ryugi-artifacts 1.6.1 → 1.7.1

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.
package/dist/server.cjs CHANGED
@@ -47440,13 +47440,13 @@ function $deleteTableRowAtSelection() {
47440
47440
  const columnCount = gridMap[0].length;
47441
47441
  const nextRow = gridMap[focusEndRow + 1];
47442
47442
  const nextRowNode = grid.getChildAtIndex(focusEndRow + 1);
47443
- for (let row = focusEndRow; row >= anchorStartRow; row--) {
47443
+ for (let row2 = focusEndRow; row2 >= anchorStartRow; row2--) {
47444
47444
  for (let column = columnCount - 1; column >= 0; column--) {
47445
47445
  const {
47446
47446
  cell,
47447
47447
  startRow: cellStartRow,
47448
47448
  startColumn: cellStartColumn
47449
- } = gridMap[row][column];
47449
+ } = gridMap[row2][column];
47450
47450
  if (cellStartColumn !== column) {
47451
47451
  continue;
47452
47452
  }
@@ -47457,7 +47457,7 @@ function $deleteTableRowAtSelection() {
47457
47457
  cell.setRowSpan(cell.__rowSpan - overflowRowsCount);
47458
47458
  }
47459
47459
  if (cellStartRow >= anchorStartRow && cellStartRow + cell.__rowSpan - 1 > focusEndRow && // Handle overflow only once
47460
- row === focusEndRow) {
47460
+ row2 === focusEndRow) {
47461
47461
  if (!$isTableRowNode(nextRowNode)) {
47462
47462
  formatDevErrorMessage9(`Expected a TableRowNode`);
47463
47463
  }
@@ -47465,7 +47465,7 @@ function $deleteTableRowAtSelection() {
47465
47465
  for (let columnIndex = 0; columnIndex < column; columnIndex++) {
47466
47466
  const currentCellMap = nextRow[columnIndex];
47467
47467
  const currentCell = currentCellMap.cell;
47468
- if (currentCellMap.startRow === row + 1) {
47468
+ if (currentCellMap.startRow === row2 + 1) {
47469
47469
  insertAfterCell = currentCell;
47470
47470
  }
47471
47471
  if (currentCell.__colSpan > 1) {
@@ -47479,9 +47479,9 @@ function $deleteTableRowAtSelection() {
47479
47479
  }
47480
47480
  }
47481
47481
  }
47482
- const rowNode = grid.getChildAtIndex(row);
47482
+ const rowNode = grid.getChildAtIndex(row2);
47483
47483
  if (!$isTableRowNode(rowNode)) {
47484
- formatDevErrorMessage9(`Expected TableNode childAtIndex(${String(row)}) to be RowNode`);
47484
+ formatDevErrorMessage9(`Expected TableNode childAtIndex(${String(row2)}) to be RowNode`);
47485
47485
  }
47486
47486
  rowNode.remove();
47487
47487
  }
@@ -47526,12 +47526,12 @@ function $deleteTableColumnAtSelection() {
47526
47526
  return;
47527
47527
  }
47528
47528
  const rowCount = gridMap.length;
47529
- for (let row = 0; row < rowCount; row++) {
47529
+ for (let row2 = 0; row2 < rowCount; row2++) {
47530
47530
  for (let column = startColumn; column <= endColumn; column++) {
47531
47531
  const {
47532
47532
  cell,
47533
47533
  startColumn: cellStartColumn
47534
- } = gridMap[row][column];
47534
+ } = gridMap[row2][column];
47535
47535
  if (cellStartColumn < startColumn) {
47536
47536
  if (column === startColumn) {
47537
47537
  const overflowLeft = startColumn - cellStartColumn;
@@ -47597,8 +47597,8 @@ function $mergeCells(cellNodes) {
47597
47597
  let minCol = Infinity;
47598
47598
  let maxCol = -Infinity;
47599
47599
  const processedCells = /* @__PURE__ */ new Set();
47600
- for (const row of gridMap) {
47601
- for (const mapCell of row) {
47600
+ for (const row2 of gridMap) {
47601
+ for (const mapCell of row2) {
47602
47602
  if (!mapCell || !mapCell.cell) {
47603
47603
  continue;
47604
47604
  }
@@ -47632,9 +47632,9 @@ function $mergeCells(cellNodes) {
47632
47632
  targetCell.setColSpan(totalColSpan);
47633
47633
  targetCell.setRowSpan(totalRowSpan);
47634
47634
  const seenCells = /* @__PURE__ */ new Set([targetCell.getKey()]);
47635
- for (let row = minRow; row <= maxRow; row++) {
47635
+ for (let row2 = minRow; row2 <= maxRow; row2++) {
47636
47636
  for (let col = minCol; col <= maxCol; col++) {
47637
- const mapCell = gridMap[row][col];
47637
+ const mapCell = gridMap[row2][col];
47638
47638
  if (!mapCell.cell) {
47639
47639
  continue;
47640
47640
  }
@@ -47681,7 +47681,7 @@ function $unmergeCell() {
47681
47681
  return $unmergeCellNode(cellNode);
47682
47682
  }
47683
47683
  function $unmergeCellNode(cellNode) {
47684
- const [cell, row, grid] = $getNodeTriplet(cellNode);
47684
+ const [cell, row2, grid] = $getNodeTriplet(cellNode);
47685
47685
  const colSpan = cell.__colSpan;
47686
47686
  const rowSpan = cell.__rowSpan;
47687
47687
  if (colSpan === 1 && rowSpan === 1) {
@@ -47724,7 +47724,7 @@ function $unmergeCellNode(cellNode) {
47724
47724
  for (let i6 = 1; i6 < rowSpan; i6++) {
47725
47725
  const currentRow = startRow + i6;
47726
47726
  const currentRowMap = map[currentRow];
47727
- currentRowNode = (currentRowNode || row).getNextSibling();
47727
+ currentRowNode = (currentRowNode || row2).getNextSibling();
47728
47728
  if (!$isTableRowNode(currentRowNode)) {
47729
47729
  formatDevErrorMessage9(`Expected row next sibling to be a row`);
47730
47730
  }
@@ -47767,20 +47767,20 @@ function $computeTableMapSkipCellCheck(tableNode, cellA, cellB) {
47767
47767
  let cellAValue = null;
47768
47768
  let cellBValue = null;
47769
47769
  function getMapRow(i6) {
47770
- let row = tableMap[i6];
47771
- if (row === void 0) {
47772
- tableMap[i6] = row = [];
47770
+ let row2 = tableMap[i6];
47771
+ if (row2 === void 0) {
47772
+ tableMap[i6] = row2 = [];
47773
47773
  }
47774
- return row;
47774
+ return row2;
47775
47775
  }
47776
47776
  const gridChildren = tableNode.getChildren();
47777
47777
  for (let rowIdx = 0; rowIdx < gridChildren.length; rowIdx++) {
47778
- const row = gridChildren[rowIdx];
47779
- if (!$isTableRowNode(row)) {
47778
+ const row2 = gridChildren[rowIdx];
47779
+ if (!$isTableRowNode(row2)) {
47780
47780
  formatDevErrorMessage9(`Expected TableNode children to be TableRowNode`);
47781
47781
  }
47782
47782
  const startMapRow = getMapRow(rowIdx);
47783
- for (let cell = row.getFirstChild(), colIdx = 0; cell != null; cell = cell.getNextSibling()) {
47783
+ for (let cell = row2.getFirstChild(), colIdx = 0; cell != null; cell = cell.getNextSibling()) {
47784
47784
  if (!$isTableCellNode(cell)) {
47785
47785
  formatDevErrorMessage9(`Expected TableRowNode children to be TableCellNode`);
47786
47786
  }
@@ -47832,15 +47832,15 @@ function $getNodeTriplet(source) {
47832
47832
  }
47833
47833
  cell = cell_;
47834
47834
  }
47835
- const row = cell.getParent();
47836
- if (!$isTableRowNode(row)) {
47835
+ const row2 = cell.getParent();
47836
+ if (!$isTableRowNode(row2)) {
47837
47837
  formatDevErrorMessage9(`Expected TableCellNode to have a parent TableRowNode`);
47838
47838
  }
47839
- const grid = row.getParent();
47839
+ const grid = row2.getParent();
47840
47840
  if (!$isTableNode(grid)) {
47841
47841
  formatDevErrorMessage9(`Expected TableRowNode to have a parent TableNode`);
47842
47842
  }
47843
- return [cell, row, grid];
47843
+ return [cell, row2, grid];
47844
47844
  }
47845
47845
  function $computeTableCellRectSpans(map, boundary) {
47846
47846
  const {
@@ -47859,9 +47859,9 @@ function $computeTableCellRectSpans(map, boundary) {
47859
47859
  topSpan = Math.max(topSpan, topRow[col].cell.__rowSpan);
47860
47860
  bottomSpan = Math.max(bottomSpan, bottomRow[col].cell.__rowSpan);
47861
47861
  }
47862
- for (let row = minRow; row <= maxRow; row++) {
47863
- leftSpan = Math.max(leftSpan, map[row][minColumn].cell.__colSpan);
47864
- rightSpan = Math.max(rightSpan, map[row][maxColumn].cell.__colSpan);
47862
+ for (let row2 = minRow; row2 <= maxRow; row2++) {
47863
+ leftSpan = Math.max(leftSpan, map[row2][minColumn].cell.__colSpan);
47864
+ rightSpan = Math.max(rightSpan, map[row2][maxColumn].cell.__colSpan);
47865
47865
  }
47866
47866
  return {
47867
47867
  bottomSpan,
@@ -47878,9 +47878,9 @@ function $computeTableCellRectBoundary(map, cellAMap, cellBMap) {
47878
47878
  let hasChanges;
47879
47879
  do {
47880
47880
  hasChanges = false;
47881
- for (let row = 0; row < map.length; row++) {
47881
+ for (let row2 = 0; row2 < map.length; row2++) {
47882
47882
  for (let col = 0; col < map[0].length; col++) {
47883
- const cell = map[row][col];
47883
+ const cell = map[row2][col];
47884
47884
  if (!cell) {
47885
47885
  continue;
47886
47886
  }
@@ -47914,17 +47914,17 @@ function $computeTableCellRectBoundary(map, cellAMap, cellBMap) {
47914
47914
  function $isSimpleTable(table) {
47915
47915
  const rows = table.getChildren();
47916
47916
  let columns = null;
47917
- for (const row of rows) {
47918
- if (!$isTableRowNode(row)) {
47917
+ for (const row2 of rows) {
47918
+ if (!$isTableRowNode(row2)) {
47919
47919
  return false;
47920
47920
  }
47921
47921
  if (columns === null) {
47922
- columns = row.getChildrenSize();
47922
+ columns = row2.getChildrenSize();
47923
47923
  }
47924
- if (row.getChildrenSize() !== columns) {
47924
+ if (row2.getChildrenSize() !== columns) {
47925
47925
  return false;
47926
47926
  }
47927
- const cells = row.getChildren();
47927
+ const cells = row2.getChildren();
47928
47928
  for (const cell of cells) {
47929
47929
  if (!$isTableCellNode(cell) || cell.getRowSpan() !== 1 || cell.getColSpan() !== 1) {
47930
47930
  return false;
@@ -47945,11 +47945,11 @@ function $moveTableColumn(tableNode, originColumn, targetColumn) {
47945
47945
  return;
47946
47946
  }
47947
47947
  const rows = tableNode.getChildren().filter($isTableRowNode);
47948
- rows.forEach((row) => {
47949
- const cells = row.getChildren();
47948
+ rows.forEach((row2) => {
47949
+ const cells = row2.getChildren();
47950
47950
  const [moved] = cells.splice(originColumn, 1);
47951
47951
  cells.splice(targetColumn, 0, moved);
47952
- row.splice(0, cells.length, cells);
47952
+ row2.splice(0, cells.length, cells);
47953
47953
  });
47954
47954
  const colWidths = tableNode.getColWidths();
47955
47955
  if (colWidths && colWidths.length === columnCount) {
@@ -47989,8 +47989,8 @@ function $getTableCellNodeRect(tableCellNode) {
47989
47989
  cellMatrix[i6] = new Array(columnCount);
47990
47990
  }
47991
47991
  for (let rowIndex = 0; rowIndex < rowCount; rowIndex++) {
47992
- const row = rows[rowIndex];
47993
- const cells = row.getChildren().filter($isTableCellNode);
47992
+ const row2 = rows[rowIndex];
47993
+ const cells = row2.getChildren().filter($isTableCellNode);
47994
47994
  let columnIndex = 0;
47995
47995
  for (let cellIndex = 0; cellIndex < cells.length; cellIndex++) {
47996
47996
  while (cellMatrix[rowIndex][columnIndex]) {
@@ -48050,9 +48050,9 @@ function $insertTableIntoGrid(tableNode, selection) {
48050
48050
  const lastRowForUnmerge = Math.min(initialRowCount, startRow + affectedRowCount) - 1;
48051
48051
  const lastColForUnmerge = Math.min(initialColCount, startCol + affectedColCount) - 1;
48052
48052
  const unmergedKeys = /* @__PURE__ */ new Set();
48053
- for (let row = startRow; row <= lastRowForUnmerge; row++) {
48053
+ for (let row2 = startRow; row2 <= lastRowForUnmerge; row2++) {
48054
48054
  for (let col = startCol; col <= lastColForUnmerge; col++) {
48055
- const cellMap = initialGridMap[row][col];
48055
+ const cellMap = initialGridMap[row2][col];
48056
48056
  if (unmergedKeys.has(cellMap.cell.getKey())) {
48057
48057
  continue;
48058
48058
  }
@@ -48076,9 +48076,9 @@ function $insertTableIntoGrid(tableNode, selection) {
48076
48076
  $insertTableColumnAtNode(cellMap.cell, true, false);
48077
48077
  }
48078
48078
  [interimGridMap] = $computeTableMapSkipCellCheck(gridNode.getWritable(), null, null);
48079
- for (let row = startRow; row < startRow + affectedRowCount; row++) {
48079
+ for (let row2 = startRow; row2 < startRow + affectedRowCount; row2++) {
48080
48080
  for (let col = startCol; col < startCol + affectedColCount; col++) {
48081
- const templateRow = row - startRow;
48081
+ const templateRow = row2 - startRow;
48082
48082
  const templateCol = col - startCol;
48083
48083
  const templateCellMap = templateGridMap[templateRow][templateCol];
48084
48084
  if (templateCellMap.startRow !== templateRow || templateCellMap.startColumn !== templateCol) {
@@ -48087,9 +48087,9 @@ function $insertTableIntoGrid(tableNode, selection) {
48087
48087
  const templateCell = templateCellMap.cell;
48088
48088
  if (templateCell.__rowSpan !== 1 || templateCell.__colSpan !== 1) {
48089
48089
  const cellsToMerge = [];
48090
- const lastRowForMerge = Math.min(row + templateCell.__rowSpan, startRow + affectedRowCount) - 1;
48090
+ const lastRowForMerge = Math.min(row2 + templateCell.__rowSpan, startRow + affectedRowCount) - 1;
48091
48091
  const lastColForMerge = Math.min(col + templateCell.__colSpan, startCol + affectedColCount) - 1;
48092
- for (let r7 = row; r7 <= lastRowForMerge; r7++) {
48092
+ for (let r7 = row2; r7 <= lastRowForMerge; r7++) {
48093
48093
  for (let c10 = col; c10 <= lastColForMerge; c10++) {
48094
48094
  const cellMap = interimGridMap[r7][c10];
48095
48095
  cellsToMerge.push(cellMap.cell);
@@ -48100,7 +48100,7 @@ function $insertTableIntoGrid(tableNode, selection) {
48100
48100
  }
48101
48101
  const {
48102
48102
  cell
48103
- } = interimGridMap[row][col];
48103
+ } = interimGridMap[row2][col];
48104
48104
  const backgroundColor = templateCell.getBackgroundColor();
48105
48105
  if (backgroundColor !== null && backgroundColor !== void 0) {
48106
48106
  cell.setBackgroundColor(backgroundColor);
@@ -48155,8 +48155,8 @@ function $setTableColumnIsHeader(tableNode, columnIndex, isHeader) {
48155
48155
  }
48156
48156
  const headerState = isHeader ? TableCellHeaderStates.COLUMN : TableCellHeaderStates.NO_STATUS;
48157
48157
  const visited = /* @__PURE__ */ new Set();
48158
- for (let row = 0; row < gridMap.length; row++) {
48159
- const mapCell = gridMap[row][columnIndex];
48158
+ for (let row2 = 0; row2 < gridMap.length; row2++) {
48159
+ const mapCell = gridMap[row2][columnIndex];
48160
48160
  if (mapCell == null) {
48161
48161
  continue;
48162
48162
  }
@@ -48271,9 +48271,9 @@ var TableSelection = class _TableSelection {
48271
48271
  const trimmed = text.endsWith("\n") ? text.slice(0, -1) : text;
48272
48272
  const tsvGrid = trimmed.split("\n").map((line) => line.split(" "));
48273
48273
  const tableNode = $createTableNode();
48274
- for (const row of tsvGrid) {
48274
+ for (const row2 of tsvGrid) {
48275
48275
  const rowNode = $createTableRowNode();
48276
- for (const cellText of row) {
48276
+ for (const cellText of row2) {
48277
48277
  const cellNode = $createTableCellNode(TableCellHeaderStates.NO_STATUS);
48278
48278
  const paragraph = $createParagraphNode2();
48279
48279
  if (cellText) {
@@ -48414,9 +48414,9 @@ var TableSelection = class _TableSelection {
48414
48414
  let textContent3 = "";
48415
48415
  for (let i6 = 0; i6 < nodes.length; i6++) {
48416
48416
  const node = nodes[i6];
48417
- const row = node.__parent;
48417
+ const row2 = node.__parent;
48418
48418
  const nextRow = (nodes[i6 + 1] || {}).__parent;
48419
- textContent3 += node.getTextContent() + (nextRow !== row ? "\n" : " ");
48419
+ textContent3 += node.getTextContent() + (nextRow !== row2 ? "\n" : " ");
48420
48420
  }
48421
48421
  return textContent3;
48422
48422
  }
@@ -49739,11 +49739,11 @@ function getTable(tableNode, dom) {
49739
49739
  y: y5
49740
49740
  };
49741
49741
  currentNode._cell = cell;
49742
- let row = domRows[y5];
49743
- if (row === void 0) {
49744
- row = domRows[y5] = [];
49742
+ let row2 = domRows[y5];
49743
+ if (row2 === void 0) {
49744
+ row2 = domRows[y5] = [];
49745
49745
  }
49746
- row[x9] = cell;
49746
+ row2[x9] = cell;
49747
49747
  } else {
49748
49748
  const child = currentNode.firstChild;
49749
49749
  if (child != null) {
@@ -49793,12 +49793,12 @@ function $forEachTableCell(grid, cb) {
49793
49793
  domRows
49794
49794
  } = grid;
49795
49795
  for (let y5 = 0; y5 < domRows.length; y5++) {
49796
- const row = domRows[y5];
49797
- if (!row) {
49796
+ const row2 = domRows[y5];
49797
+ if (!row2) {
49798
49798
  continue;
49799
49799
  }
49800
- for (let x9 = 0; x9 < row.length; x9++) {
49801
- const cell = row[x9];
49800
+ for (let x9 = 0; x9 < row2.length; x9++) {
49801
+ const cell = row2[x9];
49802
49802
  if (!cell) {
49803
49803
  continue;
49804
49804
  }
@@ -50861,8 +50861,8 @@ var TableNode = class extends ElementNode2 {
50861
50861
  const rows = tableElement.querySelectorAll(":scope > tr");
50862
50862
  if (rows.length > 0) {
50863
50863
  const tBody = $getDocument2().createElement("tbody");
50864
- for (const row of rows) {
50865
- tBody.appendChild(row);
50864
+ for (const row2 of rows) {
50865
+ tBody.appendChild(row2);
50866
50866
  }
50867
50867
  tableElement.append(tBody);
50868
50868
  }
@@ -50883,12 +50883,12 @@ var TableNode = class extends ElementNode2 {
50883
50883
  domRows
50884
50884
  } = table;
50885
50885
  for (let y5 = 0; y5 < rows; y5++) {
50886
- const row = domRows[y5];
50887
- if (row == null) {
50886
+ const row2 = domRows[y5];
50887
+ if (row2 == null) {
50888
50888
  continue;
50889
50889
  }
50890
- for (let x9 = 0; x9 < row.length; x9++) {
50891
- const cell = row[x9];
50890
+ for (let x9 = 0; x9 < row2.length; x9++) {
50891
+ const cell = row2[x9];
50892
50892
  if (cell == null) {
50893
50893
  continue;
50894
50894
  }
@@ -50910,12 +50910,12 @@ var TableNode = class extends ElementNode2 {
50910
50910
  const {
50911
50911
  domRows
50912
50912
  } = table;
50913
- const row = domRows[y5];
50914
- if (row == null) {
50913
+ const row2 = domRows[y5];
50914
+ if (row2 == null) {
50915
50915
  return null;
50916
50916
  }
50917
- const index = x9 < row.length ? x9 : row.length - 1;
50918
- const cell = row[index];
50917
+ const index = x9 < row2.length ? x9 : row2.length - 1;
50918
+ const cell = row2[index];
50919
50919
  if (cell == null) {
50920
50920
  return null;
50921
50921
  }
@@ -51075,8 +51075,8 @@ function $tableRowTransform(node) {
51075
51075
  function $tableTransform(node) {
51076
51076
  $unwrapAndFilterDescendants2(node, $isTableRowNode);
51077
51077
  const [gridMap] = $computeTableMapSkipCellCheck(node, null, null);
51078
- const maxRowLength = gridMap.reduce((curLength, row) => {
51079
- return Math.max(curLength, row.length);
51078
+ const maxRowLength = gridMap.reduce((curLength, row2) => {
51079
+ return Math.max(curLength, row2.length);
51080
51080
  }, 0);
51081
51081
  const rowNodes = node.getChildren();
51082
51082
  for (let i6 = 0; i6 < gridMap.length; ++i6) {
@@ -51169,15 +51169,15 @@ function registerTableCellUnmergeTransform(editor) {
51169
51169
  const [gridMap] = $computeTableMap(gridNode, node, node);
51170
51170
  const rowsCount = gridMap.length;
51171
51171
  const columnsCount = gridMap[0].length;
51172
- let row = gridNode.getFirstChild();
51173
- if (!$isTableRowNode(row)) {
51172
+ let row2 = gridNode.getFirstChild();
51173
+ if (!$isTableRowNode(row2)) {
51174
51174
  formatDevErrorMessage9(`Expected TableNode first child to be a RowNode`);
51175
51175
  }
51176
51176
  const unmerged = [];
51177
51177
  for (let i6 = 0; i6 < rowsCount; i6++) {
51178
51178
  if (i6 !== 0) {
51179
- row = row.getNextSibling();
51180
- if (!$isTableRowNode(row)) {
51179
+ row2 = row2.getNextSibling();
51180
+ if (!$isTableRowNode(row2)) {
51181
51181
  formatDevErrorMessage9(`Expected TableNode first child to be a RowNode`);
51182
51182
  }
51183
51183
  }
@@ -51196,7 +51196,7 @@ function registerTableCellUnmergeTransform(editor) {
51196
51196
  if (lastRowCell !== null) {
51197
51197
  lastRowCell.insertAfter(newCell);
51198
51198
  } else {
51199
- $insertFirst2(row, newCell);
51199
+ $insertFirst2(row2, newCell);
51200
51200
  }
51201
51201
  }
51202
51202
  }
@@ -68210,7 +68210,7 @@ var TABLE_BLOCK_TRANSFORMER = {
68210
68210
  if (!$isTableNode2(node)) return null;
68211
68211
  const rows = node.getChildren().filter($isTableRowNode2);
68212
68212
  if (rows.length === 0) return "| |\n| --- |";
68213
- const data = rows.map((row) => row.getChildren().filter($isTableCellNode2).map((c10) => escCell(c10.getTextContent())));
68213
+ const data = rows.map((row2) => row2.getChildren().filter($isTableCellNode2).map((c10) => escCell(c10.getTextContent())));
68214
68214
  const hdr = data[0];
68215
68215
  const sep = hdr.map(() => "---");
68216
68216
  return [
@@ -84683,167 +84683,91 @@ function updateArtifactConfig(file, key2, patch) {
84683
84683
  // src/server/cloud.ts
84684
84684
  var import_node_crypto3 = __toESM(require("node:crypto"), 1);
84685
84685
 
84686
+ // src/shared/brand.ts
84687
+ var RYUGI_MARK_VIEWBOX = "0 0 512 512";
84688
+ var RYUGI_MARK_BODY = '<g transform="translate(82 136.317460) scale(0.613756614)"><g transform="translate(0.000000,390.000000) scale(0.100000,-0.100000)" stroke="none"><path d="M4945 3889 c-339 -44 -682 -239 -905 -517 -139 -172 -232 -355 -365 -717 -136 -368 -285 -735 -360 -890 -219 -449 -524 -768 -849 -887 -121 -44 -215 -60 -356 -60 -162 0 -244 18 -450 97 -291 111 -420 144 -650 166 -257 24 -637 -19 -772 -87 -148 -75 -249 -247 -235 -399 19 -197 186 -344 392 -346 40 -1 127 11 205 27 115 23 160 28 300 28 242 1 372 -29 671 -155 226 -95 467 -149 662 -149 252 0 548 74 789 197 394 201 708 521 988 1008 83 144 271 529 405 830 220 493 300 632 436 759 121 112 226 162 424 201 44 9 108 29 143 45 165 77 274 285 244 467 -31 188 -168 334 -354 378 -70 16 -249 18 -363 4z M765 3139 c-202 -11 -415 -48 -497 -86 -91 -44 -151 -101 -193 -186 -123 -248 31 -525 307 -554 38 -4 99 3 204 23 137 27 167 29 384 29 205 0 249 -3 347 -23 225 -45 387 -106 658 -247 182 -94 308 -144 463 -182 138 -35 350 -39 447 -9 174 53 275 152 305 299 26 130 -40 267 -158 323 -52 25 -72 28 -227 35 -248 11 -328 37 -576 187 -232 140 -384 213 -585 281 -283 95 -541 127 -879 110z M620 2104 c-273 -32 -384 -65 -471 -143 -235 -208 -136 -589 172 -660 68 -16 129 -13 272 14 400 73 702 31 1167 -163 239 -99 350 -125 535 -125 193 0 338 51 448 157 117 113 139 261 56 375 -50 69 -99 85 -294 92 -245 10 -332 35 -563 163 -224 123 -456 211 -693 262 -111 23 -149 26 -359 29 -129 2 -251 1 -270 -1z"/></g></g>';
84689
+
84686
84690
  // src/server/callback-page.ts
84687
84691
  var CALLBACK_PAGE_CSP = "default-src 'none'; style-src 'unsafe-inline'; img-src data:; script-src 'none'; base-uri 'none'; form-action 'none'; frame-ancestors 'none'";
84688
84692
  var escapeHtml = (value) => value.replace(/[&<>"']/g, (ch) => ({ "&": "&amp;", "<": "&lt;", ">": "&gt;", '"': "&quot;", "'": "&#39;" })[ch]);
84689
- var GRAIN = "data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='160' height='160'><filter id='n'><feTurbulence type='fractalNoise' baseFrequency='.9' numOctaves='2' stitchTiles='stitch'/></filter><rect width='100%' height='100%' filter='url(%23n)'/></svg>";
84693
+ var lucide = (body) => `<svg width="14" height="14" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true">${body}</svg>`;
84694
+ var CIRCLE_CHECK = lucide('<circle cx="12" cy="12" r="10"/><path d="m16 9-5.5 5.5L8 12"/>');
84695
+ var CIRCLE_ALERT = lucide('<circle cx="12" cy="12" r="10"/><line x1="12" x2="12" y1="8" y2="12"/><line x1="12" x2="12.01" y1="16" y2="16"/>');
84696
+ var MARK = `<svg class="logo" width="20" height="20" viewBox="${RYUGI_MARK_VIEWBOX}" fill="currentColor" aria-hidden="true">${RYUGI_MARK_BODY}</svg>`;
84690
84697
  var STYLE2 = `
84691
84698
  :root {
84692
84699
  color-scheme: light dark;
84693
- --paper: #f3ede1;
84694
- --paper-deep: #e8dfcd;
84700
+ --bg: #fafaf9;
84695
84701
  --ink: #1d1a16;
84696
- --ink-soft: #6b6152;
84697
- --rule: #cfc3ab;
84698
- --moon-hi: #fffaf0;
84699
- --moon-mid: #f1e4c6;
84700
- --moon-lo: #d6c19b;
84701
- --halo: rgba(214, 178, 110, 0.35);
84702
- --accent: #9b3d2a;
84703
- --serif: "Iowan Old Style", "Songti SC", "STSong", "Noto Serif CJK SC", "Source Han Serif SC", Georgia, serif;
84702
+ --soft: #6b6152;
84703
+ --faint: #a59f93;
84704
+ --rule: #e6e4de;
84705
+ --name: #c65d3b;
84706
+ --ok: #2f8a4f;
84707
+ --bad: #b4472f;
84704
84708
  --sans: "PingFang SC", "Hiragino Sans GB", "Noto Sans CJK SC", system-ui, sans-serif;
84705
84709
  --mono: ui-monospace, "SF Mono", Menlo, monospace;
84706
84710
  }
84707
84711
  @media (prefers-color-scheme: dark) {
84708
84712
  :root {
84709
- --paper: #0e1222;
84710
- --paper-deep: #070912;
84711
- --ink: #ece6d8;
84712
- --ink-soft: #9a96a8;
84713
- --rule: #2a3050;
84714
- --moon-hi: #fffdf6;
84715
- --moon-mid: #e9dfc6;
84716
- --moon-lo: #b9a985;
84717
- --halo: rgba(233, 214, 160, 0.28);
84718
- --accent: #e08a6d;
84713
+ --bg: #161514;
84714
+ --ink: #ece9e3;
84715
+ --soft: #a8a196;
84716
+ --faint: #6f6a62;
84717
+ --rule: #2c2a27;
84718
+ --name: #e08a6d;
84719
+ --ok: #6cc28a;
84720
+ --bad: #e58a72;
84719
84721
  }
84720
84722
  }
84721
84723
  * { box-sizing: border-box; }
84722
- html, body { height: 100%; margin: 0; }
84724
+ html, body { margin: 0; min-height: 100%; }
84723
84725
  body {
84726
+ min-height: 100vh;
84724
84727
  display: grid;
84725
84728
  place-items: center;
84726
- padding: 32px 20px;
84727
- background: radial-gradient(120% 90% at 18% 20%, var(--paper) 0%, var(--paper-deep) 100%);
84729
+ padding: 72px 20px;
84730
+ background: var(--bg);
84728
84731
  color: var(--ink);
84729
84732
  font-family: var(--sans);
84730
84733
  -webkit-font-smoothing: antialiased;
84731
- overflow: hidden;
84732
84734
  }
84733
- body::before {
84734
- content: "";
84735
+ .mark {
84735
84736
  position: fixed;
84736
- inset: 0;
84737
- background-image: url("${GRAIN}");
84738
- opacity: 0.07;
84739
- mix-blend-mode: multiply;
84740
- pointer-events: none;
84741
- }
84742
- main {
84743
- position: relative;
84744
- display: grid;
84745
- grid-template-columns: auto minmax(0, 360px);
84746
- align-items: center;
84747
- gap: 56px;
84748
- max-width: 760px;
84749
- }
84750
- .sky { position: relative; width: 220px; height: 220px; }
84751
- .moon {
84752
- position: absolute;
84753
- inset: 0;
84754
- border-radius: 50%;
84755
- background:
84756
- radial-gradient(circle at 64% 30%, rgba(0, 0, 0, 0.06) 0 9%, transparent 10%),
84757
- radial-gradient(circle at 34% 62%, rgba(0, 0, 0, 0.05) 0 13%, transparent 14%),
84758
- radial-gradient(circle at 70% 70%, rgba(0, 0, 0, 0.04) 0 6%, transparent 7%),
84759
- radial-gradient(circle at 35% 32%, var(--moon-hi) 0%, var(--moon-mid) 55%, var(--moon-lo) 100%);
84760
- box-shadow: 0 0 0 1px var(--halo), 0 0 80px 18px var(--halo);
84761
- animation: rise 1.1s cubic-bezier(0.2, 0.7, 0.1, 1) both;
84762
- }
84763
- .failed .moon {
84764
- background: transparent;
84765
- box-shadow: inset 34px -14px 0 0 var(--moon-lo), 0 0 0 1px var(--rule);
84766
- opacity: 0.85;
84767
- }
84768
- .vertical {
84769
- position: absolute;
84770
- right: -34px;
84771
- top: 6px;
84772
- writing-mode: vertical-rl;
84773
- font-family: var(--serif);
84774
- font-size: 15px;
84775
- letter-spacing: 0.5em;
84776
- color: var(--ink-soft);
84777
- animation: fade 1s 0.5s both;
84778
- }
84779
- .label {
84737
+ top: 22px;
84738
+ left: 24px;
84780
84739
  display: flex;
84781
84740
  align-items: center;
84782
- gap: 10px;
84783
- margin: 0 0 18px;
84784
- font-family: var(--mono);
84785
- font-size: 11px;
84786
- letter-spacing: 0.18em;
84787
- text-transform: uppercase;
84788
- color: var(--ink-soft);
84789
- animation: fade 0.8s 0.35s both;
84790
- }
84791
- .label::before { content: ""; width: 28px; height: 1px; background: var(--rule); }
84792
- .failed .label { color: var(--accent); }
84793
- h1 {
84794
- margin: 0;
84795
- font-family: var(--serif);
84741
+ gap: 8px;
84742
+ font-size: 14px;
84796
84743
  font-weight: 600;
84797
- font-size: clamp(34px, 6vw, 46px);
84798
- line-height: 1.15;
84799
- letter-spacing: 0.01em;
84800
- animation: fade 0.9s 0.45s both;
84801
- }
84802
- h1 em {
84803
- display: block;
84804
- font-style: italic;
84805
- font-weight: 400;
84806
- color: var(--ink-soft);
84807
- }
84808
- p {
84809
- margin: 22px 0 0;
84810
- font-size: 15px;
84811
- line-height: 1.85;
84812
- color: var(--ink-soft);
84813
- animation: fade 0.9s 0.6s both;
84814
- }
84815
- p strong { color: var(--ink); font-weight: 500; }
84816
- footer {
84817
- margin-top: 34px;
84818
- padding-top: 16px;
84819
- border-top: 1px solid var(--rule);
84820
- display: flex;
84821
- justify-content: space-between;
84822
- gap: 16px;
84823
- font-family: var(--mono);
84824
- font-size: 11px;
84825
- color: var(--ink-soft);
84826
- animation: fade 0.9s 0.75s both;
84827
- }
84828
- @keyframes rise { from { opacity: 0; transform: translateY(28px) scale(0.96); } to { opacity: 1; transform: none; } }
84829
- @keyframes fade { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }
84830
- @media (max-width: 640px) {
84831
- main { grid-template-columns: 1fr; gap: 40px; justify-items: start; }
84832
- .sky { width: 132px; height: 132px; }
84833
- .vertical { display: none; }
84834
- }
84835
- @media (prefers-reduced-motion: reduce) {
84836
- *, *::before, *::after { animation: none !important; }
84837
- }
84744
+ letter-spacing: -0.4px;
84745
+ }
84746
+ main { width: min(520px, 100%); }
84747
+ .status { display: flex; align-items: center; gap: 6px; margin: 0 0 14px; font-size: 12px; }
84748
+ .signed-in .status { color: var(--ok); }
84749
+ .failed .status { color: var(--bad); }
84750
+ h1 { margin: 0 0 10px; font-size: 30px; font-weight: 650; overflow-wrap: anywhere; }
84751
+ h1 em { margin-left: 8px; font-style: normal; color: var(--name); }
84752
+ .lead { margin: 0; color: var(--soft); font-size: 15px; line-height: 1.8; }
84753
+ .rows { margin: 32px 0 0; padding: 0; list-style: none; border-top: 1px solid var(--rule); }
84754
+ .rows li { padding: 16px 0; border-bottom: 1px solid var(--rule); font-size: 14px; }
84755
+ .rows b { display: block; margin-bottom: 3px; font-weight: 600; }
84756
+ .rows span { color: var(--soft); font-size: 13px; }
84757
+ footer { display: flex; justify-content: space-between; gap: 16px; margin-top: 20px; font-size: 12px; color: var(--faint); }
84758
+ footer code { font: 12px var(--mono); }
84838
84759
  `;
84760
+ var row = (title, detail) => `<li><b>${title}</b><span>${detail}</span></li>`;
84839
84761
  function callbackPage(result) {
84840
84762
  const host = escapeHtml(new URL(result.origin).host);
84841
84763
  const title = result.ok ? "\u5DF2\u767B\u5F55 Ryugi Cloud" : "\u767B\u5F55\u6CA1\u6709\u5B8C\u6210";
84842
- const body = result.ok ? `<p class="label">Ryugi Cloud \xB7 \u5DF2\u8FDE\u63A5</p>
84764
+ const body = result.ok ? `<p class="status">${CIRCLE_CHECK}\u5DF2\u8FDE\u63A5 Ryugi Cloud</p>
84843
84765
  <h1>\u5DF2\u767B\u5F55<em>${escapeHtml(result.login)}</em></h1>
84844
- <p>\u8FD9\u53F0\u7535\u8111\u4E0A\u7684 Ryugi \u73B0\u5728\u53EF\u4EE5\u53D1\u5E03 artifact \u4E86\u3002<strong>\u56DE\u5230 Ryugi</strong>\uFF0C\u5206\u4EAB\u9762\u677F\u4F1A\u81EA\u52A8\u5237\u65B0\uFF1B\u5982\u679C\u662F\u8BA9 agent \u53D1\u5E03\u7684\uFF0C\u8BA9\u5B83\u518D\u8FD0\u884C\u4E00\u6B21\u53D1\u5E03\u547D\u4EE4\u3002</p>` : `<p class="label">Ryugi Cloud \xB7 \u672A\u8FDE\u63A5</p>
84766
+ <p class="lead">\u8FD9\u53F0\u7535\u8111\u4E0A\u7684 Ryugi \u73B0\u5728\u53EF\u4EE5\u53D1\u5E03 artifact \u4E86\u3002</p>
84767
+ <ul class="rows">${row("\u5728 Ryugi \u9875\u9762\u91CC\u53D1\u5E03\u7684\uFF1F", "\u56DE\u5230 Ryugi\uFF0C\u5206\u4EAB\u9762\u677F\u4F1A\u81EA\u52A8\u5237\u65B0\u3002")}${row("\u8BA9 agent \u53D1\u5E03\u7684\uFF1F", "\u8BA9\u5B83\u518D\u8FD0\u884C\u4E00\u6B21\u53D1\u5E03\u547D\u4EE4\u3002")}</ul>` : `<p class="status">${CIRCLE_ALERT}\u672A\u8FDE\u63A5</p>
84845
84768
  <h1>\u767B\u5F55\u6CA1\u6709\u5B8C\u6210</h1>
84846
- <p>${escapeHtml(result.detail)}</p>`;
84769
+ <p class="lead">${escapeHtml(result.detail)}</p>
84770
+ <ul class="rows">${row("\u91CD\u65B0\u767B\u5F55", "\u56DE\u5230 Ryugi\uFF0C\u5728\u5206\u4EAB\u9762\u677F\u91CC\u518D\u70B9\u4E00\u6B21\u300C\u767B\u5F55\u300D\u3002")}</ul>`;
84847
84771
  return `<!doctype html>
84848
84772
  <html lang="zh-CN">
84849
84773
  <head>
@@ -84856,12 +84780,10 @@ function callbackPage(result) {
84856
84780
  <style>${STYLE2}</style>
84857
84781
  </head>
84858
84782
  <body>
84783
+ <div class="mark">${MARK}ryugi</div>
84859
84784
  <main class="${result.ok ? "signed-in" : "failed"}">
84860
- <div class="sky" aria-hidden="true"><div class="moon"></div><span class="vertical">\u6D41\u5100</span></div>
84861
- <section>
84862
- ${body}
84863
- <footer><span>${result.ok ? "\u53EF\u4EE5\u5173\u95ED\u8FD9\u4E2A\u9875\u9762" : "\u53EF\u4EE5\u5173\u95ED\u8FD9\u4E2A\u9875\u9762\u540E\u91CD\u8BD5"}</span><span>${host}</span></footer>
84864
- </section>
84785
+ ${body}
84786
+ <footer><span>${result.ok ? "\u53EF\u4EE5\u5173\u95ED\u8FD9\u4E2A\u9875\u9762" : "\u53EF\u4EE5\u5173\u95ED\u8FD9\u4E2A\u9875\u9762\u540E\u91CD\u8BD5"}</span><code>${host}</code></footer>
84865
84787
  </main>
84866
84788
  </body>
84867
84789
  </html>
@@ -85047,19 +84969,21 @@ function createCloudRoutes(options) {
85047
84969
  }
85048
84970
  const key2 = `${ref.type}/${ref.id}`;
85049
84971
  const entry = artifactEntry(key2);
85050
- const visibility = requested ?? entry.visibility ?? "private";
85051
- const form = new FormData();
85052
- form.set("meta", JSON.stringify({ type: ref.type, title: inspected.title, visibility }));
85053
- form.set("payload", JSON.stringify(inspected.payload));
85054
- for (const file of files) form.set(`file:${file.path}`, new Blob([new Uint8Array(file.data)]), file.path);
85055
- let res = entry.cloud ? await cloudFetch("PUT", `/api/artifacts/${entry.cloud.id}`, form) : null;
85056
- if (!res || res.status === 404) res = await cloudFetch("POST", "/api/artifacts", form);
84972
+ const upload = (visibility) => {
84973
+ const form = new FormData();
84974
+ form.set("meta", JSON.stringify({ type: ref.type, title: inspected.title, ...visibility ? { visibility } : {} }));
84975
+ form.set("payload", JSON.stringify(inspected.payload));
84976
+ for (const file of files) form.set(`file:${file.path}`, new Blob([new Uint8Array(file.data)]), file.path);
84977
+ return form;
84978
+ };
84979
+ let res = entry.cloud ? await cloudFetch("PUT", `/api/artifacts/${entry.cloud.id}`, upload(requested)) : null;
84980
+ if (!res || res.status === 404) res = await cloudFetch("POST", "/api/artifacts", upload(requested ?? entry.visibility ?? "private"));
85057
84981
  const published = await (await expectOk(res)).json();
85058
84982
  updateArtifactConfig(configFile, key2, {
85059
- visibility,
84983
+ visibility: published.visibility,
85060
84984
  cloud: { id: published.id, url: published.url, publishedAt: published.updatedAt, visibility: published.visibility }
85061
84985
  });
85062
- return { status: 200, body: { id: published.id, url: published.url, visibility, publishedAt: published.updatedAt } };
84986
+ return { status: 200, body: { id: published.id, url: published.url, visibility: published.visibility, publishedAt: published.updatedAt } };
85063
84987
  };
85064
84988
  const setVisibility = async (ref, visibility) => {
85065
84989
  if (!await options.inspect(ref)) throw new CloudRefused(404, `${ref.type}/${ref.id} not found`);
@@ -85075,6 +84999,14 @@ function createCloudRoutes(options) {
85075
84999
  }
85076
85000
  return updateArtifactConfig(configFile, key2, { visibility });
85077
85001
  };
85002
+ const adoptCloudVisibility = (artifacts) => {
85003
+ const current = new Map(artifacts.map((artifact) => [artifact.id, artifact.visibility]));
85004
+ for (const [key2, entry] of Object.entries(readConfig(configFile).config.artifacts)) {
85005
+ const visibility = entry.cloud && current.get(entry.cloud.id);
85006
+ if (!entry.cloud || !visibility || entry.visibility === visibility && entry.cloud.visibility === visibility) continue;
85007
+ updateArtifactConfig(configFile, key2, { visibility, cloud: { ...entry.cloud, visibility } });
85008
+ }
85009
+ };
85078
85010
  const deleteCloud = async (cloudId) => {
85079
85011
  const res = await cloudFetch("DELETE", `/api/artifacts/${cloudId}`);
85080
85012
  if (res.status !== 404) await expectOk(res);
@@ -85106,7 +85038,9 @@ function createCloudRoutes(options) {
85106
85038
  return;
85107
85039
  }
85108
85040
  if (action === "artifacts" && method === "GET" && !first) {
85109
- sendJson(res, 200, await (await expectOk(await cloudFetch("GET", "/api/artifacts"))).json());
85041
+ const listed = await (await expectOk(await cloudFetch("GET", "/api/artifacts"))).json();
85042
+ adoptCloudVisibility(listed.artifacts);
85043
+ sendJson(res, 200, listed);
85110
85044
  return;
85111
85045
  }
85112
85046
  if (action === "artifacts" && method === "DELETE" && first && !second) {