owndesign 0.2.2 → 0.3.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.
Files changed (159) hide show
  1. package/dist/index.js +1 -1
  2. package/dist/server/index.js +889 -809
  3. package/dist/server/prompts/agents/design-page.md +21 -2
  4. package/dist/server/prompts/index.ts +0 -1
  5. package/dist/server/templates/html/page-shell.html +1 -3
  6. package/dist/server/templates/owndesign-runtime.test.ts +51 -0
  7. package/dist/server/templates/owndesign-runtime.ts +138 -0
  8. package/dist/server/templates/single-html.ts +18 -0
  9. package/dist/web/assets/{angular-html-BC-ehZ2Z.js → angular-html-BdqUTOSr.js} +1 -1
  10. package/dist/web/assets/{angular-ts-CbNdIQVH.js → angular-ts-CHVPl0K2.js} +1 -1
  11. package/dist/web/assets/{apl-CKXIPXmN.js → apl-Cdj8xhOr.js} +1 -1
  12. package/dist/web/assets/{arc-DCbsmfyT.js → arc-CQzLFt8P.js} +1 -1
  13. package/dist/web/assets/architecture-7EHR7CIX-D_1q3iHJ.js +1 -0
  14. package/dist/web/assets/{architectureDiagram-3BPJPVTR-C3CSEDbb.js → architectureDiagram-3BPJPVTR-DQRev6P0.js} +1 -1
  15. package/dist/web/assets/{astro-0YgDtFyB.js → astro-CqvP6Sm9.js} +1 -1
  16. package/dist/web/assets/{blade-DCBz6o9i.js → blade-AHcrF7FJ.js} +1 -1
  17. package/dist/web/assets/{blockDiagram-GPEHLZMM-Wy4mtab2.js → blockDiagram-GPEHLZMM-wWr1jqbH.js} +1 -1
  18. package/dist/web/assets/{c-B_5YfUT4.js → c-L6BASEY4.js} +1 -1
  19. package/dist/web/assets/{c4Diagram-AAUBKEIU-DvAQK-yr.js → c4Diagram-AAUBKEIU-QcoxyP1-.js} +1 -1
  20. package/dist/web/assets/channel-CKLAyPXF.js +1 -0
  21. package/dist/web/assets/{chunk-2J33WTMH-D12BmulM.js → chunk-2J33WTMH-Rt8Y9qQM.js} +1 -1
  22. package/dist/web/assets/{chunk-4BX2VUAB-CUsT6Yoy.js → chunk-4BX2VUAB-DgnUshBl.js} +1 -1
  23. package/dist/web/assets/{chunk-55IACEB6-B1fNBh7K.js → chunk-55IACEB6-C4VtZ0S1.js} +1 -1
  24. package/dist/web/assets/{chunk-727SXJPM-BNwBLitG.js → chunk-727SXJPM-pX8vxQBM.js} +1 -1
  25. package/dist/web/assets/{chunk-AQP2D5EJ-Cj6w8RRN.js → chunk-AQP2D5EJ-CtASt0uL.js} +1 -1
  26. package/dist/web/assets/{chunk-FMBD7UC4-DZQMeOiP.js → chunk-FMBD7UC4-AYbdnBZ-.js} +1 -1
  27. package/dist/web/assets/{chunk-ND2GUHAM-BDZZZpgK.js → chunk-ND2GUHAM-Bi2LmhY7.js} +1 -1
  28. package/dist/web/assets/chunk-QZHKN3VN-_jfeFdsU.js +1 -0
  29. package/dist/web/assets/classDiagram-4FO5ZUOK-CPA3GyTp.js +1 -0
  30. package/dist/web/assets/classDiagram-v2-Q7XG4LA2-CPA3GyTp.js +1 -0
  31. package/dist/web/assets/{cobol-B7rjWy71.js → cobol-2mv2h2I-.js} +1 -1
  32. package/dist/web/assets/{coffee-327Z21kX.js → coffee-WyF-3t43.js} +1 -1
  33. package/dist/web/assets/{cose-bilkent-S5V4N54A-D1c4YrLP.js → cose-bilkent-S5V4N54A-DM6dd-q1.js} +1 -1
  34. package/dist/web/assets/{cpp-76QBVYPh.js → cpp-CAEbN4Ya.js} +1 -1
  35. package/dist/web/assets/{crystal-B4heXbZm.js → crystal-DyRNEnWF.js} +1 -1
  36. package/dist/web/assets/{css-CzEdf7OR.js → css-CG0mYlL5.js} +1 -1
  37. package/dist/web/assets/{dagre-BM42HDAG-ET87-tzF.js → dagre-BM42HDAG-D_NqzEVm.js} +1 -1
  38. package/dist/web/assets/{diagram-2AECGRRQ-CBQXEPqZ.js → diagram-2AECGRRQ-Bgm-_Eko.js} +1 -1
  39. package/dist/web/assets/{diagram-5GNKFQAL-CtNzeaR4.js → diagram-5GNKFQAL-C_9mv9Qd.js} +1 -1
  40. package/dist/web/assets/{diagram-KO2AKTUF-DKv9ewpj.js → diagram-KO2AKTUF-BHQT9JgD.js} +1 -1
  41. package/dist/web/assets/{diagram-LMA3HP47-BdL7Q4hm.js → diagram-LMA3HP47-B48NzL_Q.js} +1 -1
  42. package/dist/web/assets/{diagram-OG6HWLK6-BTYYRviK.js → diagram-OG6HWLK6-DKk01CLS.js} +1 -1
  43. package/dist/web/assets/{edge-CbifZx89.js → edge-WFDIDqY1.js} +1 -1
  44. package/dist/web/assets/{elixir-D7epo7XU.js → elixir-CP1ajsZR.js} +1 -1
  45. package/dist/web/assets/{elm-CDnfHiSW.js → elm-oora7HJE.js} +1 -1
  46. package/dist/web/assets/{erDiagram-TEJ5UH35-DoS_g6rc.js → erDiagram-TEJ5UH35-ClLJSrwL.js} +1 -1
  47. package/dist/web/assets/{erb-CJPDtktp.js → erb-DpZNjJ9_.js} +1 -1
  48. package/dist/web/assets/eventmodeling-FCH6USID-1ivGez78.js +1 -0
  49. package/dist/web/assets/{flowDiagram-I6XJVG4X-INqAi_9A.js → flowDiagram-I6XJVG4X-m1zK1OOI.js} +1 -1
  50. package/dist/web/assets/{ganttDiagram-6RSMTGT7-BtV9RfaV.js → ganttDiagram-6RSMTGT7-R7B6FFxw.js} +1 -1
  51. package/dist/web/assets/{git-rebase-XN1VAGxD.js → git-rebase-Dg9skXJz.js} +1 -1
  52. package/dist/web/assets/gitGraph-WXDBUCRP-Dpi4pm_y.js +1 -0
  53. package/dist/web/assets/{gitGraphDiagram-PVQCEYII-Bg7oxgNx.js → gitGraphDiagram-PVQCEYII-rvpKbkxm.js} +1 -1
  54. package/dist/web/assets/{glimmer-js-jAUeYMlX.js → glimmer-js-BM1sc5ia.js} +1 -1
  55. package/dist/web/assets/{glimmer-ts-wcJbAc9L.js → glimmer-ts-BJ5aeU1p.js} +1 -1
  56. package/dist/web/assets/{glsl-CqkwmhMS.js → glsl-DAXCJ1Bs.js} +1 -1
  57. package/dist/web/assets/{graphql-MSHUJ_J9.js → graphql-_HTUmoJJ.js} +1 -1
  58. package/dist/web/assets/{hack-o9VcDxFX.js → hack-Bbw_IBNu.js} +1 -1
  59. package/dist/web/assets/{haml-yMII7dOY.js → haml-BElCN2ig.js} +1 -1
  60. package/dist/web/assets/{handlebars-DqywSDps.js → handlebars-PfBBM4Ul.js} +1 -1
  61. package/dist/web/assets/{highlighted-body-OFNGDK62-DZUhBEEf.js → highlighted-body-OFNGDK62-B7shmJas.js} +1 -1
  62. package/dist/web/assets/{html-D8D_RndX.js → html-BF5zzurH.js} +1 -1
  63. package/dist/web/assets/{html-derivative-Db1SyKg8.js → html-derivative-oPCMAlhR.js} +1 -1
  64. package/dist/web/assets/{http-Bqs_GAGw.js → http-B3FNtPG9.js} +1 -1
  65. package/dist/web/assets/{hurl-j0mDeRMp.js → hurl-Dp2M6dIg.js} +1 -1
  66. package/dist/web/assets/index-YSa89xAk.js +977 -0
  67. package/dist/web/assets/index-qzT4Spui.css +2 -0
  68. package/dist/web/assets/info-J43DQDTF-CCIIC-lT.js +1 -0
  69. package/dist/web/assets/{infoDiagram-5YYISTIA-D4cmnLLV.js → infoDiagram-5YYISTIA-DUiIIzSJ.js} +1 -1
  70. package/dist/web/assets/{ishikawaDiagram-YF4QCWOH-BY9yvtJK.js → ishikawaDiagram-YF4QCWOH-BDoM1IJ1.js} +1 -1
  71. package/dist/web/assets/{java-CegvNhLh.js → java-D8VYPdmO.js} +1 -1
  72. package/dist/web/assets/{javascript-DhcUAesx.js → javascript-8l7nZMBo.js} +1 -1
  73. package/dist/web/assets/{jinja-BdSDD1Q-.js → jinja-CTV42GN6.js} +1 -1
  74. package/dist/web/assets/{jison-CarYqmfq.js → jison-DOEd3yQu.js} +1 -1
  75. package/dist/web/assets/{journeyDiagram-JHISSGLW-rDquyMpx.js → journeyDiagram-JHISSGLW-o_K8r6Fc.js} +1 -1
  76. package/dist/web/assets/{json-wCF8Ai7e.js → json-BJP4ONN0.js} +1 -1
  77. package/dist/web/assets/{jsx-Ct3LR2iE.js → jsx-kpZBrH4w.js} +1 -1
  78. package/dist/web/assets/{julia-Brh5r__6.js → julia-H9ccs9iA.js} +1 -1
  79. package/dist/web/assets/{just-CK9u7rV8.js → just-hj2UAEFQ.js} +1 -1
  80. package/dist/web/assets/{kanban-definition-UN3LZRKU-DRY4BHuX.js → kanban-definition-UN3LZRKU-QwMAKT_f.js} +1 -1
  81. package/dist/web/assets/{latex-CnioxxTZ.js → latex-CyO33iPb.js} +1 -1
  82. package/dist/web/assets/{linear-DdVYArrQ.js → linear-o7e5jEgw.js} +1 -1
  83. package/dist/web/assets/{liquid-CWr27PHL.js → liquid-_mek6fOE.js} +1 -1
  84. package/dist/web/assets/{lua-BHz_f72B.js → lua-C2DhJyVI.js} +1 -1
  85. package/dist/web/assets/{marko-DYZOkg7A.js → marko-CZEiD-NB.js} +1 -1
  86. package/dist/web/assets/{mdc-a5KQMe4S.js → mdc-A90dq1MH.js} +1 -1
  87. package/dist/web/assets/mermaid-GHXKKRXX-BHX3ego2.js +1 -0
  88. package/dist/web/assets/{mermaid-parser.core-BAsHbYUQ.js → mermaid-parser.core-CwzV1M_V.js} +2 -2
  89. package/dist/web/assets/{mindmap-definition-RKZ34NQL-C1ndv4OX.js → mindmap-definition-RKZ34NQL-BMri-V6y.js} +1 -1
  90. package/dist/web/assets/{nginx-DYjAek21.js → nginx-DOMnJ23j.js} +1 -1
  91. package/dist/web/assets/{nim-BY3DE5rh.js → nim-zbR5LDAV.js} +1 -1
  92. package/dist/web/assets/packet-YPE3B663-ByXdjZNB.js +1 -0
  93. package/dist/web/assets/{perl-Q7rsz5p8.js → perl-DdSkRoeE.js} +1 -1
  94. package/dist/web/assets/{php-wkLOOMEB.js → php-BpQLZPHO.js} +1 -1
  95. package/dist/web/assets/pie-LRSECV5Y-B4cm_9Re.js +1 -0
  96. package/dist/web/assets/{pieDiagram-4H26LBE5-hbmKZkAo.js → pieDiagram-4H26LBE5-DFad80u4.js} +1 -1
  97. package/dist/web/assets/{pug-DBjGFTz6.js → pug-C_fdPtH-.js} +1 -1
  98. package/dist/web/assets/{qml-6JbnGGh-.js → qml-CNXBf8kx.js} +1 -1
  99. package/dist/web/assets/{quadrantDiagram-W4KKPZXB-Ce3Tyy1v.js → quadrantDiagram-W4KKPZXB-CXH7Ps0K.js} +1 -1
  100. package/dist/web/assets/{r-CpWosUkA.js → r-BCVwx55G.js} +1 -1
  101. package/dist/web/assets/radar-GUYGQ44K-BfTLimWm.js +1 -0
  102. package/dist/web/assets/{razor-VaRLosil.js → razor-4UnzbliN.js} +1 -1
  103. package/dist/web/assets/{regexp-BXX0dR0g.js → regexp-Cx44IXhZ.js} +1 -1
  104. package/dist/web/assets/{requirementDiagram-4Y6WPE33-BvuMdAA_.js → requirementDiagram-4Y6WPE33-jgMAzOs_.js} +1 -1
  105. package/dist/web/assets/{rst-B5mAlZz_.js → rst-BQ98T0pl.js} +1 -1
  106. package/dist/web/assets/{ruby-CuJVGKz0.js → ruby-CQe2_1Mx.js} +1 -1
  107. package/dist/web/assets/{sankeyDiagram-5OEKKPKP-9vzIUX0R.js → sankeyDiagram-5OEKKPKP-D_3RedGH.js} +1 -1
  108. package/dist/web/assets/{sas-CVzjXYMr.js → sas-Df1AewjZ.js} +1 -1
  109. package/dist/web/assets/{scss-WQpgeU5g.js → scss-Mnube1Aq.js} +1 -1
  110. package/dist/web/assets/{sequenceDiagram-3UESZ5HK-q6rXjDsy.js → sequenceDiagram-3UESZ5HK-C1836wpQ.js} +1 -1
  111. package/dist/web/assets/{shellscript-CycmgFgs.js → shellscript-CDszjMg6.js} +1 -1
  112. package/dist/web/assets/{shellsession-CSmahWBB.js → shellsession-CnjHVqYh.js} +1 -1
  113. package/dist/web/assets/{soy-E8MJKPgz.js → soy-B5asYSZT.js} +1 -1
  114. package/dist/web/assets/{sql-ChzFHxMA.js → sql-BFrC3Vi5.js} +1 -1
  115. package/dist/web/assets/{stata-D-Voeimj.js → stata-KlFU2EjN.js} +1 -1
  116. package/dist/web/assets/{stateDiagram-AJRCARHV-QkbVYicl.js → stateDiagram-AJRCARHV-S48Ai71o.js} +1 -1
  117. package/dist/web/assets/stateDiagram-v2-BHNVJYJU-bf5jD_zW.js +1 -0
  118. package/dist/web/assets/{surrealql-CDreHe5D.js → surrealql-rIRDXr_v.js} +1 -1
  119. package/dist/web/assets/{svelte-UtC71yfS.js → svelte-BQftzg5X.js} +1 -1
  120. package/dist/web/assets/{templ-DI5vQSP6.js → templ-DfQQPqaN.js} +1 -1
  121. package/dist/web/assets/{tex-B1pg-O0j.js → tex-8LsiEF9g.js} +1 -1
  122. package/dist/web/assets/{timeline-definition-PNZ67QCA-hOb9CPgd.js → timeline-definition-PNZ67QCA-C9H3XLfz.js} +1 -1
  123. package/dist/web/assets/treeView-BLDUP644-mOvRjQhT.js +1 -0
  124. package/dist/web/assets/treemap-LRROVOQU--QiNmmi5.js +1 -0
  125. package/dist/web/assets/{ts-tags-DDRBQd18.js → ts-tags-i6Dbvl26.js} +1 -1
  126. package/dist/web/assets/{tsx-BNOyqGp9.js → tsx-BMATElFg.js} +1 -1
  127. package/dist/web/assets/{twig-zClWYmrr.js → twig-Cy6dMspl.js} +1 -1
  128. package/dist/web/assets/{typescript-Bywfx-vz.js → typescript-BMNfloOQ.js} +1 -1
  129. package/dist/web/assets/{vennDiagram-CIIHVFJN-Cx7yBOK-.js → vennDiagram-CIIHVFJN-DGW7CatZ.js} +1 -1
  130. package/dist/web/assets/{vue-Bp_voCJR.js → vue-DRQ1Vnbf.js} +1 -1
  131. package/dist/web/assets/{vue-html-C43GF5Id.js → vue-html-BbCBEXlS.js} +1 -1
  132. package/dist/web/assets/{vue-vine-CSRbNOMz.js → vue-vine-CgyY7JdC.js} +1 -1
  133. package/dist/web/assets/wardley-L42UT6IY-CX5eMTMw.js +1 -0
  134. package/dist/web/assets/{wardleyDiagram-YWT4CUSO-Cwiuub7b.js → wardleyDiagram-YWT4CUSO-DCGzfbps.js} +1 -1
  135. package/dist/web/assets/{xml-rhD_p6eK.js → xml-95qkb9yN.js} +1 -1
  136. package/dist/web/assets/{xsl-B-H8kR_6.js → xsl-D6gyo8CK.js} +1 -1
  137. package/dist/web/assets/{xychartDiagram-2RQKCTM6-DAix_-GG.js → xychartDiagram-2RQKCTM6-YEjKJtlZ.js} +1 -1
  138. package/dist/web/assets/{yaml-CRIMWRGF.js → yaml-KYdypczj.js} +1 -1
  139. package/dist/web/index.html +2 -2
  140. package/package.json +4 -1
  141. package/dist/server/prompts/agents/component-audit.md +0 -24
  142. package/dist/web/assets/architecture-7EHR7CIX-Dy_x80xD.js +0 -1
  143. package/dist/web/assets/channel-CNy21oVR.js +0 -1
  144. package/dist/web/assets/chunk-QZHKN3VN-ZvBMuvS3.js +0 -1
  145. package/dist/web/assets/classDiagram-4FO5ZUOK-CdVQzF3q.js +0 -1
  146. package/dist/web/assets/classDiagram-v2-Q7XG4LA2-CdVQzF3q.js +0 -1
  147. package/dist/web/assets/eventmodeling-FCH6USID-dHNYNvhr.js +0 -1
  148. package/dist/web/assets/gitGraph-WXDBUCRP-BTlPmENP.js +0 -1
  149. package/dist/web/assets/index-BMuMlfUY.css +0 -2
  150. package/dist/web/assets/index-DlSOjemg.js +0 -977
  151. package/dist/web/assets/info-J43DQDTF-Dk_AfWti.js +0 -1
  152. package/dist/web/assets/mermaid-GHXKKRXX-DsECfWij.js +0 -1
  153. package/dist/web/assets/packet-YPE3B663-C6X9xd7B.js +0 -1
  154. package/dist/web/assets/pie-LRSECV5Y-B7m9jxWQ.js +0 -1
  155. package/dist/web/assets/radar-GUYGQ44K-CNV--1hE.js +0 -1
  156. package/dist/web/assets/stateDiagram-v2-BHNVJYJU-CemwCoPd.js +0 -1
  157. package/dist/web/assets/treeView-BLDUP644-4kzz9e5T.js +0 -1
  158. package/dist/web/assets/treemap-LRROVOQU-CUGlq2kA.js +0 -1
  159. package/dist/web/assets/wardley-L42UT6IY-NTb3kln2.js +0 -1
@@ -12,10 +12,10 @@ var __require = /* @__PURE__ */ ((x) => typeof require !== "undefined" ? require
12
12
  if (typeof require !== "undefined") return require.apply(this, arguments);
13
13
  throw Error('Dynamic require of "' + x + '" is not supported');
14
14
  });
15
- var __glob = (map2) => (path16) => {
16
- var fn = map2[path16];
15
+ var __glob = (map2) => (path15) => {
16
+ var fn = map2[path15];
17
17
  if (fn) return fn();
18
- throw new Error("Module not found in bundle: " + path16);
18
+ throw new Error("Module not found in bundle: " + path15);
19
19
  };
20
20
  var __esm = (fn, res) => function __init() {
21
21
  return fn && (res = (0, fn[__getOwnPropNames(fn)[0]])(fn = 0)), res;
@@ -1187,7 +1187,7 @@ var require_auth_config = __commonJS({
1187
1187
  });
1188
1188
  module.exports = __toCommonJS(auth_config_exports);
1189
1189
  var fs12 = __toESM2(__require("fs"));
1190
- var path16 = __toESM2(__require("path"));
1190
+ var path15 = __toESM2(__require("path"));
1191
1191
  var import_token_util = require_token_util();
1192
1192
  function getAuthConfigPath() {
1193
1193
  const dataDir = (0, import_token_util.getVercelDataDir)();
@@ -1196,7 +1196,7 @@ var require_auth_config = __commonJS({
1196
1196
  `Unable to find Vercel CLI data directory. Your platform: ${process.platform}. Supported: darwin, linux, win32.`
1197
1197
  );
1198
1198
  }
1199
- return path16.join(dataDir, "auth.json");
1199
+ return path15.join(dataDir, "auth.json");
1200
1200
  }
1201
1201
  function readAuthConfig() {
1202
1202
  try {
@@ -1215,7 +1215,7 @@ var require_auth_config = __commonJS({
1215
1215
  }
1216
1216
  function writeAuthConfig(config2) {
1217
1217
  const authPath = getAuthConfigPath();
1218
- const authDir = path16.dirname(authPath);
1218
+ const authDir = path15.dirname(authPath);
1219
1219
  if (!fs12.existsSync(authDir)) {
1220
1220
  fs12.mkdirSync(authDir, { mode: 504, recursive: true });
1221
1221
  }
@@ -1410,7 +1410,7 @@ var require_token_util = __commonJS({
1410
1410
  saveToken: () => saveToken
1411
1411
  });
1412
1412
  module.exports = __toCommonJS(token_util_exports);
1413
- var path16 = __toESM2(__require("path"));
1413
+ var path15 = __toESM2(__require("path"));
1414
1414
  var fs12 = __toESM2(__require("fs"));
1415
1415
  var import_token_error = require_token_error();
1416
1416
  var import_token_io = require_token_io();
@@ -1423,7 +1423,7 @@ var require_token_util = __commonJS({
1423
1423
  if (!dataDir) {
1424
1424
  return null;
1425
1425
  }
1426
- return path16.join(dataDir, vercelFolder);
1426
+ return path15.join(dataDir, vercelFolder);
1427
1427
  }
1428
1428
  async function getVercelToken2(options) {
1429
1429
  const authConfig = (0, import_auth_config.readAuthConfig)();
@@ -1499,7 +1499,7 @@ var require_token_util = __commonJS({
1499
1499
  "Unable to find project root directory. Have you linked your project with `vc link?`"
1500
1500
  );
1501
1501
  }
1502
- const prjPath = path16.join(dir, ".vercel", "project.json");
1502
+ const prjPath = path15.join(dir, ".vercel", "project.json");
1503
1503
  if (!fs12.existsSync(prjPath)) {
1504
1504
  throw new import_token_error.VercelOidcTokenError(
1505
1505
  "project.json not found, have you linked your project with `vc link?`"
@@ -1520,9 +1520,9 @@ var require_token_util = __commonJS({
1520
1520
  "Unable to find user data directory. Please reach out to Vercel support."
1521
1521
  );
1522
1522
  }
1523
- const tokenPath = path16.join(dir, "com.vercel.token", `${projectId}.json`);
1523
+ const tokenPath = path15.join(dir, "com.vercel.token", `${projectId}.json`);
1524
1524
  const tokenJson = JSON.stringify(token);
1525
- fs12.mkdirSync(path16.dirname(tokenPath), { mode: 504, recursive: true });
1525
+ fs12.mkdirSync(path15.dirname(tokenPath), { mode: 504, recursive: true });
1526
1526
  fs12.writeFileSync(tokenPath, tokenJson);
1527
1527
  fs12.chmodSync(tokenPath, 432);
1528
1528
  return;
@@ -1534,7 +1534,7 @@ var require_token_util = __commonJS({
1534
1534
  "Unable to find user data directory. Please reach out to Vercel support."
1535
1535
  );
1536
1536
  }
1537
- const tokenPath = path16.join(dir, "com.vercel.token", `${projectId}.json`);
1537
+ const tokenPath = path15.join(dir, "com.vercel.token", `${projectId}.json`);
1538
1538
  if (!fs12.existsSync(tokenPath)) {
1539
1539
  return null;
1540
1540
  }
@@ -1805,7 +1805,7 @@ var require_path = __commonJS({
1805
1805
  Object.defineProperty(exports, "__esModule", { value: true });
1806
1806
  exports.convertPosixPathToPattern = exports.convertWindowsPathToPattern = exports.convertPathToPattern = exports.escapePosixPath = exports.escapeWindowsPath = exports.escape = exports.removeLeadingDotSegment = exports.makeAbsolute = exports.unixify = void 0;
1807
1807
  var os7 = __require("os");
1808
- var path16 = __require("path");
1808
+ var path15 = __require("path");
1809
1809
  var IS_WINDOWS_PLATFORM = os7.platform() === "win32";
1810
1810
  var LEADING_DOT_SEGMENT_CHARACTERS_COUNT = 2;
1811
1811
  var POSIX_UNESCAPED_GLOB_SYMBOLS_RE = /(\\?)([()*?[\]{|}]|^!|[!+@](?=\()|\\(?![!()*+?@[\]{|}]))/g;
@@ -1817,7 +1817,7 @@ var require_path = __commonJS({
1817
1817
  }
1818
1818
  exports.unixify = unixify;
1819
1819
  function makeAbsolute(cwd, filepath) {
1820
- return path16.resolve(cwd, filepath);
1820
+ return path15.resolve(cwd, filepath);
1821
1821
  }
1822
1822
  exports.makeAbsolute = makeAbsolute;
1823
1823
  function removeLeadingDotSegment(entry) {
@@ -3114,7 +3114,7 @@ var require_braces = __commonJS({
3114
3114
  var require_constants2 = __commonJS({
3115
3115
  "../../node_modules/.pnpm/picomatch@2.3.2/node_modules/picomatch/lib/constants.js"(exports, module) {
3116
3116
  "use strict";
3117
- var path16 = __require("path");
3117
+ var path15 = __require("path");
3118
3118
  var WIN_SLASH = "\\\\/";
3119
3119
  var WIN_NO_SLASH = `[^${WIN_SLASH}]`;
3120
3120
  var DEFAULT_MAX_EXTGLOB_RECURSION = 0;
@@ -3288,7 +3288,7 @@ var require_constants2 = __commonJS({
3288
3288
  /* | */
3289
3289
  CHAR_ZERO_WIDTH_NOBREAK_SPACE: 65279,
3290
3290
  /* \uFEFF */
3291
- SEP: path16.sep,
3291
+ SEP: path15.sep,
3292
3292
  /**
3293
3293
  * Create EXTGLOB_CHARS
3294
3294
  */
@@ -3315,7 +3315,7 @@ var require_constants2 = __commonJS({
3315
3315
  var require_utils2 = __commonJS({
3316
3316
  "../../node_modules/.pnpm/picomatch@2.3.2/node_modules/picomatch/lib/utils.js"(exports) {
3317
3317
  "use strict";
3318
- var path16 = __require("path");
3318
+ var path15 = __require("path");
3319
3319
  var win32 = process.platform === "win32";
3320
3320
  var {
3321
3321
  REGEX_BACKSLASH,
@@ -3344,7 +3344,7 @@ var require_utils2 = __commonJS({
3344
3344
  if (options && typeof options.windows === "boolean") {
3345
3345
  return options.windows;
3346
3346
  }
3347
- return win32 === true || path16.sep === "\\";
3347
+ return win32 === true || path15.sep === "\\";
3348
3348
  };
3349
3349
  exports.escapeLast = (input, char, lastIdx) => {
3350
3350
  const idx = input.lastIndexOf(char, lastIdx);
@@ -4708,7 +4708,7 @@ var require_parse2 = __commonJS({
4708
4708
  var require_picomatch = __commonJS({
4709
4709
  "../../node_modules/.pnpm/picomatch@2.3.2/node_modules/picomatch/lib/picomatch.js"(exports, module) {
4710
4710
  "use strict";
4711
- var path16 = __require("path");
4711
+ var path15 = __require("path");
4712
4712
  var scan = require_scan();
4713
4713
  var parse3 = require_parse2();
4714
4714
  var utils = require_utils2();
@@ -4793,7 +4793,7 @@ var require_picomatch = __commonJS({
4793
4793
  };
4794
4794
  picomatch.matchBase = (input, glob, options, posix = utils.isWindows(options)) => {
4795
4795
  const regex = glob instanceof RegExp ? glob : picomatch.makeRe(glob, options);
4796
- return regex.test(path16.basename(input));
4796
+ return regex.test(path15.basename(input));
4797
4797
  };
4798
4798
  picomatch.isMatch = (str, patterns, options) => picomatch(patterns, options)(str);
4799
4799
  picomatch.parse = (pattern, options) => {
@@ -5020,7 +5020,7 @@ var require_pattern = __commonJS({
5020
5020
  "use strict";
5021
5021
  Object.defineProperty(exports, "__esModule", { value: true });
5022
5022
  exports.isAbsolute = exports.partitionAbsoluteAndRelative = exports.removeDuplicateSlashes = exports.matchAny = exports.convertPatternsToRe = exports.makeRe = exports.getPatternParts = exports.expandBraceExpansion = exports.expandPatternsWithBraceExpansion = exports.isAffectDepthOfReadingPattern = exports.endsWithSlashGlobStar = exports.hasGlobStar = exports.getBaseDirectory = exports.isPatternRelatedToParentDirectory = exports.getPatternsOutsideCurrentDirectory = exports.getPatternsInsideCurrentDirectory = exports.getPositivePatterns = exports.getNegativePatterns = exports.isPositivePattern = exports.isNegativePattern = exports.convertToNegativePattern = exports.convertToPositivePattern = exports.isDynamicPattern = exports.isStaticPattern = void 0;
5023
- var path16 = __require("path");
5023
+ var path15 = __require("path");
5024
5024
  var globParent = require_glob_parent();
5025
5025
  var micromatch = require_micromatch();
5026
5026
  var GLOBSTAR = "**";
@@ -5115,7 +5115,7 @@ var require_pattern = __commonJS({
5115
5115
  }
5116
5116
  exports.endsWithSlashGlobStar = endsWithSlashGlobStar;
5117
5117
  function isAffectDepthOfReadingPattern(pattern) {
5118
- const basename = path16.basename(pattern);
5118
+ const basename = path15.basename(pattern);
5119
5119
  return endsWithSlashGlobStar(pattern) || isStaticPattern(basename);
5120
5120
  }
5121
5121
  exports.isAffectDepthOfReadingPattern = isAffectDepthOfReadingPattern;
@@ -5173,7 +5173,7 @@ var require_pattern = __commonJS({
5173
5173
  }
5174
5174
  exports.partitionAbsoluteAndRelative = partitionAbsoluteAndRelative;
5175
5175
  function isAbsolute(pattern) {
5176
- return path16.isAbsolute(pattern);
5176
+ return path15.isAbsolute(pattern);
5177
5177
  }
5178
5178
  exports.isAbsolute = isAbsolute;
5179
5179
  }
@@ -5350,8 +5350,8 @@ var require_utils3 = __commonJS({
5350
5350
  exports.errno = errno;
5351
5351
  var fs12 = require_fs();
5352
5352
  exports.fs = fs12;
5353
- var path16 = require_path();
5354
- exports.path = path16;
5353
+ var path15 = require_path();
5354
+ exports.path = path15;
5355
5355
  var pattern = require_pattern();
5356
5356
  exports.pattern = pattern;
5357
5357
  var stream2 = require_stream();
@@ -5463,8 +5463,8 @@ var require_async = __commonJS({
5463
5463
  "use strict";
5464
5464
  Object.defineProperty(exports, "__esModule", { value: true });
5465
5465
  exports.read = void 0;
5466
- function read(path16, settings, callback) {
5467
- settings.fs.lstat(path16, (lstatError, lstat2) => {
5466
+ function read(path15, settings, callback) {
5467
+ settings.fs.lstat(path15, (lstatError, lstat2) => {
5468
5468
  if (lstatError !== null) {
5469
5469
  callFailureCallback(callback, lstatError);
5470
5470
  return;
@@ -5473,7 +5473,7 @@ var require_async = __commonJS({
5473
5473
  callSuccessCallback(callback, lstat2);
5474
5474
  return;
5475
5475
  }
5476
- settings.fs.stat(path16, (statError, stat5) => {
5476
+ settings.fs.stat(path15, (statError, stat5) => {
5477
5477
  if (statError !== null) {
5478
5478
  if (settings.throwErrorOnBrokenSymbolicLink) {
5479
5479
  callFailureCallback(callback, statError);
@@ -5505,13 +5505,13 @@ var require_sync = __commonJS({
5505
5505
  "use strict";
5506
5506
  Object.defineProperty(exports, "__esModule", { value: true });
5507
5507
  exports.read = void 0;
5508
- function read(path16, settings) {
5509
- const lstat2 = settings.fs.lstatSync(path16);
5508
+ function read(path15, settings) {
5509
+ const lstat2 = settings.fs.lstatSync(path15);
5510
5510
  if (!lstat2.isSymbolicLink() || !settings.followSymbolicLink) {
5511
5511
  return lstat2;
5512
5512
  }
5513
5513
  try {
5514
- const stat5 = settings.fs.statSync(path16);
5514
+ const stat5 = settings.fs.statSync(path15);
5515
5515
  if (settings.markSymbolicLink) {
5516
5516
  stat5.isSymbolicLink = () => true;
5517
5517
  }
@@ -5582,17 +5582,17 @@ var require_out = __commonJS({
5582
5582
  var sync = require_sync();
5583
5583
  var settings_1 = require_settings();
5584
5584
  exports.Settings = settings_1.default;
5585
- function stat5(path16, optionsOrSettingsOrCallback, callback) {
5585
+ function stat5(path15, optionsOrSettingsOrCallback, callback) {
5586
5586
  if (typeof optionsOrSettingsOrCallback === "function") {
5587
- async.read(path16, getSettings(), optionsOrSettingsOrCallback);
5587
+ async.read(path15, getSettings(), optionsOrSettingsOrCallback);
5588
5588
  return;
5589
5589
  }
5590
- async.read(path16, getSettings(optionsOrSettingsOrCallback), callback);
5590
+ async.read(path15, getSettings(optionsOrSettingsOrCallback), callback);
5591
5591
  }
5592
5592
  exports.stat = stat5;
5593
- function statSync3(path16, optionsOrSettings) {
5593
+ function statSync3(path15, optionsOrSettings) {
5594
5594
  const settings = getSettings(optionsOrSettings);
5595
- return sync.read(path16, settings);
5595
+ return sync.read(path15, settings);
5596
5596
  }
5597
5597
  exports.statSync = statSync3;
5598
5598
  function getSettings(settingsOrOptions = {}) {
@@ -5808,16 +5808,16 @@ var require_async2 = __commonJS({
5808
5808
  return;
5809
5809
  }
5810
5810
  const tasks = names.map((name21) => {
5811
- const path16 = common.joinPathSegments(directory, name21, settings.pathSegmentSeparator);
5811
+ const path15 = common.joinPathSegments(directory, name21, settings.pathSegmentSeparator);
5812
5812
  return (done) => {
5813
- fsStat.stat(path16, settings.fsStatSettings, (error51, stats) => {
5813
+ fsStat.stat(path15, settings.fsStatSettings, (error51, stats) => {
5814
5814
  if (error51 !== null) {
5815
5815
  done(error51);
5816
5816
  return;
5817
5817
  }
5818
5818
  const entry = {
5819
5819
  name: name21,
5820
- path: path16,
5820
+ path: path15,
5821
5821
  dirent: utils.fs.createDirentFromStats(name21, stats)
5822
5822
  };
5823
5823
  if (settings.stats) {
@@ -5935,7 +5935,7 @@ var require_settings2 = __commonJS({
5935
5935
  "../../node_modules/.pnpm/@nodelib+fs.scandir@2.1.5/node_modules/@nodelib/fs.scandir/out/settings.js"(exports) {
5936
5936
  "use strict";
5937
5937
  Object.defineProperty(exports, "__esModule", { value: true });
5938
- var path16 = __require("path");
5938
+ var path15 = __require("path");
5939
5939
  var fsStat = require_out();
5940
5940
  var fs12 = require_fs4();
5941
5941
  var Settings = class {
@@ -5943,7 +5943,7 @@ var require_settings2 = __commonJS({
5943
5943
  this._options = _options;
5944
5944
  this.followSymbolicLinks = this._getValue(this._options.followSymbolicLinks, false);
5945
5945
  this.fs = fs12.createFileSystemAdapter(this._options.fs);
5946
- this.pathSegmentSeparator = this._getValue(this._options.pathSegmentSeparator, path16.sep);
5946
+ this.pathSegmentSeparator = this._getValue(this._options.pathSegmentSeparator, path15.sep);
5947
5947
  this.stats = this._getValue(this._options.stats, false);
5948
5948
  this.throwErrorOnBrokenSymbolicLink = this._getValue(this._options.throwErrorOnBrokenSymbolicLink, true);
5949
5949
  this.fsStatSettings = new fsStat.Settings({
@@ -5970,17 +5970,17 @@ var require_out2 = __commonJS({
5970
5970
  var sync = require_sync2();
5971
5971
  var settings_1 = require_settings2();
5972
5972
  exports.Settings = settings_1.default;
5973
- function scandir(path16, optionsOrSettingsOrCallback, callback) {
5973
+ function scandir(path15, optionsOrSettingsOrCallback, callback) {
5974
5974
  if (typeof optionsOrSettingsOrCallback === "function") {
5975
- async.read(path16, getSettings(), optionsOrSettingsOrCallback);
5975
+ async.read(path15, getSettings(), optionsOrSettingsOrCallback);
5976
5976
  return;
5977
5977
  }
5978
- async.read(path16, getSettings(optionsOrSettingsOrCallback), callback);
5978
+ async.read(path15, getSettings(optionsOrSettingsOrCallback), callback);
5979
5979
  }
5980
5980
  exports.scandir = scandir;
5981
- function scandirSync(path16, optionsOrSettings) {
5981
+ function scandirSync(path15, optionsOrSettings) {
5982
5982
  const settings = getSettings(optionsOrSettings);
5983
- return sync.read(path16, settings);
5983
+ return sync.read(path15, settings);
5984
5984
  }
5985
5985
  exports.scandirSync = scandirSync;
5986
5986
  function getSettings(settingsOrOptions = {}) {
@@ -6627,7 +6627,7 @@ var require_settings3 = __commonJS({
6627
6627
  "../../node_modules/.pnpm/@nodelib+fs.walk@1.2.8/node_modules/@nodelib/fs.walk/out/settings.js"(exports) {
6628
6628
  "use strict";
6629
6629
  Object.defineProperty(exports, "__esModule", { value: true });
6630
- var path16 = __require("path");
6630
+ var path15 = __require("path");
6631
6631
  var fsScandir = require_out2();
6632
6632
  var Settings = class {
6633
6633
  constructor(_options = {}) {
@@ -6637,7 +6637,7 @@ var require_settings3 = __commonJS({
6637
6637
  this.deepFilter = this._getValue(this._options.deepFilter, null);
6638
6638
  this.entryFilter = this._getValue(this._options.entryFilter, null);
6639
6639
  this.errorFilter = this._getValue(this._options.errorFilter, null);
6640
- this.pathSegmentSeparator = this._getValue(this._options.pathSegmentSeparator, path16.sep);
6640
+ this.pathSegmentSeparator = this._getValue(this._options.pathSegmentSeparator, path15.sep);
6641
6641
  this.fsScandirSettings = new fsScandir.Settings({
6642
6642
  followSymbolicLinks: this._options.followSymbolicLinks,
6643
6643
  fs: this._options.fs,
@@ -6699,7 +6699,7 @@ var require_reader2 = __commonJS({
6699
6699
  "../../node_modules/.pnpm/fast-glob@3.3.3/node_modules/fast-glob/out/readers/reader.js"(exports) {
6700
6700
  "use strict";
6701
6701
  Object.defineProperty(exports, "__esModule", { value: true });
6702
- var path16 = __require("path");
6702
+ var path15 = __require("path");
6703
6703
  var fsStat = require_out();
6704
6704
  var utils = require_utils3();
6705
6705
  var Reader = class {
@@ -6712,7 +6712,7 @@ var require_reader2 = __commonJS({
6712
6712
  });
6713
6713
  }
6714
6714
  _getFullEntryPath(filepath) {
6715
- return path16.resolve(this._settings.cwd, filepath);
6715
+ return path15.resolve(this._settings.cwd, filepath);
6716
6716
  }
6717
6717
  _makeEntry(stats, pattern) {
6718
6718
  const entry = {
@@ -7128,7 +7128,7 @@ var require_provider = __commonJS({
7128
7128
  "../../node_modules/.pnpm/fast-glob@3.3.3/node_modules/fast-glob/out/providers/provider.js"(exports) {
7129
7129
  "use strict";
7130
7130
  Object.defineProperty(exports, "__esModule", { value: true });
7131
- var path16 = __require("path");
7131
+ var path15 = __require("path");
7132
7132
  var deep_1 = require_deep();
7133
7133
  var entry_1 = require_entry();
7134
7134
  var error_1 = require_error();
@@ -7142,7 +7142,7 @@ var require_provider = __commonJS({
7142
7142
  this.entryTransformer = new entry_2.default(this._settings);
7143
7143
  }
7144
7144
  _getRootDirectory(task) {
7145
- return path16.resolve(this._settings.cwd, task.base);
7145
+ return path15.resolve(this._settings.cwd, task.base);
7146
7146
  }
7147
7147
  _getReaderOptions(task) {
7148
7148
  const basePath = task.base === "." ? "" : task.base;
@@ -7775,7 +7775,7 @@ var require_ignore = __commonJS({
7775
7775
  // path matching.
7776
7776
  // - check `string` either `MODE_IGNORE` or `MODE_CHECK_IGNORE`
7777
7777
  // @returns {TestResult} true if a file is ignored
7778
- test(path16, checkUnignored, mode) {
7778
+ test(path15, checkUnignored, mode) {
7779
7779
  let ignored = false;
7780
7780
  let unignored = false;
7781
7781
  let matchedRule;
@@ -7784,7 +7784,7 @@ var require_ignore = __commonJS({
7784
7784
  if (unignored === negative && ignored !== unignored || negative && !ignored && !unignored && !checkUnignored) {
7785
7785
  return;
7786
7786
  }
7787
- const matched = rule[mode].test(path16);
7787
+ const matched = rule[mode].test(path15);
7788
7788
  if (!matched) {
7789
7789
  return;
7790
7790
  }
@@ -7805,17 +7805,17 @@ var require_ignore = __commonJS({
7805
7805
  var throwError = (message, Ctor) => {
7806
7806
  throw new Ctor(message);
7807
7807
  };
7808
- var checkPath = (path16, originalPath, doThrow) => {
7809
- if (!isString(path16)) {
7808
+ var checkPath = (path15, originalPath, doThrow) => {
7809
+ if (!isString(path15)) {
7810
7810
  return doThrow(
7811
7811
  `path must be a string, but got \`${originalPath}\``,
7812
7812
  TypeError
7813
7813
  );
7814
7814
  }
7815
- if (!path16) {
7815
+ if (!path15) {
7816
7816
  return doThrow(`path must not be empty`, TypeError);
7817
7817
  }
7818
- if (checkPath.isNotRelative(path16)) {
7818
+ if (checkPath.isNotRelative(path15)) {
7819
7819
  const r = "`path.relative()`d";
7820
7820
  return doThrow(
7821
7821
  `path should be a ${r} string, but got "${originalPath}"`,
@@ -7824,7 +7824,7 @@ var require_ignore = __commonJS({
7824
7824
  }
7825
7825
  return true;
7826
7826
  };
7827
- var isNotRelative = (path16) => REGEX_TEST_INVALID_PATH.test(path16);
7827
+ var isNotRelative = (path15) => REGEX_TEST_INVALID_PATH.test(path15);
7828
7828
  checkPath.isNotRelative = isNotRelative;
7829
7829
  checkPath.convert = (p) => p;
7830
7830
  var Ignore = class {
@@ -7854,19 +7854,19 @@ var require_ignore = __commonJS({
7854
7854
  }
7855
7855
  // @returns {TestResult}
7856
7856
  _test(originalPath, cache, checkUnignored, slices) {
7857
- const path16 = originalPath && checkPath.convert(originalPath);
7857
+ const path15 = originalPath && checkPath.convert(originalPath);
7858
7858
  checkPath(
7859
- path16,
7859
+ path15,
7860
7860
  originalPath,
7861
7861
  this._strictPathCheck ? throwError : RETURN_FALSE
7862
7862
  );
7863
- return this._t(path16, cache, checkUnignored, slices);
7863
+ return this._t(path15, cache, checkUnignored, slices);
7864
7864
  }
7865
- checkIgnore(path16) {
7866
- if (!REGEX_TEST_TRAILING_SLASH.test(path16)) {
7867
- return this.test(path16);
7865
+ checkIgnore(path15) {
7866
+ if (!REGEX_TEST_TRAILING_SLASH.test(path15)) {
7867
+ return this.test(path15);
7868
7868
  }
7869
- const slices = path16.split(SLASH).filter(Boolean);
7869
+ const slices = path15.split(SLASH).filter(Boolean);
7870
7870
  slices.pop();
7871
7871
  if (slices.length) {
7872
7872
  const parent = this._t(
@@ -7879,18 +7879,18 @@ var require_ignore = __commonJS({
7879
7879
  return parent;
7880
7880
  }
7881
7881
  }
7882
- return this._rules.test(path16, false, MODE_CHECK_IGNORE);
7882
+ return this._rules.test(path15, false, MODE_CHECK_IGNORE);
7883
7883
  }
7884
- _t(path16, cache, checkUnignored, slices) {
7885
- if (path16 in cache) {
7886
- return cache[path16];
7884
+ _t(path15, cache, checkUnignored, slices) {
7885
+ if (path15 in cache) {
7886
+ return cache[path15];
7887
7887
  }
7888
7888
  if (!slices) {
7889
- slices = path16.split(SLASH).filter(Boolean);
7889
+ slices = path15.split(SLASH).filter(Boolean);
7890
7890
  }
7891
7891
  slices.pop();
7892
7892
  if (!slices.length) {
7893
- return cache[path16] = this._rules.test(path16, checkUnignored, MODE_IGNORE);
7893
+ return cache[path15] = this._rules.test(path15, checkUnignored, MODE_IGNORE);
7894
7894
  }
7895
7895
  const parent = this._t(
7896
7896
  slices.join(SLASH) + SLASH,
@@ -7898,29 +7898,29 @@ var require_ignore = __commonJS({
7898
7898
  checkUnignored,
7899
7899
  slices
7900
7900
  );
7901
- return cache[path16] = parent.ignored ? parent : this._rules.test(path16, checkUnignored, MODE_IGNORE);
7901
+ return cache[path15] = parent.ignored ? parent : this._rules.test(path15, checkUnignored, MODE_IGNORE);
7902
7902
  }
7903
- ignores(path16) {
7904
- return this._test(path16, this._ignoreCache, false).ignored;
7903
+ ignores(path15) {
7904
+ return this._test(path15, this._ignoreCache, false).ignored;
7905
7905
  }
7906
7906
  createFilter() {
7907
- return (path16) => !this.ignores(path16);
7907
+ return (path15) => !this.ignores(path15);
7908
7908
  }
7909
7909
  filter(paths) {
7910
7910
  return makeArray(paths).filter(this.createFilter());
7911
7911
  }
7912
7912
  // @returns {TestResult}
7913
- test(path16) {
7914
- return this._test(path16, this._testCache, true);
7913
+ test(path15) {
7914
+ return this._test(path15, this._testCache, true);
7915
7915
  }
7916
7916
  };
7917
7917
  var factory12 = (options) => new Ignore(options);
7918
- var isPathValid = (path16) => checkPath(path16 && checkPath.convert(path16), path16, RETURN_FALSE);
7918
+ var isPathValid = (path15) => checkPath(path15 && checkPath.convert(path15), path15, RETURN_FALSE);
7919
7919
  var setupWindows = () => {
7920
7920
  const makePosix = (str) => /^\\\\\?\\/.test(str) || /["<>|\u0000-\u001F]+/u.test(str) ? str : str.replace(/\\/g, "/");
7921
7921
  checkPath.convert = makePosix;
7922
7922
  const REGEX_TEST_WINDOWS_PATH_ABSOLUTE = /^[a-z]:\//i;
7923
- checkPath.isNotRelative = (path16) => REGEX_TEST_WINDOWS_PATH_ABSOLUTE.test(path16) || isNotRelative(path16);
7923
+ checkPath.isNotRelative = (path15) => REGEX_TEST_WINDOWS_PATH_ABSOLUTE.test(path15) || isNotRelative(path15);
7924
7924
  };
7925
7925
  if (
7926
7926
  // Detect `process` so that it can run in browsers.
@@ -7937,7 +7937,7 @@ var require_ignore = __commonJS({
7937
7937
 
7938
7938
  // ../../node_modules/.pnpm/move-file@4.1.0/node_modules/move-file/index.js
7939
7939
  import process5 from "node:process";
7940
- import path9 from "node:path";
7940
+ import path8 from "node:path";
7941
7941
  import fs4, { promises as fsPromises3 } from "node:fs";
7942
7942
  async function moveFile(sourcePath, destinationPath, options) {
7943
7943
  validatePathsExist(sourcePath, destinationPath);
@@ -7947,8 +7947,8 @@ var resolvePath, validatePathsExist, validateSameDirectory, _moveFile;
7947
7947
  var init_move_file = __esm({
7948
7948
  "../../node_modules/.pnpm/move-file@4.1.0/node_modules/move-file/index.js"() {
7949
7949
  resolvePath = (cwd, sourcePath, destinationPath) => {
7950
- sourcePath = path9.resolve(cwd, sourcePath);
7951
- destinationPath = path9.resolve(cwd, destinationPath);
7950
+ sourcePath = path8.resolve(cwd, sourcePath);
7951
+ destinationPath = path8.resolve(cwd, destinationPath);
7952
7952
  return {
7953
7953
  sourcePath,
7954
7954
  destinationPath
@@ -7960,7 +7960,7 @@ var init_move_file = __esm({
7960
7960
  }
7961
7961
  };
7962
7962
  validateSameDirectory = (source, destination) => {
7963
- if (path9.dirname(source) !== path9.dirname(destination)) {
7963
+ if (path8.dirname(source) !== path8.dirname(destination)) {
7964
7964
  throw new Error("`source` and `destination` must be in the same directory");
7965
7965
  }
7966
7966
  };
@@ -7974,7 +7974,7 @@ var init_move_file = __esm({
7974
7974
  if (!overwrite && fs4.existsSync(destinationPath)) {
7975
7975
  throw new Error(`The destination file exists: ${destinationPath}`);
7976
7976
  }
7977
- await fsPromises3.mkdir(path9.dirname(destinationPath), {
7977
+ await fsPromises3.mkdir(path8.dirname(destinationPath), {
7978
7978
  recursive: true,
7979
7979
  mode: directoryMode
7980
7980
  });
@@ -8058,7 +8058,7 @@ __export(macos_exports, {
8058
8058
  });
8059
8059
  import os2 from "node:os";
8060
8060
  import fs5 from "node:fs";
8061
- import path10 from "node:path";
8061
+ import path9 from "node:path";
8062
8062
  import process6 from "node:process";
8063
8063
  async function macOS(paths) {
8064
8064
  if (isOlderThanMountainLion) {
@@ -8073,19 +8073,19 @@ async function macOS(paths) {
8073
8073
  throw error51;
8074
8074
  }
8075
8075
  const trashDirectories = [
8076
- path10.join(os2.homedir(), ".Trash"),
8077
- path10.join(process6.cwd(), ".Trash")
8076
+ path9.join(os2.homedir(), ".Trash"),
8077
+ path9.join(process6.cwd(), ".Trash")
8078
8078
  ];
8079
8079
  await Promise.all(paths.map(async (filePath) => {
8080
- const base = path10.basename(filePath);
8080
+ const base = path9.basename(filePath);
8081
8081
  let lastError;
8082
8082
  for (const dir of trashDirectories) {
8083
8083
  try {
8084
8084
  await fs5.promises.mkdir(dir, { recursive: true });
8085
- let destination = path10.join(dir, base);
8085
+ let destination = path9.join(dir, base);
8086
8086
  let counter = 1;
8087
8087
  while (fs5.existsSync(destination)) {
8088
- destination = path10.join(dir, `${base} ${counter++}`);
8088
+ destination = path9.join(dir, `${base} ${counter++}`);
8089
8089
  }
8090
8090
  await moveFile(filePath, destination, { overwrite: false });
8091
8091
  return;
@@ -8343,16 +8343,16 @@ var init_wsl_utils = __esm({
8343
8343
  const { stdout } = await executePowerShell(command, { powerShellPath: psPath });
8344
8344
  return stdout.trim();
8345
8345
  };
8346
- isUrl = (path16) => /^[a-z]+:\/\//i.test(path16);
8346
+ isUrl = (path15) => /^[a-z]+:\/\//i.test(path15);
8347
8347
  convertWslPathToWindows = async (paths) => {
8348
8348
  const isBatch = Array.isArray(paths);
8349
8349
  const pathArray = isBatch ? paths : [paths];
8350
8350
  const indicesToConvert = [];
8351
8351
  const pathsToConvert = [];
8352
- for (const [index, path16] of pathArray.entries()) {
8353
- if (!isUrl(path16)) {
8352
+ for (const [index, path15] of pathArray.entries()) {
8353
+ if (!isUrl(path15)) {
8354
8354
  indicesToConvert.push(index);
8355
- pathsToConvert.push(path16);
8355
+ pathsToConvert.push(path15);
8356
8356
  }
8357
8357
  }
8358
8358
  const results = [...pathArray];
@@ -8368,9 +8368,9 @@ var init_wsl_utils = __esm({
8368
8368
  }
8369
8369
  return isBatch ? results : results[0];
8370
8370
  };
8371
- isUncPath = (path16) => /^\\\\/u.test(path16);
8372
- isPathOnWindowsFilesystem = async (path16) => {
8373
- const windowsPath = await convertWslPathToWindows(path16);
8371
+ isUncPath = (path15) => /^\\\\/u.test(path15);
8372
+ isPathOnWindowsFilesystem = async (path15) => {
8373
+ const windowsPath = await convertWslPathToWindows(path15);
8374
8374
  return !isUncPath(windowsPath);
8375
8375
  };
8376
8376
  convertWindowsPathToWsl = async (paths) => {
@@ -8435,7 +8435,7 @@ var require_windows = __commonJS({
8435
8435
  module.exports = isexe;
8436
8436
  isexe.sync = sync;
8437
8437
  var fs12 = __require("fs");
8438
- function checkPathExt(path16, options) {
8438
+ function checkPathExt(path15, options) {
8439
8439
  var pathext = options.pathExt !== void 0 ? options.pathExt : process.env.PATHEXT;
8440
8440
  if (!pathext) {
8441
8441
  return true;
@@ -8446,25 +8446,25 @@ var require_windows = __commonJS({
8446
8446
  }
8447
8447
  for (var i = 0; i < pathext.length; i++) {
8448
8448
  var p = pathext[i].toLowerCase();
8449
- if (p && path16.substr(-p.length).toLowerCase() === p) {
8449
+ if (p && path15.substr(-p.length).toLowerCase() === p) {
8450
8450
  return true;
8451
8451
  }
8452
8452
  }
8453
8453
  return false;
8454
8454
  }
8455
- function checkStat(stat5, path16, options) {
8455
+ function checkStat(stat5, path15, options) {
8456
8456
  if (!stat5.isSymbolicLink() && !stat5.isFile()) {
8457
8457
  return false;
8458
8458
  }
8459
- return checkPathExt(path16, options);
8459
+ return checkPathExt(path15, options);
8460
8460
  }
8461
- function isexe(path16, options, cb) {
8462
- fs12.stat(path16, function(er, stat5) {
8463
- cb(er, er ? false : checkStat(stat5, path16, options));
8461
+ function isexe(path15, options, cb) {
8462
+ fs12.stat(path15, function(er, stat5) {
8463
+ cb(er, er ? false : checkStat(stat5, path15, options));
8464
8464
  });
8465
8465
  }
8466
- function sync(path16, options) {
8467
- return checkStat(fs12.statSync(path16), path16, options);
8466
+ function sync(path15, options) {
8467
+ return checkStat(fs12.statSync(path15), path15, options);
8468
8468
  }
8469
8469
  }
8470
8470
  });
@@ -8475,13 +8475,13 @@ var require_mode = __commonJS({
8475
8475
  module.exports = isexe;
8476
8476
  isexe.sync = sync;
8477
8477
  var fs12 = __require("fs");
8478
- function isexe(path16, options, cb) {
8479
- fs12.stat(path16, function(er, stat5) {
8478
+ function isexe(path15, options, cb) {
8479
+ fs12.stat(path15, function(er, stat5) {
8480
8480
  cb(er, er ? false : checkStat(stat5, options));
8481
8481
  });
8482
8482
  }
8483
- function sync(path16, options) {
8484
- return checkStat(fs12.statSync(path16), options);
8483
+ function sync(path15, options) {
8484
+ return checkStat(fs12.statSync(path15), options);
8485
8485
  }
8486
8486
  function checkStat(stat5, options) {
8487
8487
  return stat5.isFile() && checkMode(stat5, options);
@@ -8514,7 +8514,7 @@ var require_isexe = __commonJS({
8514
8514
  }
8515
8515
  module.exports = isexe;
8516
8516
  isexe.sync = sync;
8517
- function isexe(path16, options, cb) {
8517
+ function isexe(path15, options, cb) {
8518
8518
  if (typeof options === "function") {
8519
8519
  cb = options;
8520
8520
  options = {};
@@ -8524,7 +8524,7 @@ var require_isexe = __commonJS({
8524
8524
  throw new TypeError("callback not provided");
8525
8525
  }
8526
8526
  return new Promise(function(resolve2, reject) {
8527
- isexe(path16, options || {}, function(er, is) {
8527
+ isexe(path15, options || {}, function(er, is) {
8528
8528
  if (er) {
8529
8529
  reject(er);
8530
8530
  } else {
@@ -8533,7 +8533,7 @@ var require_isexe = __commonJS({
8533
8533
  });
8534
8534
  });
8535
8535
  }
8536
- core(path16, options || {}, function(er, is) {
8536
+ core(path15, options || {}, function(er, is) {
8537
8537
  if (er) {
8538
8538
  if (er.code === "EACCES" || options && options.ignoreErrors) {
8539
8539
  er = null;
@@ -8543,9 +8543,9 @@ var require_isexe = __commonJS({
8543
8543
  cb(er, is);
8544
8544
  });
8545
8545
  }
8546
- function sync(path16, options) {
8546
+ function sync(path15, options) {
8547
8547
  try {
8548
- return core.sync(path16, options || {});
8548
+ return core.sync(path15, options || {});
8549
8549
  } catch (er) {
8550
8550
  if (options && options.ignoreErrors || er.code === "EACCES") {
8551
8551
  return false;
@@ -8561,7 +8561,7 @@ var require_isexe = __commonJS({
8561
8561
  var require_which = __commonJS({
8562
8562
  "../../node_modules/.pnpm/which@2.0.2/node_modules/which/which.js"(exports, module) {
8563
8563
  var isWindows = process.platform === "win32" || process.env.OSTYPE === "cygwin" || process.env.OSTYPE === "msys";
8564
- var path16 = __require("path");
8564
+ var path15 = __require("path");
8565
8565
  var COLON = isWindows ? ";" : ":";
8566
8566
  var isexe = require_isexe();
8567
8567
  var getNotFoundError = (cmd) => Object.assign(new Error(`not found: ${cmd}`), { code: "ENOENT" });
@@ -8599,7 +8599,7 @@ var require_which = __commonJS({
8599
8599
  return opt.all && found.length ? resolve2(found) : reject(getNotFoundError(cmd));
8600
8600
  const ppRaw = pathEnv[i];
8601
8601
  const pathPart = /^".*"$/.test(ppRaw) ? ppRaw.slice(1, -1) : ppRaw;
8602
- const pCmd = path16.join(pathPart, cmd);
8602
+ const pCmd = path15.join(pathPart, cmd);
8603
8603
  const p = !pathPart && /^\.[\\\/]/.test(cmd) ? cmd.slice(0, 2) + pCmd : pCmd;
8604
8604
  resolve2(subStep(p, i, 0));
8605
8605
  });
@@ -8626,7 +8626,7 @@ var require_which = __commonJS({
8626
8626
  for (let i = 0; i < pathEnv.length; i++) {
8627
8627
  const ppRaw = pathEnv[i];
8628
8628
  const pathPart = /^".*"$/.test(ppRaw) ? ppRaw.slice(1, -1) : ppRaw;
8629
- const pCmd = path16.join(pathPart, cmd);
8629
+ const pCmd = path15.join(pathPart, cmd);
8630
8630
  const p = !pathPart && /^\.[\\\/]/.test(cmd) ? cmd.slice(0, 2) + pCmd : pCmd;
8631
8631
  for (let j = 0; j < pathExt.length; j++) {
8632
8632
  const cur = p + pathExt[j];
@@ -8674,7 +8674,7 @@ var require_path_key = __commonJS({
8674
8674
  var require_resolveCommand = __commonJS({
8675
8675
  "../../node_modules/.pnpm/cross-spawn@7.0.6/node_modules/cross-spawn/lib/util/resolveCommand.js"(exports, module) {
8676
8676
  "use strict";
8677
- var path16 = __require("path");
8677
+ var path15 = __require("path");
8678
8678
  var which = require_which();
8679
8679
  var getPathKey = require_path_key();
8680
8680
  function resolveCommandAttempt(parsed, withoutPathExt) {
@@ -8692,7 +8692,7 @@ var require_resolveCommand = __commonJS({
8692
8692
  try {
8693
8693
  resolved = which.sync(parsed.command, {
8694
8694
  path: env[getPathKey({ env })],
8695
- pathExt: withoutPathExt ? path16.delimiter : void 0
8695
+ pathExt: withoutPathExt ? path15.delimiter : void 0
8696
8696
  });
8697
8697
  } catch (e) {
8698
8698
  } finally {
@@ -8701,7 +8701,7 @@ var require_resolveCommand = __commonJS({
8701
8701
  }
8702
8702
  }
8703
8703
  if (resolved) {
8704
- resolved = path16.resolve(hasCustomCwd ? parsed.options.cwd : "", resolved);
8704
+ resolved = path15.resolve(hasCustomCwd ? parsed.options.cwd : "", resolved);
8705
8705
  }
8706
8706
  return resolved;
8707
8707
  }
@@ -8755,8 +8755,8 @@ var require_shebang_command = __commonJS({
8755
8755
  if (!match2) {
8756
8756
  return null;
8757
8757
  }
8758
- const [path16, argument] = match2[0].replace(/#! ?/, "").split(" ");
8759
- const binary3 = path16.split("/").pop();
8758
+ const [path15, argument] = match2[0].replace(/#! ?/, "").split(" ");
8759
+ const binary3 = path15.split("/").pop();
8760
8760
  if (binary3 === "env") {
8761
8761
  return argument;
8762
8762
  }
@@ -8791,7 +8791,7 @@ var require_readShebang = __commonJS({
8791
8791
  var require_parse3 = __commonJS({
8792
8792
  "../../node_modules/.pnpm/cross-spawn@7.0.6/node_modules/cross-spawn/lib/parse.js"(exports, module) {
8793
8793
  "use strict";
8794
- var path16 = __require("path");
8794
+ var path15 = __require("path");
8795
8795
  var resolveCommand = require_resolveCommand();
8796
8796
  var escape = require_escape();
8797
8797
  var readShebang = require_readShebang();
@@ -8816,7 +8816,7 @@ var require_parse3 = __commonJS({
8816
8816
  const needsShell = !isExecutableRegExp.test(commandFile);
8817
8817
  if (parsed.options.forceShell || needsShell) {
8818
8818
  const needsDoubleEscapeMetaChars = isCmdShimRegExp.test(commandFile);
8819
- parsed.command = path16.normalize(parsed.command);
8819
+ parsed.command = path15.normalize(parsed.command);
8820
8820
  parsed.command = escape.command(parsed.command);
8821
8821
  parsed.args = parsed.args.map((arg) => escape.argument(arg, needsDoubleEscapeMetaChars));
8822
8822
  const shellCommand = [parsed.command].concat(parsed.args).join(" ");
@@ -8948,7 +8948,7 @@ var require_strip_final_newline = __commonJS({
8948
8948
  var require_npm_run_path = __commonJS({
8949
8949
  "../../node_modules/.pnpm/npm-run-path@3.1.0/node_modules/npm-run-path/index.js"(exports, module) {
8950
8950
  "use strict";
8951
- var path16 = __require("path");
8951
+ var path15 = __require("path");
8952
8952
  var pathKey = require_path_key();
8953
8953
  var npmRunPath = (options) => {
8954
8954
  options = {
@@ -8957,15 +8957,15 @@ var require_npm_run_path = __commonJS({
8957
8957
  ...options
8958
8958
  };
8959
8959
  let previous;
8960
- let cwdPath = path16.resolve(options.cwd);
8960
+ let cwdPath = path15.resolve(options.cwd);
8961
8961
  const result = [];
8962
8962
  while (previous !== cwdPath) {
8963
- result.push(path16.join(cwdPath, "node_modules/.bin"));
8963
+ result.push(path15.join(cwdPath, "node_modules/.bin"));
8964
8964
  previous = cwdPath;
8965
- cwdPath = path16.resolve(cwdPath, "..");
8965
+ cwdPath = path15.resolve(cwdPath, "..");
8966
8966
  }
8967
- result.push(path16.dirname(process.execPath));
8968
- return result.concat(options.path).join(path16.delimiter);
8967
+ result.push(path15.dirname(process.execPath));
8968
+ return result.concat(options.path).join(path15.delimiter);
8969
8969
  };
8970
8970
  module.exports = npmRunPath;
8971
8971
  module.exports.default = npmRunPath;
@@ -8975,9 +8975,9 @@ var require_npm_run_path = __commonJS({
8975
8975
  ...options
8976
8976
  };
8977
8977
  const env = { ...options.env };
8978
- const path17 = pathKey({ env });
8979
- options.path = env[path17];
8980
- env[path17] = module.exports(options);
8978
+ const path16 = pathKey({ env });
8979
+ options.path = env[path16];
8980
+ env[path16] = module.exports(options);
8981
8981
  return env;
8982
8982
  };
8983
8983
  }
@@ -9998,7 +9998,7 @@ var require_command = __commonJS({
9998
9998
  var require_execa = __commonJS({
9999
9999
  "../../node_modules/.pnpm/execa@2.1.0/node_modules/execa/index.js"(exports, module) {
10000
10000
  "use strict";
10001
- var path16 = __require("path");
10001
+ var path15 = __require("path");
10002
10002
  var childProcess4 = __require("child_process");
10003
10003
  var crossSpawn = require_cross_spawn();
10004
10004
  var stripFinalNewline = require_strip_final_newline();
@@ -10038,7 +10038,7 @@ var require_execa = __commonJS({
10038
10038
  };
10039
10039
  options.env = getEnv(options);
10040
10040
  options.stdio = normalizeStdio(options);
10041
- if (process.platform === "win32" && path16.basename(file2, ".exe") === "cmd") {
10041
+ if (process.platform === "win32" && path15.basename(file2, ".exe") === "cmd") {
10042
10042
  args.unshift("/q");
10043
10043
  }
10044
10044
  return { file: file2, args, options, parsed };
@@ -10695,12 +10695,12 @@ var require_xdg_basedir = __commonJS({
10695
10695
  "../../node_modules/.pnpm/xdg-basedir@4.0.0/node_modules/xdg-basedir/index.js"(exports) {
10696
10696
  "use strict";
10697
10697
  var os7 = __require("os");
10698
- var path16 = __require("path");
10698
+ var path15 = __require("path");
10699
10699
  var homeDirectory = os7.homedir();
10700
10700
  var { env } = process;
10701
- exports.data = env.XDG_DATA_HOME || (homeDirectory ? path16.join(homeDirectory, ".local", "share") : void 0);
10702
- exports.config = env.XDG_CONFIG_HOME || (homeDirectory ? path16.join(homeDirectory, ".config") : void 0);
10703
- exports.cache = env.XDG_CACHE_HOME || (homeDirectory ? path16.join(homeDirectory, ".cache") : void 0);
10701
+ exports.data = env.XDG_DATA_HOME || (homeDirectory ? path15.join(homeDirectory, ".local", "share") : void 0);
10702
+ exports.config = env.XDG_CONFIG_HOME || (homeDirectory ? path15.join(homeDirectory, ".config") : void 0);
10703
+ exports.cache = env.XDG_CACHE_HOME || (homeDirectory ? path15.join(homeDirectory, ".cache") : void 0);
10704
10704
  exports.runtime = env.XDG_RUNTIME_DIR || void 0;
10705
10705
  exports.dataDirs = (env.XDG_DATA_DIRS || "/usr/local/share/:/usr/share/").split(":");
10706
10706
  if (exports.data) {
@@ -10718,7 +10718,7 @@ var require_xdg_trashdir = __commonJS({
10718
10718
  "../../node_modules/.pnpm/xdg-trashdir@3.1.0/node_modules/xdg-trashdir/index.js"(exports, module) {
10719
10719
  "use strict";
10720
10720
  var fs12 = __require("fs").promises;
10721
- var path16 = __require("path");
10721
+ var path15 = __require("path");
10722
10722
  var df = require_df();
10723
10723
  var mountPoint = require_mount_point();
10724
10724
  var userHome = require_user_home();
@@ -10731,12 +10731,12 @@ var require_xdg_trashdir = __commonJS({
10731
10731
  if (stats.isSymbolicLink() || stats.mode !== stickyBitMode) {
10732
10732
  return topuid;
10733
10733
  }
10734
- return path16.join(filePath, String(process.getuid()));
10734
+ return path15.join(filePath, String(process.getuid()));
10735
10735
  } catch (error51) {
10736
10736
  if (error51.code === "ENOENT") {
10737
10737
  return topuid;
10738
10738
  }
10739
- return path16.join(xdgBasedir.data, "Trash");
10739
+ return path15.join(xdgBasedir.data, "Trash");
10740
10740
  }
10741
10741
  };
10742
10742
  module.exports = async (filePath) => {
@@ -10744,7 +10744,7 @@ var require_xdg_trashdir = __commonJS({
10744
10744
  return Promise.reject(new Error("Only Linux systems are supported"));
10745
10745
  }
10746
10746
  if (!filePath) {
10747
- return Promise.resolve(path16.join(xdgBasedir.data, "Trash"));
10747
+ return Promise.resolve(path15.join(xdgBasedir.data, "Trash"));
10748
10748
  }
10749
10749
  const [homeMountPoint, fileMountPoint] = await Promise.all([
10750
10750
  mountPoint(userHome),
@@ -10753,9 +10753,9 @@ var require_xdg_trashdir = __commonJS({
10753
10753
  })
10754
10754
  ]);
10755
10755
  if (!fileMountPoint || fileMountPoint === homeMountPoint) {
10756
- return path16.join(xdgBasedir.data, "Trash");
10756
+ return path15.join(xdgBasedir.data, "Trash");
10757
10757
  }
10758
- return check2(path16.join(fileMountPoint, ".Trash"));
10758
+ return check2(path15.join(fileMountPoint, ".Trash"));
10759
10759
  };
10760
10760
  module.exports.all = async () => {
10761
10761
  if (process.platform !== "linux") {
@@ -10763,9 +10763,9 @@ var require_xdg_trashdir = __commonJS({
10763
10763
  }
10764
10764
  return Promise.all((await df()).map((fileSystem) => {
10765
10765
  if (fileSystem.mountpoint === "/") {
10766
- return path16.join(xdgBasedir.data, "Trash");
10766
+ return path15.join(xdgBasedir.data, "Trash");
10767
10767
  }
10768
- return check2(path16.join(fileSystem.mountpoint, ".Trash"));
10768
+ return check2(path15.join(fileSystem.mountpoint, ".Trash"));
10769
10769
  }));
10770
10770
  };
10771
10771
  }
@@ -11139,8 +11139,8 @@ var require_utils6 = __commonJS({
11139
11139
  var tmpBufMinLen = 4096 * 2;
11140
11140
  var tmpBufMaxLen = 4096 * 8;
11141
11141
  var tmpBuf = Buffer.allocUnsafeSlow(tmpBufMinLen);
11142
- var read = (path16) => {
11143
- const fd = openSync(path16, "r", 438);
11142
+ var read = (path15) => {
11143
+ const fd = openSync(path15, "r", 438);
11144
11144
  let pos = 0;
11145
11145
  let bytesRead;
11146
11146
  let buf = tmpBuf;
@@ -11161,8 +11161,8 @@ var require_utils6 = __commonJS({
11161
11161
  closeSync(fd);
11162
11162
  return buf.toString("utf8", 0, pos);
11163
11163
  };
11164
- var readIdList = (path16) => {
11165
- let ls = readdirSync(path16);
11164
+ var readIdList = (path15) => {
11165
+ let ls = readdirSync(path15);
11166
11166
  for (let i = 0; i < ls.length; i++) {
11167
11167
  ls[i] = parseInt(ls[i]);
11168
11168
  }
@@ -12329,7 +12329,7 @@ var require_procfs = __commonJS({
12329
12329
  Procfs.prototype.devIdGetMinor = devIdGetMinor;
12330
12330
  Procfs.prototype.devIdGetMajor = devIdGetMajor;
12331
12331
  Procfs.prototype.devIdFromMajorMinor = devIdFromMajorMinor;
12332
- for (let [name21, path16] of [
12332
+ for (let [name21, path15] of [
12333
12333
  ["processExe", "/exe"],
12334
12334
  ["processCwd", "/cwd"]
12335
12335
  ]) {
@@ -12338,13 +12338,13 @@ var require_procfs = __commonJS({
12338
12338
  throw new TypeError("pid");
12339
12339
  }
12340
12340
  try {
12341
- return parsers[name21](readLink(`${this.rootSlash}${pid === void 0 ? "self" : pid}${path16}`));
12341
+ return parsers[name21](readLink(`${this.rootSlash}${pid === void 0 ? "self" : pid}${path15}`));
12342
12342
  } catch (error51) {
12343
12343
  throw ProcfsError.generic(error51);
12344
12344
  }
12345
12345
  };
12346
12346
  }
12347
- for (let [name21, path16] of [
12347
+ for (let [name21, path15] of [
12348
12348
  ["processMountinfo", "/mountinfo"],
12349
12349
  ["processIo", "/io"],
12350
12350
  ["processUidMap", "/uid_map"],
@@ -12375,7 +12375,7 @@ var require_procfs = __commonJS({
12375
12375
  throw new TypeError("pid");
12376
12376
  }
12377
12377
  try {
12378
- return parsers[name21](read(`${this.rootSlash}${pid === void 0 ? "self" : pid}${path16}`));
12378
+ return parsers[name21](read(`${this.rootSlash}${pid === void 0 ? "self" : pid}${path15}`));
12379
12379
  } catch (error51) {
12380
12380
  throw ProcfsError.generic(error51);
12381
12381
  }
@@ -12404,7 +12404,7 @@ var require_procfs = __commonJS({
12404
12404
  }
12405
12405
  };
12406
12406
  }
12407
- for (let [name21, parser, path16] of [
12407
+ for (let [name21, parser, path15] of [
12408
12408
  ["netDev", "processNetDev", "net/dev"],
12409
12409
  ["netWireless", "processNetWireless", "net/wireless"],
12410
12410
  ["netUnix", "processNetUnix", "net/unix"],
@@ -12415,7 +12415,7 @@ var require_procfs = __commonJS({
12415
12415
  ]) {
12416
12416
  Procfs.prototype[name21] = function() {
12417
12417
  try {
12418
- return parsers[parser](read(this.rootSlash + path16));
12418
+ return parsers[parser](read(this.rootSlash + path15));
12419
12419
  } catch (error51) {
12420
12420
  throw ProcfsError.generic(error51);
12421
12421
  }
@@ -12436,7 +12436,7 @@ __export(linux_exports, {
12436
12436
  default: () => linux
12437
12437
  });
12438
12438
  import os4 from "node:os";
12439
- import path11 from "node:path";
12439
+ import path10 from "node:path";
12440
12440
  import fs10 from "node:fs";
12441
12441
  import { randomUUID as randomUUID2 } from "node:crypto";
12442
12442
  async function linux(paths) {
@@ -12459,8 +12459,8 @@ async function linux(paths) {
12459
12459
  const mountPoint = deviceId === homeDevId ? void 0 : mountPointMap.get(deviceId);
12460
12460
  const trashPath = await (0, import_xdg_trashdir.default)(mountPoint);
12461
12461
  const paths2 = {
12462
- filesPath: path11.join(trashPath, "files"),
12463
- infoPath: path11.join(trashPath, "info")
12462
+ filesPath: path10.join(trashPath, "files"),
12463
+ infoPath: path10.join(trashPath, "info")
12464
12464
  };
12465
12465
  await fs10.promises.mkdir(paths2.filesPath, { mode: 448, recursive: true });
12466
12466
  await fs10.promises.mkdir(paths2.infoPath, { mode: 448, recursive: true });
@@ -12500,8 +12500,8 @@ var init_linux = __esm({
12500
12500
  };
12501
12501
  trash = async (filePath, { filesPath, infoPath }) => {
12502
12502
  const name21 = randomUUID2();
12503
- const destination = path11.join(filesPath, name21);
12504
- const trashInfoPath = path11.join(infoPath, `${name21}.trashinfo`);
12503
+ const destination = path10.join(filesPath, name21);
12504
+ const trashInfoPath = path10.join(infoPath, `${name21}.trashinfo`);
12505
12505
  const trashInfo = [
12506
12506
  "[Trash Info]",
12507
12507
  `Path=${encodeFilePath(filePath)}`,
@@ -13629,13 +13629,14 @@ var serve = (options, listeningListener) => {
13629
13629
  };
13630
13630
 
13631
13631
  // src/index.ts
13632
- import path15 from "node:path";
13632
+ import path14 from "node:path";
13633
13633
 
13634
13634
  // src/app.ts
13635
13635
  import { createWriteStream, statSync as statSync2 } from "node:fs";
13636
13636
  import { mkdtemp, readFile as readFile5, rm as rm2, stat as stat4 } from "node:fs/promises";
13637
+ import { randomUUID as randomUUID3 } from "node:crypto";
13637
13638
  import os6 from "node:os";
13638
- import path14 from "node:path";
13639
+ import path13 from "node:path";
13639
13640
 
13640
13641
  // ../../node_modules/.pnpm/@hono+node-server@2.0.4_hono@4.12.23/node_modules/@hono/node-server/dist/utils/stream.mjs
13641
13642
  import { Readable as Readable2 } from "node:stream";
@@ -13778,10 +13779,10 @@ var ENCODINGS = {
13778
13779
  gzip: ".gz"
13779
13780
  };
13780
13781
  var ENCODINGS_ORDERED_KEYS = Object.keys(ENCODINGS);
13781
- var getStats = (path16) => {
13782
+ var getStats = (path15) => {
13782
13783
  let stats;
13783
13784
  try {
13784
- stats = statSync(path16);
13785
+ stats = statSync(path15);
13785
13786
  } catch {
13786
13787
  }
13787
13788
  return stats;
@@ -13815,29 +13816,29 @@ var serveStatic = (options = { root: "" }) => {
13815
13816
  await options.onNotFound?.(c.req.path, c);
13816
13817
  return next();
13817
13818
  }
13818
- let path16 = join(root, !optionPath && options.rewriteRequestPath ? options.rewriteRequestPath(filename, c) : filename);
13819
- let stats = getStats(path16);
13819
+ let path15 = join(root, !optionPath && options.rewriteRequestPath ? options.rewriteRequestPath(filename, c) : filename);
13820
+ let stats = getStats(path15);
13820
13821
  if (stats && stats.isDirectory()) {
13821
13822
  const indexFile = options.index ?? "index.html";
13822
- path16 = join(path16, indexFile);
13823
- stats = getStats(path16);
13823
+ path15 = join(path15, indexFile);
13824
+ stats = getStats(path15);
13824
13825
  }
13825
13826
  if (!stats) {
13826
- await options.onNotFound?.(path16, c);
13827
+ await options.onNotFound?.(path15, c);
13827
13828
  return next();
13828
13829
  }
13829
- const mimeType = getMimeType(path16);
13830
+ const mimeType = getMimeType(path15);
13830
13831
  c.header("Content-Type", mimeType || "application/octet-stream");
13831
13832
  if (options.precompressed && (!mimeType || COMPRESSIBLE_CONTENT_TYPE_REGEX.test(mimeType))) {
13832
13833
  const acceptEncodingSet = new Set(c.req.header("Accept-Encoding")?.split(",").map((encoding) => encoding.trim()));
13833
13834
  for (const encoding of ENCODINGS_ORDERED_KEYS) {
13834
13835
  if (!acceptEncodingSet.has(encoding)) continue;
13835
- const precompressedStats = getStats(path16 + ENCODINGS[encoding]);
13836
+ const precompressedStats = getStats(path15 + ENCODINGS[encoding]);
13836
13837
  if (precompressedStats) {
13837
13838
  c.header("Content-Encoding", encoding);
13838
13839
  c.header("Vary", "Accept-Encoding", { append: true });
13839
13840
  stats = precompressedStats;
13840
- path16 = path16 + ENCODINGS[encoding];
13841
+ path15 = path15 + ENCODINGS[encoding];
13841
13842
  break;
13842
13843
  }
13843
13844
  }
@@ -13852,7 +13853,7 @@ var serveStatic = (options = { root: "" }) => {
13852
13853
  result = c.body(null);
13853
13854
  } else if (!range) {
13854
13855
  c.header("Content-Length", size.toString());
13855
- result = c.body(createStreamBody(createReadStream(path16)), 200);
13856
+ result = c.body(createStreamBody(createReadStream(path15)), 200);
13856
13857
  } else {
13857
13858
  c.header("Accept-Ranges", "bytes");
13858
13859
  const parts = range.replace(/bytes=/, "").split("-", 2);
@@ -13860,7 +13861,7 @@ var serveStatic = (options = { root: "" }) => {
13860
13861
  let end = parseInt(parts[1], 10) || size - 1;
13861
13862
  if (size < end - start + 1) end = size - 1;
13862
13863
  const chunksize = end - start + 1;
13863
- const stream2 = createReadStream(path16, {
13864
+ const stream2 = createReadStream(path15, {
13864
13865
  start,
13865
13866
  end
13866
13867
  });
@@ -13868,7 +13869,7 @@ var serveStatic = (options = { root: "" }) => {
13868
13869
  c.header("Content-Range", `bytes ${start}-${end}/${stats.size}`);
13869
13870
  result = c.body(createStreamBody(stream2), 206);
13870
13871
  }
13871
- await options.onFound?.(path16, c);
13872
+ await options.onFound?.(path15, c);
13872
13873
  return result;
13873
13874
  };
13874
13875
  };
@@ -14196,26 +14197,26 @@ var handleParsingNestedValues = (form, key, value) => {
14196
14197
  };
14197
14198
 
14198
14199
  // ../../node_modules/.pnpm/hono@4.12.23/node_modules/hono/dist/utils/url.js
14199
- var splitPath = (path16) => {
14200
- const paths = path16.split("/");
14200
+ var splitPath = (path15) => {
14201
+ const paths = path15.split("/");
14201
14202
  if (paths[0] === "") {
14202
14203
  paths.shift();
14203
14204
  }
14204
14205
  return paths;
14205
14206
  };
14206
14207
  var splitRoutingPath = (routePath) => {
14207
- const { groups, path: path16 } = extractGroupsFromPath(routePath);
14208
- const paths = splitPath(path16);
14208
+ const { groups, path: path15 } = extractGroupsFromPath(routePath);
14209
+ const paths = splitPath(path15);
14209
14210
  return replaceGroupMarks(paths, groups);
14210
14211
  };
14211
- var extractGroupsFromPath = (path16) => {
14212
+ var extractGroupsFromPath = (path15) => {
14212
14213
  const groups = [];
14213
- path16 = path16.replace(/\{[^}]+\}/g, (match2, index) => {
14214
+ path15 = path15.replace(/\{[^}]+\}/g, (match2, index) => {
14214
14215
  const mark = `@${index}`;
14215
14216
  groups.push([mark, match2]);
14216
14217
  return mark;
14217
14218
  });
14218
- return { groups, path: path16 };
14219
+ return { groups, path: path15 };
14219
14220
  };
14220
14221
  var replaceGroupMarks = (paths, groups) => {
14221
14222
  for (let i = groups.length - 1; i >= 0; i--) {
@@ -14272,8 +14273,8 @@ var getPath = (request) => {
14272
14273
  const queryIndex = url2.indexOf("?", i);
14273
14274
  const hashIndex = url2.indexOf("#", i);
14274
14275
  const end = queryIndex === -1 ? hashIndex === -1 ? void 0 : hashIndex : hashIndex === -1 ? queryIndex : Math.min(queryIndex, hashIndex);
14275
- const path16 = url2.slice(start, end);
14276
- return tryDecodeURI2(path16.includes("%25") ? path16.replace(/%25/g, "%2525") : path16);
14276
+ const path15 = url2.slice(start, end);
14277
+ return tryDecodeURI2(path15.includes("%25") ? path15.replace(/%25/g, "%2525") : path15);
14277
14278
  } else if (charCode === 63 || charCode === 35) {
14278
14279
  break;
14279
14280
  }
@@ -14290,11 +14291,11 @@ var mergePath = (base, sub, ...rest) => {
14290
14291
  }
14291
14292
  return `${base?.[0] === "/" ? "" : "/"}${base}${sub === "/" ? "" : `${base?.at(-1) === "/" ? "" : "/"}${sub?.[0] === "/" ? sub.slice(1) : sub}`}`;
14292
14293
  };
14293
- var checkOptionalParameter = (path16) => {
14294
- if (path16.charCodeAt(path16.length - 1) !== 63 || !path16.includes(":")) {
14294
+ var checkOptionalParameter = (path15) => {
14295
+ if (path15.charCodeAt(path15.length - 1) !== 63 || !path15.includes(":")) {
14295
14296
  return null;
14296
14297
  }
14297
- const segments = path16.split("/");
14298
+ const segments = path15.split("/");
14298
14299
  const results = [];
14299
14300
  let basePath = "";
14300
14301
  segments.forEach((segment) => {
@@ -14435,9 +14436,9 @@ var HonoRequest = class {
14435
14436
  */
14436
14437
  path;
14437
14438
  bodyCache = {};
14438
- constructor(request, path16 = "/", matchResult = [[]]) {
14439
+ constructor(request, path15 = "/", matchResult = [[]]) {
14439
14440
  this.raw = request;
14440
- this.path = path16;
14441
+ this.path = path15;
14441
14442
  this.#matchResult = matchResult;
14442
14443
  this.#validatedData = {};
14443
14444
  }
@@ -15191,8 +15192,8 @@ var Hono = class _Hono {
15191
15192
  return this;
15192
15193
  };
15193
15194
  });
15194
- this.on = (method, path16, ...handlers) => {
15195
- for (const p of [path16].flat()) {
15195
+ this.on = (method, path15, ...handlers) => {
15196
+ for (const p of [path15].flat()) {
15196
15197
  this.#path = p;
15197
15198
  for (const m of [method].flat()) {
15198
15199
  handlers.map((handler) => {
@@ -15249,8 +15250,8 @@ var Hono = class _Hono {
15249
15250
  * app.route("/api", app2) // GET /api/user
15250
15251
  * ```
15251
15252
  */
15252
- route(path16, app2) {
15253
- const subApp = this.basePath(path16);
15253
+ route(path15, app2) {
15254
+ const subApp = this.basePath(path15);
15254
15255
  app2.routes.map((r) => {
15255
15256
  let handler;
15256
15257
  if (app2.errorHandler === errorHandler) {
@@ -15276,9 +15277,9 @@ var Hono = class _Hono {
15276
15277
  * const api = new Hono().basePath('/api')
15277
15278
  * ```
15278
15279
  */
15279
- basePath(path16) {
15280
+ basePath(path15) {
15280
15281
  const subApp = this.#clone();
15281
- subApp._basePath = mergePath(this._basePath, path16);
15282
+ subApp._basePath = mergePath(this._basePath, path15);
15282
15283
  return subApp;
15283
15284
  }
15284
15285
  /**
@@ -15352,7 +15353,7 @@ var Hono = class _Hono {
15352
15353
  * })
15353
15354
  * ```
15354
15355
  */
15355
- mount(path16, applicationHandler, options) {
15356
+ mount(path15, applicationHandler, options) {
15356
15357
  let replaceRequest;
15357
15358
  let optionHandler;
15358
15359
  if (options) {
@@ -15379,7 +15380,7 @@ var Hono = class _Hono {
15379
15380
  return [c.env, executionContext];
15380
15381
  };
15381
15382
  replaceRequest ||= (() => {
15382
- const mergedPath = mergePath(this._basePath, path16);
15383
+ const mergedPath = mergePath(this._basePath, path15);
15383
15384
  const pathPrefixLength = mergedPath === "/" ? 0 : mergedPath.length;
15384
15385
  return (request) => {
15385
15386
  const url2 = new URL(request.url);
@@ -15394,19 +15395,19 @@ var Hono = class _Hono {
15394
15395
  }
15395
15396
  await next();
15396
15397
  };
15397
- this.#addRoute(METHOD_NAME_ALL, mergePath(path16, "*"), handler);
15398
+ this.#addRoute(METHOD_NAME_ALL, mergePath(path15, "*"), handler);
15398
15399
  return this;
15399
15400
  }
15400
- #addRoute(method, path16, handler, baseRoutePath) {
15401
+ #addRoute(method, path15, handler, baseRoutePath) {
15401
15402
  method = method.toUpperCase();
15402
- path16 = mergePath(this._basePath, path16);
15403
+ path15 = mergePath(this._basePath, path15);
15403
15404
  const r = {
15404
15405
  basePath: baseRoutePath !== void 0 ? mergePath(this._basePath, baseRoutePath) : this._basePath,
15405
- path: path16,
15406
+ path: path15,
15406
15407
  method,
15407
15408
  handler
15408
15409
  };
15409
- this.router.add(method, path16, [handler, r]);
15410
+ this.router.add(method, path15, [handler, r]);
15410
15411
  this.routes.push(r);
15411
15412
  }
15412
15413
  #handleError(err, c) {
@@ -15419,10 +15420,10 @@ var Hono = class _Hono {
15419
15420
  if (method === "HEAD") {
15420
15421
  return (async () => new Response(null, await this.#dispatch(request, executionCtx, env, "GET")))();
15421
15422
  }
15422
- const path16 = this.getPath(request, { env });
15423
- const matchResult = this.router.match(method, path16);
15423
+ const path15 = this.getPath(request, { env });
15424
+ const matchResult = this.router.match(method, path15);
15424
15425
  const c = new Context(request, {
15425
- path: path16,
15426
+ path: path15,
15426
15427
  matchResult,
15427
15428
  env,
15428
15429
  executionCtx,
@@ -15522,7 +15523,7 @@ var Hono = class _Hono {
15522
15523
 
15523
15524
  // ../../node_modules/.pnpm/hono@4.12.23/node_modules/hono/dist/router/reg-exp-router/matcher.js
15524
15525
  var emptyParam = [];
15525
- function match(method, path16) {
15526
+ function match(method, path15) {
15526
15527
  const matchers = this.buildAllMatchers();
15527
15528
  const match2 = ((method2, path22) => {
15528
15529
  const matcher = matchers[method2] || matchers[METHOD_NAME_ALL];
@@ -15538,7 +15539,7 @@ function match(method, path16) {
15538
15539
  return [matcher[1][index], match3];
15539
15540
  });
15540
15541
  this.match = match2;
15541
- return match2(method, path16);
15542
+ return match2(method, path15);
15542
15543
  }
15543
15544
 
15544
15545
  // ../../node_modules/.pnpm/hono@4.12.23/node_modules/hono/dist/router/reg-exp-router/node.js
@@ -15653,12 +15654,12 @@ var Node = class _Node {
15653
15654
  var Trie = class {
15654
15655
  #context = { varIndex: 0 };
15655
15656
  #root = new Node();
15656
- insert(path16, index, pathErrorCheckOnly) {
15657
+ insert(path15, index, pathErrorCheckOnly) {
15657
15658
  const paramAssoc = [];
15658
15659
  const groups = [];
15659
15660
  for (let i = 0; ; ) {
15660
15661
  let replaced = false;
15661
- path16 = path16.replace(/\{[^}]+\}/g, (m) => {
15662
+ path15 = path15.replace(/\{[^}]+\}/g, (m) => {
15662
15663
  const mark = `@\\${i}`;
15663
15664
  groups[i] = [mark, m];
15664
15665
  i++;
@@ -15669,7 +15670,7 @@ var Trie = class {
15669
15670
  break;
15670
15671
  }
15671
15672
  }
15672
- const tokens = path16.match(/(?::[^\/]+)|(?:\/\*$)|./g) || [];
15673
+ const tokens = path15.match(/(?::[^\/]+)|(?:\/\*$)|./g) || [];
15673
15674
  for (let i = groups.length - 1; i >= 0; i--) {
15674
15675
  const [mark] = groups[i];
15675
15676
  for (let j = tokens.length - 1; j >= 0; j--) {
@@ -15708,9 +15709,9 @@ var Trie = class {
15708
15709
  // ../../node_modules/.pnpm/hono@4.12.23/node_modules/hono/dist/router/reg-exp-router/router.js
15709
15710
  var nullMatcher = [/^$/, [], /* @__PURE__ */ Object.create(null)];
15710
15711
  var wildcardRegExpCache = /* @__PURE__ */ Object.create(null);
15711
- function buildWildcardRegExp(path16) {
15712
- return wildcardRegExpCache[path16] ??= new RegExp(
15713
- path16 === "*" ? "" : `^${path16.replace(
15712
+ function buildWildcardRegExp(path15) {
15713
+ return wildcardRegExpCache[path15] ??= new RegExp(
15714
+ path15 === "*" ? "" : `^${path15.replace(
15714
15715
  /\/\*$|([.\\+*[^\]$()])/g,
15715
15716
  (_, metaChar) => metaChar ? `\\${metaChar}` : "(?:|/.*)"
15716
15717
  )}$`
@@ -15732,17 +15733,17 @@ function buildMatcherFromPreprocessedRoutes(routes) {
15732
15733
  );
15733
15734
  const staticMap = /* @__PURE__ */ Object.create(null);
15734
15735
  for (let i = 0, j = -1, len = routesWithStaticPathFlag.length; i < len; i++) {
15735
- const [pathErrorCheckOnly, path16, handlers] = routesWithStaticPathFlag[i];
15736
+ const [pathErrorCheckOnly, path15, handlers] = routesWithStaticPathFlag[i];
15736
15737
  if (pathErrorCheckOnly) {
15737
- staticMap[path16] = [handlers.map(([h]) => [h, /* @__PURE__ */ Object.create(null)]), emptyParam];
15738
+ staticMap[path15] = [handlers.map(([h]) => [h, /* @__PURE__ */ Object.create(null)]), emptyParam];
15738
15739
  } else {
15739
15740
  j++;
15740
15741
  }
15741
15742
  let paramAssoc;
15742
15743
  try {
15743
- paramAssoc = trie.insert(path16, j, pathErrorCheckOnly);
15744
+ paramAssoc = trie.insert(path15, j, pathErrorCheckOnly);
15744
15745
  } catch (e) {
15745
- throw e === PATH_ERROR ? new UnsupportedPathError(path16) : e;
15746
+ throw e === PATH_ERROR ? new UnsupportedPathError(path15) : e;
15746
15747
  }
15747
15748
  if (pathErrorCheckOnly) {
15748
15749
  continue;
@@ -15776,12 +15777,12 @@ function buildMatcherFromPreprocessedRoutes(routes) {
15776
15777
  }
15777
15778
  return [regexp, handlerMap, staticMap];
15778
15779
  }
15779
- function findMiddleware(middleware, path16) {
15780
+ function findMiddleware(middleware, path15) {
15780
15781
  if (!middleware) {
15781
15782
  return void 0;
15782
15783
  }
15783
15784
  for (const k of Object.keys(middleware).sort((a, b) => b.length - a.length)) {
15784
- if (buildWildcardRegExp(k).test(path16)) {
15785
+ if (buildWildcardRegExp(k).test(path15)) {
15785
15786
  return [...middleware[k]];
15786
15787
  }
15787
15788
  }
@@ -15795,7 +15796,7 @@ var RegExpRouter = class {
15795
15796
  this.#middleware = { [METHOD_NAME_ALL]: /* @__PURE__ */ Object.create(null) };
15796
15797
  this.#routes = { [METHOD_NAME_ALL]: /* @__PURE__ */ Object.create(null) };
15797
15798
  }
15798
- add(method, path16, handler) {
15799
+ add(method, path15, handler) {
15799
15800
  const middleware = this.#middleware;
15800
15801
  const routes = this.#routes;
15801
15802
  if (!middleware || !routes) {
@@ -15810,18 +15811,18 @@ var RegExpRouter = class {
15810
15811
  });
15811
15812
  });
15812
15813
  }
15813
- if (path16 === "/*") {
15814
- path16 = "*";
15814
+ if (path15 === "/*") {
15815
+ path15 = "*";
15815
15816
  }
15816
- const paramCount = (path16.match(/\/:/g) || []).length;
15817
- if (/\*$/.test(path16)) {
15818
- const re2 = buildWildcardRegExp(path16);
15817
+ const paramCount = (path15.match(/\/:/g) || []).length;
15818
+ if (/\*$/.test(path15)) {
15819
+ const re2 = buildWildcardRegExp(path15);
15819
15820
  if (method === METHOD_NAME_ALL) {
15820
15821
  Object.keys(middleware).forEach((m) => {
15821
- middleware[m][path16] ||= findMiddleware(middleware[m], path16) || findMiddleware(middleware[METHOD_NAME_ALL], path16) || [];
15822
+ middleware[m][path15] ||= findMiddleware(middleware[m], path15) || findMiddleware(middleware[METHOD_NAME_ALL], path15) || [];
15822
15823
  });
15823
15824
  } else {
15824
- middleware[method][path16] ||= findMiddleware(middleware[method], path16) || findMiddleware(middleware[METHOD_NAME_ALL], path16) || [];
15825
+ middleware[method][path15] ||= findMiddleware(middleware[method], path15) || findMiddleware(middleware[METHOD_NAME_ALL], path15) || [];
15825
15826
  }
15826
15827
  Object.keys(middleware).forEach((m) => {
15827
15828
  if (method === METHOD_NAME_ALL || method === m) {
@@ -15839,7 +15840,7 @@ var RegExpRouter = class {
15839
15840
  });
15840
15841
  return;
15841
15842
  }
15842
- const paths = checkOptionalParameter(path16) || [path16];
15843
+ const paths = checkOptionalParameter(path15) || [path15];
15843
15844
  for (let i = 0, len = paths.length; i < len; i++) {
15844
15845
  const path22 = paths[i];
15845
15846
  Object.keys(routes).forEach((m) => {
@@ -15866,13 +15867,13 @@ var RegExpRouter = class {
15866
15867
  const routes = [];
15867
15868
  let hasOwnRoute = method === METHOD_NAME_ALL;
15868
15869
  [this.#middleware, this.#routes].forEach((r) => {
15869
- const ownRoute = r[method] ? Object.keys(r[method]).map((path16) => [path16, r[method][path16]]) : [];
15870
+ const ownRoute = r[method] ? Object.keys(r[method]).map((path15) => [path15, r[method][path15]]) : [];
15870
15871
  if (ownRoute.length !== 0) {
15871
15872
  hasOwnRoute ||= true;
15872
15873
  routes.push(...ownRoute);
15873
15874
  } else if (method !== METHOD_NAME_ALL) {
15874
15875
  routes.push(
15875
- ...Object.keys(r[METHOD_NAME_ALL]).map((path16) => [path16, r[METHOD_NAME_ALL][path16]])
15876
+ ...Object.keys(r[METHOD_NAME_ALL]).map((path15) => [path15, r[METHOD_NAME_ALL][path15]])
15876
15877
  );
15877
15878
  }
15878
15879
  });
@@ -15892,13 +15893,13 @@ var SmartRouter = class {
15892
15893
  constructor(init) {
15893
15894
  this.#routers = init.routers;
15894
15895
  }
15895
- add(method, path16, handler) {
15896
+ add(method, path15, handler) {
15896
15897
  if (!this.#routes) {
15897
15898
  throw new Error(MESSAGE_MATCHER_IS_ALREADY_BUILT);
15898
15899
  }
15899
- this.#routes.push([method, path16, handler]);
15900
+ this.#routes.push([method, path15, handler]);
15900
15901
  }
15901
- match(method, path16) {
15902
+ match(method, path15) {
15902
15903
  if (!this.#routes) {
15903
15904
  throw new Error("Fatal error");
15904
15905
  }
@@ -15913,7 +15914,7 @@ var SmartRouter = class {
15913
15914
  for (let i2 = 0, len2 = routes.length; i2 < len2; i2++) {
15914
15915
  router.add(...routes[i2]);
15915
15916
  }
15916
- res = router.match(method, path16);
15917
+ res = router.match(method, path15);
15917
15918
  } catch (e) {
15918
15919
  if (e instanceof UnsupportedPathError) {
15919
15920
  continue;
@@ -15963,10 +15964,10 @@ var Node2 = class _Node2 {
15963
15964
  }
15964
15965
  this.#patterns = [];
15965
15966
  }
15966
- insert(method, path16, handler) {
15967
+ insert(method, path15, handler) {
15967
15968
  this.#order = ++this.#order;
15968
15969
  let curNode = this;
15969
- const parts = splitRoutingPath(path16);
15970
+ const parts = splitRoutingPath(path15);
15970
15971
  const possibleKeys = [];
15971
15972
  for (let i = 0, len = parts.length; i < len; i++) {
15972
15973
  const p = parts[i];
@@ -16015,12 +16016,12 @@ var Node2 = class _Node2 {
16015
16016
  }
16016
16017
  }
16017
16018
  }
16018
- search(method, path16) {
16019
+ search(method, path15) {
16019
16020
  const handlerSets = [];
16020
16021
  this.#params = emptyParams;
16021
16022
  const curNode = this;
16022
16023
  let curNodes = [curNode];
16023
- const parts = splitPath(path16);
16024
+ const parts = splitPath(path15);
16024
16025
  const curNodesQueue = [];
16025
16026
  const len = parts.length;
16026
16027
  let partOffsets = null;
@@ -16062,13 +16063,13 @@ var Node2 = class _Node2 {
16062
16063
  if (matcher instanceof RegExp) {
16063
16064
  if (partOffsets === null) {
16064
16065
  partOffsets = new Array(len);
16065
- let offset = path16[0] === "/" ? 1 : 0;
16066
+ let offset = path15[0] === "/" ? 1 : 0;
16066
16067
  for (let p = 0; p < len; p++) {
16067
16068
  partOffsets[p] = offset;
16068
16069
  offset += parts[p].length + 1;
16069
16070
  }
16070
16071
  }
16071
- const restPathString = path16.substring(partOffsets[i]);
16072
+ const restPathString = path15.substring(partOffsets[i]);
16072
16073
  const m = matcher.exec(restPathString);
16073
16074
  if (m) {
16074
16075
  params[name21] = m[0];
@@ -16121,18 +16122,18 @@ var TrieRouter = class {
16121
16122
  constructor() {
16122
16123
  this.#node = new Node2();
16123
16124
  }
16124
- add(method, path16, handler) {
16125
- const results = checkOptionalParameter(path16);
16125
+ add(method, path15, handler) {
16126
+ const results = checkOptionalParameter(path15);
16126
16127
  if (results) {
16127
16128
  for (let i = 0, len = results.length; i < len; i++) {
16128
16129
  this.#node.insert(method, results[i], handler);
16129
16130
  }
16130
16131
  return;
16131
16132
  }
16132
- this.#node.insert(method, path16, handler);
16133
+ this.#node.insert(method, path15, handler);
16133
16134
  }
16134
- match(method, path16) {
16135
- return this.#node.search(method, path16);
16135
+ match(method, path15) {
16136
+ return this.#node.search(method, path15);
16136
16137
  }
16137
16138
  };
16138
16139
 
@@ -17266,10 +17267,10 @@ function mergeDefs(...defs) {
17266
17267
  function cloneDef(schema) {
17267
17268
  return mergeDefs(schema._zod.def);
17268
17269
  }
17269
- function getElementAtPath(obj, path16) {
17270
- if (!path16)
17270
+ function getElementAtPath(obj, path15) {
17271
+ if (!path15)
17271
17272
  return obj;
17272
- return path16.reduce((acc, key) => acc?.[key], obj);
17273
+ return path15.reduce((acc, key) => acc?.[key], obj);
17273
17274
  }
17274
17275
  function promiseAllObject(promisesObj) {
17275
17276
  const keys = Object.keys(promisesObj);
@@ -17678,11 +17679,11 @@ function explicitlyAborted(x, startIndex = 0) {
17678
17679
  }
17679
17680
  return false;
17680
17681
  }
17681
- function prefixIssues(path16, issues) {
17682
+ function prefixIssues(path15, issues) {
17682
17683
  return issues.map((iss) => {
17683
17684
  var _a21;
17684
17685
  (_a21 = iss).path ?? (_a21.path = []);
17685
- iss.path.unshift(path16);
17686
+ iss.path.unshift(path15);
17686
17687
  return iss;
17687
17688
  });
17688
17689
  }
@@ -17829,16 +17830,16 @@ function flattenError(error51, mapper = (issue2) => issue2.message) {
17829
17830
  }
17830
17831
  function formatError(error51, mapper = (issue2) => issue2.message) {
17831
17832
  const fieldErrors = { _errors: [] };
17832
- const processError = (error52, path16 = []) => {
17833
+ const processError = (error52, path15 = []) => {
17833
17834
  for (const issue2 of error52.issues) {
17834
17835
  if (issue2.code === "invalid_union" && issue2.errors.length) {
17835
- issue2.errors.map((issues) => processError({ issues }, [...path16, ...issue2.path]));
17836
+ issue2.errors.map((issues) => processError({ issues }, [...path15, ...issue2.path]));
17836
17837
  } else if (issue2.code === "invalid_key") {
17837
- processError({ issues: issue2.issues }, [...path16, ...issue2.path]);
17838
+ processError({ issues: issue2.issues }, [...path15, ...issue2.path]);
17838
17839
  } else if (issue2.code === "invalid_element") {
17839
- processError({ issues: issue2.issues }, [...path16, ...issue2.path]);
17840
+ processError({ issues: issue2.issues }, [...path15, ...issue2.path]);
17840
17841
  } else {
17841
- const fullpath = [...path16, ...issue2.path];
17842
+ const fullpath = [...path15, ...issue2.path];
17842
17843
  if (fullpath.length === 0) {
17843
17844
  fieldErrors._errors.push(mapper(issue2));
17844
17845
  } else {
@@ -17865,17 +17866,17 @@ function formatError(error51, mapper = (issue2) => issue2.message) {
17865
17866
  }
17866
17867
  function treeifyError(error51, mapper = (issue2) => issue2.message) {
17867
17868
  const result = { errors: [] };
17868
- const processError = (error52, path16 = []) => {
17869
+ const processError = (error52, path15 = []) => {
17869
17870
  var _a21, _b17;
17870
17871
  for (const issue2 of error52.issues) {
17871
17872
  if (issue2.code === "invalid_union" && issue2.errors.length) {
17872
- issue2.errors.map((issues) => processError({ issues }, [...path16, ...issue2.path]));
17873
+ issue2.errors.map((issues) => processError({ issues }, [...path15, ...issue2.path]));
17873
17874
  } else if (issue2.code === "invalid_key") {
17874
- processError({ issues: issue2.issues }, [...path16, ...issue2.path]);
17875
+ processError({ issues: issue2.issues }, [...path15, ...issue2.path]);
17875
17876
  } else if (issue2.code === "invalid_element") {
17876
- processError({ issues: issue2.issues }, [...path16, ...issue2.path]);
17877
+ processError({ issues: issue2.issues }, [...path15, ...issue2.path]);
17877
17878
  } else {
17878
- const fullpath = [...path16, ...issue2.path];
17879
+ const fullpath = [...path15, ...issue2.path];
17879
17880
  if (fullpath.length === 0) {
17880
17881
  result.errors.push(mapper(issue2));
17881
17882
  continue;
@@ -17907,8 +17908,8 @@ function treeifyError(error51, mapper = (issue2) => issue2.message) {
17907
17908
  }
17908
17909
  function toDotPath(_path) {
17909
17910
  const segs = [];
17910
- const path16 = _path.map((seg) => typeof seg === "object" ? seg.key : seg);
17911
- for (const seg of path16) {
17911
+ const path15 = _path.map((seg) => typeof seg === "object" ? seg.key : seg);
17912
+ for (const seg of path15) {
17912
17913
  if (typeof seg === "number")
17913
17914
  segs.push(`[${seg}]`);
17914
17915
  else if (typeof seg === "symbol")
@@ -30600,13 +30601,13 @@ function resolveRef(ref, ctx) {
30600
30601
  if (!ref.startsWith("#")) {
30601
30602
  throw new Error("External $ref is not supported, only local refs (#/...) are allowed");
30602
30603
  }
30603
- const path16 = ref.slice(1).split("/").filter(Boolean);
30604
- if (path16.length === 0) {
30604
+ const path15 = ref.slice(1).split("/").filter(Boolean);
30605
+ if (path15.length === 0) {
30605
30606
  return ctx.rootSchema;
30606
30607
  }
30607
30608
  const defsKey = ctx.version === "draft-2020-12" ? "$defs" : "definitions";
30608
- if (path16[0] === defsKey) {
30609
- const key = path16[1];
30609
+ if (path15[0] === defsKey) {
30610
+ const key = path15[1];
30610
30611
  if (!key || !ctx.defs[key]) {
30611
30612
  throw new Error(`Reference not found: ${ref}`);
30612
30613
  }
@@ -31373,8 +31374,8 @@ function getErrorMap2() {
31373
31374
 
31374
31375
  // ../../node_modules/.pnpm/zod@4.4.3/node_modules/zod/v3/helpers/parseUtil.js
31375
31376
  var makeIssue = (params) => {
31376
- const { data, path: path16, errorMaps, issueData } = params;
31377
- const fullPath = [...path16, ...issueData.path || []];
31377
+ const { data, path: path15, errorMaps, issueData } = params;
31378
+ const fullPath = [...path15, ...issueData.path || []];
31378
31379
  const fullIssue = {
31379
31380
  ...issueData,
31380
31381
  path: fullPath
@@ -31489,11 +31490,11 @@ var errorUtil;
31489
31490
 
31490
31491
  // ../../node_modules/.pnpm/zod@4.4.3/node_modules/zod/v3/types.js
31491
31492
  var ParseInputLazyPath = class {
31492
- constructor(parent, value, path16, key) {
31493
+ constructor(parent, value, path15, key) {
31493
31494
  this._cachedPath = [];
31494
31495
  this.parent = parent;
31495
31496
  this.data = value;
31496
- this._path = path16;
31497
+ this._path = path15;
31497
31498
  this._key = key;
31498
31499
  }
31499
31500
  get path() {
@@ -54579,7 +54580,7 @@ function createDeepSeek(options = {}) {
54579
54580
  const createLanguageModel = (modelId) => {
54580
54581
  return new DeepSeekChatLanguageModel(modelId, {
54581
54582
  provider: `deepseek.chat`,
54582
- url: ({ path: path16 }) => `${baseURL}${path16}`,
54583
+ url: ({ path: path15 }) => `${baseURL}${path15}`,
54583
54584
  headers: getHeaders,
54584
54585
  fetch: options.fetch
54585
54586
  });
@@ -56216,8 +56217,8 @@ function createOpenAICompatible(options) {
56216
56217
  const getHeaders = () => withUserAgentSuffix(headers, `ai-sdk/openai-compatible/${VERSION7}`);
56217
56218
  const getCommonModelConfig = (modelType) => ({
56218
56219
  provider: `${providerName}.${modelType}`,
56219
- url: ({ path: path16 }) => {
56220
- const url2 = new URL(`${baseURL}${path16}`);
56220
+ url: ({ path: path15 }) => {
56221
+ const url2 = new URL(`${baseURL}${path15}`);
56221
56222
  if (options.queryParams) {
56222
56223
  url2.search = new URLSearchParams(options.queryParams).toString();
56223
56224
  }
@@ -56675,162 +56676,235 @@ function elapsedWallTime(startedAt) {
56675
56676
  return Math.max(0, Math.round((performance.now() - startedAt) * 100) / 100);
56676
56677
  }
56677
56678
 
56678
- // ../core/src/agent/tools/tool-paths.ts
56679
- import path2 from "node:path";
56680
- async function readProjectWorkspaceFileIfExists(workspaceStore, projectId, relativePath) {
56681
- try {
56682
- return await workspaceStore.readProjectWorkspaceFile(projectId, relativePath);
56683
- } catch (error51) {
56684
- if (isMissingPathError2(error51)) {
56685
- return void 0;
56679
+ // ../core/src/workspace-store/text.ts
56680
+ var MAX_LINE_LENGTH = 2e3;
56681
+ function normalizePositiveInteger(value, fallback, name21) {
56682
+ if (value === void 0) {
56683
+ return fallback;
56684
+ }
56685
+ if (!Number.isInteger(value) || value < 1) {
56686
+ throw new Error(`${name21} must be a positive integer.`);
56687
+ }
56688
+ return value;
56689
+ }
56690
+ function countOccurrences(content, needle) {
56691
+ if (!needle) {
56692
+ return 0;
56693
+ }
56694
+ return content.split(needle).length - 1;
56695
+ }
56696
+ function applyTextEdit(content, oldText, newText, replaceAll = false, relativePath) {
56697
+ if (!oldText) {
56698
+ throw new Error("oldText must not be empty.");
56699
+ }
56700
+ if (oldText === newText) {
56701
+ throw new Error("No changes to apply: oldText and newText are identical.");
56702
+ }
56703
+ const normalizedOldText = convertToLineEnding(oldText, detectLineEnding(content));
56704
+ const normalizedNewText = convertToLineEnding(newText, detectLineEnding(content));
56705
+ const firstIndex = content.indexOf(normalizedOldText);
56706
+ if (firstIndex === -1) {
56707
+ const deEscaped = deEscapeQuotes(normalizedOldText);
56708
+ if (deEscaped !== normalizedOldText && content.includes(deEscaped)) {
56709
+ throw new Error(
56710
+ `oldText was not found in Project Workspace file: ${relativePath}. It looks like oldText contains backslash-escaped quotes/backticks (\\" \\' \\\`) that are not in the file. Provide oldText as the literal file content without adding escape characters.`
56711
+ );
56686
56712
  }
56687
- throw error51;
56713
+ throw new Error(`oldText was not found in Project Workspace file: ${relativePath}`);
56688
56714
  }
56715
+ const replacements = countOccurrences(content, normalizedOldText);
56716
+ if (!replaceAll && replacements > 1) {
56717
+ throw new Error(`oldText appears more than once in Project Workspace file: ${relativePath}`);
56718
+ }
56719
+ return {
56720
+ content: replaceAll ? content.split(normalizedOldText).join(normalizedNewText) : content.slice(0, firstIndex) + normalizedNewText + content.slice(firstIndex + normalizedOldText.length),
56721
+ replacements: replaceAll ? replacements : 1
56722
+ };
56689
56723
  }
56690
- function isHtmlPath(relativePath) {
56691
- return normalizeToolPath(relativePath).toLowerCase().endsWith(".html");
56724
+ function deEscapeQuotes(text2) {
56725
+ return text2.replaceAll('\\"', '"').replaceAll("\\'", "'").replaceAll("\\`", "`");
56692
56726
  }
56693
- function normalizeToolPath(relativePath) {
56694
- return path2.posix.normalize(relativePath.replaceAll("\\", "/"));
56727
+ function detectLineEnding(text2) {
56728
+ return text2.includes("\r\n") ? "\r\n" : "\n";
56695
56729
  }
56696
- function isMissingPathError2(error51) {
56697
- return error51 instanceof Error && "code" in error51 && error51.code === "ENOENT";
56730
+ function convertToLineEnding(text2, ending) {
56731
+ const normalized = text2.replaceAll("\r\n", "\n").replaceAll("\r", "\n");
56732
+ return ending === "\n" ? normalized : normalized.replaceAll("\n", "\r\n");
56698
56733
  }
56699
-
56700
- // ../core/src/agent/tools/copy-file.ts
56701
- function createCopyFileToolDefinition() {
56734
+ function truncateLineMiddle(line) {
56735
+ if (line.length <= MAX_LINE_LENGTH) {
56736
+ return {
56737
+ line,
56738
+ truncated: false
56739
+ };
56740
+ }
56741
+ const half = Math.floor((MAX_LINE_LENGTH - 19) / 2);
56702
56742
  return {
56703
- description: "Copy one UTF-8 text file inside the current Project Workspace to a new path. Never overwrites existing files.",
56704
- inputSchema: external_exports.object({
56705
- sourcePath: external_exports.string().describe("Relative source file path inside the Project Workspace."),
56706
- targetPath: external_exports.string().describe(
56707
- "Relative destination file path inside the Project Workspace. Must not already exist."
56708
- )
56709
- }).strict(),
56710
- name: "copyFile",
56711
- parallelSafe: false,
56712
- execute: async ({ sourcePath, targetPath }, { projectId, workspaceStore }) => {
56713
- const normalizedSourcePath = normalizeToolPath(sourcePath);
56714
- const normalizedTargetPath = normalizeToolPath(targetPath);
56715
- const existingTarget = await readProjectWorkspaceFileIfExists(
56716
- workspaceStore,
56717
- projectId,
56718
- normalizedTargetPath
56719
- );
56720
- if (existingTarget !== void 0) {
56721
- throw new Error(`Project Workspace file already exists: ${normalizedTargetPath}`);
56722
- }
56723
- const sourceContent = await workspaceStore.readProjectWorkspaceFile(
56724
- projectId,
56725
- normalizedSourcePath
56726
- );
56727
- return workspaceStore.writeProjectWorkspaceFile(
56728
- projectId,
56729
- normalizedTargetPath,
56730
- sourceContent
56731
- );
56732
- }
56743
+ line: `${line.slice(0, half)}...<truncated>...${line.slice(-half)}`,
56744
+ truncated: true
56733
56745
  };
56734
56746
  }
56735
56747
 
56736
- // ../core/src/templates/index.ts
56737
- import { readFileSync } from "node:fs";
56738
- import path3 from "node:path";
56739
- import { fileURLToPath } from "node:url";
56740
- var TEMPLATE_FILES = {
56741
- "html/page-shell": "html/page-shell.html"
56742
- };
56743
- function loadTemplate(name21) {
56744
- const templateFile = TEMPLATE_FILES[name21];
56745
- if (!templateFile) {
56746
- throw new Error(`Unsupported template: ${String(name21)}`);
56748
+ // ../core/src/workspace-store/diff.ts
56749
+ var MAX_DIFF_LINES = 80;
56750
+ function buildUnifiedDiff(oldContent, newContent, relativePath) {
56751
+ if (oldContent === newContent) {
56752
+ return "";
56747
56753
  }
56748
- const currentDir = path3.dirname(fileURLToPath(import.meta.url));
56749
- const candidatePaths = [
56750
- path3.join(currentDir, "templates", templateFile),
56751
- path3.join(currentDir, templateFile)
56752
- ];
56753
- for (const candidatePath of candidatePaths) {
56754
- try {
56755
- return readFileSync(candidatePath, "utf8").trim();
56756
- } catch (error51) {
56757
- if (!isNotFoundError(error51)) {
56758
- throw error51;
56759
- }
56754
+ const oldLines = oldContent.split(/\r?\n/);
56755
+ const newLines = newContent.split(/\r?\n/);
56756
+ const lines = [`--- ${relativePath}`, `+++ ${relativePath}`];
56757
+ const maxLines = Math.max(oldLines.length, newLines.length);
56758
+ let emitted = 0;
56759
+ let omitted = 0;
56760
+ for (let index = 0; index < maxLines; index += 1) {
56761
+ const oldLine = oldLines[index];
56762
+ const newLine = newLines[index];
56763
+ if (oldLine === newLine) {
56764
+ continue;
56760
56765
  }
56766
+ if (emitted >= MAX_DIFF_LINES) {
56767
+ omitted += 1;
56768
+ continue;
56769
+ }
56770
+ lines.push(`@@ line ${index + 1}`);
56771
+ if (oldLine !== void 0) {
56772
+ lines.push(`-${truncateLineMiddle(oldLine).line}`);
56773
+ }
56774
+ if (newLine !== void 0) {
56775
+ lines.push(`+${truncateLineMiddle(newLine).line}`);
56776
+ }
56777
+ emitted += 1;
56761
56778
  }
56762
- throw new Error(`Template "${name21}" was not found. Searched: ${candidatePaths.join(", ")}`);
56779
+ if (omitted > 0) {
56780
+ lines.push(`... ${omitted} changed line(s) omitted ...`);
56781
+ }
56782
+ return lines.join("\n");
56763
56783
  }
56764
- function isNotFoundError(error51) {
56765
- return typeof error51 === "object" && error51 !== null && "code" in error51 && error51.code === "ENOENT";
56784
+
56785
+ // ../core/src/workspace-store/paths.ts
56786
+ import path2 from "node:path";
56787
+ function isMissingPathError2(error51) {
56788
+ return error51 instanceof Error && "code" in error51 && error51.code === "ENOENT";
56789
+ }
56790
+ function normalizeWorkspaceRelativePath(relativePath) {
56791
+ return relativePath.split(path2.sep).join("/");
56766
56792
  }
56767
56793
 
56768
- // ../core/src/agent/tools/create-html.ts
56769
- var DEFAULT_TITLE = "OwnDesign Preview";
56770
- var SINGLE_HTML_PATH = "index.html";
56771
- function createCreateHtmlToolDefinition() {
56772
- return {
56773
- description: "Create the single previewable index.html file from the configured template before designing a missing Single HTML project. Never overwrites existing files.",
56774
- inputSchema: external_exports.object({
56775
- path: external_exports.string().describe("Relative HTML file path inside the Project Workspace. Must be index.html."),
56776
- title: external_exports.string().describe("Optional document title. Defaults to OwnDesign Preview.").optional()
56777
- }).strict(),
56778
- name: "createHtml",
56779
- parallelSafe: false,
56780
- execute: async (input, { projectId, workspaceStore }) => {
56781
- const targetPath = normalizeToolPath(input.path);
56782
- if (!isHtmlPath(targetPath)) {
56783
- throw new Error(`HTML initialization target must end with .html: ${targetPath}`);
56784
- }
56785
- if (targetPath !== SINGLE_HTML_PATH) {
56786
- throw new Error(`Single HTML projects can only create ${SINGLE_HTML_PATH}: ${targetPath}`);
56787
- }
56788
- const existingHtml = await readProjectWorkspaceFileIfExists(
56789
- workspaceStore,
56790
- projectId,
56791
- targetPath
56792
- );
56793
- if (existingHtml !== void 0) {
56794
- throw new Error(`Project Workspace HTML file already exists: ${targetPath}`);
56795
- }
56796
- const title = input.title?.trim() || DEFAULT_TITLE;
56797
- await workspaceStore.writeProjectWorkspaceFile(
56798
- projectId,
56799
- targetPath,
56800
- buildSingleHtmlTemplate({ title })
56801
- );
56802
- return {
56803
- path: targetPath,
56804
- title
56805
- };
56806
- }
56794
+ // ../core/src/templates/owndesign-runtime.ts
56795
+ var OWNDESIGN_RUNTIME_ATTRIBUTE = 'data-owndesign-runtime="preview-route-bridge"';
56796
+ var OWNDESIGN_RUNTIME_SCRIPT_TAG = `<script ${OWNDESIGN_RUNTIME_ATTRIBUTE}>
56797
+ (() => {
56798
+ const sendRoute = () => {
56799
+ window.parent?.postMessage(
56800
+ {
56801
+ source: 'owndesign-preview',
56802
+ type: 'route-changed',
56803
+ version: 1,
56804
+ hash: window.location.hash || '',
56805
+ },
56806
+ '*',
56807
+ );
56807
56808
  };
56809
+
56810
+ const scheduleRouteUpdate = () => {
56811
+ window.requestAnimationFrame(sendRoute);
56812
+ };
56813
+
56814
+ const patchHistory = (method) => {
56815
+ const original = window.history[method];
56816
+
56817
+ window.history[method] = function patchedHistoryMethod(...args) {
56818
+ const result = original.apply(this, args);
56819
+ scheduleRouteUpdate();
56820
+ return result;
56821
+ };
56822
+ };
56823
+
56824
+ patchHistory('pushState');
56825
+ patchHistory('replaceState');
56826
+ window.addEventListener('hashchange', scheduleRouteUpdate);
56827
+ window.addEventListener('popstate', scheduleRouteUpdate);
56828
+ window.addEventListener('pageshow', scheduleRouteUpdate);
56829
+ document.addEventListener('DOMContentLoaded', scheduleRouteUpdate);
56830
+ scheduleRouteUpdate();
56831
+
56832
+ if (window.lucide) {
56833
+ lucide.createIcons();
56834
+ }
56835
+ })();
56836
+ </script>`;
56837
+ var BODY_CLOSE_PATTERN = /<\/body\s*>/gi;
56838
+ var BODY_OPEN_PATTERN = /<body(?:\s[^>]*)?>/i;
56839
+ var HTML_COMMENT_PATTERN = /<!--[\s\S]*?-->/g;
56840
+ function assertOwnDesignRuntimeScript(content) {
56841
+ const normalizedContent = normalizeLineEndings(content);
56842
+ const normalizedRuntimeScript = normalizeLineEndings(OWNDESIGN_RUNTIME_SCRIPT_TAG);
56843
+ const runtimeScriptCount = countOccurrences2(normalizedContent, normalizedRuntimeScript);
56844
+ if (runtimeScriptCount !== 1) {
56845
+ throw new Error(
56846
+ "Keep the OwnDesign runtime script unchanged and include it exactly once as the last element inside <body>."
56847
+ );
56848
+ }
56849
+ const bodyOpen = BODY_OPEN_PATTERN.exec(normalizedContent);
56850
+ BODY_OPEN_PATTERN.lastIndex = 0;
56851
+ const bodyClose = getLastMatch(normalizedContent, BODY_CLOSE_PATTERN);
56852
+ if (!bodyOpen || !bodyClose) {
56853
+ throw new Error(
56854
+ "Keep the OwnDesign runtime script inside <body> as the last element."
56855
+ );
56856
+ }
56857
+ const runtimeScriptIndex = normalizedContent.indexOf(normalizedRuntimeScript);
56858
+ const runtimeScriptEnd = runtimeScriptIndex + normalizedRuntimeScript.length;
56859
+ const bodyContentStart = bodyOpen.index + bodyOpen[0].length;
56860
+ if (runtimeScriptIndex < bodyContentStart || runtimeScriptEnd > bodyClose.index) {
56861
+ throw new Error(
56862
+ "Keep the OwnDesign runtime script inside <body> as the last element."
56863
+ );
56864
+ }
56865
+ const trailingBodyContent = normalizedContent.slice(runtimeScriptEnd, bodyClose.index).replace(HTML_COMMENT_PATTERN, "").trim();
56866
+ if (trailingBodyContent) {
56867
+ throw new Error(
56868
+ "Keep the OwnDesign runtime script as the last element inside <body>."
56869
+ );
56870
+ }
56808
56871
  }
56809
- function buildSingleHtmlTemplate({ title }) {
56810
- return renderTemplate(loadTemplate("html/page-shell"), {
56811
- lang: "zh-CN",
56812
- title: escapeHtmlText(title)
56813
- });
56872
+ function isProtectedSingleHtmlPath(relativePath) {
56873
+ return normalizeRelativePath(relativePath).toLowerCase() === "index.html";
56814
56874
  }
56815
- function renderTemplate(template, values) {
56816
- return `${template.replace(/\{\{([a-zA-Z0-9]+)\}\}/g, (_match, key) => values[key] ?? "")}
56817
- `;
56875
+ function normalizeLineEndings(value) {
56876
+ return value.replaceAll("\r\n", "\n").replaceAll("\r", "\n");
56818
56877
  }
56819
- function escapeHtmlText(value) {
56820
- return value.replaceAll("&", "&amp;").replaceAll("<", "&lt;").replaceAll(">", "&gt;");
56878
+ function countOccurrences2(content, needle) {
56879
+ return content.split(needle).length - 1;
56821
56880
  }
56822
-
56823
- // ../core/src/agent/tools/delete.ts
56824
- function createDeleteToolDefinition() {
56825
- return {
56826
- description: "Recursively delete a file or directory from the current Project Workspace.",
56827
- inputSchema: external_exports.object({
56828
- path: external_exports.string().describe("Relative file or directory path inside the Project Workspace.")
56829
- }).strict(),
56830
- name: "delete",
56831
- parallelSafe: false,
56832
- execute: async ({ path: path16 }, { projectId, workspaceStore }) => workspaceStore.deleteProjectWorkspacePath(projectId, path16)
56833
- };
56881
+ function normalizeRelativePath(relativePath) {
56882
+ const segments = [];
56883
+ for (const segment of relativePath.replaceAll("\\", "/").split("/")) {
56884
+ if (!segment || segment === ".") {
56885
+ continue;
56886
+ }
56887
+ if (segment === "..") {
56888
+ if (segments.length > 0 && segments.at(-1) !== "..") {
56889
+ segments.pop();
56890
+ } else {
56891
+ segments.push(segment);
56892
+ }
56893
+ continue;
56894
+ }
56895
+ segments.push(segment);
56896
+ }
56897
+ return segments.join("/");
56898
+ }
56899
+ function getLastMatch(content, pattern) {
56900
+ pattern.lastIndex = 0;
56901
+ let lastMatch = null;
56902
+ let currentMatch;
56903
+ while (currentMatch = pattern.exec(content)) {
56904
+ lastMatch = currentMatch;
56905
+ }
56906
+ pattern.lastIndex = 0;
56907
+ return lastMatch;
56834
56908
  }
56835
56909
 
56836
56910
  // ../core/src/agent/tools/edit.ts
@@ -56845,6 +56919,7 @@ var DESCRIPTION = [
56845
56919
  "- Never include any part of the line number prefix in oldString or newString.",
56846
56920
  "- Provide oldString as the literal file content. Do not add backslash escapes to quotes or backticks (\\\" \\' \\`), even when the text is inside a JavaScript template literal or string.",
56847
56921
  "- Prefer editing existing files. Only create new files when the user request explicitly requires it.",
56922
+ "- For index.html, preserve the OwnDesign protected runtime script unchanged, exactly once, as the last element inside <body>.",
56848
56923
  "- Only use emojis if the user explicitly requests them.",
56849
56924
  "- The edit will fail if oldString is not found in the file.",
56850
56925
  "- The edit will fail if oldString is found multiple times unless replaceAll is true.",
@@ -56864,7 +56939,25 @@ function createEditToolDefinition() {
56864
56939
  }).strict(),
56865
56940
  name: "edit",
56866
56941
  parallelSafe: false,
56867
- execute: async ({ newString, oldString, path: path16, replaceAll }, { projectId, workspaceStore }) => workspaceStore.editProjectWorkspaceFile(projectId, path16, oldString, newString, replaceAll)
56942
+ execute: async ({ newString, oldString, path: path15, replaceAll }, { projectId, workspaceStore }) => {
56943
+ const content = await workspaceStore.readProjectWorkspaceFile(projectId, path15);
56944
+ const { content: updatedContent, replacements } = applyTextEdit(
56945
+ content,
56946
+ oldString,
56947
+ newString,
56948
+ replaceAll,
56949
+ path15
56950
+ );
56951
+ if (isProtectedSingleHtmlPath(path15)) {
56952
+ assertOwnDesignRuntimeScript(updatedContent);
56953
+ }
56954
+ await workspaceStore.writeProjectWorkspaceFile(projectId, path15, updatedContent);
56955
+ return {
56956
+ diff: buildUnifiedDiff(content, updatedContent, normalizeWorkspaceRelativePath(path15)),
56957
+ path: normalizeWorkspaceRelativePath(path15),
56958
+ replacements: replaceAll ? replacements : 1
56959
+ };
56960
+ }
56868
56961
  };
56869
56962
  }
56870
56963
 
@@ -56890,8 +56983,8 @@ function createGlobToolDefinition() {
56890
56983
  }).strict(),
56891
56984
  name: "glob",
56892
56985
  parallelSafe: true,
56893
- execute: async ({ path: path16, pattern }, { projectId, workspaceStore }) => {
56894
- return workspaceStore.globProjectWorkspace(projectId, pattern, path16);
56986
+ execute: async ({ path: path15, pattern }, { projectId, workspaceStore }) => {
56987
+ return workspaceStore.globProjectWorkspace(projectId, pattern, path15);
56895
56988
  }
56896
56989
  };
56897
56990
  }
@@ -56920,10 +57013,10 @@ function createGrepToolDefinition() {
56920
57013
  }).strict(),
56921
57014
  name: "grep",
56922
57015
  parallelSafe: true,
56923
- execute: async ({ include, path: path16, pattern }, { projectId, workspaceStore }) => {
57016
+ execute: async ({ include, path: path15, pattern }, { projectId, workspaceStore }) => {
56924
57017
  return workspaceStore.grepProjectWorkspace(projectId, pattern, {
56925
57018
  include,
56926
- path: path16
57019
+ path: path15
56927
57020
  });
56928
57021
  }
56929
57022
  };
@@ -57099,8 +57192,8 @@ function createReadToolDefinition() {
57099
57192
  }).strict(),
57100
57193
  name: "read",
57101
57194
  parallelSafe: true,
57102
- execute: async ({ limit, offset, path: path16 }, { projectId, workspaceStore }) => {
57103
- return workspaceStore.readProjectWorkspaceEntry(projectId, path16, {
57195
+ execute: async ({ limit, offset, path: path15 }, { projectId, workspaceStore }) => {
57196
+ return workspaceStore.readProjectWorkspaceEntry(projectId, path15, {
57104
57197
  limit,
57105
57198
  offset
57106
57199
  });
@@ -57117,7 +57210,8 @@ var DESCRIPTION5 = [
57117
57210
  "- The path parameter must be a relative file path inside the Project Workspace.",
57118
57211
  "- If this is an existing file, you must use the read tool first to read the file contents.",
57119
57212
  "- Prefer editing existing files with the edit tool. Only write full files when intentional.",
57120
- "- Do not use write to create the initial index.html; use createHtml first.",
57213
+ "- Use write to create index.html only when it is missing and the file content is complete.",
57214
+ "- For index.html, preserve the OwnDesign protected runtime script unchanged, exactly once, as the last element inside <body>.",
57121
57215
  "- Never proactively create documentation files (*.md) or README files. Only create documentation files if explicitly requested by the user.",
57122
57216
  "- Only use emojis if the user explicitly requests them."
57123
57217
  ].join("\n");
@@ -57130,16 +57224,18 @@ function createWriteToolDefinition() {
57130
57224
  }).strict(),
57131
57225
  name: "write",
57132
57226
  parallelSafe: false,
57133
- execute: async ({ content, path: path16 }, { projectId, workspaceStore }) => workspaceStore.writeProjectWorkspaceFile(projectId, path16, content)
57227
+ execute: async ({ content, path: path15 }, { projectId, workspaceStore }) => {
57228
+ if (isProtectedSingleHtmlPath(path15)) {
57229
+ assertOwnDesignRuntimeScript(content);
57230
+ }
57231
+ return workspaceStore.writeProjectWorkspaceFile(projectId, path15, content);
57232
+ }
57134
57233
  };
57135
57234
  }
57136
57235
 
57137
57236
  // ../core/src/agent/tools/project-workspace-tools.ts
57138
57237
  function createProjectWorkspaceToolDefinitions() {
57139
57238
  return [
57140
- createCopyFileToolDefinition(),
57141
- createCreateHtmlToolDefinition(),
57142
- createDeleteToolDefinition(),
57143
57239
  createEditToolDefinition(),
57144
57240
  createGlobToolDefinition(),
57145
57241
  createGrepToolDefinition(),
@@ -57150,11 +57246,10 @@ function createProjectWorkspaceToolDefinitions() {
57150
57246
  }
57151
57247
 
57152
57248
  // ../core/src/prompts/index.ts
57153
- import { readFileSync as readFileSync2 } from "node:fs";
57154
- import path4 from "node:path";
57155
- import { fileURLToPath as fileURLToPath2 } from "node:url";
57249
+ import { readFileSync } from "node:fs";
57250
+ import path3 from "node:path";
57251
+ import { fileURLToPath } from "node:url";
57156
57252
  var PROMPT_FILES = {
57157
- "agents/component-audit": "agents/component-audit.md",
57158
57253
  "agents/design-page": "agents/design-page.md"
57159
57254
  };
57160
57255
  function loadPrompt(name21) {
@@ -57162,23 +57257,23 @@ function loadPrompt(name21) {
57162
57257
  if (!promptFile) {
57163
57258
  throw new Error(`Unsupported prompt: ${String(name21)}`);
57164
57259
  }
57165
- const currentDir = path4.dirname(fileURLToPath2(import.meta.url));
57260
+ const currentDir = path3.dirname(fileURLToPath(import.meta.url));
57166
57261
  const candidatePaths = [
57167
- path4.join(currentDir, "prompts", promptFile),
57168
- path4.join(currentDir, promptFile)
57262
+ path3.join(currentDir, "prompts", promptFile),
57263
+ path3.join(currentDir, promptFile)
57169
57264
  ];
57170
57265
  for (const candidatePath of candidatePaths) {
57171
57266
  try {
57172
- return readFileSync2(candidatePath, "utf8").trim();
57267
+ return readFileSync(candidatePath, "utf8").trim();
57173
57268
  } catch (error51) {
57174
- if (!isNotFoundError2(error51)) {
57269
+ if (!isNotFoundError(error51)) {
57175
57270
  throw error51;
57176
57271
  }
57177
57272
  }
57178
57273
  }
57179
57274
  throw new Error(`Prompt "${name21}" was not found. Searched: ${candidatePaths.join(", ")}`);
57180
57275
  }
57181
- function isNotFoundError2(error51) {
57276
+ function isNotFoundError(error51) {
57182
57277
  return typeof error51 === "object" && error51 !== null && "code" in error51 && error51.code === "ENOENT";
57183
57278
  }
57184
57279
 
@@ -57211,7 +57306,7 @@ function buildFrontendCapabilityPrompt() {
57211
57306
  }
57212
57307
 
57213
57308
  // ../core/src/agent/design-page-agent.ts
57214
- var DESIGN_PAGE_AGENT_PROMPT_VERSION = 3;
57309
+ var DESIGN_PAGE_AGENT_PROMPT_VERSION = 6;
57215
57310
  var AiSdkDesignPageAgent = class {
57216
57311
  constructor(workspaceStore) {
57217
57312
  this.workspaceStore = workspaceStore;
@@ -57237,7 +57332,6 @@ var AiSdkDesignPageAgent = class {
57237
57332
  }
57238
57333
  };
57239
57334
  async function createDesignPageAgentContext({
57240
- currentPreviewPath,
57241
57335
  frontendTabId,
57242
57336
  modelConfigurationId,
57243
57337
  outputType,
@@ -57257,7 +57351,6 @@ async function createDesignPageAgentContext({
57257
57351
  settingsService.resolveModelConfiguration(modelConfigurationId)
57258
57352
  ]);
57259
57353
  return {
57260
- currentPreviewPath,
57261
57354
  frontendTabId,
57262
57355
  model: buildLanguageModel(modelConfiguration),
57263
57356
  projectType,
@@ -57396,10 +57489,19 @@ function buildPageTargetProtocolPrompt() {
57396
57489
  "Rules:",
57397
57490
  "- Always target `index.html` for previewable output.",
57398
57491
  "- Do not create `login.html`, `detail.html`, versioned HTML files, or any other HTML page.",
57399
- "- If the user asks for multiple pages, screens, or routes, implement them as internal views inside `index.html`.",
57492
+ "- If the user asks for multiple pages, page-level screens, or route-like navigation, use hash routing inside `index.html`.",
57493
+ "- Do not use path-based browser routing.",
57494
+ "- Any UI state that a viewer would want to link to or return to directly must be restorable from `location.hash`, including tabs, modals, drawers, side panels, selected detail views, filters, and modes.",
57495
+ "- A direct load of `index.html#/route?...` must render the matching route and any material UI state without requiring prior clicks.",
57496
+ "- Render the current hash state on initial load, such as `DOMContentLoaded`, as well as on `hashchange`; do not rely on `hashchange` firing for the first paint.",
57497
+ "- Use normal hash navigation for page-level route changes. For in-page sub-state such as tabs, modals, drawers, side panels, filters, modes, and selected details, update the hash with `history.replaceState` so the Back button moves between pages instead of every toggle.",
57498
+ "- Navigation, tabs, modal and drawer controls, side-panel controls, filters, modes, and detail selectors should update `location.hash` when they control a deep-link-worthy design state.",
57499
+ "- Use local in-memory state only for ephemeral micro-interactions such as hover, focus, pressed feedback, transient toasts, loading spinners, and unsubmitted form typing.",
57500
+ '- Preserve the OwnDesign protected runtime script with `data-owndesign-runtime="preview-route-bridge"` unchanged, exactly once, as the last element inside `<body>`.',
57501
+ "- Put app-specific prototype JavaScript in a separate earlier script block, not inside the OwnDesign protected runtime script.",
57400
57502
  "- Use ordinary HTML, CSS, and browser JavaScript in the file.",
57401
57503
  "- Do not create custom elements, component module folders, or page/component reuse metadata files.",
57402
- '- If `index.html` is missing, call `createHtml({ path: "index.html" })` before editing.',
57504
+ "- If `index.html` is missing, use `write` to create a complete `index.html` before refreshing preview.",
57403
57505
  "- If `index.html` exists, read it before editing and continue from the current design."
57404
57506
  ].join("\n");
57405
57507
  }
@@ -57414,16 +57516,12 @@ function buildToolWorkflowPrompt() {
57414
57516
  "- Use `read` before editing an existing file.",
57415
57517
  "",
57416
57518
  "Choose tools by intent:",
57417
- "- Use `createHtml` only to create a missing `index.html` file.",
57418
57519
  "- Use `edit` for small, focused replacements in one existing file.",
57419
- "- Use `write` only for deliberate full-file replacement of `index.html`.",
57420
- "- Do not use `write` to create the initial `index.html`; use `createHtml` first.",
57421
- "- Use `copyFile` only when the current user message explicitly asks you to duplicate an existing file.",
57422
- "- Use `delete` only after confirming the file is not referenced.",
57520
+ "- Use `write` only for deliberate full-file replacement of `index.html` or to create a missing `index.html` with complete content.",
57423
57521
  "",
57424
57522
  "Single HTML create vs update flow:",
57425
- '- When `index.html` is missing, call `createHtml({ path: "index.html" })`, then read it and replace the default placeholder markup, CSS, and script with a complete designed prototype.',
57426
- "- When `index.html` exists, read it before editing and do not call `createHtml`.",
57523
+ "- When `index.html` is missing, use `write` with a complete designed prototype.",
57524
+ "- When `index.html` exists, read it before editing.",
57427
57525
  "",
57428
57526
  "Recover from tool failures:",
57429
57527
  "- If an edit fails, read the file again and retry with a smaller, exact edit.",
@@ -57443,12 +57541,13 @@ function buildResourcePolicyPrompt(resources) {
57443
57541
  defaultIconLibrary ? `Default icon library: ${defaultIconLibrary.name}.` : "Default icon library: none configured.",
57444
57542
  "The default HTML template already configures Inter and Noto Sans SC on the `html` element.",
57445
57543
  "Unless the user explicitly asks for a different typeface, do not change `font-family`; adjust typography with size, weight, line-height, spacing, and hierarchy.",
57446
- "Lucide icons are already configured by the default HTML template.",
57544
+ "Lucide icons are already configured by the default HTML template and initialized by the protected OwnDesign runtime script.",
57447
57545
  'Use Lucide icons with `<i data-lucide="menu"></i>` syntax, replacing `menu` with the appropriate Lucide icon name.',
57448
57546
  "Do not use other icon systems, inline SVG icons, emoji icons, or decorative emoji as UI icons.",
57449
57547
  "When styling Lucide icons, do not target `i`, `i[data-lucide]`, or tag selectors because Lucide replaces the placeholder with inline `svg` elements.",
57450
57548
  "Give icons a semantic class or wrap them in a classed element, then style the class and child `svg`, such as `.nav-icon svg { width: 18px; height: 18px; stroke-width: 2; }`.",
57451
57549
  "If JavaScript dynamically inserts markup that contains Lucide placeholders, call `lucide.createIcons()` after updating the DOM.",
57550
+ "Do not edit, move after another element, remove, duplicate, or add app logic inside the protected OwnDesign runtime script.",
57452
57551
  "Prefer configured resources and local CSS before adding any external resource.",
57453
57552
  "Add an extra external resource only when the user explicitly requests it or when it is necessary for the prototype quality.",
57454
57553
  "When a configured library has no CDN, follow the library choice in CSS naming only.",
@@ -57481,7 +57580,7 @@ function formatResourceLibraryList(libraries) {
57481
57580
 
57482
57581
  // ../core/src/preview/preview-server-manager.ts
57483
57582
  import { access, readFile as readFile2 } from "node:fs/promises";
57484
- import path5 from "node:path";
57583
+ import path4 from "node:path";
57485
57584
  var DEFAULT_CLEANUP_INTERVAL_MS = 3e4;
57486
57585
  var DEFAULT_LEASE_TTL_MS = 9e4;
57487
57586
  var PREVIEW_HOST = "127.0.0.1";
@@ -57500,29 +57599,20 @@ var PreviewServerManager = class {
57500
57599
  this.now = options.now ?? Date.now;
57501
57600
  this.workspaceStore = options.workspaceStore;
57502
57601
  }
57503
- async ensure(projectId, clientId, previewPath) {
57602
+ async ensure(projectId, clientId) {
57504
57603
  const entry = await this.getOrStartEntry(projectId, clientId);
57505
- const [files, pageManifest] = await Promise.all([
57506
- this.workspaceStore.listProjectHtmlFiles(projectId),
57507
- this.workspaceStore.readProjectHtmlPageManifest(projectId)
57508
- ]);
57509
- const activePath = resolveActivePreviewPath(
57510
- files,
57511
- pageManifest,
57512
- previewPath ?? entry.activePath
57604
+ const previewFileExists = await indexHtmlExists(
57605
+ this.workspaceStore.getProjectWorkspaceDirectory(projectId)
57513
57606
  );
57514
- entry.activePath = activePath;
57515
57607
  this.touchLease(entry);
57516
57608
  this.ensureCleanupTimer();
57517
57609
  return {
57518
- ...activePath ? { activePath } : {},
57519
- files,
57520
- pageManifest,
57521
- url: buildPreviewUrl(entry.baseUrl, activePath)
57610
+ previewFileExists,
57611
+ ...previewFileExists ? { url: buildPreviewUrl(entry.baseUrl) } : {}
57522
57612
  };
57523
57613
  }
57524
- async heartbeat(projectId, clientId, previewPath) {
57525
- return this.ensure(projectId, clientId, previewPath);
57614
+ async heartbeat(projectId, clientId) {
57615
+ return this.ensure(projectId, clientId);
57526
57616
  }
57527
57617
  async release(projectId, clientId) {
57528
57618
  const entry = this.entries.get(buildEntryKey(projectId, clientId));
@@ -57591,18 +57681,26 @@ var PreviewServerManager = class {
57591
57681
  key,
57592
57682
  projectId
57593
57683
  };
57594
- app2.get("/", async () => readIndexHtmlOrNotFound(workspaceDirectory, entry));
57595
- app2.get("/index.html", async () => readIndexHtmlOrNotFound(workspaceDirectory, entry));
57684
+ app2.get("/", async () => readIndexHtmlOrNotFound(workspaceDirectory));
57685
+ app2.get("/index.html", async () => readIndexHtmlOrNotFound(workspaceDirectory));
57596
57686
  app2.use("*", async (context2, next) => {
57597
57687
  context2.header("Cache-Control", PREVIEW_CACHE_CONTROL);
57598
57688
  await next();
57599
57689
  });
57690
+ app2.use("*", async (context2, next) => {
57691
+ if (context2.req.path.toLowerCase().endsWith(".html")) {
57692
+ return new Response(null, {
57693
+ headers: {
57694
+ "Cache-Control": PREVIEW_CACHE_CONTROL
57695
+ },
57696
+ status: 404
57697
+ });
57698
+ }
57699
+ await next();
57700
+ });
57600
57701
  app2.use(
57601
57702
  "*",
57602
57703
  serveStatic({
57603
- onFound: (filePath) => {
57604
- recordServedStaticPath(entry, workspaceDirectory, filePath);
57605
- },
57606
57704
  root: workspaceDirectory
57607
57705
  })
57608
57706
  );
@@ -57684,11 +57782,10 @@ function getPreviewServerManager(workspaceStore) {
57684
57782
  });
57685
57783
  return globalThis.__owndesignPreviewServerManager;
57686
57784
  }
57687
- async function readIndexHtmlOrNotFound(workspaceDirectory, entry) {
57688
- const indexPath = path5.join(workspaceDirectory, "index.html");
57785
+ async function readIndexHtmlOrNotFound(workspaceDirectory) {
57786
+ const indexPath = path4.join(workspaceDirectory, "index.html");
57689
57787
  try {
57690
57788
  await access(indexPath);
57691
- entry.activePath = "index.html";
57692
57789
  return htmlResponse(await readFile2(indexPath, "utf8"));
57693
57790
  } catch {
57694
57791
  return new Response(null, {
@@ -57699,56 +57796,29 @@ async function readIndexHtmlOrNotFound(workspaceDirectory, entry) {
57699
57796
  });
57700
57797
  }
57701
57798
  }
57702
- function resolveActivePreviewPath(files, pageManifest, previewPath) {
57703
- if (previewPath && files.includes(previewPath)) {
57704
- return previewPath;
57705
- }
57706
- if (files.includes("index.html")) {
57707
- return "index.html";
57708
- }
57709
- const manifestPath = pageManifest.pages.find((page) => files.includes(page.htmlPath))?.htmlPath;
57710
- if (manifestPath) {
57711
- return manifestPath;
57799
+ async function indexHtmlExists(workspaceDirectory) {
57800
+ try {
57801
+ await access(path4.join(workspaceDirectory, "index.html"));
57802
+ return true;
57803
+ } catch {
57804
+ return false;
57712
57805
  }
57713
- return files[0];
57714
57806
  }
57715
- function buildPreviewUrl(baseUrl, previewPath) {
57716
- if (!previewPath) {
57717
- return baseUrl;
57718
- }
57719
- return `${baseUrl}/${previewPath.split("/").map(encodeURIComponent).join("/")}`;
57807
+ function buildPreviewUrl(baseUrl) {
57808
+ return `${baseUrl}/index.html`;
57720
57809
  }
57721
57810
  function buildEntryKey(projectId, clientId) {
57722
57811
  return `${projectId}:${clientId}`;
57723
57812
  }
57724
- function recordServedHtmlPath(entry, workspaceDirectory, filePath) {
57725
- if (!filePath.toLowerCase().endsWith(".html")) {
57726
- return;
57727
- }
57728
- const relativePath = path5.relative(workspaceDirectory, filePath).split(path5.sep).join("/");
57729
- if (!relativePath || relativePath.startsWith("..")) {
57730
- return;
57731
- }
57732
- entry.activePath = relativePath;
57733
- }
57734
- function recordServedStaticPath(entry, workspaceDirectory, servedPath) {
57735
- const filePath = path5.isAbsolute(servedPath) ? servedPath : path5.join(workspaceDirectory, servedPath.replace(/^[/\\]+/, ""));
57736
- recordServedHtmlPath(entry, workspaceDirectory, filePath);
57737
- }
57738
57813
 
57739
57814
  // ../core/src/navigation.ts
57740
- function buildWorkspaceHref({ conversationId, previewPath, projectId }) {
57815
+ function buildWorkspaceHref({ conversationId, projectId }) {
57741
57816
  if (!projectId) {
57742
57817
  return "/";
57743
57818
  }
57744
- const pathname = conversationId ? `/projects/${encodeURIComponent(projectId)}/conversations/${encodeURIComponent(
57819
+ return conversationId ? `/projects/${encodeURIComponent(projectId)}/conversations/${encodeURIComponent(
57745
57820
  conversationId
57746
57821
  )}` : `/projects/${encodeURIComponent(projectId)}`;
57747
- if (!previewPath) {
57748
- return pathname;
57749
- }
57750
- const params = new URLSearchParams({ previewPath });
57751
- return `${pathname}?${params.toString()}`;
57752
57822
  }
57753
57823
 
57754
57824
  // ../core/src/conversations/conversation-service.ts
@@ -57882,6 +57952,54 @@ function summarizeConversationTitle(content) {
57882
57952
  return content.trim().replace(/\s+/g, " ").slice(0, 80);
57883
57953
  }
57884
57954
 
57955
+ // ../core/src/templates/index.ts
57956
+ import { readFileSync as readFileSync2 } from "node:fs";
57957
+ import path5 from "node:path";
57958
+ import { fileURLToPath as fileURLToPath2 } from "node:url";
57959
+ var TEMPLATE_FILES = {
57960
+ "html/page-shell": "html/page-shell.html"
57961
+ };
57962
+ function loadTemplate(name21) {
57963
+ const templateFile = TEMPLATE_FILES[name21];
57964
+ if (!templateFile) {
57965
+ throw new Error(`Unsupported template: ${String(name21)}`);
57966
+ }
57967
+ const currentDir = path5.dirname(fileURLToPath2(import.meta.url));
57968
+ const candidatePaths = [
57969
+ path5.join(currentDir, "templates", templateFile),
57970
+ path5.join(currentDir, templateFile)
57971
+ ];
57972
+ for (const candidatePath of candidatePaths) {
57973
+ try {
57974
+ return readFileSync2(candidatePath, "utf8").trim();
57975
+ } catch (error51) {
57976
+ if (!isNotFoundError2(error51)) {
57977
+ throw error51;
57978
+ }
57979
+ }
57980
+ }
57981
+ throw new Error(`Template "${name21}" was not found. Searched: ${candidatePaths.join(", ")}`);
57982
+ }
57983
+ function isNotFoundError2(error51) {
57984
+ return typeof error51 === "object" && error51 !== null && "code" in error51 && error51.code === "ENOENT";
57985
+ }
57986
+
57987
+ // ../core/src/templates/single-html.ts
57988
+ function buildSingleHtmlTemplate({ title }) {
57989
+ return renderTemplate(loadTemplate("html/page-shell"), {
57990
+ lang: "zh-CN",
57991
+ runtimeScript: OWNDESIGN_RUNTIME_SCRIPT_TAG,
57992
+ title: escapeHtmlText(title)
57993
+ });
57994
+ }
57995
+ function renderTemplate(template, values) {
57996
+ return `${template.replace(/\{\{([a-zA-Z0-9]+)\}\}/g, (_match, key) => values[key] ?? "")}
57997
+ `;
57998
+ }
57999
+ function escapeHtmlText(value) {
58000
+ return value.replaceAll("&", "&amp;").replaceAll("<", "&lt;").replaceAll(">", "&gt;");
58001
+ }
58002
+
57885
58003
  // ../core/src/projects/project-service.ts
57886
58004
  var ProjectService = class {
57887
58005
  workspaceStore;
@@ -57951,161 +58069,11 @@ var ProjectService = class {
57951
58069
  // ../core/src/workspace-store/store.ts
57952
58070
  import { copyFile, lstat, mkdir as mkdir2, readdir, readFile as readFile4, rm, stat as stat3, writeFile as writeFile2 } from "node:fs/promises";
57953
58071
  import os5 from "node:os";
57954
- import path13 from "node:path";
58072
+ import path12 from "node:path";
57955
58073
  import process12 from "node:process";
57956
58074
 
57957
- // ../core/src/workspace-store/text.ts
57958
- var MAX_LINE_LENGTH = 2e3;
57959
- function normalizePositiveInteger(value, fallback, name21) {
57960
- if (value === void 0) {
57961
- return fallback;
57962
- }
57963
- if (!Number.isInteger(value) || value < 1) {
57964
- throw new Error(`${name21} must be a positive integer.`);
57965
- }
57966
- return value;
57967
- }
57968
- function countOccurrences(content, needle) {
57969
- if (!needle) {
57970
- return 0;
57971
- }
57972
- return content.split(needle).length - 1;
57973
- }
57974
- function applyTextEdit(content, oldText, newText, replaceAll = false, relativePath) {
57975
- if (!oldText) {
57976
- throw new Error("oldText must not be empty.");
57977
- }
57978
- if (oldText === newText) {
57979
- throw new Error("No changes to apply: oldText and newText are identical.");
57980
- }
57981
- const normalizedOldText = convertToLineEnding(oldText, detectLineEnding(content));
57982
- const normalizedNewText = convertToLineEnding(newText, detectLineEnding(content));
57983
- const firstIndex = content.indexOf(normalizedOldText);
57984
- if (firstIndex === -1) {
57985
- const deEscaped = deEscapeQuotes(normalizedOldText);
57986
- if (deEscaped !== normalizedOldText && content.includes(deEscaped)) {
57987
- throw new Error(
57988
- `oldText was not found in Project Workspace file: ${relativePath}. It looks like oldText contains backslash-escaped quotes/backticks (\\" \\' \\\`) that are not in the file. Provide oldText as the literal file content without adding escape characters.`
57989
- );
57990
- }
57991
- throw new Error(`oldText was not found in Project Workspace file: ${relativePath}`);
57992
- }
57993
- const replacements = countOccurrences(content, normalizedOldText);
57994
- if (!replaceAll && replacements > 1) {
57995
- throw new Error(`oldText appears more than once in Project Workspace file: ${relativePath}`);
57996
- }
57997
- return {
57998
- content: replaceAll ? content.split(normalizedOldText).join(normalizedNewText) : content.slice(0, firstIndex) + normalizedNewText + content.slice(firstIndex + normalizedOldText.length),
57999
- replacements: replaceAll ? replacements : 1
58000
- };
58001
- }
58002
- function deEscapeQuotes(text2) {
58003
- return text2.replaceAll('\\"', '"').replaceAll("\\'", "'").replaceAll("\\`", "`");
58004
- }
58005
- function detectLineEnding(text2) {
58006
- return text2.includes("\r\n") ? "\r\n" : "\n";
58007
- }
58008
- function convertToLineEnding(text2, ending) {
58009
- const normalized = text2.replaceAll("\r\n", "\n").replaceAll("\r", "\n");
58010
- return ending === "\n" ? normalized : normalized.replaceAll("\n", "\r\n");
58011
- }
58012
- function truncateLineMiddle(line) {
58013
- if (line.length <= MAX_LINE_LENGTH) {
58014
- return {
58015
- line,
58016
- truncated: false
58017
- };
58018
- }
58019
- const half = Math.floor((MAX_LINE_LENGTH - 19) / 2);
58020
- return {
58021
- line: `${line.slice(0, half)}...<truncated>...${line.slice(-half)}`,
58022
- truncated: true
58023
- };
58024
- }
58025
-
58026
- // ../core/src/workspace-store/diff.ts
58027
- var MAX_DIFF_LINES = 80;
58028
- function buildUnifiedDiff(oldContent, newContent, relativePath) {
58029
- if (oldContent === newContent) {
58030
- return "";
58031
- }
58032
- const oldLines = oldContent.split(/\r?\n/);
58033
- const newLines = newContent.split(/\r?\n/);
58034
- const lines = [`--- ${relativePath}`, `+++ ${relativePath}`];
58035
- const maxLines = Math.max(oldLines.length, newLines.length);
58036
- let emitted = 0;
58037
- let omitted = 0;
58038
- for (let index = 0; index < maxLines; index += 1) {
58039
- const oldLine = oldLines[index];
58040
- const newLine = newLines[index];
58041
- if (oldLine === newLine) {
58042
- continue;
58043
- }
58044
- if (emitted >= MAX_DIFF_LINES) {
58045
- omitted += 1;
58046
- continue;
58047
- }
58048
- lines.push(`@@ line ${index + 1}`);
58049
- if (oldLine !== void 0) {
58050
- lines.push(`-${truncateLineMiddle(oldLine).line}`);
58051
- }
58052
- if (newLine !== void 0) {
58053
- lines.push(`+${truncateLineMiddle(newLine).line}`);
58054
- }
58055
- emitted += 1;
58056
- }
58057
- if (omitted > 0) {
58058
- lines.push(`... ${omitted} changed line(s) omitted ...`);
58059
- }
58060
- return lines.join("\n");
58061
- }
58062
-
58063
- // ../core/src/html-page-manifest.ts
58064
- var HTML_PAGE_MANIFEST_PATH = ".owndesign-pages.json";
58065
- var EMPTY_HTML_PAGE_MANIFEST = {
58066
- pages: []
58067
- };
58068
- function parseHtmlPageManifest(content) {
58069
- if (!content) {
58070
- return EMPTY_HTML_PAGE_MANIFEST;
58071
- }
58072
- let value;
58073
- try {
58074
- value = JSON.parse(content);
58075
- } catch {
58076
- return EMPTY_HTML_PAGE_MANIFEST;
58077
- }
58078
- if (!isRecord2(value) || !Array.isArray(value.pages)) {
58079
- return EMPTY_HTML_PAGE_MANIFEST;
58080
- }
58081
- const pages = value.pages.filter(isRecord2).map((page) => ({
58082
- componentSource: typeof page.componentSource === "string" ? page.componentSource.trim() : "",
58083
- componentTag: typeof page.componentTag === "string" ? page.componentTag.trim() : "",
58084
- displayName: typeof page.displayName === "string" ? page.displayName.trim() : "",
58085
- htmlPath: typeof page.htmlPath === "string" ? page.htmlPath.trim() : "",
58086
- slug: typeof page.slug === "string" ? page.slug.trim() : ""
58087
- })).filter(
58088
- (page) => page.slug && page.displayName && page.htmlPath && page.componentTag && page.componentSource
58089
- );
58090
- return { pages };
58091
- }
58092
- function isRecord2(value) {
58093
- return typeof value === "object" && value !== null;
58094
- }
58095
-
58096
58075
  // ../core/src/workspace-store/files.ts
58097
58076
  import { open, readFile as readFile3, stat as stat2 } from "node:fs/promises";
58098
-
58099
- // ../core/src/workspace-store/paths.ts
58100
- import path6 from "node:path";
58101
- function isMissingPathError3(error51) {
58102
- return error51 instanceof Error && "code" in error51 && error51.code === "ENOENT";
58103
- }
58104
- function normalizeWorkspaceRelativePath(relativePath) {
58105
- return relativePath.split(path6.sep).join("/");
58106
- }
58107
-
58108
- // ../core/src/workspace-store/files.ts
58109
58077
  async function readTextFileIfExists(filePath) {
58110
58078
  try {
58111
58079
  const fileStats = await stat2(filePath);
@@ -58114,7 +58082,7 @@ async function readTextFileIfExists(filePath) {
58114
58082
  }
58115
58083
  return await readFile3(filePath, "utf8");
58116
58084
  } catch (error51) {
58117
- if (isMissingPathError3(error51)) {
58085
+ if (isMissingPathError2(error51)) {
58118
58086
  return void 0;
58119
58087
  }
58120
58088
  throw error51;
@@ -58186,7 +58154,7 @@ import { promisify as promisify6 } from "node:util";
58186
58154
 
58187
58155
  // ../../node_modules/.pnpm/trash@10.1.1/node_modules/trash/index.js
58188
58156
  import fs11 from "node:fs";
58189
- import path12 from "node:path";
58157
+ import path11 from "node:path";
58190
58158
  import process10 from "node:process";
58191
58159
 
58192
58160
  // ../../node_modules/.pnpm/globby@14.1.0/node_modules/globby/index.js
@@ -58427,15 +58395,15 @@ var import_ignore = __toESM(require_ignore(), 1);
58427
58395
  import process3 from "node:process";
58428
58396
  import fs2 from "node:fs";
58429
58397
  import fsPromises2 from "node:fs/promises";
58430
- import path7 from "node:path";
58398
+ import path6 from "node:path";
58431
58399
 
58432
58400
  // ../../node_modules/.pnpm/slash@5.1.0/node_modules/slash/index.js
58433
- function slash(path16) {
58434
- const isExtendedLengthPath = path16.startsWith("\\\\?\\");
58401
+ function slash(path15) {
58402
+ const isExtendedLengthPath = path15.startsWith("\\\\?\\");
58435
58403
  if (isExtendedLengthPath) {
58436
- return path16;
58404
+ return path15;
58437
58405
  }
58438
- return path16.replace(/\\/g, "/");
58406
+ return path15.replace(/\\/g, "/");
58439
58407
  }
58440
58408
 
58441
58409
  // ../../node_modules/.pnpm/globby@14.1.0/node_modules/globby/utilities.js
@@ -58453,16 +58421,16 @@ var ignoreFilesGlobOptions = {
58453
58421
  dot: true
58454
58422
  };
58455
58423
  var GITIGNORE_FILES_PATTERN = "**/.gitignore";
58456
- var applyBaseToPattern = (pattern, base) => isNegativePattern(pattern) ? "!" + path7.posix.join(base, pattern.slice(1)) : path7.posix.join(base, pattern);
58424
+ var applyBaseToPattern = (pattern, base) => isNegativePattern(pattern) ? "!" + path6.posix.join(base, pattern.slice(1)) : path6.posix.join(base, pattern);
58457
58425
  var parseIgnoreFile = (file2, cwd) => {
58458
- const base = slash(path7.relative(cwd, path7.dirname(file2.filePath)));
58426
+ const base = slash(path6.relative(cwd, path6.dirname(file2.filePath)));
58459
58427
  return file2.content.split(/\r?\n/).filter((line) => line && !line.startsWith("#")).map((pattern) => applyBaseToPattern(pattern, base));
58460
58428
  };
58461
58429
  var toRelativePath = (fileOrDirectory, cwd) => {
58462
58430
  cwd = slash(cwd);
58463
- if (path7.isAbsolute(fileOrDirectory)) {
58431
+ if (path6.isAbsolute(fileOrDirectory)) {
58464
58432
  if (slash(fileOrDirectory).startsWith(cwd)) {
58465
- return path7.relative(cwd, fileOrDirectory);
58433
+ return path6.relative(cwd, fileOrDirectory);
58466
58434
  }
58467
58435
  throw new Error(`Path ${fileOrDirectory} is not in cwd ${cwd}`);
58468
58436
  }
@@ -58523,8 +58491,8 @@ var assertPatternsInput = (patterns) => {
58523
58491
  }
58524
58492
  };
58525
58493
  var normalizePathForDirectoryGlob = (filePath, cwd) => {
58526
- const path16 = isNegativePattern(filePath) ? filePath.slice(1) : filePath;
58527
- return nodePath.isAbsolute(path16) ? path16 : nodePath.join(cwd, path16);
58494
+ const path15 = isNegativePattern(filePath) ? filePath.slice(1) : filePath;
58495
+ return nodePath.isAbsolute(path15) ? path15 : nodePath.join(cwd, path15);
58528
58496
  };
58529
58497
  var getDirectoryGlob = ({ directoryPath, files, extensions }) => {
58530
58498
  const extensionGlob = extensions?.length > 0 ? `.${extensions.length > 1 ? `{${extensions.join(",")}}` : extensions[0]}` : "";
@@ -58707,11 +58675,11 @@ var generateGlobTasksSync = normalizeArgumentsSync(generateTasksSync);
58707
58675
  var { convertPathToPattern } = import_fast_glob2.default;
58708
58676
 
58709
58677
  // ../../node_modules/.pnpm/is-path-inside@4.0.0/node_modules/is-path-inside/index.js
58710
- import path8 from "node:path";
58678
+ import path7 from "node:path";
58711
58679
  function isPathInside(childPath, parentPath) {
58712
- const relation = path8.relative(parentPath, childPath);
58680
+ const relation = path7.relative(parentPath, childPath);
58713
58681
  return Boolean(
58714
- relation && relation !== ".." && !relation.startsWith(`..${path8.sep}`) && relation !== path8.resolve(childPath)
58682
+ relation && relation !== ".." && !relation.startsWith(`..${path7.sep}`) && relation !== path7.resolve(childPath)
58715
58683
  );
58716
58684
  }
58717
58685
 
@@ -58723,7 +58691,7 @@ async function trash2(paths, options = {}) {
58723
58691
  const patterns = paths.map((pattern) => {
58724
58692
  const isNegated = pattern.startsWith("!");
58725
58693
  const body = isNegated ? pattern.slice(1) : pattern;
58726
- const normalized = body.endsWith("/**") ? path12.dirname(body) : body;
58694
+ const normalized = body.endsWith("/**") ? path11.dirname(body) : body;
58727
58695
  return isNegated ? "!" + normalized : normalized;
58728
58696
  });
58729
58697
  const matches = await globby(patterns, {
@@ -58747,7 +58715,7 @@ async function trash2(paths, options = {}) {
58747
58715
  }
58748
58716
  try {
58749
58717
  await fs11.promises.lstat(filePath);
58750
- return path12.resolve(filePath);
58718
+ return path11.resolve(filePath);
58751
58719
  } catch (error51) {
58752
58720
  if (error51.code !== "ENOENT") {
58753
58721
  throw error51;
@@ -58824,7 +58792,7 @@ var WorkspaceStore = class {
58824
58792
  workspaceRoot;
58825
58793
  moveToTrash;
58826
58794
  constructor(options = {}) {
58827
- this.workspaceRoot = options.workspaceRoot ?? path13.join(os5.homedir(), ".owndesign");
58795
+ this.workspaceRoot = options.workspaceRoot ?? path12.join(os5.homedir(), ".owndesign");
58828
58796
  this.moveToTrash = options.moveToTrash ?? (async (targetPath) => {
58829
58797
  await movePathToTrash(targetPath, {
58830
58798
  platform: options.platform ?? process12.platform,
@@ -58837,12 +58805,12 @@ var WorkspaceStore = class {
58837
58805
  }
58838
58806
  async createProject(project) {
58839
58807
  const projectDirectory = this.getProjectDirectory(project.id);
58840
- await mkdir2(path13.join(projectDirectory, "workspace"), { recursive: true });
58841
- await mkdir2(path13.join(projectDirectory, "conversations"), {
58808
+ await mkdir2(path12.join(projectDirectory, "workspace"), { recursive: true });
58809
+ await mkdir2(path12.join(projectDirectory, "conversations"), {
58842
58810
  recursive: true
58843
58811
  });
58844
58812
  await writeFile2(
58845
- path13.join(projectDirectory, "project.json"),
58813
+ path12.join(projectDirectory, "project.json"),
58846
58814
  JSON.stringify(project, null, 2),
58847
58815
  "utf8"
58848
58816
  );
@@ -58855,7 +58823,7 @@ var WorkspaceStore = class {
58855
58823
  const projects = await Promise.all(
58856
58824
  projectEntries.filter((entry) => entry.isDirectory()).map(async (entry) => {
58857
58825
  const projectJson = await readFile4(
58858
- path13.join(projectsRoot, entry.name, "project.json"),
58826
+ path12.join(projectsRoot, entry.name, "project.json"),
58859
58827
  "utf8"
58860
58828
  );
58861
58829
  return normalizeProjectRecord(JSON.parse(projectJson));
@@ -58865,7 +58833,7 @@ var WorkspaceStore = class {
58865
58833
  (left, right) => new Date(right.updatedAt).getTime() - new Date(left.updatedAt).getTime()
58866
58834
  );
58867
58835
  } catch (error51) {
58868
- if (isMissingPathError3(error51)) {
58836
+ if (isMissingPathError2(error51)) {
58869
58837
  return [];
58870
58838
  }
58871
58839
  throw error51;
@@ -58873,14 +58841,14 @@ var WorkspaceStore = class {
58873
58841
  }
58874
58842
  async getProject(projectId) {
58875
58843
  const projectJson = await readFile4(
58876
- path13.join(this.getProjectDirectory(projectId), "project.json"),
58844
+ path12.join(this.getProjectDirectory(projectId), "project.json"),
58877
58845
  "utf8"
58878
58846
  );
58879
58847
  return normalizeProjectRecord(JSON.parse(projectJson));
58880
58848
  }
58881
58849
  async updateProject(projectId, project) {
58882
58850
  await writeFile2(
58883
- path13.join(this.getProjectDirectory(projectId), "project.json"),
58851
+ path12.join(this.getProjectDirectory(projectId), "project.json"),
58884
58852
  JSON.stringify(project, null, 2),
58885
58853
  "utf8"
58886
58854
  );
@@ -58906,7 +58874,7 @@ var WorkspaceStore = class {
58906
58874
  const conversations = await Promise.all(
58907
58875
  conversationEntries.filter((entry) => entry.isFile() && entry.name.endsWith(".json")).map(async (entry) => {
58908
58876
  const conversationJson = await readFile4(
58909
- path13.join(conversationsDirectory, entry.name),
58877
+ path12.join(conversationsDirectory, entry.name),
58910
58878
  "utf8"
58911
58879
  );
58912
58880
  return JSON.parse(conversationJson);
@@ -58918,7 +58886,7 @@ var WorkspaceStore = class {
58918
58886
  return new Date(rightTime).getTime() - new Date(leftTime).getTime();
58919
58887
  });
58920
58888
  } catch (error51) {
58921
- if (isMissingPathError3(error51)) {
58889
+ if (isMissingPathError2(error51)) {
58922
58890
  return [];
58923
58891
  }
58924
58892
  throw error51;
@@ -58946,14 +58914,14 @@ var WorkspaceStore = class {
58946
58914
  files: ["index.html"]
58947
58915
  };
58948
58916
  const checkpointDirectory = this.getCheckpointDirectory(input.projectId, input.id);
58949
- const filesDirectory = path13.join(checkpointDirectory, "files");
58917
+ const filesDirectory = path12.join(checkpointDirectory, "files");
58950
58918
  const sourceFilePath = await this.resolveProjectWorkspacePath(input.projectId, "index.html", {
58951
58919
  checkTargetSymlink: true
58952
58920
  });
58953
58921
  await mkdir2(filesDirectory, { recursive: true });
58954
- await copyFile(sourceFilePath, path13.join(filesDirectory, "index.html"));
58922
+ await copyFile(sourceFilePath, path12.join(filesDirectory, "index.html"));
58955
58923
  await writeFile2(
58956
- path13.join(checkpointDirectory, "meta.json"),
58924
+ path12.join(checkpointDirectory, "meta.json"),
58957
58925
  `${JSON.stringify(record2, null, 2)}
58958
58926
  `,
58959
58927
  "utf8"
@@ -58971,7 +58939,7 @@ var WorkspaceStore = class {
58971
58939
  (left, right) => new Date(right.createdAt).getTime() - new Date(left.createdAt).getTime()
58972
58940
  );
58973
58941
  } catch (error51) {
58974
- if (isMissingPathError3(error51)) {
58942
+ if (isMissingPathError2(error51)) {
58975
58943
  return [];
58976
58944
  }
58977
58945
  throw error51;
@@ -58980,7 +58948,7 @@ var WorkspaceStore = class {
58980
58948
  async readCheckpoint(projectId, checkpointId) {
58981
58949
  assertSafeCheckpointId(checkpointId);
58982
58950
  const checkpointJson = await readFile4(
58983
- path13.join(this.getCheckpointDirectory(projectId, checkpointId), "meta.json"),
58951
+ path12.join(this.getCheckpointDirectory(projectId, checkpointId), "meta.json"),
58984
58952
  "utf8"
58985
58953
  );
58986
58954
  const checkpoint = JSON.parse(checkpointJson);
@@ -58993,19 +58961,19 @@ var WorkspaceStore = class {
58993
58961
  const checkpoint = await this.readCheckpoint(projectId, checkpointId);
58994
58962
  const checkpointDirectory = this.getCheckpointDirectory(projectId, checkpointId);
58995
58963
  for (const file2 of checkpoint.files) {
58996
- const sourcePath = path13.join(checkpointDirectory, "files", file2);
58964
+ const sourcePath = path12.join(checkpointDirectory, "files", file2);
58997
58965
  const targetPath = await this.resolveProjectWorkspacePath(projectId, file2, {
58998
58966
  checkTargetSymlink: true,
58999
58967
  targetMayBeMissing: true
59000
58968
  });
59001
- await mkdir2(path13.dirname(targetPath), { recursive: true });
58969
+ await mkdir2(path12.dirname(targetPath), { recursive: true });
59002
58970
  await copyFile(sourcePath, targetPath);
59003
58971
  }
59004
58972
  return checkpoint;
59005
58973
  }
59006
58974
  async writeProjectOutput(projectId, outputType, content) {
59007
58975
  const outputPath = this.getProjectOutputFilePath(projectId, outputType);
59008
- await mkdir2(path13.dirname(outputPath), { recursive: true });
58976
+ await mkdir2(path12.dirname(outputPath), { recursive: true });
59009
58977
  await writeFile2(outputPath, content, "utf8");
59010
58978
  return outputPath;
59011
58979
  }
@@ -59013,7 +58981,7 @@ var WorkspaceStore = class {
59013
58981
  return readFile4(this.getProjectOutputFilePath(projectId, outputType), "utf8");
59014
58982
  }
59015
58983
  getProjectWorkspaceDirectory(projectId) {
59016
- return path13.join(this.getProjectDirectory(projectId), "workspace");
58984
+ return path12.join(this.getProjectDirectory(projectId), "workspace");
59017
58985
  }
59018
58986
  async listProjectWorkspace(projectId) {
59019
58987
  const entries = [];
@@ -59022,35 +58990,6 @@ var WorkspaceStore = class {
59022
58990
  });
59023
58991
  return entries.sort((left, right) => left.path.localeCompare(right.path));
59024
58992
  }
59025
- async listProjectHtmlFiles(projectId) {
59026
- const entries = [];
59027
- await this.walkProjectWorkspace(projectId, "", async (entry) => {
59028
- if (entry.type === "file" && entry.path.toLowerCase().endsWith(".html")) {
59029
- entries.push(entry);
59030
- }
59031
- });
59032
- return entries.map((entry) => entry.path).sort((left, right) => {
59033
- if (left === "index.html") {
59034
- return -1;
59035
- }
59036
- if (right === "index.html") {
59037
- return 1;
59038
- }
59039
- return left.localeCompare(right);
59040
- });
59041
- }
59042
- async readProjectHtmlPageManifest(projectId) {
59043
- try {
59044
- return parseHtmlPageManifest(
59045
- await this.readProjectWorkspaceFile(projectId, HTML_PAGE_MANIFEST_PATH)
59046
- );
59047
- } catch (error51) {
59048
- if (isMissingPathError3(error51)) {
59049
- return parseHtmlPageManifest(void 0);
59050
- }
59051
- throw error51;
59052
- }
59053
- }
59054
58993
  async readProjectWorkspaceEntry(projectId, relativePath, options = {}) {
59055
58994
  const offset = normalizePositiveInteger(options.offset, 1, "offset");
59056
58995
  const limit = normalizePositiveInteger(options.limit, DEFAULT_READ_LIMIT, "limit");
@@ -59067,7 +59006,7 @@ var WorkspaceStore = class {
59067
59006
  const entries = await readdir(targetPath, { withFileTypes: true });
59068
59007
  const visibleEntries = (await Promise.all(
59069
59008
  entries.map(async (entry) => {
59070
- const absolutePath = path13.join(targetPath, entry.name);
59009
+ const absolutePath = path12.join(targetPath, entry.name);
59071
59010
  const entryStats = await lstat(absolutePath);
59072
59011
  if (entryStats.isSymbolicLink()) {
59073
59012
  return void 0;
@@ -59076,7 +59015,7 @@ var WorkspaceStore = class {
59076
59015
  return void 0;
59077
59016
  }
59078
59017
  return {
59079
- path: normalizeWorkspaceRelativePath(path13.relative(rootPath, absolutePath)),
59018
+ path: normalizeWorkspaceRelativePath(path12.relative(rootPath, absolutePath)),
59080
59019
  type: entryStats.isDirectory() ? "directory" : "file"
59081
59020
  };
59082
59021
  })
@@ -59154,8 +59093,8 @@ var WorkspaceStore = class {
59154
59093
  const matcher = globToRegExp(pattern);
59155
59094
  const matches = [];
59156
59095
  await this.walkProjectWorkspace(projectId, startPath, async (entry) => {
59157
- const pathFromStart = startPath ? normalizeWorkspaceRelativePath(path13.relative(startPath, entry.path)) : entry.path;
59158
- if (matcher.test(pathFromStart) || matcher.test(path13.basename(entry.path))) {
59096
+ const pathFromStart = startPath ? normalizeWorkspaceRelativePath(path12.relative(startPath, entry.path)) : entry.path;
59097
+ if (matcher.test(pathFromStart) || matcher.test(path12.basename(entry.path))) {
59159
59098
  matches.push({
59160
59099
  path: entry.path,
59161
59100
  type: entry.type,
@@ -59196,9 +59135,9 @@ var WorkspaceStore = class {
59196
59135
  const startStats = await stat3(absoluteStartPath);
59197
59136
  const visitFile = async (absolutePath) => {
59198
59137
  const relativeFilePath = normalizeWorkspaceRelativePath(
59199
- path13.relative(this.getProjectWorkspaceDirectory(projectId), absolutePath)
59138
+ path12.relative(this.getProjectWorkspaceDirectory(projectId), absolutePath)
59200
59139
  );
59201
- if (includeMatcher && !includeMatcher.test(relativeFilePath) && !includeMatcher.test(path13.basename(relativeFilePath))) {
59140
+ if (includeMatcher && !includeMatcher.test(relativeFilePath) && !includeMatcher.test(path12.basename(relativeFilePath))) {
59202
59141
  return;
59203
59142
  }
59204
59143
  const fileStats = await stat3(absolutePath);
@@ -59266,7 +59205,7 @@ var WorkspaceStore = class {
59266
59205
  await rm(change.absolutePath, { force: false, recursive: true });
59267
59206
  continue;
59268
59207
  }
59269
- await mkdir2(path13.dirname(change.absolutePath), { recursive: true });
59208
+ await mkdir2(path12.dirname(change.absolutePath), { recursive: true });
59270
59209
  await writeFile2(change.absolutePath, change.content ?? "", "utf8");
59271
59210
  }
59272
59211
  const results = prepared.map((change) => ({
@@ -59336,7 +59275,7 @@ var WorkspaceStore = class {
59336
59275
  targetMayBeMissing: true
59337
59276
  });
59338
59277
  const previousContent = await readTextFileIfExists(filePath);
59339
- await mkdir2(path13.dirname(filePath), { recursive: true });
59278
+ await mkdir2(path12.dirname(filePath), { recursive: true });
59340
59279
  await writeFile2(filePath, content, "utf8");
59341
59280
  return {
59342
59281
  bytesWritten: Buffer.byteLength(content, "utf8"),
@@ -59344,11 +59283,11 @@ var WorkspaceStore = class {
59344
59283
  previousContent ?? "",
59345
59284
  content,
59346
59285
  normalizeWorkspaceRelativePath(
59347
- path13.relative(this.getProjectWorkspaceDirectory(projectId), filePath)
59286
+ path12.relative(this.getProjectWorkspaceDirectory(projectId), filePath)
59348
59287
  )
59349
59288
  ),
59350
59289
  path: normalizeWorkspaceRelativePath(
59351
- path13.relative(this.getProjectWorkspaceDirectory(projectId), filePath)
59290
+ path12.relative(this.getProjectWorkspaceDirectory(projectId), filePath)
59352
59291
  )
59353
59292
  };
59354
59293
  }
@@ -59391,25 +59330,25 @@ var WorkspaceStore = class {
59391
59330
  await this.moveToTrash(this.getProjectDirectory(projectId));
59392
59331
  }
59393
59332
  getProjectsRoot() {
59394
- return path13.join(this.workspaceRoot, "projects");
59333
+ return path12.join(this.workspaceRoot, "projects");
59395
59334
  }
59396
59335
  getProjectDirectory(projectId) {
59397
- return path13.join(this.getProjectsRoot(), projectId);
59336
+ return path12.join(this.getProjectsRoot(), projectId);
59398
59337
  }
59399
59338
  getConversationsDirectory(projectId) {
59400
- return path13.join(this.getProjectDirectory(projectId), "conversations");
59339
+ return path12.join(this.getProjectDirectory(projectId), "conversations");
59401
59340
  }
59402
59341
  getCheckpointsDirectory(projectId) {
59403
- return path13.join(this.getProjectDirectory(projectId), "checkpoints");
59342
+ return path12.join(this.getProjectDirectory(projectId), "checkpoints");
59404
59343
  }
59405
59344
  getCheckpointDirectory(projectId, checkpointId) {
59406
- return path13.join(this.getCheckpointsDirectory(projectId), checkpointId);
59345
+ return path12.join(this.getCheckpointsDirectory(projectId), checkpointId);
59407
59346
  }
59408
59347
  getProjectOutputFilePath(projectId, outputType) {
59409
- return path13.join(this.getProjectWorkspaceDirectory(projectId), `index.${outputType}`);
59348
+ return path12.join(this.getProjectWorkspaceDirectory(projectId), `index.${outputType}`);
59410
59349
  }
59411
59350
  getConversationFilePath(projectId, conversationId) {
59412
- return path13.join(this.getConversationsDirectory(projectId), `${conversationId}.json`);
59351
+ return path12.join(this.getConversationsDirectory(projectId), `${conversationId}.json`);
59413
59352
  }
59414
59353
  async walkProjectWorkspace(projectId, relativePath, visit2) {
59415
59354
  const rootPath = this.getProjectWorkspaceDirectory(projectId);
@@ -59419,13 +59358,13 @@ var WorkspaceStore = class {
59419
59358
  async function walk(absoluteDirectory) {
59420
59359
  const dirEntries = await readdir(absoluteDirectory, { withFileTypes: true });
59421
59360
  for (const dirEntry of dirEntries) {
59422
- const absolutePath = path13.join(absoluteDirectory, dirEntry.name);
59361
+ const absolutePath = path12.join(absoluteDirectory, dirEntry.name);
59423
59362
  const entryStats = await lstat(absolutePath);
59424
59363
  if (entryStats.isSymbolicLink()) {
59425
59364
  continue;
59426
59365
  }
59427
59366
  const relativeEntryPath = normalizeWorkspaceRelativePath(
59428
- path13.relative(rootPath, absolutePath)
59367
+ path12.relative(rootPath, absolutePath)
59429
59368
  );
59430
59369
  if (entryStats.isDirectory()) {
59431
59370
  await visit2(
@@ -59460,7 +59399,7 @@ var WorkspaceStore = class {
59460
59399
  } else if (startStats.isFile()) {
59461
59400
  await visit2(
59462
59401
  {
59463
- path: normalizeWorkspaceRelativePath(path13.relative(rootPath, startPath)),
59402
+ path: normalizeWorkspaceRelativePath(path12.relative(rootPath, startPath)),
59464
59403
  size: startStats.size,
59465
59404
  type: "file",
59466
59405
  updatedAt: startStats.mtime.toISOString()
@@ -59471,7 +59410,7 @@ var WorkspaceStore = class {
59471
59410
  }
59472
59411
  async searchWorkspaceFile(projectId, absolutePath, query, matches, skippedFiles) {
59473
59412
  const relativePath = normalizeWorkspaceRelativePath(
59474
- path13.relative(this.getProjectWorkspaceDirectory(projectId), absolutePath)
59413
+ path12.relative(this.getProjectWorkspaceDirectory(projectId), absolutePath)
59475
59414
  );
59476
59415
  const fileStats = await stat3(absolutePath);
59477
59416
  if (fileStats.size > MAX_TEXT_FILE_BYTES) {
@@ -59586,24 +59525,24 @@ var WorkspaceStore = class {
59586
59525
  if (!relativePath.trim()) {
59587
59526
  throw new Error("Project Workspace path must not be empty.");
59588
59527
  }
59589
- if (path13.isAbsolute(relativePath)) {
59528
+ if (path12.isAbsolute(relativePath)) {
59590
59529
  throw new Error(`Project Workspace path must be relative: ${relativePath}`);
59591
59530
  }
59592
59531
  const workspaceDirectory = this.getProjectWorkspaceDirectory(projectId);
59593
- const targetPath = path13.resolve(workspaceDirectory, relativePath);
59594
- const relativeFromWorkspace = path13.relative(workspaceDirectory, targetPath);
59595
- if (!relativeFromWorkspace || relativeFromWorkspace.startsWith("..") || path13.isAbsolute(relativeFromWorkspace)) {
59532
+ const targetPath = path12.resolve(workspaceDirectory, relativePath);
59533
+ const relativeFromWorkspace = path12.relative(workspaceDirectory, targetPath);
59534
+ if (!relativeFromWorkspace || relativeFromWorkspace.startsWith("..") || path12.isAbsolute(relativeFromWorkspace)) {
59596
59535
  throw new Error(`Project Workspace path escapes workspace: ${relativePath}`);
59597
59536
  }
59598
59537
  await this.assertNoWorkspaceSymlinkPath(workspaceDirectory, relativeFromWorkspace, options);
59599
59538
  return targetPath;
59600
59539
  }
59601
59540
  async assertNoWorkspaceSymlinkPath(workspaceDirectory, relativeFromWorkspace, options) {
59602
- const segments = relativeFromWorkspace.split(path13.sep).filter((segment) => segment && segment !== ".");
59541
+ const segments = relativeFromWorkspace.split(path12.sep).filter((segment) => segment && segment !== ".");
59603
59542
  const lastIndex = segments.length - 1;
59604
59543
  let currentPath = workspaceDirectory;
59605
59544
  for (const [index, segment] of segments.entries()) {
59606
- currentPath = path13.join(currentPath, segment);
59545
+ currentPath = path12.join(currentPath, segment);
59607
59546
  try {
59608
59547
  const pathStats = await lstat(currentPath);
59609
59548
  const isTarget = index === lastIndex;
@@ -59611,7 +59550,7 @@ var WorkspaceStore = class {
59611
59550
  throw new Error("Project Workspace symlinks are not supported.");
59612
59551
  }
59613
59552
  } catch (error51) {
59614
- if (isMissingPathError3(error51) && options.targetMayBeMissing) {
59553
+ if (isMissingPathError2(error51) && options.targetMayBeMissing) {
59615
59554
  return;
59616
59555
  }
59617
59556
  throw error51;
@@ -59747,9 +59686,9 @@ function getPathFromValue(value) {
59747
59686
  if (!value || typeof value !== "object") {
59748
59687
  return void 0;
59749
59688
  }
59750
- const path16 = "path" in value ? value.path : "targetPath" in value ? value.targetPath : void 0;
59751
- if (typeof path16 === "string" && path16.length > 0) {
59752
- return path16;
59689
+ const path15 = "path" in value ? value.path : "targetPath" in value ? value.targetPath : void 0;
59690
+ if (typeof path15 === "string" && path15.length > 0) {
59691
+ return path15;
59753
59692
  }
59754
59693
  const nestedOutput = "output" in value ? value.output : void 0;
59755
59694
  if (nestedOutput && typeof nestedOutput === "object") {
@@ -59762,13 +59701,13 @@ function getSanitizedToolOutput(value) {
59762
59701
  return void 0;
59763
59702
  }
59764
59703
  const ok = "ok" in value && typeof value.ok === "boolean" ? value.ok : void 0;
59765
- const path16 = getPathFromValue(value);
59766
- if (ok === void 0 && !path16) {
59704
+ const path15 = getPathFromValue(value);
59705
+ if (ok === void 0 && !path15) {
59767
59706
  return void 0;
59768
59707
  }
59769
59708
  return {
59770
59709
  ...ok !== void 0 ? { ok } : {},
59771
- ...path16 ? { path: path16 } : {}
59710
+ ...path15 ? { path: path15 } : {}
59772
59711
  };
59773
59712
  }
59774
59713
 
@@ -60070,6 +60009,73 @@ function mergeResponseMessage(messages, responseMessage) {
60070
60009
  return [...messages, responseMessage];
60071
60010
  }
60072
60011
 
60012
+ // src/screenshot.ts
60013
+ import { chromium } from "playwright-core";
60014
+ var ScreenshotBrowserUnavailableError = class extends Error {
60015
+ constructor(cause) {
60016
+ super(
60017
+ "No supported browser was found. Install Chrome/Edge or set OWNDESIGN_SCREENSHOT_BROWSER_EXECUTABLE.",
60018
+ { cause }
60019
+ );
60020
+ this.name = "ScreenshotBrowserUnavailableError";
60021
+ }
60022
+ };
60023
+ var SCREENSHOT_VIEWPORTS = {
60024
+ desktop: { height: 1024, width: 1440 },
60025
+ mobile: { height: 844, width: 390 }
60026
+ };
60027
+ var BROWSER_CHANNELS = ["msedge", "chrome"];
60028
+ function getScreenshotViewport(device) {
60029
+ return SCREENSHOT_VIEWPORTS[device];
60030
+ }
60031
+ async function captureProjectScreenshot({ device, url: url2 }) {
60032
+ const browser = await launchSystemBrowser();
60033
+ let context2;
60034
+ let page;
60035
+ try {
60036
+ context2 = await browser.newContext({
60037
+ deviceScaleFactor: 1,
60038
+ viewport: getScreenshotViewport(device)
60039
+ });
60040
+ page = await context2.newPage();
60041
+ page.setDefaultTimeout(15e3);
60042
+ page.setDefaultNavigationTimeout(15e3);
60043
+ await page.goto(url2, { waitUntil: "networkidle" });
60044
+ await waitForFonts(page);
60045
+ return await page.screenshot({ fullPage: true, type: "png" });
60046
+ } finally {
60047
+ await context2?.close().catch(() => {
60048
+ });
60049
+ await browser.close().catch(() => {
60050
+ });
60051
+ }
60052
+ }
60053
+ async function launchSystemBrowser() {
60054
+ let lastError;
60055
+ for (const channel of BROWSER_CHANNELS) {
60056
+ try {
60057
+ return await chromium.launch({ channel, headless: true });
60058
+ } catch (error51) {
60059
+ lastError = error51;
60060
+ }
60061
+ }
60062
+ const executablePath = process.env.OWNDESIGN_SCREENSHOT_BROWSER_EXECUTABLE?.trim();
60063
+ if (executablePath) {
60064
+ try {
60065
+ return await chromium.launch({ executablePath, headless: true });
60066
+ } catch (error51) {
60067
+ lastError = error51;
60068
+ }
60069
+ }
60070
+ throw new ScreenshotBrowserUnavailableError(lastError);
60071
+ }
60072
+ async function waitForFonts(page) {
60073
+ await page.evaluate(async () => {
60074
+ await document.fonts?.ready;
60075
+ }).catch(() => {
60076
+ });
60077
+ }
60078
+
60073
60079
  // src/app.ts
60074
60080
  function createOwnDesignApp(options = {}) {
60075
60081
  const app2 = new Hono2();
@@ -60264,18 +60270,12 @@ function createOwnDesignApp(options = {}) {
60264
60270
  const body = await context2.req.json();
60265
60271
  const projectId = asNonEmptyString(body.projectId);
60266
60272
  const conversationId = asNonEmptyString(body.conversationId);
60267
- const requestedPreviewPath = asNonEmptyString(body.previewPath);
60268
60273
  const currentUserMessage = createCurrentUserMessage(body.message);
60269
60274
  if (!projectId || !conversationId || !currentUserMessage) {
60270
60275
  return context2.text("Invalid chat request.", 400);
60271
60276
  }
60272
60277
  const workspaceStore = createWorkspaceStore(options);
60273
60278
  const project = await workspaceStore.getProject(projectId);
60274
- const previewPath = await resolveExistingPreviewPath(
60275
- workspaceStore,
60276
- projectId,
60277
- requestedPreviewPath
60278
- );
60279
60279
  if (chatRunManager.getActiveRun(projectId)) {
60280
60280
  return context2.text("\u5F53\u524D\u9879\u76EE\u5DF2\u6709\u4EFB\u52A1\u6B63\u5728\u6267\u884C\u3002", 409);
60281
60281
  }
@@ -60295,7 +60295,6 @@ function createOwnDesignApp(options = {}) {
60295
60295
  let agentContext;
60296
60296
  try {
60297
60297
  agentContext = await createDesignPageAgentContext({
60298
- currentPreviewPath: previewPath,
60299
60298
  frontendTabId: asNonEmptyString(body.frontendTabId),
60300
60299
  modelConfigurationId: asNonEmptyString(body.modelConfigurationId),
60301
60300
  projectType: project.projectType ?? "single_html",
@@ -60413,7 +60412,7 @@ function createOwnDesignApp(options = {}) {
60413
60412
  })
60414
60413
  });
60415
60414
  } catch (error51) {
60416
- if (isMissingPathError4(error51)) {
60415
+ if (isMissingPathError3(error51)) {
60417
60416
  return context2.text("Checkpoint not found.", 404);
60418
60417
  }
60419
60418
  return context2.text(
@@ -60470,13 +60469,12 @@ function createOwnDesignApp(options = {}) {
60470
60469
  if (!clientId) {
60471
60470
  return context2.text("Invalid preview session request.", 400);
60472
60471
  }
60472
+ if (hasPreviewPath(body)) {
60473
+ return context2.text("Invalid preview session request.", 400);
60474
+ }
60473
60475
  const workspaceStore = createWorkspaceStore(options);
60474
60476
  const manager = getPreviewServerManager(workspaceStore);
60475
- const session = await manager.ensure(
60476
- context2.req.param("projectId"),
60477
- clientId,
60478
- asNonEmptyString(body?.previewPath)
60479
- );
60477
+ const session = await manager.ensure(context2.req.param("projectId"), clientId);
60480
60478
  return context2.json(session);
60481
60479
  });
60482
60480
  app2.delete("/api/projects/:projectId/preview-session", async (context2) => {
@@ -60496,13 +60494,12 @@ function createOwnDesignApp(options = {}) {
60496
60494
  if (!clientId) {
60497
60495
  return context2.text("Invalid preview heartbeat request.", 400);
60498
60496
  }
60497
+ if (hasPreviewPath(body)) {
60498
+ return context2.text("Invalid preview heartbeat request.", 400);
60499
+ }
60499
60500
  const workspaceStore = createWorkspaceStore(options);
60500
60501
  const manager = getPreviewServerManager(workspaceStore);
60501
- const session = await manager.heartbeat(
60502
- context2.req.param("projectId"),
60503
- clientId,
60504
- asNonEmptyString(body?.previewPath)
60505
- );
60502
+ const session = await manager.heartbeat(context2.req.param("projectId"), clientId);
60506
60503
  return context2.json(session);
60507
60504
  });
60508
60505
  app2.get("/api/projects/:projectId/frontend-capabilities/stream", async (context2) => {
@@ -60540,15 +60537,29 @@ function createOwnDesignApp(options = {}) {
60540
60537
  const projectId = context2.req.param("projectId");
60541
60538
  const kind = context2.req.query("kind");
60542
60539
  if (kind === "current-html") {
60543
- return downloadCurrentHtml(
60544
- workspaceStore,
60545
- projectId,
60546
- context2.req.query("previewPath") ?? null
60547
- );
60540
+ if (context2.req.query("previewPath") !== void 0) {
60541
+ return context2.text("Invalid download request.", 400);
60542
+ }
60543
+ return downloadCurrentHtml(workspaceStore, projectId);
60548
60544
  }
60549
60545
  if (kind === "workspace-zip") {
60550
60546
  return downloadWorkspaceZip(workspaceStore, projectId);
60551
60547
  }
60548
+ if (kind === "current-screenshot") {
60549
+ if (context2.req.query("previewPath") !== void 0) {
60550
+ return context2.text("Invalid download request.", 400);
60551
+ }
60552
+ const route = parseScreenshotRoute(context2.req.query("route"));
60553
+ if (!route.ok) {
60554
+ return context2.text("Invalid download request.", 400);
60555
+ }
60556
+ return downloadCurrentScreenshot(
60557
+ workspaceStore,
60558
+ projectId,
60559
+ parseScreenshotDevice(context2.req.query("device")),
60560
+ route.value
60561
+ );
60562
+ }
60552
60563
  return context2.text("Invalid download request.", 400);
60553
60564
  });
60554
60565
  registerStaticHosting(app2, options.staticRoot);
@@ -60581,7 +60592,7 @@ function resolveStaticIndexPath(staticRoot2) {
60581
60592
  }
60582
60593
  try {
60583
60594
  const rootStats = statSync2(staticRoot2);
60584
- const indexPath = path14.join(staticRoot2, "index.html");
60595
+ const indexPath = path13.join(staticRoot2, "index.html");
60585
60596
  const indexStats = statSync2(indexPath);
60586
60597
  if (!rootStats.isDirectory() || !indexStats.isFile()) {
60587
60598
  return void 0;
@@ -60598,7 +60609,7 @@ function shouldServeSpaIndex(request, requestPath) {
60598
60609
  if (request.method !== "GET" && request.method !== "HEAD") {
60599
60610
  return false;
60600
60611
  }
60601
- if (path14.extname(requestPath)) {
60612
+ if (path13.extname(requestPath)) {
60602
60613
  return false;
60603
60614
  }
60604
60615
  const accept = request.headers.get("Accept");
@@ -60609,15 +60620,12 @@ function htmlResponse2(html) {
60609
60620
  headers: { "Content-Type": "text/html; charset=utf-8" }
60610
60621
  });
60611
60622
  }
60612
- async function downloadCurrentHtml(workspaceStore, projectId, previewPath) {
60613
- if (!previewPath?.trim() || !previewPath.toLowerCase().endsWith(".html")) {
60614
- return new Response("Invalid download request.", { status: 400 });
60615
- }
60623
+ async function downloadCurrentHtml(workspaceStore, projectId) {
60616
60624
  try {
60617
- const content = await workspaceStore.readProjectWorkspaceFileBuffer(projectId, previewPath);
60618
- return new Response(content, {
60625
+ const content = await workspaceStore.readProjectWorkspaceFileBuffer(projectId, "index.html");
60626
+ return new Response(new Uint8Array(content), {
60619
60627
  headers: {
60620
- "Content-Disposition": createAttachmentDisposition(path14.basename(previewPath)),
60628
+ "Content-Disposition": createAttachmentDisposition("index.html"),
60621
60629
  "Content-Type": "text/html; charset=utf-8"
60622
60630
  },
60623
60631
  status: 200
@@ -60630,8 +60638,8 @@ async function downloadWorkspaceZip(workspaceStore, projectId) {
60630
60638
  let tempDirectory;
60631
60639
  try {
60632
60640
  const project = await workspaceStore.getProject(projectId);
60633
- tempDirectory = await mkdtemp(path14.join(os6.tmpdir(), "owndesign-project-download-"));
60634
- const zipPath = path14.join(tempDirectory, "workspace.zip");
60641
+ tempDirectory = await mkdtemp(path13.join(os6.tmpdir(), "owndesign-project-download-"));
60642
+ const zipPath = path13.join(tempDirectory, "workspace.zip");
60635
60643
  await writeWorkspaceZip(workspaceStore, projectId, zipPath);
60636
60644
  const [zipStats, zipBuffer] = await Promise.all([stat4(zipPath), readFile5(zipPath)]);
60637
60645
  await rm2(tempDirectory, { force: true, recursive: true });
@@ -60654,6 +60662,45 @@ async function downloadWorkspaceZip(workspaceStore, projectId) {
60654
60662
  return mapWorkspaceErrorToResponse(error51);
60655
60663
  }
60656
60664
  }
60665
+ async function downloadCurrentScreenshot(workspaceStore, projectId, device, route) {
60666
+ if (!device) {
60667
+ return new Response("Invalid download request.", { status: 400 });
60668
+ }
60669
+ const clientId = `screenshot-${randomUUID3()}`;
60670
+ const previewManager = getPreviewServerManager(workspaceStore);
60671
+ try {
60672
+ await workspaceStore.readProjectWorkspaceFileBuffer(projectId, "index.html");
60673
+ const session = await previewManager.ensure(projectId, clientId);
60674
+ if (!session.previewFileExists || !session.url) {
60675
+ return new Response("Project file not found.", { status: 404 });
60676
+ }
60677
+ const content = await captureProjectScreenshot({
60678
+ device,
60679
+ url: buildScreenshotUrl(session.url, route)
60680
+ });
60681
+ return new Response(new Uint8Array(content), {
60682
+ headers: {
60683
+ "Content-Disposition": createAttachmentDisposition(
60684
+ createScreenshotDownloadFilename(route)
60685
+ ),
60686
+ "Content-Type": "image/png"
60687
+ },
60688
+ status: 200
60689
+ });
60690
+ } catch (error51) {
60691
+ if (error51 instanceof ScreenshotBrowserUnavailableError) {
60692
+ return new Response(error51.message, { status: 503 });
60693
+ }
60694
+ try {
60695
+ return mapWorkspaceErrorToResponse(error51);
60696
+ } catch {
60697
+ return new Response("Screenshot capture failed.", { status: 500 });
60698
+ }
60699
+ } finally {
60700
+ await previewManager.release(projectId, clientId).catch(() => {
60701
+ });
60702
+ }
60703
+ }
60657
60704
  async function writeWorkspaceZip(workspaceStore, projectId, zipPath) {
60658
60705
  const zipFile = new import_yazl.ZipFile();
60659
60706
  const output = createWriteStream(zipPath);
@@ -60679,11 +60726,48 @@ function createAttachmentDisposition(filename) {
60679
60726
  const encodedFilename = encodeRFC5987Value(filename);
60680
60727
  return `attachment; filename="${fallbackFilename}"; filename*=UTF-8''${encodedFilename}`;
60681
60728
  }
60729
+ function parseScreenshotDevice(value) {
60730
+ return value === "desktop" || value === "mobile" ? value : void 0;
60731
+ }
60732
+ function parseScreenshotRoute(value) {
60733
+ if (value === void 0 || value === "") {
60734
+ return { ok: true, value: void 0 };
60735
+ }
60736
+ if (!value.startsWith("#") || hasControlCharacter(value)) {
60737
+ return { ok: false };
60738
+ }
60739
+ return { ok: true, value };
60740
+ }
60741
+ function hasControlCharacter(value) {
60742
+ for (const character of value) {
60743
+ const codePoint = character.codePointAt(0) ?? 0;
60744
+ if (codePoint <= 31 || codePoint === 127) {
60745
+ return true;
60746
+ }
60747
+ }
60748
+ return false;
60749
+ }
60750
+ function buildScreenshotUrl(url2, route) {
60751
+ if (!route) {
60752
+ return url2;
60753
+ }
60754
+ const screenshotUrl = new URL(url2);
60755
+ screenshotUrl.hash = route;
60756
+ return screenshotUrl.toString();
60757
+ }
60758
+ function createScreenshotDownloadFilename(route) {
60759
+ const basename = "index";
60760
+ if (!route) {
60761
+ return `${basename}.png`;
60762
+ }
60763
+ const routeSlug = route.slice(1).toLowerCase().replace(/[^a-z0-9]+/g, "-").replace(/^-+|-+$/g, "");
60764
+ return `${basename}${routeSlug ? `-${routeSlug}` : ""}.png`;
60765
+ }
60682
60766
  function sanitizeDownloadFilename(value) {
60683
60767
  return value?.replace(/[<>:"/\\|?*\u0000-\u001F]/g, "-").replace(/[.\s]+$/g, "").trim();
60684
60768
  }
60685
60769
  function createAsciiFilenameFallback(filename) {
60686
- const extension = path14.extname(filename);
60770
+ const extension = path13.extname(filename);
60687
60771
  const basename = extension ? filename.slice(0, -extension.length) : filename;
60688
60772
  const safeBasename = basename.normalize("NFKD").replace(/[^\x20-\x7E]/g, "-").replace(/["\\]/g, "").replace(/\s+/g, "-").replace(/-+/g, "-").replace(/^[.-]+|[.-]+$/g, "");
60689
60773
  const safeExtension = extension.replace(/[^\x20-\x7E]/g, "");
@@ -60697,7 +60781,7 @@ function encodeRFC5987Value(value) {
60697
60781
  );
60698
60782
  }
60699
60783
  function mapWorkspaceErrorToResponse(error51) {
60700
- if (isMissingPathError4(error51)) {
60784
+ if (isMissingPathError3(error51)) {
60701
60785
  return new Response("Project file not found.", { status: 404 });
60702
60786
  }
60703
60787
  if (error51 instanceof Error && (error51.message.includes("must be relative") || error51.message.includes("escapes workspace") || error51.message.includes("symlinks are not supported") || error51.message.includes("is not a file"))) {
@@ -60705,7 +60789,7 @@ function mapWorkspaceErrorToResponse(error51) {
60705
60789
  }
60706
60790
  throw error51;
60707
60791
  }
60708
- function isMissingPathError4(error51) {
60792
+ function isMissingPathError3(error51) {
60709
60793
  return typeof error51 === "object" && error51 !== null && "code" in error51 && error51.code === "ENOENT";
60710
60794
  }
60711
60795
  function getChatRunManagerKey(options) {
@@ -60722,7 +60806,7 @@ async function readJson(request) {
60722
60806
  }
60723
60807
  }
60724
60808
  function createCurrentUserMessage(value) {
60725
- if (!isRecord3(value)) {
60809
+ if (!isRecord2(value)) {
60726
60810
  return void 0;
60727
60811
  }
60728
60812
  const id = asNonEmptyString(value.id);
@@ -60739,21 +60823,17 @@ function createCurrentUserMessage(value) {
60739
60823
  };
60740
60824
  }
60741
60825
  function isFileUIPart2(value) {
60742
- return isRecord3(value) && value.type === "file";
60826
+ return isRecord2(value) && value.type === "file";
60743
60827
  }
60744
- function isRecord3(value) {
60828
+ function isRecord2(value) {
60745
60829
  return typeof value === "object" && value !== null;
60746
60830
  }
60747
- async function resolveExistingPreviewPath(workspaceStore, projectId, previewPath) {
60748
- if (!previewPath) {
60749
- return void 0;
60750
- }
60751
- const htmlFiles = await workspaceStore.listProjectHtmlFiles(projectId);
60752
- return htmlFiles.includes(previewPath) ? previewPath : void 0;
60753
- }
60754
60831
  function asNonEmptyString(value) {
60755
60832
  return typeof value === "string" && value.trim() ? value.trim() : void 0;
60756
60833
  }
60834
+ function hasPreviewPath(value) {
60835
+ return isRecord2(value) && Object.hasOwn(value, "previewPath");
60836
+ }
60757
60837
  function parseProjectType(value) {
60758
60838
  if (value === void 0 || value === null || value === "") {
60759
60839
  return "single_html";
@@ -60767,7 +60847,7 @@ function parseCheckpointRestoreMode(value) {
60767
60847
  return value === "files" || value === "conversation" || value === "both" ? value : void 0;
60768
60848
  }
60769
60849
  function parseProviderOptionsSelection(value) {
60770
- if (!isRecord3(value)) {
60850
+ if (!isRecord2(value)) {
60771
60851
  return void 0;
60772
60852
  }
60773
60853
  const deepseek2 = parseDeepSeekThinkingMode(value.deepseek);
@@ -60816,7 +60896,7 @@ var DEFAULT_HOST = "127.0.0.1";
60816
60896
  var DEFAULT_PORT = 3711;
60817
60897
  var host = process.env.OWNDESIGN_SERVER_HOST ?? DEFAULT_HOST;
60818
60898
  var port = parsePort(process.env.OWNDESIGN_SERVER_PORT ?? String(DEFAULT_PORT));
60819
- var staticRoot = process.env.OWNDESIGN_WEB_ROOT ?? path15.resolve(process.cwd(), "web");
60899
+ var staticRoot = process.env.OWNDESIGN_WEB_ROOT ?? path14.resolve(process.cwd(), "web");
60820
60900
  var app = createOwnDesignApp({
60821
60901
  staticRoot
60822
60902
  });