@dao42/d42paas-front 0.6.4 → 0.6.8

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.
@@ -14713,20 +14713,29 @@ const daopaasDB = openDB("daopaas", 1, {
14713
14713
  });
14714
14714
  async function setReplaySource(val) {
14715
14715
  const {
14716
- CRDTInfo,
14716
+ CRDTInfo: CRDTInfo2,
14717
14717
  appStatus,
14718
14718
  globalData
14719
14719
  } = oTStore.getState();
14720
14720
  if (appStatus === "replay")
14721
14721
  return;
14722
+ if (val.event === "editor") {
14723
+ val.editor.revision++;
14724
+ }
14722
14725
  return (await daopaasDB).put("crdts", __spreadProps(__spreadValues({}, val), {
14723
14726
  userInfo: lodash$2.exports.pick(val.userInfo, ["uuid", "role"]),
14724
14727
  file: lodash$2.exports.omit(val.file, "value")
14725
14728
  }), val.timestamp + "." + v4$1().split("-")[0]);
14726
14729
  }
14730
+ async function getLocalFile(key) {
14731
+ return (await daopaasDB).get("files", key);
14732
+ }
14727
14733
  async function getLocalReplayFile(key) {
14728
14734
  return (await daopaasDB).get("replayFiles", key);
14729
14735
  }
14736
+ async function getAllLocalReplayFile() {
14737
+ return (await daopaasDB).getAll("replayFiles");
14738
+ }
14730
14739
  async function setLocalFile(key, val) {
14731
14740
  return (await daopaasDB).put("files", val, key);
14732
14741
  }
@@ -15020,14 +15029,11 @@ const oTStore = create$3((set2) => ({
15020
15029
  asyncType: arg
15021
15030
  }))
15022
15031
  }));
15023
- const fileTreeStore = create$3(persist((set2) => ({
15032
+ const fileTreeStore = create$3((set2) => ({
15024
15033
  fileTree: {},
15025
15034
  switchFileTree: (arg) => set2(() => ({
15026
15035
  fileTree: arg
15027
15036
  }))
15028
- }), {
15029
- name: "fileTree",
15030
- getStorage: () => localStorage
15031
15037
  }));
15032
15038
  const userStore = create$3(persist((set2) => ({
15033
15039
  userInfo: {},
@@ -28379,6 +28385,13 @@ const PlaygroundInit = (arg) => {
28379
28385
  setGlobalData
28380
28386
  } = oTStore.getState();
28381
28387
  shadowUserStore.getState();
28388
+ getAllLocalReplayFile().then((allFiles) => {
28389
+ allFiles.forEach((f2) => {
28390
+ setLocalReplayFile(f2.path, __spreadProps(__spreadValues({}, f2), {
28391
+ revision: 0
28392
+ }));
28393
+ });
28394
+ });
28382
28395
  window.clearCache = () => {
28383
28396
  localStorage.clear();
28384
28397
  indexedDB.deleteDatabase("daopaas").onsuccess = () => {
@@ -28436,13 +28449,15 @@ const PlaygroundInit = (arg) => {
28436
28449
  setCRDTInfo2(crdt);
28437
28450
  const otPlaygroundInfo = oTStore.getState().playgroundInfo;
28438
28451
  setPlaygroundInfo(__spreadProps(__spreadValues(__spreadValues({}, playgroundInfo), otPlaygroundInfo), {
28439
- activeDockerId: dockerInfo2.dockerId
28452
+ activeDockerId: playgroundInfo == null ? void 0 : playgroundInfo.dockerId
28440
28453
  }));
28441
- (_a2 = otPlaygroundInfo == null ? void 0 : otPlaygroundInfo.dockerInfos) == null ? void 0 : _a2.set(dockerInfo2.dockerId, dockerInfo2);
28442
- setDockerInfo(__spreadValues(__spreadValues({}, oTStore.getState().dockerInfo), dockerInfo2));
28443
- dockerInfo2.fileTree && switchFileTree({
28444
- data: dockerInfo2.fileTree
28445
- });
28454
+ if (dockerInfo2) {
28455
+ (_a2 = otPlaygroundInfo == null ? void 0 : otPlaygroundInfo.dockerInfos) == null ? void 0 : _a2.set(dockerInfo2.dockerId, dockerInfo2);
28456
+ setDockerInfo(__spreadValues(__spreadValues({}, oTStore.getState().dockerInfo), dockerInfo2));
28457
+ dockerInfo2.fileTree && switchFileTree({
28458
+ data: dockerInfo2.fileTree
28459
+ });
28460
+ }
28446
28461
  });
28447
28462
  io.on("playgroundStatus", (data) => {
28448
28463
  setPlaygroundStatus(data);
@@ -28451,7 +28466,7 @@ const PlaygroundInit = (arg) => {
28451
28466
  setDockerStatus(data || "STOP");
28452
28467
  });
28453
28468
  io.on("fileContent", async (d2) => {
28454
- var _a2, _b2, _c2, _d3;
28469
+ var _a2, _b2, _c2;
28455
28470
  const _d2 = JSON.parse(d2);
28456
28471
  setCRDTInfo2(_d2);
28457
28472
  setAsyncType("file");
@@ -28462,7 +28477,11 @@ const PlaygroundInit = (arg) => {
28462
28477
  switchDoc2(_d2.file);
28463
28478
  (await daopaasDB).put("files", (_a2 = _d2 == null ? void 0 : _d2.file) == null ? void 0 : _a2.value, (_b2 = _d2 == null ? void 0 : _d2.file) == null ? void 0 : _b2.path);
28464
28479
  if (!await getLocalReplayFile(_d2.file.path)) {
28465
- setLocalReplayFile((_c2 = _d2 == null ? void 0 : _d2.file) == null ? void 0 : _c2.path, (_d3 = _d2 == null ? void 0 : _d2.file) == null ? void 0 : _d3.value);
28480
+ setLocalReplayFile((_c2 = _d2 == null ? void 0 : _d2.file) == null ? void 0 : _c2.path, {
28481
+ value: _d2.file.value,
28482
+ revision: 0,
28483
+ path: _d2.file.path
28484
+ });
28466
28485
  }
28467
28486
  }
28468
28487
  });
@@ -28484,7 +28503,7 @@ const PlaygroundInit = (arg) => {
28484
28503
  io.on("saveFile", (d2) => {
28485
28504
  JSON.parse(d2);
28486
28505
  });
28487
- io.on("customAck", (d2) => {
28506
+ io.on("customAck", async (d2) => {
28488
28507
  const _d2 = JSON.parse(d2);
28489
28508
  setCRDTInfo2(_d2);
28490
28509
  setAsyncType("editor");
@@ -28507,14 +28526,20 @@ const PlaygroundInit = (arg) => {
28507
28526
  return;
28508
28527
  }
28509
28528
  });
28510
- io.on("serverAck", (d2) => {
28511
- var _a2;
28529
+ io.on("serverAck", async (d2) => {
28530
+ var _a2, _b2;
28512
28531
  const _d2 = JSON.parse(d2);
28513
28532
  setAsyncType("editor");
28533
+ const file = await getLocalReplayFile(_d2.file.path);
28534
+ setLocalReplayFile((_a2 = _d2 == null ? void 0 : _d2.file) == null ? void 0 : _a2.path, {
28535
+ value: file.value,
28536
+ revision: file.revision + 1,
28537
+ path: _d2.file.path
28538
+ });
28514
28539
  setReplaySource(__spreadProps(__spreadValues({}, _d2), {
28515
28540
  event: "editor",
28516
28541
  editor: __spreadProps(__spreadValues({}, _d2.editor), {
28517
- revision: (_a2 = _d2.editor) == null ? void 0 : _a2.revision
28542
+ revision: (_b2 = _d2.editor) == null ? void 0 : _b2.revision
28518
28543
  })
28519
28544
  }));
28520
28545
  setServerAck();
@@ -32704,42 +32729,65 @@ const {
32704
32729
  switchDoc,
32705
32730
  setCRDTInfo,
32706
32731
  dockerInfo,
32707
- doc
32732
+ doc,
32733
+ CRDTInfo
32708
32734
  } = oTStore.getState();
32709
32735
  const replay = async (passInData) => {
32736
+ var _a2, _b2, _c2;
32710
32737
  setAppStatus("replay");
32738
+ let operation;
32711
32739
  const replayList = await getLocalCRDTs();
32712
32740
  const filterReplayList = replayList.filter((replayItem) => replayItem.userInfo.uuid === passInData.userId);
32713
- let filterReplaySource = null;
32714
- filterReplayList.some((nowTimeData, index2, array3) => {
32715
- if (dayjs$1(passInData.timestamp).isSame(nowTimeData.timestamp) || dayjs$1(passInData.timestamp).isBefore(nowTimeData.timestamp)) {
32716
- filterReplaySource = nowTimeData;
32717
- return true;
32718
- }
32719
- });
32741
+ const currentFilter = filterReplayList.filter((f2) => dayjs$1(passInData.timestamp).isSame(f2.timestamp) || dayjs$1(passInData.timestamp).isBefore(f2.timestamp));
32742
+ const filterReplaySource = currentFilter[0];
32743
+ const replayFile = await getLocalReplayFile(filterReplaySource.file.path);
32744
+ const localFile = await getLocalFile(filterReplaySource.file.path);
32720
32745
  if (filterReplaySource.event === "editor") {
32721
- const tempFilter = filterReplayList.filter((x2) => x2.event === "editor");
32722
- let composeOperation = new TextOperation();
32723
- let i2 = 0;
32724
- while (filterReplaySource.editor.revision > tempFilter[i2].editor.revision) {
32725
- composeOperation = composeOperation.compose(TextOperation.fromJSON(tempFilter[i2].editor.operation));
32726
- filterReplaySource.editor.operation = composeOperation.toJSON();
32727
- i2++;
32746
+ const tempFilter = filterReplayList.filter((x2) => x2.event === "editor").filter((x2) => {
32747
+ var _a3;
32748
+ return ((_a3 = x2.file) == null ? void 0 : _a3.path) === replayFile.path;
32749
+ });
32750
+ const operationFilter = filterReplaySource.editor.revision > replayFile.revision ? tempFilter.filter((x2) => x2.editor.revision <= filterReplaySource.editor.revision).filter((x2) => x2.editor.revision > replayFile.revision) : tempFilter.filter((x2) => x2.editor.revision > filterReplaySource.editor.revision).filter((x2) => x2.editor.revision <= replayFile.revision);
32751
+ if (filterReplaySource.editor.revision > replayFile.revision) {
32752
+ operation = operationFilter.reduce((currentOp, nextOp, _index) => {
32753
+ const NextOP = TextOperation.fromJSON(nextOp.editor.operation);
32754
+ if (currentOp.targetLength === NextOP.baseLength) {
32755
+ return currentOp.compose(NextOP);
32756
+ } else {
32757
+ return NextOP.compose(currentOp);
32758
+ }
32759
+ }, new TextOperation().retain(replayFile.revision === 0 ? replayFile.value.length : localFile.value.length));
32760
+ } else {
32761
+ operation = operationFilter.length === 1 ? TextOperation.fromJSON(operationFilter[0].editor.operation).invert(localFile.value) : operationFilter.reduce((currentOp, nextOp, _index) => {
32762
+ const NextOP = TextOperation.fromJSON(nextOp.editor.operation);
32763
+ if (currentOp.editor) {
32764
+ return TextOperation.fromJSON(currentOp.editor.operation).compose(NextOP);
32765
+ } else {
32766
+ return currentOp.compose(NextOP);
32767
+ }
32768
+ }).invert(localFile.value);
32728
32769
  }
32770
+ filterReplaySource.editor.operation = operation.toJSON();
32729
32771
  }
32730
32772
  if (filterReplaySource.file) {
32731
32773
  if (!filterReplaySource.file)
32732
32774
  return;
32733
- const doc2 = await getLocalReplayFile(filterReplaySource.file.path);
32775
+ setLocalFile(filterReplaySource.file.path, __spreadProps(__spreadValues({}, localFile), {
32776
+ value: replayFile.revision === 0 ? operation == null ? void 0 : operation.apply(replayFile.value) : operation == null ? void 0 : operation.apply(localFile.value)
32777
+ }));
32734
32778
  switchDoc == null ? void 0 : switchDoc({
32735
- value: doc2,
32779
+ value: replayFile.value,
32736
32780
  path: filterReplaySource.file.path
32737
32781
  });
32738
32782
  }
32783
+ console.log(oTStore.getState().appStatus);
32784
+ setLocalReplayFile((_a2 = filterReplaySource == null ? void 0 : filterReplaySource.file) == null ? void 0 : _a2.path, __spreadProps(__spreadValues({}, replayFile), {
32785
+ revision: (_b2 = filterReplaySource == null ? void 0 : filterReplaySource.editor) == null ? void 0 : _b2.revision,
32786
+ path: (_c2 = filterReplaySource == null ? void 0 : filterReplaySource.file) == null ? void 0 : _c2.path
32787
+ }));
32739
32788
  setTimeout(() => {
32740
32789
  setCRDTInfo(__spreadValues({}, filterReplaySource));
32741
32790
  }, 0);
32742
- setAppStatus("code");
32743
32791
  };
32744
32792
  var index$6 = "";
32745
32793
  const ignoreReplayerStore = create$3((set2) => ({
@@ -46753,7 +46801,7 @@ const FileTree = ({
46753
46801
  const [remoteUserList, setRemoteUserList] = react.exports.useState({});
46754
46802
  const treeRef = react.exports.useRef(null);
46755
46803
  const {
46756
- CRDTInfo,
46804
+ CRDTInfo: CRDTInfo2,
46757
46805
  dockerInfo: dockerInfo2
46758
46806
  } = oTStore((state) => state);
46759
46807
  const {
@@ -46856,8 +46904,11 @@ const FileTree = ({
46856
46904
  const items = event.dataTransfer.items;
46857
46905
  if (items.length === 0)
46858
46906
  return;
46859
- for (let i2 = 0; i2 < items.length; i2++) {
46860
- const item = items[i2].webkitGetAsEntry();
46907
+ const itemsIterate = [];
46908
+ for (const i2 of items) {
46909
+ itemsIterate.push(i2.webkitGetAsEntry());
46910
+ }
46911
+ for (const item of itemsIterate) {
46861
46912
  if (item) {
46862
46913
  addedFolder.files = addedFolder.files.concat(await traverseFileTree(item));
46863
46914
  }
@@ -46906,14 +46957,14 @@ const FileTree = ({
46906
46957
  }
46907
46958
  }, [treeRef]);
46908
46959
  const onUploadFile = (payload) => {
46909
- io.emit("upload", payload);
46960
+ io == null ? void 0 : io.emit("upload", payload);
46910
46961
  };
46911
46962
  react.exports.useEffect(() => {
46912
46963
  var _a2, _b2;
46913
- const user = userListStore.getState().userList.find((item) => item.uuid === CRDTInfo.userInfo.uuid);
46914
- if (((_a2 = CRDTInfo == null ? void 0 : CRDTInfo.editor) == null ? void 0 : _a2.evtType) === "File" && user) {
46915
- const path = (_b2 = CRDTInfo == null ? void 0 : CRDTInfo.file) == null ? void 0 : _b2.path;
46916
- if (!IsMe(CRDTInfo.userInfo)) {
46964
+ const user = userListStore.getState().userList.find((item) => item.uuid === CRDTInfo2.userInfo.uuid);
46965
+ if (((_a2 = CRDTInfo2 == null ? void 0 : CRDTInfo2.editor) == null ? void 0 : _a2.evtType) === "File" && user) {
46966
+ const path = (_b2 = CRDTInfo2 == null ? void 0 : CRDTInfo2.file) == null ? void 0 : _b2.path;
46967
+ if (!IsMe(CRDTInfo2.userInfo)) {
46917
46968
  setRemoteUserList((oldUserListItem) => {
46918
46969
  const userListItem = __spreadValues({}, oldUserListItem);
46919
46970
  const remoteUserListObj = Object.entries(userListItem);
@@ -46963,7 +47014,7 @@ const FileTree = ({
46963
47014
  }
46964
47015
  }
46965
47016
  }
46966
- }, [CRDTInfo]);
47017
+ }, [CRDTInfo2]);
46967
47018
  return /* @__PURE__ */ jsx(FollowLayout, {
46968
47019
  name: "file",
46969
47020
  children: /* @__PURE__ */ jsx("div", {
@@ -187761,7 +187812,8 @@ const Editor = ({
187761
187812
  containerStyle,
187762
187813
  menuStyle,
187763
187814
  editorStyle,
187764
- serviceWorkerOrigin
187815
+ serviceWorkerOrigin,
187816
+ useLsp
187765
187817
  }) => {
187766
187818
  const divEl = react.exports.useRef(null);
187767
187819
  const file = oTStore((state) => state.doc);
@@ -187895,7 +187947,7 @@ const Editor = ({
187895
187947
  value,
187896
187948
  path,
187897
187949
  language: language2,
187898
- CRDTInfo,
187950
+ CRDTInfo: CRDTInfo2,
187899
187951
  doc: doc22
187900
187952
  }) => {
187901
187953
  var _a2;
@@ -187908,7 +187960,7 @@ const Editor = ({
187908
187960
  model: gotModel
187909
187961
  }]);
187910
187962
  }
187911
- client2.revision = ((_a2 = CRDTInfo.editor) == null ? void 0 : _a2.revision) ? CRDTInfo.editor.revision : 0;
187963
+ client2.revision = ((_a2 = CRDTInfo2.editor) == null ? void 0 : _a2.revision) ? CRDTInfo2.editor.revision : 0;
187912
187964
  editor.setModel(gotModel);
187913
187965
  if (file) {
187914
187966
  docServer.set(file.path, {
@@ -187922,12 +187974,17 @@ const Editor = ({
187922
187974
  });
187923
187975
  }
187924
187976
  };
187925
- const lspServerInject = (_lan, useLsp) => {
187977
+ const lspServerInject = (_lan, useLsp2 = true) => {
187926
187978
  languages.register({
187927
187979
  id: "ruby",
187928
187980
  extensions: [".rb"],
187929
187981
  aliases: ["ruby", "RUBY"]
187930
187982
  });
187983
+ languages.register({
187984
+ id: "go",
187985
+ extensions: [".go"],
187986
+ aliases: ["go", "GO"]
187987
+ });
187931
187988
  languages.register({
187932
187989
  id: "python",
187933
187990
  extensions: [".py"],
@@ -187943,7 +188000,7 @@ const Editor = ({
187943
188000
  extensions: [".ts"],
187944
188001
  aliases: ["TypeScript", "ts", "TS", "typescript"]
187945
188002
  });
187946
- if (!useLsp)
188003
+ if (!useLsp2)
187947
188004
  return;
187948
188005
  lib.MonacoServices.install(monaco);
187949
188006
  const {
@@ -187966,7 +188023,7 @@ const Editor = ({
187966
188023
  const languageClient = new lib.MonacoLanguageClient({
187967
188024
  name: "Language Client",
187968
188025
  clientOptions: {
187969
- documentSelector: ["java", "ruby", "python"],
188026
+ documentSelector: ["java", "ruby", "python", "go"],
187970
188027
  errorHandler: {
187971
188028
  error: () => lib.ErrorAction.Continue,
187972
188029
  closed: () => lib.CloseAction.DoNotRestart
@@ -187985,10 +188042,10 @@ const Editor = ({
187985
188042
  };
187986
188043
  const switchModel = (model) => {
187987
188044
  const {
187988
- CRDTInfo,
188045
+ CRDTInfo: CRDTInfo2,
187989
188046
  setCRDTInfo: setCRDTInfo2
187990
188047
  } = oTStore.getState();
187991
- setCRDTInfo2(__spreadProps(__spreadValues({}, CRDTInfo), {
188048
+ setCRDTInfo2(__spreadProps(__spreadValues({}, CRDTInfo2), {
187992
188049
  file: {
187993
188050
  action: "Get",
187994
188051
  value: model.getValue(),
@@ -188029,9 +188086,6 @@ const Editor = ({
188029
188086
  }
188030
188087
  });
188031
188088
  editorEventBinder();
188032
- const {
188033
- useLsp
188034
- } = oTStore.getState().globalData;
188035
188089
  lspServerInject(INIT_LANGUAGE, useLsp);
188036
188090
  const editorService = editor._codeEditorService;
188037
188091
  const openEditorBase = editorService.openCodeEditor.bind(editorService);
@@ -188098,20 +188152,20 @@ const Editor = ({
188098
188152
  react.exports.useEffect(() => {
188099
188153
  var _a2, _b2, _c2;
188100
188154
  const {
188101
- CRDTInfo,
188155
+ CRDTInfo: CRDTInfo2,
188102
188156
  doc: doc22,
188103
188157
  serverAck,
188104
188158
  appStatus
188105
188159
  } = oTStore.getState();
188106
188160
  useValue.getState();
188107
- if (!CRDTInfo.editor || CRDTInfo.editor.evtType !== "Editor")
188161
+ if (!CRDTInfo2.editor || CRDTInfo2.editor.evtType !== "Editor")
188108
188162
  return;
188109
188163
  if (oTStore.getState().appStatus === "replay" && ignoreReplayerStore.getState().ignoreReplayers.some((d2) => d2 === "editor")) {
188110
188164
  return;
188111
188165
  }
188112
- if (editor && ((doc22 == null ? void 0 : doc22.path) === ((_a2 = CRDTInfo == null ? void 0 : CRDTInfo.file) == null ? void 0 : _a2.path) || ((_b2 = CRDTInfo == null ? void 0 : CRDTInfo.file) == null ? void 0 : _b2.path) === "singleFile")) {
188113
- const server_operation = CRDTInfo.editor.operation;
188114
- const CLIENT_OPERATION = receiveOperation(CRDTInfo.editor.revision, TextOperation.fromJSON(server_operation), (_c2 = CRDTInfo == null ? void 0 : CRDTInfo.file) == null ? void 0 : _c2.path);
188166
+ if (editor && ((doc22 == null ? void 0 : doc22.path) === ((_a2 = CRDTInfo2 == null ? void 0 : CRDTInfo2.file) == null ? void 0 : _a2.path) || ((_b2 = CRDTInfo2 == null ? void 0 : CRDTInfo2.file) == null ? void 0 : _b2.path) === "singleFile")) {
188167
+ const server_operation = CRDTInfo2.editor.operation;
188168
+ const CLIENT_OPERATION = receiveOperation(CRDTInfo2.editor.revision, TextOperation.fromJSON(server_operation), (_c2 = CRDTInfo2 == null ? void 0 : CRDTInfo2.file) == null ? void 0 : _c2.path);
188115
188169
  client2.applyServer(CLIENT_OPERATION.operation);
188116
188170
  const {
188117
188171
  ops
@@ -188151,14 +188205,14 @@ const Editor = ({
188151
188205
  react.exports.useEffect(() => {
188152
188206
  var _a2;
188153
188207
  const {
188154
- CRDTInfo
188208
+ CRDTInfo: CRDTInfo2
188155
188209
  } = oTStore.getState();
188156
188210
  const {
188157
188211
  shadowUser
188158
188212
  } = shadowUserStore.getState();
188159
- if (((_a2 = CRDTInfo == null ? void 0 : CRDTInfo.extend) == null ? void 0 : _a2.type) === "editor-scroll" && editor && shadowUser.uuid) {
188160
- editor.setScrollTop(editor.getScrollHeight() * Number(CRDTInfo.extend.topPercent));
188161
- editor.setScrollLeft(-(editor.getScrollWidth() * Number(CRDTInfo.extend.leftPercent)));
188213
+ if (((_a2 = CRDTInfo2 == null ? void 0 : CRDTInfo2.extend) == null ? void 0 : _a2.type) === "editor-scroll" && editor && shadowUser.uuid) {
188214
+ editor.setScrollTop(editor.getScrollHeight() * Number(CRDTInfo2.extend.topPercent));
188215
+ editor.setScrollLeft(-(editor.getScrollWidth() * Number(CRDTInfo2.extend.leftPercent)));
188162
188216
  }
188163
188217
  }, [OTSTATE.CRDTInfo.extend]);
188164
188218
  react.exports.useEffect(() => {
@@ -188166,7 +188220,7 @@ const Editor = ({
188166
188220
  if (!editor)
188167
188221
  return;
188168
188222
  const {
188169
- CRDTInfo,
188223
+ CRDTInfo: CRDTInfo2,
188170
188224
  doc: doc22,
188171
188225
  serverAck,
188172
188226
  appStatus
@@ -188176,8 +188230,8 @@ const Editor = ({
188176
188230
  setUsersDelta
188177
188231
  } = useValue.getState();
188178
188232
  editor.getModel();
188179
- if ((doc22 == null ? void 0 : doc22.path) === ((_a2 = CRDTInfo == null ? void 0 : CRDTInfo.file) == null ? void 0 : _a2.path)) {
188180
- if (CRDTInfo.selection) {
188233
+ if ((doc22 == null ? void 0 : doc22.path) === ((_a2 = CRDTInfo2 == null ? void 0 : CRDTInfo2.file) == null ? void 0 : _a2.path)) {
188234
+ if (CRDTInfo2.selection) {
188181
188235
  usersDelta.forEach((u2) => {
188182
188236
  let timer;
188183
188237
  const _label = document.querySelector(`.${u2.role}-label`);
@@ -188192,8 +188246,8 @@ const Editor = ({
188192
188246
  getPosition: function() {
188193
188247
  return {
188194
188248
  position: {
188195
- lineNumber: CRDTInfo.selection[0][7],
188196
- column: CRDTInfo.selection[0][6]
188249
+ lineNumber: CRDTInfo2.selection[0][7],
188250
+ column: CRDTInfo2.selection[0][6]
188197
188251
  },
188198
188252
  preference: [editor$1.ContentWidgetPositionPreference.ABOVE, editor$1.ContentWidgetPositionPreference.BELOW]
188199
188253
  };
@@ -188201,9 +188255,9 @@ const Editor = ({
188201
188255
  }));
188202
188256
  });
188203
188257
  setUsersDelta(usersDelta.map((deltaInfo) => {
188204
- if (deltaInfo.uuid === CRDTInfo.userInfo.uuid) {
188258
+ if (deltaInfo.uuid === CRDTInfo2.userInfo.uuid) {
188205
188259
  return __spreadProps(__spreadValues({}, deltaInfo), {
188206
- delta: editor.deltaDecorations(deltaInfo.delta ? deltaInfo.delta : "", (CRDTInfo == null ? void 0 : CRDTInfo.selection).map((s2) => ({
188260
+ delta: editor.deltaDecorations(deltaInfo.delta ? deltaInfo.delta : "", (CRDTInfo2 == null ? void 0 : CRDTInfo2.selection).map((s2) => ({
188207
188261
  range: new Range$4(s2[0], s2[1], s2[2], s2[3]),
188208
188262
  options: {
188209
188263
  isWholeLine: false,
@@ -188217,7 +188271,7 @@ const Editor = ({
188217
188271
  }
188218
188272
  }));
188219
188273
  }
188220
- if (((_b2 = CRDTInfo == null ? void 0 : CRDTInfo.editor) == null ? void 0 : _b2.evtType) === "Editor")
188274
+ if (((_b2 = CRDTInfo2 == null ? void 0 : CRDTInfo2.editor) == null ? void 0 : _b2.evtType) === "Editor")
188221
188275
  ;
188222
188276
  }
188223
188277
  }, [OTSTATE.CRDTInfo.selection]);
@@ -188248,28 +188302,30 @@ const Editor = ({
188248
188302
  let egt = /\.(\w+$)/gim.exec(file.path);
188249
188303
  egt = egt ? egt : ["", file.path.substring(1)];
188250
188304
  const {
188251
- CRDTInfo,
188252
- doc: doc22
188305
+ CRDTInfo: CRDTInfo2,
188306
+ doc: doc22,
188307
+ appStatus,
188308
+ setAppStatus: setAppStatus2
188253
188309
  } = oTStore.getState();
188254
188310
  const {
188255
188311
  shadowUser
188256
188312
  } = shadowUserStore.getState();
188257
- if (file.path && egt && oTStore.getState().appStatus === "replay" && !ignoreReplayerStore.getState().ignoreReplayers.some((d2) => d2 === "editor")) {
188313
+ if (file.path && egt && appStatus === "replay" && !ignoreReplayerStore.getState().ignoreReplayers.some((d2) => d2 === "editor")) {
188258
188314
  updateLspOps({
188259
188315
  value: file.value,
188260
188316
  path: file.path,
188261
188317
  language: FExtension[egt[1]],
188262
- CRDTInfo,
188318
+ CRDTInfo: CRDTInfo2,
188263
188319
  doc: doc22
188264
188320
  });
188265
188321
  return;
188266
188322
  }
188267
- if (oTStore.getState().appStatus !== "replay" && (shadowUser.uuid || file.path && egt && IsMe(CRDTInfo.userInfo))) {
188323
+ if (appStatus !== "replay" && (shadowUser.uuid || file.path && egt && IsMe(CRDTInfo2.userInfo))) {
188268
188324
  updateLspOps({
188269
188325
  value: file.value,
188270
188326
  path: file.path,
188271
188327
  language: FExtension[egt[1]],
188272
- CRDTInfo,
188328
+ CRDTInfo: CRDTInfo2,
188273
188329
  doc: doc22
188274
188330
  });
188275
188331
  }
@@ -195409,7 +195465,7 @@ const XTerm = (_c2) => {
195409
195465
  const stateStyle = __spreadValues({
195410
195466
  height: "100%",
195411
195467
  width: "100%",
195412
- padding: "5px 20px",
195468
+ padding: "5px 5px",
195413
195469
  backgroundColor: "#1e1e1e"
195414
195470
  }, props2);
195415
195471
  const xtermFitAddon = new xtermAddonFit.exports.FitAddon();
@@ -195441,6 +195497,15 @@ const XTerm = (_c2) => {
195441
195497
  }
195442
195498
  onKey == null ? void 0 : onKey(character2);
195443
195499
  });
195500
+ term.attachCustomKeyEventHandler((e2) => {
195501
+ if (e2.key === "v" && e2.ctrlKey) {
195502
+ onKey == null ? void 0 : onKey(e2.target.value);
195503
+ return false;
195504
+ }
195505
+ if (e2.key === "r" && e2.ctrlKey) {
195506
+ return false;
195507
+ }
195508
+ });
195444
195509
  };
195445
195510
  const fitTerminal = () => {
195446
195511
  try {
@@ -195489,9 +195554,7 @@ const Console = (_e2) => {
195489
195554
  }
195490
195555
  }, options);
195491
195556
  const [terminal, setTerminal] = react.exports.useState(null);
195492
- const {
195493
- CRDTInfo
195494
- } = oTStore((state) => state);
195557
+ const OTSTATE = oTStore((state) => state);
195495
195558
  const {
195496
195559
  dockerStatus
195497
195560
  } = oTStore((state) => state);
@@ -195522,11 +195585,11 @@ const Console = (_e2) => {
195522
195585
  var _a2;
195523
195586
  if (!terminal)
195524
195587
  return;
195525
- const crdt = CRDTInfo.console;
195588
+ const crdt = OTSTATE.CRDTInfo.console;
195526
195589
  if (crdt) {
195527
195590
  writeText(terminal, ((_a2 = crdt == null ? void 0 : crdt.doc) == null ? void 0 : _a2.value) || "");
195528
195591
  }
195529
- }, [CRDTInfo.console]);
195592
+ }, [OTSTATE.CRDTInfo]);
195530
195593
  react.exports.useEffect(() => {
195531
195594
  if (!terminal)
195532
195595
  return;
@@ -195709,7 +195772,7 @@ const TerminalComponent = (_i) => {
195709
195772
  userLabel.classList.add("xterm-helper-user-label");
195710
195773
  const [terminal, setTerminal] = react.exports.useState(null);
195711
195774
  const {
195712
- CRDTInfo
195775
+ CRDTInfo: CRDTInfo2
195713
195776
  } = oTStore((state) => state);
195714
195777
  const initTerminalText = (terminal2, text2) => {
195715
195778
  terminal2.write("\r\n");
@@ -195746,25 +195809,25 @@ const TerminalComponent = (_i) => {
195746
195809
  var _a2, _b2, _c2, _d2;
195747
195810
  if (!terminal)
195748
195811
  return;
195749
- if (CRDTInfo.terminal) {
195812
+ if (CRDTInfo2.terminal) {
195750
195813
  initTerminalText(terminal, ((_d2 = (_c2 = (_b2 = (_a2 = oTStore.getState()) == null ? void 0 : _a2.CRDTInfo) == null ? void 0 : _b2.terminal) == null ? void 0 : _c2.doc) == null ? void 0 : _d2.value) || "");
195751
195814
  }
195752
195815
  }, [terminal]);
195753
195816
  react.exports.useEffect(() => {
195754
195817
  var _a2, _b2, _c2;
195755
- const crdt = CRDTInfo.terminal;
195818
+ const crdt = CRDTInfo2.terminal;
195756
195819
  if (terminal && crdt) {
195757
195820
  if (((_a2 = crdt == null ? void 0 : crdt.doc) == null ? void 0 : _a2.action) === "Get") {
195758
195821
  initTerminalText(terminal, crdt.doc.value);
195759
195822
  return;
195760
195823
  }
195761
195824
  writeText(terminal, ((_b2 = crdt == null ? void 0 : crdt.doc) == null ? void 0 : _b2.value) || "");
195762
- if (!CRDTInfo.userInfo.uuid)
195825
+ if (!CRDTInfo2.userInfo.uuid)
195763
195826
  return;
195764
195827
  const postUser = userListStore.getState().userList.find(({
195765
195828
  uuid: uuid2
195766
- }) => uuid2 === CRDTInfo.userInfo.uuid);
195767
- if (postUser && !IsMe(CRDTInfo.userInfo)) {
195829
+ }) => uuid2 === CRDTInfo2.userInfo.uuid);
195830
+ if (postUser && !IsMe(CRDTInfo2.userInfo)) {
195768
195831
  const helperContainer = (_c2 = terminal == null ? void 0 : terminal._core) == null ? void 0 : _c2._helperContainer;
195769
195832
  const childNode = helperContainer == null ? void 0 : helperContainer.firstChild;
195770
195833
  userLabel.innerText = postUser.username;
@@ -195793,7 +195856,7 @@ const TerminalComponent = (_i) => {
195793
195856
  };
195794
195857
  }
195795
195858
  }
195796
- }, [CRDTInfo.terminal]);
195859
+ }, [CRDTInfo2.terminal]);
195797
195860
  return /* @__PURE__ */ jsx(FollowLayout, {
195798
195861
  name: "terminal",
195799
195862
  children: /* @__PURE__ */ jsx("div", {
@@ -196377,7 +196440,7 @@ const MultiPlayerCursorLayout = newStyled.svg`
196377
196440
  `;
196378
196441
  const MultiPlayerCursor = () => {
196379
196442
  const [users, setUsers] = react.exports.useState(null);
196380
- const CRDTInfo = oTStore((state) => state.CRDTInfo);
196443
+ const CRDTInfo2 = oTStore((state) => state.CRDTInfo);
196381
196444
  const throttled = lodash$2.exports.throttle((a) => {
196382
196445
  var _a2, _b2;
196383
196446
  (_b2 = (_a2 = useOT.getState()) == null ? void 0 : _a2.socket) == null ? void 0 : _b2.emit("extraSync", JSON.stringify(a));
@@ -196387,12 +196450,12 @@ const MultiPlayerCursor = () => {
196387
196450
  userList
196388
196451
  } = userListStore.getState();
196389
196452
  setUsers(userList.map((_user) => {
196390
- if (_user.uuid === CRDTInfo.userInfo.uuid) {
196391
- _user.cursor = CRDTInfo.extend;
196453
+ if (_user.uuid === CRDTInfo2.userInfo.uuid) {
196454
+ _user.cursor = CRDTInfo2.extend;
196392
196455
  }
196393
196456
  return _user;
196394
196457
  }));
196395
- }, [CRDTInfo]);
196458
+ }, [CRDTInfo2]);
196396
196459
  react.exports.useEffect(() => {
196397
196460
  const {
196398
196461
  userInfo
@@ -196584,7 +196647,9 @@ const Index = (props2) => {
196584
196647
  fallback: /* @__PURE__ */ jsx(Skeleton, {
196585
196648
  count: 10
196586
196649
  }),
196587
- children: /* @__PURE__ */ jsx(Editor, {})
196650
+ children: /* @__PURE__ */ jsx(Editor, {
196651
+ useLsp: true
196652
+ })
196588
196653
  }) : null
196589
196654
  }), /* @__PURE__ */ jsxs(RunnerLayout, {
196590
196655
  className: `rounded-sm mr-2.5`,