@moonshot-ai/kimi-code 0.37.2 → 0.39.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/main.mjs +32451 -25743
- package/dist/search-worker.mjs +0 -160
- package/dist-web/assets/{CodeBlockNode-EUGAgT_h.js → CodeBlockNode-TQKPIcUp.js} +2 -2
- package/dist-web/assets/{Tooltip-OrMK9Tfr.js → Tooltip-3Kylewm2.js} +1 -1
- package/dist-web/assets/{abnfDiagram-VRR7QNED-BN8tpheJ.js → abnfDiagram-VRR7QNED-DZ5l2NNF.js} +1 -1
- package/dist-web/assets/arc-C525Mmp6.js +1 -0
- package/dist-web/assets/{architectureDiagram-ZJ3FMSHR-C9XZJvH9.js → architectureDiagram-ZJ3FMSHR-DsZ4TpMi.js} +1 -1
- package/dist-web/assets/{blockDiagram-677ZJIJ3-DAH71x1Q.js → blockDiagram-677ZJIJ3-DHUznNgz.js} +1 -1
- package/dist-web/assets/{c4Diagram-LMCZKHZV-Pb2vyZDT.js → c4Diagram-LMCZKHZV-BRKLxvwh.js} +1 -1
- package/dist-web/assets/channel-5_2atmZK.js +1 -0
- package/dist-web/assets/{chunk-2Q5K7J3B-vvrZ7MG7.js → chunk-2Q5K7J3B-CldwFnN4.js} +1 -1
- package/dist-web/assets/{chunk-32BRIVSS-CZoTGle4.js → chunk-32BRIVSS-0ImWpiFu.js} +1 -1
- package/dist-web/assets/{chunk-5VM5RSS4-BxdGGlTY.js → chunk-5VM5RSS4-K_NNkrmw.js} +1 -1
- package/dist-web/assets/{chunk-EX3LRPZG-CfpEIqXB.js → chunk-EX3LRPZG-Du5tJK2w.js} +1 -1
- package/dist-web/assets/{chunk-JWPE2WC7-D0FrOBtU.js → chunk-JWPE2WC7-CnsTQcA8.js} +1 -1
- package/dist-web/assets/{chunk-MOJQB5TN-BWl8WxOI.js → chunk-MOJQB5TN-BWiH3s-c.js} +3 -3
- package/dist-web/assets/{chunk-RYQCIY6F-DPVXfp-M.js → chunk-RYQCIY6F-Bg4GHN0V.js} +1 -1
- package/dist-web/assets/{chunk-V7JOEXUC-CySsnTrI.js → chunk-V7JOEXUC-5w7loxVR.js} +1 -1
- package/dist-web/assets/{chunk-VR4S4FIN-CTR9P-lT.js → chunk-VR4S4FIN-Cp8JVohH.js} +1 -1
- package/dist-web/assets/{chunk-XXDRQBXY-BeefoqH0.js → chunk-XXDRQBXY-BwEKpC0s.js} +1 -1
- package/dist-web/assets/classDiagram-OUVF2IWQ-CNk36E8O.js +1 -0
- package/dist-web/assets/classDiagram-v2-EOCWNBFH-CNk36E8O.js +1 -0
- package/dist-web/assets/{cose-bilkent-JH36ORCC-Br_qiVSQ.js → cose-bilkent-JH36ORCC-CyvFRDuS.js} +1 -1
- package/dist-web/assets/{cynefin-VYW2F7L2-BGL2vhde.js → cynefin-VYW2F7L2-Ct8il_Gb.js} +1 -1
- package/dist-web/assets/{cynefinDiagram-TSTJHNR4-qBwjxYIX.js → cynefinDiagram-TSTJHNR4-BP26cYtj.js} +2 -2
- package/dist-web/assets/{dagre-VKFMJZFB-LDM5VIAI.js → dagre-VKFMJZFB-BuaL-XNK.js} +1 -1
- package/dist-web/assets/{diagram-FQU43EPY-D5pIW94l.js → diagram-FQU43EPY-BXKGXolr.js} +3 -3
- package/dist-web/assets/{diagram-G47NLZAW-Xp-lqyAs.js → diagram-G47NLZAW-DsoHq3g9.js} +1 -1
- package/dist-web/assets/{diagram-NH7WQ7WH-arIhWcCl.js → diagram-NH7WQ7WH-l2Pip_5t.js} +2 -2
- package/dist-web/assets/{diagram-OA4YK3LP-DRlqkiV7.js → diagram-OA4YK3LP-DO8otT0J.js} +3 -3
- package/dist-web/assets/diagram-WEI45ONY-tJhlXXXb.js +41 -0
- package/dist-web/assets/{ebnfDiagram-CCIWWBDH-CxhfT5Dk.js → ebnfDiagram-CCIWWBDH-DuVJXtzP.js} +1 -1
- package/dist-web/assets/{erDiagram-Q63AITRT-qDRc-Mjq.js → erDiagram-Q63AITRT-q8LwmVdA.js} +1 -1
- package/dist-web/assets/{flowDiagram-23GEKE2U-CLFIXYkh.js → flowDiagram-23GEKE2U-CSk8qFwd.js} +5 -5
- package/dist-web/assets/{ganttDiagram-NO4QXBWP-CWQOrsH8.js → ganttDiagram-NO4QXBWP-BliHEJI2.js} +1 -1
- package/dist-web/assets/{gitGraphDiagram-IHSO6WYX-DT7ncN8L.js → gitGraphDiagram-IHSO6WYX-DbTFMBma.js} +3 -3
- package/dist-web/assets/{index-CDF-FRTI.js → index-BlRksujk.js} +1 -1
- package/dist-web/assets/index-BxiMZi52.css +32 -0
- package/dist-web/assets/index-CvgiEu-R.js +818 -0
- package/dist-web/assets/{index-DXophRCW.js → index-Dq61ZbBp.js} +2 -2
- package/dist-web/assets/{index-C6iX4-LJ.js → index-DuIqvsra.js} +1 -1
- package/dist-web/assets/{index10-BY9KLppN.js → index10-C0TQjdWb.js} +1 -1
- package/dist-web/assets/{index11-D6nykIM1.js → index11-DNt97Omj.js} +1 -1
- package/dist-web/assets/{index5-D0Y6cLP4.js → index5-DPyXoDa2.js} +1 -1
- package/dist-web/assets/{index6-It9n1WlQ.js → index6-RUyA_B9p.js} +1 -1
- package/dist-web/assets/{index7-3cymNRfD.js → index7-ClRJOaWc.js} +1 -1
- package/dist-web/assets/{index8-CdUxL-Tk.js → index8-Dx-vzK_w.js} +1 -1
- package/dist-web/assets/{infoDiagram-FWYZ7A6U-DmW-BDHY.js → infoDiagram-FWYZ7A6U-Bge59IZG.js} +1 -1
- package/dist-web/assets/{ishikawaDiagram-FXEZZL3T-DJxuDwZK.js → ishikawaDiagram-FXEZZL3T-y8Y7SwAW.js} +3 -3
- package/dist-web/assets/{journeyDiagram-5HDEW3XC-BXVdGyDj.js → journeyDiagram-5HDEW3XC-B1mQtsyC.js} +1 -1
- package/dist-web/assets/{kanban-definition-HUTT4EX6-B6mC5age.js → kanban-definition-HUTT4EX6-Bpgk0PjP.js} +7 -7
- package/dist-web/assets/{linear-oD38CRgN.js → linear-Cu3jckud.js} +1 -1
- package/dist-web/assets/{mermaid.core-BKBZnrB_.js → mermaid.core-CGrLstUA.js} +5 -5
- package/dist-web/assets/{mindmap-definition-LN4V7U3C-dirTUANL.js → mindmap-definition-LN4V7U3C-jRWZCKa4.js} +2 -2
- package/dist-web/assets/{pegDiagram-2B236MQR-D_Imjl5d.js → pegDiagram-2B236MQR-BBHHexxE.js} +1 -1
- package/dist-web/assets/pieDiagram-ENE6RG2P-h3KzynJ8.js +39 -0
- package/dist-web/assets/{quadrantDiagram-ABIIQ3AL-AdbtQLWr.js → quadrantDiagram-ABIIQ3AL-DFm-eCQb.js} +4 -4
- package/dist-web/assets/{railroadDiagram-RFXS5EU6-DFGDBfNL.js → railroadDiagram-RFXS5EU6-Buc-7xRH.js} +1 -1
- package/dist-web/assets/{requirementDiagram-TGXJPOKE-BM1jojUv.js → requirementDiagram-TGXJPOKE-CSxNTrK4.js} +3 -3
- package/dist-web/assets/{sankeyDiagram-HTMAVEWB-CVUG-8BS.js → sankeyDiagram-HTMAVEWB-Dd9T4UrJ.js} +4 -4
- package/dist-web/assets/{sequenceDiagram-DBY2YBRQ-UDhAaHfs.js → sequenceDiagram-DBY2YBRQ-Cr-Sj8Pb.js} +4 -4
- package/dist-web/assets/{sizeCapture-X5ZJPWSS-DkAB-D09.js → sizeCapture-X5ZJPWSS-Cl-kJspZ.js} +1 -1
- package/dist-web/assets/stateDiagram-2N3HPSRC-BYfWdLSL.js +1 -0
- package/dist-web/assets/stateDiagram-v2-6OUMAXLB-D2Op2fy3.js +1 -0
- package/dist-web/assets/{swimlanes-5IMT3BWC-CfDcaFta.js → swimlanes-5IMT3BWC-48M2vHyU.js} +2 -2
- package/dist-web/assets/swimlanesDiagram-G3AALYLV-gPkWeD2t.js +8 -0
- package/dist-web/assets/{timeline-definition-FHXFAJF6-B-aR9mhp.js → timeline-definition-FHXFAJF6-CsGFMDtB.js} +3 -3
- package/dist-web/assets/{vennDiagram-L72KCM5P-55dVqqaA.js → vennDiagram-L72KCM5P-B5PLrg4a.js} +1 -1
- package/dist-web/assets/{vue.runtime.esm-bundler-C_QWhoww.js → vue.runtime.esm-bundler-Ii2EKmOx.js} +1 -1
- package/dist-web/assets/{wardleyDiagram-EHGQE667-Ip7Q1iRO.js → wardleyDiagram-EHGQE667-B6OLyL9l.js} +1 -1
- package/dist-web/assets/{xychartDiagram-FW5EYKEG-D5HV8EjG.js → xychartDiagram-FW5EYKEG-DfHxJPKU.js} +1 -1
- package/dist-web/index.html +2 -2
- package/package.json +13 -7
- package/dist-web/assets/DesignSystemView-B4B2cx0C.js +0 -13
- package/dist-web/assets/DesignSystemView-BxQYZjpo.css +0 -1
- package/dist-web/assets/arc-myf2kRJl.js +0 -1
- package/dist-web/assets/channel-C2KMAw2n.js +0 -1
- package/dist-web/assets/classDiagram-OUVF2IWQ-C4oeFc7A.js +0 -1
- package/dist-web/assets/classDiagram-v2-EOCWNBFH-C4oeFc7A.js +0 -1
- package/dist-web/assets/diagram-WEI45ONY-zMSIhP2J.js +0 -41
- package/dist-web/assets/index-DBtc5buz.css +0 -1
- package/dist-web/assets/index-yKYHPeXU.js +0 -669
- package/dist-web/assets/pieDiagram-ENE6RG2P-Bma7UCRc.js +0 -39
- package/dist-web/assets/stateDiagram-2N3HPSRC-C83-b98K.js +0 -1
- package/dist-web/assets/stateDiagram-v2-6OUMAXLB-DuUdJv-B.js +0 -1
- package/dist-web/assets/swimlanesDiagram-G3AALYLV-B-ICP983.js +0 -8
package/dist/search-worker.mjs
CHANGED
|
@@ -58,11 +58,6 @@ function getTextBuildWorkerRuntimeState() {
|
|
|
58
58
|
|
|
59
59
|
//#endregion
|
|
60
60
|
//#region ../../packages/kap-server/src/search/contract.ts
|
|
61
|
-
/**
|
|
62
|
-
* Service-level error with a machine-readable reason. Lives in the contract
|
|
63
|
-
* (not the service module) so the search-index core — which also runs inside
|
|
64
|
-
* the search worker thread — can raise it without importing the service.
|
|
65
|
-
*/
|
|
66
61
|
var GlobalSearchError = class extends Error {
|
|
67
62
|
reason;
|
|
68
63
|
constructor(reason, message) {
|
|
@@ -11887,20 +11882,12 @@ const MAX_DOC_TEXT_CHARS = 2e4;
|
|
|
11887
11882
|
|
|
11888
11883
|
//#endregion
|
|
11889
11884
|
//#region ../../packages/kap-server/src/search/match.ts
|
|
11890
|
-
/** Boundary tuple width for the query's effective sort order. */
|
|
11891
11885
|
function boundaryWidth(q) {
|
|
11892
11886
|
return q.mode !== "literal" && q.sort === "score" ? 3 : 2;
|
|
11893
11887
|
}
|
|
11894
11888
|
function cmpKey(a, b) {
|
|
11895
11889
|
return a < b ? -1 : a > b ? 1 : 0;
|
|
11896
11890
|
}
|
|
11897
|
-
/**
|
|
11898
|
-
* The query's total order (negative = `a` ranks before `b`):
|
|
11899
|
-
* - literal mode (sort is a terms-mode concept) and `time_desc`:
|
|
11900
|
-
* (time desc, key asc);
|
|
11901
|
-
* - `time_asc`: (time asc, key asc);
|
|
11902
|
-
* - `score`: (score desc, time desc, key asc).
|
|
11903
|
-
*/
|
|
11904
11891
|
function compareRows(q, a, b) {
|
|
11905
11892
|
if (q.mode !== "literal" && q.sort === "score") return b.score - a.score || b.value.time - a.value.time || cmpKey(a.key, b.key);
|
|
11906
11893
|
if (q.mode !== "literal" && q.sort === "time_asc") return a.value.time - b.value.time || cmpKey(a.key, b.key);
|
|
@@ -11917,12 +11904,6 @@ function rowAfterBoundary(q, row, boundary) {
|
|
|
11917
11904
|
}
|
|
11918
11905
|
return cmp > 0;
|
|
11919
11906
|
}
|
|
11920
|
-
/**
|
|
11921
|
-
* Bounded collector for the K best rows in the query's sort order — same
|
|
11922
|
-
* worst-at-root heap shape as minidb's TopK: O(log K) per row and K rows in
|
|
11923
|
-
* memory instead of an O(E log E) sort over every eligible row. Deep pages
|
|
11924
|
-
* stay proportional to pageSize.
|
|
11925
|
-
*/
|
|
11926
11907
|
var RowTopK = class {
|
|
11927
11908
|
q;
|
|
11928
11909
|
k;
|
|
@@ -11961,22 +11942,11 @@ var RowTopK = class {
|
|
|
11961
11942
|
i = w;
|
|
11962
11943
|
}
|
|
11963
11944
|
}
|
|
11964
|
-
/** The kept rows in final rank order. */
|
|
11965
11945
|
sorted() {
|
|
11966
11946
|
return this.a.sort((x, y) => compareRows(this.q, x, y));
|
|
11967
11947
|
}
|
|
11968
11948
|
};
|
|
11969
11949
|
const DEADLINE_CHECK_STRIDE = 64;
|
|
11970
|
-
/**
|
|
11971
|
-
* Container/role/time filtering, keyset-boundary filtering and literal
|
|
11972
|
-
* confirmation — one implementation shared by the index route (confirming
|
|
11973
|
-
* n-gram candidates) and the live route (scanning every in-memory
|
|
11974
|
-
* document). The query work budgets apply at this match stage: the
|
|
11975
|
-
* wall-clock deadline is re-checked every DEADLINE_CHECK_STRIDE candidates
|
|
11976
|
-
* and literal confirmation additionally charges each processed document's
|
|
11977
|
-
* text against `budget.textCharsLeft`. A budget stop is reported as
|
|
11978
|
-
* `incomplete: 'deadline'`, never a silent truncation.
|
|
11979
|
-
*/
|
|
11980
11950
|
function matchDocs(q, docs, boundary, budget) {
|
|
11981
11951
|
const literalQuery = q.literalQuery;
|
|
11982
11952
|
const rows = [];
|
|
@@ -12019,12 +11989,6 @@ function matchDocs(q, docs, boundary, budget) {
|
|
|
12019
11989
|
}
|
|
12020
11990
|
return { rows };
|
|
12021
11991
|
}
|
|
12022
|
-
/**
|
|
12023
|
-
* Sort, paginate and project the matched docs into a page (both routes).
|
|
12024
|
-
* Keyset pages collect the best `pageSize + 1` rows past the boundary in a
|
|
12025
|
-
* bounded heap; legacy v1 offset tokens get one last offset slice and are
|
|
12026
|
-
* answered with a v2 keyset token.
|
|
12027
|
-
*/
|
|
12028
11992
|
function paginateRows(q, page, rows) {
|
|
12029
11993
|
let pageRows;
|
|
12030
11994
|
let hasMore;
|
|
@@ -12045,14 +12009,6 @@ function paginateRows(q, page, rows) {
|
|
|
12045
12009
|
hasMore
|
|
12046
12010
|
};
|
|
12047
12011
|
}
|
|
12048
|
-
/**
|
|
12049
|
-
* The page token encodes a fingerprint of the query conditions — changing
|
|
12050
|
-
* conditions mid-pagination invalidates the token (same rule as Lark's
|
|
12051
|
-
* search API). The serving route (`source`) is part of the fingerprint: a
|
|
12052
|
-
* route flip mid-pagination (e.g. the container session closed and the live
|
|
12053
|
-
* route fell away) invalidates the token too, so the client restarts the
|
|
12054
|
-
* search instead of silently switching result sets.
|
|
12055
|
-
*/
|
|
12056
12012
|
function tokenFingerprint(q, source) {
|
|
12057
12013
|
const basis = JSON.stringify([
|
|
12058
12014
|
q.query,
|
|
@@ -12257,7 +12213,6 @@ function turnEffectOfAppendMessage(message) {
|
|
|
12257
12213
|
anchor: kind === void 0 || kind === "user"
|
|
12258
12214
|
};
|
|
12259
12215
|
}
|
|
12260
|
-
/** Full reading of one wire.jsonl line; unparseable lines analyze to zero. */
|
|
12261
12216
|
function analyzeWireLine(line) {
|
|
12262
12217
|
const r = parseWireLine(line);
|
|
12263
12218
|
if (r === void 0) return {
|
|
@@ -12469,35 +12424,15 @@ function advanceStepTracker(state, effect) {
|
|
|
12469
12424
|
}
|
|
12470
12425
|
var SearchIndexCore = class {
|
|
12471
12426
|
options;
|
|
12472
|
-
/** WAL watermark (bytes applied) for read-only catch-up. */
|
|
12473
12427
|
walOffset = 0;
|
|
12474
12428
|
fingerprint = "";
|
|
12475
12429
|
disposed = false;
|
|
12476
|
-
/**
|
|
12477
|
-
* Close-gate + drain for lifecycle-managed background ops (sync passes and
|
|
12478
|
-
* read-only refreshes): close() closes the gate (new ops skip) and drains
|
|
12479
|
-
* the in-flight ones BEFORE closing the db, so no background task ever
|
|
12480
|
-
* touches a closed handle.
|
|
12481
|
-
*/
|
|
12482
12430
|
ops = new OpTracker();
|
|
12483
|
-
/**
|
|
12484
|
-
* Identity of the published index base: bumped on every open/reopen
|
|
12485
|
-
* (initial open, read-only swap, reindex) and on a sync pass that REPLACED
|
|
12486
|
-
* already-indexed documents (shrink rescan, title overwrite). Page tokens
|
|
12487
|
-
* pin it; additive/deletion-only passes deliberately keep it stable so
|
|
12488
|
-
* keyset pagination over a live index is not constantly restarted (see
|
|
12489
|
-
* contract.ts for the weak-consistency semantics).
|
|
12490
|
-
*/
|
|
12491
12431
|
generation = 0;
|
|
12492
|
-
/** Set by a sync pass when it replaced indexed documents → generation bump. */
|
|
12493
12432
|
syncReplaced = false;
|
|
12494
|
-
/** Last background refresh failure — surfaced as degraded. */
|
|
12495
12433
|
lastRefreshError = null;
|
|
12496
|
-
/** Last open failure — a search with no published generation fails fast. */
|
|
12497
12434
|
openError = null;
|
|
12498
|
-
/** One-time per-process migration flag for pre-v2 file-meta keys. */
|
|
12499
12435
|
fileMetaMigrated = false;
|
|
12500
|
-
/** Token of the published db.lock line (writer only) — see CoreIndexView. */
|
|
12501
12436
|
lockToken;
|
|
12502
12437
|
db = null;
|
|
12503
12438
|
openPromise = null;
|
|
@@ -12506,7 +12441,6 @@ var SearchIndexCore = class {
|
|
|
12506
12441
|
constructor(options) {
|
|
12507
12442
|
this.options = options;
|
|
12508
12443
|
}
|
|
12509
|
-
/** The published db.lock token (writer only) — see CoreIndexView.lockToken. */
|
|
12510
12444
|
get lockTokenView() {
|
|
12511
12445
|
return this.lockToken;
|
|
12512
12446
|
}
|
|
@@ -12534,25 +12468,9 @@ var SearchIndexCore = class {
|
|
|
12534
12468
|
}
|
|
12535
12469
|
await this.publishDb(db, null);
|
|
12536
12470
|
}
|
|
12537
|
-
/**
|
|
12538
|
-
* The generation page tokens pin: `<bootSalt>:<local counter>`. The local
|
|
12539
|
-
* counter alone restarts from 0 when the worker (or, pre-workerization,
|
|
12540
|
-
* the process) respawns — a token issued before the restart (say g=1)
|
|
12541
|
-
* would otherwise validate against the fresh host's g=1 and silently
|
|
12542
|
-
* paginate a different base. The boot salt makes every pre-restart token
|
|
12543
|
-
* fail with `invalid_page_token` so the client restarts the search.
|
|
12544
|
-
*/
|
|
12545
12471
|
tokenGeneration() {
|
|
12546
12472
|
return `${this.options.bootSalt}:${this.generation}`;
|
|
12547
12473
|
}
|
|
12548
|
-
/**
|
|
12549
|
-
* Swap a freshly opened db in as the new published generation: writer-side
|
|
12550
|
-
* text-index definitions and the (handle-independent) fingerprint are
|
|
12551
|
-
* computed BEFORE the swap, so a failure closes `next` and leaves `prev`
|
|
12552
|
-
* (or the no-db state) untouched; the swap itself is one synchronous
|
|
12553
|
-
* segment with no failure point between publishing `next` and closing
|
|
12554
|
-
* `prev`.
|
|
12555
|
-
*/
|
|
12556
12474
|
async publishDb(next, prev) {
|
|
12557
12475
|
let fingerprint;
|
|
12558
12476
|
try {
|
|
@@ -12585,12 +12503,6 @@ var SearchIndexCore = class {
|
|
|
12585
12503
|
fullRecoveryMs: Math.round(lifecycle.phases.fullRecoveryMs)
|
|
12586
12504
|
});
|
|
12587
12505
|
}
|
|
12588
|
-
/**
|
|
12589
|
-
* The db.lock token this core published, so the main process can reap the
|
|
12590
|
-
* lock after a worker crash. Read from the lock file (the LockFile
|
|
12591
|
-
* instance's token is instance-private by design); anything unreadable or
|
|
12592
|
-
* foreign-owned yields undefined and the reaper stays conservative.
|
|
12593
|
-
*/
|
|
12594
12506
|
async readLockToken() {
|
|
12595
12507
|
try {
|
|
12596
12508
|
const raw = await readFile(join(this.indexDir, "db.lock"), "utf8");
|
|
@@ -12601,18 +12513,6 @@ var SearchIndexCore = class {
|
|
|
12601
12513
|
return;
|
|
12602
12514
|
}
|
|
12603
12515
|
}
|
|
12604
|
-
/**
|
|
12605
|
-
* Open the index db, rebuilding from scratch on unrecoverable corruption
|
|
12606
|
-
* (the index is derived data — never repaired, only rebuilt).
|
|
12607
|
-
*
|
|
12608
|
-
* Rebuild is WRITER-ONLY: a process that fails to grab the write lock must
|
|
12609
|
-
* never delete the directory out from under the live indexer. Lock state is
|
|
12610
|
-
* not observable once `open` throws, so corruption is disambiguated with a
|
|
12611
|
-
* probe open WITHOUT `onLockFail`: it throws `LockError` before recovery
|
|
12612
|
-
* when another process holds the lock, and re-throws the corruption
|
|
12613
|
-
* (releasing the lock) when the lock is free — in which case this process
|
|
12614
|
-
* is the would-be writer and may rebuild.
|
|
12615
|
-
*/
|
|
12616
12516
|
async openSearchDb() {
|
|
12617
12517
|
const opts = {
|
|
12618
12518
|
dir: this.indexDir,
|
|
@@ -12650,23 +12550,9 @@ var SearchIndexCore = class {
|
|
|
12650
12550
|
return MiniDb.open(opts);
|
|
12651
12551
|
}
|
|
12652
12552
|
}
|
|
12653
|
-
/**
|
|
12654
|
-
* Synchronously mark the core closed: in-flight sync/refresh passes skip
|
|
12655
|
-
* their remaining work at the next `disposed` check, and no new background
|
|
12656
|
-
* work starts. The async close() then drains and releases the handle. The
|
|
12657
|
-
* split exists so a host's synchronous dispose() can gate mid-pass writes
|
|
12658
|
-
* BEFORE awaiting anything (the pre-worker service did this with its
|
|
12659
|
-
* synchronous `disposed = true`).
|
|
12660
|
-
*/
|
|
12661
12553
|
beginClose() {
|
|
12662
12554
|
this.disposed = true;
|
|
12663
12555
|
}
|
|
12664
|
-
/**
|
|
12665
|
-
* Close the core: close the op gate (new syncs / refreshes skip at
|
|
12666
|
-
* enter()), wait for every in-flight op and the in-flight open to settle,
|
|
12667
|
-
* then release and close the handle — no background task can touch a
|
|
12668
|
-
* closed db.
|
|
12669
|
-
*/
|
|
12670
12556
|
async close() {
|
|
12671
12557
|
this.disposed = true;
|
|
12672
12558
|
await this.ops.close();
|
|
@@ -12675,11 +12561,6 @@ var SearchIndexCore = class {
|
|
|
12675
12561
|
this.db = null;
|
|
12676
12562
|
if (db) await db.close().catch(() => {});
|
|
12677
12563
|
}
|
|
12678
|
-
/**
|
|
12679
|
-
* Run one lifecycle-managed background op under the close drain gate:
|
|
12680
|
-
* skipped once close has started, and close waits for every op that
|
|
12681
|
-
* already entered before it closes the db.
|
|
12682
|
-
*/
|
|
12683
12564
|
async tracked(op) {
|
|
12684
12565
|
if (!this.ops.enter()) return;
|
|
12685
12566
|
try {
|
|
@@ -12702,14 +12583,6 @@ var SearchIndexCore = class {
|
|
|
12702
12583
|
}
|
|
12703
12584
|
return parts.join("|");
|
|
12704
12585
|
}
|
|
12705
|
-
/**
|
|
12706
|
-
* Bring a read-only instance up to date with the indexer's committed
|
|
12707
|
-
* writes. Unchanged fingerprint → zero IO; WAL pure-append → incremental
|
|
12708
|
-
* `catchUpFromWal`; anything else → open the replacement db and swap (which
|
|
12709
|
-
* may also promote this process to indexer when the old writer's lock is
|
|
12710
|
-
* gone). Single-flight; a failure is recorded in `lastRefreshError` and
|
|
12711
|
-
* the stale generation keeps serving (surfaced as `indexState.degraded`).
|
|
12712
|
-
*/
|
|
12713
12586
|
refresh() {
|
|
12714
12587
|
this.refreshPromise ??= this.tracked(() => this.doRefreshReadonly()).then(() => {
|
|
12715
12588
|
this.lastRefreshError = null;
|
|
@@ -12834,12 +12707,6 @@ var SearchIndexCore = class {
|
|
|
12834
12707
|
documents: stats.documents
|
|
12835
12708
|
};
|
|
12836
12709
|
}
|
|
12837
|
-
/**
|
|
12838
|
-
* One-time per-process migration of pre-v2 hash-only file-meta keys to the
|
|
12839
|
-
* session-scoped format (`fileMetaKey`). A single full prefix scan of the
|
|
12840
|
-
* meta namespace; per-session work afterwards only scans that session's
|
|
12841
|
-
* keys. Idempotent — a crash mid-migration just rescans on the next pass.
|
|
12842
|
-
*/
|
|
12843
12710
|
async migrateFileMetaKeys(db) {
|
|
12844
12711
|
if (this.fileMetaMigrated) return;
|
|
12845
12712
|
const ops = [];
|
|
@@ -13022,11 +12889,6 @@ var SearchIndexCore = class {
|
|
|
13022
12889
|
});
|
|
13023
12890
|
await db.batch(ops);
|
|
13024
12891
|
}
|
|
13025
|
-
/**
|
|
13026
|
-
* Turn/step counting and doc extraction for one complete wire line.
|
|
13027
|
-
* Returns the counter states advanced by the line (they are immutable and
|
|
13028
|
-
* replaced per line, so the caller threads them through the chunk loop).
|
|
13029
|
-
*/
|
|
13030
12892
|
collectWireLine(ops, summary, file, line, lineOffset, counters) {
|
|
13031
12893
|
let { turnState, stepState } = counters;
|
|
13032
12894
|
const analysis = analyzeWireLine(line);
|
|
@@ -13061,13 +12923,6 @@ var SearchIndexCore = class {
|
|
|
13061
12923
|
stepState
|
|
13062
12924
|
};
|
|
13063
12925
|
}
|
|
13064
|
-
/**
|
|
13065
|
-
* Serve one page from the currently published generation. Never waits for
|
|
13066
|
-
* an open, sync, reopen or reindex: with no published base it answers with
|
|
13067
|
-
* `building` semantics (or fails fast when the last open failed), and the
|
|
13068
|
-
* page-token generation check runs against the base pinned at request
|
|
13069
|
-
* time.
|
|
13070
|
-
*/
|
|
13071
12926
|
async search(params) {
|
|
13072
12927
|
const { q, budgets } = params;
|
|
13073
12928
|
const db = this.db;
|
|
@@ -13176,11 +13031,6 @@ var SearchIndexCore = class {
|
|
|
13176
13031
|
index: this.readIndexView(serveDb, freshnessStale)
|
|
13177
13032
|
};
|
|
13178
13033
|
}
|
|
13179
|
-
/**
|
|
13180
|
-
* Full rebuild: close the handle, wipe the directory and reopen. The
|
|
13181
|
-
* caller (the service) blocks new sync passes beforehand and runs the
|
|
13182
|
-
* authoritative sync afterwards.
|
|
13183
|
-
*/
|
|
13184
13034
|
async reindex() {
|
|
13185
13035
|
await this.ensureOpen();
|
|
13186
13036
|
if (this.db?.readOnly === true) throw new GlobalSearchError("readonly_index", "another process holds the search-index write lock; reindex from that process");
|
|
@@ -13199,15 +13049,6 @@ var SearchIndexCore = class {
|
|
|
13199
13049
|
});
|
|
13200
13050
|
await this.ensureOpen();
|
|
13201
13051
|
}
|
|
13202
|
-
/**
|
|
13203
|
-
* Synchronous lifecycle snapshot (stage 5) — never kicks an open, never
|
|
13204
|
-
* awaits: the diagnostic view of `stopped → opening → ready →
|
|
13205
|
-
* building/degraded → closing`. 'degraded' means NO base is serving (the
|
|
13206
|
-
* last open failed); a published base that keeps serving after a failed
|
|
13207
|
-
* background refresh stays 'ready' — the failure rides the `degraded`
|
|
13208
|
-
* message field of the page/status surfaces, same as the per-page
|
|
13209
|
-
* `indexState` discipline.
|
|
13210
|
-
*/
|
|
13211
13052
|
lifecycleState() {
|
|
13212
13053
|
if (this.disposed) return { state: this.db === null ? "stopped" : "closing" };
|
|
13213
13054
|
const db = this.db;
|
|
@@ -13237,7 +13078,6 @@ var SearchIndexCore = class {
|
|
|
13237
13078
|
lifecycle: this.lifecycleState()
|
|
13238
13079
|
};
|
|
13239
13080
|
}
|
|
13240
|
-
/** The view served while no queryable base is available. */
|
|
13241
13081
|
buildingView(db) {
|
|
13242
13082
|
const handle = db ?? this.db;
|
|
13243
13083
|
const stats = handle?.get(STATS_KEY);
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/index-
|
|
2
|
-
import{bR as xi,cb as Si,bQ as Ho,M as pl,bl as Ci,af as fl,bY as Mi,cc as Bi,b$ as hl,aU as $,c0 as Ei,c1 as Fi,c2 as Pi,a0 as Mo,aD as No,bE as ue,az as Li,cd as wn,c8 as mt,aI as To,aL as Y,s as Sn,aw as Vt,au as pt,bk as J,ce as Bo,u as ie,I as Ro,A as Oi,bJ as Gt,aY as ht,bL as vl,v as w,t as we,bB as ml,bb as Be,q as b,b7 as $i,cf as zi,cg as bn,ch as Hi,ci as Ni,cj as Ti,ck as Ri,as as A,cl as Eo,cm as Di,cn as Ai,co as Wt,cp as Fo,bO as Do,T as ji,G as qi,F as Po,g as Wi,c7 as _i,b_ as Ii}from"./index-yKYHPeXU.js";import{i as fe,t as kn}from"./safeRaf-DGuzXxDK.js";var xn=(k,M,y)=>new Promise((te,ne)=>{var be=P=>{try{r(y.next(P))}catch(H){ne(H)}},ke=P=>{try{r(y.throw(P))}catch(H){ne(H)}},r=P=>P.done?te(P.value):Promise.resolve(P.value).then(be,ke);r((y=y.apply(k,M)).next())});let Lo=!1,_t=null,It=null,Ut=null;function Ui(){return xn(this,null,function*(){if(Ut)return Ut;Ut=xn(null,null,function*(){if(!It)try{if(It=(function(k){const M=k;if(typeof M?.useMonaco=="function")return M;const y=k?.default;return typeof y?.useMonaco=="function"?y:null})(yield xi(()=>import("./index-DXophRCW.js"),__vite__mapDeps([0,1,2]))),!It)return null}catch{return null}try{return yield(function(k){return xn(this,null,function*(){return Lo?void 0:_t||(_t=xn(null,null,function*(){const y=globalThis?.MonacoEnvironment;y&&(typeof y.getWorker=="function"||typeof y.getWorkerUrl=="function")||typeof k?.preloadMonacoWorkers!="function"||(yield k.preloadMonacoWorkers()),Lo=!0}).finally(()=>{_t=null}),_t)})})(It),Si(),It}catch{return null}});try{return yield Ut}finally{Ut=null}})}var Vi=Object.defineProperty,Gi=Object.defineProperties,Ji=Object.getOwnPropertyDescriptors,Oo=Object.getOwnPropertySymbols,Yi=Object.prototype.hasOwnProperty,Qi=Object.prototype.propertyIsEnumerable,$o=(k,M,y)=>M in k?Vi(k,M,{enumerable:!0,configurable:!0,writable:!0,value:y}):k[M]=y,U=(k,M)=>{for(var y in M||(M={}))Yi.call(M,y)&&$o(k,y,M[y]);if(Oo)for(var y of Oo(M))Qi.call(M,y)&&$o(k,y,M[y]);return k},Me=(k,M)=>Gi(k,Ji(M)),j=(k,M,y)=>new Promise((te,ne)=>{var be=P=>{try{r(y.next(P))}catch(H){ne(H)}},ke=P=>{try{r(y.throw(P))}catch(H){ne(H)}},r=P=>P.done?te(P.value):Promise.resolve(P.value).then(be,ke);r((y=y.apply(k,M)).next())});const Xi={key:0,class:"code-block-header flex justify-between items-center border-b px-[var(--ms-inset-panel-x)] py-[var(--ms-inset-panel-y)] border-[var(--code-border)] bg-[var(--code-header-bg)] text-[var(--code-fg)]"},Ki={class:"flex items-center gap-0.5"},Zi=["aria-label"],er={class:"code-diff-stat removed"},tr={class:"code-diff-stat added"},nr=["aria-label"],lr={key:0,xmlns:"http://www.w3.org/2000/svg","aria-hidden":"true",width:"1em",height:"1em",viewBox:"0 0 24 24",class:"action-icon"},or={key:1,xmlns:"http://www.w3.org/2000/svg","aria-hidden":"true",width:"1em",height:"1em",viewBox:"0 0 24 24",class:"action-icon"},ir=["aria-pressed"],rr={key:3,class:"relative"},ar=["aria-expanded"],ur=["disabled"],sr=["disabled"],dr=["disabled"],cr={key:0,xmlns:"http://www.w3.org/2000/svg","aria-hidden":"true",width:"1em",height:"1em",viewBox:"0 0 24 24",class:"action-icon"},fr={key:1,xmlns:"http://www.w3.org/2000/svg","aria-hidden":"true",width:"1em",height:"1em",viewBox:"0 0 24 24",class:"action-icon"},vr={class:"code-loading-placeholder"},mr={class:"sr-only","aria-live":"polite",role:"status"},pr=pl({__name:"CodeBlockShell",props:{showHeader:{type:Boolean,default:!0},showCollapseButton:{type:Boolean,default:!0},showFontSizeButtons:{type:Boolean,default:!0},enableFontSizeControl:{type:Boolean,default:!0},showCopyButton:{type:Boolean,default:!0},showExpandButton:{type:Boolean,default:!0},showPreviewButton:{type:Boolean,default:!0},showTooltips:{type:Boolean,default:!0},isDark:{type:Boolean,default:!1},loading:{type:Boolean,default:!1},stream:{type:Boolean,default:!1},isCollapsed:{type:Boolean,default:!1},isExpanded:{type:Boolean,default:!1},copyText:{type:Boolean,default:!1},isPreviewable:{type:Boolean,default:!1},codeFontSize:{},codeFontMin:{},codeFontMax:{},defaultCodeFontSize:{},fontBaselineReady:{type:Boolean,default:!1},diffStats:{},diffStatsAriaLabel:{}},emits:["toggleCollapse","decreaseFont","resetFont","increaseFont","copy","toggleExpand","preview"],setup(k,{emit:M}){const y=k,te=M,ne=$(!1),be=$(null),ke=$(null);function r(){mt(!0),ne.value=!ne.value,ne.value&&document.addEventListener("click",H,{once:!0,capture:!0})}function P(){mt(!0),ne.value=!1}function H(Q){var v,z;const wt=Q.target;(v=be.value)!=null&&v.contains(wt)||(z=ke.value)!=null&&z.contains(wt)?document.addEventListener("click",H,{once:!0,capture:!0}):P()}const re=b(()=>y.showFontSizeButtons&&y.enableFontSizeControl||y.showExpandButton||y.isPreviewable&&y.showPreviewButton),{t:T}=hl(),gt=b(()=>y.showTooltips!==!1);function Ge(Q,v){gt.value&&_i(Q.currentTarget,v,"top",!1,void 0,y.isDark)}function Ee(){gt.value&&mt()}function yt(Q){Ge(Q,y.copyText?T("common.copied")||"Copied":T("common.copy")||"Copy")}const gl=b(()=>{var Q,v;return!!Number.isFinite(y.codeFontSize)&&((Q=y.codeFontSize)!=null?Q:0)<=((v=y.codeFontMin)!=null?v:0)}),Jt=b(()=>!y.fontBaselineReady||y.codeFontSize===y.defaultCodeFontSize),Yt=b(()=>{var Q,v;return!!Number.isFinite(y.codeFontSize)&&((Q=y.codeFontSize)!=null?Q:0)>=((v=y.codeFontMax)!=null?v:100)});return(Q,v)=>(Y(),ie(Po,null,[y.showHeader?(Y(),ie("div",Xi,[ht(Q.$slots,"header-left"),ht(Q.$slots,"header-right",{},()=>[w("div",Ki,[k.diffStats?(Y(),ie("div",{key:0,class:"code-diff-stats","aria-label":k.diffStatsAriaLabel},[w("span",er,"-"+Be(k.diffStats.removed),1),w("span",tr,"+"+Be(k.diffStats.added),1)],8,Zi)):we("",!0),y.showCopyButton?(Y(),ie("button",{key:1,type:"button",class:"code-action-btn inline-flex items-center justify-center p-[var(--ms-action-btn-padding)] rounded leading-none shrink-0 cursor-pointer text-[var(--code-action-fg)] hover:bg-[var(--code-action-hover-bg)] hover:text-[var(--code-action-hover-fg)] active:scale-[0.96] disabled:opacity-40 disabled:cursor-not-allowed transition-colors","aria-label":k.copyText?J(T)("common.copied")||"Copied":J(T)("common.copy")||"Copy",onClick:v[0]||(v[0]=z=>te("copy")),onMouseenter:v[1]||(v[1]=z=>yt(z)),onFocus:v[2]||(v[2]=z=>yt(z)),onMouseleave:Ee,onBlur:Ee},[k.copyText?(Y(),ie("svg",or,[...v[14]||(v[14]=[w("path",{fill:"none",stroke:"currentColor","stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"2",d:"M20 6L9 17l-5-5"},null,-1)])])):(Y(),ie("svg",lr,[...v[13]||(v[13]=[w("g",{fill:"none",stroke:"currentColor","stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"2"},[w("rect",{width:"14",height:"14",x:"8",y:"8",rx:"2",ry:"2"}),w("path",{d:"M4 16c-1.1 0-2-.9-2-2V4c0-1.1.9-2 2-2h10c1.1 0 2 .9 2 2"})],-1)])]))],40,nr)):we("",!0),y.showCollapseButton?(Y(),ie("button",{key:2,type:"button",class:"code-action-btn inline-flex items-center justify-center p-[var(--ms-action-btn-padding)] rounded leading-none shrink-0 cursor-pointer text-[var(--code-action-fg)] hover:bg-[var(--code-action-hover-bg)] hover:text-[var(--code-action-hover-fg)] active:scale-[0.96] disabled:opacity-40 disabled:cursor-not-allowed transition-colors","aria-pressed":k.isCollapsed,onClick:v[3]||(v[3]=z=>te("toggleCollapse")),onMouseenter:v[4]||(v[4]=z=>Ge(z,k.isCollapsed?J(T)("common.expand")||"Expand":J(T)("common.collapse")||"Collapse")),onFocus:v[5]||(v[5]=z=>Ge(z,k.isCollapsed?J(T)("common.expand")||"Expand":J(T)("common.collapse")||"Collapse")),onMouseleave:Ee,onBlur:Ee},[(Y(),ie("svg",{style:Vt({rotate:k.isCollapsed?"0deg":"90deg"}),xmlns:"http://www.w3.org/2000/svg","aria-hidden":"true",width:"1em",height:"1em",viewBox:"0 0 24 24",class:"action-icon"},[...v[15]||(v[15]=[w("path",{fill:"none",stroke:"currentColor","stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"2",d:"m9 18l6-6l-6-6"},null,-1)])],4))],40,ir)):we("",!0),re.value?(Y(),ie("div",rr,[w("button",{ref_key:"moreBtnRef",ref:ke,type:"button",class:"code-action-btn inline-flex items-center justify-center p-[var(--ms-action-btn-padding)] rounded leading-none shrink-0 cursor-pointer text-[var(--code-action-fg)] hover:bg-[var(--code-action-hover-bg)] hover:text-[var(--code-action-hover-fg)] active:scale-[0.96] transition-colors","aria-expanded":ne.value,"aria-haspopup":"true",onClick:Do(r,["stop"]),onMouseenter:v[6]||(v[6]=z=>Ge(z,J(T)("common.more")||"More")),onFocus:v[7]||(v[7]=z=>Ge(z,J(T)("common.more")||"More")),onMouseleave:Ee,onBlur:Ee},[...v[16]||(v[16]=[qi('<svg xmlns="http://www.w3.org/2000/svg" aria-hidden="true" width="1em" height="1em" viewBox="0 0 24 24" class="action-icon"><g fill="currentColor"><circle cx="12" cy="5" r="1.5"></circle><circle cx="12" cy="12" r="1.5"></circle><circle cx="12" cy="19" r="1.5"></circle></g></svg>',1)])],40,ar),Ro(Wi,{name:"code-menu"},{default:Gt(()=>[ne.value?(Y(),ie("div",{key:0,ref_key:"moreMenuRef",ref:be,class:"code-more-menu min-w-[10rem] p-1 bg-[hsl(var(--ms-popover))] text-[hsl(var(--ms-popover-foreground))] border border-[var(--code-border)] shadow-[var(--ms-shadow-popover)]",role:"menu"},[y.showFontSizeButtons&&y.enableFontSizeControl?(Y(),ie(Po,{key:0},[w("button",{type:"button",role:"menuitem",class:"flex items-center gap-2 w-full py-1.5 px-2 rounded text-xs text-[var(--code-action-fg)] cursor-pointer whitespace-nowrap hover:bg-[var(--code-action-hover-bg)] hover:text-[var(--code-action-hover-fg)] disabled:opacity-40 disabled:cursor-not-allowed transition-colors",disabled:gl.value,onClick:v[8]||(v[8]=z=>{J(mt)(!0),te("decreaseFont")})},[v[17]||(v[17]=w("svg",{xmlns:"http://www.w3.org/2000/svg","aria-hidden":"true",width:"1em",height:"1em",viewBox:"0 0 24 24",class:"action-icon"},[w("path",{fill:"none",stroke:"currentColor","stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"2",d:"M5 12h14"})],-1)),w("span",null,Be(J(T)("common.fontSmaller")||"Font size −"),1)],8,ur),w("button",{type:"button",role:"menuitem",class:"flex items-center gap-2 w-full py-1.5 px-2 rounded text-xs text-[var(--code-action-fg)] cursor-pointer whitespace-nowrap hover:bg-[var(--code-action-hover-bg)] hover:text-[var(--code-action-hover-fg)] disabled:opacity-40 disabled:cursor-not-allowed transition-colors",disabled:Jt.value,onClick:v[9]||(v[9]=z=>{J(mt)(!0),te("resetFont")})},[v[18]||(v[18]=w("svg",{xmlns:"http://www.w3.org/2000/svg","aria-hidden":"true",width:"1em",height:"1em",viewBox:"0 0 24 24",class:"action-icon"},[w("g",{fill:"none",stroke:"currentColor","stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"2"},[w("path",{d:"M3 12a9 9 0 1 0 9-9a9.75 9.75 0 0 0-6.74 2.74L3 8"}),w("path",{d:"M3 3v5h5"})])],-1)),w("span",null,Be(J(T)("common.fontReset")||"Font size reset"),1)],8,sr),w("button",{type:"button",role:"menuitem",class:"flex items-center gap-2 w-full py-1.5 px-2 rounded text-xs text-[var(--code-action-fg)] cursor-pointer whitespace-nowrap hover:bg-[var(--code-action-hover-bg)] hover:text-[var(--code-action-hover-fg)] disabled:opacity-40 disabled:cursor-not-allowed transition-colors",disabled:Yt.value,onClick:v[10]||(v[10]=z=>{J(mt)(!0),te("increaseFont")})},[v[19]||(v[19]=w("svg",{xmlns:"http://www.w3.org/2000/svg","aria-hidden":"true",width:"1em",height:"1em",viewBox:"0 0 24 24",class:"action-icon"},[w("path",{fill:"none",stroke:"currentColor","stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"2",d:"M5 12h14m-7-7v14"})],-1)),w("span",null,Be(J(T)("common.fontLarger")||"Font size +"),1)],8,dr)],64)):we("",!0),y.showExpandButton?(Y(),ie("button",{key:1,type:"button",role:"menuitem",class:"flex items-center gap-2 w-full py-1.5 px-2 rounded text-xs text-[var(--code-action-fg)] cursor-pointer whitespace-nowrap hover:bg-[var(--code-action-hover-bg)] hover:text-[var(--code-action-hover-fg)] transition-colors",onClick:v[11]||(v[11]=z=>{P(),te("toggleExpand")})},[k.isExpanded?(Y(),ie("svg",cr,[...v[20]||(v[20]=[w("path",{fill:"none",stroke:"currentColor","stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"2",d:"m14 10l7-7m-1 7h-6V4M3 21l7-7m-6 0h6v6"},null,-1)])])):(Y(),ie("svg",fr,[...v[21]||(v[21]=[w("path",{fill:"none",stroke:"currentColor","stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"2",d:"M15 3h6v6m0-6l-7 7M3 21l7-7m-1 7H3v-6"},null,-1)])])),w("span",null,Be(k.isExpanded?J(T)("common.collapse")||"Collapse":J(T)("common.expand")||"Expand"),1)])):we("",!0),k.isPreviewable&&y.showPreviewButton?(Y(),ie("button",{key:2,type:"button",role:"menuitem",class:"flex items-center gap-2 w-full py-1.5 px-2 rounded text-xs text-[var(--code-action-fg)] cursor-pointer whitespace-nowrap hover:bg-[var(--code-action-hover-bg)] hover:text-[var(--code-action-hover-fg)] transition-colors",onClick:v[12]||(v[12]=z=>{P(),te("preview")})},[v[22]||(v[22]=w("svg",{xmlns:"http://www.w3.org/2000/svg","aria-hidden":"true",width:"1em",height:"1em",viewBox:"0 0 24 24",class:"action-icon"},[w("g",{fill:"none",stroke:"currentColor","stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"2"},[w("path",{d:"M2.062 12.348a1 1 0 0 1 0-.696a10.75 10.75 0 0 1 19.876 0a1 1 0 0 1 0 .696a10.75 10.75 0 0 1-19.876 0"}),w("circle",{cx:"12",cy:"12",r:"3"})])],-1)),w("span",null,Be(J(T)("common.preview")||"Preview"),1)])):we("",!0)],512)):we("",!0)]),_:1})])):we("",!0)])])])):we("",!0),vl(w("div",{class:pt(["code-block-shell-content",{"code-block-shell-content--collapsed":k.isCollapsed}])},[ht(Q.$slots,"default")],2),[[ml,!!k.stream||!k.loading]]),vl(w("div",vr,[ht(Q.$slots,"loading",{},()=>[v[23]||(v[23]=w("div",{class:"loading-skeleton"},[w("div",{class:"skeleton-line"}),w("div",{class:"skeleton-line"}),w("div",{class:"skeleton-line short"})],-1))])],512),[[ml,!k.stream&&k.loading]]),w("span",mr,Be(k.copyText?J(T)("common.copied")||"Copied":""),1)],64))}}),hr={class:"html-preview-frame__header"},gr={class:"html-preview-frame__title"},yr={class:"html-preview-frame__label"},wr=["sandbox","srcdoc"],br=Ho(pl({__name:"HtmlPreviewFrame",props:{code:{},isDark:{type:Boolean},htmlPreviewAllowScripts:{type:Boolean},htmlPreviewSandbox:{},onClose:{type:Function},title:{}},setup(k){const M=k,y=import.meta!==void 0&&!1;let te=null;const{t:ne}=hl(),be=b(()=>{const P=M.code||"",H=P.trim().toLowerCase();return H.startsWith("<!doctype")||H.startsWith("<html")||H.startsWith("<body")?P:`<!doctype html>
|
|
1
|
+
const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/index-Dq61ZbBp.js","assets/index-CvgiEu-R.js","assets/index-BxiMZi52.css"])))=>i.map(i=>d[i]);
|
|
2
|
+
import{bR as xi,cb as Si,bQ as Ho,M as pl,bl as Ci,af as fl,bY as Mi,cc as Bi,b$ as hl,aU as $,c0 as Ei,c1 as Fi,c2 as Pi,a0 as Mo,aD as No,bE as ue,az as Li,cd as wn,c8 as mt,aI as To,aL as Y,s as Sn,aw as Vt,au as pt,bk as J,ce as Bo,u as ie,I as Ro,A as Oi,bJ as Gt,aY as ht,bL as vl,v as w,t as we,bB as ml,bb as Be,q as b,b7 as $i,cf as zi,cg as bn,ch as Hi,ci as Ni,cj as Ti,ck as Ri,as as A,cl as Eo,cm as Di,cn as Ai,co as Wt,cp as Fo,bO as Do,T as ji,G as qi,F as Po,g as Wi,c7 as _i,b_ as Ii}from"./index-CvgiEu-R.js";import{i as fe,t as kn}from"./safeRaf-DGuzXxDK.js";var xn=(k,M,y)=>new Promise((te,ne)=>{var be=P=>{try{r(y.next(P))}catch(H){ne(H)}},ke=P=>{try{r(y.throw(P))}catch(H){ne(H)}},r=P=>P.done?te(P.value):Promise.resolve(P.value).then(be,ke);r((y=y.apply(k,M)).next())});let Lo=!1,_t=null,It=null,Ut=null;function Ui(){return xn(this,null,function*(){if(Ut)return Ut;Ut=xn(null,null,function*(){if(!It)try{if(It=(function(k){const M=k;if(typeof M?.useMonaco=="function")return M;const y=k?.default;return typeof y?.useMonaco=="function"?y:null})(yield xi(()=>import("./index-Dq61ZbBp.js"),__vite__mapDeps([0,1,2]))),!It)return null}catch{return null}try{return yield(function(k){return xn(this,null,function*(){return Lo?void 0:_t||(_t=xn(null,null,function*(){const y=globalThis?.MonacoEnvironment;y&&(typeof y.getWorker=="function"||typeof y.getWorkerUrl=="function")||typeof k?.preloadMonacoWorkers!="function"||(yield k.preloadMonacoWorkers()),Lo=!0}).finally(()=>{_t=null}),_t)})})(It),Si(),It}catch{return null}});try{return yield Ut}finally{Ut=null}})}var Vi=Object.defineProperty,Gi=Object.defineProperties,Ji=Object.getOwnPropertyDescriptors,Oo=Object.getOwnPropertySymbols,Yi=Object.prototype.hasOwnProperty,Qi=Object.prototype.propertyIsEnumerable,$o=(k,M,y)=>M in k?Vi(k,M,{enumerable:!0,configurable:!0,writable:!0,value:y}):k[M]=y,U=(k,M)=>{for(var y in M||(M={}))Yi.call(M,y)&&$o(k,y,M[y]);if(Oo)for(var y of Oo(M))Qi.call(M,y)&&$o(k,y,M[y]);return k},Me=(k,M)=>Gi(k,Ji(M)),j=(k,M,y)=>new Promise((te,ne)=>{var be=P=>{try{r(y.next(P))}catch(H){ne(H)}},ke=P=>{try{r(y.throw(P))}catch(H){ne(H)}},r=P=>P.done?te(P.value):Promise.resolve(P.value).then(be,ke);r((y=y.apply(k,M)).next())});const Xi={key:0,class:"code-block-header flex justify-between items-center border-b px-[var(--ms-inset-panel-x)] py-[var(--ms-inset-panel-y)] border-[var(--code-border)] bg-[var(--code-header-bg)] text-[var(--code-fg)]"},Ki={class:"flex items-center gap-0.5"},Zi=["aria-label"],er={class:"code-diff-stat removed"},tr={class:"code-diff-stat added"},nr=["aria-label"],lr={key:0,xmlns:"http://www.w3.org/2000/svg","aria-hidden":"true",width:"1em",height:"1em",viewBox:"0 0 24 24",class:"action-icon"},or={key:1,xmlns:"http://www.w3.org/2000/svg","aria-hidden":"true",width:"1em",height:"1em",viewBox:"0 0 24 24",class:"action-icon"},ir=["aria-pressed"],rr={key:3,class:"relative"},ar=["aria-expanded"],ur=["disabled"],sr=["disabled"],dr=["disabled"],cr={key:0,xmlns:"http://www.w3.org/2000/svg","aria-hidden":"true",width:"1em",height:"1em",viewBox:"0 0 24 24",class:"action-icon"},fr={key:1,xmlns:"http://www.w3.org/2000/svg","aria-hidden":"true",width:"1em",height:"1em",viewBox:"0 0 24 24",class:"action-icon"},vr={class:"code-loading-placeholder"},mr={class:"sr-only","aria-live":"polite",role:"status"},pr=pl({__name:"CodeBlockShell",props:{showHeader:{type:Boolean,default:!0},showCollapseButton:{type:Boolean,default:!0},showFontSizeButtons:{type:Boolean,default:!0},enableFontSizeControl:{type:Boolean,default:!0},showCopyButton:{type:Boolean,default:!0},showExpandButton:{type:Boolean,default:!0},showPreviewButton:{type:Boolean,default:!0},showTooltips:{type:Boolean,default:!0},isDark:{type:Boolean,default:!1},loading:{type:Boolean,default:!1},stream:{type:Boolean,default:!1},isCollapsed:{type:Boolean,default:!1},isExpanded:{type:Boolean,default:!1},copyText:{type:Boolean,default:!1},isPreviewable:{type:Boolean,default:!1},codeFontSize:{},codeFontMin:{},codeFontMax:{},defaultCodeFontSize:{},fontBaselineReady:{type:Boolean,default:!1},diffStats:{},diffStatsAriaLabel:{}},emits:["toggleCollapse","decreaseFont","resetFont","increaseFont","copy","toggleExpand","preview"],setup(k,{emit:M}){const y=k,te=M,ne=$(!1),be=$(null),ke=$(null);function r(){mt(!0),ne.value=!ne.value,ne.value&&document.addEventListener("click",H,{once:!0,capture:!0})}function P(){mt(!0),ne.value=!1}function H(Q){var v,z;const wt=Q.target;(v=be.value)!=null&&v.contains(wt)||(z=ke.value)!=null&&z.contains(wt)?document.addEventListener("click",H,{once:!0,capture:!0}):P()}const re=b(()=>y.showFontSizeButtons&&y.enableFontSizeControl||y.showExpandButton||y.isPreviewable&&y.showPreviewButton),{t:T}=hl(),gt=b(()=>y.showTooltips!==!1);function Ge(Q,v){gt.value&&_i(Q.currentTarget,v,"top",!1,void 0,y.isDark)}function Ee(){gt.value&&mt()}function yt(Q){Ge(Q,y.copyText?T("common.copied")||"Copied":T("common.copy")||"Copy")}const gl=b(()=>{var Q,v;return!!Number.isFinite(y.codeFontSize)&&((Q=y.codeFontSize)!=null?Q:0)<=((v=y.codeFontMin)!=null?v:0)}),Jt=b(()=>!y.fontBaselineReady||y.codeFontSize===y.defaultCodeFontSize),Yt=b(()=>{var Q,v;return!!Number.isFinite(y.codeFontSize)&&((Q=y.codeFontSize)!=null?Q:0)>=((v=y.codeFontMax)!=null?v:100)});return(Q,v)=>(Y(),ie(Po,null,[y.showHeader?(Y(),ie("div",Xi,[ht(Q.$slots,"header-left"),ht(Q.$slots,"header-right",{},()=>[w("div",Ki,[k.diffStats?(Y(),ie("div",{key:0,class:"code-diff-stats","aria-label":k.diffStatsAriaLabel},[w("span",er,"-"+Be(k.diffStats.removed),1),w("span",tr,"+"+Be(k.diffStats.added),1)],8,Zi)):we("",!0),y.showCopyButton?(Y(),ie("button",{key:1,type:"button",class:"code-action-btn inline-flex items-center justify-center p-[var(--ms-action-btn-padding)] rounded leading-none shrink-0 cursor-pointer text-[var(--code-action-fg)] hover:bg-[var(--code-action-hover-bg)] hover:text-[var(--code-action-hover-fg)] active:scale-[0.96] disabled:opacity-40 disabled:cursor-not-allowed transition-colors","aria-label":k.copyText?J(T)("common.copied")||"Copied":J(T)("common.copy")||"Copy",onClick:v[0]||(v[0]=z=>te("copy")),onMouseenter:v[1]||(v[1]=z=>yt(z)),onFocus:v[2]||(v[2]=z=>yt(z)),onMouseleave:Ee,onBlur:Ee},[k.copyText?(Y(),ie("svg",or,[...v[14]||(v[14]=[w("path",{fill:"none",stroke:"currentColor","stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"2",d:"M20 6L9 17l-5-5"},null,-1)])])):(Y(),ie("svg",lr,[...v[13]||(v[13]=[w("g",{fill:"none",stroke:"currentColor","stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"2"},[w("rect",{width:"14",height:"14",x:"8",y:"8",rx:"2",ry:"2"}),w("path",{d:"M4 16c-1.1 0-2-.9-2-2V4c0-1.1.9-2 2-2h10c1.1 0 2 .9 2 2"})],-1)])]))],40,nr)):we("",!0),y.showCollapseButton?(Y(),ie("button",{key:2,type:"button",class:"code-action-btn inline-flex items-center justify-center p-[var(--ms-action-btn-padding)] rounded leading-none shrink-0 cursor-pointer text-[var(--code-action-fg)] hover:bg-[var(--code-action-hover-bg)] hover:text-[var(--code-action-hover-fg)] active:scale-[0.96] disabled:opacity-40 disabled:cursor-not-allowed transition-colors","aria-pressed":k.isCollapsed,onClick:v[3]||(v[3]=z=>te("toggleCollapse")),onMouseenter:v[4]||(v[4]=z=>Ge(z,k.isCollapsed?J(T)("common.expand")||"Expand":J(T)("common.collapse")||"Collapse")),onFocus:v[5]||(v[5]=z=>Ge(z,k.isCollapsed?J(T)("common.expand")||"Expand":J(T)("common.collapse")||"Collapse")),onMouseleave:Ee,onBlur:Ee},[(Y(),ie("svg",{style:Vt({rotate:k.isCollapsed?"0deg":"90deg"}),xmlns:"http://www.w3.org/2000/svg","aria-hidden":"true",width:"1em",height:"1em",viewBox:"0 0 24 24",class:"action-icon"},[...v[15]||(v[15]=[w("path",{fill:"none",stroke:"currentColor","stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"2",d:"m9 18l6-6l-6-6"},null,-1)])],4))],40,ir)):we("",!0),re.value?(Y(),ie("div",rr,[w("button",{ref_key:"moreBtnRef",ref:ke,type:"button",class:"code-action-btn inline-flex items-center justify-center p-[var(--ms-action-btn-padding)] rounded leading-none shrink-0 cursor-pointer text-[var(--code-action-fg)] hover:bg-[var(--code-action-hover-bg)] hover:text-[var(--code-action-hover-fg)] active:scale-[0.96] transition-colors","aria-expanded":ne.value,"aria-haspopup":"true",onClick:Do(r,["stop"]),onMouseenter:v[6]||(v[6]=z=>Ge(z,J(T)("common.more")||"More")),onFocus:v[7]||(v[7]=z=>Ge(z,J(T)("common.more")||"More")),onMouseleave:Ee,onBlur:Ee},[...v[16]||(v[16]=[qi('<svg xmlns="http://www.w3.org/2000/svg" aria-hidden="true" width="1em" height="1em" viewBox="0 0 24 24" class="action-icon"><g fill="currentColor"><circle cx="12" cy="5" r="1.5"></circle><circle cx="12" cy="12" r="1.5"></circle><circle cx="12" cy="19" r="1.5"></circle></g></svg>',1)])],40,ar),Ro(Wi,{name:"code-menu"},{default:Gt(()=>[ne.value?(Y(),ie("div",{key:0,ref_key:"moreMenuRef",ref:be,class:"code-more-menu min-w-[10rem] p-1 bg-[hsl(var(--ms-popover))] text-[hsl(var(--ms-popover-foreground))] border border-[var(--code-border)] shadow-[var(--ms-shadow-popover)]",role:"menu"},[y.showFontSizeButtons&&y.enableFontSizeControl?(Y(),ie(Po,{key:0},[w("button",{type:"button",role:"menuitem",class:"flex items-center gap-2 w-full py-1.5 px-2 rounded text-xs text-[var(--code-action-fg)] cursor-pointer whitespace-nowrap hover:bg-[var(--code-action-hover-bg)] hover:text-[var(--code-action-hover-fg)] disabled:opacity-40 disabled:cursor-not-allowed transition-colors",disabled:gl.value,onClick:v[8]||(v[8]=z=>{J(mt)(!0),te("decreaseFont")})},[v[17]||(v[17]=w("svg",{xmlns:"http://www.w3.org/2000/svg","aria-hidden":"true",width:"1em",height:"1em",viewBox:"0 0 24 24",class:"action-icon"},[w("path",{fill:"none",stroke:"currentColor","stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"2",d:"M5 12h14"})],-1)),w("span",null,Be(J(T)("common.fontSmaller")||"Font size −"),1)],8,ur),w("button",{type:"button",role:"menuitem",class:"flex items-center gap-2 w-full py-1.5 px-2 rounded text-xs text-[var(--code-action-fg)] cursor-pointer whitespace-nowrap hover:bg-[var(--code-action-hover-bg)] hover:text-[var(--code-action-hover-fg)] disabled:opacity-40 disabled:cursor-not-allowed transition-colors",disabled:Jt.value,onClick:v[9]||(v[9]=z=>{J(mt)(!0),te("resetFont")})},[v[18]||(v[18]=w("svg",{xmlns:"http://www.w3.org/2000/svg","aria-hidden":"true",width:"1em",height:"1em",viewBox:"0 0 24 24",class:"action-icon"},[w("g",{fill:"none",stroke:"currentColor","stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"2"},[w("path",{d:"M3 12a9 9 0 1 0 9-9a9.75 9.75 0 0 0-6.74 2.74L3 8"}),w("path",{d:"M3 3v5h5"})])],-1)),w("span",null,Be(J(T)("common.fontReset")||"Font size reset"),1)],8,sr),w("button",{type:"button",role:"menuitem",class:"flex items-center gap-2 w-full py-1.5 px-2 rounded text-xs text-[var(--code-action-fg)] cursor-pointer whitespace-nowrap hover:bg-[var(--code-action-hover-bg)] hover:text-[var(--code-action-hover-fg)] disabled:opacity-40 disabled:cursor-not-allowed transition-colors",disabled:Yt.value,onClick:v[10]||(v[10]=z=>{J(mt)(!0),te("increaseFont")})},[v[19]||(v[19]=w("svg",{xmlns:"http://www.w3.org/2000/svg","aria-hidden":"true",width:"1em",height:"1em",viewBox:"0 0 24 24",class:"action-icon"},[w("path",{fill:"none",stroke:"currentColor","stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"2",d:"M5 12h14m-7-7v14"})],-1)),w("span",null,Be(J(T)("common.fontLarger")||"Font size +"),1)],8,dr)],64)):we("",!0),y.showExpandButton?(Y(),ie("button",{key:1,type:"button",role:"menuitem",class:"flex items-center gap-2 w-full py-1.5 px-2 rounded text-xs text-[var(--code-action-fg)] cursor-pointer whitespace-nowrap hover:bg-[var(--code-action-hover-bg)] hover:text-[var(--code-action-hover-fg)] transition-colors",onClick:v[11]||(v[11]=z=>{P(),te("toggleExpand")})},[k.isExpanded?(Y(),ie("svg",cr,[...v[20]||(v[20]=[w("path",{fill:"none",stroke:"currentColor","stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"2",d:"m14 10l7-7m-1 7h-6V4M3 21l7-7m-6 0h6v6"},null,-1)])])):(Y(),ie("svg",fr,[...v[21]||(v[21]=[w("path",{fill:"none",stroke:"currentColor","stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"2",d:"M15 3h6v6m0-6l-7 7M3 21l7-7m-1 7H3v-6"},null,-1)])])),w("span",null,Be(k.isExpanded?J(T)("common.collapse")||"Collapse":J(T)("common.expand")||"Expand"),1)])):we("",!0),k.isPreviewable&&y.showPreviewButton?(Y(),ie("button",{key:2,type:"button",role:"menuitem",class:"flex items-center gap-2 w-full py-1.5 px-2 rounded text-xs text-[var(--code-action-fg)] cursor-pointer whitespace-nowrap hover:bg-[var(--code-action-hover-bg)] hover:text-[var(--code-action-hover-fg)] transition-colors",onClick:v[12]||(v[12]=z=>{P(),te("preview")})},[v[22]||(v[22]=w("svg",{xmlns:"http://www.w3.org/2000/svg","aria-hidden":"true",width:"1em",height:"1em",viewBox:"0 0 24 24",class:"action-icon"},[w("g",{fill:"none",stroke:"currentColor","stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"2"},[w("path",{d:"M2.062 12.348a1 1 0 0 1 0-.696a10.75 10.75 0 0 1 19.876 0a1 1 0 0 1 0 .696a10.75 10.75 0 0 1-19.876 0"}),w("circle",{cx:"12",cy:"12",r:"3"})])],-1)),w("span",null,Be(J(T)("common.preview")||"Preview"),1)])):we("",!0)],512)):we("",!0)]),_:1})])):we("",!0)])])])):we("",!0),vl(w("div",{class:pt(["code-block-shell-content",{"code-block-shell-content--collapsed":k.isCollapsed}])},[ht(Q.$slots,"default")],2),[[ml,!!k.stream||!k.loading]]),vl(w("div",vr,[ht(Q.$slots,"loading",{},()=>[v[23]||(v[23]=w("div",{class:"loading-skeleton"},[w("div",{class:"skeleton-line"}),w("div",{class:"skeleton-line"}),w("div",{class:"skeleton-line short"})],-1))])],512),[[ml,!k.stream&&k.loading]]),w("span",mr,Be(k.copyText?J(T)("common.copied")||"Copied":""),1)],64))}}),hr={class:"html-preview-frame__header"},gr={class:"html-preview-frame__title"},yr={class:"html-preview-frame__label"},wr=["sandbox","srcdoc"],br=Ho(pl({__name:"HtmlPreviewFrame",props:{code:{},isDark:{type:Boolean},htmlPreviewAllowScripts:{type:Boolean},htmlPreviewSandbox:{},onClose:{type:Function},title:{}},setup(k){const M=k,y=import.meta!==void 0&&!1;let te=null;const{t:ne}=hl(),be=b(()=>{const P=M.code||"",H=P.trim().toLowerCase();return H.startsWith("<!doctype")||H.startsWith("<html")||H.startsWith("<body")?P:`<!doctype html>
|
|
3
3
|
<html lang="en">
|
|
4
4
|
<head>
|
|
5
5
|
<meta charset="utf-8" />
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{bQ as A,M as H,aU as b,bE as V,az as J,aL as O,s as Q,v as R,I as F,bJ as G,bL as K,aw as L,H as W,bb as Z,bB as ee,g as te,au as le,T as ae,as as B,bR as ne}from"./index-
|
|
1
|
+
import{bQ as A,M as H,aU as b,bE as V,az as J,aL as O,s as Q,v as R,I as F,bJ as G,bL as K,aw as L,H as W,bb as Z,bB as ee,g as te,au as le,T as ae,as as B,bR as ne}from"./index-CvgiEu-R.js";var k=(h,E,e)=>new Promise((o,p)=>{var i=a=>{try{d(e.next(a))}catch(c){p(c)}},y=a=>{try{d(e.throw(a))}catch(c){p(c)}},d=a=>a.done?o(a.value):Promise.resolve(a.value).then(i,y);d((e=e.apply(h,E)).next())});const oe=["id"],ie=["data-placement"],ue=A(H({__name:"Tooltip",props:{visible:{type:Boolean},anchorEl:{},content:{},placement:{},offset:{},originX:{},originY:{},id:{},isDark:{type:[Boolean,null]}},setup(h){var E;const e=h,o=b(null),p=b(null),i=b({transform:"translate3d(0px, 0px, 0px)",left:"0px",top:"0px"}),y=b({}),d=b((E=e.placement)!=null?E:"top"),a=b(!1);let c=null,$=null,T=null,C=null,w=null,s=0;function X(){return C?Promise.resolve(C):(w||(w=ne(()=>import("./floating-ui.dom-xGUaHE3m.js"),[]).then(l=>(C=l,l)).catch(l=>{throw w=null,l})),w)}function D(){c&&(c(),c=null),$=null,T=null}function P(l){return k(this,null,function*(){const t=e.anchorEl,n=o.value;if(!e.visible||!t||!n||$===t&&T===n)return;const{autoUpdate:r}=yield X();l()&&e.visible&&e.anchorEl===t&&o.value===n&&(D(),$=t,T=n,c=r(t,n,()=>{N().catch(()=>{_()})}))})}function N(){return k(this,null,function*(){var l,t;const n=e.anchorEl,r=o.value;if(!e.visible||!n||!r)return!1;const{arrow:u,computePosition:m,flip:v,offset:f,shift:x}=yield X();if(!e.visible||e.anchorEl!==n||o.value!==r)return!1;const g=[f((l=e.offset)!=null?l:6),v(),x({padding:6}),...p.value?[u({element:p.value,padding:4})]:[]],{x:S,y:j,placement:Y,middlewareData:z}=yield m(n,r,{placement:(t=e.placement)!=null?t:"top",middleware:g,strategy:"fixed"});if(!e.visible||e.anchorEl!==n||o.value!==r)return!1;if(i.value.transform=`translate3d(${Math.round(S)}px, ${Math.round(j)}px, 0)`,i.value.left="0px",i.value.top="0px",d.value=Y,z.arrow&&p.value){const{x:I,y:U}=z.arrow,q={top:"bottom",bottom:"top",left:"right",right:"left"}[Y.split("-")[0]];y.value={left:I!=null?`${I}px`:"",top:U!=null?`${U}px`:"",[q]:"-3px"}}return!0})}function _(){var l,t;const n=e.anchorEl,r=o.value;if(!n||!r)return!1;const u=n.getBoundingClientRect(),m=r.getBoundingClientRect(),v=(l=e.offset)!=null?l:6,f=(t=e.placement)!=null?t:"top";let x=u.left,g=u.top;return f==="bottom"?g=u.bottom+v:f==="left"?x=u.left-m.width-v:f==="right"?x=u.right+v:g=u.top-m.height-v,i.value.transform=`translate3d(${Math.round(Math.max(0,x))}px, ${Math.round(Math.max(0,g))}px, 0)`,i.value.left="0px",i.value.top="0px",d.value=f,y.value={},!0}V(()=>e.visible,l=>k(null,null,function*(){const t=++s;if(l){if(a.value=!1,yield B(),t!==s||!e.visible)return;if(e.anchorEl&&o.value)try{const n=e.anchorEl,r=o.value,u=n.getBoundingClientRect();if(!(yield N())||t!==s||!e.visible||e.anchorEl!==n||o.value!==r)return;const m=i.value.transform;if(e.originX!=null&&e.originY!=null){const v=Math.abs(Number(e.originX)-u.left),f=Math.abs(Number(e.originY)-u.top);if(Math.hypot(v,f)>120){if(i.value.transform=`translate3d(${Math.round(e.originX)}px, ${Math.round(e.originY)}px, 0)`,yield B(),t!==s||!e.visible||(a.value=!0,yield B(),t!==s||!e.visible))return;i.value.transform=m}else a.value=!0}else a.value=!0;yield P(()=>t===s)}catch{if(t!==s||!e.visible)return;if(a.value=_(),e.anchorEl&&o.value)try{yield P(()=>t===s)}catch{}}else a.value=!0}else a.value=!1,D()}));let M=0;return V([()=>e.anchorEl,()=>e.placement,()=>e.content],()=>k(null,null,function*(){const l=++M;if(e.visible&&e.anchorEl&&o.value){if(yield B(),l!==M||!e.visible||!e.anchorEl||!o.value)return;try{const t=yield N();if(l!==M||!e.visible||!e.anchorEl||!o.value)return;t||_()}catch{_()}yield P(()=>l===M)}})),J(()=>{s+=1,D()}),(l,t)=>(O(),Q(ae,{to:"body"},[R("div",{class:le(["markstream-vue",{dark:h.isDark}])},[F(te,{name:"tooltip",appear:""},{default:G(()=>[K(R("div",{id:e.id,ref_key:"tooltip",ref:o,style:L({position:"fixed",left:i.value.left,top:i.value.top,transform:i.value.transform,visibility:a.value?"visible":"hidden",pointerEvents:a.value?void 0:"none"}),class:"tooltip-element",role:"tooltip"},[W(Z(h.content)+" ",1),R("div",{ref_key:"arrowEl",ref:p,class:"tooltip-arrow","data-placement":d.value,style:L(y.value)},null,12,ie)],12,oe),[[ee,h.visible]])]),_:1})],2)]))}}),[["__scopeId","data-v-c606ee4c"]]);export{ue as default};
|
package/dist-web/assets/{abnfDiagram-VRR7QNED-BN8tpheJ.js → abnfDiagram-VRR7QNED-DZ5l2NNF.js}
RENAMED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{g as p,r as u,d as a}from"./chunk-MOJQB5TN-
|
|
1
|
+
import{g as p,r as u,d as a}from"./chunk-MOJQB5TN-BWiH3s-c.js";import{p as f}from"./chunk-JWPE2WC7-CnsTQcA8.js";import{_ as n,l as o}from"./mermaid.core-CGrLstUA.js";import{M as c,b as d}from"./cynefin-VYW2F7L2-Ct8il_Gb.js";import"./index-CvgiEu-R.js";import"./_commonjsHelpers-CqkleIqs.js";var v=d().RailroadAbnf.parser.LangiumParser,i=n(e=>{const r=e.alternatives.map(g);return r.length===1?r[0]:{type:"choice",alternatives:r}},"transformAlternation"),g=n(e=>{const r=e.elements.map(y);return r.length===1?r[0]:{type:"sequence",elements:r}},"transformConcatenation"),b=n(e=>{if(e.includes("*")){const[t,s]=e.split("*"),l=t?parseInt(t,10):0,m=s?parseInt(s,10):1/0;return{min:l,max:m}}const r=parseInt(e,10);return{min:r,max:r}},"parseRepeat"),y=n(e=>{const r=A(e.primary);if(!e.repeat)return r;const{min:t,max:s}=b(e.repeat);return t===0&&s===1?{type:"optional",element:r}:{type:"repetition",element:r,min:t,max:s}},"transformElement"),A=n(e=>{switch(e.$type){case"AbnfStringLiteral":return{type:"terminal",value:e.value};case"AbnfNumVal":return{type:"terminal",value:e.value};case"AbnfRuleName":return{type:"nonterminal",name:e.name};case"AbnfGroup":return i(e.element);case"AbnfOptionalGroup":return{type:"optional",element:i(e.element)};default:throw new Error(`Unsupported ABNF primary node: ${e.$type}`)}},"transformPrimary"),P=n(e=>({name:e.name,definition:i(e.definition)}),"transformRule"),h=n(e=>{f(e,a),e.title&&a.setTitle(e.title),e.rules.map(r=>a.addRule(P(r)))},"populateDb"),R={parse:n(e=>{a.clear(),o.debug("[ABNF Parser] Starting Langium parse");const r=v.parse(e);if(r.lexerErrors.length>0||r.parserErrors.length>0)throw new c(r);const t=r.value;o.debug("[ABNF Parser] Parsed rules:",t.rules.length),h(t),o.debug("[ABNF Parser] Parse complete")},"parse"),parser:{yy:a}},F={parser:R,db:a,renderer:u,styles:p};export{F as diagram};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{P as ln,Q as an,R as j,S,T as W,V as un,W as y,X as tn,Y as C,$ as _,a0 as rn,a1 as o,a2 as on,a3 as sn,a4 as fn}from"./mermaid.core-CGrLstUA.js";function cn(l){return l.innerRadius}function yn(l){return l.outerRadius}function gn(l){return l.startAngle}function dn(l){return l.endAngle}function mn(l){return l&&l.padAngle}function pn(l,h,E,q,v,R,X,a){var I=E-l,i=q-h,n=X-v,d=a-R,u=d*I-n*i;if(!(u*u<y))return u=(n*(h-R)-d*(l-v))/u,[l+u*I,h+u*i]}function L(l,h,E,q,v,R,X){var a=l-E,I=h-q,i=(X?R:-R)/C(a*a+I*I),n=i*I,d=-i*a,u=l+n,s=h+d,f=E+n,c=q+d,Y=(u+f)/2,t=(s+c)/2,m=f-u,g=c-s,A=m*m+g*g,T=v-R,P=u*c-f*s,O=(g<0?-1:1)*C(on(0,T*T*A-P*P)),Q=(P*g-m*O)/A,V=(-P*m-g*O)/A,w=(P*g+m*O)/A,p=(-P*m+g*O)/A,x=Q-Y,e=V-t,r=w-Y,$=p-t;return x*x+e*e>r*r+$*$&&(Q=w,V=p),{cx:Q,cy:V,x01:-n,y01:-d,x11:Q*(v/T-1),y11:V*(v/T-1)}}function hn(){var l=cn,h=yn,E=W(0),q=null,v=gn,R=dn,X=mn,a=null,I=ln(i);function i(){var n,d,u=+l.apply(this,arguments),s=+h.apply(this,arguments),f=v.apply(this,arguments)-un,c=R.apply(this,arguments)-un,Y=rn(c-f),t=c>f;if(a||(a=n=I()),s<u&&(d=s,s=u,u=d),!(s>y))a.moveTo(0,0);else if(Y>tn-y)a.moveTo(s*j(f),s*S(f)),a.arc(0,0,s,f,c,!t),u>y&&(a.moveTo(u*j(c),u*S(c)),a.arc(0,0,u,c,f,t));else{var m=f,g=c,A=f,T=c,P=Y,O=Y,Q=X.apply(this,arguments)/2,V=Q>y&&(q?+q.apply(this,arguments):C(u*u+s*s)),w=_(rn(s-u)/2,+E.apply(this,arguments)),p=w,x=w,e,r;if(V>y){var $=sn(V/u*S(Q)),F=sn(V/s*S(Q));(P-=$*2)>y?($*=t?1:-1,A+=$,T-=$):(P=0,A=T=(f+c)/2),(O-=F*2)>y?(F*=t?1:-1,m+=F,g-=F):(O=0,m=g=(f+c)/2)}var z=s*j(m),B=s*S(m),G=u*j(T),H=u*S(T);if(w>y){var J=s*j(g),K=s*S(g),M=u*j(A),N=u*S(A),D;if(Y<an)if(D=pn(z,B,M,N,J,K,G,H)){var U=z-D[0],Z=B-D[1],k=J-D[0],b=K-D[1],nn=1/S(fn((U*k+Z*b)/(C(U*U+Z*Z)*C(k*k+b*b)))/2),en=C(D[0]*D[0]+D[1]*D[1]);p=_(w,(u-en)/(nn-1)),x=_(w,(s-en)/(nn+1))}else p=x=0}O>y?x>y?(e=L(M,N,z,B,s,x,t),r=L(J,K,G,H,s,x,t),a.moveTo(e.cx+e.x01,e.cy+e.y01),x<w?a.arc(e.cx,e.cy,x,o(e.y01,e.x01),o(r.y01,r.x01),!t):(a.arc(e.cx,e.cy,x,o(e.y01,e.x01),o(e.y11,e.x11),!t),a.arc(0,0,s,o(e.cy+e.y11,e.cx+e.x11),o(r.cy+r.y11,r.cx+r.x11),!t),a.arc(r.cx,r.cy,x,o(r.y11,r.x11),o(r.y01,r.x01),!t))):(a.moveTo(z,B),a.arc(0,0,s,m,g,!t)):a.moveTo(z,B),!(u>y)||!(P>y)?a.lineTo(G,H):p>y?(e=L(G,H,J,K,u,-p,t),r=L(z,B,M,N,u,-p,t),a.lineTo(e.cx+e.x01,e.cy+e.y01),p<w?a.arc(e.cx,e.cy,p,o(e.y01,e.x01),o(r.y01,r.x01),!t):(a.arc(e.cx,e.cy,p,o(e.y01,e.x01),o(e.y11,e.x11),!t),a.arc(0,0,u,o(e.cy+e.y11,e.cx+e.x11),o(r.cy+r.y11,r.cx+r.x11),t),a.arc(r.cx,r.cy,p,o(r.y11,r.x11),o(r.y01,r.x01),!t))):a.arc(0,0,u,T,A,t)}if(a.closePath(),n)return a=null,n+""||null}return i.centroid=function(){var n=(+l.apply(this,arguments)+ +h.apply(this,arguments))/2,d=(+v.apply(this,arguments)+ +R.apply(this,arguments))/2-an/2;return[j(d)*n,S(d)*n]},i.innerRadius=function(n){return arguments.length?(l=typeof n=="function"?n:W(+n),i):l},i.outerRadius=function(n){return arguments.length?(h=typeof n=="function"?n:W(+n),i):h},i.cornerRadius=function(n){return arguments.length?(E=typeof n=="function"?n:W(+n),i):E},i.padRadius=function(n){return arguments.length?(q=n==null?null:typeof n=="function"?n:W(+n),i):q},i.startAngle=function(n){return arguments.length?(v=typeof n=="function"?n:W(+n),i):v},i.endAngle=function(n){return arguments.length?(R=typeof n=="function"?n:W(+n),i):R},i.padAngle=function(n){return arguments.length?(X=typeof n=="function"?n:W(+n),i):X},i.context=function(n){return arguments.length?(a=n??null,i):a},i}export{hn as d};
|