@lvce-editor/renderer-process 30.68.9 → 30.68.10

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.
@@ -1464,15 +1464,15 @@ const createClient = url => {
1464
1464
  const commandMapRef = {};
1465
1465
 
1466
1466
  const workers$1 = new Map();
1467
- const state$m = {
1467
+ const state$n = {
1468
1468
  generation: 0,
1469
1469
  nextId: 0
1470
1470
  };
1471
- const getGeneration = () => state$m.generation;
1471
+ const getGeneration = () => state$n.generation;
1472
1472
  const createRuntimeName = name => {
1473
- state$m.nextId++;
1474
- const id = `worker-${state$m.nextId}`;
1475
- const runtimeId = `worker-${String(state$m.nextId).padStart(2, '0')}`;
1473
+ state$n.nextId++;
1474
+ const id = `worker-${state$n.nextId}`;
1475
+ const runtimeId = `worker-${String(state$n.nextId).padStart(2, '0')}`;
1476
1476
  return {
1477
1477
  id,
1478
1478
  name,
@@ -1480,8 +1480,8 @@ const createRuntimeName = name => {
1480
1480
  runtimeName: `[${runtimeId}] ${name}`
1481
1481
  };
1482
1482
  };
1483
- const track = (worker, startedIn = state$m.generation, trackedWorker) => {
1484
- if (startedIn !== state$m.generation) {
1483
+ const track = (worker, startedIn = state$n.generation, trackedWorker) => {
1484
+ if (startedIn !== state$n.generation) {
1485
1485
  worker.terminate();
1486
1486
  throw new Error('Worker launch canceled by application restart');
1487
1487
  }
@@ -1508,7 +1508,7 @@ const terminate$1 = id => {
1508
1508
  };
1509
1509
  const getWorkers$1 = () => workers$1.values().toArray();
1510
1510
  const terminateAll = () => {
1511
- state$m.generation++;
1511
+ state$n.generation++;
1512
1512
  const retiring = workers$1.keys().toArray();
1513
1513
  workers$1.clear();
1514
1514
  for (const worker of retiring) {
@@ -1654,7 +1654,7 @@ const launchRendererWorker = async () => {
1654
1654
  };
1655
1655
 
1656
1656
  const selector = 'script.RendererWorkerTrace';
1657
- const state$l = {
1657
+ const state$m = {
1658
1658
  enabled: false,
1659
1659
  entries: []
1660
1660
  };
@@ -1704,14 +1704,14 @@ const isCommand = value => {
1704
1704
  };
1705
1705
  const initialize$1 = search => {
1706
1706
  const searchParams = new URLSearchParams(search);
1707
- state$l.enabled = searchParams.has('traceRendererWorker');
1708
- state$l.entries = [];
1707
+ state$m.enabled = searchParams.has('traceRendererWorker');
1708
+ state$m.entries = [];
1709
1709
  };
1710
1710
  const record = (direction, method, params) => {
1711
- if (!state$l.enabled) {
1711
+ if (!state$m.enabled) {
1712
1712
  return;
1713
1713
  }
1714
- state$l.entries.push({
1714
+ state$m.entries.push({
1715
1715
  direction,
1716
1716
  method,
1717
1717
  params: serialize(params),
@@ -1719,7 +1719,7 @@ const record = (direction, method, params) => {
1719
1719
  });
1720
1720
  };
1721
1721
  const listen$1 = rpc => {
1722
- if (!state$l.enabled) {
1722
+ if (!state$m.enabled) {
1723
1723
  return;
1724
1724
  }
1725
1725
  const ipc = rpc.ipc;
@@ -1734,7 +1734,7 @@ const listen$1 = rpc => {
1734
1734
  });
1735
1735
  };
1736
1736
  const exportToDom = () => {
1737
- if (!state$l.enabled) {
1737
+ if (!state$m.enabled) {
1738
1738
  return;
1739
1739
  }
1740
1740
  const existing = document.querySelector(selector);
@@ -1742,7 +1742,7 @@ const exportToDom = () => {
1742
1742
  script.className = 'RendererWorkerTrace';
1743
1743
  script.type = 'application/json';
1744
1744
  script.textContent = JSON.stringify({
1745
- entries: state$l.entries,
1745
+ entries: state$m.entries,
1746
1746
  version: 1
1747
1747
  });
1748
1748
  if (!existing) {
@@ -1750,49 +1750,49 @@ const exportToDom = () => {
1750
1750
  }
1751
1751
  };
1752
1752
  const scheduleExport = () => {
1753
- if (!state$l.enabled) {
1753
+ if (!state$m.enabled) {
1754
1754
  return;
1755
1755
  }
1756
1756
  queueMicrotask(exportToDom);
1757
1757
  };
1758
1758
 
1759
- const state$k = {
1759
+ const state$l = {
1760
1760
  rpc: undefined
1761
1761
  };
1762
1762
  const hydrate$4 = async () => {
1763
1763
  const result = await launchRendererWorker();
1764
1764
  if (isError(result)) {
1765
- state$k.rpc = undefined;
1765
+ state$l.rpc = undefined;
1766
1766
  return result;
1767
1767
  }
1768
- state$k.rpc = result.value;
1768
+ state$l.rpc = result.value;
1769
1769
  listen$1(result.value);
1770
1770
  return success(undefined);
1771
1771
  };
1772
1772
 
1773
1773
  // TODO needed?
1774
1774
  const dispose$m = async () => {
1775
- const rpc = state$k.rpc;
1776
- state$k.rpc = undefined;
1775
+ const rpc = state$l.rpc;
1776
+ state$l.rpc = undefined;
1777
1777
  await rpc?.dispose();
1778
1778
  };
1779
1779
  const send$1 = (method, ...params) => {
1780
1780
  record('sent', method, params);
1781
1781
  // @ts-ignore
1782
- state$k.rpc.send(method, ...params);
1782
+ state$l.rpc.send(method, ...params);
1783
1783
  };
1784
1784
  const invoke$1 = (method, ...params) => {
1785
1785
  record('sent', method, params);
1786
1786
  // @ts-ignore
1787
- return state$k.rpc.invoke(method, ...params);
1787
+ return state$l.rpc.invoke(method, ...params);
1788
1788
  };
1789
1789
  const invokeAndTransfer = (method, ...params) => {
1790
1790
  record('sent', method, params);
1791
1791
  // @ts-ignore
1792
- return state$k.rpc.invokeAndTransfer(method, ...params);
1792
+ return state$l.rpc.invokeAndTransfer(method, ...params);
1793
1793
  };
1794
1794
 
1795
- const state$j = {
1795
+ const state$k = {
1796
1796
  client: undefined,
1797
1797
  enabled: false,
1798
1798
  lastError: '',
@@ -1802,38 +1802,38 @@ const state$j = {
1802
1802
  const workerUrl = new URL('sessionReplayWorkerMain.js', import.meta.url);
1803
1803
  const reloadMessage = 'Reload the window to start session replay with the complete DOM command history';
1804
1804
  const report = error => {
1805
- state$j.lastError = error instanceof Error ? error.message : String(error);
1806
- state$j.stopObserving?.();
1807
- state$j.stopObserving = undefined;
1808
- console.warn(`Session replay: ${state$j.lastError}`);
1805
+ state$k.lastError = error instanceof Error ? error.message : String(error);
1806
+ state$k.stopObserving?.();
1807
+ state$k.stopObserving = undefined;
1808
+ console.warn(`Session replay: ${state$k.lastError}`);
1809
1809
  };
1810
1810
 
1811
1811
  // Retain snapshot recording for older renderer workers during dependency rollout.
1812
1812
  const configure$1 = async options => {
1813
- state$j.stopObserving?.();
1814
- state$j.stopObserving = undefined;
1815
- state$j.enabled = false;
1816
- if (state$j.client) {
1813
+ state$k.stopObserving?.();
1814
+ state$k.stopObserving = undefined;
1815
+ state$k.enabled = false;
1816
+ if (state$k.client) {
1817
1817
  try {
1818
- await state$j.client.invoke('stop');
1818
+ await state$k.client.invoke('stop');
1819
1819
  } catch (error) {
1820
1820
  report(error);
1821
1821
  }
1822
1822
  // Live channels still need their proxy after capture stops.
1823
- if (!state$j.proxy) {
1824
- state$j.client.dispose();
1825
- state$j.client = undefined;
1823
+ if (!state$k.proxy) {
1824
+ state$k.client.dispose();
1825
+ state$k.client = undefined;
1826
1826
  }
1827
1827
  }
1828
1828
  if (!options.local && !options.upload) return '';
1829
- if (state$j.proxy) throw new Error(reloadMessage);
1830
- state$j.lastError = '';
1829
+ if (state$k.proxy) throw new Error(reloadMessage);
1830
+ state$k.lastError = '';
1831
1831
  const client = createClient(workerUrl);
1832
1832
  try {
1833
1833
  const id = await client.invoke('start', options);
1834
- state$j.stopObserving = observe(document, (type, data) => client.invoke('record', type, data), report);
1835
- state$j.client = client;
1836
- state$j.enabled = true;
1834
+ state$k.stopObserving = observe(document, (type, data) => client.invoke('record', type, data), report);
1835
+ state$k.client = client;
1836
+ state$k.enabled = true;
1837
1837
  return id;
1838
1838
  } catch (error) {
1839
1839
  client.dispose();
@@ -1841,7 +1841,7 @@ const configure$1 = async options => {
1841
1841
  }
1842
1842
  };
1843
1843
  const configureProxy = async (options, port) => {
1844
- if (state$j.client || !options.local && !options.upload) {
1844
+ if (state$k.client || !options.local && !options.upload) {
1845
1845
  port.close();
1846
1846
  throw new Error(reloadMessage);
1847
1847
  }
@@ -1854,25 +1854,25 @@ const configureProxy = async (options, port) => {
1854
1854
  commandMap: commandMapRef,
1855
1855
  messagePort: proxyPort
1856
1856
  });
1857
- const original = state$k.rpc;
1858
- state$k.rpc = {
1857
+ const original = state$l.rpc;
1858
+ state$l.rpc = {
1859
1859
  ...rpc,
1860
1860
  async dispose() {
1861
1861
  try {
1862
1862
  await rpc.dispose();
1863
1863
  } finally {
1864
1864
  client.dispose();
1865
- state$j.client = undefined;
1866
- state$j.enabled = false;
1867
- state$j.proxy = false;
1865
+ state$k.client = undefined;
1866
+ state$k.enabled = false;
1867
+ state$k.proxy = false;
1868
1868
  await original?.dispose();
1869
1869
  }
1870
1870
  }
1871
1871
  };
1872
- state$j.client = client;
1873
- state$j.enabled = true;
1874
- state$j.proxy = true;
1875
- state$j.lastError = '';
1872
+ state$k.client = client;
1873
+ state$k.enabled = true;
1874
+ state$k.proxy = true;
1875
+ state$k.lastError = '';
1876
1876
  return id;
1877
1877
  } catch (error) {
1878
1878
  proxyPort?.close();
@@ -1882,21 +1882,21 @@ const configureProxy = async (options, port) => {
1882
1882
  }
1883
1883
  };
1884
1884
  const getSession = async () => {
1885
- if (!state$j.enabled || !state$j.client) throw new Error('Session replay is disabled in settings');
1886
- return state$j.client.invoke('export');
1885
+ if (!state$k.enabled || !state$k.client) throw new Error('Session replay is disabled in settings');
1886
+ return state$k.client.invoke('export');
1887
1887
  };
1888
1888
  const getStatus$1 = async () => {
1889
- if (!state$j.client) return {
1889
+ if (!state$k.client) return {
1890
1890
  enabled: false,
1891
- error: state$j.lastError
1891
+ error: state$k.lastError
1892
1892
  };
1893
1893
  return {
1894
- enabled: state$j.enabled,
1895
- ...(await state$j.client.invoke('status')),
1896
- captureError: state$j.lastError
1894
+ enabled: state$k.enabled,
1895
+ ...(await state$k.client.invoke('status')),
1896
+ captureError: state$k.lastError
1897
1897
  };
1898
1898
  };
1899
- const flush = async () => state$j.client?.invoke('flush');
1899
+ const flush = async () => state$k.client?.invoke('flush');
1900
1900
  const openLocalFile = async () => {
1901
1901
  const input = document.createElement('input');
1902
1902
  input.type = 'file';
@@ -1954,12 +1954,12 @@ const initializeLayout = async href => {
1954
1954
  return true;
1955
1955
  };
1956
1956
  const dispose$l = async () => {
1957
- state$j.stopObserving?.();
1958
- state$j.stopObserving = undefined;
1959
- const client = state$j.client;
1960
- state$j.client = undefined;
1961
- state$j.enabled = false;
1962
- state$j.proxy = false;
1957
+ state$k.stopObserving?.();
1958
+ state$k.stopObserving = undefined;
1959
+ const client = state$k.client;
1960
+ state$k.client = undefined;
1961
+ state$k.enabled = false;
1962
+ state$k.proxy = false;
1963
1963
  if (client) {
1964
1964
  try {
1965
1965
  await client.invoke('flush');
@@ -2065,34 +2065,34 @@ const launchDragAndDropWorker = async () => {
2065
2065
  }
2066
2066
  };
2067
2067
 
2068
- const state$i = {
2068
+ const state$j = {
2069
2069
  rpc: undefined
2070
2070
  };
2071
2071
  const hydrate$3 = async () => {
2072
2072
  const result = await launchDragAndDropWorker();
2073
2073
  if (isError(result)) {
2074
- state$i.rpc = undefined;
2074
+ state$j.rpc = undefined;
2075
2075
  return result;
2076
2076
  }
2077
- state$i.rpc = result.value;
2077
+ state$j.rpc = result.value;
2078
2078
  return success(undefined);
2079
2079
  };
2080
2080
  const handleMessagePort$1 = async port => {
2081
- if (!state$i.rpc) {
2081
+ if (!state$j.rpc) {
2082
2082
  const result = await hydrate$3();
2083
2083
  if (isError(result)) {
2084
2084
  throw result.error;
2085
2085
  }
2086
2086
  }
2087
- const rpc = state$i.rpc;
2087
+ const rpc = state$j.rpc;
2088
2088
  if (!rpc) {
2089
2089
  throw new Error('Drag And Drop Worker failed to initialize');
2090
2090
  }
2091
2091
  await rpc.invokeAndTransfer('DragAndDrop.handleMessagePort', port);
2092
2092
  };
2093
2093
  const dispose$k = async () => {
2094
- const rpc = state$i.rpc;
2095
- state$i.rpc = undefined;
2094
+ const rpc = state$j.rpc;
2095
+ state$j.rpc = undefined;
2096
2096
  await rpc?.dispose();
2097
2097
  };
2098
2098
 
@@ -2216,7 +2216,7 @@ const createIdGenerator = () => {
2216
2216
  };
2217
2217
  const create$A = createIdGenerator();
2218
2218
 
2219
- const state$h = Object.create(null);
2219
+ const state$i = Object.create(null);
2220
2220
  const retainString = (item, index) => {
2221
2221
  const value = new Promise(resolve => {
2222
2222
  item.getAsString(resolve);
@@ -2267,25 +2267,25 @@ const retainItems = dataTransfer => {
2267
2267
  };
2268
2268
  const addItems = items => {
2269
2269
  const id = create$A();
2270
- state$h[id] = items;
2270
+ state$i[id] = items;
2271
2271
  return id;
2272
2272
  };
2273
2273
  const add$2 = dataTransfer => {
2274
2274
  return addItems(retainItems(dataTransfer));
2275
2275
  };
2276
2276
  const acquire$2 = id => {
2277
- const items = state$h[id];
2277
+ const items = state$i[id];
2278
2278
  if (!items) {
2279
2279
  throw new Error(`Drop data not found: ${id}`);
2280
2280
  }
2281
- delete state$h[id];
2281
+ delete state$i[id];
2282
2282
  return items;
2283
2283
  };
2284
2284
 
2285
- const state$g = Object.create(null);
2285
+ const state$h = Object.create(null);
2286
2286
  const acquire$1 = id => {
2287
- const promise = state$g[id];
2288
- delete state$g[id];
2287
+ const promise = state$h[id];
2288
+ delete state$h[id];
2289
2289
  return promise;
2290
2290
  };
2291
2291
  const getFileHandles = async ids => {
@@ -2295,7 +2295,7 @@ const getFileHandles = async ids => {
2295
2295
  };
2296
2296
  const add$1 = promise => {
2297
2297
  const id = create$A();
2298
- state$g[id] = promise;
2298
+ state$h[id] = promise;
2299
2299
  return id;
2300
2300
  };
2301
2301
  const addFileHandle$1 = fileHandle => {
@@ -2489,14 +2489,14 @@ const getEventListenerArgs = (params, event) => {
2489
2489
  return serialized;
2490
2490
  };
2491
2491
 
2492
- const state$f = {
2492
+ const state$g = {
2493
2493
  ipc: undefined
2494
2494
  };
2495
2495
  const getIpc = () => {
2496
- return state$f.ipc;
2496
+ return state$g.ipc;
2497
2497
  };
2498
2498
  const setIpc = value => {
2499
- state$f.ipc = value;
2499
+ state$g.ipc = value;
2500
2500
  };
2501
2501
 
2502
2502
  const nameAnonymousFunction$1 = (fn, name) => {
@@ -4172,12 +4172,12 @@ const unregisterView = uid => {
4172
4172
  viewRpcIds.delete(uid);
4173
4173
  };
4174
4174
 
4175
- const state$e = {
4175
+ const state$f = {
4176
4176
  snapshot: undefined
4177
4177
  };
4178
- const get$7 = () => state$e.snapshot;
4178
+ const get$7 = () => state$f.snapshot;
4179
4179
  const set$9 = value => {
4180
- state$e.snapshot = value;
4180
+ state$f.snapshot = value;
4181
4181
  };
4182
4182
 
4183
4183
  const ipcs = Object.create(null);
@@ -4686,32 +4686,32 @@ const launchWorkers = async () => {
4686
4686
  return success(undefined);
4687
4687
  };
4688
4688
 
4689
- const state$d = {
4689
+ const state$e = {
4690
4690
  renderer: undefined
4691
4691
  };
4692
4692
  const configure = options => {
4693
4693
  const cache = options?.cache;
4694
- state$d.renderer = cache?.dom > 0 || cache?.text > 0 ? createRenderer(options) : undefined;
4694
+ state$e.renderer = cache?.dom > 0 || cache?.text > 0 ? createRenderer(options) : undefined;
4695
4695
  };
4696
4696
  const render = (nodes, eventMap = {}, newEventMap = {}) => {
4697
- return state$d.renderer?.render(nodes, eventMap, newEventMap) || render$1(nodes, eventMap, newEventMap);
4697
+ return state$e.renderer?.render(nodes, eventMap, newEventMap) || render$1(nodes, eventMap, newEventMap);
4698
4698
  };
4699
4699
  const renderInto = (parent, nodes, eventMap = {}, newEventMap = {}) => {
4700
- if (state$d.renderer) {
4701
- state$d.renderer.renderInto(parent, nodes, eventMap, newEventMap);
4700
+ if (state$e.renderer) {
4701
+ state$e.renderer.renderInto(parent, nodes, eventMap, newEventMap);
4702
4702
  return;
4703
4703
  }
4704
4704
  renderInto$1(parent, nodes, eventMap);
4705
4705
  };
4706
4706
  const applyPatch$1 = (element, patches, eventMap = {}, id = 0) => {
4707
- if (state$d.renderer) {
4708
- state$d.renderer.applyPatch(element, patches, eventMap, id);
4707
+ if (state$e.renderer) {
4708
+ state$e.renderer.applyPatch(element, patches, eventMap, id);
4709
4709
  return;
4710
4710
  }
4711
4711
  applyPatch$2(element, patches, eventMap, id);
4712
4712
  };
4713
4713
  const dispose$i = root => {
4714
- state$d.renderer?.dispose(root);
4714
+ state$e.renderer?.dispose(root);
4715
4715
  };
4716
4716
 
4717
4717
  const applyPatch = (element, patches, eventMap = {}, id = 0) => {
@@ -4724,25 +4724,25 @@ const attachEvents$7 = ($Node, eventMap) => {
4724
4724
  }
4725
4725
  };
4726
4726
 
4727
- const state$c = {
4727
+ const state$d = {
4728
4728
  styleSheets: Object.create(null),
4729
4729
  texts: Object.create(null)
4730
4730
  };
4731
4731
  const set$6 = (id, sheet) => {
4732
- state$c.styleSheets[id] = sheet;
4732
+ state$d.styleSheets[id] = sheet;
4733
4733
  };
4734
4734
  const get$5 = id => {
4735
- return state$c.styleSheets[id];
4735
+ return state$d.styleSheets[id];
4736
4736
  };
4737
4737
  const setText$1 = (id, text) => {
4738
- state$c.texts[id] = text;
4738
+ state$d.texts[id] = text;
4739
4739
  };
4740
4740
  const getText = id => {
4741
- return state$c.texts[id];
4741
+ return state$d.texts[id];
4742
4742
  };
4743
4743
  const remove$2 = id => {
4744
- delete state$c.styleSheets[id];
4745
- delete state$c.texts[id];
4744
+ delete state$d.styleSheets[id];
4745
+ delete state$d.texts[id];
4746
4746
  };
4747
4747
 
4748
4748
  const addCssStyleSheet = (id, text) => {
@@ -4816,25 +4816,25 @@ const PointerUp = 'pointerup';
4816
4816
  const Resize = 'resize';
4817
4817
  const Wheel = 'wheel';
4818
4818
 
4819
- const state$b = {
4819
+ const state$c = {
4820
4820
  currentDragInfo: undefined
4821
4821
  };
4822
4822
  const set$5 = (id, data) => {
4823
- state$b.currentDragInfo = data;
4823
+ state$c.currentDragInfo = data;
4824
4824
  setDragInfo(id, data);
4825
4825
  };
4826
4826
  const getCurrent = () => {
4827
- return state$b.currentDragInfo;
4827
+ return state$c.currentDragInfo;
4828
4828
  };
4829
4829
 
4830
- const state$a = {
4830
+ const state$b = {
4831
4831
  identifiers: new Uint32Array()
4832
4832
  };
4833
4833
  const setIdentifiers$1 = identifiers => {
4834
- state$a.identifiers = identifiers;
4834
+ state$b.identifiers = identifiers;
4835
4835
  };
4836
4836
  const getIdentifiers = () => {
4837
- return state$a.identifiers;
4837
+ return state$b.identifiers;
4838
4838
  };
4839
4839
 
4840
4840
  // TODO store keybindings as JSON somewhere
@@ -4864,11 +4864,11 @@ const info = (...args) => {
4864
4864
  };
4865
4865
 
4866
4866
  const pendingBatches = new Map();
4867
- const state$9 = {
4867
+ const state$a = {
4868
4868
  nextTransactionId: 1
4869
4869
  };
4870
4870
  const queue = (uid, commands, focusVersion = 0) => {
4871
- const transactionId = state$9.nextTransactionId++;
4871
+ const transactionId = state$a.nextTransactionId++;
4872
4872
  pendingBatches.set(transactionId, {
4873
4873
  commands,
4874
4874
  committed: false,
@@ -5060,7 +5060,7 @@ class VError extends Error {
5060
5060
  }
5061
5061
 
5062
5062
  // TODO this file is not needed when all elements are position fixed
5063
- const state$8 = {
5063
+ const state$9 = {
5064
5064
  $Widgets: undefined,
5065
5065
  widgetSet: new Set()
5066
5066
  };
@@ -5072,20 +5072,20 @@ const create$Widgets = () => {
5072
5072
  };
5073
5073
  const append$1 = $Element => {
5074
5074
  // TODO should not call append in the first place if it is already in DOM
5075
- if (state$8.widgetSet.has($Element)) {
5075
+ if (state$9.widgetSet.has($Element)) {
5076
5076
  return;
5077
5077
  }
5078
- state$8.widgetSet.add($Element);
5079
- if (state$8.$Widgets) {
5078
+ state$9.widgetSet.add($Element);
5079
+ if (state$9.$Widgets) {
5080
5080
  // @ts-expect-error
5081
- state$8.$Widgets.append($Element);
5081
+ state$9.$Widgets.append($Element);
5082
5082
  } else {
5083
5083
  // @ts-expect-error
5084
- state$8.$Widgets = create$Widgets();
5084
+ state$9.$Widgets = create$Widgets();
5085
5085
  // @ts-expect-error
5086
- state$8.$Widgets.append($Element);
5086
+ state$9.$Widgets.append($Element);
5087
5087
  // @ts-expect-error
5088
- document.body.append(state$8.$Widgets);
5088
+ document.body.append(state$9.$Widgets);
5089
5089
  }
5090
5090
  };
5091
5091
  const remove$1 = $Element => {
@@ -5093,13 +5093,13 @@ const remove$1 = $Element => {
5093
5093
  // TODO $Element should always be defined
5094
5094
  return;
5095
5095
  }
5096
- state$8.widgetSet.delete($Element);
5096
+ state$9.widgetSet.delete($Element);
5097
5097
  $Element.remove();
5098
5098
  // TODO state.$Widgets should always be defined at this point
5099
- if (state$8.widgetSet.size === 0 && state$8.$Widgets) {
5099
+ if (state$9.widgetSet.size === 0 && state$9.$Widgets) {
5100
5100
  // @ts-expect-error
5101
- state$8.$Widgets.remove();
5102
- state$8.$Widgets = undefined;
5101
+ state$9.$Widgets.remove();
5102
+ state$9.$Widgets = undefined;
5103
5103
  }
5104
5104
  };
5105
5105
 
@@ -7475,16 +7475,16 @@ const EditorTextError = 'EditorTextError';
7475
7475
  const EditorRename = 'EditorRename';
7476
7476
  const EditorCodeGenerator = 'EditorCodeGenerator';
7477
7477
 
7478
- const state$7 = {
7478
+ const state$8 = {
7479
7479
  /**
7480
7480
  * @type {HTMLElement|undefined}
7481
7481
  */
7482
7482
  $PreviousFocusElement: undefined};
7483
7483
  const setElement = $Element => {
7484
- state$7.$PreviousFocusElement = $Element;
7484
+ state$8.$PreviousFocusElement = $Element;
7485
7485
  };
7486
7486
  const getElement = () => {
7487
- return state$7.$PreviousFocusElement;
7487
+ return state$8.$PreviousFocusElement;
7488
7488
  };
7489
7489
 
7490
7490
  const focus$8 = $Element => {
@@ -7893,11 +7893,11 @@ const ViewletSidebar = {
7893
7893
  };
7894
7894
 
7895
7895
  const pendingSelections = new WeakMap();
7896
- const state$6 = {};
7896
+ const state$7 = {};
7897
7897
  const handleFocus$2 = event => {
7898
7898
  const target = event.target;
7899
7899
  if (target instanceof HTMLElement && !target.closest('.SimpleBrowser') && target.closest('.Main, .Panel, .Editor, .Terminal')) {
7900
- state$6.codingFocus = new WeakRef(target);
7900
+ state$7.codingFocus = new WeakRef(target);
7901
7901
  }
7902
7902
  };
7903
7903
  const handleFocusOut$2 = event => {
@@ -7926,7 +7926,7 @@ const listen = () => {
7926
7926
  document.addEventListener('keydown', cancelPendingAddressSelection);
7927
7927
  };
7928
7928
  const restoreCodingFocus$1 = () => {
7929
- const target = state$6.codingFocus?.deref();
7929
+ const target = state$7.codingFocus?.deref();
7930
7930
  if (!target?.isConnected) {
7931
7931
  return false;
7932
7932
  }
@@ -8419,7 +8419,7 @@ const create$BackDrop = () => {
8419
8419
 
8420
8420
  // TODO keyboard handling
8421
8421
 
8422
- const state$5 = {
8422
+ const state$6 = {
8423
8423
  $$Menus: [],
8424
8424
  $BackDrop: undefined,
8425
8425
  anchorTime: -1,
@@ -8430,7 +8430,7 @@ const state$5 = {
8430
8430
  };
8431
8431
  const getLevel = $Menu => {
8432
8432
  // @ts-expect-error
8433
- return state$5.$$Menus.indexOf($Menu);
8433
+ return state$6.$$Menus.indexOf($Menu);
8434
8434
  };
8435
8435
  const handleMouseDown$1 = event => {
8436
8436
  const $Target = event.target;
@@ -8500,10 +8500,10 @@ const handleMouseLeave = event => {
8500
8500
 
8501
8501
  // const handleBlur = (event) => {}
8502
8502
  const handleKeyDown = event => {
8503
- state$5.handleKeyDown(event);
8503
+ state$6.handleKeyDown(event);
8504
8504
  };
8505
8505
  const handleFocusOut$1 = event => {
8506
- state$5.handleFocusOut(event);
8506
+ state$6.handleFocusOut(event);
8507
8507
  };
8508
8508
  const create$Menu$1 = () => {
8509
8509
  // TODO set aria label on menu (e.g. File, Edit, Selection)
@@ -8531,7 +8531,7 @@ const create$Menu$1 = () => {
8531
8531
  return $Menu;
8532
8532
  };
8533
8533
  const focusIndex = (level, oldFocusedIndex, newFocusedIndex) => {
8534
- const $Menu = state$5.$$Menus[level];
8534
+ const $Menu = state$6.$$Menus[level];
8535
8535
  if (oldFocusedIndex !== -1) {
8536
8536
  // @ts-expect-error
8537
8537
  $Menu.children[oldFocusedIndex].classList.remove('MenuItemFocused');
@@ -8553,21 +8553,21 @@ const handleBackDropMouseDown = event => {
8553
8553
  preventDefault(event);
8554
8554
  stopPropagation(event);
8555
8555
  send$1(/* Menu.hide */'Menu.hide');
8556
- if (state$5.$BackDrop) {
8557
- remove$1(state$5.$BackDrop);
8558
- state$5.$BackDrop = undefined;
8556
+ if (state$6.$BackDrop) {
8557
+ remove$1(state$6.$BackDrop);
8558
+ state$6.$BackDrop = undefined;
8559
8559
  }
8560
8560
  };
8561
8561
  const handleContextMenu$1 = event => {
8562
8562
  preventDefault(event);
8563
8563
  };
8564
8564
  const showMenu = (x, y, width, height, items, level, parentIndex = -1, dom = [], mouseBlocking = false) => {
8565
- if (mouseBlocking && !state$5.$BackDrop) {
8565
+ if (mouseBlocking && !state$6.$BackDrop) {
8566
8566
  const $BackDrop = create$BackDrop();
8567
8567
  $BackDrop.onmousedown = handleBackDropMouseDown;
8568
8568
  $BackDrop.oncontextmenu = handleContextMenu$1;
8569
8569
  // @ts-expect-error
8570
- state$5.$BackDrop = $BackDrop;
8570
+ state$6.$BackDrop = $BackDrop;
8571
8571
  append$1($BackDrop);
8572
8572
  }
8573
8573
  const $Menu = create$Menu$1();
@@ -8575,7 +8575,7 @@ const showMenu = (x, y, width, height, items, level, parentIndex = -1, dom = [],
8575
8575
  setXAndY($Menu, x, y);
8576
8576
  $Menu.id = `Menu-${level}`;
8577
8577
  if (parentIndex !== -1) {
8578
- const $ParentMenu = state$5.$$Menus[level - 1];
8578
+ const $ParentMenu = state$6.$$Menus[level - 1];
8579
8579
  // @ts-expect-error
8580
8580
  const $ParentMenuItem = $ParentMenu.children[parentIndex];
8581
8581
  $ParentMenuItem.ariaExpanded = True;
@@ -8583,7 +8583,7 @@ const showMenu = (x, y, width, height, items, level, parentIndex = -1, dom = [],
8583
8583
  }
8584
8584
 
8585
8585
  // @ts-expect-error
8586
- state$5.$$Menus.push($Menu);
8586
+ state$6.$$Menus.push($Menu);
8587
8587
  append$1($Menu);
8588
8588
  if (level === 0) {
8589
8589
  focus$8($Menu);
@@ -8591,14 +8591,14 @@ const showMenu = (x, y, width, height, items, level, parentIndex = -1, dom = [],
8591
8591
  }
8592
8592
  };
8593
8593
  const hideSubmenu = level => {
8594
- const $$ChildMenus = state$5.$$Menus.slice(level);
8594
+ const $$ChildMenus = state$6.$$Menus.slice(level);
8595
8595
  for (const $ChildMenu of $$ChildMenus) {
8596
8596
  remove$1($ChildMenu);
8597
8597
  }
8598
- state$5.$$Menus = state$5.$$Menus.slice(0, level);
8599
- if (state$5.$$Menus.length === 0 && state$5.$BackDrop) {
8600
- remove$1(state$5.$BackDrop);
8601
- state$5.$BackDrop = undefined;
8598
+ state$6.$$Menus = state$6.$$Menus.slice(0, level);
8599
+ if (state$6.$$Menus.length === 0 && state$6.$BackDrop) {
8600
+ remove$1(state$6.$BackDrop);
8601
+ state$6.$BackDrop = undefined;
8602
8602
  }
8603
8603
  };
8604
8604
 
@@ -8637,7 +8637,7 @@ const showControlled = ({
8637
8637
  y
8638
8638
  }) => {
8639
8639
  showMenu(x, y, width, height, items, level);
8640
- const $Menu = state$5.$$Menus.at(-1);
8640
+ const $Menu = state$6.$$Menus.at(-1);
8641
8641
  if ($Parent && $Menu) {
8642
8642
  const uid = get$9($Parent);
8643
8643
  set$a($Menu, uid);
@@ -8645,9 +8645,9 @@ const showControlled = ({
8645
8645
  // TODO menu should not necessarily know about parent (titleBarMenuBar)
8646
8646
  // it should be the other way around
8647
8647
  // @ts-expect-error
8648
- state$5.$Parent = $Parent;
8649
- state$5.handleFocusOut = handleFocusOut;
8650
- state$5.handleKeyDown = handleKeyDown;
8648
+ state$6.$Parent = $Parent;
8649
+ state$6.handleFocusOut = handleFocusOut;
8650
+ state$6.handleKeyDown = handleKeyDown;
8651
8651
  if ($Parent) {
8652
8652
  // state.$Menu.ariaLabel=''
8653
8653
  // state.$Menu.ariaLabelledBy =$Parent.id
@@ -8659,13 +8659,13 @@ const showControlled = ({
8659
8659
  // TODO have function to show submenu
8660
8660
 
8661
8661
  const hide = (restoreFocus = true) => {
8662
- for (const $Menu of state$5.$$Menus) {
8662
+ for (const $Menu of state$6.$$Menus) {
8663
8663
  remove$1($Menu);
8664
8664
  }
8665
- state$5.$$Menus = [];
8666
- if (state$5.$BackDrop) {
8667
- remove$1(state$5.$BackDrop);
8668
- state$5.$BackDrop = undefined;
8665
+ state$6.$$Menus = [];
8666
+ if (state$6.$BackDrop) {
8667
+ remove$1(state$6.$BackDrop);
8668
+ state$6.$BackDrop = undefined;
8669
8669
  }
8670
8670
  // TODO focus previous item
8671
8671
  if (restoreFocus) {
@@ -8910,8 +8910,8 @@ const openMenu = (state, unFocusIndex, index, level, menuItems, menuFocusedIndex
8910
8910
  $Viewlet.children[unFocusIndex].removeAttribute(AriaOwns);
8911
8911
  }
8912
8912
  $Viewlet.children[index].ariaExpanded = True;
8913
- const $$Menus = state$5.$$Menus;
8914
- state$5.$$Menus = [];
8913
+ const $$Menus = state$6.$$Menus;
8914
+ state$6.$$Menus = [];
8915
8915
  // @ts-expect-error
8916
8916
  showControlled({
8917
8917
  $Parent: $Viewlet.children[index],
@@ -9320,14 +9320,14 @@ const load$1 = moduleId => {
9320
9320
  return loadModule();
9321
9321
  };
9322
9322
 
9323
- const state$4 = {
9323
+ const state$5 = {
9324
9324
  currentPanelView: undefined,
9325
9325
  currentSidebarView: undefined,
9326
9326
  modules: Object.create(null)
9327
9327
  };
9328
9328
 
9329
9329
  const create$4 = (id, uid = id) => {
9330
- const module = state$4.modules[id];
9330
+ const module = state$5.modules[id];
9331
9331
  if (!module) {
9332
9332
  throw new Error(`module not found: ${id}`);
9333
9333
  }
@@ -9346,7 +9346,7 @@ const create$4 = (id, uid = id) => {
9346
9346
  });
9347
9347
  };
9348
9348
  const createFunctionalRoot = (id, uid = id, hasFunctionalEvents, directEventRpcId) => {
9349
- let module = state$4.modules[id];
9349
+ let module = state$5.modules[id];
9350
9350
  if (hasFunctionalEvents) {
9351
9351
  module ||= {};
9352
9352
  }
@@ -9378,7 +9378,7 @@ const removeKeyBindings = id => {
9378
9378
  const loadModule = async id => {
9379
9379
  try {
9380
9380
  const module = await load$1(id);
9381
- state$4.modules[id] = module;
9381
+ state$5.modules[id] = module;
9382
9382
  } catch (error) {
9383
9383
  throw new VError(error, `Failed to load ${id}`);
9384
9384
  }
@@ -9562,7 +9562,7 @@ const refresh = (viewletId, viewletContext) => {
9562
9562
  instance.factory.refresh(instance.state, viewletContext);
9563
9563
  } else {
9564
9564
  // @ts-expect-error
9565
- state$4.refreshContext[viewletId] = viewletContext;
9565
+ state$5.refreshContext[viewletId] = viewletContext;
9566
9566
  }
9567
9567
  };
9568
9568
  const specialIds = new Set(['TitleBar', 'SideBar', 'Main', 'ActivityBar', 'StatusBar', 'Panel']);
@@ -10172,7 +10172,7 @@ const getFn = command => {
10172
10172
  return fn;
10173
10173
  };
10174
10174
 
10175
- const state$3 = {
10175
+ const state$4 = {
10176
10176
  duration: 0,
10177
10177
  lastError: '',
10178
10178
  pending: false
@@ -10188,9 +10188,9 @@ const waitForReady = async () => {
10188
10188
  }
10189
10189
  };
10190
10190
  const getStatus = () => ({
10191
- duration: state$3.duration,
10192
- error: state$3.lastError,
10193
- pending: state$3.pending
10191
+ duration: state$4.duration,
10192
+ error: state$4.lastError,
10193
+ pending: state$4.pending
10194
10194
  });
10195
10195
  const restart = async () => {
10196
10196
  const started = performance.now();
@@ -10213,9 +10213,9 @@ const restart = async () => {
10213
10213
  if (isError(result)) throw result.error;
10214
10214
  await waitForReady();
10215
10215
  set$9(undefined);
10216
- state$3.duration = performance.now() - started;
10216
+ state$4.duration = performance.now() - started;
10217
10217
  } catch (error) {
10218
- state$3.lastError = error instanceof Error ? error.message : String(error);
10218
+ state$4.lastError = error instanceof Error ? error.message : String(error);
10219
10219
  console.error(error);
10220
10220
  // Keep the snapshot available for recovery; never silently discard drafts.
10221
10221
  const snapshot = get$7();
@@ -10229,21 +10229,21 @@ const restart = async () => {
10229
10229
  }
10230
10230
  }
10231
10231
  const recovery = document.createElement('button');
10232
- recovery.textContent = `Application restart failed: ${state$3.lastError}. Reload window`;
10232
+ recovery.textContent = `Application restart failed: ${state$4.lastError}. Reload window`;
10233
10233
  recovery.onclick = () => location.reload();
10234
10234
  document.body.append(recovery);
10235
10235
  } finally {
10236
10236
  document.documentElement.inert = false;
10237
- state$3.pending = false;
10237
+ state$4.pending = false;
10238
10238
  }
10239
10239
  };
10240
10240
 
10241
10241
  // Reply on the old RPC before retiring it. Awaiting restart from that RPC would
10242
10242
  // strand the caller when its worker is terminated.
10243
10243
  const request = () => {
10244
- if (state$3.pending) return;
10245
- state$3.pending = true;
10246
- state$3.lastError = '';
10244
+ if (state$4.pending) return;
10245
+ state$4.pending = true;
10246
+ state$4.lastError = '';
10247
10247
  setTimeout(() => void restart(), 0);
10248
10248
  };
10249
10249
 
@@ -10483,6 +10483,10 @@ const addFileHandle = fileHandle => {
10483
10483
  return addFileHandle$1(fileHandle);
10484
10484
  };
10485
10485
 
10486
+ const state$3 = {
10487
+ hydrated: false,
10488
+ lastPathName: ''
10489
+ };
10486
10490
  const getPathName = () => {
10487
10491
  return location.pathname;
10488
10492
  };
@@ -10499,6 +10503,7 @@ const setPathName = pathName => {
10499
10503
  return;
10500
10504
  }
10501
10505
  history.pushState(null, '', pathName);
10506
+ state$3.lastPathName = getPathName();
10502
10507
  };
10503
10508
  const setHash = hash => {
10504
10509
  const currentHref = getHref();
@@ -10518,8 +10523,25 @@ const setWorkspaceUri = workspaceUri => {
10518
10523
  }
10519
10524
  history.replaceState(null, '', url.href);
10520
10525
  };
10526
+ const isChatPath = pathName => {
10527
+ return /(?:^|\/)chat\/?$/.test(pathName);
10528
+ };
10529
+ const handlePopState = () => {
10530
+ const pathName = getPathName();
10531
+ if (isChatPath(pathName)) {
10532
+ send$1('Layout.enterAiNativeLayout');
10533
+ } else if (isChatPath(state$3.lastPathName)) {
10534
+ send$1('Layout.leaveSideBarFocusMode');
10535
+ }
10536
+ state$3.lastPathName = pathName;
10537
+ };
10521
10538
  const hydrate = () => {
10522
- // addEventListener('popstate', handlePopState)
10539
+ if (state$3.hydrated) {
10540
+ return;
10541
+ }
10542
+ state$3.lastPathName = getPathName();
10543
+ addEventListener('popstate', handlePopState);
10544
+ state$3.hydrated = true;
10523
10545
  };
10524
10546
 
10525
10547
  const getConfig = () => {
@@ -12515,15 +12537,15 @@ const main = async () => {
12515
12537
  initialize$1(location.search);
12516
12538
  Object.assign(commandMapRef, commandMap);
12517
12539
  enable(window);
12518
- state$4.modules[ColorPicker] = ViewletColorPicker;
12519
- state$4.modules[EditorCodeGenerator] = ViewletEditorCodeGenerator;
12520
- state$4.modules[EditorCompletion] = ViewletEditorCompletion;
12521
- state$4.modules[EditorCompletionDetails] = ViewletEditorCompletionDetails;
12522
- state$4.modules[EditorHover] = ViewletEditorHover;
12523
- state$4.modules[EditorRename] = ViewletEditorRename;
12524
- state$4.modules[EditorSourceActions] = ViewletEditorSourceActions;
12525
- state$4.modules[FindWidget] = ViewletFindWidget;
12526
- state$4.modules[TitleBar] = ViewletTitleBar;
12540
+ state$5.modules[ColorPicker] = ViewletColorPicker;
12541
+ state$5.modules[EditorCodeGenerator] = ViewletEditorCodeGenerator;
12542
+ state$5.modules[EditorCompletion] = ViewletEditorCompletion;
12543
+ state$5.modules[EditorCompletionDetails] = ViewletEditorCompletionDetails;
12544
+ state$5.modules[EditorHover] = ViewletEditorHover;
12545
+ state$5.modules[EditorRename] = ViewletEditorRename;
12546
+ state$5.modules[EditorSourceActions] = ViewletEditorSourceActions;
12547
+ state$5.modules[FindWidget] = ViewletFindWidget;
12548
+ state$5.modules[TitleBar] = ViewletTitleBar;
12527
12549
  // TODO this is discovered very late
12528
12550
  const launchWorkersResult = await launchWorkers();
12529
12551
  if (isError(launchWorkersResult)) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@lvce-editor/renderer-process",
3
- "version": "30.68.9",
3
+ "version": "30.68.10",
4
4
  "keywords": [
5
5
  "lvce-editor",
6
6
  "renderer-process"