@lvce-editor/renderer-process 30.82.4 → 30.83.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.
@@ -1474,15 +1474,15 @@ const commandMapRef = {};
1474
1474
 
1475
1475
  const workers$1 = new Map();
1476
1476
  const metadataById = new Map();
1477
- const state$p = {
1477
+ const state$q = {
1478
1478
  generation: 0,
1479
1479
  nextId: 0
1480
1480
  };
1481
- const getGeneration = () => state$p.generation;
1481
+ const getGeneration = () => state$q.generation;
1482
1482
  const createRuntimeName = (name, parentName) => {
1483
- state$p.nextId++;
1484
- const id = `worker-${state$p.nextId}`;
1485
- const runtimeId = `worker-${String(state$p.nextId).padStart(2, '0')}`;
1483
+ state$q.nextId++;
1484
+ const id = `worker-${state$q.nextId}`;
1485
+ const runtimeId = `worker-${String(state$q.nextId).padStart(2, '0')}`;
1486
1486
  let parent;
1487
1487
  if (parentName) {
1488
1488
  parent = metadataById.values().find(worker => worker.name === parentName);
@@ -1500,8 +1500,8 @@ const createRuntimeName = (name, parentName) => {
1500
1500
  metadataById.set(id, metadata);
1501
1501
  return metadata;
1502
1502
  };
1503
- const track = (worker, startedIn = state$p.generation, trackedWorker) => {
1504
- if (startedIn !== state$p.generation) {
1503
+ const track = (worker, startedIn = state$q.generation, trackedWorker) => {
1504
+ if (startedIn !== state$q.generation) {
1505
1505
  worker.terminate();
1506
1506
  throw new Error('Worker launch canceled by application restart');
1507
1507
  }
@@ -1535,7 +1535,7 @@ const terminate$1 = id => {
1535
1535
  };
1536
1536
  const getWorkers$1 = () => workers$1.values().toArray();
1537
1537
  const terminateAll = () => {
1538
- state$p.generation++;
1538
+ state$q.generation++;
1539
1539
  const retiring = workers$1.keys().toArray();
1540
1540
  workers$1.clear();
1541
1541
  metadataById.clear();
@@ -1672,7 +1672,7 @@ const launchRendererWorker = async () => {
1672
1672
  };
1673
1673
 
1674
1674
  const selector$1 = 'script.RendererWorkerTrace';
1675
- const state$o = {
1675
+ const state$p = {
1676
1676
  enabled: false,
1677
1677
  entries: []
1678
1678
  };
@@ -1722,14 +1722,14 @@ const isCommand = value => {
1722
1722
  };
1723
1723
  const initialize$1 = search => {
1724
1724
  const searchParams = new URLSearchParams(search);
1725
- state$o.enabled = searchParams.has('traceRendererWorker');
1726
- state$o.entries = [];
1725
+ state$p.enabled = searchParams.has('traceRendererWorker');
1726
+ state$p.entries = [];
1727
1727
  };
1728
1728
  const record = (direction, method, params) => {
1729
- if (!state$o.enabled) {
1729
+ if (!state$p.enabled) {
1730
1730
  return;
1731
1731
  }
1732
- state$o.entries.push({
1732
+ state$p.entries.push({
1733
1733
  direction,
1734
1734
  method,
1735
1735
  params: serialize(params),
@@ -1737,7 +1737,7 @@ const record = (direction, method, params) => {
1737
1737
  });
1738
1738
  };
1739
1739
  const listen$1 = rpc => {
1740
- if (!state$o.enabled) {
1740
+ if (!state$p.enabled) {
1741
1741
  return;
1742
1742
  }
1743
1743
  const ipc = rpc.ipc;
@@ -1752,7 +1752,7 @@ const listen$1 = rpc => {
1752
1752
  });
1753
1753
  };
1754
1754
  const exportToDom = () => {
1755
- if (!state$o.enabled) {
1755
+ if (!state$p.enabled) {
1756
1756
  return;
1757
1757
  }
1758
1758
  const existing = document.querySelector(selector$1);
@@ -1760,7 +1760,7 @@ const exportToDom = () => {
1760
1760
  script.className = 'RendererWorkerTrace';
1761
1761
  script.type = 'application/json';
1762
1762
  script.textContent = JSON.stringify({
1763
- entries: state$o.entries,
1763
+ entries: state$p.entries,
1764
1764
  version: 1
1765
1765
  });
1766
1766
  if (!existing) {
@@ -1768,49 +1768,49 @@ const exportToDom = () => {
1768
1768
  }
1769
1769
  };
1770
1770
  const scheduleExport = () => {
1771
- if (!state$o.enabled) {
1771
+ if (!state$p.enabled) {
1772
1772
  return;
1773
1773
  }
1774
1774
  queueMicrotask(exportToDom);
1775
1775
  };
1776
1776
 
1777
- const state$n = {
1777
+ const state$o = {
1778
1778
  rpc: undefined
1779
1779
  };
1780
1780
  const hydrate$4 = async () => {
1781
1781
  const result = await launchRendererWorker();
1782
1782
  if (isError(result)) {
1783
- state$n.rpc = undefined;
1783
+ state$o.rpc = undefined;
1784
1784
  return result;
1785
1785
  }
1786
- state$n.rpc = result.value;
1786
+ state$o.rpc = result.value;
1787
1787
  listen$1(result.value);
1788
1788
  return success(undefined);
1789
1789
  };
1790
1790
 
1791
1791
  // TODO needed?
1792
1792
  const dispose$q = async () => {
1793
- const rpc = state$n.rpc;
1794
- state$n.rpc = undefined;
1793
+ const rpc = state$o.rpc;
1794
+ state$o.rpc = undefined;
1795
1795
  await rpc?.dispose();
1796
1796
  };
1797
1797
  const send$1 = (method, ...params) => {
1798
1798
  record('sent', method, params);
1799
1799
  // @ts-ignore
1800
- state$n.rpc.send(method, ...params);
1800
+ state$o.rpc.send(method, ...params);
1801
1801
  };
1802
1802
  const invoke$1 = (method, ...params) => {
1803
1803
  record('sent', method, params);
1804
1804
  // @ts-ignore
1805
- return state$n.rpc.invoke(method, ...params);
1805
+ return state$o.rpc.invoke(method, ...params);
1806
1806
  };
1807
1807
  const invokeAndTransfer = (method, ...params) => {
1808
1808
  record('sent', method, params);
1809
1809
  // @ts-ignore
1810
- return state$n.rpc.invokeAndTransfer(method, ...params);
1810
+ return state$o.rpc.invokeAndTransfer(method, ...params);
1811
1811
  };
1812
1812
 
1813
- const state$m = {
1813
+ const state$n = {
1814
1814
  client: undefined,
1815
1815
  enabled: false,
1816
1816
  lastError: '',
@@ -1820,38 +1820,38 @@ const state$m = {
1820
1820
  const workerUrl = new URL('sessionReplayWorkerMain.js', import.meta.url);
1821
1821
  const reloadMessage = 'Reload the window to start session replay with the complete DOM command history';
1822
1822
  const report = error => {
1823
- state$m.lastError = error instanceof Error ? error.message : String(error);
1824
- state$m.stopObserving?.();
1825
- state$m.stopObserving = undefined;
1826
- console.warn(`Session replay: ${state$m.lastError}`);
1823
+ state$n.lastError = error instanceof Error ? error.message : String(error);
1824
+ state$n.stopObserving?.();
1825
+ state$n.stopObserving = undefined;
1826
+ console.warn(`Session replay: ${state$n.lastError}`);
1827
1827
  };
1828
1828
 
1829
1829
  // Retain snapshot recording for older renderer workers during dependency rollout.
1830
1830
  const configure$1 = async options => {
1831
- state$m.stopObserving?.();
1832
- state$m.stopObserving = undefined;
1833
- state$m.enabled = false;
1834
- if (state$m.client) {
1831
+ state$n.stopObserving?.();
1832
+ state$n.stopObserving = undefined;
1833
+ state$n.enabled = false;
1834
+ if (state$n.client) {
1835
1835
  try {
1836
- await state$m.client.invoke('stop');
1836
+ await state$n.client.invoke('stop');
1837
1837
  } catch (error) {
1838
1838
  report(error);
1839
1839
  }
1840
1840
  // Live channels still need their proxy after capture stops.
1841
- if (!state$m.proxy) {
1842
- state$m.client.dispose();
1843
- state$m.client = undefined;
1841
+ if (!state$n.proxy) {
1842
+ state$n.client.dispose();
1843
+ state$n.client = undefined;
1844
1844
  }
1845
1845
  }
1846
1846
  if (!options.local && !options.upload) return '';
1847
- if (state$m.proxy) throw new Error(reloadMessage);
1848
- state$m.lastError = '';
1847
+ if (state$n.proxy) throw new Error(reloadMessage);
1848
+ state$n.lastError = '';
1849
1849
  const client = createClient(workerUrl);
1850
1850
  try {
1851
1851
  const id = await client.invoke('start', options);
1852
- state$m.stopObserving = observe(document, (type, data) => client.invoke('record', type, data), report);
1853
- state$m.client = client;
1854
- state$m.enabled = true;
1852
+ state$n.stopObserving = observe(document, (type, data) => client.invoke('record', type, data), report);
1853
+ state$n.client = client;
1854
+ state$n.enabled = true;
1855
1855
  return id;
1856
1856
  } catch (error) {
1857
1857
  client.dispose();
@@ -1859,7 +1859,7 @@ const configure$1 = async options => {
1859
1859
  }
1860
1860
  };
1861
1861
  const configureProxy = async (options, port) => {
1862
- if (state$m.client || !options.local && !options.upload) {
1862
+ if (state$n.client || !options.local && !options.upload) {
1863
1863
  port.close();
1864
1864
  throw new Error(reloadMessage);
1865
1865
  }
@@ -1872,25 +1872,25 @@ const configureProxy = async (options, port) => {
1872
1872
  commandMap: commandMapRef,
1873
1873
  messagePort: proxyPort
1874
1874
  });
1875
- const original = state$n.rpc;
1876
- state$n.rpc = {
1875
+ const original = state$o.rpc;
1876
+ state$o.rpc = {
1877
1877
  ...rpc,
1878
1878
  async dispose() {
1879
1879
  try {
1880
1880
  await rpc.dispose();
1881
1881
  } finally {
1882
1882
  client.dispose();
1883
- state$m.client = undefined;
1884
- state$m.enabled = false;
1885
- state$m.proxy = false;
1883
+ state$n.client = undefined;
1884
+ state$n.enabled = false;
1885
+ state$n.proxy = false;
1886
1886
  await original?.dispose();
1887
1887
  }
1888
1888
  }
1889
1889
  };
1890
- state$m.client = client;
1891
- state$m.enabled = true;
1892
- state$m.proxy = true;
1893
- state$m.lastError = '';
1890
+ state$n.client = client;
1891
+ state$n.enabled = true;
1892
+ state$n.proxy = true;
1893
+ state$n.lastError = '';
1894
1894
  return id;
1895
1895
  } catch (error) {
1896
1896
  proxyPort?.close();
@@ -1900,21 +1900,21 @@ const configureProxy = async (options, port) => {
1900
1900
  }
1901
1901
  };
1902
1902
  const getSession = async () => {
1903
- if (!state$m.enabled || !state$m.client) throw new Error('Session replay is disabled in settings');
1904
- return state$m.client.invoke('export');
1903
+ if (!state$n.enabled || !state$n.client) throw new Error('Session replay is disabled in settings');
1904
+ return state$n.client.invoke('export');
1905
1905
  };
1906
1906
  const getStatus$1 = async () => {
1907
- if (!state$m.client) return {
1907
+ if (!state$n.client) return {
1908
1908
  enabled: false,
1909
- error: state$m.lastError
1909
+ error: state$n.lastError
1910
1910
  };
1911
1911
  return {
1912
- enabled: state$m.enabled,
1913
- ...(await state$m.client.invoke('status')),
1914
- captureError: state$m.lastError
1912
+ enabled: state$n.enabled,
1913
+ ...(await state$n.client.invoke('status')),
1914
+ captureError: state$n.lastError
1915
1915
  };
1916
1916
  };
1917
- const flush = async () => state$m.client?.invoke('flush');
1917
+ const flush = async () => state$n.client?.invoke('flush');
1918
1918
  const openLocalFile = async () => {
1919
1919
  const input = document.createElement('input');
1920
1920
  input.type = 'file';
@@ -1972,12 +1972,12 @@ const initializeLayout = async href => {
1972
1972
  return true;
1973
1973
  };
1974
1974
  const dispose$p = async () => {
1975
- state$m.stopObserving?.();
1976
- state$m.stopObserving = undefined;
1977
- const client = state$m.client;
1978
- state$m.client = undefined;
1979
- state$m.enabled = false;
1980
- state$m.proxy = false;
1975
+ state$n.stopObserving?.();
1976
+ state$n.stopObserving = undefined;
1977
+ const client = state$n.client;
1978
+ state$n.client = undefined;
1979
+ state$n.enabled = false;
1980
+ state$n.proxy = false;
1981
1981
  if (client) {
1982
1982
  try {
1983
1983
  await client.invoke('flush');
@@ -2043,7 +2043,7 @@ const register$2 = (uid, listeners, speed = 1) => {
2043
2043
  speed: normalize(speed)
2044
2044
  });
2045
2045
  };
2046
- const set$d = (uid, speed) => {
2046
+ const set$e = (uid, speed) => {
2047
2047
  const view = views.get(uid);
2048
2048
  if (view) view.speed = normalize(speed);
2049
2049
  };
@@ -2095,10 +2095,10 @@ const measurePrefix = (text, offset, fontWeight, fontSize, fontFamily, letterSpa
2095
2095
  };
2096
2096
 
2097
2097
  const pendingInputs = new Set();
2098
- const state$l = {
2098
+ const state$m = {
2099
2099
  shortcut: undefined
2100
2100
  };
2101
- const hasPending = () => Boolean(state$l.shortcut || pendingInputs.size > 0);
2101
+ const hasPending = () => Boolean(state$m.shortcut || pendingInputs.size > 0);
2102
2102
  const settle = async result => {
2103
2103
  try {
2104
2104
  await result;
@@ -2116,7 +2116,7 @@ const runAfterShortcut = async (previous, run) => {
2116
2116
  };
2117
2117
  const runInput = run => {
2118
2118
  // Inputs in the same burst run concurrently so the worker can coalesce renders.
2119
- const result = runAfterShortcut(state$l.shortcut, run);
2119
+ const result = runAfterShortcut(state$m.shortcut, run);
2120
2120
  const settled = settle(result);
2121
2121
  pendingInputs.add(settled);
2122
2122
  void removeInput(settled);
@@ -2128,15 +2128,15 @@ const runAfterInputs = async (earlier, run) => {
2128
2128
  };
2129
2129
  const clearShortcut = async settled => {
2130
2130
  await settled;
2131
- if (state$l.shortcut === settled) state$l.shortcut = undefined;
2131
+ if (state$m.shortcut === settled) state$m.shortcut = undefined;
2132
2132
  };
2133
2133
  const runShortcut = run => {
2134
2134
  // Snapshot only earlier input; later input waits for this shortcut instead.
2135
2135
  const earlier = [...pendingInputs];
2136
- if (state$l.shortcut) earlier.push(state$l.shortcut);
2136
+ if (state$m.shortcut) earlier.push(state$m.shortcut);
2137
2137
  const result = runAfterInputs(earlier, run);
2138
2138
  const settled = settle(result);
2139
- state$l.shortcut = settled;
2139
+ state$m.shortcut = settled;
2140
2140
  void clearShortcut(settled);
2141
2141
  return result;
2142
2142
  };
@@ -2643,7 +2643,7 @@ const createIdGenerator = () => {
2643
2643
  };
2644
2644
  const create$z = createIdGenerator();
2645
2645
 
2646
- const state$k = Object.create(null);
2646
+ const state$l = Object.create(null);
2647
2647
  const retainString = (item, index) => {
2648
2648
  const value = new Promise(resolve => {
2649
2649
  item.getAsString(resolve);
@@ -2694,25 +2694,25 @@ const retainItems = dataTransfer => {
2694
2694
  };
2695
2695
  const addItems = items => {
2696
2696
  const id = create$z();
2697
- state$k[id] = items;
2697
+ state$l[id] = items;
2698
2698
  return id;
2699
2699
  };
2700
2700
  const add$2 = dataTransfer => {
2701
2701
  return addItems(retainItems(dataTransfer));
2702
2702
  };
2703
2703
  const acquire$2 = id => {
2704
- const items = state$k[id];
2704
+ const items = state$l[id];
2705
2705
  if (!items) {
2706
2706
  throw new Error(`Drop data not found: ${id}`);
2707
2707
  }
2708
- delete state$k[id];
2708
+ delete state$l[id];
2709
2709
  return items;
2710
2710
  };
2711
2711
 
2712
- const state$j = Object.create(null);
2712
+ const state$k = Object.create(null);
2713
2713
  const acquire$1 = id => {
2714
- const promise = state$j[id];
2715
- delete state$j[id];
2714
+ const promise = state$k[id];
2715
+ delete state$k[id];
2716
2716
  return promise;
2717
2717
  };
2718
2718
  const getFileHandles = async ids => {
@@ -2722,7 +2722,7 @@ const getFileHandles = async ids => {
2722
2722
  };
2723
2723
  const add$1 = promise => {
2724
2724
  const id = create$z();
2725
- state$j[id] = promise;
2725
+ state$k[id] = promise;
2726
2726
  return id;
2727
2727
  };
2728
2728
  const addFileHandle$1 = fileHandle => {
@@ -2923,14 +2923,14 @@ const getEventListenerArgs = (params, event) => {
2923
2923
  return serialized;
2924
2924
  };
2925
2925
 
2926
- const state$i = {
2926
+ const state$j = {
2927
2927
  ipc: undefined
2928
2928
  };
2929
2929
  const getIpc = () => {
2930
- return state$i.ipc;
2930
+ return state$j.ipc;
2931
2931
  };
2932
2932
  const setIpc = value => {
2933
- state$i.ipc = value;
2933
+ state$j.ipc = value;
2934
2934
  };
2935
2935
 
2936
2936
  const nameAnonymousFunction$1 = (fn, name) => {
@@ -3660,7 +3660,7 @@ const instances = Object.create(null);
3660
3660
  const get$b = viewletId => {
3661
3661
  return instances[viewletId];
3662
3662
  };
3663
- const set$c = (viewletId, instance) => {
3663
+ const set$d = (viewletId, instance) => {
3664
3664
  instances[viewletId] = instance;
3665
3665
  };
3666
3666
 
@@ -3689,7 +3689,7 @@ const cache = new Map();
3689
3689
  const has$1 = listener => {
3690
3690
  return cache.has(listener);
3691
3691
  };
3692
- const set$b = (listener, value) => {
3692
+ const set$c = (listener, value) => {
3693
3693
  cache.set(listener, value);
3694
3694
  };
3695
3695
  const get$a = listener => {
@@ -3712,7 +3712,7 @@ const getWrappedListener = (listener, returnValue) => {
3712
3712
  ipc.send('Viewlet.executeViewletCommand', uid, ...result);
3713
3713
  };
3714
3714
  nameAnonymousFunction$1(wrapped, listener.name);
3715
- set$b(listener, wrapped);
3715
+ set$c(listener, wrapped);
3716
3716
  }
3717
3717
  return get$a(listener);
3718
3718
  };
@@ -4667,38 +4667,38 @@ const launchDragAndDropWorker = async () => {
4667
4667
  }
4668
4668
  };
4669
4669
 
4670
- const state$h = {
4670
+ const state$i = {
4671
4671
  rpc: undefined
4672
4672
  };
4673
4673
  const hydrate$3 = async () => {
4674
4674
  const result = await launchDragAndDropWorker();
4675
4675
  if (isError(result)) {
4676
- state$h.rpc = undefined;
4676
+ state$i.rpc = undefined;
4677
4677
  return result;
4678
4678
  }
4679
- state$h.rpc = result.value;
4679
+ state$i.rpc = result.value;
4680
4680
  return success(undefined);
4681
4681
  };
4682
4682
  const handleMessagePort$1 = async port => {
4683
- if (!state$h.rpc) {
4683
+ if (!state$i.rpc) {
4684
4684
  const result = await hydrate$3();
4685
4685
  if (isError(result)) {
4686
4686
  throw result.error;
4687
4687
  }
4688
4688
  }
4689
- const rpc = state$h.rpc;
4689
+ const rpc = state$i.rpc;
4690
4690
  if (!rpc) {
4691
4691
  throw new Error('Drag And Drop Worker failed to initialize');
4692
4692
  }
4693
4693
  await rpc.invokeAndTransfer('DragAndDrop.handleMessagePort', port);
4694
4694
  };
4695
4695
  const dispose$n = async () => {
4696
- const rpc = state$h.rpc;
4697
- state$h.rpc = undefined;
4696
+ const rpc = state$i.rpc;
4697
+ state$i.rpc = undefined;
4698
4698
  await rpc?.dispose();
4699
4699
  };
4700
4700
 
4701
- const set$a = setComponentUid;
4701
+ const set$b = setComponentUid;
4702
4702
  const get$9 = getComponentUid;
4703
4703
  const fromEvent = getComponentUidFromEvent;
4704
4704
 
@@ -4753,16 +4753,16 @@ const unregisterView = uid => {
4753
4753
  viewRpcIds.delete(uid);
4754
4754
  };
4755
4755
 
4756
- const state$g = {
4756
+ const state$h = {
4757
4757
  snapshot: undefined
4758
4758
  };
4759
- const get$7 = () => state$g.snapshot;
4760
- const set$9 = value => {
4761
- state$g.snapshot = value;
4759
+ const get$7 = () => state$h.snapshot;
4760
+ const set$a = value => {
4761
+ state$h.snapshot = value;
4762
4762
  };
4763
4763
 
4764
4764
  const ipcs = Object.create(null);
4765
- const set$8 = (name, ipc) => {
4765
+ const set$9 = (name, ipc) => {
4766
4766
  ipcs[name] = ipc;
4767
4767
  };
4768
4768
  const get$6 = name => {
@@ -5057,7 +5057,7 @@ const IpcParentWithReferencePort = {
5057
5057
  };
5058
5058
 
5059
5059
  const workers = Object.create(null);
5060
- const set$7 = (id, worker) => {
5060
+ const set$8 = (id, worker) => {
5061
5061
  workers[id] = worker;
5062
5062
  };
5063
5063
  const remove$3 = id => {
@@ -5109,7 +5109,7 @@ const create$v = async ({
5109
5109
  discard(trackedWorker);
5110
5110
  }
5111
5111
  if (typeof id === 'number' && raw && worker) {
5112
- set$7(id, worker);
5112
+ set$8(id, worker);
5113
5113
  }
5114
5114
  return undefined;
5115
5115
  };
@@ -5210,7 +5210,7 @@ const hydrate$2 = async () => {
5210
5210
  } = new MessageChannel();
5211
5211
  // TODO only launch port and send to renderer worker
5212
5212
  const promise = launchEditorWorker(port1);
5213
- set$8('Editor Worker', port2);
5213
+ set$9('Editor Worker', port2);
5214
5214
  const result = await promise;
5215
5215
  if (isError(result)) {
5216
5216
  remove$4('Editor Worker');
@@ -5235,7 +5235,7 @@ const preloadWorker = async (name, packageName, fileName, settingName) => {
5235
5235
  url
5236
5236
  });
5237
5237
  // Start creation before caching, so our own request cannot consume this port.
5238
- set$8(name, port2);
5238
+ set$9(name, port2);
5239
5239
  await pending;
5240
5240
  return success(undefined);
5241
5241
  } catch (error) {
@@ -5279,7 +5279,7 @@ const hydrate$1 = async () => {
5279
5279
  } = new MessageChannel();
5280
5280
  // TODO only launch port and send to renderer worker
5281
5281
  const promise = launchSyntaxHighlightingWorker(port1);
5282
- set$8('Syntax Highlighting Worker', port2);
5282
+ set$9('Syntax Highlighting Worker', port2);
5283
5283
  const result = await promise;
5284
5284
  if (isError(result)) {
5285
5285
  remove$4('Syntax Highlighting Worker');
@@ -5312,32 +5312,32 @@ const launchWorkers = async () => {
5312
5312
  return success(undefined);
5313
5313
  };
5314
5314
 
5315
- const state$f = {
5315
+ const state$g = {
5316
5316
  renderer: undefined
5317
5317
  };
5318
5318
  const configure = options => {
5319
5319
  const cache = options?.cache;
5320
- state$f.renderer = cache?.dom > 0 || cache?.text > 0 ? createRenderer(options) : undefined;
5320
+ state$g.renderer = cache?.dom > 0 || cache?.text > 0 ? createRenderer(options) : undefined;
5321
5321
  };
5322
5322
  const render = (nodes, eventMap = {}, newEventMap = {}) => {
5323
- return state$f.renderer?.render(nodes, eventMap, newEventMap) || render$1(nodes, eventMap, newEventMap);
5323
+ return state$g.renderer?.render(nodes, eventMap, newEventMap) || render$1(nodes, eventMap, newEventMap);
5324
5324
  };
5325
5325
  const renderInto = (parent, nodes, eventMap = {}, newEventMap = {}) => {
5326
- if (state$f.renderer) {
5327
- state$f.renderer.renderInto(parent, nodes, eventMap, newEventMap);
5326
+ if (state$g.renderer) {
5327
+ state$g.renderer.renderInto(parent, nodes, eventMap, newEventMap);
5328
5328
  return;
5329
5329
  }
5330
5330
  renderInto$1(parent, nodes, eventMap);
5331
5331
  };
5332
5332
  const applyPatch$1 = (element, patches, eventMap = {}, id = 0) => {
5333
- if (state$f.renderer) {
5334
- state$f.renderer.applyPatch(element, patches, eventMap, id);
5333
+ if (state$g.renderer) {
5334
+ state$g.renderer.applyPatch(element, patches, eventMap, id);
5335
5335
  return;
5336
5336
  }
5337
5337
  applyPatch$2(element, patches, eventMap, id);
5338
5338
  };
5339
5339
  const dispose$l = root => {
5340
- state$f.renderer?.dispose(root);
5340
+ state$g.renderer?.dispose(root);
5341
5341
  };
5342
5342
 
5343
5343
  const applyPatch = (element, patches, eventMap = {}, id = 0) => {
@@ -5351,24 +5351,24 @@ const attachEvents$7 = ($Node, eventMap) => {
5351
5351
  };
5352
5352
 
5353
5353
  const selector = 'textarea[name="composer"]';
5354
- const state$e = {
5354
+ const state$f = {
5355
5355
  handled: false
5356
5356
  };
5357
5357
  const hasFocus = () => !!document.activeElement && document.activeElement !== document.body && document.activeElement !== document.documentElement;
5358
5358
  const dispose$k = viewletId => {
5359
- const pending = state$e.pending;
5359
+ const pending = state$f.pending;
5360
5360
  if (pending && pending.id === viewletId) pending.cancel();
5361
5361
  };
5362
5362
 
5363
5363
  // The route's composer can arrive after the initial workbench frame.
5364
5364
  const focus$d = viewletId => {
5365
- if (state$e.handled || !/(?:^|\/)chat\/?$/.test(location.pathname)) {
5365
+ if (state$f.handled || !/(?:^|\/)chat\/?$/.test(location.pathname)) {
5366
5366
  return;
5367
5367
  }
5368
5368
  if (!get$b(viewletId)?.state.$Viewlet.querySelector(selector)) {
5369
5369
  return;
5370
5370
  }
5371
- state$e.handled = true;
5371
+ state$f.handled = true;
5372
5372
  if (hasFocus()) {
5373
5373
  return;
5374
5374
  }
@@ -5381,9 +5381,9 @@ const focus$d = viewletId => {
5381
5381
  document.removeEventListener('focusin', cancel, true);
5382
5382
  mutations?.disconnect();
5383
5383
  sizes?.disconnect();
5384
- state$e.pending = undefined;
5384
+ state$f.pending = undefined;
5385
5385
  };
5386
- state$e.pending = {
5386
+ state$f.pending = {
5387
5387
  cancel,
5388
5388
  id: viewletId
5389
5389
  };
@@ -5425,25 +5425,25 @@ const focus$d = viewletId => {
5425
5425
  requestAnimationFrame(() => requestAnimationFrame(tryFocus));
5426
5426
  };
5427
5427
 
5428
- const state$d = {
5428
+ const state$e = {
5429
5429
  styleSheets: Object.create(null),
5430
5430
  texts: Object.create(null)
5431
5431
  };
5432
- const set$6 = (id, sheet) => {
5433
- state$d.styleSheets[id] = sheet;
5432
+ const set$7 = (id, sheet) => {
5433
+ state$e.styleSheets[id] = sheet;
5434
5434
  };
5435
5435
  const get$5 = id => {
5436
- return state$d.styleSheets[id];
5436
+ return state$e.styleSheets[id];
5437
5437
  };
5438
5438
  const setText$1 = (id, text) => {
5439
- state$d.texts[id] = text;
5439
+ state$e.texts[id] = text;
5440
5440
  };
5441
5441
  const getText = id => {
5442
- return state$d.texts[id];
5442
+ return state$e.texts[id];
5443
5443
  };
5444
5444
  const remove$2 = id => {
5445
- delete state$d.styleSheets[id];
5446
- delete state$d.texts[id];
5445
+ delete state$e.styleSheets[id];
5446
+ delete state$e.texts[id];
5447
5447
  };
5448
5448
 
5449
5449
  const addCssStyleSheet = (id, text) => {
@@ -5461,7 +5461,7 @@ const addCssStyleSheet = (id, text) => {
5461
5461
  const sheet = new CSSStyleSheet({});
5462
5462
  sheet.replaceSync(text);
5463
5463
  document.adoptedStyleSheets.push(sheet);
5464
- set$6(id, sheet);
5464
+ set$7(id, sheet);
5465
5465
  setText$1(id, text);
5466
5466
  if (id === 'ContributedColorTheme') {
5467
5467
  window.dispatchEvent(new Event('color-theme-changed'));
@@ -5519,25 +5519,25 @@ const PointerUp = 'pointerup';
5519
5519
  const Resize = 'resize';
5520
5520
  const Wheel = 'wheel';
5521
5521
 
5522
- const state$c = {
5522
+ const state$d = {
5523
5523
  currentDragInfo: undefined
5524
5524
  };
5525
- const set$5 = (id, data) => {
5526
- state$c.currentDragInfo = data;
5525
+ const set$6 = (id, data) => {
5526
+ state$d.currentDragInfo = data;
5527
5527
  setDragInfo(id, data);
5528
5528
  };
5529
5529
  const getCurrent = () => {
5530
- return state$c.currentDragInfo;
5530
+ return state$d.currentDragInfo;
5531
5531
  };
5532
5532
 
5533
- const state$b = {
5533
+ const state$c = {
5534
5534
  identifiers: new Uint32Array()
5535
5535
  };
5536
5536
  const setIdentifiers$1 = identifiers => {
5537
- state$b.identifiers = identifiers;
5537
+ state$c.identifiers = identifiers;
5538
5538
  };
5539
5539
  const getIdentifiers = () => {
5540
- return state$b.identifiers;
5540
+ return state$c.identifiers;
5541
5541
  };
5542
5542
 
5543
5543
  // TODO store keybindings as JSON somewhere
@@ -5656,11 +5656,11 @@ const register = (uid, targetUid, listeners) => {
5656
5656
  };
5657
5657
 
5658
5658
  const pendingBatches = new Map();
5659
- const state$a = {
5659
+ const state$b = {
5660
5660
  nextTransactionId: 1
5661
5661
  };
5662
5662
  const queue = (uid, commands, focusVersion = 0) => {
5663
- const transactionId = state$a.nextTransactionId++;
5663
+ const transactionId = state$b.nextTransactionId++;
5664
5664
  pendingBatches.set(transactionId, {
5665
5665
  commands,
5666
5666
  committed: false,
@@ -5675,7 +5675,7 @@ const take = (uid, transactionId, focusVersion = 0) => {
5675
5675
  if (!batch) {
5676
5676
  // An allocated transaction may have been discarded with its view. Late or
5677
5677
  // duplicate commits are harmless and must not affect a recreated root.
5678
- if (transactionId > 0 && transactionId < state$a.nextTransactionId) return [];
5678
+ if (transactionId > 0 && transactionId < state$b.nextTransactionId) return [];
5679
5679
  throw new Error(`pending viewlet command transaction not found: ${transactionId}`);
5680
5680
  }
5681
5681
  if (batch.uid !== uid) {
@@ -5865,7 +5865,7 @@ class VError extends Error {
5865
5865
  }
5866
5866
 
5867
5867
  // TODO this file is not needed when all elements are position fixed
5868
- const state$9 = {
5868
+ const state$a = {
5869
5869
  $Widgets: undefined,
5870
5870
  widgetSet: new Set()
5871
5871
  };
@@ -5877,20 +5877,20 @@ const create$Widgets = () => {
5877
5877
  };
5878
5878
  const append$1 = $Element => {
5879
5879
  // TODO should not call append in the first place if it is already in DOM
5880
- if (state$9.widgetSet.has($Element)) {
5880
+ if (state$a.widgetSet.has($Element)) {
5881
5881
  return;
5882
5882
  }
5883
- state$9.widgetSet.add($Element);
5884
- if (state$9.$Widgets) {
5883
+ state$a.widgetSet.add($Element);
5884
+ if (state$a.$Widgets) {
5885
5885
  // @ts-expect-error
5886
- state$9.$Widgets.append($Element);
5886
+ state$a.$Widgets.append($Element);
5887
5887
  } else {
5888
5888
  // @ts-expect-error
5889
- state$9.$Widgets = create$Widgets();
5889
+ state$a.$Widgets = create$Widgets();
5890
5890
  // @ts-expect-error
5891
- state$9.$Widgets.append($Element);
5891
+ state$a.$Widgets.append($Element);
5892
5892
  // @ts-expect-error
5893
- document.body.append(state$9.$Widgets);
5893
+ document.body.append(state$a.$Widgets);
5894
5894
  }
5895
5895
  };
5896
5896
  const remove$1 = $Element => {
@@ -5898,13 +5898,13 @@ const remove$1 = $Element => {
5898
5898
  // TODO $Element should always be defined
5899
5899
  return;
5900
5900
  }
5901
- state$9.widgetSet.delete($Element);
5901
+ state$a.widgetSet.delete($Element);
5902
5902
  $Element.remove();
5903
5903
  // TODO state.$Widgets should always be defined at this point
5904
- if (state$9.widgetSet.size === 0 && state$9.$Widgets) {
5904
+ if (state$a.widgetSet.size === 0 && state$a.$Widgets) {
5905
5905
  // @ts-expect-error
5906
- state$9.$Widgets.remove();
5907
- state$9.$Widgets = undefined;
5906
+ state$a.$Widgets.remove();
5907
+ state$a.$Widgets = undefined;
5908
5908
  }
5909
5909
  };
5910
5910
 
@@ -6234,7 +6234,7 @@ const applyUidWorkaround = element => {
6234
6234
  throw new Error('no editor found');
6235
6235
  }
6236
6236
  const editorUid = get$9(editor);
6237
- set$a(element, editorUid);
6237
+ set$b(element, editorUid);
6238
6238
  };
6239
6239
 
6240
6240
  const startTracking$1 = ($Target, pointerId, handlePointerMove, handlePointerUp) => {
@@ -6753,7 +6753,7 @@ const sendToIframe = (contentWindow, message, origin, transfer) => {
6753
6753
  };
6754
6754
 
6755
6755
  const webViews = Object.create(null);
6756
- const set$4 = (id, webView) => {
6756
+ const set$5 = (id, webView) => {
6757
6757
  webViews[id] = webView;
6758
6758
  };
6759
6759
  const get$4 = id => {
@@ -8256,16 +8256,16 @@ const EditorTextError = 'EditorTextError';
8256
8256
  const EditorRename = 'EditorRename';
8257
8257
  const EditorCodeGenerator = 'EditorCodeGenerator';
8258
8258
 
8259
- const state$8 = {
8259
+ const state$9 = {
8260
8260
  /**
8261
8261
  * @type {HTMLElement|undefined}
8262
8262
  */
8263
8263
  $PreviousFocusElement: undefined};
8264
8264
  const setElement = $Element => {
8265
- state$8.$PreviousFocusElement = $Element;
8265
+ state$9.$PreviousFocusElement = $Element;
8266
8266
  };
8267
8267
  const getElement = () => {
8268
- return state$8.$PreviousFocusElement;
8268
+ return state$9.$PreviousFocusElement;
8269
8269
  };
8270
8270
 
8271
8271
  const focus$6 = $Element => {
@@ -8531,7 +8531,7 @@ const screenCaptures = Object.create(null);
8531
8531
  const get$3 = id => {
8532
8532
  return screenCaptures[id];
8533
8533
  };
8534
- const set$3 = (id, captureStream) => {
8534
+ const set$4 = (id, captureStream) => {
8535
8535
  screenCaptures[id] = captureStream;
8536
8536
  };
8537
8537
 
@@ -8544,7 +8544,7 @@ const start = async (id, options) => {
8544
8544
  number(id);
8545
8545
  object(options);
8546
8546
  const captureStream = await navigator.mediaDevices.getUserMedia(options);
8547
- set$3(id, captureStream);
8547
+ set$4(id, captureStream);
8548
8548
  } catch (error) {
8549
8549
  throw new VError(error, `Failed to start screen capture`);
8550
8550
  }
@@ -8673,11 +8673,11 @@ const ViewletSidebar = {
8673
8673
  };
8674
8674
 
8675
8675
  const pendingSelections = new WeakMap();
8676
- const state$7 = {};
8676
+ const state$8 = {};
8677
8677
  const handleFocus$1 = event => {
8678
8678
  const target = event.target;
8679
8679
  if (target instanceof HTMLElement && !target.closest('.SimpleBrowser') && target.closest('.Main, .Panel, .Editor, .Terminal')) {
8680
- state$7.codingFocus = new WeakRef(target);
8680
+ state$8.codingFocus = new WeakRef(target);
8681
8681
  }
8682
8682
  };
8683
8683
  const handleFocusOut$2 = event => {
@@ -8706,7 +8706,7 @@ const listen = () => {
8706
8706
  document.addEventListener('keydown', cancelPendingAddressSelection);
8707
8707
  };
8708
8708
  const restoreCodingFocus$1 = () => {
8709
- const target = state$7.codingFocus?.deref();
8709
+ const target = state$8.codingFocus?.deref();
8710
8710
  if (!target?.isConnected) {
8711
8711
  return false;
8712
8712
  }
@@ -9043,7 +9043,7 @@ const findIndex$1 = ($Container, $Target) => {
9043
9043
 
9044
9044
  // TODO keyboard handling
9045
9045
 
9046
- const state$6 = {
9046
+ const state$7 = {
9047
9047
  $$Menus: [],
9048
9048
  $BackDrop: undefined,
9049
9049
  anchorTime: -1,
@@ -9054,7 +9054,7 @@ const state$6 = {
9054
9054
  };
9055
9055
  const getLevel = $Menu => {
9056
9056
  // @ts-expect-error
9057
- return state$6.$$Menus.indexOf($Menu);
9057
+ return state$7.$$Menus.indexOf($Menu);
9058
9058
  };
9059
9059
  const handleMouseDown$1 = event => {
9060
9060
  const $Target = event.target;
@@ -9124,10 +9124,10 @@ const handleMouseLeave = event => {
9124
9124
 
9125
9125
  // const handleBlur = (event) => {}
9126
9126
  const handleKeyDown = event => {
9127
- state$6.handleKeyDown(event);
9127
+ state$7.handleKeyDown(event);
9128
9128
  };
9129
9129
  const handleFocusOut$1 = event => {
9130
- state$6.handleFocusOut(event);
9130
+ state$7.handleFocusOut(event);
9131
9131
  };
9132
9132
  const create$Menu$1 = () => {
9133
9133
  // TODO set aria label on menu (e.g. File, Edit, Selection)
@@ -9155,7 +9155,7 @@ const create$Menu$1 = () => {
9155
9155
  return $Menu;
9156
9156
  };
9157
9157
  const focusIndex = (level, oldFocusedIndex, newFocusedIndex) => {
9158
- const $Menu = state$6.$$Menus[level];
9158
+ const $Menu = state$7.$$Menus[level];
9159
9159
  if (oldFocusedIndex !== -1) {
9160
9160
  // @ts-expect-error
9161
9161
  $Menu.children[oldFocusedIndex].classList.remove('MenuItemFocused');
@@ -9177,21 +9177,21 @@ const handleBackDropMouseDown = event => {
9177
9177
  preventDefault(event);
9178
9178
  stopPropagation(event);
9179
9179
  send$1(/* Menu.hide */'Menu.hide');
9180
- if (state$6.$BackDrop) {
9181
- remove$1(state$6.$BackDrop);
9182
- state$6.$BackDrop = undefined;
9180
+ if (state$7.$BackDrop) {
9181
+ remove$1(state$7.$BackDrop);
9182
+ state$7.$BackDrop = undefined;
9183
9183
  }
9184
9184
  };
9185
9185
  const handleContextMenu$1 = event => {
9186
9186
  preventDefault(event);
9187
9187
  };
9188
9188
  const showMenu = async (x, y, width, height, items, level, parentIndex = -1, dom = [], mouseBlocking = false) => {
9189
- if (mouseBlocking && !state$6.$BackDrop) {
9189
+ if (mouseBlocking && !state$7.$BackDrop) {
9190
9190
  const $BackDrop = create$BackDrop();
9191
9191
  $BackDrop.onmousedown = handleBackDropMouseDown;
9192
9192
  $BackDrop.oncontextmenu = handleContextMenu$1;
9193
9193
  // @ts-expect-error
9194
- state$6.$BackDrop = $BackDrop;
9194
+ state$7.$BackDrop = $BackDrop;
9195
9195
  append$1($BackDrop);
9196
9196
  }
9197
9197
  const $Menu = create$Menu$1();
@@ -9199,7 +9199,7 @@ const showMenu = async (x, y, width, height, items, level, parentIndex = -1, dom
9199
9199
  setBounds$a($Menu, x, y, width, height);
9200
9200
  $Menu.id = `Menu-${level}`;
9201
9201
  if (parentIndex !== -1) {
9202
- const $ParentMenu = state$6.$$Menus[level - 1];
9202
+ const $ParentMenu = state$7.$$Menus[level - 1];
9203
9203
  // @ts-expect-error
9204
9204
  const $ParentMenuItem = $ParentMenu.children[parentIndex];
9205
9205
  $ParentMenuItem.ariaExpanded = True;
@@ -9207,7 +9207,7 @@ const showMenu = async (x, y, width, height, items, level, parentIndex = -1, dom
9207
9207
  }
9208
9208
 
9209
9209
  // @ts-expect-error
9210
- state$6.$$Menus.push($Menu);
9210
+ state$7.$$Menus.push($Menu);
9211
9211
  append$1($Menu);
9212
9212
  if (level === 0) {
9213
9213
  focus$6($Menu);
@@ -9215,14 +9215,14 @@ const showMenu = async (x, y, width, height, items, level, parentIndex = -1, dom
9215
9215
  }
9216
9216
  };
9217
9217
  const hideSubmenu = level => {
9218
- const $$ChildMenus = state$6.$$Menus.slice(level);
9218
+ const $$ChildMenus = state$7.$$Menus.slice(level);
9219
9219
  for (const $ChildMenu of $$ChildMenus) {
9220
9220
  remove$1($ChildMenu);
9221
9221
  }
9222
- state$6.$$Menus = state$6.$$Menus.slice(0, level);
9223
- if (state$6.$$Menus.length === 0 && state$6.$BackDrop) {
9224
- remove$1(state$6.$BackDrop);
9225
- state$6.$BackDrop = undefined;
9222
+ state$7.$$Menus = state$7.$$Menus.slice(0, level);
9223
+ if (state$7.$$Menus.length === 0 && state$7.$BackDrop) {
9224
+ remove$1(state$7.$BackDrop);
9225
+ state$7.$BackDrop = undefined;
9226
9226
  }
9227
9227
  };
9228
9228
 
@@ -9261,17 +9261,17 @@ const showControlled = ({
9261
9261
  y
9262
9262
  }) => {
9263
9263
  showMenu(x, y, width, height, items, level);
9264
- const $Menu = state$6.$$Menus.at(-1);
9264
+ const $Menu = state$7.$$Menus.at(-1);
9265
9265
  if ($Parent && $Menu) {
9266
9266
  const uid = get$9($Parent);
9267
- set$a($Menu, uid);
9267
+ set$b($Menu, uid);
9268
9268
  }
9269
9269
  // TODO menu should not necessarily know about parent (titleBarMenuBar)
9270
9270
  // it should be the other way around
9271
9271
  // @ts-expect-error
9272
- state$6.$Parent = $Parent;
9273
- state$6.handleFocusOut = handleFocusOut;
9274
- state$6.handleKeyDown = handleKeyDown;
9272
+ state$7.$Parent = $Parent;
9273
+ state$7.handleFocusOut = handleFocusOut;
9274
+ state$7.handleKeyDown = handleKeyDown;
9275
9275
  if ($Parent) {
9276
9276
  // state.$Menu.ariaLabel=''
9277
9277
  // state.$Menu.ariaLabelledBy =$Parent.id
@@ -9283,13 +9283,13 @@ const showControlled = ({
9283
9283
  // TODO have function to show submenu
9284
9284
 
9285
9285
  const hide = (restoreFocus = true) => {
9286
- for (const $Menu of state$6.$$Menus) {
9286
+ for (const $Menu of state$7.$$Menus) {
9287
9287
  remove$1($Menu);
9288
9288
  }
9289
- state$6.$$Menus = [];
9290
- if (state$6.$BackDrop) {
9291
- remove$1(state$6.$BackDrop);
9292
- state$6.$BackDrop = undefined;
9289
+ state$7.$$Menus = [];
9290
+ if (state$7.$BackDrop) {
9291
+ remove$1(state$7.$BackDrop);
9292
+ state$7.$BackDrop = undefined;
9293
9293
  }
9294
9294
  // TODO focus previous item
9295
9295
  if (restoreFocus) {
@@ -9534,8 +9534,8 @@ const openMenu = (state, unFocusIndex, index, level, menuItems, menuFocusedIndex
9534
9534
  $Viewlet.children[unFocusIndex].removeAttribute(AriaOwns);
9535
9535
  }
9536
9536
  $Viewlet.children[index].ariaExpanded = True;
9537
- const $$Menus = state$6.$$Menus;
9538
- state$6.$$Menus = [];
9537
+ const $$Menus = state$7.$$Menus;
9538
+ state$7.$$Menus = [];
9539
9539
  // @ts-expect-error
9540
9540
  showControlled({
9541
9541
  $Parent: $Viewlet.children[index],
@@ -9600,7 +9600,7 @@ const addMenu = ($$Menus, change, uid) => {
9600
9600
  const menu = change[1];
9601
9601
  const dom = change[2];
9602
9602
  const $Menu = create$Menu();
9603
- set$a($Menu, uid);
9603
+ set$b($Menu, uid);
9604
9604
  $Menu.onmousemove = handleMenuMouseOver;
9605
9605
  $Menu.onmouseleave = handleMenuMouseLeave;
9606
9606
  $Menu.onclick = handleMenuClick;
@@ -9844,7 +9844,7 @@ const setIframe = (state, src, sandbox = [], srcDoc = '', csp = '', credentialle
9844
9844
  $Iframe.className = 'E2eTestIframe WebViewIframe';
9845
9845
  $Parent.append($Iframe);
9846
9846
  state.frame = $Iframe;
9847
- set$4(1, $Iframe);
9847
+ set$5(1, $Iframe);
9848
9848
  };
9849
9849
  const setPort$1 = (state, portId, origin) => {
9850
9850
  const port = acquire(portId);
@@ -9942,14 +9942,14 @@ const load$1 = moduleId => {
9942
9942
  return loadModule();
9943
9943
  };
9944
9944
 
9945
- const state$5 = {
9945
+ const state$6 = {
9946
9946
  currentPanelView: undefined,
9947
9947
  currentSidebarView: undefined,
9948
9948
  modules: Object.create(null)
9949
9949
  };
9950
9950
 
9951
9951
  const create$4 = (id, uid = id) => {
9952
- const module = state$5.modules[id];
9952
+ const module = state$6.modules[id];
9953
9953
  if (!module) {
9954
9954
  throw new Error(`module not found: ${id}`);
9955
9955
  }
@@ -9958,17 +9958,17 @@ const create$4 = (id, uid = id) => {
9958
9958
  existing.state.$Viewlet.remove();
9959
9959
  }
9960
9960
  const instanceState = module.create();
9961
- set$a(instanceState.$Viewlet, uid);
9961
+ set$b(instanceState.$Viewlet, uid);
9962
9962
  if (module.attachEvents) {
9963
9963
  module.attachEvents(instanceState);
9964
9964
  }
9965
- set$c(uid, {
9965
+ set$d(uid, {
9966
9966
  factory: module,
9967
9967
  state: instanceState
9968
9968
  });
9969
9969
  };
9970
9970
  const createFunctionalRoot = (id, uid = id, hasFunctionalEvents, directEventRpcId, eventTargetUid = uid) => {
9971
- let module = state$5.modules[id];
9971
+ let module = state$6.modules[id];
9972
9972
  if (hasFunctionalEvents) {
9973
9973
  module ||= {};
9974
9974
  }
@@ -9983,11 +9983,11 @@ const createFunctionalRoot = (id, uid = id, hasFunctionalEvents, directEventRpcI
9983
9983
  const instanceState = {
9984
9984
  $Viewlet: document.createElement('div')
9985
9985
  };
9986
- set$a(instanceState.$Viewlet, uid);
9986
+ set$b(instanceState.$Viewlet, uid);
9987
9987
  if (existing) dispose$i(uid);
9988
- set$a(instanceState.$Viewlet, eventTargetUid);
9988
+ set$b(instanceState.$Viewlet, eventTargetUid);
9989
9989
  registerView(uid, directEventRpcId);
9990
- set$c(uid, {
9990
+ set$d(uid, {
9991
9991
  factory: module,
9992
9992
  state: instanceState
9993
9993
  });
@@ -10003,7 +10003,7 @@ const removeKeyBindings = id => {
10003
10003
  const loadModule = async id => {
10004
10004
  try {
10005
10005
  const module = await load$1(id);
10006
- state$5.modules[id] = module;
10006
+ state$6.modules[id] = module;
10007
10007
  } catch (error) {
10008
10008
  throw new VError(error, `Failed to load ${id}`);
10009
10009
  }
@@ -10114,7 +10114,7 @@ const setUid = (viewletId, uid) => {
10114
10114
  const {
10115
10115
  $Viewlet
10116
10116
  } = instance.state;
10117
- set$a($Viewlet, uid);
10117
+ set$b($Viewlet, uid);
10118
10118
  };
10119
10119
  const focusCallback = {
10120
10120
  id: 0,
@@ -10189,7 +10189,7 @@ const refresh = (viewletId, viewletContext) => {
10189
10189
  instance.factory.refresh(instance.state, viewletContext);
10190
10190
  } else {
10191
10191
  // @ts-expect-error
10192
- state$5.refreshContext[viewletId] = viewletContext;
10192
+ state$6.refreshContext[viewletId] = viewletContext;
10193
10193
  }
10194
10194
  };
10195
10195
  const specialIds = new Set(['TitleBar', 'SideBar', 'Main', 'ActivityBar', 'StatusBar', 'Panel']);
@@ -10206,14 +10206,14 @@ const createPlaceholder = (viewletId, parentId, top, left, width, height) => {
10206
10206
  const parentInstance = get$b(parentId);
10207
10207
  const $Parent = parentInstance.state.$Viewlet;
10208
10208
  $Parent.append($Placeholder);
10209
- set$c(viewletId, {
10209
+ set$d(viewletId, {
10210
10210
  state: {
10211
10211
  $Viewlet: $Placeholder
10212
10212
  }
10213
10213
  });
10214
10214
  };
10215
10215
  const setDragData = (viewletId, dragData) => {
10216
- set$5(viewletId, dragData);
10216
+ set$6(viewletId, dragData);
10217
10217
  };
10218
10218
  const getDragData = () => {
10219
10219
  return getCurrent();
@@ -10264,7 +10264,7 @@ const restoreComponentDom = viewletId => {
10264
10264
  }
10265
10265
  }
10266
10266
  instance.state.$Viewlet.replaceWith($Original);
10267
- set$c(viewletId, {
10267
+ set$d(viewletId, {
10268
10268
  ...instance,
10269
10269
  componentDom: undefined,
10270
10270
  componentDomOriginal: undefined,
@@ -10312,7 +10312,7 @@ const setComponentDom = (viewletId, dom) => {
10312
10312
  uid
10313
10313
  });
10314
10314
  }
10315
- set$c(viewletId, {
10315
+ set$d(viewletId, {
10316
10316
  ...instance,
10317
10317
  componentDomOriginal: $Original,
10318
10318
  componentDomReferences: references
@@ -10326,7 +10326,7 @@ const setComponentDom = (viewletId, dom) => {
10326
10326
  throw error;
10327
10327
  }
10328
10328
  $Viewlet.replaceWith($Preview);
10329
- set$c(viewletId, {
10329
+ set$d(viewletId, {
10330
10330
  ...instance,
10331
10331
  componentDom: dom,
10332
10332
  componentDomOriginal: $Original,
@@ -10375,9 +10375,9 @@ const setDom2 = (viewletId, dom) => {
10375
10375
  const $NewViewlet = rememberFocus($Viewlet, dom, Events, viewletId);
10376
10376
  if (uid) {
10377
10377
  // @ts-ignore
10378
- set$a($NewViewlet, uid);
10378
+ set$b($NewViewlet, uid);
10379
10379
  }
10380
- set$c(viewletId, {
10380
+ set$d(viewletId, {
10381
10381
  ...instance,
10382
10382
  state: {
10383
10383
  ...instance.state,
@@ -10500,7 +10500,7 @@ const dispose$4 = id => {
10500
10500
  instance.state.$Viewlet.remove();
10501
10501
  }
10502
10502
  removeCssStyleSheet(id);
10503
- set$c(id, undefined);
10503
+ set$d(id, undefined);
10504
10504
  } catch {
10505
10505
  throw new Error(`Failed to dispose ${id}`);
10506
10506
  }
@@ -10791,7 +10791,7 @@ const commandHandlers = {
10791
10791
  'Viewlet.setInputValues': setInputValues,
10792
10792
  'Viewlet.setPatches': setPatches,
10793
10793
  'Viewlet.setProperty': setProperty,
10794
- 'Viewlet.setScrollSpeed': set$d,
10794
+ 'Viewlet.setScrollSpeed': set$e,
10795
10795
  'Viewlet.setSelectionByName': setSelectionByName,
10796
10796
  'Viewlet.setTreePatches': setTreePatches,
10797
10797
  'Viewlet.setUid': setUid,
@@ -10806,7 +10806,7 @@ const getFn = command => {
10806
10806
  return fn;
10807
10807
  };
10808
10808
 
10809
- const state$4 = {
10809
+ const state$5 = {
10810
10810
  duration: 0,
10811
10811
  lastError: '',
10812
10812
  pending: false
@@ -10821,16 +10821,16 @@ const waitForReady = async () => {
10821
10821
  }
10822
10822
  };
10823
10823
  const getStatus = () => ({
10824
- duration: state$4.duration,
10825
- error: state$4.lastError,
10826
- pending: state$4.pending
10824
+ duration: state$5.duration,
10825
+ error: state$5.lastError,
10826
+ pending: state$5.pending
10827
10827
  });
10828
10828
  const restart = async () => {
10829
10829
  const started = performance.now();
10830
10830
  try {
10831
10831
  document.documentElement.inert = true;
10832
10832
  const snapshot = await invoke$1('Reload.prepareHotReload');
10833
- set$9(snapshot);
10833
+ set$a(snapshot);
10834
10834
  await invoke$1('Reload.retire');
10835
10835
  await dispose$p();
10836
10836
  await dispose$q();
@@ -10845,10 +10845,10 @@ const restart = async () => {
10845
10845
  const result = await launchWorkers();
10846
10846
  if (isError(result)) throw result.error;
10847
10847
  await waitForReady();
10848
- set$9(undefined);
10849
- state$4.duration = performance.now() - started;
10848
+ set$a(undefined);
10849
+ state$5.duration = performance.now() - started;
10850
10850
  } catch (error) {
10851
- state$4.lastError = error instanceof Error ? error.message : String(error);
10851
+ state$5.lastError = error instanceof Error ? error.message : String(error);
10852
10852
  console.error(error);
10853
10853
  // Keep the snapshot available for recovery; never silently discard drafts.
10854
10854
  const snapshot = get$7();
@@ -10862,21 +10862,21 @@ const restart = async () => {
10862
10862
  }
10863
10863
  }
10864
10864
  const recovery = document.createElement('button');
10865
- recovery.textContent = `Application restart failed: ${state$4.lastError}. Reload window`;
10865
+ recovery.textContent = `Application restart failed: ${state$5.lastError}. Reload window`;
10866
10866
  recovery.onclick = () => location.reload();
10867
10867
  document.body.append(recovery);
10868
10868
  } finally {
10869
10869
  document.documentElement.inert = false;
10870
- state$4.pending = false;
10870
+ state$5.pending = false;
10871
10871
  }
10872
10872
  };
10873
10873
 
10874
10874
  // Reply on the old RPC before retiring it. Awaiting restart from that RPC would
10875
10875
  // strand the caller when its worker is terminated.
10876
10876
  const request = () => {
10877
- if (state$4.pending) return;
10878
- state$4.pending = true;
10879
- state$4.lastError = '';
10877
+ if (state$5.pending) return;
10878
+ state$5.pending = true;
10879
+ state$5.lastError = '';
10880
10880
  setTimeout(() => void restart(), 0);
10881
10881
  };
10882
10882
 
@@ -11166,7 +11166,7 @@ const addFileHandle = fileHandle => {
11166
11166
  return addFileHandle$1(fileHandle);
11167
11167
  };
11168
11168
 
11169
- const state$3 = {
11169
+ const state$4 = {
11170
11170
  hydrated: false,
11171
11171
  lastPathName: ''
11172
11172
  };
@@ -11186,7 +11186,7 @@ const setPathName = pathName => {
11186
11186
  return;
11187
11187
  }
11188
11188
  history.pushState(null, '', pathName);
11189
- state$3.lastPathName = getPathName();
11189
+ state$4.lastPathName = getPathName();
11190
11190
  };
11191
11191
  const setHash = hash => {
11192
11192
  const currentHref = getHref();
@@ -11232,21 +11232,21 @@ const handlePopState = () => {
11232
11232
  } else if (isChatPath(pathName)) {
11233
11233
  send$1('Layout.enterAiNativeLayout');
11234
11234
  executeExtensionCommand('chat2.show');
11235
- } else if (isChatPath(state$3.lastPathName) || isBoardPath(state$3.lastPathName)) {
11235
+ } else if (isChatPath(state$4.lastPathName) || isBoardPath(state$4.lastPathName)) {
11236
11236
  executeExtensionCommand('chat2.showIdeLayout');
11237
11237
  }
11238
- state$3.lastPathName = pathName;
11238
+ state$4.lastPathName = pathName;
11239
11239
  };
11240
11240
  const hydrate = () => {
11241
- if (state$3.hydrated) {
11241
+ if (state$4.hydrated) {
11242
11242
  return;
11243
11243
  }
11244
- state$3.lastPathName = getPathName();
11245
- if (isChatPath(state$3.lastPathName)) {
11244
+ state$4.lastPathName = getPathName();
11245
+ if (isChatPath(state$4.lastPathName)) {
11246
11246
  send$1('Layout.enterAiNativeLayout');
11247
11247
  }
11248
11248
  addEventListener('popstate', handlePopState);
11249
- state$3.hydrated = true;
11249
+ state$4.hydrated = true;
11250
11250
  };
11251
11251
 
11252
11252
  const getConfig = () => {
@@ -11338,7 +11338,7 @@ const setModernUi = enabled => {
11338
11338
  document.body.classList.toggle('ModernUi', enabled);
11339
11339
  };
11340
11340
 
11341
- const state$2 = {
11341
+ const state$3 = {
11342
11342
  nextNotificationId: 0
11343
11343
  };
11344
11344
  const pendingChoices = new WeakMap();
@@ -11368,7 +11368,7 @@ const create$Notification = message => {
11368
11368
  const $NotificationMessage = create$NotificationMessage(message);
11369
11369
  const $CloseButton = create$CloseButton();
11370
11370
  const $Notification = document.createElement('div');
11371
- $Notification.id = `Notification-${++state$2.nextNotificationId}`;
11371
+ $Notification.id = `Notification-${++state$3.nextNotificationId}`;
11372
11372
  $Notification.className = 'Notification';
11373
11373
  $Notification.append($NotificationMessage, $CloseButton);
11374
11374
  return $Notification;
@@ -11417,7 +11417,7 @@ const create$NotificationWithOptions = (message, options) => {
11417
11417
  $NotificationOptions.append($NotificationOption);
11418
11418
  }
11419
11419
  const $Notification = document.createElement('div');
11420
- $Notification.id = `Notification-${++state$2.nextNotificationId}`;
11420
+ $Notification.id = `Notification-${++state$3.nextNotificationId}`;
11421
11421
  $Notification.className = 'Notification';
11422
11422
  $Notification.append($NotificationMessage, $CloseButton, $NotificationOptions);
11423
11423
  $Notification.onclick = handleNotificationClick;
@@ -11527,17 +11527,17 @@ const createCanvasPresentation = (canvas, onDispose) => {
11527
11527
  };
11528
11528
  };
11529
11529
 
11530
- const state$1 = {
11530
+ const state$2 = {
11531
11531
  canvasObjects: Object.create(null)
11532
11532
  };
11533
- const set$2 = (canvasId, canvas) => {
11534
- state$1.canvasObjects[canvasId] = canvas;
11533
+ const set$3 = (canvasId, canvas) => {
11534
+ state$2.canvasObjects[canvasId] = canvas;
11535
11535
  };
11536
11536
 
11537
11537
  const create$2 = async (canvasId, objectId) => {
11538
11538
  const canvas = document.createElement('canvas');
11539
11539
  const offscreenCanvas = canvas.transferControlToOffscreen();
11540
- set$2(canvasId, canvas);
11540
+ set$3(canvasId, canvas);
11541
11541
  await invokeAndTransfer('Transferrable.transfer', objectId, offscreenCanvas);
11542
11542
  };
11543
11543
  const create2 = async (canvasId, objectId, width, height) => {
@@ -11550,7 +11550,7 @@ const create2 = async (canvasId, objectId, width, height) => {
11550
11550
  }
11551
11551
  const offscreenCanvas = canvas.transferControlToOffscreen();
11552
11552
  canvas.dataset.id = canvasId;
11553
- set$c(canvasId, {
11553
+ set$d(canvasId, {
11554
11554
  factory: {},
11555
11555
  state: {
11556
11556
  $Viewlet: canvas
@@ -11569,9 +11569,9 @@ const createForPreview = async (canvasId, objectId, portId, width, height) => {
11569
11569
  canvas.height = height;
11570
11570
  canvas.dataset.id = String(canvasId);
11571
11571
  const offscreen = new OffscreenCanvas(width, height);
11572
- const presentation = createCanvasPresentation(canvas, () => set$c(canvasId, undefined));
11572
+ const presentation = createCanvasPresentation(canvas, () => set$d(canvasId, undefined));
11573
11573
  // Keep the receiving port reachable until the sandbox disposes this canvas.
11574
- set$c(canvasId, {
11574
+ set$d(canvasId, {
11575
11575
  factory: {},
11576
11576
  state: {
11577
11577
  $Viewlet: canvas,
@@ -12516,6 +12516,31 @@ const revealBrowserTab = revealBrowserTab$1;
12516
12516
  const rememberBrowserParent = rememberBrowserParent$1;
12517
12517
  const restoreBrowserParent = restoreBrowserParent$1;
12518
12518
 
12519
+ const state$1 = {
12520
+ icon: undefined
12521
+ };
12522
+
12523
+ // Keep the application's original icons intact so removing this override
12524
+ // restores the default favicon, including deployments under a path prefix.
12525
+ const set$2 = href => {
12526
+ if (!href) {
12527
+ state$1.icon?.remove();
12528
+ state$1.icon = undefined;
12529
+ return;
12530
+ }
12531
+ const url = new URL(href);
12532
+ const isImageData = /^data:image\/(?:png;base64,|svg\+xml,)/u.test(href);
12533
+ if (url.protocol !== 'https:' && !isImageData) {
12534
+ throw new Error('Favicon URL must use HTTPS or PNG/SVG image data');
12535
+ }
12536
+ if (!state$1.icon) {
12537
+ state$1.icon = document.createElement('link');
12538
+ state$1.icon.rel = 'icon';
12539
+ }
12540
+ state$1.icon.href = url.href;
12541
+ document.head.append(state$1.icon);
12542
+ };
12543
+
12519
12544
  const set$1 = title => {
12520
12545
  document.title = title;
12521
12546
  };
@@ -12593,7 +12618,7 @@ const create$1 = async (uid, src, sandbox, csp, credentialless, permissionPolicy
12593
12618
  if (title) {
12594
12619
  $Iframe.title = title;
12595
12620
  }
12596
- set$4(uid, $Iframe);
12621
+ set$5(uid, $Iframe);
12597
12622
  // TODO make make waitForFrameToLoad a separate command
12598
12623
  };
12599
12624
  const loadOnly = async uid => {
@@ -12898,6 +12923,7 @@ const commandMap = {
12898
12923
  'DropData.get': get$1,
12899
12924
  'EditorKeymap.register': register$1,
12900
12925
  'EditorKeymap.remove': remove$5,
12926
+ 'Favicon.set': set$2,
12901
12927
  'FileHandles.get': get,
12902
12928
  'FilePicker.showDirectoryPicker': showDirectoryPicker,
12903
12929
  'FilePicker.showFilePicker': showFilePicker,
@@ -12996,7 +13022,7 @@ const commandMap = {
12996
13022
  'Viewlet.sendMultiple': sendMultiple,
12997
13023
  'Viewlet.setBounds': setBounds$1,
12998
13024
  'Viewlet.setComponentDom': setComponentDom,
12999
- 'Viewlet.setScrollSpeed': set$d,
13025
+ 'Viewlet.setScrollSpeed': set$e,
13000
13026
  'Viewlet.show': show,
13001
13027
  'VirtualDom.configure': configure,
13002
13028
  'WebRtc.readMicLevels': readMicLevels,
@@ -13132,15 +13158,15 @@ const main = async () => {
13132
13158
  initialize$1(location.search);
13133
13159
  Object.assign(commandMapRef, commandMap);
13134
13160
  enable(window);
13135
- state$5.modules[ColorPicker] = ViewletColorPicker;
13136
- state$5.modules[EditorCodeGenerator] = ViewletEditorCodeGenerator;
13137
- state$5.modules[EditorCompletion] = ViewletEditorCompletion;
13138
- state$5.modules[EditorCompletionDetails] = ViewletEditorCompletionDetails;
13139
- state$5.modules[EditorHover] = ViewletEditorHover;
13140
- state$5.modules[EditorRename] = ViewletEditorRename;
13141
- state$5.modules[EditorSourceActions] = ViewletEditorSourceActions;
13142
- state$5.modules[FindWidget] = ViewletFindWidget;
13143
- state$5.modules[TitleBar] = ViewletTitleBar;
13161
+ state$6.modules[ColorPicker] = ViewletColorPicker;
13162
+ state$6.modules[EditorCodeGenerator] = ViewletEditorCodeGenerator;
13163
+ state$6.modules[EditorCompletion] = ViewletEditorCompletion;
13164
+ state$6.modules[EditorCompletionDetails] = ViewletEditorCompletionDetails;
13165
+ state$6.modules[EditorHover] = ViewletEditorHover;
13166
+ state$6.modules[EditorRename] = ViewletEditorRename;
13167
+ state$6.modules[EditorSourceActions] = ViewletEditorSourceActions;
13168
+ state$6.modules[FindWidget] = ViewletFindWidget;
13169
+ state$6.modules[TitleBar] = ViewletTitleBar;
13144
13170
  // TODO this is discovered very late
13145
13171
  const launchWorkersResult = await launchWorkers();
13146
13172
  if (isError(launchWorkersResult)) {