@shellui/core 0.0.18 → 0.0.20

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,1762 @@
1
+ // modules are defined as an array
2
+ // [ module function, map of requires ]
3
+ //
4
+ // map of requires is short require name -> numeric require
5
+ //
6
+ // anything defined in a previous bundle is accessed via the
7
+ // orig method which is the require for previous bundles
8
+
9
+ (function (
10
+ modules,
11
+ entry,
12
+ mainEntry,
13
+ parcelRequireName,
14
+ externals,
15
+ distDir,
16
+ publicUrl,
17
+ devServer
18
+ ) {
19
+ /* eslint-disable no-undef */
20
+ var globalObject =
21
+ typeof globalThis !== 'undefined'
22
+ ? globalThis
23
+ : typeof self !== 'undefined'
24
+ ? self
25
+ : typeof window !== 'undefined'
26
+ ? window
27
+ : typeof global !== 'undefined'
28
+ ? global
29
+ : {};
30
+ /* eslint-enable no-undef */
31
+
32
+ // Save the require from previous bundle to this closure if any
33
+ var previousRequire =
34
+ typeof globalObject[parcelRequireName] === 'function' &&
35
+ globalObject[parcelRequireName];
36
+
37
+ var importMap = previousRequire.i || {};
38
+ var cache = previousRequire.cache || {};
39
+ // Do not use `require` to prevent Webpack from trying to bundle this call
40
+ var nodeRequire =
41
+ typeof module !== 'undefined' &&
42
+ typeof module.require === 'function' &&
43
+ module.require.bind(module);
44
+
45
+ function newRequire(name, jumped) {
46
+ if (!cache[name]) {
47
+ if (!modules[name]) {
48
+ if (externals[name]) {
49
+ return externals[name];
50
+ }
51
+ // if we cannot find the module within our internal map or
52
+ // cache jump to the current global require ie. the last bundle
53
+ // that was added to the page.
54
+ var currentRequire =
55
+ typeof globalObject[parcelRequireName] === 'function' &&
56
+ globalObject[parcelRequireName];
57
+ if (!jumped && currentRequire) {
58
+ return currentRequire(name, true);
59
+ }
60
+
61
+ // If there are other bundles on this page the require from the
62
+ // previous one is saved to 'previousRequire'. Repeat this as
63
+ // many times as there are bundles until the module is found or
64
+ // we exhaust the require chain.
65
+ if (previousRequire) {
66
+ return previousRequire(name, true);
67
+ }
68
+
69
+ // Try the node require function if it exists.
70
+ if (nodeRequire && typeof name === 'string') {
71
+ return nodeRequire(name);
72
+ }
73
+
74
+ var err = new Error("Cannot find module '" + name + "'");
75
+ err.code = 'MODULE_NOT_FOUND';
76
+ throw err;
77
+ }
78
+
79
+ localRequire.resolve = resolve;
80
+ localRequire.cache = {};
81
+
82
+ var module = (cache[name] = new newRequire.Module(name));
83
+
84
+ modules[name][0].call(
85
+ module.exports,
86
+ localRequire,
87
+ module,
88
+ module.exports,
89
+ globalObject
90
+ );
91
+ }
92
+
93
+ return cache[name].exports;
94
+
95
+ function localRequire(x) {
96
+ var res = localRequire.resolve(x);
97
+ if (res === false) {
98
+ return {};
99
+ }
100
+ // Synthesize a module to follow re-exports.
101
+ if (Array.isArray(res)) {
102
+ var m = {__esModule: true};
103
+ res.forEach(function (v) {
104
+ var key = v[0];
105
+ var id = v[1];
106
+ var exp = v[2] || v[0];
107
+ var x = newRequire(id);
108
+ if (key === '*') {
109
+ Object.keys(x).forEach(function (key) {
110
+ if (
111
+ key === 'default' ||
112
+ key === '__esModule' ||
113
+ Object.prototype.hasOwnProperty.call(m, key)
114
+ ) {
115
+ return;
116
+ }
117
+
118
+ Object.defineProperty(m, key, {
119
+ enumerable: true,
120
+ get: function () {
121
+ return x[key];
122
+ },
123
+ });
124
+ });
125
+ } else if (exp === '*') {
126
+ Object.defineProperty(m, key, {
127
+ enumerable: true,
128
+ value: x,
129
+ });
130
+ } else {
131
+ Object.defineProperty(m, key, {
132
+ enumerable: true,
133
+ get: function () {
134
+ if (exp === 'default') {
135
+ return x.__esModule ? x.default : x;
136
+ }
137
+ return x[exp];
138
+ },
139
+ });
140
+ }
141
+ });
142
+ return m;
143
+ }
144
+ return newRequire(res);
145
+ }
146
+
147
+ function resolve(x) {
148
+ var id = modules[name][1][x];
149
+ return id != null ? id : x;
150
+ }
151
+ }
152
+
153
+ function Module(moduleName) {
154
+ this.id = moduleName;
155
+ this.bundle = newRequire;
156
+ this.require = nodeRequire;
157
+ this.exports = {};
158
+ }
159
+
160
+ newRequire.isParcelRequire = true;
161
+ newRequire.Module = Module;
162
+ newRequire.modules = modules;
163
+ newRequire.cache = cache;
164
+ newRequire.parent = previousRequire;
165
+ newRequire.distDir = distDir;
166
+ newRequire.publicUrl = publicUrl;
167
+ newRequire.devServer = devServer;
168
+ newRequire.i = importMap;
169
+ newRequire.register = function (id, exports) {
170
+ modules[id] = [
171
+ function (require, module) {
172
+ module.exports = exports;
173
+ },
174
+ {},
175
+ ];
176
+ };
177
+
178
+ // Only insert newRequire.load when it is actually used.
179
+ // The code in this file is linted against ES5, so dynamic import is not allowed.
180
+ // INSERT_LOAD_HERE
181
+
182
+ Object.defineProperty(newRequire, 'root', {
183
+ get: function () {
184
+ return globalObject[parcelRequireName];
185
+ },
186
+ });
187
+
188
+ globalObject[parcelRequireName] = newRequire;
189
+
190
+ for (var i = 0; i < entry.length; i++) {
191
+ newRequire(entry[i]);
192
+ }
193
+
194
+ if (mainEntry) {
195
+ // Expose entry point to Node, AMD or browser globals
196
+ // Based on https://github.com/ForbesLindesay/umd/blob/master/template.js
197
+ var mainExports = newRequire(mainEntry);
198
+
199
+ // CommonJS
200
+ if (typeof exports === 'object' && typeof module !== 'undefined') {
201
+ module.exports = mainExports;
202
+
203
+ // RequireJS
204
+ } else if (typeof define === 'function' && define.amd) {
205
+ define(function () {
206
+ return mainExports;
207
+ });
208
+ }
209
+ }
210
+ })({"bpbKD":[function(require,module,exports,__globalThis) {
211
+ var global = arguments[3];
212
+ var HMR_HOST = "localhost";
213
+ var HMR_PORT = null;
214
+ var HMR_SERVER_PORT = 4000;
215
+ var HMR_SECURE = false;
216
+ var HMR_ENV_HASH = "439701173a9199ea";
217
+ var HMR_USE_SSE = false;
218
+ module.bundle.HMR_BUNDLE_ID = "254ea4fd08724167";
219
+ "use strict";
220
+ /* global HMR_HOST, HMR_PORT, HMR_SERVER_PORT, HMR_ENV_HASH, HMR_SECURE, HMR_USE_SSE, chrome, browser, __parcel__import__, __parcel__importScripts__, ServiceWorkerGlobalScope */ /*::
221
+ import type {
222
+ HMRAsset,
223
+ HMRMessage,
224
+ } from '@parcel/reporter-dev-server/src/HMRServer.js';
225
+ interface ParcelRequire {
226
+ (string): mixed;
227
+ cache: {|[string]: ParcelModule|};
228
+ hotData: {|[string]: mixed|};
229
+ Module: any;
230
+ parent: ?ParcelRequire;
231
+ isParcelRequire: true;
232
+ modules: {|[string]: [Function, {|[string]: string|}]|};
233
+ HMR_BUNDLE_ID: string;
234
+ root: ParcelRequire;
235
+ }
236
+ interface ParcelModule {
237
+ hot: {|
238
+ data: mixed,
239
+ accept(cb: (Function) => void): void,
240
+ dispose(cb: (mixed) => void): void,
241
+ // accept(deps: Array<string> | string, cb: (Function) => void): void,
242
+ // decline(): void,
243
+ _acceptCallbacks: Array<(Function) => void>,
244
+ _disposeCallbacks: Array<(mixed) => void>,
245
+ |};
246
+ }
247
+ interface ExtensionContext {
248
+ runtime: {|
249
+ reload(): void,
250
+ getURL(url: string): string;
251
+ getManifest(): {manifest_version: number, ...};
252
+ |};
253
+ }
254
+ declare var module: {bundle: ParcelRequire, ...};
255
+ declare var HMR_HOST: string;
256
+ declare var HMR_PORT: string;
257
+ declare var HMR_SERVER_PORT: string;
258
+ declare var HMR_ENV_HASH: string;
259
+ declare var HMR_SECURE: boolean;
260
+ declare var HMR_USE_SSE: boolean;
261
+ declare var chrome: ExtensionContext;
262
+ declare var browser: ExtensionContext;
263
+ declare var __parcel__import__: (string) => Promise<void>;
264
+ declare var __parcel__importScripts__: (string) => Promise<void>;
265
+ declare var globalThis: typeof self;
266
+ declare var ServiceWorkerGlobalScope: Object;
267
+ */ var OVERLAY_ID = '__parcel__error__overlay__';
268
+ var OldModule = module.bundle.Module;
269
+ function Module(moduleName) {
270
+ OldModule.call(this, moduleName);
271
+ this.hot = {
272
+ data: module.bundle.hotData[moduleName],
273
+ _acceptCallbacks: [],
274
+ _disposeCallbacks: [],
275
+ accept: function(fn) {
276
+ this._acceptCallbacks.push(fn || function() {});
277
+ },
278
+ dispose: function(fn) {
279
+ this._disposeCallbacks.push(fn);
280
+ }
281
+ };
282
+ module.bundle.hotData[moduleName] = undefined;
283
+ }
284
+ module.bundle.Module = Module;
285
+ module.bundle.hotData = {};
286
+ var checkedAssets /*: {|[string]: boolean|} */ , disposedAssets /*: {|[string]: boolean|} */ , assetsToDispose /*: Array<[ParcelRequire, string]> */ , assetsToAccept /*: Array<[ParcelRequire, string]> */ , bundleNotFound = false;
287
+ function getHostname() {
288
+ return HMR_HOST || (typeof location !== 'undefined' && location.protocol.indexOf('http') === 0 ? location.hostname : 'localhost');
289
+ }
290
+ function getPort() {
291
+ return HMR_PORT || (typeof location !== 'undefined' ? location.port : HMR_SERVER_PORT);
292
+ }
293
+ // eslint-disable-next-line no-redeclare
294
+ let WebSocket = globalThis.WebSocket;
295
+ if (!WebSocket && typeof module.bundle.root === 'function') try {
296
+ // eslint-disable-next-line no-global-assign
297
+ WebSocket = module.bundle.root('ws');
298
+ } catch {
299
+ // ignore.
300
+ }
301
+ var hostname = getHostname();
302
+ var port = getPort();
303
+ var protocol = HMR_SECURE || typeof location !== 'undefined' && location.protocol === 'https:' && ![
304
+ 'localhost',
305
+ '127.0.0.1',
306
+ '0.0.0.0'
307
+ ].includes(hostname) ? 'wss' : 'ws';
308
+ // eslint-disable-next-line no-redeclare
309
+ var parent = module.bundle.parent;
310
+ if (!parent || !parent.isParcelRequire) {
311
+ // Web extension context
312
+ var extCtx = typeof browser === 'undefined' ? typeof chrome === 'undefined' ? null : chrome : browser;
313
+ // Safari doesn't support sourceURL in error stacks.
314
+ // eval may also be disabled via CSP, so do a quick check.
315
+ var supportsSourceURL = false;
316
+ try {
317
+ (0, eval)('throw new Error("test"); //# sourceURL=test.js');
318
+ } catch (err) {
319
+ supportsSourceURL = err.stack.includes('test.js');
320
+ }
321
+ var ws;
322
+ if (HMR_USE_SSE) ws = new EventSource('/__parcel_hmr');
323
+ else try {
324
+ // If we're running in the dev server's node runner, listen for messages on the parent port.
325
+ let { workerData, parentPort } = module.bundle.root('node:worker_threads') /*: any*/ ;
326
+ if (workerData !== null && workerData !== void 0 && workerData.__parcel) {
327
+ parentPort.on('message', async (message)=>{
328
+ try {
329
+ await handleMessage(message);
330
+ parentPort.postMessage('updated');
331
+ } catch {
332
+ parentPort.postMessage('restart');
333
+ }
334
+ });
335
+ // After the bundle has finished running, notify the dev server that the HMR update is complete.
336
+ queueMicrotask(()=>parentPort.postMessage('ready'));
337
+ }
338
+ } catch {
339
+ if (typeof WebSocket !== 'undefined') try {
340
+ ws = new WebSocket(protocol + '://' + hostname + (port ? ':' + port : '') + '/');
341
+ } catch (err) {
342
+ // Ignore cloudflare workers error.
343
+ if (err.message && !err.message.includes('Disallowed operation called within global scope')) console.error(err.message);
344
+ }
345
+ }
346
+ if (ws) {
347
+ // $FlowFixMe
348
+ ws.onmessage = async function(event /*: {data: string, ...} */ ) {
349
+ var data /*: HMRMessage */ = JSON.parse(event.data);
350
+ await handleMessage(data);
351
+ };
352
+ if (ws instanceof WebSocket) {
353
+ ws.onerror = function(e) {
354
+ if (e.message) console.error(e.message);
355
+ };
356
+ ws.onclose = function() {
357
+ console.warn("[parcel] \uD83D\uDEA8 Connection to the HMR server was lost");
358
+ };
359
+ }
360
+ }
361
+ }
362
+ async function handleMessage(data /*: HMRMessage */ ) {
363
+ checkedAssets = {} /*: {|[string]: boolean|} */ ;
364
+ disposedAssets = {} /*: {|[string]: boolean|} */ ;
365
+ assetsToAccept = [];
366
+ assetsToDispose = [];
367
+ bundleNotFound = false;
368
+ if (data.type === 'reload') fullReload();
369
+ else if (data.type === 'update') {
370
+ // Remove error overlay if there is one
371
+ if (typeof document !== 'undefined') removeErrorOverlay();
372
+ let assets = data.assets;
373
+ // Handle HMR Update
374
+ let handled = assets.every((asset)=>{
375
+ return asset.type === 'css' || asset.type === 'js' && hmrAcceptCheck(module.bundle.root, asset.id, asset.depsByBundle);
376
+ });
377
+ // Dispatch a custom event in case a bundle was not found. This might mean
378
+ // an asset on the server changed and we should reload the page. This event
379
+ // gives the client an opportunity to refresh without losing state
380
+ // (e.g. via React Server Components). If e.preventDefault() is not called,
381
+ // we will trigger a full page reload.
382
+ if (handled && bundleNotFound && assets.some((a)=>a.envHash !== HMR_ENV_HASH) && typeof window !== 'undefined' && typeof CustomEvent !== 'undefined') handled = !window.dispatchEvent(new CustomEvent('parcelhmrreload', {
383
+ cancelable: true
384
+ }));
385
+ if (handled) {
386
+ console.clear();
387
+ // Dispatch custom event so other runtimes (e.g React Refresh) are aware.
388
+ if (typeof window !== 'undefined' && typeof CustomEvent !== 'undefined') window.dispatchEvent(new CustomEvent('parcelhmraccept'));
389
+ await hmrApplyUpdates(assets);
390
+ hmrDisposeQueue();
391
+ // Run accept callbacks. This will also re-execute other disposed assets in topological order.
392
+ let processedAssets = {};
393
+ for(let i = 0; i < assetsToAccept.length; i++){
394
+ let id = assetsToAccept[i][1];
395
+ if (!processedAssets[id]) {
396
+ hmrAccept(assetsToAccept[i][0], id);
397
+ processedAssets[id] = true;
398
+ }
399
+ }
400
+ } else fullReload();
401
+ }
402
+ if (data.type === 'error') {
403
+ // Log parcel errors to console
404
+ for (let ansiDiagnostic of data.diagnostics.ansi){
405
+ let stack = ansiDiagnostic.codeframe ? ansiDiagnostic.codeframe : ansiDiagnostic.stack;
406
+ console.error("\uD83D\uDEA8 [parcel]: " + ansiDiagnostic.message + '\n' + stack + '\n\n' + ansiDiagnostic.hints.join('\n'));
407
+ }
408
+ if (typeof document !== 'undefined') {
409
+ // Render the fancy html overlay
410
+ removeErrorOverlay();
411
+ var overlay = createErrorOverlay(data.diagnostics.html);
412
+ // $FlowFixMe
413
+ document.body.appendChild(overlay);
414
+ }
415
+ }
416
+ }
417
+ function removeErrorOverlay() {
418
+ var overlay = document.getElementById(OVERLAY_ID);
419
+ if (overlay) {
420
+ overlay.remove();
421
+ console.log("[parcel] \u2728 Error resolved");
422
+ }
423
+ }
424
+ function createErrorOverlay(diagnostics) {
425
+ var overlay = document.createElement('div');
426
+ overlay.id = OVERLAY_ID;
427
+ let errorHTML = '<div style="background: black; opacity: 0.85; font-size: 16px; color: white; position: fixed; height: 100%; width: 100%; top: 0px; left: 0px; padding: 30px; font-family: Menlo, Consolas, monospace; z-index: 9999;">';
428
+ for (let diagnostic of diagnostics){
429
+ let stack = diagnostic.frames.length ? diagnostic.frames.reduce((p, frame)=>{
430
+ return `${p}
431
+ <a href="${protocol === 'wss' ? 'https' : 'http'}://${hostname}:${port}/__parcel_launch_editor?file=${encodeURIComponent(frame.location)}" style="text-decoration: underline; color: #888" onclick="fetch(this.href); return false">${frame.location}</a>
432
+ ${frame.code}`;
433
+ }, '') : diagnostic.stack;
434
+ errorHTML += `
435
+ <div>
436
+ <div style="font-size: 18px; font-weight: bold; margin-top: 20px;">
437
+ \u{1F6A8} ${diagnostic.message}
438
+ </div>
439
+ <pre>${stack}</pre>
440
+ <div>
441
+ ${diagnostic.hints.map((hint)=>"<div>\uD83D\uDCA1 " + hint + '</div>').join('')}
442
+ </div>
443
+ ${diagnostic.documentation ? `<div>\u{1F4DD} <a style="color: violet" href="${diagnostic.documentation}" target="_blank">Learn more</a></div>` : ''}
444
+ </div>
445
+ `;
446
+ }
447
+ errorHTML += '</div>';
448
+ overlay.innerHTML = errorHTML;
449
+ return overlay;
450
+ }
451
+ function fullReload() {
452
+ if (typeof location !== 'undefined' && 'reload' in location) location.reload();
453
+ else if (typeof extCtx !== 'undefined' && extCtx && extCtx.runtime && extCtx.runtime.reload) extCtx.runtime.reload();
454
+ else try {
455
+ let { workerData, parentPort } = module.bundle.root('node:worker_threads') /*: any*/ ;
456
+ if (workerData !== null && workerData !== void 0 && workerData.__parcel) parentPort.postMessage('restart');
457
+ } catch (err) {
458
+ console.error("[parcel] \u26A0\uFE0F An HMR update was not accepted. Please restart the process.");
459
+ }
460
+ }
461
+ function getParents(bundle, id) /*: Array<[ParcelRequire, string]> */ {
462
+ var modules = bundle.modules;
463
+ if (!modules) return [];
464
+ var parents = [];
465
+ var k, d, dep;
466
+ for(k in modules)for(d in modules[k][1]){
467
+ dep = modules[k][1][d];
468
+ if (dep === id || Array.isArray(dep) && dep[dep.length - 1] === id) parents.push([
469
+ bundle,
470
+ k
471
+ ]);
472
+ }
473
+ if (bundle.parent) parents = parents.concat(getParents(bundle.parent, id));
474
+ return parents;
475
+ }
476
+ function updateLink(link) {
477
+ var href = link.getAttribute('href');
478
+ if (!href) return;
479
+ var newLink = link.cloneNode();
480
+ newLink.onload = function() {
481
+ if (link.parentNode !== null) // $FlowFixMe
482
+ link.parentNode.removeChild(link);
483
+ };
484
+ newLink.setAttribute('href', // $FlowFixMe
485
+ href.split('?')[0] + '?' + Date.now());
486
+ // $FlowFixMe
487
+ link.parentNode.insertBefore(newLink, link.nextSibling);
488
+ }
489
+ var cssTimeout = null;
490
+ function reloadCSS() {
491
+ if (cssTimeout || typeof document === 'undefined') return;
492
+ cssTimeout = setTimeout(function() {
493
+ var links = document.querySelectorAll('link[rel="stylesheet"]');
494
+ for(var i = 0; i < links.length; i++){
495
+ // $FlowFixMe[incompatible-type]
496
+ var href /*: string */ = links[i].getAttribute('href');
497
+ var hostname = getHostname();
498
+ var servedFromHMRServer = hostname === 'localhost' ? new RegExp('^(https?:\\/\\/(0.0.0.0|127.0.0.1)|localhost):' + getPort()).test(href) : href.indexOf(hostname + ':' + getPort());
499
+ var absolute = /^https?:\/\//i.test(href) && href.indexOf(location.origin) !== 0 && !servedFromHMRServer;
500
+ if (!absolute) updateLink(links[i]);
501
+ }
502
+ cssTimeout = null;
503
+ }, 50);
504
+ }
505
+ function hmrDownload(asset) {
506
+ if (asset.type === 'js') {
507
+ if (typeof document !== 'undefined') {
508
+ let script = document.createElement('script');
509
+ script.src = asset.url + '?t=' + Date.now();
510
+ if (asset.outputFormat === 'esmodule') script.type = 'module';
511
+ return new Promise((resolve, reject)=>{
512
+ var _document$head;
513
+ script.onload = ()=>resolve(script);
514
+ script.onerror = reject;
515
+ (_document$head = document.head) === null || _document$head === void 0 || _document$head.appendChild(script);
516
+ });
517
+ } else if (typeof importScripts === 'function') {
518
+ // Worker scripts
519
+ if (asset.outputFormat === 'esmodule') return import(asset.url + '?t=' + Date.now());
520
+ else return new Promise((resolve, reject)=>{
521
+ try {
522
+ importScripts(asset.url + '?t=' + Date.now());
523
+ resolve();
524
+ } catch (err) {
525
+ reject(err);
526
+ }
527
+ });
528
+ }
529
+ }
530
+ }
531
+ async function hmrApplyUpdates(assets) {
532
+ global.parcelHotUpdate = Object.create(null);
533
+ let scriptsToRemove;
534
+ try {
535
+ // If sourceURL comments aren't supported in eval, we need to load
536
+ // the update from the dev server over HTTP so that stack traces
537
+ // are correct in errors/logs. This is much slower than eval, so
538
+ // we only do it if needed (currently just Safari).
539
+ // https://bugs.webkit.org/show_bug.cgi?id=137297
540
+ // This path is also taken if a CSP disallows eval.
541
+ if (!supportsSourceURL) {
542
+ let promises = assets.map((asset)=>{
543
+ var _hmrDownload;
544
+ return (_hmrDownload = hmrDownload(asset)) === null || _hmrDownload === void 0 ? void 0 : _hmrDownload.catch((err)=>{
545
+ // Web extension fix
546
+ if (extCtx && extCtx.runtime && extCtx.runtime.getManifest().manifest_version == 3 && typeof ServiceWorkerGlobalScope != 'undefined' && global instanceof ServiceWorkerGlobalScope) {
547
+ extCtx.runtime.reload();
548
+ return;
549
+ }
550
+ throw err;
551
+ });
552
+ });
553
+ scriptsToRemove = await Promise.all(promises);
554
+ }
555
+ assets.forEach(function(asset) {
556
+ hmrApply(module.bundle.root, asset);
557
+ });
558
+ } finally{
559
+ delete global.parcelHotUpdate;
560
+ if (scriptsToRemove) scriptsToRemove.forEach((script)=>{
561
+ if (script) {
562
+ var _document$head2;
563
+ (_document$head2 = document.head) === null || _document$head2 === void 0 || _document$head2.removeChild(script);
564
+ }
565
+ });
566
+ }
567
+ }
568
+ function hmrApply(bundle /*: ParcelRequire */ , asset /*: HMRAsset */ ) {
569
+ var modules = bundle.modules;
570
+ if (!modules) return;
571
+ if (asset.type === 'css') reloadCSS();
572
+ else if (asset.type === 'js') {
573
+ let deps = asset.depsByBundle[bundle.HMR_BUNDLE_ID];
574
+ if (deps) {
575
+ if (modules[asset.id]) {
576
+ // Remove dependencies that are removed and will become orphaned.
577
+ // This is necessary so that if the asset is added back again, the cache is gone, and we prevent a full page reload.
578
+ let oldDeps = modules[asset.id][1];
579
+ for(let dep in oldDeps)if (!deps[dep] || deps[dep] !== oldDeps[dep]) {
580
+ let id = oldDeps[dep];
581
+ let parents = getParents(module.bundle.root, id);
582
+ if (parents.length === 1) hmrDelete(module.bundle.root, id);
583
+ }
584
+ }
585
+ if (supportsSourceURL) // Global eval. We would use `new Function` here but browser
586
+ // support for source maps is better with eval.
587
+ (0, eval)(asset.output);
588
+ // $FlowFixMe
589
+ let fn = global.parcelHotUpdate[asset.id];
590
+ modules[asset.id] = [
591
+ fn,
592
+ deps
593
+ ];
594
+ }
595
+ // Always traverse to the parent bundle, even if we already replaced the asset in this bundle.
596
+ // This is required in case modules are duplicated. We need to ensure all instances have the updated code.
597
+ if (bundle.parent) hmrApply(bundle.parent, asset);
598
+ }
599
+ }
600
+ function hmrDelete(bundle, id) {
601
+ let modules = bundle.modules;
602
+ if (!modules) return;
603
+ if (modules[id]) {
604
+ // Collect dependencies that will become orphaned when this module is deleted.
605
+ let deps = modules[id][1];
606
+ let orphans = [];
607
+ for(let dep in deps){
608
+ let parents = getParents(module.bundle.root, deps[dep]);
609
+ if (parents.length === 1) orphans.push(deps[dep]);
610
+ }
611
+ // Delete the module. This must be done before deleting dependencies in case of circular dependencies.
612
+ delete modules[id];
613
+ delete bundle.cache[id];
614
+ // Now delete the orphans.
615
+ orphans.forEach((id)=>{
616
+ hmrDelete(module.bundle.root, id);
617
+ });
618
+ } else if (bundle.parent) hmrDelete(bundle.parent, id);
619
+ }
620
+ function hmrAcceptCheck(bundle /*: ParcelRequire */ , id /*: string */ , depsByBundle /*: ?{ [string]: { [string]: string } }*/ ) {
621
+ checkedAssets = {};
622
+ if (hmrAcceptCheckOne(bundle, id, depsByBundle)) return true;
623
+ // Traverse parents breadth first. All possible ancestries must accept the HMR update, or we'll reload.
624
+ let parents = getParents(module.bundle.root, id);
625
+ let accepted = false;
626
+ while(parents.length > 0){
627
+ let v = parents.shift();
628
+ let a = hmrAcceptCheckOne(v[0], v[1], null);
629
+ if (a) // If this parent accepts, stop traversing upward, but still consider siblings.
630
+ accepted = true;
631
+ else if (a !== null) {
632
+ // Otherwise, queue the parents in the next level upward.
633
+ let p = getParents(module.bundle.root, v[1]);
634
+ if (p.length === 0) {
635
+ // If there are no parents, then we've reached an entry without accepting. Reload.
636
+ accepted = false;
637
+ break;
638
+ }
639
+ parents.push(...p);
640
+ }
641
+ }
642
+ return accepted;
643
+ }
644
+ function hmrAcceptCheckOne(bundle /*: ParcelRequire */ , id /*: string */ , depsByBundle /*: ?{ [string]: { [string]: string } }*/ ) {
645
+ var modules = bundle.modules;
646
+ if (!modules) return;
647
+ if (depsByBundle && !depsByBundle[bundle.HMR_BUNDLE_ID]) {
648
+ // If we reached the root bundle without finding where the asset should go,
649
+ // there's nothing to do. Mark as "accepted" so we don't reload the page.
650
+ if (!bundle.parent) {
651
+ bundleNotFound = true;
652
+ return true;
653
+ }
654
+ return hmrAcceptCheckOne(bundle.parent, id, depsByBundle);
655
+ }
656
+ if (checkedAssets[id]) return null;
657
+ checkedAssets[id] = true;
658
+ var cached = bundle.cache[id];
659
+ if (!cached) return true;
660
+ assetsToDispose.push([
661
+ bundle,
662
+ id
663
+ ]);
664
+ if (cached && cached.hot && cached.hot._acceptCallbacks.length) {
665
+ assetsToAccept.push([
666
+ bundle,
667
+ id
668
+ ]);
669
+ return true;
670
+ }
671
+ return false;
672
+ }
673
+ function hmrDisposeQueue() {
674
+ // Dispose all old assets.
675
+ for(let i = 0; i < assetsToDispose.length; i++){
676
+ let id = assetsToDispose[i][1];
677
+ if (!disposedAssets[id]) {
678
+ hmrDispose(assetsToDispose[i][0], id);
679
+ disposedAssets[id] = true;
680
+ }
681
+ }
682
+ assetsToDispose = [];
683
+ }
684
+ function hmrDispose(bundle /*: ParcelRequire */ , id /*: string */ ) {
685
+ var cached = bundle.cache[id];
686
+ bundle.hotData[id] = {};
687
+ if (cached && cached.hot) cached.hot.data = bundle.hotData[id];
688
+ if (cached && cached.hot && cached.hot._disposeCallbacks.length) cached.hot._disposeCallbacks.forEach(function(cb) {
689
+ cb(bundle.hotData[id]);
690
+ });
691
+ delete bundle.cache[id];
692
+ }
693
+ function hmrAccept(bundle /*: ParcelRequire */ , id /*: string */ ) {
694
+ // Execute the module.
695
+ bundle(id);
696
+ // Run the accept callbacks in the new version of the module.
697
+ var cached = bundle.cache[id];
698
+ if (cached && cached.hot && cached.hot._acceptCallbacks.length) {
699
+ let assetsToAlsoAccept = [];
700
+ cached.hot._acceptCallbacks.forEach(function(cb) {
701
+ let additionalAssets = cb(function() {
702
+ return getParents(module.bundle.root, id);
703
+ });
704
+ if (Array.isArray(additionalAssets) && additionalAssets.length) assetsToAlsoAccept.push(...additionalAssets);
705
+ });
706
+ if (assetsToAlsoAccept.length) {
707
+ let handled = assetsToAlsoAccept.every(function(a) {
708
+ return hmrAcceptCheck(a[0], a[1]);
709
+ });
710
+ if (!handled) return fullReload();
711
+ hmrDisposeQueue();
712
+ }
713
+ }
714
+ }
715
+
716
+ },{}],"8iGsg":[function(require,module,exports,__globalThis) {
717
+ var $parcel$ReactRefreshHelpers$8f5d = require("@parcel/transformer-react-refresh-wrap/lib/helpers/helpers.js");
718
+ $parcel$ReactRefreshHelpers$8f5d.init();
719
+ var prevRefreshReg = globalThis.$RefreshReg$;
720
+ var prevRefreshSig = globalThis.$RefreshSig$;
721
+ $parcel$ReactRefreshHelpers$8f5d.prelude(module);
722
+
723
+ try {
724
+ var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js");
725
+ parcelHelpers.defineInteropFlag(exports);
726
+ parcelHelpers.export(exports, "WindowsLayout", ()=>WindowsLayout);
727
+ var _jsxRuntime = require("react/jsx-runtime");
728
+ var _react = require("react");
729
+ var _reactI18Next = require("react-i18next");
730
+ var _sdk = require("@shellui/sdk");
731
+ var _utils = require("./utils");
732
+ var _useSettings = require("../settings/hooks/useSettings");
733
+ var _layoutProviders = require("./LayoutProviders");
734
+ var _overlayShell = require("./OverlayShell");
735
+ var _contentView = require("@/components/ContentView");
736
+ var _utils1 = require("@/lib/utils");
737
+ var _zIndex = require("@/lib/z-index");
738
+ var _s = $RefreshSig$(), _s1 = $RefreshSig$();
739
+ const getExternalFaviconUrl = (url)=>{
740
+ try {
741
+ const parsed = new URL(url);
742
+ const hostname = parsed.hostname;
743
+ if (!hostname) return null;
744
+ return `https://icons.duckduckgo.com/ip3/${hostname}.ico`;
745
+ } catch {
746
+ return null;
747
+ }
748
+ };
749
+ /** True when the icon is a local app icon (/icons/); apply theme (dark invert) so it matches foreground. */ const isAppIcon = (src)=>src.startsWith('/icons/');
750
+ const genId = ()=>`win-${Date.now()}-${Math.random().toString(36).slice(2)}`;
751
+ const MIN_WIDTH = 280;
752
+ const MIN_HEIGHT = 200;
753
+ const DEFAULT_WIDTH = 720;
754
+ const DEFAULT_HEIGHT = 480;
755
+ const TASKBAR_HEIGHT = 48;
756
+ function getMaximizedBounds() {
757
+ return {
758
+ x: 0,
759
+ y: 0,
760
+ w: typeof window !== 'undefined' ? window.innerWidth : 800,
761
+ h: typeof window !== 'undefined' ? window.innerHeight - TASKBAR_HEIGHT : 600
762
+ };
763
+ }
764
+ function buildFinalUrl(baseUrl, path, pathname) {
765
+ const pathPrefix = `/${path}`;
766
+ const subPath = pathname.length > pathPrefix.length ? pathname.slice(pathPrefix.length + 1) : '';
767
+ if (!subPath) return baseUrl;
768
+ const base = baseUrl.endsWith('/') ? baseUrl : `${baseUrl}/`;
769
+ return `${base}${subPath}`;
770
+ }
771
+ /** Single draggable/resizable window */ function AppWindow({ win, navItem, currentLanguage, isFocused, onFocus, onClose, onBoundsChange, maxZIndex, zIndex }) {
772
+ _s();
773
+ const windowLabel = (0, _utils.resolveLocalizedString)(navItem.label, currentLanguage);
774
+ const [bounds, setBounds] = (0, _react.useState)(win.bounds);
775
+ const [isMaximized, setIsMaximized] = (0, _react.useState)(false);
776
+ const boundsBeforeMaximizeRef = (0, _react.useRef)(bounds);
777
+ const containerRef = (0, _react.useRef)(null);
778
+ const dragRef = (0, _react.useRef)(null);
779
+ const resizeRef = (0, _react.useRef)(null);
780
+ const resizeRafRef = (0, _react.useRef)(null);
781
+ const pendingResizeBoundsRef = (0, _react.useRef)(null);
782
+ (0, _react.useEffect)(()=>{
783
+ setBounds(win.bounds);
784
+ }, [
785
+ win.bounds
786
+ ]);
787
+ (0, _react.useEffect)(()=>{
788
+ onBoundsChange(bounds);
789
+ }, [
790
+ bounds,
791
+ onBoundsChange
792
+ ]);
793
+ // When maximized, keep filling the viewport on window resize
794
+ (0, _react.useEffect)(()=>{
795
+ if (!isMaximized) return;
796
+ const onResize = ()=>setBounds(getMaximizedBounds());
797
+ window.addEventListener('resize', onResize);
798
+ return ()=>window.removeEventListener('resize', onResize);
799
+ }, [
800
+ isMaximized
801
+ ]);
802
+ const onPointerMove = (0, _react.useCallback)((e)=>{
803
+ if (!dragRef.current) return;
804
+ const d = dragRef.current;
805
+ const dx = e.clientX - d.startX;
806
+ const dy = e.clientY - d.startY;
807
+ d.lastDx = dx;
808
+ d.lastDy = dy;
809
+ const el = containerRef.current;
810
+ if (el) {
811
+ el.style.willChange = 'transform';
812
+ el.style.transform = `translate(${dx}px, ${dy}px)`;
813
+ }
814
+ }, []);
815
+ const onPointerUp = (0, _react.useCallback)((e)=>{
816
+ const el = containerRef.current;
817
+ if (el) {
818
+ el.removeEventListener('pointermove', onPointerMove);
819
+ el.removeEventListener('pointerup', onPointerUp);
820
+ el.releasePointerCapture(e.pointerId);
821
+ }
822
+ if (dragRef.current) {
823
+ const d = dragRef.current;
824
+ if (el) {
825
+ el.style.transform = '';
826
+ el.style.willChange = '';
827
+ }
828
+ const finalBounds = {
829
+ ...d.startBounds,
830
+ x: Math.max(0, d.startBounds.x + d.lastDx),
831
+ y: Math.max(0, d.startBounds.y + d.lastDy)
832
+ };
833
+ setBounds(finalBounds);
834
+ dragRef.current = null;
835
+ }
836
+ }, [
837
+ onPointerMove
838
+ ]);
839
+ const handleTitlePointerDown = (0, _react.useCallback)((e)=>{
840
+ if (e.button !== 0 || isMaximized) return;
841
+ // Don't start drag when clicking a button (close, maximize) so their click handlers run
842
+ if (e.target.closest('button')) return;
843
+ e.preventDefault();
844
+ onFocus();
845
+ dragRef.current = {
846
+ startX: e.clientX,
847
+ startY: e.clientY,
848
+ startBounds: {
849
+ ...bounds
850
+ },
851
+ lastDx: 0,
852
+ lastDy: 0
853
+ };
854
+ const el = containerRef.current;
855
+ if (el) {
856
+ el.setPointerCapture(e.pointerId);
857
+ el.addEventListener('pointermove', onPointerMove, {
858
+ passive: true
859
+ });
860
+ el.addEventListener('pointerup', onPointerUp);
861
+ }
862
+ }, [
863
+ bounds,
864
+ isMaximized,
865
+ onFocus,
866
+ onPointerMove,
867
+ onPointerUp
868
+ ]);
869
+ const handleMaximizeToggle = (0, _react.useCallback)(()=>{
870
+ if (isMaximized) {
871
+ setBounds(boundsBeforeMaximizeRef.current);
872
+ setIsMaximized(false);
873
+ } else {
874
+ boundsBeforeMaximizeRef.current = {
875
+ ...bounds
876
+ };
877
+ setBounds(getMaximizedBounds());
878
+ setIsMaximized(true);
879
+ }
880
+ }, [
881
+ isMaximized,
882
+ bounds
883
+ ]);
884
+ const onResizePointerMove = (0, _react.useCallback)((e)=>{
885
+ if (!resizeRef.current) return;
886
+ const { edge, startX, startY, startBounds } = resizeRef.current;
887
+ const dx = e.clientX - startX;
888
+ const dy = e.clientY - startY;
889
+ const next = {
890
+ ...startBounds
891
+ };
892
+ if (edge.includes('e')) next.w = Math.max(MIN_WIDTH, startBounds.w + dx);
893
+ if (edge.includes('w')) {
894
+ const newW = Math.max(MIN_WIDTH, startBounds.w - dx);
895
+ next.x = startBounds.x + startBounds.w - newW;
896
+ next.w = newW;
897
+ }
898
+ if (edge.includes('s')) next.h = Math.max(MIN_HEIGHT, startBounds.h + dy);
899
+ if (edge.includes('n')) {
900
+ const newH = Math.max(MIN_HEIGHT, startBounds.h - dy);
901
+ next.y = startBounds.y + startBounds.h - newH;
902
+ next.h = newH;
903
+ }
904
+ pendingResizeBoundsRef.current = next;
905
+ if (resizeRafRef.current === null) resizeRafRef.current = requestAnimationFrame(()=>{
906
+ const pending = pendingResizeBoundsRef.current;
907
+ resizeRafRef.current = null;
908
+ pendingResizeBoundsRef.current = null;
909
+ if (pending) setBounds(pending);
910
+ });
911
+ }, []);
912
+ const onResizePointerUp = (0, _react.useCallback)((e)=>{
913
+ const el = containerRef.current;
914
+ if (el) {
915
+ el.removeEventListener('pointermove', onResizePointerMove);
916
+ el.removeEventListener('pointerup', onResizePointerUp);
917
+ el.releasePointerCapture(e.pointerId);
918
+ }
919
+ resizeRef.current = null;
920
+ }, [
921
+ onResizePointerMove
922
+ ]);
923
+ const handleResizePointerDown = (0, _react.useCallback)((e, edge)=>{
924
+ if (e.button !== 0) return;
925
+ e.preventDefault();
926
+ e.stopPropagation();
927
+ onFocus();
928
+ resizeRef.current = {
929
+ edge,
930
+ startX: e.clientX,
931
+ startY: e.clientY,
932
+ startBounds: {
933
+ ...bounds
934
+ }
935
+ };
936
+ const el = containerRef.current;
937
+ if (el) {
938
+ el.setPointerCapture(e.pointerId);
939
+ el.addEventListener('pointermove', onResizePointerMove, {
940
+ passive: true
941
+ });
942
+ el.addEventListener('pointerup', onResizePointerUp);
943
+ }
944
+ }, [
945
+ bounds,
946
+ onFocus,
947
+ onResizePointerMove,
948
+ onResizePointerUp
949
+ ]);
950
+ const finalUrl = (0, _react.useMemo)(()=>buildFinalUrl(win.baseUrl, win.path, win.pathname), [
951
+ win.baseUrl,
952
+ win.path,
953
+ win.pathname
954
+ ]);
955
+ const z = isFocused ? maxZIndex : zIndex;
956
+ return (0, _jsxRuntime.jsxs)("div", {
957
+ ref: containerRef,
958
+ className: "absolute flex flex-col rounded-lg border border-border bg-card shadow-lg overflow-hidden",
959
+ style: {
960
+ left: bounds.x,
961
+ top: bounds.y,
962
+ width: bounds.w,
963
+ height: bounds.h,
964
+ zIndex: z
965
+ },
966
+ onClick: onFocus,
967
+ onMouseDown: onFocus,
968
+ children: [
969
+ (0, _jsxRuntime.jsxs)("div", {
970
+ className: "flex items-center gap-2 pl-2 pr-1 py-1 bg-muted/80 border-b border-border cursor-move select-none shrink-0",
971
+ onPointerDown: handleTitlePointerDown,
972
+ children: [
973
+ win.icon && (0, _jsxRuntime.jsx)("img", {
974
+ src: win.icon,
975
+ alt: "",
976
+ className: (0, _utils1.cn)('h-4 w-4 shrink-0 rounded-sm object-cover', isAppIcon(win.icon) && 'opacity-90 dark:opacity-100 dark:invert')
977
+ }),
978
+ (0, _jsxRuntime.jsx)("span", {
979
+ className: "flex-1 text-sm font-medium truncate min-w-0",
980
+ children: windowLabel
981
+ }),
982
+ (0, _jsxRuntime.jsx)("button", {
983
+ type: "button",
984
+ onClick: (e)=>{
985
+ e.stopPropagation();
986
+ handleMaximizeToggle();
987
+ },
988
+ className: "p-1 rounded cursor-pointer text-muted-foreground hover:bg-sidebar-accent/50 hover:text-sidebar-foreground transition-colors focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2",
989
+ "aria-label": isMaximized ? 'Restore' : 'Maximize',
990
+ children: isMaximized ? (0, _jsxRuntime.jsx)(RestoreIcon, {
991
+ className: "h-4 w-4"
992
+ }) : (0, _jsxRuntime.jsx)(MaximizeIcon, {
993
+ className: "h-4 w-4"
994
+ })
995
+ }),
996
+ (0, _jsxRuntime.jsx)("button", {
997
+ type: "button",
998
+ onClick: (e)=>{
999
+ e.stopPropagation();
1000
+ onClose();
1001
+ },
1002
+ className: "p-1 rounded cursor-pointer text-muted-foreground hover:bg-destructive/20 hover:text-destructive transition-colors focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2",
1003
+ "aria-label": "Close",
1004
+ children: (0, _jsxRuntime.jsx)(CloseIcon, {
1005
+ className: "h-4 w-4"
1006
+ })
1007
+ })
1008
+ ]
1009
+ }),
1010
+ (0, _jsxRuntime.jsxs)("div", {
1011
+ className: "flex-1 min-h-0 relative bg-background",
1012
+ children: [
1013
+ !isFocused && (0, _jsxRuntime.jsx)("div", {
1014
+ className: "absolute inset-0 z-10 cursor-pointer",
1015
+ onClick: onFocus,
1016
+ onMouseDown: (e)=>{
1017
+ e.stopPropagation();
1018
+ onFocus();
1019
+ },
1020
+ "aria-hidden": true
1021
+ }),
1022
+ (0, _jsxRuntime.jsx)((0, _contentView.ContentView), {
1023
+ url: finalUrl,
1024
+ pathPrefix: win.path,
1025
+ ignoreMessages: true,
1026
+ navItem: navItem
1027
+ })
1028
+ ]
1029
+ }),
1030
+ !isMaximized && [
1031
+ 'n',
1032
+ 's',
1033
+ 'e',
1034
+ 'w',
1035
+ 'ne',
1036
+ 'nw',
1037
+ 'se',
1038
+ 'sw'
1039
+ ].map((edge)=>(0, _jsxRuntime.jsx)("div", {
1040
+ className: (0, _utils1.cn)('absolute bg-transparent', edge.includes('n') && 'top-0 h-2 cursor-n-resize', edge.includes('s') && 'bottom-0 h-2 cursor-s-resize', edge.includes('e') && 'right-0 w-2 cursor-e-resize', edge.includes('w') && 'left-0 w-2 cursor-w-resize', edge === 'n' && 'left-2 right-2', edge === 's' && 'left-2 right-2', edge === 'e' && 'top-2 bottom-2', edge === 'w' && 'top-2 bottom-2', edge === 'ne' && 'top-0 right-0 w-2 h-2 cursor-ne-resize', edge === 'nw' && 'top-0 left-0 w-2 h-2 cursor-nw-resize', edge === 'se' && 'bottom-0 right-0 w-2 h-2 cursor-se-resize', edge === 'sw' && 'bottom-0 left-0 w-2 h-2 cursor-sw-resize'),
1041
+ style: edge === 'n' ? {
1042
+ left: 8,
1043
+ right: 8
1044
+ } : edge === 's' ? {
1045
+ left: 8,
1046
+ right: 8
1047
+ } : edge === 'e' ? {
1048
+ top: 8,
1049
+ bottom: 8
1050
+ } : edge === 'w' ? {
1051
+ top: 8,
1052
+ bottom: 8
1053
+ } : undefined,
1054
+ onPointerDown: (e)=>handleResizePointerDown(e, edge)
1055
+ }, edge))
1056
+ ]
1057
+ });
1058
+ }
1059
+ _s(AppWindow, "HLpnQX9Dm1+8VkKTR+Qrce0gudU=");
1060
+ _c = AppWindow;
1061
+ function MaximizeIcon({ className }) {
1062
+ return (0, _jsxRuntime.jsxs)("svg", {
1063
+ xmlns: "http://www.w3.org/2000/svg",
1064
+ width: "24",
1065
+ height: "24",
1066
+ viewBox: "0 0 24 24",
1067
+ fill: "none",
1068
+ stroke: "currentColor",
1069
+ strokeWidth: "2",
1070
+ strokeLinecap: "round",
1071
+ strokeLinejoin: "round",
1072
+ className: className,
1073
+ "aria-hidden": true,
1074
+ children: [
1075
+ (0, _jsxRuntime.jsx)("path", {
1076
+ d: "M8 3H5a2 2 0 0 0-2 2v3"
1077
+ }),
1078
+ (0, _jsxRuntime.jsx)("path", {
1079
+ d: "M21 8V5a2 2 0 0 0-2-2h-3"
1080
+ }),
1081
+ (0, _jsxRuntime.jsx)("path", {
1082
+ d: "M3 16v3a2 2 0 0 0 2 2h3"
1083
+ }),
1084
+ (0, _jsxRuntime.jsx)("path", {
1085
+ d: "M16 21h3a2 2 0 0 0 2-2v-3"
1086
+ })
1087
+ ]
1088
+ });
1089
+ }
1090
+ _c1 = MaximizeIcon;
1091
+ function RestoreIcon({ className }) {
1092
+ return (0, _jsxRuntime.jsxs)("svg", {
1093
+ xmlns: "http://www.w3.org/2000/svg",
1094
+ width: "24",
1095
+ height: "24",
1096
+ viewBox: "0 0 24 24",
1097
+ fill: "none",
1098
+ stroke: "currentColor",
1099
+ strokeWidth: "2",
1100
+ strokeLinecap: "round",
1101
+ strokeLinejoin: "round",
1102
+ className: className,
1103
+ "aria-hidden": true,
1104
+ children: [
1105
+ (0, _jsxRuntime.jsx)("rect", {
1106
+ x: "3",
1107
+ y: "3",
1108
+ width: "10",
1109
+ height: "10",
1110
+ rx: "1"
1111
+ }),
1112
+ (0, _jsxRuntime.jsx)("rect", {
1113
+ x: "11",
1114
+ y: "11",
1115
+ width: "10",
1116
+ height: "10",
1117
+ rx: "1"
1118
+ })
1119
+ ]
1120
+ });
1121
+ }
1122
+ _c2 = RestoreIcon;
1123
+ function CloseIcon({ className }) {
1124
+ return (0, _jsxRuntime.jsxs)("svg", {
1125
+ xmlns: "http://www.w3.org/2000/svg",
1126
+ width: "24",
1127
+ height: "24",
1128
+ viewBox: "0 0 24 24",
1129
+ fill: "none",
1130
+ stroke: "currentColor",
1131
+ strokeWidth: "2",
1132
+ strokeLinecap: "round",
1133
+ strokeLinejoin: "round",
1134
+ className: className,
1135
+ "aria-hidden": true,
1136
+ children: [
1137
+ (0, _jsxRuntime.jsx)("path", {
1138
+ d: "M18 6 6 18"
1139
+ }),
1140
+ (0, _jsxRuntime.jsx)("path", {
1141
+ d: "m6 6 12 12"
1142
+ })
1143
+ ]
1144
+ });
1145
+ }
1146
+ _c3 = CloseIcon;
1147
+ /** Start menu icon (Windows-style) */ function StartIcon({ className }) {
1148
+ return (0, _jsxRuntime.jsx)("svg", {
1149
+ xmlns: "http://www.w3.org/2000/svg",
1150
+ width: "24",
1151
+ height: "24",
1152
+ viewBox: "0 0 24 24",
1153
+ fill: "currentColor",
1154
+ className: className,
1155
+ "aria-hidden": true,
1156
+ children: (0, _jsxRuntime.jsx)("path", {
1157
+ d: "M3 3h8v8H3V3zm10 0h8v8h-8V3zM3 13h8v8H3v-8zm10 0h8v8h-8v-8z"
1158
+ })
1159
+ });
1160
+ }
1161
+ _c4 = StartIcon;
1162
+ function getBrowserTimezone() {
1163
+ if (typeof window !== 'undefined' && Intl.DateTimeFormat) return Intl.DateTimeFormat().resolvedOptions().timeZone;
1164
+ return 'UTC';
1165
+ }
1166
+ function WindowsLayout({ title, appIcon: _appIcon, logo: _logo, navigation }) {
1167
+ _s1();
1168
+ const { i18n } = (0, _reactI18Next.useTranslation)();
1169
+ const { settings } = (0, _useSettings.useSettings)();
1170
+ const currentLanguage = i18n.language || 'en';
1171
+ const timeZone = settings.region?.timezone ?? getBrowserTimezone();
1172
+ const { startNavItems, endNavItems, navigationItems } = (0, _react.useMemo)(()=>{
1173
+ const { start, end } = (0, _utils.splitNavigationByPosition)(navigation);
1174
+ return {
1175
+ startNavItems: (0, _utils.flattenNavigationItems)(start),
1176
+ endNavItems: end,
1177
+ navigationItems: (0, _utils.flattenNavigationItems)(navigation)
1178
+ };
1179
+ }, [
1180
+ navigation
1181
+ ]);
1182
+ const [windows, setWindows] = (0, _react.useState)([]);
1183
+ /** Id of the window that is on top (first plan). Clicking a window or its taskbar button sets this. */ const [frontWindowId, setFrontWindowId] = (0, _react.useState)(null);
1184
+ const [startMenuOpen, setStartMenuOpen] = (0, _react.useState)(false);
1185
+ const [now, setNow] = (0, _react.useState)(()=>new Date());
1186
+ const startPanelRef = (0, _react.useRef)(null);
1187
+ // Update date/time every second for taskbar clock
1188
+ (0, _react.useEffect)(()=>{
1189
+ const interval = setInterval(()=>setNow(new Date()), 1000);
1190
+ return ()=>clearInterval(interval);
1191
+ }, []);
1192
+ /** Highest z-index: front window always gets this so it stays on top. */ const maxZIndex = (0, _react.useMemo)(()=>(0, _zIndex.Z_INDEX).WINDOWS_WINDOW_BASE + Math.max(windows.length, 1), [
1193
+ windows.length
1194
+ ]);
1195
+ const openWindow = (0, _react.useCallback)((item)=>{
1196
+ const label = typeof item.label === 'string' ? item.label : (0, _utils.resolveLocalizedString)(item.label, currentLanguage);
1197
+ const faviconUrl = item.openIn === 'external' && !item.icon ? getExternalFaviconUrl(item.url) : null;
1198
+ const icon = item.icon ?? faviconUrl ?? null;
1199
+ const id = genId();
1200
+ const bounds = {
1201
+ x: 60 + windows.length * 24,
1202
+ y: 60 + windows.length * 24,
1203
+ w: DEFAULT_WIDTH,
1204
+ h: DEFAULT_HEIGHT
1205
+ };
1206
+ setWindows((prev)=>[
1207
+ ...prev,
1208
+ {
1209
+ id,
1210
+ path: item.path,
1211
+ pathname: `/${item.path}`,
1212
+ baseUrl: item.url,
1213
+ label,
1214
+ icon,
1215
+ bounds
1216
+ }
1217
+ ]);
1218
+ setFrontWindowId(id);
1219
+ setStartMenuOpen(false);
1220
+ }, [
1221
+ currentLanguage,
1222
+ windows.length
1223
+ ]);
1224
+ const closeWindow = (0, _react.useCallback)((id)=>{
1225
+ setWindows((prev)=>prev.filter((w)=>w.id !== id));
1226
+ setFrontWindowId((current)=>current === id ? null : current);
1227
+ }, []);
1228
+ // When front window is closed or missing, bring first window to front
1229
+ (0, _react.useEffect)(()=>{
1230
+ if (windows.length === 0) {
1231
+ setFrontWindowId(null);
1232
+ return;
1233
+ }
1234
+ const frontStillExists = frontWindowId !== null && windows.some((w)=>w.id === frontWindowId);
1235
+ if (!frontStillExists) setFrontWindowId(windows[0].id);
1236
+ }, [
1237
+ windows,
1238
+ frontWindowId
1239
+ ]);
1240
+ /** Bring the window to front (first plan). Used when clicking the window or its taskbar button. */ const focusWindow = (0, _react.useCallback)((id)=>{
1241
+ setFrontWindowId(id);
1242
+ }, []);
1243
+ const updateWindowBounds = (0, _react.useCallback)((id, bounds)=>{
1244
+ setWindows((prev)=>prev.map((w)=>w.id === id ? {
1245
+ ...w,
1246
+ bounds
1247
+ } : w));
1248
+ }, []);
1249
+ // Close start menu on click outside
1250
+ (0, _react.useEffect)(()=>{
1251
+ if (!startMenuOpen) return;
1252
+ const onDocClick = (e)=>{
1253
+ if (startPanelRef.current && !startPanelRef.current.contains(e.target)) setStartMenuOpen(false);
1254
+ };
1255
+ document.addEventListener('mousedown', onDocClick);
1256
+ return ()=>document.removeEventListener('mousedown', onDocClick);
1257
+ }, [
1258
+ startMenuOpen
1259
+ ]);
1260
+ const handleNavClick = (0, _react.useCallback)((item)=>{
1261
+ if (item.openIn === 'modal') {
1262
+ (0, _sdk.shellui).openModal(item.url);
1263
+ setStartMenuOpen(false);
1264
+ return;
1265
+ }
1266
+ if (item.openIn === 'drawer') {
1267
+ (0, _sdk.shellui).openDrawer({
1268
+ url: item.url,
1269
+ position: item.drawerPosition
1270
+ });
1271
+ setStartMenuOpen(false);
1272
+ return;
1273
+ }
1274
+ if (item.openIn === 'external') {
1275
+ window.open(item.url, '_blank', 'noopener,noreferrer');
1276
+ setStartMenuOpen(false);
1277
+ return;
1278
+ }
1279
+ openWindow(item);
1280
+ }, [
1281
+ openWindow
1282
+ ]);
1283
+ return (0, _jsxRuntime.jsx)((0, _layoutProviders.LayoutProviders), {
1284
+ children: (0, _jsxRuntime.jsxs)((0, _overlayShell.OverlayShell), {
1285
+ navigationItems: navigationItems,
1286
+ children: [
1287
+ (0, _jsxRuntime.jsx)("div", {
1288
+ className: "fixed inset-0 bg-muted/30",
1289
+ style: {
1290
+ paddingBottom: TASKBAR_HEIGHT
1291
+ },
1292
+ children: windows.map((win, index)=>{
1293
+ const navItem = navigationItems.find((n)=>n.path === win.path);
1294
+ if (!navItem) return null;
1295
+ const isFocused = win.id === frontWindowId;
1296
+ const zIndex = (0, _zIndex.Z_INDEX).WINDOWS_WINDOW_BASE + index;
1297
+ return (0, _jsxRuntime.jsx)(AppWindow, {
1298
+ win: win,
1299
+ navItem: navItem,
1300
+ currentLanguage: currentLanguage,
1301
+ isFocused: isFocused,
1302
+ onFocus: ()=>focusWindow(win.id),
1303
+ onClose: ()=>closeWindow(win.id),
1304
+ onBoundsChange: (bounds)=>updateWindowBounds(win.id, bounds),
1305
+ maxZIndex: maxZIndex,
1306
+ zIndex: zIndex
1307
+ }, win.id);
1308
+ })
1309
+ }),
1310
+ (0, _jsxRuntime.jsxs)("div", {
1311
+ className: "fixed left-0 right-0 bottom-0 flex items-center gap-1 px-2 border-t border-border bg-sidebar-background",
1312
+ style: {
1313
+ height: TASKBAR_HEIGHT,
1314
+ zIndex: (0, _zIndex.Z_INDEX).WINDOWS_TASKBAR,
1315
+ paddingBottom: 'env(safe-area-inset-bottom, 0px)'
1316
+ },
1317
+ children: [
1318
+ (0, _jsxRuntime.jsxs)("div", {
1319
+ className: "relative shrink-0",
1320
+ ref: startPanelRef,
1321
+ children: [
1322
+ (0, _jsxRuntime.jsxs)("button", {
1323
+ type: "button",
1324
+ onClick: ()=>setStartMenuOpen((o)=>!o),
1325
+ className: (0, _utils1.cn)('flex items-center gap-2 h-9 px-3 rounded cursor-pointer transition-colors focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2', startMenuOpen ? 'bg-sidebar-accent text-sidebar-accent-foreground' : 'text-sidebar-foreground hover:bg-sidebar-accent/50 hover:text-sidebar-foreground'),
1326
+ "aria-expanded": startMenuOpen,
1327
+ "aria-haspopup": "true",
1328
+ "aria-label": "Start",
1329
+ children: [
1330
+ (0, _jsxRuntime.jsx)(StartIcon, {
1331
+ className: "h-5 w-5"
1332
+ }),
1333
+ (0, _jsxRuntime.jsx)("span", {
1334
+ className: "font-semibold text-sm hidden sm:inline",
1335
+ children: title || 'Start'
1336
+ })
1337
+ ]
1338
+ }),
1339
+ startMenuOpen && (0, _jsxRuntime.jsxs)("div", {
1340
+ className: "absolute bottom-full left-0 mb-1 w-64 max-h-[70vh] overflow-y-auto rounded-lg border border-border bg-popover shadow-lg py-2 z-[10001]",
1341
+ style: {
1342
+ zIndex: (0, _zIndex.Z_INDEX).MODAL_CONTENT
1343
+ },
1344
+ children: [
1345
+ (0, _jsxRuntime.jsx)("div", {
1346
+ className: "px-2 pb-2 border-b border-border mb-2",
1347
+ children: (0, _jsxRuntime.jsx)("span", {
1348
+ className: "text-sm font-semibold text-popover-foreground",
1349
+ children: title || 'Applications'
1350
+ })
1351
+ }),
1352
+ (0, _jsxRuntime.jsx)("div", {
1353
+ className: "grid gap-0.5",
1354
+ children: startNavItems.filter((item)=>!item.hidden).map((item)=>{
1355
+ const label = typeof item.label === 'string' ? item.label : (0, _utils.resolveLocalizedString)(item.label, currentLanguage);
1356
+ const icon = item.icon ?? (item.openIn === 'external' ? getExternalFaviconUrl(item.url) : null);
1357
+ return (0, _jsxRuntime.jsxs)("button", {
1358
+ type: "button",
1359
+ onClick: ()=>handleNavClick(item),
1360
+ className: "flex items-center gap-3 w-full px-3 py-2 text-left text-sm cursor-pointer text-popover-foreground hover:bg-accent hover:text-accent-foreground rounded-none transition-colors focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2",
1361
+ children: [
1362
+ icon ? (0, _jsxRuntime.jsx)("img", {
1363
+ src: icon,
1364
+ alt: "",
1365
+ className: (0, _utils1.cn)('h-5 w-5 shrink-0 rounded-sm object-cover', isAppIcon(icon) && 'opacity-90 dark:opacity-100 dark:invert')
1366
+ }) : (0, _jsxRuntime.jsx)("span", {
1367
+ className: "h-5 w-5 shrink-0 rounded-sm bg-muted"
1368
+ }),
1369
+ (0, _jsxRuntime.jsx)("span", {
1370
+ className: "truncate",
1371
+ children: label
1372
+ })
1373
+ ]
1374
+ }, item.path);
1375
+ })
1376
+ })
1377
+ ]
1378
+ })
1379
+ ]
1380
+ }),
1381
+ (0, _jsxRuntime.jsx)("div", {
1382
+ className: "flex-1 flex items-center gap-1 min-w-0 overflow-x-auto",
1383
+ children: windows.map((win)=>{
1384
+ const navItem = navigationItems.find((n)=>n.path === win.path);
1385
+ const windowLabel = navItem ? (0, _utils.resolveLocalizedString)(navItem.label, currentLanguage) : win.label;
1386
+ const isFocused = win.id === frontWindowId;
1387
+ return (0, _jsxRuntime.jsxs)("button", {
1388
+ type: "button",
1389
+ onClick: ()=>focusWindow(win.id),
1390
+ onContextMenu: (e)=>{
1391
+ e.preventDefault();
1392
+ closeWindow(win.id);
1393
+ },
1394
+ className: (0, _utils1.cn)('flex items-center gap-2 h-8 px-2 rounded min-w-0 max-w-[140px] shrink-0 cursor-pointer transition-colors focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2', isFocused ? 'bg-sidebar-accent text-sidebar-accent-foreground' : 'text-sidebar-foreground hover:bg-sidebar-accent/50 hover:text-sidebar-foreground'),
1395
+ title: windowLabel,
1396
+ children: [
1397
+ win.icon ? (0, _jsxRuntime.jsx)("img", {
1398
+ src: win.icon,
1399
+ alt: "",
1400
+ className: (0, _utils1.cn)('h-4 w-4 shrink-0 rounded-sm object-cover', isAppIcon(win.icon) && 'opacity-90 dark:opacity-100 dark:invert')
1401
+ }) : (0, _jsxRuntime.jsx)("span", {
1402
+ className: "h-4 w-4 shrink-0 rounded-sm bg-muted"
1403
+ }),
1404
+ (0, _jsxRuntime.jsx)("span", {
1405
+ className: "text-xs truncate",
1406
+ children: windowLabel
1407
+ })
1408
+ ]
1409
+ }, win.id);
1410
+ })
1411
+ }),
1412
+ endNavItems.length > 0 && (0, _jsxRuntime.jsx)("div", {
1413
+ className: "flex items-center gap-0.5 shrink-0 border-l border-sidebar-border pl-2 ml-1",
1414
+ children: endNavItems.map((item)=>{
1415
+ const label = typeof item.label === 'string' ? item.label : (0, _utils.resolveLocalizedString)(item.label, currentLanguage);
1416
+ const icon = item.icon ?? (item.openIn === 'external' ? getExternalFaviconUrl(item.url) : null);
1417
+ return (0, _jsxRuntime.jsxs)("button", {
1418
+ type: "button",
1419
+ onClick: ()=>handleNavClick(item),
1420
+ className: "flex items-center gap-2 h-8 px-2 rounded cursor-pointer text-sidebar-foreground hover:bg-sidebar-accent/50 hover:text-sidebar-foreground transition-colors focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2",
1421
+ title: label,
1422
+ children: [
1423
+ icon ? (0, _jsxRuntime.jsx)("img", {
1424
+ src: icon,
1425
+ alt: "",
1426
+ className: (0, _utils1.cn)('h-4 w-4 shrink-0 rounded-sm object-cover', isAppIcon(icon) && 'opacity-90 dark:opacity-100 dark:invert')
1427
+ }) : (0, _jsxRuntime.jsx)("span", {
1428
+ className: "h-4 w-4 shrink-0 rounded-sm bg-muted"
1429
+ }),
1430
+ (0, _jsxRuntime.jsx)("span", {
1431
+ className: "text-xs truncate max-w-[100px]",
1432
+ children: label
1433
+ })
1434
+ ]
1435
+ }, item.path);
1436
+ })
1437
+ }),
1438
+ (0, _jsxRuntime.jsxs)("div", {
1439
+ className: "flex flex-col items-end justify-center shrink-0 px-3 py-1 text-sidebar-foreground border-l border-sidebar-border ml-1 min-w-0",
1440
+ style: {
1441
+ paddingRight: 'max(0.75rem, env(safe-area-inset-right))'
1442
+ },
1443
+ role: "timer",
1444
+ "aria-live": "off",
1445
+ "aria-label": new Intl.DateTimeFormat(currentLanguage, {
1446
+ timeZone,
1447
+ dateStyle: 'full',
1448
+ timeStyle: 'medium'
1449
+ }).format(now),
1450
+ children: [
1451
+ (0, _jsxRuntime.jsx)("time", {
1452
+ dateTime: now.toISOString(),
1453
+ className: "text-xs leading-tight tabular-nums whitespace-nowrap",
1454
+ children: new Intl.DateTimeFormat(currentLanguage, {
1455
+ timeZone,
1456
+ hour: '2-digit',
1457
+ minute: '2-digit',
1458
+ second: '2-digit'
1459
+ }).format(now)
1460
+ }),
1461
+ (0, _jsxRuntime.jsx)("time", {
1462
+ dateTime: now.toISOString(),
1463
+ className: "text-[10px] leading-tight whitespace-nowrap text-sidebar-foreground/90",
1464
+ children: new Intl.DateTimeFormat(currentLanguage, {
1465
+ timeZone,
1466
+ weekday: 'short',
1467
+ day: 'numeric',
1468
+ month: 'short'
1469
+ }).format(now)
1470
+ })
1471
+ ]
1472
+ })
1473
+ ]
1474
+ })
1475
+ ]
1476
+ })
1477
+ });
1478
+ }
1479
+ _s1(WindowsLayout, "LZip9+xQ6LCIuveRzYGmYY2v/WY=", false, function() {
1480
+ return [
1481
+ (0, _reactI18Next.useTranslation),
1482
+ (0, _useSettings.useSettings)
1483
+ ];
1484
+ });
1485
+ _c5 = WindowsLayout;
1486
+ var _c, _c1, _c2, _c3, _c4, _c5;
1487
+ $RefreshReg$(_c, "AppWindow");
1488
+ $RefreshReg$(_c1, "MaximizeIcon");
1489
+ $RefreshReg$(_c2, "RestoreIcon");
1490
+ $RefreshReg$(_c3, "CloseIcon");
1491
+ $RefreshReg$(_c4, "StartIcon");
1492
+ $RefreshReg$(_c5, "WindowsLayout");
1493
+
1494
+ $parcel$ReactRefreshHelpers$8f5d.postlude(module);
1495
+ } finally {
1496
+ globalThis.$RefreshReg$ = prevRefreshReg;
1497
+ globalThis.$RefreshSig$ = prevRefreshSig;
1498
+ }
1499
+ },{"react/jsx-runtime":"05iiF","react":"jMk1U","react-i18next":"gKfGQ","@shellui/sdk":"dS2fb","./utils":"4dqXA","../settings/hooks/useSettings":"hj85U","./LayoutProviders":"go6VO","./OverlayShell":"2PvVD","@/components/ContentView":"iJhlx","@/lib/utils":"58RPa","@/lib/z-index":"eChN4","@parcel/transformer-js/src/esmodule-helpers.js":"jnFvT","@parcel/transformer-react-refresh-wrap/lib/helpers/helpers.js":"7h6Pi"}],"iJhlx":[function(require,module,exports,__globalThis) {
1500
+ var $parcel$ReactRefreshHelpers$9dc4 = require("@parcel/transformer-react-refresh-wrap/lib/helpers/helpers.js");
1501
+ $parcel$ReactRefreshHelpers$9dc4.init();
1502
+ var prevRefreshReg = globalThis.$RefreshReg$;
1503
+ var prevRefreshSig = globalThis.$RefreshSig$;
1504
+ $parcel$ReactRefreshHelpers$9dc4.prelude(module);
1505
+
1506
+ try {
1507
+ var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js");
1508
+ parcelHelpers.defineInteropFlag(exports);
1509
+ parcelHelpers.export(exports, "ContentView", ()=>ContentView);
1510
+ var _jsxRuntime = require("react/jsx-runtime");
1511
+ var _sdk = require("@shellui/sdk");
1512
+ var _react = require("react");
1513
+ var _reactRouter = require("react-router");
1514
+ var _loadingOverlay = require("./LoadingOverlay");
1515
+ var _s = $RefreshSig$();
1516
+ const logger = (0, _sdk.getLogger)('shellcore');
1517
+ const ContentView = ({ url, pathPrefix, ignoreMessages = false, navItem })=>{
1518
+ _s();
1519
+ const navigate = (0, _reactRouter.useNavigate)();
1520
+ const iframeRef = (0, _react.useRef)(null);
1521
+ const isInternalNavigation = (0, _react.useRef)(false);
1522
+ const [initialUrl] = (0, _react.useState)(url);
1523
+ const [isLoading, setIsLoading] = (0, _react.useState)(true);
1524
+ (0, _react.useEffect)(()=>{
1525
+ if (!iframeRef.current) return;
1526
+ const iframeId = (0, _sdk.addIframe)(iframeRef.current);
1527
+ return ()=>{
1528
+ (0, _sdk.removeIframe)(iframeId);
1529
+ };
1530
+ }, []);
1531
+ // Sync parent URL when iframe notifies us of a change
1532
+ (0, _react.useEffect)(()=>{
1533
+ const cleanup = (0, _sdk.shellui).addMessageListener('SHELLUI_URL_CHANGED', (data, event)=>{
1534
+ if (ignoreMessages) return;
1535
+ // Ignore URL CHANGE from other than ContentView iframe
1536
+ if (event.source !== iframeRef.current?.contentWindow) return;
1537
+ const { pathname, search, hash } = data.payload;
1538
+ // Remove leading slash and trailing slashes from iframe pathname
1539
+ let cleanPathname = pathname.startsWith(navItem.url) ? pathname.slice(navItem.url.length) : pathname;
1540
+ cleanPathname = cleanPathname.startsWith('/') ? cleanPathname.slice(1) : cleanPathname;
1541
+ cleanPathname = cleanPathname.replace(/\/+$/, ''); // Remove trailing slashes
1542
+ // Construct the new path without trailing slashes
1543
+ let newShellPath = cleanPathname ? `/${pathPrefix}/${cleanPathname}${search}${hash}` : `/${pathPrefix}${search}${hash}`;
1544
+ // Normalize: remove trailing slashes from pathname part only (preserve query/hash)
1545
+ const urlParts = newShellPath.match(/^([^?#]*)([?#].*)?$/);
1546
+ if (urlParts) {
1547
+ const pathnamePart = urlParts[1].replace(/\/+$/, '') || '/';
1548
+ const queryHashPart = urlParts[2] || '';
1549
+ newShellPath = pathnamePart + queryHashPart;
1550
+ }
1551
+ // Normalize current path for comparison (remove trailing slashes from pathname)
1552
+ const currentPathname = window.location.pathname.replace(/\/+$/, '') || '/';
1553
+ const currentPath = currentPathname + window.location.search + window.location.hash;
1554
+ // Normalize new path for comparison
1555
+ const newPathParts = newShellPath.match(/^([^?#]*)([?#].*)?$/);
1556
+ const normalizedNewPathname = newPathParts?.[1]?.replace(/\/+$/, '') || '/';
1557
+ const normalizedNewPath = normalizedNewPathname + (newPathParts?.[2] || '');
1558
+ if (currentPath !== normalizedNewPath) {
1559
+ // Mark this navigation as internal so we don't try to "push" it back to the iframe
1560
+ isInternalNavigation.current = true;
1561
+ navigate(newShellPath, {
1562
+ replace: true
1563
+ });
1564
+ // Reset the flag after a short delay to allow the render cycle to complete
1565
+ setTimeout(()=>{
1566
+ isInternalNavigation.current = false;
1567
+ }, 100);
1568
+ }
1569
+ });
1570
+ return ()=>{
1571
+ cleanup();
1572
+ };
1573
+ }, [
1574
+ pathPrefix,
1575
+ navigate
1576
+ ]);
1577
+ // Hide loading overlay when iframe sends SHELLUI_INITIALIZED
1578
+ (0, _react.useEffect)(()=>{
1579
+ const cleanup = (0, _sdk.shellui).addMessageListener('SHELLUI_INITIALIZED', (_data, event)=>{
1580
+ if (event.source === iframeRef.current?.contentWindow) setIsLoading(false);
1581
+ });
1582
+ return ()=>cleanup();
1583
+ }, []);
1584
+ // Fallback: hide overlay after 400ms if SHELLUI_INITIALIZED was not received
1585
+ (0, _react.useEffect)(()=>{
1586
+ if (!isLoading) return;
1587
+ const timeoutId = setTimeout(()=>{
1588
+ logger.info('ContentView: Timeout expired, hiding loading overlay');
1589
+ setIsLoading(false);
1590
+ }, 400);
1591
+ return ()=>clearTimeout(timeoutId);
1592
+ }, [
1593
+ isLoading
1594
+ ]);
1595
+ // Handle external URL changes (e.g. from Sidebar)
1596
+ (0, _react.useEffect)(()=>{
1597
+ if (iframeRef.current && !isInternalNavigation.current) // Only update iframe src if it's actually different from its current src
1598
+ // to avoid unnecessary reloads
1599
+ {
1600
+ if (iframeRef.current.src !== url) {
1601
+ iframeRef.current.src = url;
1602
+ setIsLoading(true);
1603
+ }
1604
+ }
1605
+ }, [
1606
+ url
1607
+ ]);
1608
+ // Inject script to prevent "Layout was forced" warning by deferring layout until stylesheets load
1609
+ (0, _react.useEffect)(()=>{
1610
+ const iframe = iframeRef.current;
1611
+ if (!iframe) return;
1612
+ const handleLoad = ()=>{
1613
+ try {
1614
+ const iframeWindow = iframe.contentWindow;
1615
+ const iframeDoc = iframe.contentDocument || iframeWindow?.document;
1616
+ if (!iframeDoc || !iframeWindow) return;
1617
+ // Inject a script that waits for stylesheets before allowing layout calculations
1618
+ const script = iframeDoc.createElement('script');
1619
+ script.textContent = `
1620
+ (function() {
1621
+ // Wait for all stylesheets to load
1622
+ function waitForStylesheets() {
1623
+ const styleSheets = Array.from(document.styleSheets);
1624
+ const pendingSheets = styleSheets.filter(function(sheet) {
1625
+ try {
1626
+ return sheet.cssRules === null;
1627
+ } catch (e) {
1628
+ return false; // Cross-origin stylesheets, assume loaded
1629
+ }
1630
+ });
1631
+
1632
+ if (pendingSheets.length === 0) {
1633
+ // All stylesheets loaded
1634
+ return;
1635
+ }
1636
+
1637
+ // Check again after a short delay
1638
+ setTimeout(waitForStylesheets, 10);
1639
+ }
1640
+
1641
+ // Start checking after DOM is ready
1642
+ if (document.readyState === 'complete') {
1643
+ waitForStylesheets();
1644
+ } else {
1645
+ window.addEventListener('load', waitForStylesheets);
1646
+ }
1647
+ })();
1648
+ `;
1649
+ iframeDoc.head.appendChild(script);
1650
+ } catch (error) {
1651
+ // Cross-origin or other errors - ignore (this is expected for some iframes)
1652
+ logger.debug('Could not inject stylesheet wait script:', {
1653
+ error
1654
+ });
1655
+ }
1656
+ };
1657
+ // Wait for iframe to load before injecting script
1658
+ iframe.addEventListener('load', handleLoad);
1659
+ // Also try immediately if already loaded
1660
+ if (iframe.contentDocument?.readyState === 'complete') handleLoad();
1661
+ return ()=>{
1662
+ iframe.removeEventListener('load', handleLoad);
1663
+ };
1664
+ }, [
1665
+ initialUrl
1666
+ ]);
1667
+ // Suppress browser warnings that are expected and acceptable
1668
+ (0, _react.useEffect)(()=>{
1669
+ {
1670
+ const originalWarn = console.warn;
1671
+ console.warn = (...args)=>{
1672
+ const message = String(args[0] ?? '');
1673
+ // Suppress the specific sandbox warning
1674
+ if (message.includes('allow-scripts') && message.includes('allow-same-origin') && message.includes('sandbox')) return;
1675
+ // Suppress "Layout was forced" warning from iframe content
1676
+ // This is a performance warning that occurs when iframe content calculates layout before stylesheets load
1677
+ // It's harmless and common in iframe scenarios, especially with React apps
1678
+ if (message.includes('Layout was forced') && message.includes('before the page was fully loaded')) return;
1679
+ originalWarn.apply(console, args);
1680
+ };
1681
+ return ()=>{
1682
+ console.warn = originalWarn;
1683
+ };
1684
+ }
1685
+ }, []);
1686
+ return (0, _jsxRuntime.jsxs)("div", {
1687
+ style: {
1688
+ width: '100%',
1689
+ height: '100%',
1690
+ display: 'flex',
1691
+ position: 'relative'
1692
+ },
1693
+ children: [
1694
+ (0, _jsxRuntime.jsx)("iframe", {
1695
+ ref: iframeRef,
1696
+ src: initialUrl,
1697
+ style: {
1698
+ width: '100%',
1699
+ height: '100%',
1700
+ border: 'none',
1701
+ display: 'block'
1702
+ },
1703
+ title: "Content Frame",
1704
+ sandbox: "allow-same-origin allow-scripts allow-forms allow-popups allow-popups-to-escape-sandbox",
1705
+ referrerPolicy: "no-referrer-when-downgrade"
1706
+ }),
1707
+ isLoading && (0, _jsxRuntime.jsx)((0, _loadingOverlay.LoadingOverlay), {})
1708
+ ]
1709
+ });
1710
+ };
1711
+ _s(ContentView, "zBmwSNmwfZ2d1yaxlldrzHZdD2E=", false, function() {
1712
+ return [
1713
+ (0, _reactRouter.useNavigate)
1714
+ ];
1715
+ });
1716
+ _c = ContentView;
1717
+ var _c;
1718
+ $RefreshReg$(_c, "ContentView");
1719
+
1720
+ $parcel$ReactRefreshHelpers$9dc4.postlude(module);
1721
+ } finally {
1722
+ globalThis.$RefreshReg$ = prevRefreshReg;
1723
+ globalThis.$RefreshSig$ = prevRefreshSig;
1724
+ }
1725
+ },{"react/jsx-runtime":"05iiF","@shellui/sdk":"dS2fb","react":"jMk1U","react-router":"kWH5w","./LoadingOverlay":"1kyE0","@parcel/transformer-js/src/esmodule-helpers.js":"jnFvT","@parcel/transformer-react-refresh-wrap/lib/helpers/helpers.js":"7h6Pi"}],"1kyE0":[function(require,module,exports,__globalThis) {
1726
+ var $parcel$ReactRefreshHelpers$681a = require("@parcel/transformer-react-refresh-wrap/lib/helpers/helpers.js");
1727
+ $parcel$ReactRefreshHelpers$681a.init();
1728
+ var prevRefreshReg = globalThis.$RefreshReg$;
1729
+ var prevRefreshSig = globalThis.$RefreshSig$;
1730
+ $parcel$ReactRefreshHelpers$681a.prelude(module);
1731
+
1732
+ try {
1733
+ var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js");
1734
+ parcelHelpers.defineInteropFlag(exports);
1735
+ parcelHelpers.export(exports, "LoadingOverlay", ()=>LoadingOverlay);
1736
+ var _jsxRuntime = require("react/jsx-runtime");
1737
+ function LoadingOverlay() {
1738
+ return (0, _jsxRuntime.jsx)("div", {
1739
+ className: "absolute inset-0 z-10 flex flex-col bg-background",
1740
+ children: (0, _jsxRuntime.jsx)("div", {
1741
+ className: "h-1 w-full overflow-hidden bg-muted/30",
1742
+ children: (0, _jsxRuntime.jsx)("div", {
1743
+ className: "h-full w-0 bg-muted-foreground/50",
1744
+ style: {
1745
+ animation: 'loading-bar-slide 400ms linear infinite'
1746
+ }
1747
+ })
1748
+ })
1749
+ });
1750
+ }
1751
+ _c = LoadingOverlay;
1752
+ var _c;
1753
+ $RefreshReg$(_c, "LoadingOverlay");
1754
+
1755
+ $parcel$ReactRefreshHelpers$681a.postlude(module);
1756
+ } finally {
1757
+ globalThis.$RefreshReg$ = prevRefreshReg;
1758
+ globalThis.$RefreshSig$ = prevRefreshSig;
1759
+ }
1760
+ },{"react/jsx-runtime":"05iiF","@parcel/transformer-js/src/esmodule-helpers.js":"jnFvT","@parcel/transformer-react-refresh-wrap/lib/helpers/helpers.js":"7h6Pi"}]},["bpbKD"], null, "parcelRequire6cf0", {})
1761
+
1762
+ //# sourceMappingURL=WindowsLayout.08724167.js.map