@synnaxlabs/drift 0.42.3 → 0.44.0

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,33 +1,32 @@
1
1
  import { configureStore as j } from "@reduxjs/toolkit";
2
- import { g, l as d, a as T, r as E, b as I, i as N, c as F, s as V, d as $, e as U, f as C, h as q, S as M, Z as Q, j as Z, k as K, m as X, n as B, o as J, p as Y, q as G, t as H, u as x, v as W, w as ee, x as se, y as ie, z as te, A as ae, B as oe, C as ne, D as le, E as re } from "./state-BX_5GHgM.js";
3
- import { M as w, _ as p, J as ce, I as ue, w as fe } from "./window-DwJfMpbK.js";
4
- import { s as de, a as we, b as he, c as pe, d as ye, e as _e } from "./selectors-B00IQPYW.js";
2
+ import { M as w, g, l as d, a as T, r as E, _ as y, J as F, I as N, b as M, i as V, c as $, s as U, d as Q, e as Z, f as I, h as C, S as q, Z as K, j as X, k as B, m as J, n as Y, o as G, p as H, q as x, t as W, u as ee, v as se, w as te, x as ie, y as ae, z as oe, A as ne, B as ce, C as le, D as re, E as ue, F as fe } from "./state-D41-Dai4.js";
3
+ import { s as de, a as we, b as he, c as ye, d as pe, e as _e } from "./selectors-C36jHClh.js";
5
4
  const be = new Error("request for lock canceled");
6
- var me = function(i, e, s, t) {
5
+ var me = function(t, e, s, i) {
7
6
  function a(o) {
8
- return o instanceof s ? o : new s(function(l) {
9
- l(o);
7
+ return o instanceof s ? o : new s(function(c) {
8
+ c(o);
10
9
  });
11
10
  }
12
- return new (s || (s = Promise))(function(o, l) {
13
- function n(r) {
11
+ return new (s || (s = Promise))(function(o, c) {
12
+ function n(l) {
14
13
  try {
15
- u(t.next(r));
14
+ u(i.next(l));
16
15
  } catch (f) {
17
- l(f);
16
+ c(f);
18
17
  }
19
18
  }
20
- function c(r) {
19
+ function r(l) {
21
20
  try {
22
- u(t.throw(r));
21
+ u(i.throw(l));
23
22
  } catch (f) {
24
- l(f);
23
+ c(f);
25
24
  }
26
25
  }
27
- function u(r) {
28
- r.done ? o(r.value) : a(r.value).then(n, c);
26
+ function u(l) {
27
+ l.done ? o(l.value) : a(l.value).then(n, r);
29
28
  }
30
- u((t = t.apply(i, e || [])).next());
29
+ u((i = i.apply(t, e || [])).next());
31
30
  });
32
31
  };
33
32
  class ze {
@@ -37,26 +36,26 @@ class ze {
37
36
  acquire(e = 1, s = 0) {
38
37
  if (e <= 0)
39
38
  throw new Error(`invalid weight ${e}: must be positive`);
40
- return new Promise((t, a) => {
41
- const o = { resolve: t, reject: a, weight: e, priority: s }, l = O(this._queue, (n) => s <= n.priority);
42
- l === -1 && e <= this._value ? this._dispatchItem(o) : this._queue.splice(l + 1, 0, o);
39
+ return new Promise((i, a) => {
40
+ const o = { resolve: i, reject: a, weight: e, priority: s }, c = O(this._queue, (n) => s <= n.priority);
41
+ c === -1 && e <= this._value ? this._dispatchItem(o) : this._queue.splice(c + 1, 0, o);
43
42
  });
44
43
  }
45
44
  runExclusive(e) {
46
- return me(this, arguments, void 0, function* (s, t = 1, a = 0) {
47
- const [o, l] = yield this.acquire(t, a);
45
+ return me(this, arguments, void 0, function* (s, i = 1, a = 0) {
46
+ const [o, c] = yield this.acquire(i, a);
48
47
  try {
49
48
  return yield s(o);
50
49
  } finally {
51
- l();
50
+ c();
52
51
  }
53
52
  });
54
53
  }
55
54
  waitForUnlock(e = 1, s = 0) {
56
55
  if (e <= 0)
57
56
  throw new Error(`invalid weight ${e}: must be positive`);
58
- return this._couldLockImmediately(e, s) ? Promise.resolve() : new Promise((t) => {
59
- this._weightedWaiters[e - 1] || (this._weightedWaiters[e - 1] = []), Se(this._weightedWaiters[e - 1], { resolve: t, priority: s });
57
+ return this._couldLockImmediately(e, s) ? Promise.resolve() : new Promise((i) => {
58
+ this._weightedWaiters[e - 1] || (this._weightedWaiters[e - 1] = []), Se(this._weightedWaiters[e - 1], { resolve: i, priority: s });
60
59
  });
61
60
  }
62
61
  isLocked() {
@@ -94,16 +93,16 @@ class ze {
94
93
  if (this._queue.length === 0)
95
94
  for (let e = this._value; e > 0; e--) {
96
95
  const s = this._weightedWaiters[e - 1];
97
- s && (s.forEach((t) => t.resolve()), this._weightedWaiters[e - 1] = []);
96
+ s && (s.forEach((i) => i.resolve()), this._weightedWaiters[e - 1] = []);
98
97
  }
99
98
  else {
100
99
  const e = this._queue[0].priority;
101
100
  for (let s = this._value; s > 0; s--) {
102
- const t = this._weightedWaiters[s - 1];
103
- if (!t)
101
+ const i = this._weightedWaiters[s - 1];
102
+ if (!i)
104
103
  continue;
105
- const a = t.findIndex((o) => o.priority <= e);
106
- (a === -1 ? t : t.splice(0, a)).forEach((o) => o.resolve());
104
+ const a = i.findIndex((o) => o.priority <= e);
105
+ (a === -1 ? i : i.splice(0, a)).forEach((o) => o.resolve());
107
106
  }
108
107
  }
109
108
  }
@@ -111,49 +110,49 @@ class ze {
111
110
  return (this._queue.length === 0 || this._queue[0].priority < s) && e <= this._value;
112
111
  }
113
112
  }
114
- function Se(i, e) {
115
- const s = O(i, (t) => e.priority <= t.priority);
116
- i.splice(s + 1, 0, e);
113
+ function Se(t, e) {
114
+ const s = O(t, (i) => e.priority <= i.priority);
115
+ t.splice(s + 1, 0, e);
117
116
  }
118
- function O(i, e) {
119
- for (let s = i.length - 1; s >= 0; s--)
120
- if (e(i[s]))
117
+ function O(t, e) {
118
+ for (let s = t.length - 1; s >= 0; s--)
119
+ if (e(t[s]))
121
120
  return s;
122
121
  return -1;
123
122
  }
124
- var ve = function(i, e, s, t) {
123
+ var ke = function(t, e, s, i) {
125
124
  function a(o) {
126
- return o instanceof s ? o : new s(function(l) {
127
- l(o);
125
+ return o instanceof s ? o : new s(function(c) {
126
+ c(o);
128
127
  });
129
128
  }
130
- return new (s || (s = Promise))(function(o, l) {
131
- function n(r) {
129
+ return new (s || (s = Promise))(function(o, c) {
130
+ function n(l) {
132
131
  try {
133
- u(t.next(r));
132
+ u(i.next(l));
134
133
  } catch (f) {
135
- l(f);
134
+ c(f);
136
135
  }
137
136
  }
138
- function c(r) {
137
+ function r(l) {
139
138
  try {
140
- u(t.throw(r));
139
+ u(i.throw(l));
141
140
  } catch (f) {
142
- l(f);
141
+ c(f);
143
142
  }
144
143
  }
145
- function u(r) {
146
- r.done ? o(r.value) : a(r.value).then(n, c);
144
+ function u(l) {
145
+ l.done ? o(l.value) : a(l.value).then(n, r);
147
146
  }
148
- u((t = t.apply(i, e || [])).next());
147
+ u((i = i.apply(t, e || [])).next());
149
148
  });
150
149
  };
151
- class ke {
150
+ class ve {
152
151
  constructor(e) {
153
152
  this._semaphore = new ze(1, e);
154
153
  }
155
154
  acquire() {
156
- return ve(this, arguments, void 0, function* (e = 0) {
155
+ return ke(this, arguments, void 0, function* (e = 0) {
157
156
  const [, s] = yield this._semaphore.acquire(1, e);
158
157
  return s;
159
158
  });
@@ -174,319 +173,378 @@ class ke {
174
173
  return this._semaphore.cancel();
175
174
  }
176
175
  }
177
- const ge = (i) => [...new Set(i)], Te = (i, e, s = !0) => {
178
- const t = /* @__PURE__ */ new Map();
179
- return i.forEach((a) => {
176
+ const ge = (t) => [...new Set(t)], Te = (t, e, s = !0) => {
177
+ const i = /* @__PURE__ */ new Map();
178
+ return t.forEach((a) => {
180
179
  const o = e(a);
181
- if (t.has(o)) {
180
+ if (i.has(o)) {
182
181
  if (s) return;
183
- t.delete(o);
182
+ i.delete(o);
184
183
  }
185
- t.set(o, a);
186
- }), Array.from(t.values());
184
+ i.set(o, a);
185
+ }), Array.from(i.values());
187
186
  }, Ee = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
188
187
  __proto__: null,
189
188
  by: Te,
190
189
  unique: ge
191
- }, Symbol.toStringTag, { value: "Module" })), L = "DA@", A = "://", Ie = (i, e) => L.concat(e, A, i), Ce = (i) => {
192
- const [e, s] = i.split(A);
193
- if (s == null) return [i, ""];
194
- const [, t] = e.split(L);
195
- return [s, t];
196
- }, z = (i, e) => ({
197
- ...i,
198
- type: Ie(i.type, e)
199
- }), qe = (i) => {
200
- const [e, s] = Ce(i.type);
190
+ }, Symbol.toStringTag, { value: "Module" })), L = "DA@", A = "://", Me = (t, e) => L.concat(e, A, t), Ie = (t) => {
191
+ const [e, s] = t.split(A);
192
+ if (s == null) return [t, ""];
193
+ const [, i] = e.split(L);
194
+ return [s, i];
195
+ }, z = (t, e) => ({
196
+ ...t,
197
+ type: Me(t.type, e)
198
+ }), Ce = (t) => {
199
+ const [e, s] = Ie(t.type);
201
200
  return {
202
201
  emitted: s != null && s.length > 0,
203
202
  emitter: s,
204
- action: { ...i, type: e }
203
+ action: { ...t, type: e }
205
204
  };
206
- }, Me = (i) => {
205
+ }, qe = (t) => {
207
206
  const {
208
207
  centerCount: e,
209
208
  processCount: s,
210
- focusCount: t,
209
+ focusCount: i,
211
210
  stage: a,
212
211
  key: o,
213
- prerenderLabel: l,
212
+ prerenderLabel: c,
214
213
  reserved: n,
215
- minimized: c,
214
+ minimized: r,
216
215
  ...u
217
- } = i;
216
+ } = t;
218
217
  return u;
219
- }, Oe = async (i, e, s, t) => {
218
+ }, Oe = async (t, e, s, i) => {
220
219
  const a = (await s.listLabels()).filter(
221
- (r) => r !== w
222
- ), o = Object.keys(i.windows).filter((r) => r !== w);
223
- g(t, "syncInitial"), d(t, "existing windows in runtime", a.sort()), d(t, "non-main windows in state", o.sort()), T(t);
224
- const l = Ee.unique([...a, ...o]);
225
- for (const r of l)
226
- !a.includes(r) && s.isMain() ? (d(t, "state window not in runtime, creating", r), await D(s, r, i.windows[r], t)) : o.includes(r) || (d(t, "runtime window not in state, closing", r), await y(s, r, t));
227
- const n = s.label(), c = i.windows[n];
228
- if (c == null) return;
229
- const u = { ...ue };
230
- await R(u, c, s, t), e(
220
+ (l) => l !== w
221
+ ), o = Object.keys(t.windows).filter((l) => l !== w);
222
+ g(i, "syncInitial"), d(i, "existing windows in runtime", a.sort()), d(i, "non-main windows in state", o.sort()), T(i);
223
+ const c = Ee.unique([...a, ...o]);
224
+ for (const l of c)
225
+ !a.includes(l) && s.isMain() ? (d(i, "state window not in runtime, creating", l), await R(s, l, t.windows[l], i)) : o.includes(l) || (d(i, "runtime window not in state, closing", l), await p(s, l, i));
226
+ const n = s.label(), r = t.windows[n];
227
+ if (r == null) return;
228
+ const u = { ...N };
229
+ await P(u, r, s, i), e(
231
230
  E({ label: s.label(), ...await s.getProps() })
232
231
  );
233
- }, Le = async (i, e, s, t) => {
234
- d(t, "sync", i, e), s.isMain() && await Ae(i, e, s, t);
235
- const a = i.windows[s.label()], o = e.windows[s.label()];
236
- a == null || o == null || await R(a, o, s, t);
237
- }, R = async (i, e, s, t) => {
232
+ }, Le = async (t, e, s, i) => {
233
+ d(i, "sync", t, e), s.isMain() && await Ae(t, e, s, i);
234
+ const a = t.windows[s.label()], o = e.windows[s.label()];
235
+ a == null || o == null || await P(a, o, s, i);
236
+ }, P = async (t, e, s, i) => {
238
237
  const a = [];
239
- e.title != null && e.title !== i.title && a.push([
238
+ e.title != null && e.title !== t.title && a.push([
240
239
  "title",
241
- { prev: i.title, next: e.title },
240
+ { prev: t.title, next: e.title },
242
241
  async () => s.setTitle(e.title)
243
242
  ]);
244
- const o = e.visible != null && e.visible !== i.visible, l = e.visible === !1, n = () => a.push([
243
+ const o = e.visible != null && e.visible !== t.visible, c = e.visible === !1, n = () => a.push([
245
244
  "visible",
246
- { prev: i.visible, next: e.visible },
245
+ { prev: t.visible, next: e.visible },
247
246
  async () => {
248
247
  if (await s.setVisible(e.visible), e.visible === !1) return;
249
- let c = e.position;
250
- c ?? (c = (await s.getProps()).position), await s.setPosition(ce.translate(c, { x: 1, y: 1 })), await s.setPosition(c);
248
+ let r = e.position;
249
+ r ??= (await s.getProps()).position, r != null && (await s.setPosition(F.translate(r, { x: 1, y: 1 })), await s.setPosition(r));
251
250
  }
252
251
  ]);
253
- if (o && l && n(), e.skipTaskbar != null && e.skipTaskbar !== i.skipTaskbar && a.push([
252
+ if (o && c && n(), e.skipTaskbar != null && e.skipTaskbar !== t.skipTaskbar && a.push([
254
253
  "skipTaskbar",
255
- { prev: i.skipTaskbar, next: e.skipTaskbar },
254
+ { prev: t.skipTaskbar, next: e.skipTaskbar },
256
255
  async () => await s.setSkipTaskbar(e.skipTaskbar)
257
- ]), e.maximized != null && e.maximized !== i.maximized && a.push([
256
+ ]), e.maximized != null && e.maximized !== t.maximized && a.push([
258
257
  "maximized",
259
- { prev: i.maximized, next: e.maximized },
258
+ { prev: t.maximized, next: e.maximized },
260
259
  async () => await s.setMaximized(e.maximized)
261
- ]), e.fullscreen != null && e.fullscreen !== i.fullscreen && a.push([
260
+ ]), e.fullscreen != null && e.fullscreen !== t.fullscreen && a.push([
262
261
  "fullscreen",
263
- { prev: i.fullscreen, next: e.fullscreen },
262
+ { prev: t.fullscreen, next: e.fullscreen },
264
263
  async () => await s.setFullscreen(e.fullscreen)
265
- ]), e.centerCount !== i.centerCount && a.push([
264
+ ]), e.centerCount !== t.centerCount && a.push([
266
265
  "center",
267
- { prev: i.centerCount, next: e.centerCount },
266
+ { prev: t.centerCount, next: e.centerCount },
268
267
  async () => s.center()
269
- ]), e.minimized != null && e.minimized !== i.minimized && a.push([
268
+ ]), e.minimized != null && e.minimized !== t.minimized && a.push([
270
269
  "minimized",
271
- { prev: i.minimized, next: e.minimized },
270
+ { prev: t.minimized, next: e.minimized },
272
271
  async () => await s.setMinimized(e.minimized)
273
- ]), e.resizable != null && e.resizable !== i.resizable && a.push([
272
+ ]), e.resizable != null && e.resizable !== t.resizable && a.push([
274
273
  "resizable",
275
- { prev: i.resizable, next: e.resizable },
274
+ { prev: t.resizable, next: e.resizable },
276
275
  async () => await s.setResizable(e.resizable)
277
- ]), e.minSize != null && !p.equals(e.minSize, i.minSize) && a.push([
276
+ ]), e.minSize != null && !y.equals(e.minSize, t.minSize) && a.push([
278
277
  "minSize",
279
- { prev: i.minSize, next: e.minSize },
278
+ { prev: t.minSize, next: e.minSize },
280
279
  async () => await s.setMinSize(e.minSize)
281
- ]), e.maxSize != null && !p.equals(e.maxSize, i.maxSize) && a.push([
280
+ ]), e.maxSize != null && !y.equals(e.maxSize, t.maxSize) && a.push([
282
281
  "maxSize",
283
- { prev: i.maxSize, next: e.maxSize },
282
+ { prev: t.maxSize, next: e.maxSize },
284
283
  async () => await s.setMaxSize(e.maxSize)
285
- ]), e.size != null && !p.equals(e.size, i.size) && a.push([
284
+ ]), e.size != null && !y.equals(e.size, t.size) && a.push([
286
285
  "size",
287
- { prev: i.size, next: e.size },
286
+ { prev: t.size, next: e.size },
288
287
  async () => await s.setSize(e.size)
289
- ]), e.position != null && !p.equals(e.position, i.position) && a.push([
288
+ ]), e.position != null && !y.equals(e.position, t.position) && a.push([
290
289
  "position",
291
- { prev: i.position, next: e.position },
290
+ { prev: t.position, next: e.position },
292
291
  async () => await s.setPosition(e.position)
293
- ]), e.focusCount !== i.focusCount && a.push(
292
+ ]), e.focusCount !== t.focusCount && a.push(
294
293
  [
295
294
  "setVisible",
296
- { prev: i.visible, next: e.visible },
295
+ { prev: t.visible, next: e.visible },
297
296
  async () => await s.setVisible(!0)
298
297
  ],
299
298
  [
300
299
  "focus",
301
- { prev: i.focusCount, next: e.focusCount },
300
+ { prev: t.focusCount, next: e.focusCount },
302
301
  async () => await s.focus()
303
302
  ]
304
- ), e.decorations != null && e.decorations !== i.decorations && a.push([
303
+ ), e.decorations != null && e.decorations !== t.decorations && a.push([
305
304
  "decorations",
306
- { prev: i.decorations, next: e.decorations },
305
+ { prev: t.decorations, next: e.decorations },
307
306
  async () => await s.setDecorations(e.decorations)
308
- ]), e.alwaysOnTop != null && e.alwaysOnTop !== i.alwaysOnTop && a.push([
307
+ ]), e.alwaysOnTop != null && e.alwaysOnTop !== t.alwaysOnTop && a.push([
309
308
  "alwaysOnTop",
310
- { prev: i.alwaysOnTop, next: e.alwaysOnTop },
309
+ { prev: t.alwaysOnTop, next: e.alwaysOnTop },
311
310
  async () => await s.setAlwaysOnTop(e.alwaysOnTop)
312
- ]), o && !l && n(), a.length !== 0) {
313
- g(t, `syncCurrent, label: ${s.label()}, key: ${e.key}`);
314
- for (const [c, { prev: u, next: r }] of a) d(t, c, u, "->", r);
315
- T(t);
316
- for (const [, , c] of a) await c();
317
- }
318
- }, Ae = async (i, e, s, t) => {
319
- const a = Object.keys(i.windows).filter((n) => !(n in e.windows)), o = Object.keys(e.windows).filter((n) => !(n in i.windows)), l = s.isMain();
320
- if (l && a.length > 0)
311
+ ]), o && !c && n(), a.length !== 0) {
312
+ g(i, `syncCurrent, label: ${s.label()}, key: ${e.key}`);
313
+ for (const [r, { prev: u, next: l }] of a) d(i, r, u, "->", l);
314
+ T(i);
315
+ for (const [, , r] of a) await r();
316
+ }
317
+ }, Ae = async (t, e, s, i) => {
318
+ const a = Object.keys(t.windows).filter((n) => !(n in e.windows)), o = Object.keys(e.windows).filter((n) => !(n in t.windows)), c = s.isMain();
319
+ if (c && a.length > 0)
321
320
  for (const n of a)
322
- d(t, "syncMain", "closing", n), n === w && await Promise.all(
323
- Object.keys(e.windows).filter((c) => c !== w).map(async (c) => await y(s, c, t))
324
- ), await y(s, n, t);
325
- if (l && o.length > 0)
321
+ d(i, "syncMain", "closing", n), n === w && await Promise.all(
322
+ Object.keys(e.windows).filter((r) => r !== w).map(async (r) => await p(s, r, i))
323
+ ), await p(s, n, i);
324
+ if (c && o.length > 0)
326
325
  for (const n of o)
327
- await D(s, n, e.windows[n], t);
328
- }, D = async (i, e, s, t) => (d(t, "createWindow", s), await i.create(e, Me(s))), y = async (i, e, s) => (d(s, "closeWindow", e), await i.close(e)), S = "[drift] - unexpected undefined action", v = "[drift] - unexpected undefined action type", _ = (i) => {
329
- if (i.emitted ?? (i.emitted = !1), i.action == null)
330
- throw console.warn(S, i), new Error(S);
331
- if (i.action.type == null || i.action.type.length === 0)
332
- throw console.warn(v, i), new Error(v);
333
- }, Re = new ke(), De = [E.type, I.type], Pe = (i, e = !1) => (s) => (t) => (a) => {
334
- let { action: o, emitted: l, emitter: n } = qe(a);
335
- const c = i.label();
336
- _({ action: a, emitted: l, emitter: n });
337
- const u = N(o.type);
326
+ await R(s, n, e.windows[n], i);
327
+ }, R = async (t, e, s, i) => (d(i, "createWindow", s), await t.create(e, qe(s))), p = async (t, e, s) => (d(s, "closeWindow", e), await t.close(e)), S = "[drift] - unexpected undefined action", k = "[drift] - unexpected undefined action type", _ = (t) => {
328
+ if (t.emitted ??= !1, t.action == null)
329
+ throw console.warn(S, t), new Error(S);
330
+ if (t.action.type == null || t.action.type.length === 0)
331
+ throw console.warn(k, t), new Error(k);
332
+ }, Pe = new ve(), Re = [E.type, M.type], De = (t, e = !1) => (s) => (i) => (a) => {
333
+ let { action: o, emitted: c, emitter: n } = Ce(a);
334
+ const r = t.label();
335
+ _({ action: a, emitted: c, emitter: n });
336
+ const u = V(o.type);
338
337
  if (u && d(e, "[drift] - middleware", {
339
338
  action: o,
340
- emitted: l,
339
+ emitted: c,
341
340
  emitter: n,
342
- host: c
343
- }), n === i.label()) return;
344
- const r = u && !De.includes(o.type);
341
+ host: r
342
+ }), n === t.label()) return;
343
+ const l = u && !Re.includes(o.type);
345
344
  let f = null;
346
- u && (f = s.getState().drift, o = F(
345
+ u && (f = s.getState().drift, o = $(
347
346
  o,
348
347
  f
349
348
  ));
350
- const h = t(o), b = r ? s.getState().drift : null, P = V(l, o.type);
351
- return Re.runExclusive(async () => {
349
+ const h = i(o), b = l ? s.getState().drift : null, D = U(c, o.type);
350
+ return Pe.runExclusive(async () => {
352
351
  try {
353
- f !== null && b !== null && await Le(f, b, i, e), P && await i.emit({ action: o });
352
+ f !== null && b !== null && await Le(f, b, t, e), D && await t.emit({ action: o });
354
353
  } catch (m) {
355
354
  d(e, "[drift] - ERROR", {
356
355
  error: m.message,
357
356
  action: o,
358
- emitted: l,
357
+ emitted: c,
359
358
  emitter: n,
360
- host: c
361
- }), s.dispatch($({ key: c, message: m.message }));
359
+ host: r
360
+ }), s.dispatch(Q({ key: r, message: m.message }));
362
361
  }
363
362
  }), h;
364
- }, je = (i, e, s = !1) => (t) => {
365
- const a = i != null ? typeof i == "function" ? i(t) : i : t();
366
- return [Pe(e, s), ...a];
367
- }, Ne = async ({
368
- runtime: i,
363
+ }, je = (t, e, s = !1) => (i) => {
364
+ const a = t != null ? typeof t == "function" ? t(i) : t : i();
365
+ return [De(e, s), ...a];
366
+ }, Fe = async ({
367
+ runtime: t,
369
368
  preloadedState: e,
370
369
  middleware: s,
371
- debug: t = !1,
370
+ debug: i = !1,
372
371
  enablePrerender: a = !0,
373
372
  defaultWindowProps: o,
374
- ...l
373
+ ...c
375
374
  }) => {
376
- await i.configure();
375
+ await t.configure();
377
376
  let n;
378
377
  n = j({
379
- ...l,
380
- preloadedState: await Fe(
381
- t,
378
+ ...c,
379
+ preloadedState: await Ne(
382
380
  i,
381
+ t,
383
382
  () => n,
384
383
  o,
385
384
  e
386
385
  ),
387
- middleware: je(s, i, t)
388
- }), await Oe(n.getState().drift, n.dispatch, i, t);
389
- const c = i.label();
386
+ middleware: je(s, t, i)
387
+ }), await Oe(n.getState().drift, n.dispatch, t, i);
388
+ const r = t.label();
390
389
  return n.dispatch(
391
- U({ enablePrerender: a, defaultWindowProps: o, debug: t, label: c })
392
- ), n.dispatch(C({ stage: "created" })), i.onCloseRequested(() => n == null ? void 0 : n.dispatch(q({}))), n;
393
- }, Fe = async (i, e, s, t, a) => e.isMain() ? (await e.subscribe(({ action: l, emitter: n, sendState: c }) => {
390
+ Z({ enablePrerender: a, defaultWindowProps: o, debug: i, label: r })
391
+ ), n.dispatch(I({ stage: "created" })), t.onCloseRequested(() => n?.dispatch(C({}))), n;
392
+ }, Ne = async (t, e, s, i, a) => e.isMain() ? (await e.subscribe(({ action: c, emitter: n, sendState: r }) => {
394
393
  const u = s();
395
394
  if (u == null) return;
396
- if (l != null) {
397
- _({ action: l, emitter: n }), u.dispatch(z(l, n));
395
+ if (c != null) {
396
+ _({ action: c, emitter: n }), u.dispatch(z(c, n));
398
397
  return;
399
398
  }
400
- const r = u.getState();
401
- c === !0 && e.emit({ state: r }, n);
402
- }), typeof a == "function" ? k(t, i, await a()) : k(t, i, a)) : await new Promise((l, n) => {
399
+ const l = u.getState();
400
+ r === !0 && e.emit({ state: l }, n);
401
+ }), typeof a == "function" ? v(i, t, await a()) : v(i, t, a)) : await new Promise((c, n) => {
403
402
  (async () => {
404
403
  try {
405
- await e.subscribe(({ action: u, emitter: r, state: f }) => {
404
+ await e.subscribe(({ action: u, emitter: l, state: f }) => {
406
405
  const h = s();
407
406
  if (h == null)
408
- return f != null ? l(f) : void 0;
409
- u != null && (_({ action: u, emitter: r }), h.dispatch(z(u, r)));
407
+ return f != null ? c(f) : void 0;
408
+ u != null && (_({ action: u, emitter: l }), h.dispatch(z(u, l)));
410
409
  }), await e.emit({ sendState: !0 }, w);
411
410
  } catch (u) {
412
411
  n(u);
413
412
  }
414
413
  })();
415
- }), Ve = Ne, k = (i, e, s) => {
414
+ }), Ve = Fe, v = (t, e, s) => {
416
415
  if (s == null) return s;
417
- const t = s[M];
418
- return t.config.debug = e ?? t.config.debug, t.windows = Object.fromEntries(
419
- Object.entries(t.windows).filter(([, a]) => a.reserved).map(([a, o]) => ((i == null ? void 0 : i.visible) != null && (o.visible = i.visible), o.focusCount = 0, o.centerCount = 0, o.processCount = 0, [a, o]))
416
+ const i = s[q];
417
+ return i.config.debug = e ?? i.config.debug, i.windows = Object.fromEntries(
418
+ Object.entries(i.windows).filter(([, a]) => a.reserved).map(([a, o]) => (t?.visible != null && (o.visible = t.visible), o.focusCount = 0, o.centerCount = 0, o.processCount = 0, [a, o]))
420
419
  ), s;
421
- }, Ke = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
420
+ };
421
+ class $e {
422
+ async emit() {
423
+ }
424
+ async subscribe() {
425
+ }
426
+ isMain() {
427
+ return !0;
428
+ }
429
+ label() {
430
+ return w;
431
+ }
432
+ onCloseRequested() {
433
+ }
434
+ async listLabels() {
435
+ return [];
436
+ }
437
+ async getProps() {
438
+ return {};
439
+ }
440
+ async create() {
441
+ }
442
+ async close() {
443
+ }
444
+ async focus() {
445
+ }
446
+ async setMinimized() {
447
+ }
448
+ async setMaximized() {
449
+ }
450
+ async setVisible() {
451
+ }
452
+ async setFullscreen() {
453
+ }
454
+ async center() {
455
+ }
456
+ async setPosition() {
457
+ }
458
+ async setSize() {
459
+ }
460
+ async setMinSize() {
461
+ }
462
+ async setMaxSize() {
463
+ }
464
+ async setResizable() {
465
+ }
466
+ async setSkipTaskbar() {
467
+ }
468
+ async setAlwaysOnTop() {
469
+ }
470
+ async setDecorations() {
471
+ }
472
+ async setTitle() {
473
+ }
474
+ async configure() {
475
+ }
476
+ }
477
+ const Ke = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
422
478
  __proto__: null,
423
479
  MAIN_WINDOW: w,
424
- SLICE_NAME: M,
425
- ZERO_SLICE_STATE: Q,
426
- closeWindow: q,
427
- completeProcess: Z,
480
+ NoopRuntime: $e,
481
+ SLICE_NAME: q,
482
+ ZERO_SLICE_STATE: K,
483
+ closeWindow: C,
484
+ completeProcess: X,
428
485
  configureStore: Ve,
429
- createWindow: K,
430
- focusWindow: X,
431
- reducer: B,
432
- registerProcess: J,
433
- reloadWindow: I,
486
+ createWindow: B,
487
+ focusWindow: J,
488
+ reducer: Y,
489
+ registerProcess: G,
490
+ reloadWindow: M,
434
491
  selectSliceState: de,
435
492
  selectWindow: we,
436
493
  selectWindowAttribute: he,
437
- selectWindowKey: pe,
438
- selectWindowLabel: ye,
494
+ selectWindowKey: ye,
495
+ selectWindowLabel: pe,
439
496
  selectWindows: _e,
440
- setWindowAlwaysOnTop: Y,
441
- setWindowDecorations: G,
442
- setWindowFullscreen: H,
443
- setWindowMaxSize: x,
444
- setWindowMaximized: W,
445
- setWindowMinSize: ee,
446
- setWindowMinimized: se,
447
- setWindowPosition: ie,
448
- setWindowProps: te,
449
- setWindowResizable: ae,
450
- setWindowSize: oe,
451
- setWindowSkipTaskbar: ne,
452
- setWindowStage: C,
453
- setWindowTitle: le,
454
- setWindowVisible: re,
497
+ setWindowAlwaysOnTop: H,
498
+ setWindowDecorations: x,
499
+ setWindowFullscreen: W,
500
+ setWindowMaxSize: ee,
501
+ setWindowMaximized: se,
502
+ setWindowMinSize: te,
503
+ setWindowMinimized: ie,
504
+ setWindowPosition: ae,
505
+ setWindowProps: oe,
506
+ setWindowResizable: ne,
507
+ setWindowSize: ce,
508
+ setWindowSkipTaskbar: le,
509
+ setWindowStage: I,
510
+ setWindowTitle: re,
511
+ setWindowVisible: ue,
455
512
  windowPropsZ: fe
456
513
  }, Symbol.toStringTag, { value: "Module" }));
457
514
  export {
458
515
  Ke as Drift,
459
516
  w as MAIN_WINDOW,
460
- M as SLICE_NAME,
461
- Q as ZERO_SLICE_STATE,
462
- q as closeWindow,
463
- Z as completeProcess,
517
+ $e as NoopRuntime,
518
+ q as SLICE_NAME,
519
+ K as ZERO_SLICE_STATE,
520
+ C as closeWindow,
521
+ X as completeProcess,
464
522
  Ve as configureStore,
465
- K as createWindow,
466
- X as focusWindow,
467
- B as reducer,
468
- J as registerProcess,
469
- I as reloadWindow,
523
+ B as createWindow,
524
+ J as focusWindow,
525
+ Y as reducer,
526
+ G as registerProcess,
527
+ M as reloadWindow,
470
528
  de as selectSliceState,
471
529
  we as selectWindow,
472
530
  he as selectWindowAttribute,
473
- pe as selectWindowKey,
474
- ye as selectWindowLabel,
531
+ ye as selectWindowKey,
532
+ pe as selectWindowLabel,
475
533
  _e as selectWindows,
476
- Y as setWindowAlwaysOnTop,
477
- G as setWindowDecorations,
478
- H as setWindowFullscreen,
479
- x as setWindowMaxSize,
480
- W as setWindowMaximized,
481
- ee as setWindowMinSize,
482
- se as setWindowMinimized,
483
- ie as setWindowPosition,
484
- te as setWindowProps,
485
- ae as setWindowResizable,
486
- oe as setWindowSize,
487
- ne as setWindowSkipTaskbar,
488
- C as setWindowStage,
489
- le as setWindowTitle,
490
- re as setWindowVisible,
534
+ H as setWindowAlwaysOnTop,
535
+ x as setWindowDecorations,
536
+ W as setWindowFullscreen,
537
+ ee as setWindowMaxSize,
538
+ se as setWindowMaximized,
539
+ te as setWindowMinSize,
540
+ ie as setWindowMinimized,
541
+ ae as setWindowPosition,
542
+ oe as setWindowProps,
543
+ ne as setWindowResizable,
544
+ ce as setWindowSize,
545
+ le as setWindowSkipTaskbar,
546
+ I as setWindowStage,
547
+ re as setWindowTitle,
548
+ ue as setWindowVisible,
491
549
  fe as windowPropsZ
492
550
  };