@lv-x-software-house/x_view 1.2.5-dev.40 → 1.2.5-dev.42

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.
Files changed (3) hide show
  1. package/dist/index.js +714 -228
  2. package/dist/index.mjs +714 -228
  3. package/package.json +1 -1
package/dist/index.js CHANGED
@@ -1187,11 +1187,7 @@ var import_LineMaterial = require("three/addons/lines/LineMaterial.js");
1187
1187
  var import_LineGeometry = require("three/addons/lines/LineGeometry.js");
1188
1188
  var DEFAULT_LAYER = 0;
1189
1189
  var GHOST_BLOOM_LAYER = 1;
1190
- var ANCESTRY_COLORS = [
1191
- 30719,
1192
- 2278750,
1193
- 15680580
1194
- ];
1190
+ var ANCESTRY_COLORS = [30719, 2278750, 15680580];
1195
1191
  var NODE_SCALE_FACTORS = {
1196
1192
  small: 0.4,
1197
1193
  medium: 1,
@@ -1291,7 +1287,12 @@ var createNodeMesh = (nodeData, position, glowTexture) => {
1291
1287
  bgMesh.position.z = -0.01;
1292
1288
  bgMesh.layers.set(DEFAULT_LAYER);
1293
1289
  mesh.add(bgMesh);
1294
- const aura = addGlowAura(mesh, colorHex, glowTexture, x_view_config.GLOW.auraScale);
1290
+ const aura = addGlowAura(
1291
+ mesh,
1292
+ colorHex,
1293
+ glowTexture,
1294
+ x_view_config.GLOW.auraScale
1295
+ );
1295
1296
  if (aura && aura.material) {
1296
1297
  aura.material.opacity = Math.min(0.8, userIntensity * 0.15);
1297
1298
  }
@@ -1306,7 +1307,12 @@ var createNodeMesh = (nodeData, position, glowTexture) => {
1306
1307
  metalness: 0
1307
1308
  });
1308
1309
  mesh = new THREE.Mesh(geometry, material);
1309
- const aura = addGlowAura(mesh, colorHex, glowTexture, x_view_config.GLOW.auraScale);
1310
+ const aura = addGlowAura(
1311
+ mesh,
1312
+ colorHex,
1313
+ glowTexture,
1314
+ x_view_config.GLOW.auraScale
1315
+ );
1310
1316
  if (aura && aura.material) {
1311
1317
  aura.material.opacity = Math.min(0.8, userIntensity * 0.15);
1312
1318
  }
@@ -1350,7 +1356,8 @@ var updateExistingNodeVisuals = (state, updatedNode) => {
1350
1356
  state.graphGroup.remove(existingMesh);
1351
1357
  if (existingMesh.geometry) existingMesh.geometry.dispose();
1352
1358
  if (existingMesh.material) {
1353
- if (Array.isArray(existingMesh.material)) existingMesh.material.forEach((m) => m.dispose());
1359
+ if (Array.isArray(existingMesh.material))
1360
+ existingMesh.material.forEach((m) => m.dispose());
1354
1361
  else existingMesh.material.dispose();
1355
1362
  }
1356
1363
  existingMesh.traverse((child) => {
@@ -1382,18 +1389,24 @@ var updateExistingNodeVisuals = (state, updatedNode) => {
1382
1389
  else state.clickableNodes.push(newMesh);
1383
1390
  if (state.allLinks) {
1384
1391
  state.allLinks.forEach((line) => {
1385
- if (String(line.userData.source) === nodeId) line.userData.sourceNode = newMesh;
1386
- if (String(line.userData.target) === nodeId) line.userData.targetNode = newMesh;
1392
+ if (String(line.userData.source) === nodeId)
1393
+ line.userData.sourceNode = newMesh;
1394
+ if (String(line.userData.target) === nodeId)
1395
+ line.userData.targetNode = newMesh;
1387
1396
  });
1388
1397
  }
1389
1398
  if (state.ancestryLinks) {
1390
1399
  state.ancestryLinks.forEach((line) => {
1391
- if (String(line.userData.sourceNode.userData.id) === nodeId) line.userData.sourceNode = newMesh;
1392
- if (String(line.userData.targetNode.userData.id) === nodeId) line.userData.targetNode = newMesh;
1400
+ if (String(line.userData.sourceNode.userData.id) === nodeId)
1401
+ line.userData.sourceNode = newMesh;
1402
+ if (String(line.userData.targetNode.userData.id) === nodeId)
1403
+ line.userData.targetNode = newMesh;
1393
1404
  });
1394
1405
  }
1395
1406
  } else {
1396
- const { color, emissive } = computeNodeMaterialProps(updatedNode.color || "#ffffff");
1407
+ const { color, emissive } = computeNodeMaterialProps(
1408
+ updatedNode.color || "#ffffff"
1409
+ );
1397
1410
  if (newIsImage) {
1398
1411
  const borderMesh = existingMesh.getObjectByName("borderRing");
1399
1412
  if (borderMesh && borderMesh.material) {
@@ -1412,7 +1425,10 @@ var updateExistingNodeVisuals = (state, updatedNode) => {
1412
1425
  }
1413
1426
  const aura = existingMesh.getObjectByName("aura");
1414
1427
  if (aura && aura.material) {
1415
- const auraColor = new THREE.Color(updatedNode.color || "#ffffff").lerp(new THREE.Color("#ffffff"), 0.25);
1428
+ const auraColor = new THREE.Color(updatedNode.color || "#ffffff").lerp(
1429
+ new THREE.Color("#ffffff"),
1430
+ 0.25
1431
+ );
1416
1432
  aura.material.color.copy(auraColor);
1417
1433
  aura.material.opacity = Math.min(0.8, newIntensity * 0.15);
1418
1434
  }
@@ -1500,7 +1516,10 @@ var createLinkLine = (linkData, sourceNodeMesh, targetNodeMesh, resolution, isCu
1500
1516
  const points = curve.getPoints(x_view_config.CURVE_SEGMENTS);
1501
1517
  points.forEach((p) => positions.push(p.x, p.y, p.z));
1502
1518
  } else {
1503
- positions.push(...sourceNodeMesh.position.toArray(), ...targetNodeMesh.position.toArray());
1519
+ positions.push(
1520
+ ...sourceNodeMesh.position.toArray(),
1521
+ ...targetNodeMesh.position.toArray()
1522
+ );
1504
1523
  }
1505
1524
  lineGeometry.setPositions(positions);
1506
1525
  const lineMaterial = new import_LineMaterial.LineMaterial({
@@ -1619,12 +1638,22 @@ var updateSceneHighlights = (state) => {
1619
1638
  const userDefinedIntensity = node.userData.intensity !== void 0 ? Number(node.userData.intensity) : 0;
1620
1639
  const finalIntensity = userDefinedIntensity + MIN_VISIBILITY_INTENSITY + addedIntensity;
1621
1640
  const targetScale = scaleMultiplier * getNodeBaseScale(node);
1622
- node.scale.lerp(new THREE.Vector3(targetScale, targetScale, targetScale), 0.1);
1641
+ node.scale.lerp(
1642
+ new THREE.Vector3(targetScale, targetScale, targetScale),
1643
+ 0.1
1644
+ );
1623
1645
  const aura = node.getObjectByName("aura");
1624
1646
  if (aura) {
1625
1647
  aura.material.color.lerp(targetColor, 0.1);
1626
- const targetOpacity = Math.min(0.8, finalIntensity * 0.15 + (addedIntensity > 0 ? 0.3 : 0));
1627
- aura.material.opacity = THREE.MathUtils.lerp(aura.material.opacity, targetOpacity, 0.1);
1648
+ const targetOpacity = Math.min(
1649
+ 0.8,
1650
+ finalIntensity * 0.15 + (addedIntensity > 0 ? 0.3 : 0)
1651
+ );
1652
+ aura.material.opacity = THREE.MathUtils.lerp(
1653
+ aura.material.opacity,
1654
+ targetOpacity,
1655
+ 0.1
1656
+ );
1628
1657
  }
1629
1658
  if (isImageNode) {
1630
1659
  const borderMesh = node.getObjectByName("borderRing");
@@ -1701,7 +1730,10 @@ var updateSceneHighlights = (state) => {
1701
1730
  );
1702
1731
  } else if (hoveredLink) {
1703
1732
  connectedLinks = [hoveredLink];
1704
- connectedNodes = [hoveredLink.userData.sourceNode, hoveredLink.userData.targetNode];
1733
+ connectedNodes = [
1734
+ hoveredLink.userData.sourceNode,
1735
+ hoveredLink.userData.targetNode
1736
+ ];
1705
1737
  }
1706
1738
  clickableNodes.forEach((node) => {
1707
1739
  const nodeIdStr = String(node.userData.id);
@@ -1758,7 +1790,14 @@ var updateSceneHighlights = (state) => {
1758
1790
  }
1759
1791
  };
1760
1792
  var addNewNodeToScene = (state, newNodeData, newLinkData, position) => {
1761
- const { graphGroup, nodeObjects, clickableNodes, allLinks, glowTexture, renderer } = state;
1793
+ const {
1794
+ graphGroup,
1795
+ nodeObjects,
1796
+ clickableNodes,
1797
+ allLinks,
1798
+ glowTexture,
1799
+ renderer
1800
+ } = state;
1762
1801
  const sourceNodeMesh = nodeObjects[String(newLinkData.source)];
1763
1802
  if (!sourceNodeMesh || !graphGroup) return;
1764
1803
  const mesh = createNodeMesh(newNodeData, position, glowTexture);
@@ -1772,7 +1811,12 @@ var addNewNodeToScene = (state, newNodeData, newLinkData, position) => {
1772
1811
  renderer.domElement.clientWidth,
1773
1812
  renderer.domElement.clientHeight
1774
1813
  );
1775
- const lines = createMultipleLinkLines([newLinkData], sourceNodeMesh, mesh, resolution);
1814
+ const lines = createMultipleLinkLines(
1815
+ [newLinkData],
1816
+ sourceNodeMesh,
1817
+ mesh,
1818
+ resolution
1819
+ );
1776
1820
  lines.forEach((line) => {
1777
1821
  graphGroup.add(line);
1778
1822
  allLinks.push(line);
@@ -1791,13 +1835,20 @@ var addNewLinkToScene = (state, newLinkData) => {
1791
1835
  (l) => String(l.userData.source) === String(newLinkData.source) && String(l.userData.target) === String(newLinkData.target) || String(l.userData.source) === String(newLinkData.target) && String(l.userData.target) === String(newLinkData.source)
1792
1836
  ).map((l) => l.userData);
1793
1837
  existingLinksData.forEach((linkData) => {
1794
- const linkToRemove = allLinks.find((l) => String(l.userData.id) === String(linkData.id));
1838
+ const linkToRemove = allLinks.find(
1839
+ (l) => String(l.userData.id) === String(linkData.id)
1840
+ );
1795
1841
  if (linkToRemove) {
1796
1842
  removeLinkFromScene(state, linkToRemove);
1797
1843
  }
1798
1844
  });
1799
1845
  const allLinksToRender = [...existingLinksData, newLinkData];
1800
- const newRenderedLines = createMultipleLinkLines(allLinksToRender, sourceNodeMesh, targetNodeMesh, resolution);
1846
+ const newRenderedLines = createMultipleLinkLines(
1847
+ allLinksToRender,
1848
+ sourceNodeMesh,
1849
+ targetNodeMesh,
1850
+ resolution
1851
+ );
1801
1852
  newRenderedLines.forEach((line) => {
1802
1853
  graphGroup.add(line);
1803
1854
  allLinks.push(line);
@@ -1811,12 +1862,19 @@ var removeLinkFromScene = (state, linkObject) => {
1811
1862
  if (graphGroup) graphGroup.remove(linkObject);
1812
1863
  if (linkObject.geometry) linkObject.geometry.dispose();
1813
1864
  if (linkObject.material) {
1814
- if (Array.isArray(linkObject.material)) linkObject.material.forEach((m) => m.dispose());
1865
+ if (Array.isArray(linkObject.material))
1866
+ linkObject.material.forEach((m) => m.dispose());
1815
1867
  else linkObject.material.dispose();
1816
1868
  }
1817
1869
  };
1818
1870
  var removeNodeFromScene = (state, nodeId) => {
1819
- const { graphGroup, nodeObjects, clickableNodes, allLinks, timelineIntervalsGroup } = state;
1871
+ const {
1872
+ graphGroup,
1873
+ nodeObjects,
1874
+ clickableNodes,
1875
+ allLinks,
1876
+ timelineIntervalsGroup
1877
+ } = state;
1820
1878
  const nodeToRemove = nodeObjects[String(nodeId)];
1821
1879
  if (!nodeToRemove) return;
1822
1880
  const strNodeId = String(nodeId);
@@ -1843,7 +1901,8 @@ var removeNodeFromScene = (state, nodeId) => {
1843
1901
  if (timelineEndLabel) {
1844
1902
  timelineIntervalsGroup.remove(timelineEndLabel);
1845
1903
  if (timelineEndLabel.material) {
1846
- if (timelineEndLabel.material.map) timelineEndLabel.material.map.dispose();
1904
+ if (timelineEndLabel.material.map)
1905
+ timelineEndLabel.material.map.dispose();
1847
1906
  timelineEndLabel.material.dispose();
1848
1907
  }
1849
1908
  }
@@ -1883,13 +1942,17 @@ var getParentFileInfoForNode = (allParentData, sceneData, nodeId, sceneConfigId
1883
1942
  if (allParentData.hasOwnProperty(parentFileId)) {
1884
1943
  const parentFile = allParentData[parentFileId];
1885
1944
  if (parentFile.nodes && parentFile.nodes.some((n) => String(n.id) === String(nodeId))) {
1886
- const parentDbInfo = parentDbsArray.find((db) => String(db.db_id) === String(parentFileId));
1945
+ const parentDbInfo = parentDbsArray.find(
1946
+ (db) => String(db.db_id) === String(parentFileId)
1947
+ );
1887
1948
  if (parentDbInfo) {
1888
1949
  return { parentFileId, ownerId: parentDbInfo.owner_id };
1889
1950
  } else if (sceneConfigId && String(parentFileId) === String(sceneConfigId)) {
1890
1951
  return { parentFileId, ownerId: sceneOwnerId };
1891
1952
  } else {
1892
- console.warn(`Owner ID n\xE3o encontrado em sceneData.parent_dbs para o parentFileId: ${parentFileId}`);
1953
+ console.warn(
1954
+ `Owner ID n\xE3o encontrado em sceneData.parent_dbs para o parentFileId: ${parentFileId}`
1955
+ );
1893
1956
  return { parentFileId, ownerId: null };
1894
1957
  }
1895
1958
  }
@@ -1934,7 +1997,12 @@ var userActionHandlers = {
1934
1997
  opacity: 0.75
1935
1998
  });
1936
1999
  const ghostNode = new THREE.Mesh(ghostGeometry, ghostMaterial);
1937
- const ghostAura = addGlowAura(ghostNode, sourceColor, glowTexture, x_view_config.GLOW.auraScale);
2000
+ const ghostAura = addGlowAura(
2001
+ ghostNode,
2002
+ sourceColor,
2003
+ glowTexture,
2004
+ x_view_config.GLOW.auraScale
2005
+ );
1938
2006
  const ghostLabel = createTextSprite("New Node", 48);
1939
2007
  ghostLabel.name = "label";
1940
2008
  ghostNode.userData.labelObject = ghostLabel;
@@ -1957,15 +2025,25 @@ var userActionHandlers = {
1957
2025
  dashSize: 1,
1958
2026
  gapSize: 0.5,
1959
2027
  depthWrite: false,
1960
- resolution: new THREE.Vector2(renderer.domElement.clientWidth, renderer.domElement.clientHeight)
2028
+ resolution: new THREE.Vector2(
2029
+ renderer.domElement.clientWidth,
2030
+ renderer.domElement.clientHeight
2031
+ )
1961
2032
  });
1962
2033
  const ghostLine = new import_Line2.Line2(lineGeometry, lineMaterial);
1963
2034
  ghostLine.layers.set(GHOST_BLOOM_LAYER);
1964
2035
  stateRef.current.graphGroup.add(ghostLine);
1965
- stateRef.current.ghostElements = { node: ghostNode, line: ghostLine, aura: ghostAura };
2036
+ stateRef.current.ghostElements = {
2037
+ node: ghostNode,
2038
+ line: ghostLine,
2039
+ aura: ghostAura
2040
+ };
1966
2041
  setters.setCreationMode({ isActive: true, sourceNodeData });
1967
2042
  setters.setFormPosition({ left: 16, top: 16, opacity: 1 });
1968
- tweenToTarget(sourceNodeMesh.position.clone().lerp(ghostPosition, 0.5), 1.5);
2043
+ tweenToTarget(
2044
+ sourceNodeMesh.position.clone().lerp(ghostPosition, 0.5),
2045
+ 1.5
2046
+ );
1969
2047
  },
1970
2048
  handleCancelCreation: (context) => {
1971
2049
  const { stateRef, setters } = context;
@@ -1998,35 +2076,61 @@ var userActionHandlers = {
1998
2076
  setters.setFormPosition((p) => ({ ...p, opacity: 0 }));
1999
2077
  },
2000
2078
  handleSaveNode: async (context, newNodeData) => {
2001
- const { graphDataRef, sceneDataRef, stateRef, creationMode, setters, actions } = context;
2079
+ const {
2080
+ graphDataRef,
2081
+ sceneDataRef,
2082
+ stateRef,
2083
+ creationMode,
2084
+ setters,
2085
+ actions
2086
+ } = context;
2002
2087
  if (!graphDataRef.current || !sceneDataRef.current) return;
2003
2088
  const { sourceNodeData } = creationMode;
2004
2089
  const { targetDatasetId, ...nodeDataToSave } = newNodeData;
2005
2090
  const newNode = { id: import_short_uuid.default.generate(), ...nodeDataToSave };
2006
- const newLink = { id: `link_${import_short_uuid.default.generate()}`, source: sourceNodeData.id, target: newNode.id };
2007
- const sourceParentInfo = stateRef.current.nodeIdToParentFileMap.get(String(sourceNodeData.id));
2091
+ const newLink = {
2092
+ id: `link_${import_short_uuid.default.generate()}`,
2093
+ source: sourceNodeData.id,
2094
+ target: newNode.id
2095
+ };
2096
+ const sourceParentInfo = stateRef.current.nodeIdToParentFileMap.get(
2097
+ String(sourceNodeData.id)
2098
+ );
2008
2099
  const finalTargetDatasetId = targetDatasetId || sourceParentInfo.parentFileId;
2009
- const targetParentInfo = sceneDataRef.current.parent_dbs.find((db) => String(db.db_id) === String(finalTargetDatasetId));
2100
+ const targetParentInfo = sceneDataRef.current.parent_dbs.find(
2101
+ (db) => String(db.db_id) === String(finalTargetDatasetId)
2102
+ );
2010
2103
  if (!sourceParentInfo || !targetParentInfo) {
2011
2104
  alert("Erro ao identificar os datasets de origem ou destino.");
2012
2105
  return;
2013
2106
  }
2014
2107
  const isCrossDataset = String(sourceParentInfo.parentFileId) !== String(finalTargetDatasetId);
2015
- const sourceDataToUpdate = JSON.parse(JSON.stringify(graphDataRef.current[sourceParentInfo.parentFileId]));
2108
+ const sourceDataToUpdate = JSON.parse(
2109
+ JSON.stringify(graphDataRef.current[sourceParentInfo.parentFileId])
2110
+ );
2016
2111
  let targetDataToUpdate = isCrossDataset ? JSON.parse(JSON.stringify(graphDataRef.current[finalTargetDatasetId])) : sourceDataToUpdate;
2017
2112
  targetDataToUpdate.nodes.push(newNode);
2018
2113
  sourceDataToUpdate.links.push(newLink);
2019
2114
  const savePromises = [];
2020
2115
  if (isCrossDataset) {
2021
2116
  savePromises.push(
2022
- actions.save_view_data(`x_view_dbs/${sourceParentInfo.ownerId}/${sourceParentInfo.parentFileId}`, sourceDataToUpdate)
2117
+ actions.save_view_data(
2118
+ `x_view_dbs/${sourceParentInfo.ownerId}/${sourceParentInfo.parentFileId}`,
2119
+ sourceDataToUpdate
2120
+ )
2023
2121
  );
2024
2122
  savePromises.push(
2025
- actions.save_view_data(`x_view_dbs/${targetParentInfo.owner_id}/${finalTargetDatasetId}`, targetDataToUpdate)
2123
+ actions.save_view_data(
2124
+ `x_view_dbs/${targetParentInfo.owner_id}/${finalTargetDatasetId}`,
2125
+ targetDataToUpdate
2126
+ )
2026
2127
  );
2027
2128
  } else {
2028
2129
  savePromises.push(
2029
- actions.save_view_data(`x_view_dbs/${sourceParentInfo.ownerId}/${sourceParentInfo.parentFileId}`, sourceDataToUpdate)
2130
+ actions.save_view_data(
2131
+ `x_view_dbs/${sourceParentInfo.ownerId}/${sourceParentInfo.parentFileId}`,
2132
+ sourceDataToUpdate
2133
+ )
2030
2134
  );
2031
2135
  }
2032
2136
  try {
@@ -2057,7 +2161,8 @@ var userActionHandlers = {
2057
2161
  if (ghostElements.node && graphGroup) {
2058
2162
  if (ghostElements.node.userData.labelObject) {
2059
2163
  graphGroup.remove(ghostElements.node.userData.labelObject);
2060
- if (ghostElements.node.userData.labelObject.material.map) ghostElements.node.userData.labelObject.material.map.dispose();
2164
+ if (ghostElements.node.userData.labelObject.material.map)
2165
+ ghostElements.node.userData.labelObject.material.map.dispose();
2061
2166
  ghostElements.node.userData.labelObject.material.dispose();
2062
2167
  }
2063
2168
  graphGroup.remove(ghostElements.node);
@@ -2090,7 +2195,12 @@ var userActionHandlers = {
2090
2195
  opacity: 0.75
2091
2196
  });
2092
2197
  const ghostNode = new THREE.Mesh(ghostGeometry, ghostMaterial);
2093
- const ghostAura = addGlowAura(ghostNode, sourceColor, glowTexture, x_view_config.GLOW.auraScale);
2198
+ const ghostAura = addGlowAura(
2199
+ ghostNode,
2200
+ sourceColor,
2201
+ glowTexture,
2202
+ x_view_config.GLOW.auraScale
2203
+ );
2094
2204
  const ghostLabel = createTextSprite("New Version", 48);
2095
2205
  ghostLabel.name = "label";
2096
2206
  ghostNode.userData.labelObject = ghostLabel;
@@ -2114,15 +2224,25 @@ var userActionHandlers = {
2114
2224
  dashSize: 1,
2115
2225
  gapSize: 0.5,
2116
2226
  depthWrite: false,
2117
- resolution: new THREE.Vector2(renderer.domElement.clientWidth, renderer.domElement.clientHeight)
2227
+ resolution: new THREE.Vector2(
2228
+ renderer.domElement.clientWidth,
2229
+ renderer.domElement.clientHeight
2230
+ )
2118
2231
  });
2119
2232
  const ghostLine = new import_Line2.Line2(lineGeometry, lineMaterial);
2120
2233
  ghostLine.layers.set(GHOST_BLOOM_LAYER);
2121
2234
  stateRef.current.graphGroup.add(ghostLine);
2122
- stateRef.current.ghostElements = { node: ghostNode, line: ghostLine, aura: ghostAura };
2235
+ stateRef.current.ghostElements = {
2236
+ node: ghostNode,
2237
+ line: ghostLine,
2238
+ aura: ghostAura
2239
+ };
2123
2240
  setters.setVersionMode({ isActive: true, sourceNodeData });
2124
2241
  setters.setFormPosition({ left: 16, top: 16, opacity: 1 });
2125
- tweenToTarget(sourceNodeMesh.position.clone().lerp(ghostPosition, 0.5), 1.5);
2242
+ tweenToTarget(
2243
+ sourceNodeMesh.position.clone().lerp(ghostPosition, 0.5),
2244
+ 1.5
2245
+ );
2126
2246
  },
2127
2247
  handleCancelVersioning: (context) => {
2128
2248
  const { stateRef, setters } = context;
@@ -2166,15 +2286,32 @@ var userActionHandlers = {
2166
2286
  ...newNodeData,
2167
2287
  version_node: { is_version: true, parent_node: sourceNodeData.id }
2168
2288
  };
2169
- const newLink = { id: `link_${import_short_uuid.default.generate()}`, source: sourceNodeData.id, target: newNode.id };
2170
- const parentInfo = getParentFileInfoForNode(graphDataRef.current, sceneDataRef.current, sourceNodeData.id, context.sceneConfigId, context.ownerId);
2289
+ const newLink = {
2290
+ id: `link_${import_short_uuid.default.generate()}`,
2291
+ source: sourceNodeData.id,
2292
+ target: newNode.id
2293
+ };
2294
+ const parentInfo = getParentFileInfoForNode(
2295
+ graphDataRef.current,
2296
+ sceneDataRef.current,
2297
+ sourceNodeData.id,
2298
+ context.sceneConfigId,
2299
+ context.ownerId
2300
+ );
2171
2301
  if (!parentInfo || !parentInfo.ownerId) {
2172
- console.error("N\xE3o foi poss\xEDvel encontrar as informa\xE7\xF5es do arquivo pai (ou ownerId) para o Node de origem:", sourceNodeData.id);
2173
- alert("Ocorreu um erro ao identificar o arquivo pai ou seu propriet\xE1rio.");
2302
+ console.error(
2303
+ "N\xE3o foi poss\xEDvel encontrar as informa\xE7\xF5es do arquivo pai (ou ownerId) para o Node de origem:",
2304
+ sourceNodeData.id
2305
+ );
2306
+ alert(
2307
+ "Ocorreu um erro ao identificar o arquivo pai ou seu propriet\xE1rio."
2308
+ );
2174
2309
  return;
2175
2310
  }
2176
2311
  const { parentFileId, ownerId } = parentInfo;
2177
- const specificParentData = JSON.parse(JSON.stringify(graphDataRef.current[parentFileId]));
2312
+ const specificParentData = JSON.parse(
2313
+ JSON.stringify(graphDataRef.current[parentFileId])
2314
+ );
2178
2315
  specificParentData.nodes.push(newNode);
2179
2316
  specificParentData.links.push(newLink);
2180
2317
  try {
@@ -2187,10 +2324,16 @@ var userActionHandlers = {
2187
2324
  quest_nodes: specificParentData.nodes,
2188
2325
  quest_links: specificParentData.links
2189
2326
  };
2190
- await context.actions.save_view_data(context.sceneSaveUrl, viewFilePayload);
2327
+ await context.actions.save_view_data(
2328
+ context.sceneSaveUrl,
2329
+ viewFilePayload
2330
+ );
2191
2331
  } else {
2192
2332
  const filenameForSpecificParent = `x_view_dbs/${ownerId}/${parentFileId}`;
2193
- await context.actions.save_view_data(filenameForSpecificParent, specificParentData);
2333
+ await context.actions.save_view_data(
2334
+ filenameForSpecificParent,
2335
+ specificParentData
2336
+ );
2194
2337
  }
2195
2338
  graphDataRef.current[parentFileId] = specificParentData;
2196
2339
  const finalPosition = stateRef.current.ghostElements.node.position.clone();
@@ -2203,12 +2346,31 @@ var userActionHandlers = {
2203
2346
  userActionHandlers.handleCancelVersioning(context);
2204
2347
  },
2205
2348
  handleExpandConnections: (context, sourceNode, linksToExpand) => {
2206
- const { stateRef, sceneDataRef, graphDataRef, mountRef, setters, tweenToTarget } = context;
2207
- const { graphGroup, nodeObjects, clickableNodes, allLinks, glowTexture, renderer, tweenGroup } = stateRef.current;
2208
- if (!graphGroup || !sceneDataRef.current || !graphDataRef.current || !linksToExpand || linksToExpand.length === 0) return;
2349
+ const {
2350
+ stateRef,
2351
+ sceneDataRef,
2352
+ graphDataRef,
2353
+ mountRef,
2354
+ setters,
2355
+ tweenToTarget
2356
+ } = context;
2357
+ const {
2358
+ graphGroup,
2359
+ nodeObjects,
2360
+ clickableNodes,
2361
+ allLinks,
2362
+ glowTexture,
2363
+ renderer,
2364
+ tweenGroup
2365
+ } = stateRef.current;
2366
+ if (!graphGroup || !sceneDataRef.current || !graphDataRef.current || !linksToExpand || linksToExpand.length === 0)
2367
+ return;
2209
2368
  const sourceNodeMesh = nodeObjects[String(sourceNode.id)];
2210
2369
  if (!sourceNodeMesh) return;
2211
- const resolution = new THREE.Vector2(mountRef.current.clientWidth, mountRef.current.clientHeight);
2370
+ const resolution = new THREE.Vector2(
2371
+ mountRef.current.clientWidth,
2372
+ mountRef.current.clientHeight
2373
+ );
2212
2374
  const targetFinalPositions = [];
2213
2375
  const newVersionMeshes = [];
2214
2376
  linksToExpand.forEach((link) => {
@@ -2216,15 +2378,25 @@ var userActionHandlers = {
2216
2378
  const isSource = String(link.source) === String(sourceNode.id);
2217
2379
  const targetNodeId = isSource ? link.target : link.source;
2218
2380
  if (!nodeObjects[String(targetNodeId)]) {
2219
- const allParentNodes = Object.values(graphDataRef.current).flatMap((fileData) => fileData.nodes);
2220
- const nodeData = allParentNodes.find((n) => String(n.id) === String(targetNodeId));
2381
+ const allParentNodes = Object.values(graphDataRef.current).flatMap(
2382
+ (fileData) => fileData.nodes
2383
+ );
2384
+ const nodeData = allParentNodes.find(
2385
+ (n) => String(n.id) === String(targetNodeId)
2386
+ );
2221
2387
  if (!nodeData) {
2222
- console.warn(`Dados do Node com ID ${targetNodeId} n\xE3o encontrados no cache.`);
2388
+ console.warn(
2389
+ `Dados do Node com ID ${targetNodeId} n\xE3o encontrados no cache.`
2390
+ );
2223
2391
  return;
2224
2392
  }
2225
2393
  const startPosition = sourceNodeMesh.position.clone();
2226
2394
  const endPosition = startPosition.clone().add(
2227
- new THREE.Vector3((Math.random() - 0.5) * 60, (Math.random() - 0.5) * 15, (Math.random() - 0.5) * 60)
2395
+ new THREE.Vector3(
2396
+ (Math.random() - 0.5) * 60,
2397
+ (Math.random() - 0.5) * 15,
2398
+ (Math.random() - 0.5) * 60
2399
+ )
2228
2400
  );
2229
2401
  targetFinalPositions.push(endPosition);
2230
2402
  const targetMesh = createNodeMesh(nodeData, startPosition, glowTexture);
@@ -2248,7 +2420,9 @@ var userActionHandlers = {
2248
2420
  }
2249
2421
  });
2250
2422
  linksToExpand.forEach((link) => {
2251
- const linkAlreadyInSceneObjects = allLinks.some((l) => String(l.userData.id) === String(link.id));
2423
+ const linkAlreadyInSceneObjects = allLinks.some(
2424
+ (l) => String(l.userData.id) === String(link.id)
2425
+ );
2252
2426
  if (linkAlreadyInSceneObjects) return;
2253
2427
  const sourceMesh = nodeObjects[String(link.source)];
2254
2428
  const targetMesh = nodeObjects[String(link.target)];
@@ -2257,13 +2431,20 @@ var userActionHandlers = {
2257
2431
  (l) => String(l.userData.source) === String(link.source) && String(l.userData.target) === String(link.target) || String(l.userData.source) === String(link.target) && String(l.userData.target) === String(link.source)
2258
2432
  ).map((l) => l.userData);
2259
2433
  currentLinksBetweenNodesData.forEach((linkData) => {
2260
- const linkToRemove = allLinks.find((l) => String(l.userData.id) === String(linkData.id));
2434
+ const linkToRemove = allLinks.find(
2435
+ (l) => String(l.userData.id) === String(linkData.id)
2436
+ );
2261
2437
  if (linkToRemove) {
2262
2438
  removeLinkFromScene(stateRef.current, linkToRemove);
2263
2439
  }
2264
2440
  });
2265
2441
  const allLinksToRender = [...currentLinksBetweenNodesData, link];
2266
- const newRenderedLinks = createMultipleLinkLines(allLinksToRender, sourceMesh, targetMesh, resolution);
2442
+ const newRenderedLinks = createMultipleLinkLines(
2443
+ allLinksToRender,
2444
+ sourceMesh,
2445
+ targetMesh,
2446
+ resolution
2447
+ );
2267
2448
  newRenderedLinks.forEach((newLine) => {
2268
2449
  newLine.material.opacity = 0;
2269
2450
  graphGroup.add(newLine);
@@ -2282,7 +2463,10 @@ var userActionHandlers = {
2282
2463
  const size = new THREE.Vector3();
2283
2464
  boundingBox.getSize(size);
2284
2465
  const spread = Math.max(size.x, size.y, size.z, 1);
2285
- const desiredDistance = Math.max(x_view_config.CAMERA_ZOOM_DISTANCE, spread * 1.2);
2466
+ const desiredDistance = Math.max(
2467
+ x_view_config.CAMERA_ZOOM_DISTANCE,
2468
+ spread * 1.2
2469
+ );
2286
2470
  const zoomFactor = x_view_config.CAMERA_ZOOM_DISTANCE / desiredDistance;
2287
2471
  tweenToTarget(center, zoomFactor);
2288
2472
  }
@@ -2317,7 +2501,10 @@ var userActionHandlers = {
2317
2501
  dashSize: 0.5,
2318
2502
  gapSize: 0.25,
2319
2503
  depthWrite: false,
2320
- resolution: new THREE.Vector2(renderer.domElement.clientWidth, renderer.domElement.clientHeight)
2504
+ resolution: new THREE.Vector2(
2505
+ renderer.domElement.clientWidth,
2506
+ renderer.domElement.clientHeight
2507
+ )
2321
2508
  });
2322
2509
  const lineGeometry = new import_LineGeometry.LineGeometry().setPositions([
2323
2510
  ...sourceNodeMesh.position.toArray(),
@@ -2326,7 +2513,11 @@ var userActionHandlers = {
2326
2513
  const connectingLine = new import_Line2.Line2(lineGeometry, lineMaterial);
2327
2514
  connectingLine.layers.set(GHOST_BLOOM_LAYER);
2328
2515
  graphGroup.add(connectingLine);
2329
- stateRef.current.connection = { isActive: true, sourceNodeData, line: connectingLine };
2516
+ stateRef.current.connection = {
2517
+ isActive: true,
2518
+ sourceNodeData,
2519
+ line: connectingLine
2520
+ };
2330
2521
  },
2331
2522
  handleCancelConnection: (context) => {
2332
2523
  const { stateRef, mountRef } = context;
@@ -2336,7 +2527,11 @@ var userActionHandlers = {
2336
2527
  connection.line.geometry.dispose();
2337
2528
  connection.line.material.dispose();
2338
2529
  }
2339
- stateRef.current.connection = { isActive: false, sourceNodeData: null, line: null };
2530
+ stateRef.current.connection = {
2531
+ isActive: false,
2532
+ sourceNodeData: null,
2533
+ line: null
2534
+ };
2340
2535
  if (controls) controls.enabled = true;
2341
2536
  if (mountRef.current) mountRef.current.style.cursor = "grab";
2342
2537
  },
@@ -2349,10 +2544,21 @@ var userActionHandlers = {
2349
2544
  userActionHandlers.handleCancelConnection(context);
2350
2545
  return;
2351
2546
  }
2352
- const sourceParentInfo = getParentFileInfoForNode(graphDataRef.current, sceneDataRef.current, sourceNodeData.id, context.sceneConfigId, context.ownerId);
2547
+ const sourceParentInfo = getParentFileInfoForNode(
2548
+ graphDataRef.current,
2549
+ sceneDataRef.current,
2550
+ sourceNodeData.id,
2551
+ context.sceneConfigId,
2552
+ context.ownerId
2553
+ );
2353
2554
  if (!sourceParentInfo || !sourceParentInfo.ownerId) {
2354
- console.error("N\xE3o foi poss\xEDvel encontrar as informa\xE7\xF5es do arquivo pai (ou ownerId) para o Node de origem:", sourceNodeData.id);
2355
- alert("Ocorreu um erro ao identificar o arquivo pai ou seu propriet\xE1rio.");
2555
+ console.error(
2556
+ "N\xE3o foi poss\xEDvel encontrar as informa\xE7\xF5es do arquivo pai (ou ownerId) para o Node de origem:",
2557
+ sourceNodeData.id
2558
+ );
2559
+ alert(
2560
+ "Ocorreu um erro ao identificar o arquivo pai ou seu propriet\xE1rio."
2561
+ );
2356
2562
  userActionHandlers.handleCancelConnection(context);
2357
2563
  return;
2358
2564
  }
@@ -2376,12 +2582,20 @@ var userActionHandlers = {
2376
2582
  quest_nodes: specificParentData.nodes,
2377
2583
  quest_links: specificParentData.links
2378
2584
  };
2379
- await context.actions.save_view_data(context.sceneSaveUrl, viewFilePayload);
2585
+ await context.actions.save_view_data(
2586
+ context.sceneSaveUrl,
2587
+ viewFilePayload
2588
+ );
2380
2589
  } else {
2381
- const specificParentData = JSON.parse(JSON.stringify(graphDataRef.current[parentFileIdToSave]));
2590
+ const specificParentData = JSON.parse(
2591
+ JSON.stringify(graphDataRef.current[parentFileIdToSave])
2592
+ );
2382
2593
  specificParentData.links.push(newLink);
2383
2594
  const filenameForSpecificParent = `x_view_dbs/${ownerIdToSave}/${parentFileIdToSave}`;
2384
- await context.actions.save_view_data(filenameForSpecificParent, specificParentData);
2595
+ await context.actions.save_view_data(
2596
+ filenameForSpecificParent,
2597
+ specificParentData
2598
+ );
2385
2599
  graphDataRef.current[parentFileIdToSave] = specificParentData;
2386
2600
  }
2387
2601
  addNewLinkToScene(stateRef.current, newLink);
@@ -2434,7 +2648,13 @@ var userActionHandlers = {
2434
2648
  if (relink.originalLine) {
2435
2649
  relink.originalLine.visible = true;
2436
2650
  }
2437
- stateRef.current.relink = { isActive: false, end: null, fixedNodeId: null, originalLine: null, line: null };
2651
+ stateRef.current.relink = {
2652
+ isActive: false,
2653
+ end: null,
2654
+ fixedNodeId: null,
2655
+ originalLine: null,
2656
+ line: null
2657
+ };
2438
2658
  if (controls) controls.enabled = true;
2439
2659
  if (mountRef.current) mountRef.current.style.cursor = "grab";
2440
2660
  },
@@ -2452,13 +2672,39 @@ var userActionHandlers = {
2452
2672
  } else {
2453
2673
  newTargetId = newEndNodeData.id;
2454
2674
  }
2455
- const oldSourceInfo = getParentFileInfoForNode(graphDataRef.current, sceneDataRef.current, oldSourceId, context.sceneConfigId, context.ownerId);
2456
- const oldTargetInfo = getParentFileInfoForNode(graphDataRef.current, sceneDataRef.current, oldTargetId, context.sceneConfigId, context.ownerId);
2457
- const newSourceInfo = getParentFileInfoForNode(graphDataRef.current, sceneDataRef.current, newSourceId, context.sceneConfigId, context.ownerId);
2458
- const newTargetInfo = getParentFileInfoForNode(graphDataRef.current, sceneDataRef.current, newTargetId, context.sceneConfigId, context.ownerId);
2675
+ const oldSourceInfo = getParentFileInfoForNode(
2676
+ graphDataRef.current,
2677
+ sceneDataRef.current,
2678
+ oldSourceId,
2679
+ context.sceneConfigId,
2680
+ context.ownerId
2681
+ );
2682
+ const oldTargetInfo = getParentFileInfoForNode(
2683
+ graphDataRef.current,
2684
+ sceneDataRef.current,
2685
+ oldTargetId,
2686
+ context.sceneConfigId,
2687
+ context.ownerId
2688
+ );
2689
+ const newSourceInfo = getParentFileInfoForNode(
2690
+ graphDataRef.current,
2691
+ sceneDataRef.current,
2692
+ newSourceId,
2693
+ context.sceneConfigId,
2694
+ context.ownerId
2695
+ );
2696
+ const newTargetInfo = getParentFileInfoForNode(
2697
+ graphDataRef.current,
2698
+ sceneDataRef.current,
2699
+ newTargetId,
2700
+ context.sceneConfigId,
2701
+ context.ownerId
2702
+ );
2459
2703
  if (!oldSourceInfo || !oldTargetInfo || !newSourceInfo || !newTargetInfo) {
2460
2704
  console.error("Informa\xE7\xF5es dos arquivos pai incompletas para o relink.");
2461
- alert("Ocorreu um erro ao identificar os arquivos pai para salvar a altera\xE7\xE3o.");
2705
+ alert(
2706
+ "Ocorreu um erro ao identificar os arquivos pai para salvar a altera\xE7\xE3o."
2707
+ );
2462
2708
  userActionHandlers.handleCancelRelink(context);
2463
2709
  return;
2464
2710
  }
@@ -2492,33 +2738,63 @@ var userActionHandlers = {
2492
2738
  quest_nodes: data.nodes,
2493
2739
  quest_links: data.links
2494
2740
  };
2495
- return context.actions.save_view_data(context.sceneSaveUrl, viewFilePayload);
2741
+ return context.actions.save_view_data(
2742
+ context.sceneSaveUrl,
2743
+ viewFilePayload
2744
+ );
2496
2745
  } else {
2497
- return context.actions.save_view_data(`x_view_dbs/${fileOwnerId}/${fileId}`, data);
2746
+ return context.actions.save_view_data(
2747
+ `x_view_dbs/${fileOwnerId}/${fileId}`,
2748
+ data
2749
+ );
2498
2750
  }
2499
2751
  };
2500
2752
  const savePromises = [];
2501
2753
  const filesToUpdate = {};
2502
2754
  if (oldGoverningFileId !== newGoverningFileId) {
2503
- const updatedOriginalParentData = JSON.parse(JSON.stringify(graphDataRef.current[oldGoverningFileId]));
2755
+ const updatedOriginalParentData = JSON.parse(
2756
+ JSON.stringify(graphDataRef.current[oldGoverningFileId])
2757
+ );
2504
2758
  updatedOriginalParentData.links = updatedOriginalParentData.links.filter(
2505
2759
  (l) => String(l.id) !== String(linkId)
2506
2760
  );
2507
2761
  filesToUpdate[oldGoverningFileId] = updatedOriginalParentData;
2508
- savePromises.push(saveParentData(oldGoverningFileId, oldGoverningOwnerId, updatedOriginalParentData));
2509
- const updatedNewParentData = JSON.parse(JSON.stringify(graphDataRef.current[newGoverningFileId]));
2762
+ savePromises.push(
2763
+ saveParentData(
2764
+ oldGoverningFileId,
2765
+ oldGoverningOwnerId,
2766
+ updatedOriginalParentData
2767
+ )
2768
+ );
2769
+ const updatedNewParentData = JSON.parse(
2770
+ JSON.stringify(graphDataRef.current[newGoverningFileId])
2771
+ );
2510
2772
  if (!updatedNewParentData.links) updatedNewParentData.links = [];
2511
2773
  updatedNewParentData.links.push(newLinkData);
2512
2774
  filesToUpdate[newGoverningFileId] = updatedNewParentData;
2513
- savePromises.push(saveParentData(newGoverningFileId, newGoverningOwnerId, updatedNewParentData));
2775
+ savePromises.push(
2776
+ saveParentData(
2777
+ newGoverningFileId,
2778
+ newGoverningOwnerId,
2779
+ updatedNewParentData
2780
+ )
2781
+ );
2514
2782
  } else {
2515
- const updatedParentData = JSON.parse(JSON.stringify(graphDataRef.current[oldGoverningFileId]));
2783
+ const updatedParentData = JSON.parse(
2784
+ JSON.stringify(graphDataRef.current[oldGoverningFileId])
2785
+ );
2516
2786
  updatedParentData.links = updatedParentData.links.filter(
2517
2787
  (l) => String(l.id) !== String(linkId)
2518
2788
  );
2519
2789
  updatedParentData.links.push(newLinkData);
2520
2790
  filesToUpdate[oldGoverningFileId] = updatedParentData;
2521
- savePromises.push(saveParentData(oldGoverningFileId, oldGoverningOwnerId, updatedParentData));
2791
+ savePromises.push(
2792
+ saveParentData(
2793
+ oldGoverningFileId,
2794
+ oldGoverningOwnerId,
2795
+ updatedParentData
2796
+ )
2797
+ );
2522
2798
  }
2523
2799
  try {
2524
2800
  await Promise.all(savePromises);
@@ -2539,30 +2815,51 @@ var userActionHandlers = {
2539
2815
  var _a, _b, _c, _d, _e, _f, _g;
2540
2816
  const { stateRef, graphDataRef, sceneDataRef, setters } = context;
2541
2817
  setters.setRelationshipMenu({ visible: false });
2542
- if (!(linkObject == null ? void 0 : linkObject.userData) || !graphDataRef.current || !sceneDataRef.current) return;
2818
+ if (!(linkObject == null ? void 0 : linkObject.userData) || !graphDataRef.current || !sceneDataRef.current)
2819
+ return;
2543
2820
  const linkIdToDelete = linkObject.userData.id;
2544
2821
  if (!linkIdToDelete) {
2545
- console.error("Tentativa de deletar um link sem ID.", linkObject.userData);
2822
+ console.error(
2823
+ "Tentativa de deletar um link sem ID.",
2824
+ linkObject.userData
2825
+ );
2546
2826
  return;
2547
2827
  }
2548
- const parentInfo = getParentFileInfoForNode(graphDataRef.current, sceneDataRef.current, linkObject.userData.source, context.sceneConfigId, context.ownerId);
2828
+ const parentInfo = getParentFileInfoForNode(
2829
+ graphDataRef.current,
2830
+ sceneDataRef.current,
2831
+ linkObject.userData.source,
2832
+ context.sceneConfigId,
2833
+ context.ownerId
2834
+ );
2549
2835
  if (!parentInfo || !parentInfo.ownerId) {
2550
- console.error("N\xE3o foi poss\xEDvel encontrar as informa\xE7\xF5es do arquivo pai (ou ownerId) para o link:", linkIdToDelete);
2551
- alert("Ocorreu um erro ao identificar o arquivo pai da rela\xE7\xE3o para exclus\xE3o.");
2836
+ console.error(
2837
+ "N\xE3o foi poss\xEDvel encontrar as informa\xE7\xF5es do arquivo pai (ou ownerId) para o link:",
2838
+ linkIdToDelete
2839
+ );
2840
+ alert(
2841
+ "Ocorreu um erro ao identificar o arquivo pai da rela\xE7\xE3o para exclus\xE3o."
2842
+ );
2552
2843
  return;
2553
2844
  }
2554
2845
  const { parentFileId, ownerId } = parentInfo;
2555
2846
  const srcName = ((_c = (_b = (_a = linkObject.userData) == null ? void 0 : _a.sourceNode) == null ? void 0 : _b.userData) == null ? void 0 : _c.name) ?? linkObject.userData.source;
2556
2847
  const tgtName = ((_f = (_e = (_d = linkObject.userData) == null ? void 0 : _d.targetNode) == null ? void 0 : _e.userData) == null ? void 0 : _f.name) ?? linkObject.userData.target;
2557
- const specificParentData = JSON.parse(JSON.stringify(graphDataRef.current[parentFileId]));
2558
- const newLinks = (specificParentData.links || []).filter((l) => String(l.id) !== String(linkIdToDelete));
2848
+ const specificParentData = JSON.parse(
2849
+ JSON.stringify(graphDataRef.current[parentFileId])
2850
+ );
2851
+ const newLinks = (specificParentData.links || []).filter(
2852
+ (l) => String(l.id) !== String(linkIdToDelete)
2853
+ );
2559
2854
  specificParentData.links = newLinks;
2560
2855
  let filenameToSave;
2561
2856
  let payloadToSave;
2562
2857
  const isView = ((_g = context.viewType) == null ? void 0 : _g.toLowerCase()) === "view";
2563
2858
  if (isView && parentFileId === context.sceneConfigId) {
2564
2859
  filenameToSave = context.sceneSaveUrl;
2565
- sceneDataRef.current.links = sceneDataRef.current.links.filter((l) => String(l.id) !== String(linkIdToDelete));
2860
+ sceneDataRef.current.links = sceneDataRef.current.links.filter(
2861
+ (l) => String(l.id) !== String(linkIdToDelete)
2862
+ );
2566
2863
  payloadToSave = {
2567
2864
  parent_dbs: sceneDataRef.current.parent_dbs,
2568
2865
  nodes: sceneDataRef.current.nodes,
@@ -2578,7 +2875,9 @@ var userActionHandlers = {
2578
2875
  try {
2579
2876
  await context.actions.save_view_data(filenameToSave, payloadToSave);
2580
2877
  graphDataRef.current[parentFileId] = specificParentData;
2581
- setters.setDetailsLink((prev) => String(prev == null ? void 0 : prev.id) === String(linkIdToDelete) ? null : prev);
2878
+ setters.setDetailsLink(
2879
+ (prev) => String(prev == null ? void 0 : prev.id) === String(linkIdToDelete) ? null : prev
2880
+ );
2582
2881
  if (stateRef.current.hoveredLink === linkObject) {
2583
2882
  stateRef.current.hoveredLink = null;
2584
2883
  }
@@ -2610,7 +2909,9 @@ var userActionHandlers = {
2610
2909
  stateRef.current.renderedAncestries = [];
2611
2910
  }
2612
2911
  removeNodeFromScene(stateRef.current, nodeIdToDismiss);
2613
- setters.setDetailsNode((prev) => String(prev == null ? void 0 : prev.id) === String(nodeIdToDismiss) ? null : prev);
2912
+ setters.setDetailsNode(
2913
+ (prev) => String(prev == null ? void 0 : prev.id) === String(nodeIdToDismiss) ? null : prev
2914
+ );
2614
2915
  },
2615
2916
  handleDismissOtherNodes: (context, nodeData) => {
2616
2917
  const { stateRef, sceneDataRef, setters } = context;
@@ -2619,7 +2920,9 @@ var userActionHandlers = {
2619
2920
  const nodeIdToKeep = nodeData.id;
2620
2921
  const strNodeIdToKeep = String(nodeIdToKeep);
2621
2922
  const allVisibleNodeIds = Object.keys(stateRef.current.nodeObjects);
2622
- const nodeIdsToDismiss = allVisibleNodeIds.filter((id) => id !== strNodeIdToKeep);
2923
+ const nodeIdsToDismiss = allVisibleNodeIds.filter(
2924
+ (id) => id !== strNodeIdToKeep
2925
+ );
2623
2926
  if (nodeIdsToDismiss.length === 0) return;
2624
2927
  const { ancestryGroup, ancestryLinks } = stateRef.current;
2625
2928
  if (ancestryGroup && ancestryLinks) {
@@ -2633,7 +2936,9 @@ var userActionHandlers = {
2633
2936
  }
2634
2937
  nodeIdsToDismiss.forEach((nodeId) => {
2635
2938
  removeNodeFromScene(stateRef.current, nodeId);
2636
- setters.setDetailsNode((prev) => String(prev == null ? void 0 : prev.id) === String(nodeId) ? null : prev);
2939
+ setters.setDetailsNode(
2940
+ (prev) => String(prev == null ? void 0 : prev.id) === String(nodeId) ? null : prev
2941
+ );
2637
2942
  });
2638
2943
  },
2639
2944
  handleDismissMultipleNodes: (context, nodeIds) => {
@@ -2659,7 +2964,9 @@ var userActionHandlers = {
2659
2964
  stateRef.current.renderedAncestries = [];
2660
2965
  }
2661
2966
  strNodeIds.forEach((nodeId) => {
2662
- setters.setDetailsNode((prev) => String(prev == null ? void 0 : prev.id) === nodeId ? null : prev);
2967
+ setters.setDetailsNode(
2968
+ (prev) => String(prev == null ? void 0 : prev.id) === nodeId ? null : prev
2969
+ );
2663
2970
  removeNodeFromScene(stateRef.current, nodeId);
2664
2971
  });
2665
2972
  stateRef.current.selectedNodes.clear();
@@ -2667,10 +2974,13 @@ var userActionHandlers = {
2667
2974
  handleDismissOtherMultipleNodes: (context, nodeIdsToKeep) => {
2668
2975
  const { stateRef, sceneDataRef, setters } = context;
2669
2976
  setters.setMultiContextMenu({ visible: false });
2670
- if (!nodeIdsToKeep || nodeIdsToKeep.size === 0 || !sceneDataRef.current) return;
2977
+ if (!nodeIdsToKeep || nodeIdsToKeep.size === 0 || !sceneDataRef.current)
2978
+ return;
2671
2979
  const strNodeIdsToKeep = Array.from(nodeIdsToKeep).map(String);
2672
2980
  const allVisibleNodeIds = Object.keys(stateRef.current.nodeObjects);
2673
- const nodeIdsToDismiss = allVisibleNodeIds.filter((id) => !strNodeIdsToKeep.includes(id));
2981
+ const nodeIdsToDismiss = allVisibleNodeIds.filter(
2982
+ (id) => !strNodeIdsToKeep.includes(id)
2983
+ );
2674
2984
  if (nodeIdsToDismiss.length === 0) {
2675
2985
  stateRef.current.selectedNodes.clear();
2676
2986
  return;
@@ -2694,7 +3004,9 @@ var userActionHandlers = {
2694
3004
  }
2695
3005
  nodeIdsToDismiss.forEach((nodeId) => {
2696
3006
  removeNodeFromScene(stateRef.current, nodeId);
2697
- setters.setDetailsNode((prev) => String(prev == null ? void 0 : prev.id) === String(nodeId) ? null : prev);
3007
+ setters.setDetailsNode(
3008
+ (prev) => String(prev == null ? void 0 : prev.id) === String(nodeId) ? null : prev
3009
+ );
2698
3010
  });
2699
3011
  stateRef.current.selectedNodes.clear();
2700
3012
  },
@@ -2702,7 +3014,8 @@ var userActionHandlers = {
2702
3014
  var _a;
2703
3015
  const { stateRef, graphDataRef, sceneDataRef, setters, actions } = context;
2704
3016
  setters.setMultiContextMenu({ visible: false });
2705
- if (!nodeIds || nodeIds.size === 0 || !graphDataRef.current || !sceneDataRef.current) return;
3017
+ if (!nodeIds || nodeIds.size === 0 || !graphDataRef.current || !sceneDataRef.current)
3018
+ return;
2706
3019
  const strNodeIdsToDelete = Array.from(nodeIds).map(String);
2707
3020
  if (actions.delete_file) {
2708
3021
  strNodeIdsToDelete.forEach((id) => {
@@ -2711,16 +3024,26 @@ var userActionHandlers = {
2711
3024
  if (nodeData) {
2712
3025
  const urls = extractFileUrlsFromProperties(nodeData);
2713
3026
  if (urls.length > 0) {
2714
- Promise.all(urls.map((url) => actions.delete_file(url))).catch((err) => console.error(`Erro ao deletar arquivos do node ${id}:`, err));
3027
+ Promise.all(urls.map((url) => actions.delete_file(url))).catch(
3028
+ (err) => console.error(`Erro ao deletar arquivos do node ${id}:`, err)
3029
+ );
2715
3030
  }
2716
3031
  }
2717
3032
  });
2718
3033
  }
2719
3034
  const changesByParentFile = {};
2720
3035
  for (const nodeId of strNodeIdsToDelete) {
2721
- const parentInfo = getParentFileInfoForNode(graphDataRef.current, sceneDataRef.current, nodeId, context.sceneConfigId, context.ownerId);
3036
+ const parentInfo = getParentFileInfoForNode(
3037
+ graphDataRef.current,
3038
+ sceneDataRef.current,
3039
+ nodeId,
3040
+ context.sceneConfigId,
3041
+ context.ownerId
3042
+ );
2722
3043
  if (!parentInfo || !parentInfo.ownerId) {
2723
- console.warn(`Node com ID ${nodeId} n\xE3o encontrado ou sem ownerId. Ignorando.`);
3044
+ console.warn(
3045
+ `Node com ID ${nodeId} n\xE3o encontrado ou sem ownerId. Ignorando.`
3046
+ );
2724
3047
  continue;
2725
3048
  }
2726
3049
  const { parentFileId, ownerId } = parentInfo;
@@ -2731,21 +3054,31 @@ var userActionHandlers = {
2731
3054
  parentFileId,
2732
3055
  nodesToDelete: /* @__PURE__ */ new Set(),
2733
3056
  linksToDelete: /* @__PURE__ */ new Set(),
2734
- originalData: JSON.parse(JSON.stringify(graphDataRef.current[parentFileId]))
3057
+ originalData: JSON.parse(
3058
+ JSON.stringify(graphDataRef.current[parentFileId])
3059
+ )
2735
3060
  };
2736
3061
  }
2737
3062
  changesByParentFile[fileKey].nodesToDelete.add(nodeId);
2738
3063
  const associatedLinks = (changesByParentFile[fileKey].originalData.links || []).filter(
2739
3064
  (l) => String(l.source) === nodeId || String(l.target) === nodeId
2740
3065
  );
2741
- associatedLinks.forEach((link) => changesByParentFile[fileKey].linksToDelete.add(link.id));
3066
+ associatedLinks.forEach(
3067
+ (link) => changesByParentFile[fileKey].linksToDelete.add(link.id)
3068
+ );
2742
3069
  }
2743
3070
  const savePromises = [];
2744
3071
  const updatedParentDataCache = {};
2745
3072
  for (const fileKey in changesByParentFile) {
2746
3073
  if (changesByParentFile.hasOwnProperty(fileKey)) {
2747
3074
  const change = changesByParentFile[fileKey];
2748
- const { nodesToDelete, linksToDelete, originalData, ownerId, parentFileId } = change;
3075
+ const {
3076
+ nodesToDelete,
3077
+ linksToDelete,
3078
+ originalData,
3079
+ ownerId,
3080
+ parentFileId
3081
+ } = change;
2749
3082
  originalData.nodes = (originalData.nodes || []).filter(
2750
3083
  (n) => !nodesToDelete.has(String(n.id))
2751
3084
  );
@@ -2759,8 +3092,12 @@ var userActionHandlers = {
2759
3092
  filenameToSave = context.sceneSaveUrl;
2760
3093
  const strNodesToDelete = Array.from(nodesToDelete).map(String);
2761
3094
  const strLinksToDelete = Array.from(linksToDelete).map(String);
2762
- sceneDataRef.current.nodes = sceneDataRef.current.nodes.filter((n) => !strNodesToDelete.includes(String(n.id)));
2763
- sceneDataRef.current.links = sceneDataRef.current.links.filter((l) => !strLinksToDelete.includes(String(l.id)));
3095
+ sceneDataRef.current.nodes = sceneDataRef.current.nodes.filter(
3096
+ (n) => !strNodesToDelete.includes(String(n.id))
3097
+ );
3098
+ sceneDataRef.current.links = sceneDataRef.current.links.filter(
3099
+ (l) => !strLinksToDelete.includes(String(l.id))
3100
+ );
2764
3101
  payloadToSave = {
2765
3102
  parent_dbs: sceneDataRef.current.parent_dbs,
2766
3103
  nodes: sceneDataRef.current.nodes,
@@ -2773,7 +3110,9 @@ var userActionHandlers = {
2773
3110
  filenameToSave = `x_view_dbs/${ownerId}/${parentFileId}`;
2774
3111
  payloadToSave = originalData;
2775
3112
  }
2776
- savePromises.push(context.actions.save_view_data(filenameToSave, payloadToSave));
3113
+ savePromises.push(
3114
+ context.actions.save_view_data(filenameToSave, payloadToSave)
3115
+ );
2777
3116
  updatedParentDataCache[parentFileId] = originalData;
2778
3117
  }
2779
3118
  }
@@ -2783,7 +3122,9 @@ var userActionHandlers = {
2783
3122
  graphDataRef.current[fileId] = updatedParentDataCache[fileId];
2784
3123
  }
2785
3124
  strNodeIdsToDelete.forEach((nodeId) => {
2786
- setters.setDetailsNode((prev) => String(prev == null ? void 0 : prev.id) === nodeId ? null : prev);
3125
+ setters.setDetailsNode(
3126
+ (prev) => String(prev == null ? void 0 : prev.id) === nodeId ? null : prev
3127
+ );
2787
3128
  removeNodeFromScene(stateRef.current, nodeId);
2788
3129
  });
2789
3130
  stateRef.current.selectedNodes.clear();
@@ -2799,23 +3140,42 @@ var userActionHandlers = {
2799
3140
  if (actions.delete_file && nodeData) {
2800
3141
  const urls = extractFileUrlsFromProperties(nodeData);
2801
3142
  if (urls.length > 0) {
2802
- Promise.all(urls.map((url) => actions.delete_file(url))).then(() => console.log("Arquivos do node deletados.")).catch((err) => console.error("Erro ao deletar arquivos do node:", err));
3143
+ Promise.all(urls.map((url) => actions.delete_file(url))).then(() => console.log("Arquivos do node deletados.")).catch(
3144
+ (err) => console.error("Erro ao deletar arquivos do node:", err)
3145
+ );
2803
3146
  }
2804
3147
  }
2805
3148
  setters.setContextMenu({ visible: false });
2806
3149
  if (!nodeData || !graphDataRef.current || !sceneDataRef.current) return;
2807
3150
  const nodeIdToDelete = nodeData.id;
2808
3151
  const strNodeId = String(nodeIdToDelete);
2809
- const parentInfo = getParentFileInfoForNode(graphDataRef.current, sceneDataRef.current, nodeIdToDelete, context.sceneConfigId, context.ownerId);
3152
+ const parentInfo = getParentFileInfoForNode(
3153
+ graphDataRef.current,
3154
+ sceneDataRef.current,
3155
+ nodeIdToDelete,
3156
+ context.sceneConfigId,
3157
+ context.ownerId
3158
+ );
2810
3159
  if (!parentInfo || !parentInfo.ownerId) {
2811
- console.error("N\xE3o foi poss\xEDvel encontrar as informa\xE7\xF5es do arquivo pai (ou ownerId) para o Node a ser exclu\xEDdo:", nodeIdToDelete);
2812
- alert("Ocorreu um erro ao identificar o arquivo pai ou seu propriet\xE1rio para exclus\xE3o.");
3160
+ console.error(
3161
+ "N\xE3o foi poss\xEDvel encontrar as informa\xE7\xF5es do arquivo pai (ou ownerId) para o Node a ser exclu\xEDdo:",
3162
+ nodeIdToDelete
3163
+ );
3164
+ alert(
3165
+ "Ocorreu um erro ao identificar o arquivo pai ou seu propriet\xE1rio para exclus\xE3o."
3166
+ );
2813
3167
  return;
2814
3168
  }
2815
3169
  const { parentFileId, ownerId } = parentInfo;
2816
- const specificParentData = JSON.parse(JSON.stringify(graphDataRef.current[parentFileId]));
2817
- const newNodes = (specificParentData.nodes || []).filter((n) => String(n.id) !== strNodeId);
2818
- const newLinks = (specificParentData.links || []).filter((l) => String(l.source) !== strNodeId && String(l.target) !== strNodeId);
3170
+ const specificParentData = JSON.parse(
3171
+ JSON.stringify(graphDataRef.current[parentFileId])
3172
+ );
3173
+ const newNodes = (specificParentData.nodes || []).filter(
3174
+ (n) => String(n.id) !== strNodeId
3175
+ );
3176
+ const newLinks = (specificParentData.links || []).filter(
3177
+ (l) => String(l.source) !== strNodeId && String(l.target) !== strNodeId
3178
+ );
2819
3179
  specificParentData.nodes = newNodes;
2820
3180
  specificParentData.links = newLinks;
2821
3181
  let filenameToSave;
@@ -2823,8 +3183,12 @@ var userActionHandlers = {
2823
3183
  const isView = ((_a = context.viewType) == null ? void 0 : _a.toLowerCase()) === "view";
2824
3184
  if (isView && parentFileId === context.sceneConfigId) {
2825
3185
  filenameToSave = context.sceneSaveUrl;
2826
- const newVisualNodes = sceneDataRef.current.nodes.filter((n) => String(n.id) !== strNodeId);
2827
- const newVisualLinks = sceneDataRef.current.links.filter((l) => String(l.source) !== strNodeId && String(l.target) !== strNodeId);
3186
+ const newVisualNodes = sceneDataRef.current.nodes.filter(
3187
+ (n) => String(n.id) !== strNodeId
3188
+ );
3189
+ const newVisualLinks = sceneDataRef.current.links.filter(
3190
+ (l) => String(l.source) !== strNodeId && String(l.target) !== strNodeId
3191
+ );
2828
3192
  sceneDataRef.current.nodes = newVisualNodes;
2829
3193
  sceneDataRef.current.links = newVisualLinks;
2830
3194
  payloadToSave = {
@@ -2842,7 +3206,9 @@ var userActionHandlers = {
2842
3206
  try {
2843
3207
  await context.actions.save_view_data(filenameToSave, payloadToSave);
2844
3208
  graphDataRef.current[parentFileId] = specificParentData;
2845
- setters.setDetailsNode((prev) => String(prev == null ? void 0 : prev.id) === String(nodeIdToDelete) ? null : prev);
3209
+ setters.setDetailsNode(
3210
+ (prev) => String(prev == null ? void 0 : prev.id) === String(nodeIdToDelete) ? null : prev
3211
+ );
2846
3212
  removeNodeFromScene(stateRef.current, nodeIdToDelete);
2847
3213
  setters.setSceneVersion((v) => v + 1);
2848
3214
  } catch (e) {
@@ -2863,17 +3229,35 @@ var userActionHandlers = {
2863
3229
  timelineEndLabel,
2864
3230
  ...nodeToSave
2865
3231
  } = updatedNode;
2866
- const parentInfo = getParentFileInfoForNode(graphDataRef.current, sceneDataRef.current, nodeToSave.id, context.sceneConfigId, context.ownerId);
3232
+ const parentInfo = getParentFileInfoForNode(
3233
+ graphDataRef.current,
3234
+ sceneDataRef.current,
3235
+ nodeToSave.id,
3236
+ context.sceneConfigId,
3237
+ context.ownerId
3238
+ );
2867
3239
  if (!parentInfo || !parentInfo.ownerId) {
2868
- console.error("N\xE3o foi poss\xEDvel encontrar as informa\xE7\xF5es do arquivo pai (ou ownerId) para o Node a ser atualizado:", nodeToSave.id);
2869
- alert("Ocorreu um erro ao identificar o arquivo pai ou seu propriet\xE1rio para atualiza\xE7\xE3o.");
3240
+ console.error(
3241
+ "N\xE3o foi poss\xEDvel encontrar as informa\xE7\xF5es do arquivo pai (ou ownerId) para o Node a ser atualizado:",
3242
+ nodeToSave.id
3243
+ );
3244
+ alert(
3245
+ "Ocorreu um erro ao identificar o arquivo pai ou seu propriet\xE1rio para atualiza\xE7\xE3o."
3246
+ );
2870
3247
  return;
2871
3248
  }
2872
3249
  const { parentFileId, ownerId } = parentInfo;
2873
- const specificParentData = JSON.parse(JSON.stringify(graphDataRef.current[parentFileId]));
2874
- const nodeIndex = specificParentData.nodes.findIndex((n) => String(n.id) === String(nodeToSave.id));
3250
+ const specificParentData = JSON.parse(
3251
+ JSON.stringify(graphDataRef.current[parentFileId])
3252
+ );
3253
+ const nodeIndex = specificParentData.nodes.findIndex(
3254
+ (n) => String(n.id) === String(nodeToSave.id)
3255
+ );
2875
3256
  if (nodeIndex === -1) {
2876
- console.error("Node n\xE3o encontrado nos dados do parent para atualiza\xE7\xE3o:", nodeToSave.id);
3257
+ console.error(
3258
+ "Node n\xE3o encontrado nos dados do parent para atualiza\xE7\xE3o:",
3259
+ nodeToSave.id
3260
+ );
2877
3261
  alert("Erro interno: Node n\xE3o encontrado para salvar.");
2878
3262
  return;
2879
3263
  }
@@ -2881,7 +3265,9 @@ var userActionHandlers = {
2881
3265
  const isNewDone = oldNode.status !== "Done" && nodeToSave.status === "Done";
2882
3266
  specificParentData.nodes[nodeIndex] = { ...nodeToSave };
2883
3267
  if (isNewDone && nodeToSave.is_quest && ((_a = nodeToSave.recurrence_config) == null ? void 0 : _a.enabled)) {
2884
- const nextDateObj = calculateNextRecurrenceDate(nodeToSave.recurrence_config);
3268
+ const nextDateObj = calculateNextRecurrenceDate(
3269
+ nodeToSave.recurrence_config
3270
+ );
2885
3271
  if (nextDateObj) {
2886
3272
  const currentCounter = sceneDataRef.current.quest_counter || 1;
2887
3273
  const usedCounter = currentCounter;
@@ -2911,21 +3297,26 @@ var userActionHandlers = {
2911
3297
  // QUEST_STATUS_COLORS["Backlog"]
2912
3298
  assignee_id: nodeToSave.recurrence_config.next_assignee_id || "",
2913
3299
  Date: nextDateObj,
2914
- timeline: [{
2915
- id: import_short_uuid.default.generate(),
2916
- type: "status_changed",
2917
- timestamp: Date.now(),
2918
- actorId: "system",
2919
- description: `Quest criada automaticamente via recorr\xEAncia a partir da quest #${nodeToSave.id}`,
2920
- links: [],
2921
- images: [],
2922
- metadata: { status: "Backlog" }
2923
- }],
3300
+ timeline: [
3301
+ {
3302
+ id: import_short_uuid.default.generate(),
3303
+ type: "status_changed",
3304
+ timestamp: Date.now(),
3305
+ actorId: "system",
3306
+ description: `Quest criada automaticamente via recorr\xEAncia`,
3307
+ links: [],
3308
+ images: [],
3309
+ metadata: { status: "Backlog" }
3310
+ }
3311
+ ],
2924
3312
  version_node: {
2925
3313
  is_version: true,
2926
3314
  parent_node: ((_b = nodeToSave.version_node) == null ? void 0 : _b.parent_node) || nodeToSave.id
2927
3315
  },
2928
- reviewStack: (nodeToSave.reviewStack || []).map((r) => ({ ...r, status: "pending" })),
3316
+ reviewStack: (nodeToSave.reviewStack || []).map((r) => ({
3317
+ ...r,
3318
+ status: "pending"
3319
+ })),
2929
3320
  recurrence_config: nextRecurrenceConfig
2930
3321
  };
2931
3322
  specificParentData.nodes.push(nextQuestNode);
@@ -2939,7 +3330,9 @@ var userActionHandlers = {
2939
3330
  try {
2940
3331
  const isView = ((_c = context.viewType) == null ? void 0 : _c.toLowerCase()) === "view";
2941
3332
  if (isView && parentFileId === context.sceneConfigId) {
2942
- const visualNodeIndex = sceneDataRef.current.nodes.findIndex((n) => String(n.id) === String(nodeToSave.id));
3333
+ const visualNodeIndex = sceneDataRef.current.nodes.findIndex(
3334
+ (n) => String(n.id) === String(nodeToSave.id)
3335
+ );
2943
3336
  if (visualNodeIndex > -1) {
2944
3337
  sceneDataRef.current.nodes[visualNodeIndex] = {
2945
3338
  ...sceneDataRef.current.nodes[visualNodeIndex],
@@ -2954,10 +3347,16 @@ var userActionHandlers = {
2954
3347
  quest_links: specificParentData.links,
2955
3348
  quest_counter: sceneDataRef.current.quest_counter || 1
2956
3349
  };
2957
- await context.actions.save_view_data(context.sceneSaveUrl, viewFilePayload);
3350
+ await context.actions.save_view_data(
3351
+ context.sceneSaveUrl,
3352
+ viewFilePayload
3353
+ );
2958
3354
  } else {
2959
3355
  const filenameForSpecificParent = `x_view_dbs/${ownerId}/${parentFileId}`;
2960
- await context.actions.save_view_data(filenameForSpecificParent, specificParentData);
3356
+ await context.actions.save_view_data(
3357
+ filenameForSpecificParent,
3358
+ specificParentData
3359
+ );
2961
3360
  }
2962
3361
  graphDataRef.current[parentFileId] = specificParentData;
2963
3362
  updateExistingNodeVisuals(stateRef.current, nodeToSave);
@@ -2975,19 +3374,37 @@ var userActionHandlers = {
2975
3374
  const { graphDataRef, sceneDataRef, stateRef, setters } = context;
2976
3375
  if (!graphDataRef.current || !sceneDataRef.current) return;
2977
3376
  const { sourceNode, targetNode, ...linkToSave } = updatedLink;
2978
- const parentInfo = getParentFileInfoForNode(graphDataRef.current, sceneDataRef.current, linkToSave.source, context.sceneConfigId, context.ownerId);
3377
+ const parentInfo = getParentFileInfoForNode(
3378
+ graphDataRef.current,
3379
+ sceneDataRef.current,
3380
+ linkToSave.source,
3381
+ context.sceneConfigId,
3382
+ context.ownerId
3383
+ );
2979
3384
  if (!parentInfo || !parentInfo.ownerId) {
2980
- console.error("N\xE3o foi poss\xEDvel encontrar as informa\xE7\xF5es do arquivo pai (ou ownerId) para o link a ser atualizado:", linkToSave.id);
2981
- alert("Ocorreu um erro ao identificar o arquivo pai ou seu propriet\xE1rio para atualiza\xE7\xE3o.");
3385
+ console.error(
3386
+ "N\xE3o foi poss\xEDvel encontrar as informa\xE7\xF5es do arquivo pai (ou ownerId) para o link a ser atualizado:",
3387
+ linkToSave.id
3388
+ );
3389
+ alert(
3390
+ "Ocorreu um erro ao identificar o arquivo pai ou seu propriet\xE1rio para atualiza\xE7\xE3o."
3391
+ );
2982
3392
  return;
2983
3393
  }
2984
3394
  const { parentFileId, ownerId } = parentInfo;
2985
- const specificParentData = JSON.parse(JSON.stringify(graphDataRef.current[parentFileId]));
2986
- const linkIndex = specificParentData.links.findIndex((l) => String(l.id) === String(linkToSave.id));
3395
+ const specificParentData = JSON.parse(
3396
+ JSON.stringify(graphDataRef.current[parentFileId])
3397
+ );
3398
+ const linkIndex = specificParentData.links.findIndex(
3399
+ (l) => String(l.id) === String(linkToSave.id)
3400
+ );
2987
3401
  if (linkIndex > -1) {
2988
3402
  specificParentData.links[linkIndex] = linkToSave;
2989
3403
  } else {
2990
- console.error("Link n\xE3o encontrado nos dados do parent para atualiza\xE7\xE3o:", linkToSave.id);
3404
+ console.error(
3405
+ "Link n\xE3o encontrado nos dados do parent para atualiza\xE7\xE3o:",
3406
+ linkToSave.id
3407
+ );
2991
3408
  alert("Erro interno: link n\xE3o encontrado para salvar.");
2992
3409
  return;
2993
3410
  }
@@ -3002,10 +3419,16 @@ var userActionHandlers = {
3002
3419
  quest_links: specificParentData.links,
3003
3420
  quest_counter: sceneDataRef.current.quest_counter || 1
3004
3421
  };
3005
- await context.actions.save_view_data(context.sceneSaveUrl, viewFilePayload);
3422
+ await context.actions.save_view_data(
3423
+ context.sceneSaveUrl,
3424
+ viewFilePayload
3425
+ );
3006
3426
  } else {
3007
3427
  const filenameForSpecificParent = `x_view_dbs/${ownerId}/${parentFileId}`;
3008
- await context.actions.save_view_data(filenameForSpecificParent, specificParentData);
3428
+ await context.actions.save_view_data(
3429
+ filenameForSpecificParent,
3430
+ specificParentData
3431
+ );
3009
3432
  }
3010
3433
  graphDataRef.current[parentFileId] = specificParentData;
3011
3434
  const lineObject = stateRef.current.allLinks.find(
@@ -3035,7 +3458,9 @@ var userActionHandlers = {
3035
3458
  const graphFull = graphDataRef.current;
3036
3459
  if (!graphFull) return;
3037
3460
  const strNodeId = String(nodeId);
3038
- const allParentNodes = Object.values(graphFull).flatMap((fileData) => fileData.nodes);
3461
+ const allParentNodes = Object.values(graphFull).flatMap(
3462
+ (fileData) => fileData.nodes
3463
+ );
3039
3464
  const nodeData = allParentNodes.find((n) => String(n.id) === strNodeId);
3040
3465
  if (!nodeData) {
3041
3466
  alert("Node n\xE3o encontrado no banco de dados completo.");
@@ -3046,7 +3471,11 @@ var userActionHandlers = {
3046
3471
  return;
3047
3472
  }
3048
3473
  const base = state.controls ? state.controls.target.clone() : new THREE.Vector3(0, 0, 0);
3049
- const offset = new THREE.Vector3((Math.random() - 0.5) * 20, (Math.random() - 0.5) * 6, (Math.random() - 0.5) * 20);
3474
+ const offset = new THREE.Vector3(
3475
+ (Math.random() - 0.5) * 20,
3476
+ (Math.random() - 0.5) * 6,
3477
+ (Math.random() - 0.5) * 20
3478
+ );
3050
3479
  const position = base.add(offset);
3051
3480
  addStandaloneNodeToScene(state, nodeData, position);
3052
3481
  tweenToTarget(position, 1.3);
@@ -9211,26 +9640,17 @@ function InSceneQuestForm({
9211
9640
  "button",
9212
9641
  {
9213
9642
  type: "button",
9214
- onClick: () => setQuestDate({ type: "Data", value: "" }),
9643
+ onClick: () => setQuestDate({ type: "Data", value: "", confirmed: false }),
9215
9644
  className: "text-[10px] text-indigo-400 hover:text-indigo-300 font-bold uppercase transition-colors"
9216
9645
  },
9217
9646
  "+ Adicionar"
9218
- )), questDate && /* @__PURE__ */ import_react17.default.createElement("div", { className: "p-3 bg-slate-900/60 rounded-xl border border-white/10 space-y-3 relative group" }, /* @__PURE__ */ import_react17.default.createElement(
9219
- "button",
9220
- {
9221
- type: "button",
9222
- onClick: () => setQuestDate(null),
9223
- className: "absolute top-2 right-2 w-6 h-6 grid place-items-center rounded-full bg-red-500/10 text-red-400 opacity-0 group-hover:opacity-100 transition-opacity",
9224
- title: "Remover data"
9225
- },
9226
- /* @__PURE__ */ import_react17.default.createElement(import_fi15.FiX, { size: 12 })
9227
- ), /* @__PURE__ */ import_react17.default.createElement("div", { className: "flex items-center gap-1 rounded-lg bg-slate-800/50 p-1" }, ["Data", "Ano", "Date Interval"].map((t) => /* @__PURE__ */ import_react17.default.createElement(
9647
+ )), questDate && /* @__PURE__ */ import_react17.default.createElement("div", { className: "p-3 bg-slate-900/60 rounded-xl border border-white/10 space-y-3 relative group" }, /* @__PURE__ */ import_react17.default.createElement("div", { className: "flex items-center justify-between gap-2" }, /* @__PURE__ */ import_react17.default.createElement("div", { className: "flex-1 flex items-center gap-1 rounded-lg bg-slate-800/50 p-1" }, !questDate.confirmed ? ["Data", "Date Interval"].map((t) => /* @__PURE__ */ import_react17.default.createElement(
9228
9648
  "button",
9229
9649
  {
9230
9650
  key: t,
9231
9651
  type: "button",
9232
9652
  onClick: () => {
9233
- const newDate = { type: t };
9653
+ const newDate = { type: t, confirmed: false };
9234
9654
  if (t === "Date Interval") {
9235
9655
  newDate.start = "";
9236
9656
  newDate.end = "";
@@ -9242,7 +9662,34 @@ function InSceneQuestForm({
9242
9662
  className: `flex-1 text-[10px] px-2 py-1.5 rounded-md transition-colors ${questDate.type === t ? "bg-indigo-600 text-white font-semibold shadow" : "text-slate-400 hover:bg-slate-700/50"}`
9243
9663
  },
9244
9664
  t === "Date Interval" ? "Intervalo" : t
9245
- ))), questDate.type === "Data" && /* @__PURE__ */ import_react17.default.createElement(
9665
+ )) : /* @__PURE__ */ import_react17.default.createElement("div", { className: "flex-1 flex items-center gap-2 px-2 py-1.5" }, /* @__PURE__ */ import_react17.default.createElement(import_fi15.FiCalendar, { className: "text-indigo-400", size: 12 }), /* @__PURE__ */ import_react17.default.createElement("span", { className: "text-xs font-medium text-slate-200" }, questDate.type === "Data" ? questDate.value || "Sem data" : `${questDate.start || "In\xEDcio"} - ${questDate.end || "Fim"}`))), /* @__PURE__ */ import_react17.default.createElement("div", { className: "flex items-center gap-1" }, !questDate.confirmed ? /* @__PURE__ */ import_react17.default.createElement(
9666
+ "button",
9667
+ {
9668
+ type: "button",
9669
+ onClick: () => setQuestDate({ ...questDate, confirmed: true }),
9670
+ className: "w-8 h-8 grid place-items-center rounded-lg bg-green-500/10 text-green-400 hover:bg-green-500/20 transition-colors",
9671
+ title: "Confirmar data"
9672
+ },
9673
+ /* @__PURE__ */ import_react17.default.createElement(import_fi15.FiCheck, { size: 14 })
9674
+ ) : /* @__PURE__ */ import_react17.default.createElement(
9675
+ "button",
9676
+ {
9677
+ type: "button",
9678
+ onClick: () => setQuestDate({ ...questDate, confirmed: false }),
9679
+ className: "w-8 h-8 grid place-items-center rounded-lg bg-indigo-500/10 text-indigo-400 hover:bg-indigo-500/20 transition-colors",
9680
+ title: "Editar data"
9681
+ },
9682
+ /* @__PURE__ */ import_react17.default.createElement(import_fi15.FiEdit2, { size: 14 })
9683
+ ), /* @__PURE__ */ import_react17.default.createElement(
9684
+ "button",
9685
+ {
9686
+ type: "button",
9687
+ onClick: () => setQuestDate(null),
9688
+ className: "w-8 h-8 grid place-items-center rounded-lg bg-red-500/10 text-red-400 hover:bg-red-500/20 transition-colors",
9689
+ title: "Remover data"
9690
+ },
9691
+ /* @__PURE__ */ import_react17.default.createElement(import_fi15.FiX, { size: 14 })
9692
+ ))), !questDate.confirmed && /* @__PURE__ */ import_react17.default.createElement("div", { className: "animate-in fade-in slide-in-from-top-1 duration-200" }, questDate.type === "Data" && /* @__PURE__ */ import_react17.default.createElement(
9246
9693
  "input",
9247
9694
  {
9248
9695
  type: "text",
@@ -9262,34 +9709,47 @@ function InSceneQuestForm({
9262
9709
  maxLength: "10",
9263
9710
  className: "w-full bg-slate-800/70 p-2 text-sm rounded-lg border border-white/10 focus:outline-none focus:ring-1 focus:ring-indigo-400/60"
9264
9711
  }
9265
- ), questDate.type === "Ano" && /* @__PURE__ */ import_react17.default.createElement(
9266
- "input",
9267
- {
9268
- type: "number",
9269
- placeholder: "AAAA",
9270
- value: questDate.value || "",
9271
- onChange: (e) => setQuestDate({ ...questDate, value: e.target.value }),
9272
- className: "w-full bg-slate-800/70 p-2 text-sm rounded-lg border border-white/10 focus:outline-none focus:ring-1 focus:ring-indigo-400/60 [appearance:textfield] [&::-webkit-outer-spin-button]:appearance-none [&::-webkit-inner-spin-button]:appearance-none"
9273
- }
9274
9712
  ), questDate.type === "Date Interval" && /* @__PURE__ */ import_react17.default.createElement("div", { className: "flex items-center gap-2" }, /* @__PURE__ */ import_react17.default.createElement(
9275
9713
  "input",
9276
9714
  {
9277
- type: "number",
9278
- placeholder: "In\xEDcio (Ano)",
9715
+ type: "text",
9716
+ placeholder: "In\xEDcio (DD/MM/AAAA)",
9279
9717
  value: questDate.start || "",
9280
- onChange: (e) => setQuestDate({ ...questDate, start: e.target.value }),
9281
- className: "flex-1 bg-slate-800/70 p-2 text-sm rounded-lg border border-white/10 focus:outline-none focus:ring-1 focus:ring-indigo-400/60 [appearance:textfield] [&::-webkit-outer-spin-button]:appearance-none [&::-webkit-inner-spin-button]:appearance-none"
9718
+ onChange: (e) => {
9719
+ const rawValue = e.target.value;
9720
+ const digits = rawValue.replace(/\D/g, "");
9721
+ const len = digits.length;
9722
+ let formattedValue = digits;
9723
+ if (len > 2 && len <= 4)
9724
+ formattedValue = `${digits.slice(0, 2)}/${digits.slice(2)}`;
9725
+ else if (len > 4)
9726
+ formattedValue = `${digits.slice(0, 2)}/${digits.slice(2, 4)}/${digits.slice(4, 8)}`;
9727
+ setQuestDate({ ...questDate, start: formattedValue });
9728
+ },
9729
+ maxLength: "10",
9730
+ className: "flex-1 bg-slate-800/70 p-2 text-xs rounded-lg border border-white/10 focus:outline-none focus:ring-1 focus:ring-indigo-400/60"
9282
9731
  }
9283
9732
  ), /* @__PURE__ */ import_react17.default.createElement("span", { className: "text-slate-500" }, "-"), /* @__PURE__ */ import_react17.default.createElement(
9284
9733
  "input",
9285
9734
  {
9286
- type: "number",
9287
- placeholder: "Fim (Ano)",
9735
+ type: "text",
9736
+ placeholder: "Fim (DD/MM/AAAA)",
9288
9737
  value: questDate.end || "",
9289
- onChange: (e) => setQuestDate({ ...questDate, end: e.target.value }),
9290
- className: "flex-1 bg-slate-800/70 p-2 text-sm rounded-lg border border-white/10 focus:outline-none focus:ring-1 focus:ring-indigo-400/60 [appearance:textfield] [&::-webkit-outer-spin-button]:appearance-none [&::-webkit-inner-spin-button]:appearance-none"
9738
+ onChange: (e) => {
9739
+ const rawValue = e.target.value;
9740
+ const digits = rawValue.replace(/\D/g, "");
9741
+ const len = digits.length;
9742
+ let formattedValue = digits;
9743
+ if (len > 2 && len <= 4)
9744
+ formattedValue = `${digits.slice(0, 2)}/${digits.slice(2)}`;
9745
+ else if (len > 4)
9746
+ formattedValue = `${digits.slice(0, 2)}/${digits.slice(2, 4)}/${digits.slice(4, 8)}`;
9747
+ setQuestDate({ ...questDate, end: formattedValue });
9748
+ },
9749
+ maxLength: "10",
9750
+ className: "flex-1 bg-slate-800/70 p-2 text-xs rounded-lg border border-white/10 focus:outline-none focus:ring-1 focus:ring-indigo-400/60"
9291
9751
  }
9292
- )))), /* @__PURE__ */ import_react17.default.createElement("div", { className: "pt-4 border-t border-white/5 mt-2" }, /* @__PURE__ */ import_react17.default.createElement("div", { className: "flex items-center justify-between mb-3" }, /* @__PURE__ */ import_react17.default.createElement("div", { className: "flex items-center gap-2" }, /* @__PURE__ */ import_react17.default.createElement(import_fi15.FiRepeat, { className: `w-3.5 h-3.5 ${recurrenceConfig.enabled ? "text-indigo-400" : "text-slate-500"}` }), /* @__PURE__ */ import_react17.default.createElement("span", { className: "text-xs text-slate-300 font-medium uppercase tracking-wider" }, "Recorr\xEAncia")), /* @__PURE__ */ import_react17.default.createElement(
9752
+ ))))), /* @__PURE__ */ import_react17.default.createElement("div", { className: "pt-4 border-t border-white/5 mt-2" }, /* @__PURE__ */ import_react17.default.createElement("div", { className: "flex items-center justify-between mb-3" }, /* @__PURE__ */ import_react17.default.createElement("div", { className: "flex items-center gap-2" }, /* @__PURE__ */ import_react17.default.createElement(import_fi15.FiRepeat, { className: `w-3.5 h-3.5 ${recurrenceConfig.enabled ? "text-indigo-400" : "text-slate-500"}` }), /* @__PURE__ */ import_react17.default.createElement("span", { className: "text-xs text-slate-300 font-medium uppercase tracking-wider" }, "Recorr\xEAncia")), /* @__PURE__ */ import_react17.default.createElement(
9293
9753
  "button",
9294
9754
  {
9295
9755
  type: "button",
@@ -10557,31 +11017,19 @@ ${noteText}` : noteText : entry.notes,
10557
11017
  {
10558
11018
  type: "button",
10559
11019
  onClick: () => {
10560
- setQuestDate({ type: "Data", value: "" });
11020
+ setQuestDate({ type: "Data", value: "", confirmed: false });
10561
11021
  setHasUnsavedChanges(true);
10562
11022
  },
10563
11023
  className: "text-[10px] text-indigo-400 hover:text-indigo-300 font-bold uppercase transition-colors"
10564
11024
  },
10565
11025
  "+ Adicionar"
10566
- )), questDate && /* @__PURE__ */ import_react20.default.createElement("div", { className: "p-3 bg-slate-900/60 rounded-xl border border-white/10 space-y-3 relative group" }, canEdit && /* @__PURE__ */ import_react20.default.createElement(
10567
- "button",
10568
- {
10569
- type: "button",
10570
- onClick: () => {
10571
- setQuestDate(null);
10572
- setHasUnsavedChanges(true);
10573
- },
10574
- className: "absolute top-2 right-2 w-6 h-6 grid place-items-center rounded-full bg-red-500/10 text-red-400 opacity-0 group-hover:opacity-100 transition-opacity",
10575
- title: "Remover data"
10576
- },
10577
- /* @__PURE__ */ import_react20.default.createElement(import_fi18.FiX, { size: 12 })
10578
- ), /* @__PURE__ */ import_react20.default.createElement("div", { className: `flex items-center gap-1 rounded-lg bg-slate-800/50 p-1 ${!canEdit ? "opacity-70 pointer-events-none" : ""}` }, ["Data", "Ano", "Date Interval"].map((t) => /* @__PURE__ */ import_react20.default.createElement(
11026
+ )), questDate && /* @__PURE__ */ import_react20.default.createElement("div", { className: "p-3 bg-slate-900/60 rounded-xl border border-white/10 space-y-3 relative group" }, /* @__PURE__ */ import_react20.default.createElement("div", { className: "flex items-center justify-between gap-2" }, /* @__PURE__ */ import_react20.default.createElement("div", { className: `flex-1 flex items-center gap-1 rounded-lg bg-slate-800/50 p-1 ${!canEdit ? "opacity-70 pointer-events-none" : ""}` }, !questDate.confirmed ? ["Data", "Date Interval"].map((t) => /* @__PURE__ */ import_react20.default.createElement(
10579
11027
  "button",
10580
11028
  {
10581
11029
  key: t,
10582
11030
  type: "button",
10583
11031
  onClick: () => {
10584
- const newDate = { type: t };
11032
+ const newDate = { type: t, confirmed: false };
10585
11033
  if (t === "Date Interval") {
10586
11034
  newDate.start = "";
10587
11035
  newDate.end = "";
@@ -10594,11 +11042,46 @@ ${noteText}` : noteText : entry.notes,
10594
11042
  className: `flex-1 text-[10px] px-2 py-1.5 rounded-md transition-colors ${questDate.type === t ? "bg-indigo-600 text-white font-semibold shadow" : "text-slate-400 hover:bg-slate-700/50"}`
10595
11043
  },
10596
11044
  t === "Date Interval" ? "Intervalo" : t
10597
- ))), questDate.type === "Data" && /* @__PURE__ */ import_react20.default.createElement(
11045
+ )) : /* @__PURE__ */ import_react20.default.createElement("div", { className: "flex-1 flex items-center gap-2 px-2 py-1.5" }, /* @__PURE__ */ import_react20.default.createElement(import_fi18.FiCalendar, { className: "text-indigo-400", size: 12 }), /* @__PURE__ */ import_react20.default.createElement("span", { className: "text-xs font-medium text-slate-200" }, questDate.type === "Data" ? questDate.value || "Sem data" : `${questDate.start || "In\xEDcio"} - ${questDate.end || "Fim"}`))), canEdit && /* @__PURE__ */ import_react20.default.createElement("div", { className: "flex items-center gap-1" }, !questDate.confirmed ? /* @__PURE__ */ import_react20.default.createElement(
11046
+ "button",
11047
+ {
11048
+ type: "button",
11049
+ onClick: () => {
11050
+ setQuestDate({ ...questDate, confirmed: true });
11051
+ setHasUnsavedChanges(true);
11052
+ },
11053
+ className: "w-8 h-8 grid place-items-center rounded-lg bg-green-500/10 text-green-400 hover:bg-green-500/20 transition-colors",
11054
+ title: "Confirmar data"
11055
+ },
11056
+ /* @__PURE__ */ import_react20.default.createElement(import_fi18.FiCheck, { size: 14 })
11057
+ ) : /* @__PURE__ */ import_react20.default.createElement(
11058
+ "button",
11059
+ {
11060
+ type: "button",
11061
+ onClick: () => {
11062
+ setQuestDate({ ...questDate, confirmed: false });
11063
+ setHasUnsavedChanges(true);
11064
+ },
11065
+ className: "w-8 h-8 grid place-items-center rounded-lg bg-indigo-500/10 text-indigo-400 hover:bg-indigo-500/20 transition-colors",
11066
+ title: "Editar data"
11067
+ },
11068
+ /* @__PURE__ */ import_react20.default.createElement(import_fi18.FiEdit2, { size: 14 })
11069
+ ), /* @__PURE__ */ import_react20.default.createElement(
11070
+ "button",
11071
+ {
11072
+ type: "button",
11073
+ onClick: () => {
11074
+ setQuestDate(null);
11075
+ setHasUnsavedChanges(true);
11076
+ },
11077
+ className: "w-8 h-8 grid place-items-center rounded-lg bg-red-500/10 text-red-400 hover:bg-red-500/20 transition-colors",
11078
+ title: "Remover data"
11079
+ },
11080
+ /* @__PURE__ */ import_react20.default.createElement(import_fi18.FiX, { size: 14 })
11081
+ ))), !questDate.confirmed && canEdit && /* @__PURE__ */ import_react20.default.createElement("div", { className: "animate-in fade-in slide-in-from-top-1 duration-200" }, questDate.type === "Data" && /* @__PURE__ */ import_react20.default.createElement(
10598
11082
  "input",
10599
11083
  {
10600
11084
  type: "text",
10601
- readOnly: !canEdit,
10602
11085
  placeholder: "DD/MM/AAAA",
10603
11086
  value: questDate.value || "",
10604
11087
  onChange: (e) => {
@@ -10614,48 +11097,51 @@ ${noteText}` : noteText : entry.notes,
10614
11097
  setHasUnsavedChanges(true);
10615
11098
  },
10616
11099
  maxLength: "10",
10617
- className: `w-full bg-slate-800/70 p-2 text-sm rounded-lg border border-white/10 focus:outline-none ${canEdit ? "focus:ring-1 focus:ring-indigo-400/60" : "text-slate-400 cursor-default"}`
10618
- }
10619
- ), questDate.type === "Ano" && /* @__PURE__ */ import_react20.default.createElement(
10620
- "input",
10621
- {
10622
- type: "number",
10623
- readOnly: !canEdit,
10624
- placeholder: "AAAA",
10625
- value: questDate.value || "",
10626
- onChange: (e) => {
10627
- setQuestDate({ ...questDate, value: e.target.value });
10628
- setHasUnsavedChanges(true);
10629
- },
10630
- className: `w-full bg-slate-800/70 p-2 text-sm rounded-lg border border-white/10 focus:outline-none [appearance:textfield] [&::-webkit-outer-spin-button]:appearance-none [&::-webkit-inner-spin-button]:appearance-none ${canEdit ? "focus:ring-1 focus:ring-indigo-400/60" : "text-slate-400 cursor-default"}`
11100
+ className: "w-full bg-slate-800/70 p-2 text-sm rounded-lg border border-white/10 focus:outline-none focus:ring-1 focus:ring-indigo-400/60"
10631
11101
  }
10632
11102
  ), questDate.type === "Date Interval" && /* @__PURE__ */ import_react20.default.createElement("div", { className: "flex items-center gap-2" }, /* @__PURE__ */ import_react20.default.createElement(
10633
11103
  "input",
10634
11104
  {
10635
- type: "number",
10636
- readOnly: !canEdit,
10637
- placeholder: "In\xEDcio (Ano)",
11105
+ type: "text",
11106
+ placeholder: "In\xEDcio (DD/MM/AAAA)",
10638
11107
  value: questDate.start || "",
10639
11108
  onChange: (e) => {
10640
- setQuestDate({ ...questDate, start: e.target.value });
11109
+ const rawValue = e.target.value;
11110
+ const digits = rawValue.replace(/\D/g, "");
11111
+ const len = digits.length;
11112
+ let formattedValue = digits;
11113
+ if (len > 2 && len <= 4)
11114
+ formattedValue = `${digits.slice(0, 2)}/${digits.slice(2)}`;
11115
+ else if (len > 4)
11116
+ formattedValue = `${digits.slice(0, 2)}/${digits.slice(2, 4)}/${digits.slice(4, 8)}`;
11117
+ setQuestDate({ ...questDate, start: formattedValue });
10641
11118
  setHasUnsavedChanges(true);
10642
11119
  },
10643
- className: `flex-1 bg-slate-800/70 p-2 text-sm rounded-lg border border-white/10 focus:outline-none [appearance:textfield] [&::-webkit-outer-spin-button]:appearance-none [&::-webkit-inner-spin-button]:appearance-none ${canEdit ? "focus:ring-1 focus:ring-indigo-400/60" : "text-slate-400 cursor-default"}`
11120
+ maxLength: "10",
11121
+ className: "flex-1 bg-slate-800/70 p-2 text-xs rounded-lg border border-white/10 focus:outline-none focus:ring-1 focus:ring-indigo-400/60"
10644
11122
  }
10645
11123
  ), /* @__PURE__ */ import_react20.default.createElement("span", { className: "text-slate-500" }, "-"), /* @__PURE__ */ import_react20.default.createElement(
10646
11124
  "input",
10647
11125
  {
10648
- type: "number",
10649
- readOnly: !canEdit,
10650
- placeholder: "Fim (Ano)",
11126
+ type: "text",
11127
+ placeholder: "Fim (DD/MM/AAAA)",
10651
11128
  value: questDate.end || "",
10652
11129
  onChange: (e) => {
10653
- setQuestDate({ ...questDate, end: e.target.value });
11130
+ const rawValue = e.target.value;
11131
+ const digits = rawValue.replace(/\D/g, "");
11132
+ const len = digits.length;
11133
+ let formattedValue = digits;
11134
+ if (len > 2 && len <= 4)
11135
+ formattedValue = `${digits.slice(0, 2)}/${digits.slice(2)}`;
11136
+ else if (len > 4)
11137
+ formattedValue = `${digits.slice(0, 2)}/${digits.slice(2, 4)}/${digits.slice(4, 8)}`;
11138
+ setQuestDate({ ...questDate, end: formattedValue });
10654
11139
  setHasUnsavedChanges(true);
10655
11140
  },
10656
- className: `flex-1 bg-slate-800/70 p-2 text-sm rounded-lg border border-white/10 focus:outline-none [appearance:textfield] [&::-webkit-outer-spin-button]:appearance-none [&::-webkit-inner-spin-button]:appearance-none ${canEdit ? "focus:ring-1 focus:ring-indigo-400/60" : "text-slate-400 cursor-default"}`
11141
+ maxLength: "10",
11142
+ className: "flex-1 bg-slate-800/70 p-2 text-xs rounded-lg border border-white/10 focus:outline-none focus:ring-1 focus:ring-indigo-400/60"
10657
11143
  }
10658
- )))), /* @__PURE__ */ import_react20.default.createElement("div", { className: "space-y-1.5 relative mt-2" }, /* @__PURE__ */ import_react20.default.createElement("label", { className: "text-xs text-slate-300" }, "Status da Quest"), /* @__PURE__ */ import_react20.default.createElement("div", { className: "relative" }, /* @__PURE__ */ import_react20.default.createElement(
11144
+ ))))), /* @__PURE__ */ import_react20.default.createElement("div", { className: "space-y-1.5 relative mt-2" }, /* @__PURE__ */ import_react20.default.createElement("label", { className: "text-xs text-slate-300" }, "Status da Quest"), /* @__PURE__ */ import_react20.default.createElement("div", { className: "relative" }, /* @__PURE__ */ import_react20.default.createElement(
10659
11145
  "button",
10660
11146
  {
10661
11147
  type: "button",