react-bwin 0.3.2 → 0.3.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.
@@ -1,1106 +1,1051 @@
1
- import f, { useRef as M, useEffect as W, forwardRef as Y, useState as j, useImperativeHandle as K, useMemo as V } from "react";
2
- import { createPortal as Z } from "react-dom";
3
- var J = Object.defineProperty, Q = (e, t, i) => t in e ? J(e, t, { enumerable: !0, configurable: !0, writable: !0, value: i }) : e[t] = i, E = (e, t, i) => Q(e, typeof t != "symbol" ? t + "" : t, i);
4
- function tt(e = 0.7, t = 128) {
5
- const i = 256 - t, n = Math.floor(Math.random() * i + t), s = Math.floor(Math.random() * i + t), o = Math.floor(Math.random() * i + t), h = Math.max(0.5, Math.random() * e);
6
- return `rgba(${n}, ${s}, ${o}, ${h})`;
1
+ import e, { forwardRef as t, useEffect as n, useImperativeHandle as r, useMemo as i, useRef as a, useState as o } from "react";
2
+ import { createPortal as s } from "react-dom";
3
+ //#region node_modules/.pnpm/bwin@0.3.3/node_modules/bwin/dist/bwin.js
4
+ function c(e = .7, t = 128) {
5
+ let n = 256 - t;
6
+ return `rgba(${Math.floor(Math.random() * n + t)}, ${Math.floor(Math.random() * n + t)}, ${Math.floor(Math.random() * n + t)}, ${Math.max(.5, Math.random() * e)})`;
7
7
  }
8
- function B(e = 2, t = 3) {
9
- if (e < 0 || t < 0)
10
- throw new Error("Parameters must be non-negative numbers");
11
- const i = "ABCDEFGHIJKLMNOPQRSTUVWXYZ", n = "0123456789";
12
- let s = "";
13
- for (let o = 0; o < e; o++) {
14
- const h = Math.floor(Math.random() * i.length);
15
- s += i[h];
16
- }
17
- s += "-";
18
- for (let o = 0; o < t; o++) {
19
- const h = Math.floor(Math.random() * n.length);
20
- s += n[h];
21
- }
22
- return s;
8
+ function l(e = 2, t = 3) {
9
+ if (e < 0 || t < 0) throw Error("Parameters must be non-negative numbers");
10
+ let n = "";
11
+ for (let t = 0; t < e; t++) {
12
+ let e = Math.floor(Math.random() * 26);
13
+ n += "ABCDEFGHIJKLMNOPQRSTUVWXYZ"[e];
14
+ }
15
+ n += "-";
16
+ for (let e = 0; e < t; e++) {
17
+ let e = Math.floor(Math.random() * 10);
18
+ n += "0123456789"[e];
19
+ }
20
+ return n;
23
21
  }
24
- function z(e, t) {
25
- for (; t.firstChild; )
26
- e.append(t.firstChild);
22
+ function u(e, t) {
23
+ for (; t.firstChild;) e.append(t.firstChild);
27
24
  }
28
- function et(e, t) {
29
- const i = document.createElement("div");
30
- z(i, e), z(e, t), z(t, i);
25
+ function d(e, t) {
26
+ let n = document.createElement("div");
27
+ u(n, e), u(e, t), u(t, n);
31
28
  }
32
- function C(e) {
33
- if (typeof e == "number" && !isNaN(e))
34
- return e;
35
- if (typeof e == "string") {
36
- const t = e.trim();
37
- if (t.endsWith("%")) {
38
- const i = t.slice(0, -1);
39
- if (!i) return NaN;
40
- const n = Number(i);
41
- return isNaN(n) ? NaN : n / 100;
42
- }
43
- if (t.endsWith("px")) {
44
- const i = t.slice(0, -2);
45
- if (!i) return NaN;
46
- const n = Number(i);
47
- return isNaN(n) ? NaN : n;
48
- }
49
- return Number(t);
50
- }
51
- return NaN;
29
+ function f(e) {
30
+ if (typeof e == "number" && !isNaN(e)) return e;
31
+ if (typeof e == "string") {
32
+ let t = e.trim();
33
+ if (t.endsWith("%")) {
34
+ let e = t.slice(0, -1);
35
+ if (!e) return NaN;
36
+ let n = Number(e);
37
+ return isNaN(n) ? NaN : n / 100;
38
+ }
39
+ if (t.endsWith("px")) {
40
+ let e = t.slice(0, -2);
41
+ if (!e) return NaN;
42
+ let n = Number(e);
43
+ return isNaN(n) ? NaN : n;
44
+ }
45
+ return Number(t);
46
+ }
47
+ return NaN;
52
48
  }
53
- function it(e) {
54
- return e !== null && typeof e == "object" && !Array.isArray(e) && Object.getPrototypeOf(e) === Object.prototype;
49
+ function p(e) {
50
+ return typeof e == "object" && !!e && !Array.isArray(e) && Object.getPrototypeOf(e) === Object.prototype;
55
51
  }
56
- function nt(e, t) {
57
- for (const i in t) {
58
- if (Object.hasOwn(e, i))
59
- throw new Error(`Key "${i}" already exists in target object`);
60
- e[i] = t[i];
61
- }
62
- return e;
52
+ function m(e, t) {
53
+ for (let n in t) {
54
+ if (Object.hasOwn(e, n)) throw Error(`Key "${n}" already exists in target object`);
55
+ e[n] = t[n];
56
+ }
57
+ return e;
63
58
  }
64
- function st(e) {
65
- const t = document.createElement("template");
66
- return t.innerHTML = e.trim(), t.content;
59
+ function h(e) {
60
+ let t = document.createElement("template");
61
+ return t.innerHTML = e.trim(), t.content;
67
62
  }
68
- function N(e) {
69
- if (e == null || e === "")
70
- return null;
71
- if (typeof e == "string")
72
- try {
73
- const t = st(e);
74
- return t.childNodes.length === 1 ? t.firstChild : t;
75
- } catch {
76
- return document.createTextNode(e);
77
- }
78
- return e instanceof Node ? e : document.createTextNode(String(e));
63
+ function g(e) {
64
+ if (e == null || e === "") return null;
65
+ if (typeof e == "string") try {
66
+ let t = h(e);
67
+ return t.childNodes.length === 1 ? t.firstChild : t;
68
+ } catch {
69
+ return document.createTextNode(e);
70
+ }
71
+ return e instanceof Node ? e : document.createTextNode(String(e));
79
72
  }
80
- function R(e) {
81
- const t = parseFloat(e.style.left) || 0, i = parseFloat(e.style.top) || 0, n = parseFloat(e.style.width) || 0, s = parseFloat(e.style.height) || 0;
82
- return { left: t, top: i, width: n, height: s };
73
+ function _(e) {
74
+ return {
75
+ left: parseFloat(e.style.left) || 0,
76
+ top: parseFloat(e.style.top) || 0,
77
+ width: parseFloat(e.style.width) || 0,
78
+ height: parseFloat(e.style.height) || 0
79
+ };
83
80
  }
84
- const r = {
85
- Top: "top",
86
- Right: "right",
87
- Bottom: "bottom",
88
- Left: "left",
89
- Center: "center",
90
- Root: "root",
91
- Unknown: "unknown",
92
- Outside: "outside"
81
+ var v = {
82
+ Top: "top",
83
+ Right: "right",
84
+ Bottom: "bottom",
85
+ Left: "left",
86
+ Center: "center",
87
+ Root: "root",
88
+ Unknown: "unknown",
89
+ Outside: "outside"
93
90
  };
94
- function ot(e) {
95
- switch (e) {
96
- case r.Top:
97
- return r.Bottom;
98
- case r.Right:
99
- return r.Left;
100
- case r.Bottom:
101
- return r.Top;
102
- case r.Left:
103
- return r.Right;
104
- default:
105
- throw new Error(`[bwin] Invalid position: ${e}`);
106
- }
91
+ function y(e) {
92
+ switch (e) {
93
+ case v.Top: return v.Bottom;
94
+ case v.Right: return v.Left;
95
+ case v.Bottom: return v.Top;
96
+ case v.Left: return v.Right;
97
+ default: throw Error(`[bwin] Invalid position: ${e}`);
98
+ }
107
99
  }
108
- function ht({ width: e, height: t, x: i }) {
109
- return t / e * i;
100
+ function b({ width: e, height: t, x: n }) {
101
+ return t / e * n;
110
102
  }
111
- function rt({ width: e, height: t, y: i }) {
112
- return e / t * i;
103
+ function x({ width: e, height: t, y: n }) {
104
+ return e / t * n;
113
105
  }
114
- function at({ width: e, height: t, x: i }) {
115
- return t - t / e * i;
106
+ function ee({ width: e, height: t, x: n }) {
107
+ return t - t / e * n;
116
108
  }
117
- function lt({ width: e, height: t, y: i }) {
118
- return e - e / t * i;
109
+ function te({ width: e, height: t, y: n }) {
110
+ return e - e / t * n;
119
111
  }
120
- function dt(e, { clientX: t, clientY: i }) {
121
- const n = e.getBoundingClientRect(), { width: s, height: o } = n, h = t - n.left, a = i - n.top;
122
- if (h < 0 || h > s || a < 0 || a > o)
123
- return r.Outside;
124
- const d = 0.3, l = ht({ width: s, height: o, x: h }), c = at({ width: s, height: o, x: h }), u = rt({ width: s, height: o, y: a }), g = lt({ width: s, height: o, y: a });
125
- return h < s * (0.5 - d / 2) && a > l && a < c ? r.Left : h > s * (0.5 + d / 2) && a < l && a > c ? r.Right : a < o * (0.5 - d / 2) && h > u && h < g ? r.Top : a > o * (0.5 + d / 2) && h < u && h > g ? r.Bottom : h > s * (0.5 - d / 2) && h < s * (0.5 + d / 2) && a > o * (0.5 - d / 2) && a < o * (0.5 + d / 2) ? r.Center : r.Unknown;
112
+ function ne(e, { clientX: t, clientY: n }) {
113
+ let r = e.getBoundingClientRect(), { width: i, height: a } = r, o = t - r.left, s = n - r.top;
114
+ if (o < 0 || o > i || s < 0 || s > a) return v.Outside;
115
+ let c = .3, l = b({
116
+ width: i,
117
+ height: a,
118
+ x: o
119
+ }), u = ee({
120
+ width: i,
121
+ height: a,
122
+ x: o
123
+ }), d = x({
124
+ width: i,
125
+ height: a,
126
+ y: s
127
+ }), f = te({
128
+ width: i,
129
+ height: a,
130
+ y: s
131
+ });
132
+ return o < i * (.5 - c / 2) && s > l && s < u ? v.Left : o > i * .65 && s < l && s > u ? v.Right : s < a * (.5 - c / 2) && o > d && o < f ? v.Top : s > a * .65 && o < d && o > f ? v.Bottom : o > i * (.5 - c / 2) && o < i * .65 && s > a * (.5 - c / 2) && s < a * .65 ? v.Center : v.Unknown;
126
133
  }
127
- const ct = 100, pt = 100, v = {
128
- left: 0,
129
- top: 0,
130
- width: 150,
131
- height: 150,
132
- // Initial min values, real min width/height is calculated based on children
133
- minWidth: ct,
134
- minHeight: pt
134
+ var S = {
135
+ left: 0,
136
+ top: 0,
137
+ width: 150,
138
+ height: 150,
139
+ minWidth: 100,
140
+ minHeight: 100,
141
+ resizeStrategy: "classic"
142
+ }, C = class {
143
+ constructor({ left: e = S.left, top: t = S.top, width: n = S.width, height: r = S.height, minWidth: i = S.minWidth, minHeight: a = S.minHeight, resizeStrategy: o = S.resizeStrategy, parent: s = null, domNode: c = null, store: u = {}, position: d, id: f } = S) {
144
+ if (this.id = f ?? l(), !d) throw Error("[bwin] Sash position is required");
145
+ this.position = d, this.domNode = c, this.parent = s, this._top = t, this._left = e, this._width = n, this._height = r, this.children = [], this.minWidth = i, this.minHeight = a, this.resizeStrategy = o, this.store = u;
146
+ }
147
+ walk(e) {
148
+ this.children.forEach((t) => t.walk(e)), e(this);
149
+ }
150
+ isLeaf() {
151
+ return this.children.length === 0;
152
+ }
153
+ isSplit() {
154
+ return this.children.length > 0;
155
+ }
156
+ isLeftRightSplit() {
157
+ return this.children.some((e) => e.position === v.Left || e.position === v.Right);
158
+ }
159
+ isTopBottomSplit() {
160
+ return this.children.some((e) => e.position === v.Top || e.position === v.Bottom);
161
+ }
162
+ get leftChild() {
163
+ return this.children.find((e) => e.position === v.Left);
164
+ }
165
+ get rightChild() {
166
+ return this.children.find((e) => e.position === v.Right);
167
+ }
168
+ get topChild() {
169
+ return this.children.find((e) => e.position === v.Top);
170
+ }
171
+ get bottomChild() {
172
+ return this.children.find((e) => e.position === v.Bottom);
173
+ }
174
+ getChildren() {
175
+ let e = null, t = null, n = null, r = null;
176
+ for (let i of this.children) i.position === v.Left ? e = i : i.position === v.Right ? t = i : i.position === v.Top ? n = i : i.position === v.Bottom && (r = i);
177
+ return [
178
+ n,
179
+ t,
180
+ r,
181
+ e
182
+ ];
183
+ }
184
+ getAllLeafDescendants() {
185
+ let e = [];
186
+ return this.walk((t) => {
187
+ t.children.length === 0 && e.push(t);
188
+ }), e;
189
+ }
190
+ calcMinWidth() {
191
+ if (this.isLeaf()) return this.minWidth;
192
+ let [e, t, n, r] = this.getChildren();
193
+ if (r && t) {
194
+ let e = r.calcMinWidth() + t.calcMinWidth();
195
+ return Math.max(this.minWidth, e);
196
+ }
197
+ if (e && n) {
198
+ let t = Math.max(e.calcMinWidth(), n.calcMinWidth());
199
+ return Math.max(this.minWidth, t);
200
+ }
201
+ }
202
+ calcMinHeight() {
203
+ if (this.isLeaf()) return this.minHeight;
204
+ let [e, t, n, r] = this.getChildren();
205
+ if (r && t) {
206
+ let e = Math.max(r.calcMinHeight(), t.calcMinHeight());
207
+ return Math.max(this.minHeight, e);
208
+ }
209
+ if (e && n) {
210
+ let t = e.calcMinHeight() + n.calcMinHeight();
211
+ return Math.max(this.minHeight, t);
212
+ }
213
+ }
214
+ getById(e) {
215
+ if (this.id === e) return this;
216
+ for (let t of this.children) {
217
+ let n = t.getById(e);
218
+ if (n) return n;
219
+ }
220
+ return null;
221
+ }
222
+ swapIds(e, t) {
223
+ let n = this.getById(e), r = this.getById(t);
224
+ if (!n || !r) throw Error("[bwin] Sash not found when swapping IDs");
225
+ let i = n.id;
226
+ n.id = r.id, r.id = i;
227
+ }
228
+ getAllIds() {
229
+ let e = [this.id];
230
+ for (let t of this.children) e.push(...t.getAllIds());
231
+ return e;
232
+ }
233
+ addChild(e) {
234
+ if (this.children.length >= 2) throw Error("[bwin] Maximum 2 children allowed");
235
+ this.children.push(e);
236
+ }
237
+ getDescendantParentById(e) {
238
+ for (let t of this.children) {
239
+ if (t.id === e) return this;
240
+ let n = t.getDescendantParentById(e);
241
+ if (n) return n;
242
+ }
243
+ return null;
244
+ }
245
+ getChildSiblingById(e) {
246
+ return this.children.find((t) => t.id !== e);
247
+ }
248
+ get top() {
249
+ return this._top;
250
+ }
251
+ set top(e) {
252
+ let t = e - this._top;
253
+ this._top = e;
254
+ let [n, r, i, a] = this.getChildren();
255
+ n && i && (n.top += t, i.top += t), a && r && (a.top += t, r.top += t);
256
+ }
257
+ get left() {
258
+ return this._left;
259
+ }
260
+ set left(e) {
261
+ let t = e - this._left;
262
+ this._left = e;
263
+ let [n, r, i, a] = this.getChildren();
264
+ a && r && (a.left += t, r.left += t), n && i && (n.left += t, i.left += t);
265
+ }
266
+ get width() {
267
+ return this._width;
268
+ }
269
+ set width(e) {
270
+ let t = e - this._width;
271
+ this._width = e;
272
+ let [n, r, i, a] = this.getChildren();
273
+ if (a && r) {
274
+ let e = a.width + r.width, n = t * (a.width / e), i = e + t, o, s, c;
275
+ if (this.resizeStrategy === "natural" && this.position === v.Left ? (o = a.width, s = r.width + t, c = r.left) : this.resizeStrategy === "natural" && this.position === v.Right ? (o = a.width + t, s = r.width, c = a.left + o) : (o = a.width + n, s = i - o, c = r.left + n), t < 0) {
276
+ let e = a.calcMinWidth(), t = r.calcMinWidth();
277
+ o < e && s > t ? (o = a.width, s = i - o, c = a.left + o) : s < t && o > e && (s = r.width, o = i - s, c = a.left + o);
278
+ }
279
+ a.width = o, r.width = s, r.left = c;
280
+ }
281
+ n && i && (n.width += t, i.width += t);
282
+ }
283
+ get height() {
284
+ return this._height;
285
+ }
286
+ set height(e) {
287
+ let t = e - this._height;
288
+ this._height = e;
289
+ let [n, r, i, a] = this.getChildren();
290
+ if (n && i) {
291
+ let e = n.height + i.height, r = t * (n.height / e), a = e + t, o, s, c;
292
+ if (this.resizeStrategy === "natural" && this.position === v.Top ? (o = n.height, s = i.height + t, c = i.top) : this.resizeStrategy === "natural" && this.position === v.Bottom ? (o = n.height + t, s = i.height, c = n.top + o) : (o = n.height + r, s = a - o, c = i.top + r), t < 0) {
293
+ let e = n.calcMinHeight(), t = i.calcMinHeight();
294
+ o < e && s > t ? (o = n.height, s = a - o, c = n.top + o) : s < t && o > e && (s = i.height, o = a - s, c = n.top + o);
295
+ }
296
+ n.height = o, i.height = s, i.top = c;
297
+ }
298
+ a && r && (a.height += t, r.height += t);
299
+ }
300
+ }, w = {
301
+ size: "50%",
302
+ position: v.Left
303
+ }, T = class e {
304
+ left;
305
+ top;
306
+ width;
307
+ height;
308
+ constructor({ parentRect: e, children: t, siblingConfigNode: n, id: r, minWidth: i, minHeight: a, position: o, size: s, resizeStrategy: c, ...l }) {
309
+ this.parentRect = e, this.children = t, this.siblingConfigNode = n, this.id = r, this.minWidth = i, this.minHeight = a, this.position = this.getPosition(o), this.size = this.getSize(s), this.resizeStrategy = c, this.nonCoreData = l, this.setBounds();
310
+ }
311
+ getPosition(e) {
312
+ if (!this.siblingConfigNode) return e;
313
+ let t = y(this.siblingConfigNode.position);
314
+ if (!e) return t;
315
+ if (e !== t) throw Error("[bwin] Sibling position and current position are not opposite");
316
+ return e;
317
+ }
318
+ getSize(e) {
319
+ if (!this.siblingConfigNode) return f(e);
320
+ if (!e) {
321
+ if (this.siblingConfigNode.size < 1) return 1 - this.siblingConfigNode.size;
322
+ if (this.siblingConfigNode.position === v.Left || this.siblingConfigNode.position === v.Right) return this.parentRect.width - this.siblingConfigNode.width;
323
+ if (this.siblingConfigNode.position === v.Top || this.siblingConfigNode.position === v.Bottom) return this.parentRect.height - this.siblingConfigNode.height;
324
+ }
325
+ let t = f(e);
326
+ if (t < 1) {
327
+ if (t + this.siblingConfigNode.size !== 1) throw Error("[bwin] Sum of sibling sizes is not equal to 1");
328
+ } else {
329
+ if ((this.position === v.Left || this.position === v.Right) && t + this.siblingConfigNode.size !== this.parentRect.width) throw Error("[bwin] Sum of sibling sizes is not equal to parent width");
330
+ if ((this.position === v.Top || this.position === v.Bottom) && t + this.siblingConfigNode.size !== this.parentRect.height) throw Error("[bwin] Sum of sibling sizes is not equal to parent height");
331
+ }
332
+ return t;
333
+ }
334
+ setBounds() {
335
+ if (this.position === v.Root) this.left = 0, this.top = 0, this.width = this.parentRect.width, this.height = this.parentRect.height;
336
+ else if (this.position === v.Left) {
337
+ let e = this.size < 1 ? this.parentRect.width * this.size : this.size;
338
+ this.left = this.parentRect.left, this.top = this.parentRect.top, this.width = e, this.height = this.parentRect.height;
339
+ } else if (this.position === v.Right) {
340
+ let e = this.size < 1 ? this.parentRect.width * this.size : this.size;
341
+ this.left = this.parentRect.left + this.parentRect.width - e, this.top = this.parentRect.top, this.width = e, this.height = this.parentRect.height;
342
+ } else if (this.position === v.Top) {
343
+ let e = this.size < 1 ? this.parentRect.height * this.size : this.size;
344
+ this.left = this.parentRect.left, this.top = this.parentRect.top, this.width = this.parentRect.width, this.height = e;
345
+ } else if (this.position === v.Bottom) {
346
+ let e = this.size < 1 ? this.parentRect.height * this.size : this.size;
347
+ this.left = this.parentRect.left, this.top = this.parentRect.top + this.parentRect.height - e, this.width = this.parentRect.width, this.height = e;
348
+ }
349
+ }
350
+ createSash({ resizeStrategy: e } = {}) {
351
+ return new C({
352
+ left: this.left,
353
+ top: this.top,
354
+ width: this.width,
355
+ height: this.height,
356
+ position: this.position,
357
+ id: this.id,
358
+ minWidth: this.minWidth,
359
+ minHeight: this.minHeight,
360
+ resizeStrategy: e || this.resizeStrategy,
361
+ store: this.nonCoreData
362
+ });
363
+ }
364
+ normConfig(e) {
365
+ if (p(e)) return e;
366
+ if (Array.isArray(e)) return { children: e };
367
+ if (typeof e == "string" || typeof e == "number") {
368
+ let t = f(e);
369
+ if (isNaN(t)) throw Error(`[bwin] Invalid size value: ${t}`);
370
+ return { size: e };
371
+ } else if (e == null) return {};
372
+ else throw Error(`[bwin] Invalid config value: ${e}`);
373
+ }
374
+ createPrimaryConfigNode({ size: t, position: n, children: r, id: i, minWidth: a, minHeight: o, ...s }) {
375
+ return new e({
376
+ parentRect: this,
377
+ size: t ?? w.size,
378
+ position: n ?? w.position,
379
+ children: r,
380
+ id: i,
381
+ minWidth: a,
382
+ minHeight: o,
383
+ ...s
384
+ });
385
+ }
386
+ createSecondaryConfigNode({ size: t, position: n, children: r, id: i, minWidth: a, minHeight: o, ...s }, c) {
387
+ return new e({
388
+ parentRect: this,
389
+ size: t,
390
+ position: n,
391
+ children: r,
392
+ siblingConfigNode: c,
393
+ id: i,
394
+ minWidth: a,
395
+ minHeight: o,
396
+ ...s
397
+ });
398
+ }
399
+ buildSashTree({ resizeStrategy: e } = {}) {
400
+ let t = this.createSash({ resizeStrategy: e });
401
+ if (!Array.isArray(this.children) || this.children.length === 0) return t;
402
+ let n = this.normConfig(this.children[0]), r = this.normConfig(this.children.at(1)), i, a;
403
+ if (!n.size && !n.position && r ? (r.position ||= v.Right, i = this.createPrimaryConfigNode(r), a = this.createSecondaryConfigNode(n, i)) : (i = this.createPrimaryConfigNode(n), a = this.createSecondaryConfigNode(r, i)), i && a) {
404
+ let n = i.buildSashTree({ resizeStrategy: e }), r = a.buildSashTree({ resizeStrategy: e });
405
+ n.parent = t, r.parent = t, t.children.push(n), t.children.push(r);
406
+ }
407
+ return t;
408
+ }
409
+ }, E = {
410
+ width: 333,
411
+ height: 333
412
+ }, D = {
413
+ fitContainer: !1,
414
+ theme: ""
415
+ }, O = class extends T {
416
+ constructor({ id: e, children: t, width: n = E.width, height: r = E.height, fitContainer: i = D.fitContainer, theme: a = D.theme, ...o } = {
417
+ ...E,
418
+ ...D
419
+ }) {
420
+ super({
421
+ id: e,
422
+ children: t,
423
+ size: NaN,
424
+ position: v.Root,
425
+ parentRect: {
426
+ width: n,
427
+ height: r
428
+ },
429
+ ...o
430
+ }), this.fitContainer = i, this.theme = a;
431
+ }
432
+ }, re = class extends C {
433
+ constructor(e = S) {
434
+ super({
435
+ ...e,
436
+ position: v.Root
437
+ }), Object.assign(this, D);
438
+ }
135
439
  };
136
- class b {
137
- constructor({
138
- left: t = v.left,
139
- top: i = v.top,
140
- width: n = v.width,
141
- height: s = v.height,
142
- minWidth: o = v.minWidth,
143
- minHeight: h = v.minHeight,
144
- domNode: a = null,
145
- store: d = {},
146
- position: l,
147
- id: c
148
- } = v) {
149
- if (this.id = c ?? B(), !l)
150
- throw new Error("[bwin] Sash position is required");
151
- this.position = l, this.domNode = a, this._top = i, this._left = t, this._width = n, this._height = s, this.children = [], this.minWidth = o, this.minHeight = h, this.store = d;
152
- }
153
- walk(t) {
154
- this.children.forEach((i) => i.walk(t)), t(this);
155
- }
156
- isLeaf() {
157
- return this.children.length === 0;
158
- }
159
- // A sash that doesn't split is a leaf, in UI it's a pane
160
- isSplit() {
161
- return this.children.length > 0;
162
- }
163
- isLeftRightSplit() {
164
- return this.children.some(
165
- (t) => t.position === r.Left || t.position === r.Right
166
- );
167
- }
168
- isTopBottomSplit() {
169
- return this.children.some(
170
- (t) => t.position === r.Top || t.position === r.Bottom
171
- );
172
- }
173
- get leftChild() {
174
- return this.children.find((t) => t.position === r.Left);
175
- }
176
- get rightChild() {
177
- return this.children.find((t) => t.position === r.Right);
178
- }
179
- get topChild() {
180
- return this.children.find((t) => t.position === r.Top);
181
- }
182
- get bottomChild() {
183
- return this.children.find((t) => t.position === r.Bottom);
184
- }
185
- getChildren() {
186
- let t = null, i = null, n = null, s = null;
187
- for (const o of this.children)
188
- o.position === r.Left ? t = o : o.position === r.Right ? i = o : o.position === r.Top ? n = o : o.position === r.Bottom && (s = o);
189
- return [n, i, s, t];
190
- }
191
- getAllLeafDescendants() {
192
- const t = [];
193
- return this.walk((i) => {
194
- i.children.length === 0 && t.push(i);
195
- }), t;
196
- }
197
- calcMinWidth() {
198
- if (this.isLeaf())
199
- return this.minWidth;
200
- const [t, i, n, s] = this.getChildren();
201
- if (s && i) {
202
- const o = s.calcMinWidth() + i.calcMinWidth();
203
- return Math.max(this.minWidth, o);
204
- }
205
- if (t && n) {
206
- const o = Math.max(t.calcMinWidth(), n.calcMinWidth());
207
- return Math.max(this.minWidth, o);
208
- }
209
- }
210
- calcMinHeight() {
211
- if (this.isLeaf())
212
- return this.minHeight;
213
- const [t, i, n, s] = this.getChildren();
214
- if (s && i) {
215
- const o = Math.max(s.calcMinHeight(), i.calcMinHeight());
216
- return Math.max(this.minHeight, o);
217
- }
218
- if (t && n) {
219
- const o = t.calcMinHeight() + n.calcMinHeight();
220
- return Math.max(this.minHeight, o);
221
- }
222
- }
223
- // Get self or descendant by id
224
- getById(t) {
225
- if (this.id === t)
226
- return this;
227
- for (const i of this.children) {
228
- const n = i.getById(t);
229
- if (n)
230
- return n;
231
- }
232
- return null;
233
- }
234
- // Get all ids of self and descendants
235
- getAllIds() {
236
- const t = [this.id];
237
- for (const i of this.children)
238
- t.push(...i.getAllIds());
239
- return t;
240
- }
241
- addChild(t) {
242
- if (this.children.length >= 2)
243
- throw new Error("[bwin] Maximum 2 children allowed");
244
- this.children.push(t);
245
- }
246
- getDescendantParentById(t) {
247
- for (const i of this.children) {
248
- if (i.id === t)
249
- return this;
250
- const n = i.getDescendantParentById(t);
251
- if (n)
252
- return n;
253
- }
254
- return null;
255
- }
256
- getChildSiblingById(t) {
257
- return this.children.find((i) => i.id !== t);
258
- }
259
- get top() {
260
- return this._top;
261
- }
262
- set top(t) {
263
- const i = t - this._top;
264
- this._top = t;
265
- const [n, s, o, h] = this.getChildren();
266
- n && o && (n.top += i, o.top += i), h && s && (h.top += i, s.top += i);
267
- }
268
- get left() {
269
- return this._left;
270
- }
271
- set left(t) {
272
- const i = t - this._left;
273
- this._left = t;
274
- const [n, s, o, h] = this.getChildren();
275
- h && s && (h.left += i, s.left += i), n && o && (n.left += i, o.left += i);
276
- }
277
- get width() {
278
- return this._width;
279
- }
280
- set width(t) {
281
- const i = t - this._width;
282
- this._width = t;
283
- const [n, s, o, h] = this.getChildren();
284
- if (h && s) {
285
- const a = h.width + s.width, d = i * (h.width / a), l = a + i;
286
- let c = h.width + d, u = l - c, g = s.left + d;
287
- const m = h.calcMinWidth(), w = s.calcMinWidth();
288
- i < 0 && (c < m && u > w ? (c = h.width, u = l - c, g = h.left + c) : u < w && c > m && (u = s.width, c = l - u, g = h.left + c)), h.width = c, s.width = u, s.left = g;
289
- }
290
- n && o && (n.width += i, o.width += i);
291
- }
292
- get height() {
293
- return this._height;
294
- }
295
- set height(t) {
296
- const i = t - this._height;
297
- this._height = t;
298
- const [n, s, o, h] = this.getChildren();
299
- if (n && o) {
300
- const a = n.height + o.height, d = i * (n.height / a), l = a + i;
301
- let c = n.height + d, u = l - c, g = o.top + d;
302
- if (i < 0) {
303
- const m = n.calcMinHeight(), w = o.calcMinHeight();
304
- c < m && u > w ? (c = n.height, u = l - c, g = n.top + c) : u < w && c > m && (u = o.height, c = l - u, g = n.top + c);
305
- }
306
- n.height = c, o.height = u, o.top = g;
307
- }
308
- h && s && (h.height += i, s.height += i);
309
- }
440
+ function ie(e) {
441
+ let t = document.createElement("bw-pane");
442
+ return t.style.top = `${e.top}px`, t.style.left = `${e.left}px`, t.style.width = `${e.width}px`, t.style.height = `${e.height}px`, t.setAttribute("sash-id", e.id), t.setAttribute("position", e.position), t;
310
443
  }
311
- const H = {
312
- size: "50%",
313
- position: r.Left
314
- };
315
- class P {
316
- constructor({
317
- parentRect: t,
318
- children: i,
319
- siblingConfigNode: n,
320
- id: s,
321
- minWidth: o,
322
- minHeight: h,
323
- position: a,
324
- size: d,
325
- ...l
326
- }) {
327
- E(this, "left"), E(this, "top"), E(this, "width"), E(this, "height"), this.parentRect = t, this.children = i, this.siblingConfigNode = n, this.id = s, this.minWidth = o, this.minHeight = h, this.position = this.getPosition(a), this.size = this.getSize(d), this.nonCoreData = l, this.setBounds();
328
- }
329
- getPosition(t) {
330
- if (!this.siblingConfigNode)
331
- return t;
332
- const i = ot(this.siblingConfigNode.position);
333
- if (!t)
334
- return i;
335
- if (t !== i)
336
- throw new Error("[bwin] Sibling position and current position are not opposite");
337
- return t;
338
- }
339
- getSize(t) {
340
- if (!this.siblingConfigNode)
341
- return C(t);
342
- if (!t) {
343
- if (this.siblingConfigNode.size < 1)
344
- return 1 - this.siblingConfigNode.size;
345
- if (this.siblingConfigNode.position === r.Left || this.siblingConfigNode.position === r.Right)
346
- return this.parentRect.width - this.siblingConfigNode.width;
347
- if (this.siblingConfigNode.position === r.Top || this.siblingConfigNode.position === r.Bottom)
348
- return this.parentRect.height - this.siblingConfigNode.height;
349
- }
350
- const i = C(t);
351
- if (i < 1) {
352
- if (i + this.siblingConfigNode.size !== 1)
353
- throw new Error("[bwin] Sum of sibling sizes is not equal to 1");
354
- } else {
355
- if ((this.position === r.Left || this.position === r.Right) && i + this.siblingConfigNode.size !== this.parentRect.width)
356
- throw new Error("[bwin] Sum of sibling sizes is not equal to parent width");
357
- if ((this.position === r.Top || this.position === r.Bottom) && i + this.siblingConfigNode.size !== this.parentRect.height)
358
- throw new Error("[bwin] Sum of sibling sizes is not equal to parent height");
359
- }
360
- return i;
361
- }
362
- setBounds() {
363
- if (this.position === r.Root)
364
- this.left = 0, this.top = 0, this.width = this.parentRect.width, this.height = this.parentRect.height;
365
- else if (this.position === r.Left) {
366
- const t = this.size < 1 ? this.parentRect.width * this.size : this.size;
367
- this.left = this.parentRect.left, this.top = this.parentRect.top, this.width = t, this.height = this.parentRect.height;
368
- } else if (this.position === r.Right) {
369
- const t = this.size < 1 ? this.parentRect.width * this.size : this.size;
370
- this.left = this.parentRect.left + this.parentRect.width - t, this.top = this.parentRect.top, this.width = t, this.height = this.parentRect.height;
371
- } else if (this.position === r.Top) {
372
- const t = this.size < 1 ? this.parentRect.height * this.size : this.size;
373
- this.left = this.parentRect.left, this.top = this.parentRect.top, this.width = this.parentRect.width, this.height = t;
374
- } else if (this.position === r.Bottom) {
375
- const t = this.size < 1 ? this.parentRect.height * this.size : this.size;
376
- this.left = this.parentRect.left, this.top = this.parentRect.top + this.parentRect.height - t, this.width = this.parentRect.width, this.height = t;
377
- }
378
- }
379
- createSash() {
380
- return new b({
381
- left: this.left,
382
- top: this.top,
383
- width: this.width,
384
- height: this.height,
385
- position: this.position,
386
- id: this.id,
387
- minWidth: this.minWidth,
388
- minHeight: this.minHeight,
389
- store: this.nonCoreData
390
- });
391
- }
392
- normConfig(t) {
393
- if (it(t))
394
- return t;
395
- if (Array.isArray(t))
396
- return {
397
- children: t
398
- };
399
- if (typeof t == "string" || typeof t == "number") {
400
- const i = C(t);
401
- if (isNaN(i))
402
- throw new Error(`[bwin] Invalid size value: ${i}`);
403
- return {
404
- size: t
405
- };
406
- } else {
407
- if (t == null)
408
- return {};
409
- throw new Error(`[bwin] Invalid config value: ${t}`);
410
- }
411
- }
412
- createPrimaryConfigNode({ size: t, position: i, children: n, id: s, minWidth: o, minHeight: h, ...a }) {
413
- return new P({
414
- parentRect: this,
415
- size: t ?? H.size,
416
- position: i ?? H.position,
417
- children: n,
418
- id: s,
419
- minWidth: o,
420
- minHeight: h,
421
- ...a
422
- });
423
- }
424
- createSecondaryConfigNode({ size: t, position: i, children: n, id: s, minWidth: o, minHeight: h, ...a }, d) {
425
- return new P({
426
- parentRect: this,
427
- size: t,
428
- position: i,
429
- children: n,
430
- siblingConfigNode: d,
431
- id: s,
432
- minWidth: o,
433
- minHeight: h,
434
- ...a
435
- });
436
- }
437
- buildSashTree() {
438
- const t = this.createSash();
439
- if (!Array.isArray(this.children) || this.children.length === 0)
440
- return t;
441
- const i = this.normConfig(this.children[0]), n = this.normConfig(this.children.at(1));
442
- let s, o;
443
- return !i.size && !i.position && n ? (n.position || (n.position = r.Right), s = this.createPrimaryConfigNode(n), o = this.createSecondaryConfigNode(
444
- i,
445
- s
446
- )) : (s = this.createPrimaryConfigNode(i), o = this.createSecondaryConfigNode(
447
- n,
448
- s
449
- )), s && o && (t.children.push(s.buildSashTree()), t.children.push(o.buildSashTree())), t;
450
- }
451
- }
452
- const L = {
453
- width: 333,
454
- height: 333
455
- }, T = {
456
- fitContainer: !1
457
- };
458
- class ut extends P {
459
- constructor({
460
- id: t,
461
- children: i,
462
- width: n = L.width,
463
- height: s = L.height,
464
- fitContainer: o = T.fitContainer,
465
- ...h
466
- } = {
467
- ...L,
468
- ...T
469
- }) {
470
- super({
471
- id: t,
472
- children: i,
473
- size: NaN,
474
- position: r.Root,
475
- parentRect: { width: n, height: s },
476
- ...h
477
- }), this.fitContainer = o;
478
- }
479
- }
480
- class gt extends b {
481
- constructor(t = v) {
482
- super({ ...t, position: r.Root }), Object.assign(this, T);
483
- }
484
- }
485
- function A(e) {
486
- const t = document.createElement("bw-pane");
487
- return t.style.top = `${e.top}px`, t.style.left = `${e.left}px`, t.style.width = `${e.width}px`, t.style.height = `${e.height}px`, t.setAttribute("sash-id", e.id), t.setAttribute("position", e.position), t;
444
+ function k(e) {
445
+ let t = e.domNode;
446
+ return t.style.top = `${e.top}px`, t.style.left = `${e.left}px`, t.style.width = `${e.width}px`, t.style.height = `${e.height}px`, t.setAttribute("position", e.position), t;
488
447
  }
489
- function ft(e) {
490
- const t = e.domNode;
491
- return t.style.top = `${e.top}px`, t.style.left = `${e.left}px`, t.style.width = `${e.width}px`, t.style.height = `${e.height}px`, t.setAttribute("position", e.position), t;
448
+ function A(e, { size: t, id: n }) {
449
+ let r = f(t), i = e.width / 2;
450
+ r && (i = r < 1 ? e.width * r : r);
451
+ let a = new C({
452
+ id: n,
453
+ top: e.top,
454
+ left: e.left,
455
+ width: i,
456
+ height: e.height,
457
+ position: v.Left
458
+ }), o = new C({
459
+ id: e.id,
460
+ top: e.top,
461
+ left: e.left + a.width,
462
+ width: e.width - i,
463
+ height: e.height,
464
+ position: v.Right,
465
+ domNode: e.domNode
466
+ });
467
+ return e.addChild(a), e.addChild(o), e.domNode = null, e.id = l(), a;
492
468
  }
493
- function mt(e, { size: t }) {
494
- const i = C(t);
495
- let n = e.width / 2;
496
- i && (i < 1 ? n = e.width * i : n = i);
497
- const s = new b({
498
- top: e.top,
499
- left: e.left,
500
- width: n,
501
- height: e.height,
502
- position: r.Left
503
- }), o = new b({
504
- top: e.top,
505
- left: e.left + s.width,
506
- width: e.width - n,
507
- height: e.height,
508
- position: r.Right
509
- }), h = A(o);
510
- return o.domNode = h, z(h, e.domNode), e.addChild(s), e.addChild(o), s;
469
+ function j(e, { size: t, id: n }) {
470
+ let r = f(t), i = e.width / 2;
471
+ r && (i = r < 1 ? e.width * r : r);
472
+ let a = new C({
473
+ id: e.id,
474
+ left: e.left,
475
+ top: e.top,
476
+ width: e.width - i,
477
+ height: e.height,
478
+ position: v.Left,
479
+ domNode: e.domNode
480
+ }), o = new C({
481
+ id: n,
482
+ left: e.left + a.width,
483
+ top: e.top,
484
+ width: i,
485
+ height: e.height,
486
+ position: v.Right
487
+ });
488
+ return e.addChild(a), e.addChild(o), e.domNode = null, e.id = l(), o;
511
489
  }
512
- function wt(e, { size: t }) {
513
- const i = C(t);
514
- let n = e.width / 2;
515
- i && (i < 1 ? n = e.width * i : n = i);
516
- const s = new b({
517
- left: e.left,
518
- top: e.top,
519
- width: e.width - n,
520
- height: e.height,
521
- position: r.Left
522
- }), o = new b({
523
- left: e.left + s.width,
524
- top: e.top,
525
- width: n,
526
- height: e.height,
527
- position: r.Right
528
- }), h = A(s);
529
- return s.domNode = h, z(h, e.domNode), e.addChild(s), e.addChild(o), o;
490
+ function M(e, { size: t, id: n }) {
491
+ let r = f(t), i = e.height / 2;
492
+ r && (i = r < 1 ? e.height * r : r);
493
+ let a = new C({
494
+ id: n,
495
+ left: e.left,
496
+ top: e.top,
497
+ width: e.width,
498
+ height: i,
499
+ position: v.Top
500
+ }), o = new C({
501
+ id: e.id,
502
+ left: e.left,
503
+ top: e.top + a.height,
504
+ width: e.width,
505
+ height: e.height - i,
506
+ position: v.Bottom,
507
+ domNode: e.domNode
508
+ });
509
+ return e.addChild(a), e.addChild(o), e.domNode = null, e.id = l(), a;
530
510
  }
531
- function bt(e, { size: t }) {
532
- const i = C(t);
533
- let n = e.height / 2;
534
- i && (i < 1 ? n = e.height * i : n = i);
535
- const s = new b({
536
- left: e.left,
537
- top: e.top,
538
- width: e.width,
539
- height: n,
540
- position: r.Top
541
- }), o = new b({
542
- left: e.left,
543
- top: e.top + s.height,
544
- width: e.width,
545
- height: e.height - n,
546
- position: r.Bottom
547
- }), h = A(o);
548
- return o.domNode = h, z(h, e.domNode), e.addChild(s), e.addChild(o), s;
511
+ function N(e, { size: t, id: n }) {
512
+ let r = f(t), i = e.height / 2;
513
+ r && (i = r < 1 ? e.height * r : r);
514
+ let a = new C({
515
+ id: e.id,
516
+ top: e.top,
517
+ left: e.left,
518
+ width: e.width,
519
+ height: e.height - i,
520
+ position: v.Top,
521
+ domNode: e.domNode
522
+ }), o = new C({
523
+ id: n,
524
+ top: e.top + a.height,
525
+ left: e.left,
526
+ width: e.width,
527
+ height: i,
528
+ position: v.Bottom
529
+ });
530
+ return e.addChild(a), e.addChild(o), e.domNode = null, e.id = l(), o;
549
531
  }
550
- function Et(e, { size: t }) {
551
- const i = C(t);
552
- let n = e.height / 2;
553
- i && (i < 1 ? n = e.height * i : n = i);
554
- const s = new b({
555
- top: e.top,
556
- left: e.left,
557
- width: e.width,
558
- height: e.height - n,
559
- position: r.Top
560
- }), o = new b({
561
- top: e.top + s.height,
562
- left: e.left,
563
- width: e.width,
564
- height: n,
565
- position: r.Bottom
566
- }), h = A(s);
567
- return s.domNode = h, z(h, e.domNode), e.addChild(s), e.addChild(o), o;
532
+ function P(e, { position: t, size: n, id: r, minWidth: i, minHeight: a }) {
533
+ if (t === v.Left) return A(e, {
534
+ size: n,
535
+ id: r
536
+ });
537
+ if (t === v.Right) return j(e, {
538
+ size: n,
539
+ id: r
540
+ });
541
+ if (t === v.Top) return M(e, {
542
+ size: n,
543
+ id: r
544
+ });
545
+ if (t === v.Bottom) return N(e, {
546
+ size: n,
547
+ id: r
548
+ });
568
549
  }
569
- function yt(e, { position: t, size: i, minWidth: n, minHeight: s }) {
570
- if (t === r.Left)
571
- return mt(e, { size: i });
572
- if (t === r.Right)
573
- return wt(e, { size: i });
574
- if (t === r.Top)
575
- return bt(e, { size: i });
576
- if (t === r.Bottom)
577
- return Et(e, { size: i });
550
+ function F(e) {
551
+ if (e.tagName === "BW-PANE") return e.getAttribute("sash-id");
552
+ let t = e.closest("bw-pane");
553
+ if (!t) throw Error("[bwin] Pane element not found");
554
+ return t.getAttribute("sash-id");
578
555
  }
579
- const vt = {
580
- createPane(e) {
581
- const t = A(e);
582
- return e.store.droppable === !1 && t.setAttribute("can-drop", "false"), t;
583
- },
584
- // Intended to be overridden
585
- onPaneCreate(e, t) {
586
- t.store.content && e.append(N(t.store.content)), this != null && this.debug && (e.style.backgroundColor = tt(), e.innerHTML = "", e.append(I(e)));
587
- },
588
- updatePane(e) {
589
- return ft(e);
590
- },
591
- // Intended to be overridden
592
- onPaneUpdate(e, t) {
593
- this != null && this.debug && (e.innerHTML = "", e.append(I(e)));
594
- },
595
- /**
596
- * Add a pane into the target pane. The two panes become next to each other
597
- *
598
- * @param {string} targetPaneSashId - The Sash ID of the target pane that the new pane moves into
599
- * @param {'top'|'right'|'bottom'|'left'} position - The position of the new pane relative to the target pane
600
- * @returns {Sash} - The newly created sash
601
- */
602
- addPane(e, { position: t, size: i }) {
603
- if (!t) throw new Error("[bwin] Position is required when adding pane");
604
- const n = this.rootSash.getById(e);
605
- if (!n) throw new Error("[bwin] Parent sash not found when adding pane");
606
- const s = yt(n, { position: t, size: i });
607
- return n.id = B(), this.update(), s;
608
- },
609
- /**
610
- * Remove a pane
611
- *
612
- * @param {string} sashId - The Sash ID of the pane to be removed
613
- */
614
- removePane(e) {
615
- const t = this.rootSash.getDescendantParentById(e);
616
- if (!t) throw new Error("[bwin] Parent sash not found when removing pane");
617
- const i = t.getChildSiblingById(e);
618
- t.id = B(), i.children.length === 0 ? (t.domNode = i.domNode, t.domNode.setAttribute("sash-id", t.id), t.children = []) : (t.children = i.children, i.position === r.Left ? i.width = t.width : i.position === r.Right ? (i.width = t.width, i.left = t.left) : i.position === r.Top ? i.height = t.height : i.position === r.Bottom && (i.height = t.height, i.top = t.top)), this.update();
619
- }
556
+ var I = {
557
+ createPane(e) {
558
+ let t = ie(e);
559
+ return e.store.droppable === !1 && t.setAttribute("can-drop", "false"), t;
560
+ },
561
+ onPaneCreate(e, t) {
562
+ t.store.content && e.append(g(t.store.content)), this?.debug && (e.style.backgroundColor = c(), e.innerHTML = "", e.append(L(e)));
563
+ },
564
+ updatePane(e) {
565
+ return k(e);
566
+ },
567
+ onPaneUpdate(e, t) {
568
+ this?.debug && (e.innerHTML = "", e.append(L(e)));
569
+ },
570
+ addPane(e, { position: t, size: n, id: r }) {
571
+ if (!t) throw Error("[bwin] Position is required when adding pane");
572
+ let i = this.rootSash.getById(e);
573
+ if (!i) throw Error("[bwin] Parent sash not found when adding pane");
574
+ let a = P(i, {
575
+ position: t,
576
+ size: n,
577
+ id: r
578
+ });
579
+ return this.update(), a;
580
+ },
581
+ removePane(e) {
582
+ let t = this.rootSash.getDescendantParentById(e);
583
+ if (!t) throw Error("[bwin] Parent sash not found when removing pane");
584
+ let n = t.getChildSiblingById(e);
585
+ n.children.length === 0 ? (t.id = n.id, t.domNode = n.domNode, t.domNode.setAttribute("sash-id", n.id), t.children = []) : (t.id = l(), t.children = n.children, n.position === v.Left ? n.width = t.width : n.position === v.Right ? (n.width = t.width, n.left = t.left) : n.position === v.Top ? n.height = t.height : n.position === v.Bottom && (n.height = t.height, n.top = t.top)), this.update();
586
+ },
587
+ swapPanes(e, t) {
588
+ let n = F(e), r = F(t), i = e.getAttribute("can-drop") !== "false", a = t.getAttribute("can-drop") !== "false";
589
+ this.rootSash.swapIds(n, r), d(e, this.activeDropPaneEl), e.setAttribute("sash-id", r), t.setAttribute("sash-id", n), e.setAttribute("can-drop", a), t.setAttribute("can-drop", i);
590
+ }
620
591
  };
621
- function I(e) {
622
- const t = document.createElement("pre");
623
- t.style.fontSize = "10px";
624
- const i = `
592
+ function L(e) {
593
+ let t = document.createElement("pre");
594
+ return t.style.fontSize = "10px", t.innerHTML = `
625
595
  ${e.getAttribute("sash-id")}
626
596
  ${e.getAttribute("position")}
627
597
  top: ${e.style.top}
628
598
  left: ${e.style.left}
629
599
  width: ${e.style.width}
630
600
  height: ${e.style.height}
631
- `;
632
- return t.innerHTML = i.trim(), t;
601
+ `.trim(), t;
633
602
  }
634
- const Nt = {
635
- createWindow() {
636
- const e = document.createElement("bw-window");
637
- return e.style.width = `${this.rootSash.width}px`, e.style.height = `${this.rootSash.height}px`, e.setAttribute("root-sash-id", this.rootSash.id), e;
638
- },
639
- glaze() {
640
- this.rootSash.walk((e) => {
641
- let t = null;
642
- e.children.length > 0 ? (t = this.createMuntin(e), this.onMuntinCreate(t, e), this.windowElement.append(t)) : (t = this.createPane(e), this.onPaneCreate(t, e), this.windowElement.prepend(t)), e.domNode = t;
643
- });
644
- },
645
- update() {
646
- this.windowElement.style.width = `${this.rootSash.width}px`, this.windowElement.style.height = `${this.rootSash.height}px`;
647
- const e = this.rootSash.getAllIds(), t = [];
648
- this.windowElement.querySelectorAll("[sash-id]").forEach((i) => {
649
- const n = i.getAttribute("sash-id");
650
- t.push(n), e.includes(n) || i.remove();
651
- }), this.rootSash.walk((i) => {
652
- i.children.length > 0 ? t.includes(i.id) ? (this.updateMuntin(i), this.onMuntinUpdate(i.domNode, i)) : (i.domNode = this.createMuntin(i), this.windowElement.append(i.domNode)) : t.includes(i.id) ? (this.updatePane(i), this.onPaneUpdate(i.domNode, i)) : (i.domNode || (i.domNode = this.createPane(i)), this.windowElement.prepend(i.domNode));
653
- });
654
- }
655
- }, zt = {
656
- muntinSize: 4,
657
- createMuntin(e) {
658
- const t = document.createElement("bw-muntin"), i = e.leftChild, n = e.topChild;
659
- return i ? (t.style.width = `${this.muntinSize}px`, t.style.height = `${e.height}px`, t.style.top = `${e.top}px`, t.style.left = `${e.left + i.width - this.muntinSize / 2}px`, t.setAttribute("vertical", "")) : n && (t.style.width = `${e.width}px`, t.style.height = `${this.muntinSize}px`, t.style.top = `${e.top + n.height - this.muntinSize / 2}px`, t.style.left = `${e.left}px`, t.setAttribute("horizontal", "")), t.setAttribute("sash-id", e.id), e.store.resizable === !1 && t.setAttribute("resizable", "false"), t;
660
- },
661
- onMuntinCreate(e, t) {
662
- },
663
- updateMuntin(e) {
664
- const t = e.domNode, i = e.leftChild, n = e.topChild;
665
- i ? (t.style.height = `${e.height}px`, t.style.top = `${e.top}px`, t.style.left = `${e.left + i.width - this.muntinSize / 2}px`) : n && (t.style.width = `${e.width}px`, t.style.top = `${e.top + n.height - this.muntinSize / 2}px`, t.style.left = `${e.left}px`);
666
- },
667
- onMuntinUpdate(e, t) {
668
- }
669
- }, Ct = {
670
- fitContainer: !1,
671
- fit() {
672
- this.rootSash.width = this.containerElement.clientWidth, this.rootSash.height = this.containerElement.clientHeight, this.update();
673
- },
674
- enableFitContainer() {
675
- new ResizeObserver((e) => {
676
- for (const t of e)
677
- t.target === this.containerElement && this.fitContainer && this.fit();
678
- }).observe(this.containerElement);
679
- }
680
- }, St = {
681
- activeMuntinSash: null,
682
- isResizeStarted: !1,
683
- isDropStarted: !1,
684
- lastX: 0,
685
- lastY: 0,
686
- applyResizeStyles() {
687
- this.activeMuntinSash.domNode.hasAttribute("vertical") ? document.body.classList.add("body--bw-resize-x") : this.activeMuntinSash.domNode.hasAttribute("horizontal") && document.body.classList.add("body--bw-resize-y");
688
- },
689
- revertResizeStyles() {
690
- document.body.classList.remove("body--bw-resize-x"), document.body.classList.remove("body--bw-resize-y");
691
- },
692
- enableResize() {
693
- document.addEventListener("mousedown", (e) => {
694
- if (e.target.tagName !== "BW-MUNTIN" || e.target.getAttribute("resizable") === "false") return;
695
- const t = e.target.getAttribute("sash-id");
696
- this.activeMuntinSash = this.rootSash.getById(t), this.activeMuntinSash && (this.isResizeStarted = !0, this.lastX = e.pageX, this.lastY = e.pageY, this.applyResizeStyles());
697
- }), document.addEventListener("mousemove", (e) => {
698
- if (!this.isResizeStarted || !this.activeMuntinSash) return;
699
- const [t, i, n, s] = this.activeMuntinSash.getChildren(), o = this.activeMuntinSash.isLeftRightSplit(), h = this.activeMuntinSash.isTopBottomSplit();
700
- if (o && s && i) {
701
- const a = e.pageX - this.lastX, d = s.width + a, l = i.width - a;
702
- if (a > 0 && l <= i.calcMinWidth() || a < 0 && d <= s.calcMinWidth()) return;
703
- s.width = d, i.width = l, i.left = i.left + a, this.update(), this.lastX = e.pageX;
704
- } else if (h && t && n) {
705
- const a = e.pageY - this.lastY, d = t.height + a, l = n.height - a;
706
- if (a > 0 && l <= n.calcMinHeight() || a < 0 && d <= t.calcMinHeight()) return;
707
- t.height = d, n.height = l, n.top = n.top + a, this.update(), this.lastY = e.pageY;
708
- }
709
- }), document.addEventListener("mouseup", () => {
710
- this.isResizeStarted = !1, this.activeMuntinSash = null, this.revertResizeStyles();
711
- });
712
- }
713
- }, At = {
714
- activeDropPaneEl: null,
715
- // Intended to be overridden in `BinaryWindow` class
716
- onPaneDrop(e, t) {
717
- },
718
- enableDrop() {
719
- this.windowElement.addEventListener("dragover", (e) => {
720
- e.preventDefault();
721
- const t = e.target.matches("bw-pane") ? e.target : e.target.closest("bw-pane");
722
- if (!t || (t !== this.activeDropPaneEl && (this.activeDropPaneEl && this.activeDropPaneEl.removeAttribute("drop-area"), this.activeDropPaneEl = t), t.getAttribute("can-drop") === "false")) return;
723
- const i = dt(t, e);
724
- t.setAttribute("drop-area", i);
725
- }), this.windowElement.addEventListener("dragleave", (e) => {
726
- e.currentTarget.contains(e.relatedTarget) && e.currentTarget !== e.relatedTarget || this.activeDropPaneEl && (this.activeDropPaneEl.removeAttribute("drop-area"), this.activeDropPaneEl = null);
727
- }), this.windowElement.addEventListener("drop", (e) => {
728
- if (!this.activeDropPaneEl || this.activeDropPaneEl.getAttribute("can-drop") === "false") return;
729
- const t = this.activeDropPaneEl.getAttribute("sash-id"), i = this.rootSash.getById(t);
730
- this.onPaneDrop(e, i), typeof i.store.onDrop == "function" && i.store.onDrop(e, i), this.activeDropPaneEl.removeAttribute("drop-area"), this.activeDropPaneEl = null;
731
- });
732
- }
733
- }, Mt = !1;
734
- class O {
735
- constructor(t) {
736
- E(this, "windowElement", null), E(this, "containerElement", null), E(this, "debug", Mt);
737
- let i = null;
738
- t instanceof gt ? (i = t, this.rootSash = t) : (i = new ut(t), this.rootSash = i.buildSashTree()), this.fitContainer = i.fitContainer;
739
- }
740
- frame(t) {
741
- this.containerElement = t, this.windowElement = this.createWindow(), this.glaze(), this.containerElement.append(this.windowElement);
742
- }
743
- // Features can work independently to each other
744
- enableFeatures() {
745
- this.enableResize(), this.enableDrop(), this.fitContainer && this.enableFitContainer();
746
- }
747
- mount(t) {
748
- this.frame(t), this.enableFeatures();
749
- }
750
- static assemble(...t) {
751
- t.forEach((i) => {
752
- nt(this.prototype, i);
753
- });
754
- }
755
- }
756
- O.assemble(
757
- Nt,
758
- zt,
759
- vt,
760
- Ct,
761
- At,
762
- St
763
- );
764
- function k(e) {
765
- if (e.tagName === "BW-PANE")
766
- return e.getAttribute("sash-id");
767
- const t = e.closest("bw-pane");
768
- if (!t)
769
- throw new Error("[bwin] Pane element not found");
770
- return t.getAttribute("sash-id");
771
- }
772
- const Rt = {
773
- label: "",
774
- className: "bw-glass-action--close",
775
- onClick: (e, t) => {
776
- const i = k(e.target);
777
- t.removePane(i);
778
- }
779
- }, Pt = {
780
- label: "",
781
- className: "bw-glass-action--minimize",
782
- onClick: (e, t) => {
783
- const i = t.sillElement;
784
- if (!i) throw new Error("[bwin] Sill element not found when minimizing");
785
- const n = N('<button class="bw-minimized-glass" />');
786
- i.append(n);
787
- const s = e.target.closest("bw-pane"), o = e.target.closest("bw-glass"), h = s.getAttribute("sash-id"), a = s.getAttribute("position");
788
- n.bwGlassElement = o, n.bwOriginalPosition = a, n.bwOriginalBoundingRect = R(s), t.removePane(h);
789
- }
790
- }, xt = {
791
- label: "",
792
- className: "bw-glass-action--maximize",
793
- onClick: (e) => {
794
- const t = e.target.closest("bw-pane");
795
- t.hasAttribute("maximized") ? (t.removeAttribute("maximized"), t.style.left = `${t.bwOriginalBoundingRect.left}px`, t.style.top = `${t.bwOriginalBoundingRect.top}px`, t.style.width = `${t.bwOriginalBoundingRect.width}px`, t.style.height = `${t.bwOriginalBoundingRect.height}px`) : (t.setAttribute("maximized", ""), t.bwOriginalBoundingRect = R(t), t.style.left = "0", t.style.top = "0", t.style.width = "100%", t.style.height = "100%");
796
- }
603
+ var R = {
604
+ createWindow({ theme: e } = {}) {
605
+ let t = document.createElement("bw-window");
606
+ return t.style.width = `${this.rootSash.width}px`, t.style.height = `${this.rootSash.height}px`, t.setAttribute("root-sash-id", this.rootSash.id), e && t.setAttribute("theme", e), t;
607
+ },
608
+ glaze() {
609
+ this.rootSash.walk((e) => {
610
+ let t = null;
611
+ e.children.length > 0 ? (t = this.createMuntin(e), this.onMuntinCreate(t, e), this.windowElement.append(t)) : (t = this.createPane(e), this.onPaneCreate(t, e), this.windowElement.prepend(t)), e.domNode = t;
612
+ });
613
+ },
614
+ update() {
615
+ this.windowElement.style.width = `${this.rootSash.width}px`, this.windowElement.style.height = `${this.rootSash.height}px`;
616
+ let e = this.rootSash.getAllIds(), t = [];
617
+ this.windowElement.querySelectorAll("[sash-id]").forEach((n) => {
618
+ let r = n.getAttribute("sash-id");
619
+ t.push(r), e.includes(r) || n.remove();
620
+ }), this.rootSash.walk((e) => {
621
+ e.children.length > 0 ? t.includes(e.id) ? (this.updateMuntin(e), this.onMuntinUpdate(e.domNode, e)) : (e.domNode = this.createMuntin(e), this.windowElement.append(e.domNode)) : t.includes(e.id) ? (this.updatePane(e), this.onPaneUpdate(e.domNode, e)) : (e.domNode ||= this.createPane(e), this.windowElement.prepend(e.domNode));
622
+ });
623
+ }
624
+ }, z = {
625
+ muntinSize: 4,
626
+ createMuntin(e) {
627
+ let t = document.createElement("bw-muntin"), n = e.leftChild, r = e.topChild;
628
+ return n ? (t.style.width = `${this.muntinSize}px`, t.style.height = `${e.height}px`, t.style.top = `${e.top}px`, t.style.left = `${e.left + n.width - this.muntinSize / 2}px`, t.setAttribute("vertical", "")) : r && (t.style.width = `${e.width}px`, t.style.height = `${this.muntinSize}px`, t.style.top = `${e.top + r.height - this.muntinSize / 2}px`, t.style.left = `${e.left}px`, t.setAttribute("horizontal", "")), t.setAttribute("sash-id", e.id), e.store.resizable === !1 && t.setAttribute("resizable", "false"), t;
629
+ },
630
+ onMuntinCreate(e, t) {},
631
+ updateMuntin(e) {
632
+ let t = e.domNode, n = e.leftChild, r = e.topChild;
633
+ n ? (t.style.height = `${e.height}px`, t.style.top = `${e.top}px`, t.style.left = `${e.left + n.width - this.muntinSize / 2}px`) : r && (t.style.width = `${e.width}px`, t.style.top = `${e.top + r.height - this.muntinSize / 2}px`, t.style.left = `${e.left}px`);
634
+ },
635
+ onMuntinUpdate(e, t) {}
636
+ }, B = {
637
+ fitContainer: !1,
638
+ fit() {
639
+ this.rootSash.width = this.containerElement.clientWidth, this.rootSash.height = this.containerElement.clientHeight, this.update();
640
+ },
641
+ enableFitContainer() {
642
+ new ResizeObserver((e) => {
643
+ requestAnimationFrame(() => {
644
+ for (let t of e) t.target === this.containerElement && this.fitContainer && this.fit();
645
+ });
646
+ }).observe(this.containerElement);
647
+ }
648
+ }, V = {
649
+ activeMuntinSash: null,
650
+ isResizeStarted: !1,
651
+ isDropStarted: !1,
652
+ lastX: 0,
653
+ lastY: 0,
654
+ applyResizeStyles() {
655
+ this.activeMuntinSash.domNode.hasAttribute("vertical") ? document.body.classList.add("body--bw-resize-x") : this.activeMuntinSash.domNode.hasAttribute("horizontal") && document.body.classList.add("body--bw-resize-y");
656
+ },
657
+ revertResizeStyles() {
658
+ document.body.classList.remove("body--bw-resize-x"), document.body.classList.remove("body--bw-resize-y");
659
+ },
660
+ enableResize() {
661
+ document.addEventListener("mousedown", (e) => {
662
+ if (e.target.tagName !== "BW-MUNTIN" || e.target.getAttribute("resizable") === "false") return;
663
+ let t = e.target.getAttribute("sash-id");
664
+ this.activeMuntinSash = this.rootSash.getById(t), this.activeMuntinSash && (this.isResizeStarted = !0, this.lastX = e.pageX, this.lastY = e.pageY, this.applyResizeStyles());
665
+ }), document.addEventListener("mousemove", (e) => {
666
+ if (!this.isResizeStarted || !this.activeMuntinSash) return;
667
+ let [t, n, r, i] = this.activeMuntinSash.getChildren(), a = this.activeMuntinSash.isLeftRightSplit(), o = this.activeMuntinSash.isTopBottomSplit();
668
+ if (a && i && n) {
669
+ let t = e.pageX - this.lastX, r = i.width + t, a = n.width - t;
670
+ if (t > 0 && a <= n.calcMinWidth() || t < 0 && r <= i.calcMinWidth()) return;
671
+ i.width = r, n.width = a, n.left += t, this.update(), this.lastX = e.pageX;
672
+ } else if (o && t && r) {
673
+ let n = e.pageY - this.lastY, i = t.height + n, a = r.height - n;
674
+ if (n > 0 && a <= r.calcMinHeight() || n < 0 && i <= t.calcMinHeight()) return;
675
+ t.height = i, r.height = a, r.top += n, this.update(), this.lastY = e.pageY;
676
+ }
677
+ }), document.addEventListener("mouseup", () => {
678
+ this.isResizeStarted = !1, this.activeMuntinSash = null, this.revertResizeStyles();
679
+ });
680
+ }
681
+ }, H = {
682
+ activeDropPaneEl: null,
683
+ onPaneDrop(e, t) {},
684
+ enableDrop() {
685
+ this.windowElement.addEventListener("dragover", (e) => {
686
+ e.preventDefault();
687
+ let t = e.target.matches("bw-pane") ? e.target : e.target.closest("bw-pane");
688
+ if (!t || (t !== this.activeDropPaneEl && (this.activeDropPaneEl && this.activeDropPaneEl.removeAttribute("drop-area"), this.activeDropPaneEl = t), t.getAttribute("can-drop") === "false")) return;
689
+ let n = ne(t, e);
690
+ t.setAttribute("drop-area", n);
691
+ }), this.windowElement.addEventListener("dragleave", (e) => {
692
+ e.currentTarget.contains(e.relatedTarget) && e.currentTarget !== e.relatedTarget || (this.activeDropPaneEl &&= (this.activeDropPaneEl.removeAttribute("drop-area"), null));
693
+ }), this.windowElement.addEventListener("drop", (e) => {
694
+ if (!this.activeDropPaneEl || this.activeDropPaneEl.getAttribute("can-drop") === "false") return;
695
+ let t = this.activeDropPaneEl.getAttribute("sash-id"), n = this.rootSash.getById(t);
696
+ this.onPaneDrop(e, n), typeof n.store.onDrop == "function" && n.store.onDrop(e, n), this.activeDropPaneEl.removeAttribute("drop-area"), this.activeDropPaneEl = null;
697
+ });
698
+ }
699
+ }, U = !1, W = class {
700
+ windowElement = null;
701
+ containerElement = null;
702
+ debug = U;
703
+ constructor(e) {
704
+ let t = null;
705
+ e instanceof re ? (t = e, this.rootSash = e) : (t = new O(e), this.rootSash = t.buildSashTree({ resizeStrategy: t.resizeStrategy })), this.fitContainer = t.fitContainer, this.theme = t.theme;
706
+ }
707
+ frame(e) {
708
+ this.containerElement = e, this.windowElement = this.createWindow({ theme: this.theme }), this.glaze(), this.containerElement.append(this.windowElement);
709
+ }
710
+ enableFeatures() {
711
+ this.enableResize(), this.enableDrop(), this.fitContainer && this.enableFitContainer();
712
+ }
713
+ mount(e) {
714
+ this.frame(e), this.enableFeatures();
715
+ }
716
+ static assemble(...e) {
717
+ e.forEach((e) => {
718
+ m(this.prototype, e);
719
+ });
720
+ }
797
721
  };
798
- function Dt(e, t) {
799
- const i = e.left + e.width, n = e.top + e.height, s = t.left + t.width, o = t.top + t.height;
800
- if (e.left >= s || t.left >= i || e.top >= o || t.top >= n)
801
- return null;
802
- const h = Math.max(e.left, t.left), a = Math.max(e.top, t.top), d = Math.min(i, s), l = Math.min(n, o);
803
- return {
804
- left: h,
805
- top: a,
806
- width: d - h,
807
- height: l - a
808
- };
809
- }
810
- const F = [Pt, xt, Rt], $t = {
811
- enableActions() {
812
- this.handleMinimizedGlassClick(), this.observeActionButtons();
813
- },
814
- restoreGlass(e) {
815
- const t = e.bwOriginalBoundingRect;
816
- let i = 0, n = null;
817
- if (this.windowElement.querySelectorAll("bw-pane").forEach((s) => {
818
- const o = R(s), h = Dt(t, o);
819
- if (h) {
820
- const a = h.width * h.height;
821
- a > i && (i = a, n = s);
822
- }
823
- }), n) {
824
- const s = e.bwOriginalPosition, o = R(n), h = n.getAttribute("sash-id"), a = this.rootSash.getById(h);
825
- let d = 0;
826
- if (s === r.Left || s === r.Right)
827
- d = o.width - t.width < a.minWidth ? o.width / 2 : t.width;
828
- else if (s === r.Top || s === r.Bottom)
829
- d = o.height - t.height < a.minHeight ? o.height / 2 : t.height;
830
- else
831
- throw new Error("[bwin] Invalid position when restoring glass");
832
- this.addPane(n.getAttribute("sash-id"), {
833
- position: s,
834
- size: d
835
- }).domNode.append(e.bwGlassElement);
836
- }
837
- },
838
- handleMinimizedGlassClick() {
839
- this.sillElement.addEventListener("click", (e) => {
840
- if (!e.target.matches(".bw-minimized-glass")) return;
841
- const t = e.target;
842
- this.restoreGlass(t), t.remove();
843
- });
844
- },
845
- updateDisabledStateOfActionButtons() {
846
- this.updateDisabledState(".bw-glass-action--close"), this.updateDisabledState(".bw-glass-action--minimize"), this.updateDisabledState(".bw-glass-action--maximize");
847
- },
848
- updateDisabledState(e) {
849
- if (this.windowElement.querySelectorAll("bw-pane").length === 1) {
850
- const t = this.windowElement.querySelector(e);
851
- t && t.setAttribute("disabled", "");
852
- } else
853
- this.windowElement.querySelectorAll(e).forEach((t) => {
854
- t.removeAttribute("disabled");
855
- });
856
- },
857
- observeActionButtons() {
858
- this.updateDisabledStateOfActionButtons(), new MutationObserver((e) => {
859
- e.forEach((t) => {
860
- t.type === "childList" && this.updateDisabledStateOfActionButtons();
861
- });
862
- }).observe(this.windowElement, {
863
- childList: !0
864
- });
865
- }
866
- }, S = {
867
- title: null,
868
- content: null,
869
- tabs: [],
870
- actions: void 0,
871
- draggable: !0
722
+ W.assemble(R, z, I, B, H, V);
723
+ var G = {
724
+ label: "",
725
+ className: "bw-glass-action--close",
726
+ onClick: (e, t) => {
727
+ let n = F(e.target);
728
+ t.removePane(n);
729
+ }
730
+ }, K = {
731
+ label: "",
732
+ className: "bw-glass-action--minimize",
733
+ onClick: (e, t) => {
734
+ let n = t.sillElement;
735
+ if (!n) throw Error("[bwin] Sill element not found when minimizing");
736
+ let r = g("<button class=\"bw-minimized-glass\" />");
737
+ n.append(r);
738
+ let i = e.target.closest("bw-pane"), a = e.target.closest("bw-glass"), o = i.getAttribute("sash-id"), s = i.getAttribute("position");
739
+ r.bwGlassElement = a, r.bwOriginalPosition = s, r.bwOriginalBoundingRect = _(i), r.bwOriginalSashId = o, t.removePane(o);
740
+ }
741
+ }, q = {
742
+ label: "",
743
+ className: "bw-glass-action--maximize",
744
+ onClick: (e) => {
745
+ let t = e.target.closest("bw-pane");
746
+ t.hasAttribute("maximized") ? (t.removeAttribute("maximized"), t.style.left = `${t.bwOriginalBoundingRect.left}px`, t.style.top = `${t.bwOriginalBoundingRect.top}px`, t.style.width = `${t.bwOriginalBoundingRect.width}px`, t.style.height = `${t.bwOriginalBoundingRect.height}px`) : (t.setAttribute("maximized", ""), t.bwOriginalBoundingRect = _(t), t.style.left = "0", t.style.top = "0", t.style.width = "100%", t.style.height = "100%");
747
+ }
872
748
  };
873
- class G {
874
- constructor({
875
- title: t = S.title,
876
- content: i = S.content,
877
- tabs: n = S.tabs,
878
- actions: s = S.actions,
879
- draggable: o = S.draggable,
880
- sash: h,
881
- binaryWindow: a
882
- }) {
883
- E(this, "domNode"), this.title = t, this.content = i, this.tabs = n, this.actions = s, this.sash = h, this.draggable = o, this.binaryWindow = a, this.build();
884
- }
885
- build() {
886
- const t = document.createElement("bw-glass-header");
887
- if (Array.isArray(this.tabs) && this.tabs.length > 0)
888
- t.append(this.createTabs());
889
- else if (this.title) {
890
- const s = document.createElement("bw-glass-title");
891
- s.append(N(this.title)), t.append(s);
892
- }
893
- t.setAttribute("can-drag", this.draggable), t.append(this.createActions());
894
- const i = document.createElement("bw-glass-content"), n = N(this.content);
895
- n && i.append(n), this.domNode = document.createElement("bw-glass"), this.domNode.append(t, i);
896
- }
897
- createTabs() {
898
- const t = document.createElement("bw-glass-tab-container");
899
- for (const i of this.tabs) {
900
- const n = (i == null ? void 0 : i.label) ?? i, s = N(`<button class="bw-glass-tab">${n}</button>`);
901
- t.append(s);
902
- }
903
- return t;
904
- }
905
- createActions() {
906
- const t = document.createElement("bw-glass-action-container"), i = this.actions === void 0 ? F : Array.isArray(this.actions) ? this.actions : [];
907
- for (const n of i) {
908
- const s = (n == null ? void 0 : n.label) ?? n, o = n.className ? `bw-glass-action ${n.className}` : "bw-glass-action", h = N(`<button class="${o}">${s}</button>`);
909
- typeof n.onClick == "function" && h.addEventListener("click", (a) => {
910
- n.onClick(a, this.binaryWindow);
911
- }), t.append(h);
912
- }
913
- return t;
914
- }
915
- get contentElement() {
916
- return this.domNode.querySelector("bw-glass-content");
917
- }
918
- get headerElement() {
919
- return this.domNode.querySelector("bw-glass-header");
920
- }
749
+ function J(e, t) {
750
+ let n = e.left + e.width, r = e.top + e.height, i = t.left + t.width, a = t.top + t.height;
751
+ if (e.left >= i || t.left >= n || e.top >= a || t.top >= r) return null;
752
+ let o = Math.max(e.left, t.left), s = Math.max(e.top, t.top), c = Math.min(n, i), l = Math.min(r, a);
753
+ return {
754
+ left: o,
755
+ top: s,
756
+ width: c - o,
757
+ height: l - s
758
+ };
921
759
  }
922
- const Lt = {
923
- activeDragGlassEl: null,
924
- activeDragGlassPaneCanDrop: !1,
925
- onPaneDrop(e, t) {
926
- if (!this.activeDragGlassEl) return;
927
- const i = this.activeDropPaneEl.getAttribute("drop-area");
928
- if (i === "center") {
929
- const n = this.activeDragGlassEl.closest("bw-pane"), s = this.activeDropPaneEl.getAttribute("can-drop") !== "false";
930
- et(n, this.activeDropPaneEl), n.setAttribute("can-drop", s);
931
- return;
932
- } else {
933
- const n = k(this.activeDragGlassEl);
934
- this.addPane(t.id, { position: i }).domNode.append(this.activeDragGlassEl), this.removePane(n);
935
- }
936
- },
937
- enableDrag() {
938
- document.addEventListener("mousedown", (e) => {
939
- if (e.button !== 0 || !e.target.matches("bw-glass-header")) return;
940
- if (e.target.getAttribute("can-drag") === "false") {
941
- e.preventDefault();
942
- return;
943
- }
944
- const t = e.target.closest("bw-glass");
945
- t.setAttribute("draggable", !0), this.activeDragGlassEl = t;
946
- }), document.addEventListener("mouseup", () => {
947
- this.activeDragGlassEl && (this.activeDragGlassEl.removeAttribute("draggable"), this.activeDragGlassEl = null);
948
- }), this.windowElement.addEventListener("dragstart", (e) => {
949
- if (!(e.target instanceof HTMLElement) || !e.target.matches("bw-glass") || !this.activeDragGlassEl)
950
- return;
951
- e.dataTransfer.effectAllowed = "move";
952
- const t = this.activeDragGlassEl.closest("bw-pane");
953
- this.activeDragGlassPaneCanDrop = t.getAttribute("can-drop") !== "false", t.setAttribute("can-drop", !1);
954
- }), this.windowElement.addEventListener("dragend", () => {
955
- this.activeDragGlassEl && (this.activeDragGlassEl.removeAttribute("draggable"), this.activeDragGlassEl.closest("bw-pane").setAttribute("can-drop", this.activeDragGlassPaneCanDrop), this.activeDragGlassEl = null);
956
- });
957
- }
958
- }, Bt = {
959
- trimMuntin(e) {
960
- e.hasAttribute("vertical") ? (e.style.top = `${parseFloat(e.style.top) + this.muntinSize / 2}px`, e.style.height = `${parseFloat(e.style.height) - this.muntinSize}px`) : e.hasAttribute("horizontal") && (e.style.left = `${parseFloat(e.style.left) + this.muntinSize / 2}px`, e.style.width = `${parseFloat(e.style.width) - this.muntinSize}px`);
961
- },
962
- onMuntinCreate(e) {
963
- this.trimMuntin(e);
964
- },
965
- onMuntinUpdate(e) {
966
- this.trimMuntin(e);
967
- }
760
+ var Y = [
761
+ K,
762
+ q,
763
+ G
764
+ ], ae = {
765
+ enableActions() {
766
+ this.handleMinimizedGlassClick(), this.observeActionButtons();
767
+ },
768
+ restoreGlass(e) {
769
+ let t = e.bwOriginalBoundingRect, n = 0, r = null;
770
+ if (this.windowElement.querySelectorAll("bw-pane").forEach((e) => {
771
+ let i = J(t, _(e));
772
+ if (i) {
773
+ let t = i.width * i.height;
774
+ t > n && (n = t, r = e);
775
+ }
776
+ }), r) {
777
+ let n = e.bwOriginalPosition, i = _(r), a = r.getAttribute("sash-id"), o = this.rootSash.getById(a), s = 0;
778
+ if (n === v.Left || n === v.Right) s = i.width - t.width < o.minWidth ? i.width / 2 : t.width;
779
+ else if (n === v.Top || n === v.Bottom) s = i.height - t.height < o.minHeight ? i.height / 2 : t.height;
780
+ else throw Error("[bwin] Invalid position when restoring glass");
781
+ let c = e.bwOriginalSashId;
782
+ this.addPane(r.getAttribute("sash-id"), {
783
+ id: c,
784
+ position: n,
785
+ size: s
786
+ }).domNode.append(e.bwGlassElement);
787
+ }
788
+ },
789
+ handleMinimizedGlassClick() {
790
+ this.sillElement.addEventListener("click", (e) => {
791
+ if (!e.target.matches(".bw-minimized-glass")) return;
792
+ let t = e.target;
793
+ this.restoreGlass(t), t.remove();
794
+ });
795
+ },
796
+ updateDisabledStateOfActionButtons() {
797
+ this.updateDisabledState(".bw-glass-action--close"), this.updateDisabledState(".bw-glass-action--minimize"), this.updateDisabledState(".bw-glass-action--maximize");
798
+ },
799
+ updateDisabledState(e) {
800
+ if (this.windowElement.querySelectorAll("bw-pane").length === 1) {
801
+ let t = this.windowElement.querySelector(e);
802
+ t && t.setAttribute("disabled", "");
803
+ } else this.windowElement.querySelectorAll(e).forEach((e) => {
804
+ e.removeAttribute("disabled");
805
+ });
806
+ },
807
+ getMinimizedGlassElementBySashId(e) {
808
+ let t = this.windowElement.querySelectorAll(".bw-minimized-glass");
809
+ return Array.from(t).find((t) => t.bwOriginalSashId === e);
810
+ },
811
+ observeActionButtons() {
812
+ this.updateDisabledStateOfActionButtons(), new MutationObserver((e) => {
813
+ e.forEach((e) => {
814
+ e.type === "childList" && this.updateDisabledStateOfActionButtons();
815
+ });
816
+ }).observe(this.windowElement, { childList: !0 });
817
+ }
818
+ }, X = {
819
+ title: null,
820
+ content: null,
821
+ tabs: [],
822
+ actions: void 0,
823
+ draggable: !0
824
+ }, Z = class {
825
+ domNode;
826
+ constructor({ title: e = X.title, content: t = X.content, tabs: n = X.tabs, actions: r = X.actions, draggable: i = X.draggable, sash: a, binaryWindow: o }) {
827
+ this.title = e, this.content = t, this.tabs = n, this.actions = r, this.sash = a, this.draggable = i, this.binaryWindow = o, this.build();
828
+ }
829
+ build() {
830
+ let e = document.createElement("bw-glass-header");
831
+ if (Array.isArray(this.tabs) && this.tabs.length > 0) e.append(this.createTabs());
832
+ else if (this.title) {
833
+ let t = document.createElement("bw-glass-title");
834
+ t.append(g(this.title)), e.append(t);
835
+ }
836
+ e.setAttribute("can-drag", this.draggable), e.append(this.createActions());
837
+ let t = document.createElement("bw-glass-content"), n = g(this.content);
838
+ n && t.append(n), this.domNode = document.createElement("bw-glass"), this.domNode.append(e, t);
839
+ }
840
+ createTabs() {
841
+ let e = document.createElement("bw-glass-tab-container");
842
+ for (let t of this.tabs) {
843
+ let n = g(`<button class="bw-glass-tab">${t?.label ?? t}</button>`);
844
+ e.append(n);
845
+ }
846
+ return e;
847
+ }
848
+ createActions() {
849
+ let e = document.createElement("bw-glass-action-container"), t = this.actions === void 0 ? Y : Array.isArray(this.actions) ? this.actions : [];
850
+ for (let n of t) {
851
+ let t = n?.label ?? n, r = g(`<button class="${n.className ? `bw-glass-action ${n.className}` : "bw-glass-action"}">${t}</button>`);
852
+ typeof n.onClick == "function" && r.addEventListener("click", (e) => {
853
+ n.onClick(e, this.binaryWindow);
854
+ }), e.append(r);
855
+ }
856
+ return e;
857
+ }
858
+ get contentElement() {
859
+ return this.domNode.querySelector("bw-glass-content");
860
+ }
861
+ get headerElement() {
862
+ return this.domNode.querySelector("bw-glass-header");
863
+ }
864
+ }, oe = {
865
+ activeDragGlassEl: null,
866
+ activeDragGlassPaneCanDrop: !1,
867
+ onPaneDrop(e, t) {
868
+ if (!this.activeDragGlassEl) return;
869
+ let n = this.activeDropPaneEl.getAttribute("drop-area");
870
+ if (n === "center") {
871
+ let e = this.activeDragGlassEl.closest("bw-pane");
872
+ this.swapPanes(e, this.activeDropPaneEl);
873
+ return;
874
+ } else {
875
+ let e = F(this.activeDragGlassEl);
876
+ this.removePane(e), this.addPane(t.id, {
877
+ position: n,
878
+ id: e
879
+ }).domNode.append(this.activeDragGlassEl);
880
+ }
881
+ },
882
+ enableDrag() {
883
+ document.addEventListener("mousedown", (e) => {
884
+ if (e.button !== 0 || !e.target.matches("bw-glass-header")) return;
885
+ if (e.target.getAttribute("can-drag") === "false") {
886
+ e.preventDefault();
887
+ return;
888
+ }
889
+ let t = e.target.closest("bw-glass");
890
+ t.setAttribute("draggable", !0), this.activeDragGlassEl = t;
891
+ }), document.addEventListener("mouseup", () => {
892
+ this.activeDragGlassEl &&= (this.activeDragGlassEl.removeAttribute("draggable"), null);
893
+ }), this.windowElement.addEventListener("dragstart", (e) => {
894
+ if (!(e.target instanceof HTMLElement) || !e.target.matches("bw-glass") || !this.activeDragGlassEl) return;
895
+ e.dataTransfer.effectAllowed = "move";
896
+ let t = this.activeDragGlassEl.closest("bw-pane");
897
+ this.activeDragGlassPaneCanDrop = t.getAttribute("can-drop") !== "false", t.setAttribute("can-drop", !1);
898
+ }), this.windowElement.addEventListener("dragend", () => {
899
+ this.activeDragGlassEl &&= (this.activeDragGlassEl.removeAttribute("draggable"), this.activeDragGlassEl.closest("bw-pane").setAttribute("can-drop", this.activeDragGlassPaneCanDrop), null);
900
+ });
901
+ }
902
+ }, se = {
903
+ trimMuntin(e) {
904
+ e.hasAttribute("vertical") ? (e.style.top = `${parseFloat(e.style.top) + this.muntinSize / 2}px`, e.style.height = `${parseFloat(e.style.height) - this.muntinSize}px`) : e.hasAttribute("horizontal") && (e.style.left = `${parseFloat(e.style.left) + this.muntinSize / 2}px`, e.style.width = `${parseFloat(e.style.width) - this.muntinSize}px`);
905
+ },
906
+ onMuntinCreate(e) {
907
+ this.trimMuntin(e);
908
+ },
909
+ onMuntinUpdate(e) {
910
+ this.trimMuntin(e);
911
+ }
912
+ }, Q = class extends W {
913
+ sillElement = null;
914
+ frame() {
915
+ super.frame(...arguments);
916
+ let e = g("<bw-sill />");
917
+ this.windowElement.append(e), this.sillElement = e;
918
+ }
919
+ enableFeatures() {
920
+ super.enableFeatures(), this.enableDrag(), this.enableActions();
921
+ }
922
+ onPaneCreate(e, t) {
923
+ let n = new Z({
924
+ ...t.store,
925
+ sash: t,
926
+ binaryWindow: this
927
+ });
928
+ e.innerHTML = "", e.append(n.domNode), this.debug && n.contentElement.prepend(`${t.id}`);
929
+ }
930
+ onPaneUpdate() {}
931
+ addPane(e, t) {
932
+ let { position: n, size: r, id: i, ...a } = t, o = super.addPane(e, {
933
+ position: n,
934
+ size: r,
935
+ id: i
936
+ }), s = new Z({
937
+ ...a,
938
+ sash: o,
939
+ binaryWindow: this
940
+ });
941
+ return o.domNode.append(s.domNode), o;
942
+ }
943
+ setTheme(e) {
944
+ if (!e) {
945
+ this.theme = "", this.windowElement.removeAttribute("theme");
946
+ return;
947
+ }
948
+ this.theme = e, this.windowElement.setAttribute("theme", e);
949
+ }
950
+ removePane(e) {
951
+ if (this.windowElement.querySelector(`[sash-id="${e}"]`)) {
952
+ super.removePane(e);
953
+ return;
954
+ }
955
+ let t = this.getMinimizedGlassElementBySashId(e);
956
+ t && t.remove();
957
+ }
968
958
  };
969
- class _ extends O {
970
- constructor() {
971
- super(...arguments), E(this, "sillElement", null);
972
- }
973
- frame() {
974
- super.frame(...arguments);
975
- const t = N("<bw-sill />");
976
- this.windowElement.append(t), this.sillElement = t;
977
- }
978
- enableFeatures() {
979
- super.enableFeatures(), this.enableDrag(), this.enableActions();
980
- }
981
- onPaneCreate(t, i) {
982
- const n = new G({ ...i.store, sash: i, binaryWindow: this });
983
- t.innerHTML = "", t.append(n.domNode), this.debug && n.contentElement.prepend(`${i.id}`);
984
- }
985
- onPaneUpdate() {
986
- }
987
- /**
988
- * Add a pane with glass into the target pane.
989
- *
990
- * @param {string} targetPaneId - The Sash ID of the target pane
991
- * @param {Object} props - The pane and glass properties grouped together
992
- * @returns {Sash} - The newly created Sash
993
- */
994
- addPane(t, i) {
995
- const { position: n, size: s, ...o } = i, h = super.addPane(t, { position: n, size: s }), a = new G({ ...o, sash: h, binaryWindow: this });
996
- return h.domNode.append(a.domNode), h;
997
- }
998
- }
999
- _.assemble(Lt, Bt, $t);
1000
- const y = 4;
1001
- function Tt({ sash: e }) {
1002
- var c;
1003
- const t = M(), i = e.leftChild, n = e.topChild;
1004
- let s, o, h, a, d, l;
1005
- return i ? (s = y, o = e.height - y, h = e.top + y / 2, a = e.left + i.width - y / 2, d = !0) : n && (s = e.width - y, o = y, h = e.top + n.height - y / 2, a = e.left + y / 2, l = !0), W(() => {
1006
- e.domNode = t.current;
1007
- }, []), /* @__PURE__ */ f.createElement(
1008
- "bw-muntin",
1009
- {
1010
- "sash-id": e.id,
1011
- style: {
1012
- width: s,
1013
- height: o,
1014
- top: h,
1015
- left: a
1016
- },
1017
- vertical: d,
1018
- horizontal: l,
1019
- resizable: ((c = e.store) == null ? void 0 : c.resizable) === !1 ? "false" : "true",
1020
- ref: t
1021
- }
1022
- );
959
+ Q.assemble(oe, se, ae);
960
+ //#endregion
961
+ //#region src/Muntin.tsx
962
+ var $ = 4;
963
+ function ce({ sash: t }) {
964
+ let r = a(), i = t.leftChild, o = t.topChild, s, c, l, u, d, f;
965
+ return i ? (s = $, c = t.height - $, l = t.top + $ / 2, u = t.left + i.width - $ / 2, d = !0) : o && (s = t.width - $, c = $, l = t.top + o.height - $ / 2, u = t.left + $ / 2, f = !0), n(() => {
966
+ t.domNode = r.current;
967
+ }, []), /* @__PURE__ */ e.createElement("bw-muntin", {
968
+ "sash-id": t.id,
969
+ style: {
970
+ width: s,
971
+ height: c,
972
+ top: l,
973
+ left: u
974
+ },
975
+ vertical: d,
976
+ horizontal: f,
977
+ resizable: t.store?.resizable === !1 ? "false" : "true",
978
+ ref: r
979
+ });
1023
980
  }
1024
- function Wt({
1025
- sash: e,
1026
- bwin: t
1027
- }) {
1028
- var c, u, g, m, w;
1029
- const i = M(), { left: n, top: s, width: o, height: h, id: a, position: d } = e;
1030
- W(() => {
1031
- e.domNode = i.current;
1032
- }, []);
1033
- const l = ((c = e.store) == null ? void 0 : c.actions) === void 0 ? F : Array.isArray(e.store.actions) ? e.store.actions : [];
1034
- return /* @__PURE__ */ f.createElement(
1035
- "bw-pane",
1036
- {
1037
- "sash-id": a,
1038
- position: d,
1039
- style: { left: n, top: s, width: o, height: h },
1040
- "can-drop": ((u = e.store) == null ? void 0 : u.droppable) === !1 ? "false" : "true",
1041
- ref: i
1042
- },
1043
- /* @__PURE__ */ f.createElement("bw-glass", null, /* @__PURE__ */ f.createElement(
1044
- "bw-glass-header",
1045
- {
1046
- "can-drag": ((g = e.store) == null ? void 0 : g.draggable) === !1 ? "false" : "true"
1047
- },
1048
- ((m = e.store) == null ? void 0 : m.title) && /* @__PURE__ */ f.createElement("bw-glass-title", null, e.store.title),
1049
- l.length > 0 && /* @__PURE__ */ f.createElement("bw-glass-action-container", null, l.map((p, x) => {
1050
- const D = p.className ? `bw-glass-action ${p.className}` : "bw-glass-action";
1051
- return /* @__PURE__ */ f.createElement(
1052
- "button",
1053
- {
1054
- className: D,
1055
- key: x,
1056
- onClick: ($) => p.onClick($, t)
1057
- },
1058
- p.label
1059
- );
1060
- }))
1061
- ), /* @__PURE__ */ f.createElement("bw-glass-content", null, (w = e.store) == null ? void 0 : w.content))
1062
- );
981
+ //#endregion
982
+ //#region src/Pane.tsx
983
+ function le({ sash: t, bwin: r }) {
984
+ let i = a(), { left: o, top: s, width: c, height: l, id: u, position: d } = t;
985
+ n(() => {
986
+ t.domNode = i.current;
987
+ }, []);
988
+ let f = t.store?.actions === void 0 ? Y : Array.isArray(t.store.actions) ? t.store.actions : [];
989
+ return /* @__PURE__ */ e.createElement("bw-pane", {
990
+ "sash-id": u,
991
+ position: d,
992
+ style: {
993
+ left: o,
994
+ top: s,
995
+ width: c,
996
+ height: l
997
+ },
998
+ "can-drop": t.store?.droppable === !1 ? "false" : "true",
999
+ ref: i
1000
+ }, /* @__PURE__ */ e.createElement("bw-glass", null, /* @__PURE__ */ e.createElement("bw-glass-header", { "can-drag": t.store?.draggable === !1 ? "false" : "true" }, t.store?.title && /* @__PURE__ */ e.createElement("bw-glass-title", null, t.store.title), f.length > 0 && /* @__PURE__ */ e.createElement("bw-glass-action-container", null, f.map((t, n) => {
1001
+ let i = t.className ? `bw-glass-action ${t.className}` : "bw-glass-action";
1002
+ return /* @__PURE__ */ e.createElement("button", {
1003
+ className: i,
1004
+ key: n,
1005
+ onClick: (e) => t.onClick(e, r)
1006
+ }, t.label);
1007
+ }))), /* @__PURE__ */ e.createElement("bw-glass-content", null, t.store?.content)));
1063
1008
  }
1064
- const Gt = Y((e, t) => {
1065
- const i = M(), n = M(), [s, o] = j(), { panes: h, ...a } = e, d = { ...a, children: h }, l = new _(d), c = [], u = [];
1066
- l.rootSash.walk((p) => {
1067
- p.children.length > 0 ? c.push(p) : u.push(p);
1068
- }), W(() => {
1069
- const p = i.current;
1070
- p != null && p.parentElement && (l.windowElement = p, l.containerElement = p.parentElement, l.sillElement = n.current, l.enableFeatures());
1071
- }, []), K(
1072
- t,
1073
- () => ({
1074
- fit: l.fit.bind(l),
1075
- removePane: l.removePane.bind(l),
1076
- addPane: w
1077
- }),
1078
- []
1079
- );
1080
- const g = /* @__PURE__ */ f.createElement(
1081
- "bw-window",
1082
- {
1083
- "root-sash-id": l.rootSash.id,
1084
- style: { width: l.rootSash.width, height: l.rootSash.height },
1085
- ref: i
1086
- },
1087
- u.map((p) => /* @__PURE__ */ f.createElement(Wt, { key: p.id, sash: p, bwin: l })),
1088
- c.map((p) => /* @__PURE__ */ f.createElement(Tt, { key: p.id, sash: p })),
1089
- /* @__PURE__ */ f.createElement("bw-sill", { ref: n })
1090
- ), m = V(() => g, []);
1091
- function w(p, x) {
1092
- const { content: D, ...$ } = x, q = l.addPane(p, $), U = document.querySelector(
1093
- `bw-pane[sash-id="${q.id}"] bw-glass-content`
1094
- );
1095
- o((X) => [
1096
- ...X || [],
1097
- { node: D, container: U }
1098
- ]);
1099
- }
1100
- return /* @__PURE__ */ f.createElement(f.Fragment, null, m, s == null ? void 0 : s.map((p) => Z(p.node, p.container)));
1101
- }), Ot = "0.3.2";
1102
- export {
1103
- F as BUILTIN_ACTIONS,
1104
- Gt as Window,
1105
- Ot as version
1106
- };
1009
+ //#endregion
1010
+ //#region src/Window.tsx
1011
+ var ue = t((t, c) => {
1012
+ let l = a(), u = a(), [d, f] = o(), { panes: p, ...m } = t, h = new Q({
1013
+ ...m,
1014
+ children: p
1015
+ }), g = [], _ = [];
1016
+ h.rootSash.walk((e) => {
1017
+ e.children.length > 0 ? g.push(e) : _.push(e);
1018
+ }), n(() => {
1019
+ let e = l.current;
1020
+ e?.parentElement && (h.windowElement = e, h.containerElement = e.parentElement, h.sillElement = u.current, h.enableFeatures());
1021
+ }, []), r(c, () => ({
1022
+ fit: h.fit.bind(h),
1023
+ removePane: h.removePane.bind(h),
1024
+ addPane: b
1025
+ }), []);
1026
+ let v = /* @__PURE__ */ e.createElement("bw-window", {
1027
+ "root-sash-id": h.rootSash.id,
1028
+ style: {
1029
+ width: h.rootSash.width,
1030
+ height: h.rootSash.height
1031
+ },
1032
+ ref: l
1033
+ }, _.map((t) => /* @__PURE__ */ e.createElement(le, {
1034
+ key: t.id,
1035
+ sash: t,
1036
+ bwin: h
1037
+ })), g.map((t) => /* @__PURE__ */ e.createElement(ce, {
1038
+ key: t.id,
1039
+ sash: t
1040
+ })), /* @__PURE__ */ e.createElement("bw-sill", { ref: u })), y = i(() => v, []);
1041
+ function b(e, t) {
1042
+ let { content: n, ...r } = t, i = h.addPane(e, r), a = document.querySelector(`bw-pane[sash-id="${i.id}"] bw-glass-content`);
1043
+ f((e) => [...e || [], {
1044
+ node: n,
1045
+ container: a
1046
+ }]);
1047
+ }
1048
+ return /* @__PURE__ */ e.createElement(e.Fragment, null, y, d?.map((e) => s(e.node, e.container)));
1049
+ }), de = "0.3.4";
1050
+ //#endregion
1051
+ export { Y as BUILTIN_ACTIONS, ue as Window, de as version };