@lukstei/dsh-client-split-view 0.0.0-stage → 0.2.2-rc.5.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.
@@ -0,0 +1,698 @@
1
+ /**
2
+ * Purpose: Manage state, references, and toggle logic for concurrent equal-width vertical session splits.
3
+ * Contract:
4
+ * - Inputs: Session IDs, ISessions controller, layout/workspace navigation callbacks.
5
+ * - Outputs: Observable SplitState with per-pane overlays and the suspended native view.
6
+ * - Errors: Throws immediately on missing services.
7
+ */
8
+ import type {
9
+ ISessions,
10
+ SessionReference,
11
+ SessionTarget,
12
+ } from "@deepseek-ai/dsh-api-session-controller/client";
13
+ import type { SessionId } from "@deepseek-ai/dsh-session/types";
14
+ import type { ISplitView, SplitOverlay, SplitState } from "./contract.ts";
15
+
16
+ export type { SplitOverlay, SplitState } from "./contract.ts";
17
+
18
+ export const SPLIT_VIEW_STORAGE_KEY = "dsh-client-split-view:state:v1";
19
+
20
+ export const isMobileViewport = (): boolean => {
21
+ if (typeof window === "undefined") return false;
22
+ return window.innerWidth < 768;
23
+ };
24
+
25
+ type PersistedOverlay =
26
+ | (Extract<SplitOverlay, { kind: "slot" }> & { readonly hostId: string })
27
+ | {
28
+ readonly hostId: string;
29
+ readonly kind: "file";
30
+ readonly file: Omit<Extract<SplitOverlay, { kind: "file" }>, "kind">;
31
+ }
32
+ | {
33
+ readonly hostId: string;
34
+ readonly kind: "session";
35
+ readonly session: {
36
+ readonly target: SessionTarget;
37
+ readonly title: string;
38
+ };
39
+ };
40
+
41
+ interface PersistedSplitState {
42
+ version: 1;
43
+ sessionIds: string[];
44
+ focusedSessionId?: string;
45
+ maximizedSessionId?: string;
46
+ suspended: boolean;
47
+ overlays: PersistedOverlay[];
48
+ }
49
+
50
+ function isJsonObject(value: unknown): value is Record<string, unknown> {
51
+ const ancestors = new Set<object>();
52
+ const isJson = (entry: unknown): boolean => {
53
+ if (
54
+ entry === null ||
55
+ typeof entry === "string" ||
56
+ typeof entry === "boolean"
57
+ )
58
+ return true;
59
+ if (typeof entry === "number") return Number.isFinite(entry);
60
+ if (typeof entry !== "object" || ancestors.has(entry)) return false;
61
+ if (
62
+ !Array.isArray(entry) &&
63
+ Object.getPrototypeOf(entry) !== Object.prototype
64
+ )
65
+ return false;
66
+ ancestors.add(entry);
67
+ const valid = Object.values(entry).every(isJson);
68
+ ancestors.delete(entry);
69
+ return valid;
70
+ };
71
+ return (
72
+ typeof value === "object" &&
73
+ value !== null &&
74
+ !Array.isArray(value) &&
75
+ isJson(value)
76
+ );
77
+ }
78
+
79
+ export class SplitStore implements ISplitView {
80
+ private sessionIds: SessionId[] = [];
81
+ private focusedSessionId: SessionId | undefined;
82
+ private maximizedSessionId: SessionId | undefined;
83
+ private hoveredSessionId: SessionId | undefined;
84
+ private suspended = false;
85
+ private fallbackPanelId: string | null = null;
86
+ private overlays = new Map<SessionId, SplitOverlay>();
87
+ private pointerOrigin: SessionId | undefined;
88
+ private readonly references = new Map<SessionId, SessionReference>();
89
+ private readonly listeners = new Set<() => void>();
90
+ private sessionsProvider?: () => ISessions;
91
+ private activeSessionProvider?: () => SessionId | undefined;
92
+ private navCallbacks?: {
93
+ selectPanel: (id: string | null) => void;
94
+ openSession: (id: SessionId) => void;
95
+ };
96
+ private snapshot: SplitState = {
97
+ sessionIds: [],
98
+ focusedSessionId: undefined,
99
+ maximizedSessionId: undefined,
100
+ hoveredSessionId: undefined,
101
+ suspended: false,
102
+ overlays: new Map(),
103
+ };
104
+
105
+ subscribe = (listener: () => void): (() => void) => {
106
+ this.listeners.add(listener);
107
+ return () => {
108
+ this.listeners.delete(listener);
109
+ };
110
+ };
111
+
112
+ getSnapshot = (): SplitState => {
113
+ return this.snapshot;
114
+ };
115
+
116
+ getReference = (id: SessionId): SessionReference | undefined => {
117
+ return this.references.get(id);
118
+ };
119
+
120
+ getOverlay = (id: SessionId): SplitOverlay | undefined => {
121
+ return this.overlays.get(id);
122
+ };
123
+
124
+ isSuspended = (): boolean => {
125
+ return this.suspended;
126
+ };
127
+
128
+ isSplitActive = (): boolean => {
129
+ return this.sessionIds.length > 0 && !this.suspended;
130
+ };
131
+
132
+ private persist = (): void => {
133
+ if (typeof localStorage === "undefined") return;
134
+ try {
135
+ if (this.sessionIds.length >= 1) {
136
+ const overlays: PersistedOverlay[] = [];
137
+ for (const [hostId, overlay] of this.overlays) {
138
+ if (overlay.kind === "slot") {
139
+ overlays.push({ hostId, ...overlay });
140
+ } else if (overlay.kind === "file") {
141
+ overlays.push({
142
+ hostId,
143
+ kind: "file",
144
+ file: {
145
+ address: overlay.address,
146
+ ownerSessionId: overlay.ownerSessionId,
147
+ path: overlay.path,
148
+ title: overlay.title,
149
+ },
150
+ });
151
+ } else if (overlay.kind === "session") {
152
+ overlays.push({
153
+ hostId,
154
+ kind: "session",
155
+ session: {
156
+ target: overlay.target,
157
+ title: overlay.title,
158
+ },
159
+ });
160
+ }
161
+ }
162
+ const state: PersistedSplitState = {
163
+ version: 1,
164
+ sessionIds: [...this.sessionIds],
165
+ focusedSessionId: this.focusedSessionId,
166
+ maximizedSessionId: this.maximizedSessionId,
167
+ suspended: this.suspended,
168
+ overlays,
169
+ };
170
+ localStorage.setItem(SPLIT_VIEW_STORAGE_KEY, JSON.stringify(state));
171
+ } else if (!this.suspended) {
172
+ localStorage.removeItem(SPLIT_VIEW_STORAGE_KEY);
173
+ }
174
+ } catch {
175
+ // defensive storage isolation: ignore quota/security errors
176
+ }
177
+ };
178
+
179
+ hydrate = (sessions: ISessions): void => {
180
+ if (typeof localStorage === "undefined") return;
181
+ try {
182
+ const raw = localStorage.getItem(SPLIT_VIEW_STORAGE_KEY);
183
+ if (raw === null) return;
184
+ const data = JSON.parse(raw) as Partial<PersistedSplitState>;
185
+ if (data.version !== 1 || !Array.isArray(data.sessionIds)) return;
186
+
187
+ const snapshot = sessions.list.getSnapshot();
188
+ if (snapshot.phase !== "ready") return;
189
+
190
+ const existingIds = new Set<string>(snapshot.ids);
191
+ const validIds = data.sessionIds.filter(
192
+ (id): id is SessionId => typeof id === "string" && existingIds.has(id),
193
+ );
194
+
195
+ if (validIds.length < 1) {
196
+ localStorage.removeItem(SPLIT_VIEW_STORAGE_KEY);
197
+ return;
198
+ }
199
+
200
+ for (const ref of this.references.values()) {
201
+ ref.release();
202
+ }
203
+ this.references.clear();
204
+ for (const hostId of [...this.overlays.keys()]) {
205
+ this.releaseOverlay(hostId);
206
+ }
207
+
208
+ const focusedId =
209
+ typeof data.focusedSessionId === "string" &&
210
+ validIds.includes(data.focusedSessionId as SessionId)
211
+ ? (data.focusedSessionId as SessionId)
212
+ : validIds[0];
213
+ const isMobile = isMobileViewport();
214
+ const targetIds = isMobile ? [focusedId] : validIds;
215
+
216
+ for (const id of targetIds) {
217
+ this.retain(id, sessions);
218
+ }
219
+ this.sessionIds = targetIds;
220
+ this.focusedSessionId = focusedId;
221
+ this.maximizedSessionId =
222
+ !isMobile &&
223
+ targetIds.length > 1 &&
224
+ typeof data.maximizedSessionId === "string" &&
225
+ targetIds.includes(data.maximizedSessionId as SessionId)
226
+ ? (data.maximizedSessionId as SessionId)
227
+ : undefined;
228
+ this.suspended = Boolean(data.suspended);
229
+
230
+ if (Array.isArray(data.overlays)) {
231
+ for (const overlay of data.overlays) {
232
+ if (
233
+ !overlay ||
234
+ typeof overlay.hostId !== "string" ||
235
+ !targetIds.includes(overlay.hostId as SessionId)
236
+ ) {
237
+ continue;
238
+ }
239
+ const hostId = overlay.hostId as SessionId;
240
+ if (overlay.kind === "slot") {
241
+ if (
242
+ typeof overlay.slotName !== "string" ||
243
+ typeof overlay.title !== "string" ||
244
+ !isJsonObject(overlay.props)
245
+ )
246
+ continue;
247
+ const { hostId: _hostId, ...state } = overlay;
248
+ this.overlays.set(hostId, state);
249
+ } else if (overlay.kind === "file") {
250
+ this.overlays.set(hostId, {
251
+ kind: "file",
252
+ address: overlay.file.address,
253
+ ownerSessionId: overlay.file.ownerSessionId,
254
+ path: overlay.file.path,
255
+ title: overlay.file.title,
256
+ });
257
+ } else if (overlay.kind === "session") {
258
+ const target = overlay.session.target;
259
+ const targetId =
260
+ typeof target === "string" ? target : target.childSessionId;
261
+ if (existingIds.has(targetId)) {
262
+ const reference = sessions.retain(target, {
263
+ source: "splitView",
264
+ });
265
+ this.overlays.set(hostId, {
266
+ kind: "session",
267
+ target,
268
+ title: overlay.session.title,
269
+ reference,
270
+ });
271
+ }
272
+ }
273
+ }
274
+ }
275
+
276
+ this.emit();
277
+ if (!this.suspended && this.navCallbacks !== undefined) {
278
+ this.navCallbacks.selectPanel("split-view");
279
+ }
280
+ } catch (error) {
281
+ // storage isolation: an unreadable snapshot must not break activation
282
+ console.warn("[split-view] hydrate failed", error);
283
+ }
284
+ };
285
+
286
+ private publish = (): void => {
287
+ this.snapshot = {
288
+ sessionIds: [...this.sessionIds],
289
+ focusedSessionId: this.focusedSessionId,
290
+ maximizedSessionId: this.maximizedSessionId,
291
+ hoveredSessionId: this.hoveredSessionId,
292
+ suspended: this.suspended,
293
+ overlays: new Map(this.overlays),
294
+ };
295
+ for (const listener of this.listeners) {
296
+ listener();
297
+ }
298
+ };
299
+
300
+ private emit = (): void => {
301
+ this.publish();
302
+ this.persist();
303
+ };
304
+
305
+ setCallbacks = (
306
+ selectPanel: (id: string | null) => void,
307
+ openSession: (id: SessionId) => void,
308
+ sessionsProvider: () => ISessions,
309
+ activeSessionProvider: () => SessionId | undefined,
310
+ ): void => {
311
+ this.navCallbacks = { selectPanel, openSession };
312
+ this.sessionsProvider = sessionsProvider;
313
+ this.activeSessionProvider = activeSessionProvider;
314
+ };
315
+
316
+ /** Remember which pane a pointer interaction originated from. */
317
+ setPointerOrigin = (id: SessionId): void => {
318
+ this.pointerOrigin = id;
319
+ };
320
+
321
+ /** Forget the pane origin after a pointer interaction outside every pane. */
322
+ clearPointerOrigin = (): void => {
323
+ this.pointerOrigin = undefined;
324
+ };
325
+
326
+ getPointerOrigin = (): SessionId | undefined => {
327
+ return this.pointerOrigin;
328
+ };
329
+
330
+ /**
331
+ * Toggle session into or out of split view.
332
+ */
333
+ toggleSession = (targetId: SessionId): void => {
334
+ if (this.sessionsProvider === undefined) {
335
+ throw new Error("SplitStore: ISessions provider not configured");
336
+ }
337
+ const effectiveSessions = this.sessionsProvider();
338
+ const effectiveActiveId =
339
+ this.activeSessionProvider !== undefined
340
+ ? this.activeSessionProvider()
341
+ : undefined;
342
+
343
+ if (isMobileViewport()) {
344
+ this.openSession(targetId);
345
+ return;
346
+ }
347
+
348
+ const isPresent = this.sessionIds.includes(targetId);
349
+
350
+ if (isPresent) {
351
+ this.removeSession(targetId);
352
+ return;
353
+ }
354
+
355
+ // Add targetId
356
+ if (this.sessionIds.length === 0) {
357
+ if (effectiveActiveId !== undefined && effectiveActiveId !== targetId) {
358
+ this.retain(effectiveActiveId, effectiveSessions);
359
+ this.sessionIds.push(effectiveActiveId);
360
+ }
361
+ }
362
+
363
+ this.retain(targetId, effectiveSessions);
364
+ this.sessionIds.push(targetId);
365
+ this.focusedSessionId = targetId;
366
+ this.suspended = false;
367
+ this.maximizedSessionId = undefined;
368
+
369
+ this.emit();
370
+ if (this.navCallbacks !== undefined) {
371
+ this.navCallbacks.selectPanel("split-view");
372
+ }
373
+ };
374
+
375
+ /**
376
+ * Open a single session in the non-native view, or focus it if already in split.
377
+ */
378
+ openSession = (targetId: SessionId): void => {
379
+ if (this.sessionsProvider === undefined) {
380
+ throw new Error("SplitStore: ISessions provider not configured");
381
+ }
382
+ const effectiveSessions = this.sessionsProvider();
383
+ const mobile = isMobileViewport();
384
+
385
+ const needsReset = mobile
386
+ ? this.sessionIds.length !== 1 || this.sessionIds[0] !== targetId
387
+ : !this.sessionIds.includes(targetId);
388
+
389
+ if (needsReset) {
390
+ for (const ref of this.references.values()) {
391
+ ref.release();
392
+ }
393
+ this.references.clear();
394
+ for (const hostId of [...this.overlays.keys()]) {
395
+ this.releaseOverlay(hostId);
396
+ }
397
+
398
+ this.retain(targetId, effectiveSessions);
399
+ this.sessionIds = [targetId];
400
+ }
401
+
402
+ this.focusedSessionId = targetId;
403
+ this.maximizedSessionId = undefined;
404
+ this.suspended = false;
405
+
406
+ this.emit();
407
+ if (this.navCallbacks !== undefined) {
408
+ this.navCallbacks.selectPanel("split-view");
409
+ }
410
+ };
411
+
412
+ /**
413
+ * Remove a single session from split view (e.g. from pane header close button).
414
+ */
415
+ removeSession = (targetId: SessionId): void => {
416
+ if (!this.sessionIds.includes(targetId)) return;
417
+ this.release(targetId);
418
+ this.closeOverlay(targetId);
419
+ this.sessionIds = this.sessionIds.filter((id) => id !== targetId);
420
+ if (this.hoveredSessionId === targetId) {
421
+ this.hoveredSessionId = undefined;
422
+ }
423
+ if (this.maximizedSessionId === targetId || this.sessionIds.length <= 1) {
424
+ this.maximizedSessionId = undefined;
425
+ }
426
+
427
+ if (this.sessionIds.length === 0) {
428
+ this.reset();
429
+ if (this.navCallbacks !== undefined) {
430
+ this.navCallbacks.selectPanel(this.fallbackPanelId);
431
+ }
432
+ return;
433
+ }
434
+
435
+ if (this.focusedSessionId === targetId) {
436
+ this.focusedSessionId = this.sessionIds[this.sessionIds.length - 1];
437
+ }
438
+ this.emit();
439
+ };
440
+
441
+ /**
442
+ * Show one pane's session in the native Conversation view while keeping the split.
443
+ */
444
+ suspend = (targetId: SessionId): void => {
445
+ if (this.sessionIds.length < 1) return;
446
+ this.suspended = true;
447
+ this.emit();
448
+ if (this.navCallbacks !== undefined) {
449
+ this.navCallbacks.openSession(targetId);
450
+ this.navCallbacks.selectPanel(null);
451
+ }
452
+ };
453
+
454
+ /** Return from the native Conversation view to the retained split. */
455
+ resume = (): void => {
456
+ if (!this.suspended) return;
457
+ this.suspended = false;
458
+ this.emit();
459
+ if (this.navCallbacks !== undefined) {
460
+ this.navCallbacks.selectPanel("split-view");
461
+ }
462
+ };
463
+
464
+ /** Layer another Session over one pane, releasing any previous overlay. */
465
+ openSessionOverlay = (
466
+ hostId: SessionId,
467
+ target: SessionTarget,
468
+ title: string,
469
+ sessions?: ISessions,
470
+ ): void => {
471
+ let effectiveSessions = sessions;
472
+ if (effectiveSessions === undefined) {
473
+ if (this.sessionsProvider === undefined) {
474
+ throw new Error("SplitStore: ISessions provider not configured");
475
+ }
476
+ effectiveSessions = this.sessionsProvider();
477
+ }
478
+ this.releaseOverlay(hostId);
479
+ this.overlays.set(hostId, {
480
+ kind: "session",
481
+ target,
482
+ title,
483
+ reference: effectiveSessions.retain(target, { source: "splitView" }),
484
+ });
485
+ this.emit();
486
+ };
487
+
488
+ setFallbackPanelId = (id: string | null): void => {
489
+ this.fallbackPanelId = id;
490
+ };
491
+
492
+ /** Layer a registered factory over one pane. */
493
+ openSlotOverlay: ISplitView["openSlotOverlay"] = (
494
+ hostId,
495
+ slotName,
496
+ title,
497
+ props,
498
+ ) => {
499
+ if (!isJsonObject(props))
500
+ throw new TypeError("Split overlay props must be a JSON object");
501
+ this.releaseOverlay(hostId);
502
+ // edge case: TypeScript cannot preserve a generic key/props pair when constructing the mapped union.
503
+ const overlay = { kind: "slot", slotName, title, props } as Extract<
504
+ SplitOverlay,
505
+ { kind: "slot" }
506
+ >;
507
+ this.overlays.set(hostId, overlay);
508
+ this.emit();
509
+ };
510
+
511
+ /** Layer one addressed file over one pane. */
512
+ openFileOverlay = (
513
+ hostId: SessionId,
514
+ file: {
515
+ address: string;
516
+ ownerSessionId: SessionId;
517
+ path: string;
518
+ title: string;
519
+ fullPath?: string;
520
+ },
521
+ ): void => {
522
+ this.releaseOverlay(hostId);
523
+ this.overlays.set(hostId, { kind: "file", ...file });
524
+ this.emit();
525
+ };
526
+
527
+ /** Update resolved full path for a file overlay. */
528
+ updateFileOverlayFullPath = (
529
+ hostId: SessionId,
530
+ address: string,
531
+ fullPath: string,
532
+ ): void => {
533
+ const current = this.overlays.get(hostId);
534
+ if (
535
+ current === undefined ||
536
+ current.kind !== "file" ||
537
+ current.address !== address
538
+ ) {
539
+ return;
540
+ }
541
+
542
+ if (current.fullPath !== fullPath) {
543
+ this.overlays.set(hostId, { ...current, fullPath });
544
+ this.emit();
545
+ }
546
+ };
547
+
548
+ /** Publish the fully loaded text of a file overlay for the pane's copy action. */
549
+ updateFileOverlayContents = (
550
+ hostId: SessionId,
551
+ address: string,
552
+ contents: string,
553
+ ): void => {
554
+ const current = this.overlays.get(hostId);
555
+ if (
556
+ current === undefined ||
557
+ current.kind !== "file" ||
558
+ current.address !== address ||
559
+ current.contents === contents
560
+ ) {
561
+ return;
562
+ }
563
+ this.overlays.set(hostId, { ...current, contents });
564
+ this.emit();
565
+ };
566
+
567
+ closeOverlay = (hostId: SessionId): void => {
568
+ if (!this.overlays.has(hostId)) return;
569
+ this.releaseOverlay(hostId);
570
+ this.emit();
571
+ };
572
+
573
+ /**
574
+ * Normal single click: reset split mode and switch back to single view.
575
+ */
576
+ resetToSingle = (): void => {
577
+ if (this.sessionIds.length > 0 || this.suspended) {
578
+ this.reset();
579
+ if (this.navCallbacks !== undefined) {
580
+ this.navCallbacks.selectPanel(null);
581
+ }
582
+ }
583
+ };
584
+
585
+ /**
586
+ * Toggle maximizing one pane to take all space in the split screen.
587
+ */
588
+ toggleMaximize = (targetId: SessionId): void => {
589
+ if (
590
+ isMobileViewport() ||
591
+ !this.sessionIds.includes(targetId) ||
592
+ this.sessionIds.length <= 1
593
+ )
594
+ return;
595
+ this.maximizedSessionId =
596
+ this.maximizedSessionId === targetId ? undefined : targetId;
597
+ this.setFocus(targetId);
598
+ this.emit();
599
+ };
600
+
601
+ /**
602
+ * Reorder a session tab to the position of targetId.
603
+ */
604
+ reorderSession = (sourceId: SessionId, targetId: SessionId): void => {
605
+ if (sourceId === targetId) return;
606
+ const sourceIndex = this.sessionIds.indexOf(sourceId);
607
+ const targetIndex = this.sessionIds.indexOf(targetId);
608
+ if (sourceIndex === -1 || targetIndex === -1) return;
609
+ const next = [...this.sessionIds];
610
+ next.splice(sourceIndex, 1);
611
+ next.splice(targetIndex, 0, sourceId);
612
+ this.sessionIds = next;
613
+ this.emit();
614
+ };
615
+
616
+ setFocus = (id: SessionId): void => {
617
+ if (this.focusedSessionId !== id && this.sessionIds.includes(id)) {
618
+ this.focusedSessionId = id;
619
+ this.emit();
620
+ }
621
+ };
622
+
623
+ /**
624
+ * Highlight one pane because its sidebar row is hovered; never persisted.
625
+ */
626
+ setHoveredSession = (targetId: SessionId | undefined): void => {
627
+ const next =
628
+ targetId !== undefined && this.sessionIds.includes(targetId)
629
+ ? targetId
630
+ : undefined;
631
+ if (this.hoveredSessionId === next) return;
632
+ this.hoveredSessionId = next;
633
+ this.publish();
634
+ };
635
+
636
+ private retain = (id: SessionId, sessions: ISessions): void => {
637
+ if (!this.references.has(id)) {
638
+ const ref = sessions.retain(id, { source: "splitView" });
639
+ this.references.set(id, ref);
640
+ }
641
+ };
642
+
643
+ private release = (id: SessionId): void => {
644
+ const ref = this.references.get(id);
645
+ if (ref !== undefined) {
646
+ ref.release();
647
+ this.references.delete(id);
648
+ }
649
+ };
650
+
651
+ private releaseOverlay = (hostId: SessionId): void => {
652
+ const overlay = this.overlays.get(hostId);
653
+ this.overlays.delete(hostId);
654
+ if (overlay !== undefined && overlay.kind === "session") {
655
+ overlay.reference.release();
656
+ }
657
+ };
658
+
659
+ /** In-memory teardown releasing references without deleting persisted state. */
660
+ dispose = (): void => {
661
+ for (const ref of this.references.values()) {
662
+ ref.release();
663
+ }
664
+ this.references.clear();
665
+ for (const hostId of [...this.overlays.keys()]) {
666
+ this.releaseOverlay(hostId);
667
+ }
668
+ this.sessionIds = [];
669
+ this.focusedSessionId = undefined;
670
+ this.maximizedSessionId = undefined;
671
+ this.suspended = false;
672
+ this.pointerOrigin = undefined;
673
+ this.snapshot = {
674
+ sessionIds: [],
675
+ focusedSessionId: undefined,
676
+ maximizedSessionId: undefined,
677
+ hoveredSessionId: undefined,
678
+ suspended: false,
679
+ overlays: new Map(),
680
+ };
681
+ for (const listener of this.listeners) {
682
+ listener();
683
+ }
684
+ };
685
+
686
+ private reset = (): void => {
687
+ this.dispose();
688
+ try {
689
+ if (typeof localStorage !== "undefined") {
690
+ localStorage.removeItem(SPLIT_VIEW_STORAGE_KEY);
691
+ }
692
+ } catch {
693
+ // ignore
694
+ }
695
+ };
696
+ }
697
+
698
+ export const splitStore = new SplitStore();