@ai-ecoverse/slicc-spectrum 1.70.0 → 1.72.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/README.md +7 -7
- package/dist/slicc-dummy.js +119 -50
- package/dist/slicc-dummy.js.map +3 -3
- package/dist/slicc-ui.js +1197 -1072
- package/dist/slicc-ui.js.map +3 -3
- package/dist/types/app/approvals.d.ts +1 -0
- package/dist/types/app/messages.d.ts +2 -4
- package/dist/types/app/tool-runs.d.ts +8 -0
- package/dist/types/dummy/agent.d.ts +1 -0
- package/dist/types/dummy/script.d.ts +1 -0
- package/dist/types/model/types.d.ts +3 -0
- package/package.json +5 -5
package/dist/slicc-ui.js
CHANGED
|
@@ -6605,8 +6605,8 @@ function hasFixedPositionAncestor(element2, stopNode) {
|
|
|
6605
6605
|
}
|
|
6606
6606
|
return getComputedStyle2(parentNode).position === "fixed" || hasFixedPositionAncestor(parentNode, stopNode);
|
|
6607
6607
|
}
|
|
6608
|
-
function getClippingElementAncestors(element2,
|
|
6609
|
-
const cachedResult =
|
|
6608
|
+
function getClippingElementAncestors(element2, cache4) {
|
|
6609
|
+
const cachedResult = cache4.get(element2);
|
|
6610
6610
|
if (cachedResult) {
|
|
6611
6611
|
return cachedResult;
|
|
6612
6612
|
}
|
|
@@ -6628,7 +6628,7 @@ function getClippingElementAncestors(element2, cache3) {
|
|
|
6628
6628
|
}
|
|
6629
6629
|
currentNode = getParentNode(currentNode);
|
|
6630
6630
|
}
|
|
6631
|
-
|
|
6631
|
+
cache4.set(element2, result);
|
|
6632
6632
|
return result;
|
|
6633
6633
|
}
|
|
6634
6634
|
function getClippingRect(_ref) {
|
|
@@ -6929,14 +6929,14 @@ var flip2 = flip;
|
|
|
6929
6929
|
var size2 = size;
|
|
6930
6930
|
var arrow2 = arrow;
|
|
6931
6931
|
var computePosition2 = (reference2, floating, options) => {
|
|
6932
|
-
const
|
|
6932
|
+
const cache4 = /* @__PURE__ */ new Map();
|
|
6933
6933
|
const mergedOptions = {
|
|
6934
6934
|
platform,
|
|
6935
6935
|
...options
|
|
6936
6936
|
};
|
|
6937
6937
|
const platformWithCache = {
|
|
6938
6938
|
...mergedOptions.platform,
|
|
6939
|
-
_c:
|
|
6939
|
+
_c: cache4
|
|
6940
6940
|
};
|
|
6941
6941
|
return computePosition(reference2, floating, {
|
|
6942
6942
|
...mergedOptions,
|
|
@@ -9727,33 +9727,33 @@ var lights = {
|
|
|
9727
9727
|
unlinked: ["negative", (owner) => `Unlinked from ${owner}`],
|
|
9728
9728
|
failed: ["negative", (owner) => `Can\u2019t reach ${owner}`]
|
|
9729
9729
|
};
|
|
9730
|
-
function followLight(
|
|
9731
|
-
const [variant, text2] = lights[
|
|
9732
|
-
return { variant, text: text2(
|
|
9730
|
+
function followLight(state2) {
|
|
9731
|
+
const [variant, text2] = lights[state2.link];
|
|
9732
|
+
return { variant, text: text2(state2.owner) };
|
|
9733
9733
|
}
|
|
9734
|
-
function followPage(
|
|
9735
|
-
if (!
|
|
9736
|
-
const { owner } =
|
|
9737
|
-
if (
|
|
9734
|
+
function followPage(state2) {
|
|
9735
|
+
if (!state2) return null;
|
|
9736
|
+
const { owner } = state2;
|
|
9737
|
+
if (state2.link === "connecting")
|
|
9738
9738
|
return {
|
|
9739
9739
|
kind: "connecting",
|
|
9740
9740
|
title: `Connecting to ${owner}\u2026`,
|
|
9741
9741
|
body: `This device follows ${owner}. Its agent shows here once it\u2019s connected.`
|
|
9742
9742
|
};
|
|
9743
|
-
if (
|
|
9743
|
+
if (state2.link === "unlinked")
|
|
9744
9744
|
return {
|
|
9745
9745
|
kind: "unlinked",
|
|
9746
9746
|
title: `${owner} unlinked this device`,
|
|
9747
9747
|
body: `To follow it again, open a new link from ${owner}.`
|
|
9748
9748
|
};
|
|
9749
|
-
if (
|
|
9749
|
+
if (state2.link === "failed")
|
|
9750
9750
|
return {
|
|
9751
9751
|
kind: "failed",
|
|
9752
9752
|
title: `Can\u2019t follow ${owner}`,
|
|
9753
|
-
body:
|
|
9753
|
+
body: state2.error ?? `The link to ${owner} failed.`
|
|
9754
9754
|
};
|
|
9755
|
-
if (
|
|
9756
|
-
const where2 =
|
|
9755
|
+
if (state2.access.view) return null;
|
|
9756
|
+
const where2 = state2.name ? `next to ${state2.name}` : "for this device";
|
|
9757
9757
|
return {
|
|
9758
9758
|
kind: "waiting",
|
|
9759
9759
|
title: `Waiting for ${owner} to allow this device`,
|
|
@@ -9764,26 +9764,26 @@ function list(items, last) {
|
|
|
9764
9764
|
if (items.length < 2) return items.join("");
|
|
9765
9765
|
return `${items.slice(0, -1).join(", ")} ${last} ${items.at(-1)}`;
|
|
9766
9766
|
}
|
|
9767
|
-
function followCan(
|
|
9767
|
+
function followCan(state2) {
|
|
9768
9768
|
const allowed = ["watch the agent"];
|
|
9769
9769
|
const missing = [];
|
|
9770
|
-
(
|
|
9771
|
-
(
|
|
9770
|
+
(state2.access.control ? allowed : missing).push("send prompts");
|
|
9771
|
+
(state2.access.terminal ? allowed : missing).push("open terminals");
|
|
9772
9772
|
const can = `This device can ${list(allowed, "and")}.`;
|
|
9773
|
-
return missing.length ? `${can} To ${list(missing, "or")}, allow it on ${
|
|
9773
|
+
return missing.length ? `${can} To ${list(missing, "or")}, allow it on ${state2.owner}.` : can;
|
|
9774
9774
|
}
|
|
9775
9775
|
function following(model) {
|
|
9776
|
-
const
|
|
9777
|
-
return
|
|
9776
|
+
const state2 = model?.follow?.state();
|
|
9777
|
+
return state2 && !followPage(state2) ? state2 : null;
|
|
9778
9778
|
}
|
|
9779
9779
|
function watchOnly(model) {
|
|
9780
|
-
const
|
|
9781
|
-
if (!
|
|
9782
|
-
return `Watch only. To send prompts from this device, allow Control for it on ${
|
|
9780
|
+
const state2 = following(model);
|
|
9781
|
+
if (!state2 || state2.access.control) return "";
|
|
9782
|
+
return `Watch only. To send prompts from this device, allow Control for it on ${state2.owner}.`;
|
|
9783
9783
|
}
|
|
9784
9784
|
function terminalsAllowed(model) {
|
|
9785
|
-
const
|
|
9786
|
-
return !
|
|
9785
|
+
const state2 = model?.follow?.state();
|
|
9786
|
+
return !state2 || !!state2.access.terminal;
|
|
9787
9787
|
}
|
|
9788
9788
|
var SliccFollow = class extends ModelElement {
|
|
9789
9789
|
static properties = {
|
|
@@ -9879,11 +9879,11 @@ var SliccFollow = class extends ModelElement {
|
|
|
9879
9879
|
async leave() {
|
|
9880
9880
|
const port = this.model?.follow;
|
|
9881
9881
|
if (!port || this.busy) return;
|
|
9882
|
-
const
|
|
9883
|
-
if (
|
|
9882
|
+
const state2 = port.state();
|
|
9883
|
+
if (state2.link !== "unlinked") {
|
|
9884
9884
|
const ok2 = await confirm({
|
|
9885
|
-
title: `Stop following ${
|
|
9886
|
-
body: `This device forgets the link. To follow ${
|
|
9885
|
+
title: `Stop following ${state2.owner}?`,
|
|
9886
|
+
body: `This device forgets the link. To follow ${state2.owner} again, open a new link from it.`,
|
|
9887
9887
|
action: "Leave",
|
|
9888
9888
|
variant: "confirmation"
|
|
9889
9889
|
});
|
|
@@ -9926,12 +9926,12 @@ var SliccFollow = class extends ModelElement {
|
|
|
9926
9926
|
</div>`;
|
|
9927
9927
|
}
|
|
9928
9928
|
render() {
|
|
9929
|
-
const
|
|
9930
|
-
if (!
|
|
9931
|
-
const page = followPage(
|
|
9929
|
+
const state2 = this.model?.follow?.state();
|
|
9930
|
+
if (!state2) return A;
|
|
9931
|
+
const page = followPage(state2);
|
|
9932
9932
|
if (this.page) return page ? this.#page(page) : A;
|
|
9933
|
-
const light = followLight(
|
|
9934
|
-
return b`<swc-action-button id="chip" class="chip" size="s" quiet data-follow=${
|
|
9933
|
+
const light = followLight(state2);
|
|
9934
|
+
return b`<swc-action-button id="chip" class="chip" size="s" quiet data-follow=${state2.link} accessible-label=${light.text}>
|
|
9935
9935
|
${this.compact ? b`<swc-icon-user-following slot="icon" size="s" aria-hidden="true"></swc-icon-user-following>` : A}
|
|
9936
9936
|
<swc-status-light size="s" variant=${light.variant}><span class="text">${light.text}</span></swc-status-light>
|
|
9937
9937
|
</swc-action-button>
|
|
@@ -9939,8 +9939,8 @@ var SliccFollow = class extends ModelElement {
|
|
|
9939
9939
|
<swc-popover for="chip" placement="bottom-end" accessible-label=${light.text}>
|
|
9940
9940
|
<div class="panel">
|
|
9941
9941
|
<h2>${light.text}</h2>
|
|
9942
|
-
${
|
|
9943
|
-
<p data-can>${followCan(
|
|
9942
|
+
${state2.link === "reconnecting" ? b`<p class="muted" data-reconnecting>The link to ${state2.owner} dropped. The conversation may be out of date until it’s back${state2.access.control ? ", and sending waits until then" : ""}.</p>` : A}
|
|
9943
|
+
<p data-can>${followCan(state2)}</p>
|
|
9944
9944
|
${this.#error()}
|
|
9945
9945
|
<div class="actions">${this.#leaveButton()}</div>
|
|
9946
9946
|
</div>
|
|
@@ -10991,6 +10991,7 @@ var SliccMonitor = class extends ModelElement {
|
|
|
10991
10991
|
flex: none;
|
|
10992
10992
|
}
|
|
10993
10993
|
.body {
|
|
10994
|
+
container: monitor / inline-size;
|
|
10994
10995
|
flex: 1;
|
|
10995
10996
|
min-height: 0;
|
|
10996
10997
|
overflow-y: auto;
|
|
@@ -11005,10 +11006,65 @@ var SliccMonitor = class extends ModelElement {
|
|
|
11005
11006
|
grid-template-columns: repeat(auto-fit, minmax(min(100%, var(--swc-card-default-width-extra-small)), 1fr));
|
|
11006
11007
|
gap: var(--swc-spacing-100);
|
|
11007
11008
|
}
|
|
11009
|
+
@container monitor (min-width: 248px) {
|
|
11010
|
+
.vital:last-child:nth-child(2n + 1) {
|
|
11011
|
+
grid-column: 1 / -1;
|
|
11012
|
+
}
|
|
11013
|
+
}
|
|
11014
|
+
@container monitor (min-width: 376px) {
|
|
11015
|
+
.vital:last-child:nth-child(n) {
|
|
11016
|
+
grid-column: auto;
|
|
11017
|
+
}
|
|
11018
|
+
.vital:last-child:nth-child(3n + 1) {
|
|
11019
|
+
grid-column: 1 / -1;
|
|
11020
|
+
}
|
|
11021
|
+
}
|
|
11022
|
+
@container monitor (min-width: 504px) {
|
|
11023
|
+
.vital:last-child:nth-child(n) {
|
|
11024
|
+
grid-column: auto;
|
|
11025
|
+
}
|
|
11026
|
+
.vital:last-child:nth-child(4n + 1) {
|
|
11027
|
+
grid-column: 1 / -1;
|
|
11028
|
+
}
|
|
11029
|
+
}
|
|
11030
|
+
@container monitor (min-width: 632px) {
|
|
11031
|
+
.vital:last-child:nth-child(n) {
|
|
11032
|
+
grid-column: auto;
|
|
11033
|
+
}
|
|
11034
|
+
.vital:last-child:nth-child(5n + 1) {
|
|
11035
|
+
grid-column: 1 / -1;
|
|
11036
|
+
}
|
|
11037
|
+
}
|
|
11038
|
+
@container monitor (min-width: 760px) {
|
|
11039
|
+
.vital:last-child:nth-child(n) {
|
|
11040
|
+
grid-column: auto;
|
|
11041
|
+
}
|
|
11042
|
+
.vital:last-child:nth-child(6n + 1) {
|
|
11043
|
+
grid-column: 1 / -1;
|
|
11044
|
+
}
|
|
11045
|
+
}
|
|
11046
|
+
@container monitor (min-width: 888px) {
|
|
11047
|
+
.vital:last-child:nth-child(n) {
|
|
11048
|
+
grid-column: auto;
|
|
11049
|
+
}
|
|
11050
|
+
.vital:last-child:nth-child(7n + 1) {
|
|
11051
|
+
grid-column: 1 / -1;
|
|
11052
|
+
}
|
|
11053
|
+
}
|
|
11054
|
+
@container monitor (min-width: 1016px) {
|
|
11055
|
+
.vital:last-child:nth-child(n) {
|
|
11056
|
+
grid-column: auto;
|
|
11057
|
+
}
|
|
11058
|
+
.vital:last-child:nth-child(8n + 1) {
|
|
11059
|
+
grid-column: 1 / -1;
|
|
11060
|
+
}
|
|
11061
|
+
}
|
|
11008
11062
|
.vital {
|
|
11009
11063
|
display: grid;
|
|
11064
|
+
grid-template-rows: auto auto 1fr;
|
|
11010
11065
|
align-content: start;
|
|
11011
11066
|
gap: var(--swc-spacing-50);
|
|
11067
|
+
min-width: 0;
|
|
11012
11068
|
border-radius: var(--swc-corner-radius-medium-default);
|
|
11013
11069
|
padding: var(--swc-spacing-200);
|
|
11014
11070
|
background: var(--swc-background-layer-1-color);
|
|
@@ -11017,20 +11073,39 @@ var SliccMonitor = class extends ModelElement {
|
|
|
11017
11073
|
color: var(--swc-neutral-subdued-content-color-default);
|
|
11018
11074
|
font-size: var(--swc-font-size-75);
|
|
11019
11075
|
}
|
|
11020
|
-
.
|
|
11076
|
+
.reading {
|
|
11077
|
+
display: flex;
|
|
11078
|
+
flex-wrap: wrap;
|
|
11079
|
+
align-items: baseline;
|
|
11080
|
+
column-gap: var(--swc-spacing-75);
|
|
11081
|
+
min-width: 0;
|
|
11082
|
+
height: 1lh;
|
|
11083
|
+
overflow: hidden;
|
|
11084
|
+
white-space: nowrap;
|
|
11021
11085
|
font-size: var(--swc-font-size-300);
|
|
11086
|
+
}
|
|
11087
|
+
.value {
|
|
11088
|
+
flex: none;
|
|
11089
|
+
max-width: 100%;
|
|
11090
|
+
overflow: hidden;
|
|
11091
|
+
text-overflow: ellipsis;
|
|
11022
11092
|
font-weight: var(--swc-bold-font-weight);
|
|
11023
11093
|
font-variant-numeric: tabular-nums;
|
|
11024
11094
|
}
|
|
11025
11095
|
.unit,
|
|
11026
11096
|
.delta {
|
|
11097
|
+
flex: none;
|
|
11098
|
+
font-size: var(--swc-font-size-100);
|
|
11027
11099
|
color: var(--swc-neutral-subdued-content-color-default);
|
|
11028
|
-
|
|
11100
|
+
}
|
|
11101
|
+
.spark {
|
|
11102
|
+
align-self: end;
|
|
11103
|
+
height: var(--swc-component-height-100);
|
|
11029
11104
|
}
|
|
11030
11105
|
svg {
|
|
11031
11106
|
display: block;
|
|
11032
11107
|
width: 100%;
|
|
11033
|
-
height:
|
|
11108
|
+
height: 100%;
|
|
11034
11109
|
}
|
|
11035
11110
|
polyline {
|
|
11036
11111
|
fill: none;
|
|
@@ -11040,6 +11115,13 @@ var SliccMonitor = class extends ModelElement {
|
|
|
11040
11115
|
swc-meter {
|
|
11041
11116
|
width: 100%;
|
|
11042
11117
|
}
|
|
11118
|
+
swc-meter > span {
|
|
11119
|
+
display: block;
|
|
11120
|
+
min-width: 0;
|
|
11121
|
+
overflow: hidden;
|
|
11122
|
+
white-space: nowrap;
|
|
11123
|
+
text-overflow: ellipsis;
|
|
11124
|
+
}
|
|
11043
11125
|
.alerts {
|
|
11044
11126
|
display: grid;
|
|
11045
11127
|
gap: var(--swc-spacing-75);
|
|
@@ -11101,25 +11183,34 @@ var SliccMonitor = class extends ModelElement {
|
|
|
11101
11183
|
}
|
|
11102
11184
|
.sections {
|
|
11103
11185
|
display: grid;
|
|
11186
|
+
grid-template-columns: minmax(0, 1fr) auto auto;
|
|
11187
|
+
column-gap: var(--swc-spacing-100);
|
|
11104
11188
|
margin: 0;
|
|
11105
11189
|
padding: 0;
|
|
11106
11190
|
list-style: none;
|
|
11107
11191
|
}
|
|
11108
|
-
.section
|
|
11192
|
+
.section,
|
|
11193
|
+
.line {
|
|
11194
|
+
grid-column: 1 / -1;
|
|
11109
11195
|
display: grid;
|
|
11196
|
+
grid-template-columns: subgrid;
|
|
11110
11197
|
}
|
|
11111
11198
|
.line {
|
|
11112
|
-
display: flex;
|
|
11113
|
-
flex-wrap: wrap;
|
|
11114
11199
|
align-items: center;
|
|
11115
|
-
gap: var(--swc-spacing-100);
|
|
11116
11200
|
min-height: var(--swc-component-height-100);
|
|
11117
11201
|
padding: var(--swc-spacing-50) 0;
|
|
11118
11202
|
}
|
|
11203
|
+
.caption {
|
|
11204
|
+
grid-column: 1;
|
|
11205
|
+
min-width: 0;
|
|
11206
|
+
display: flex;
|
|
11207
|
+
flex-wrap: wrap;
|
|
11208
|
+
align-items: center;
|
|
11209
|
+
gap: var(--swc-spacing-50) var(--swc-spacing-75);
|
|
11210
|
+
}
|
|
11119
11211
|
.toggle {
|
|
11120
11212
|
all: unset;
|
|
11121
11213
|
box-sizing: border-box;
|
|
11122
|
-
flex: 1 1 auto;
|
|
11123
11214
|
min-width: 0;
|
|
11124
11215
|
display: flex;
|
|
11125
11216
|
align-items: center;
|
|
@@ -11145,14 +11236,19 @@ var SliccMonitor = class extends ModelElement {
|
|
|
11145
11236
|
transform: scaleX(-1);
|
|
11146
11237
|
}
|
|
11147
11238
|
.line .name {
|
|
11148
|
-
flex: 1 1 auto;
|
|
11149
11239
|
min-width: 0;
|
|
11150
11240
|
}
|
|
11151
11241
|
.line .num {
|
|
11242
|
+
grid-column: 2;
|
|
11243
|
+
justify-self: end;
|
|
11152
11244
|
font-weight: var(--swc-bold-font-weight);
|
|
11153
11245
|
font-variant-numeric: tabular-nums;
|
|
11154
11246
|
}
|
|
11247
|
+
.line swc-action-button {
|
|
11248
|
+
grid-column: 3;
|
|
11249
|
+
}
|
|
11155
11250
|
.rows {
|
|
11251
|
+
grid-column: 1 / -1;
|
|
11156
11252
|
display: grid;
|
|
11157
11253
|
gap: var(--swc-spacing-50);
|
|
11158
11254
|
margin: 0 0 var(--swc-spacing-100);
|
|
@@ -11202,21 +11298,21 @@ var SliccMonitor = class extends ModelElement {
|
|
|
11202
11298
|
}
|
|
11203
11299
|
#vital(vital) {
|
|
11204
11300
|
if (vital.ratio !== void 0) {
|
|
11205
|
-
return b`<div class="vital" data-id=${vital.id}>
|
|
11301
|
+
return b`<div class="vital" data-id=${vital.id} title=${vital.hint ?? vital.unit ?? A}>
|
|
11206
11302
|
<swc-meter
|
|
11207
11303
|
size="s"
|
|
11208
11304
|
variant=${meterVariant2(vital.ratio)}
|
|
11209
11305
|
value=${Math.round(vital.ratio * 100)}
|
|
11210
11306
|
value-label=${vital.value}
|
|
11211
|
-
><span slot="label">${vital.label}</span
|
|
11307
|
+
><span slot="label">${vital.label}</span><span slot="description">${vital.unit ?? "\xA0"}</span></swc-meter
|
|
11212
11308
|
>
|
|
11213
11309
|
</div>`;
|
|
11214
11310
|
}
|
|
11215
11311
|
const line = vital.series ? sparkline(vital.series) : "";
|
|
11216
11312
|
return b`<div class="vital" data-id=${vital.id}>
|
|
11217
11313
|
<div class="label">${vital.label}</div>
|
|
11218
|
-
<div><span class="value">${vital.value}</span>${vital.unit ? b`<span class="unit">${vital.unit}</span>` : A}${vital.delta ? b`<span class="delta">${vital.delta}</span>` : A}</div>
|
|
11219
|
-
|
|
11314
|
+
<div class="reading" title=${vital.hint ?? [vital.value, vital.unit, vital.delta].filter(Boolean).join(" ")}><span class="value">${vital.value}</span>${vital.unit ? b`<span class="unit">${vital.unit}</span>` : A}${vital.delta ? b`<span class="delta">${vital.delta}</span>` : A}</div>
|
|
11315
|
+
<div class="spark">${line ? b`<svg viewBox="0 0 120 28" preserveAspectRatio="none" aria-hidden="true">${w`<polyline points=${line}></polyline>`}</svg>` : A}</div>
|
|
11220
11316
|
</div>`;
|
|
11221
11317
|
}
|
|
11222
11318
|
#alert(alert) {
|
|
@@ -11252,12 +11348,12 @@ var SliccMonitor = class extends ModelElement {
|
|
|
11252
11348
|
const rows = section.rows.length > 0;
|
|
11253
11349
|
const open = rows && (this.expanded[section.id] ?? flag !== null);
|
|
11254
11350
|
const list5 = `rows-${section.id}`;
|
|
11351
|
+
const badge = flag ? b`<swc-badge size="s" variant=${flag.variant} subtle>${flag.text}</swc-badge>` : A;
|
|
11255
11352
|
return b`<li class="section" data-id=${section.id} data-open=${open ? "" : A}>
|
|
11256
11353
|
<div class="line">
|
|
11257
|
-
|
|
11354
|
+
<span class="caption">${rows ? b`<button class="toggle" aria-expanded=${open ? "true" : "false"} aria-controls=${open ? list5 : A} @click=${() => {
|
|
11258
11355
|
this.expanded = { ...this.expanded, [section.id]: !open };
|
|
11259
|
-
}}><span class="chevron"><swc-icon-chevron-right size="s" aria-hidden="true"></swc-icon-chevron-right></span><span class="name">${section.label}</span></button>` : b`<span class="chevron"></span><span class="name">${section.label}</span>`}
|
|
11260
|
-
${flag ? b`<swc-badge size="s" variant=${flag.variant} subtle>${flag.text}</swc-badge>` : A}
|
|
11356
|
+
}}><span class="chevron"><swc-icon-chevron-right size="s" aria-hidden="true"></swc-icon-chevron-right></span><span class="name">${section.label}</span></button>` : b`<span class="chevron"></span><span class="name">${section.label}</span>`}${badge}</span>
|
|
11261
11357
|
<span class="num">${section.rows.length}</span>
|
|
11262
11358
|
${surface2 ? b`<swc-action-button size="s" quiet accessible-label=${`Open ${section.label}`} @click=${() => this.#open(surface2)}
|
|
11263
11359
|
>Open</swc-action-button
|
|
@@ -11783,8 +11879,8 @@ function fallbackModel(options) {
|
|
|
11783
11879
|
return offered.find((option2) => option2.default) ?? offered[0];
|
|
11784
11880
|
}
|
|
11785
11881
|
function controls(model) {
|
|
11786
|
-
const
|
|
11787
|
-
return !
|
|
11882
|
+
const state2 = model.follow?.state();
|
|
11883
|
+
return !state2 || !!state2.access.control && state2.link === "connected";
|
|
11788
11884
|
}
|
|
11789
11885
|
function settleModels(model) {
|
|
11790
11886
|
if (settling.has(model) || !controls(model)) return;
|
|
@@ -12203,8 +12299,8 @@ var QrCode = class {
|
|
|
12203
12299
|
for (let vert = 0; vert < this.size; vert++) {
|
|
12204
12300
|
for (let j5 = 0; j5 < 2; j5++) {
|
|
12205
12301
|
const x7 = right - j5;
|
|
12206
|
-
const
|
|
12207
|
-
const y10 =
|
|
12302
|
+
const upward2 = (right + 1 & 2) === 0;
|
|
12303
|
+
const y10 = upward2 ? this.size - 1 - vert : vert;
|
|
12208
12304
|
if (!this.types[y10][x7] && i26 < data.length * 8) {
|
|
12209
12305
|
this.modules[y10][x7] = getBit(data[i26 >>> 3], 7 - (i26 & 7));
|
|
12210
12306
|
i26++;
|
|
@@ -14665,23 +14761,23 @@ function installProperties(document2, text2 = swc_default) {
|
|
|
14665
14761
|
var following2 = "SLICC runs in another tab. This tab shows it and sends your actions there.";
|
|
14666
14762
|
var connecting = "Connecting to the tab running SLICC\u2026";
|
|
14667
14763
|
var alone = "SLICC is open in another tab.";
|
|
14668
|
-
function tabsBanner(
|
|
14669
|
-
if (!
|
|
14670
|
-
if (
|
|
14764
|
+
function tabsBanner(state2) {
|
|
14765
|
+
if (!state2 || state2.role === "alone") return null;
|
|
14766
|
+
if (state2.skew === "newer")
|
|
14671
14767
|
return {
|
|
14672
14768
|
kind: "skew",
|
|
14673
14769
|
skew: "newer",
|
|
14674
14770
|
text: "Another tab runs a newer SLICC. Reload this tab.",
|
|
14675
14771
|
reload: true
|
|
14676
14772
|
};
|
|
14677
|
-
if (
|
|
14773
|
+
if (state2.skew === "older")
|
|
14678
14774
|
return {
|
|
14679
14775
|
kind: "skew",
|
|
14680
14776
|
skew: "older",
|
|
14681
14777
|
text: "Another tab runs an older SLICC. Reload the other SLICC tab.",
|
|
14682
14778
|
reload: false
|
|
14683
14779
|
};
|
|
14684
|
-
if (
|
|
14780
|
+
if (state2.stalled)
|
|
14685
14781
|
return {
|
|
14686
14782
|
kind: "stalled",
|
|
14687
14783
|
skew: null,
|
|
@@ -14690,11 +14786,11 @@ function tabsBanner(state3) {
|
|
|
14690
14786
|
};
|
|
14691
14787
|
return null;
|
|
14692
14788
|
}
|
|
14693
|
-
function tabsLight(
|
|
14694
|
-
if (!
|
|
14695
|
-
const banner = tabsBanner(
|
|
14789
|
+
function tabsLight(state2) {
|
|
14790
|
+
if (!state2 || state2.role === "owner" || state2.role === "alone") return null;
|
|
14791
|
+
const banner = tabsBanner(state2);
|
|
14696
14792
|
if (banner) return { variant: "notice", text: "Another tab", tooltip: banner.text };
|
|
14697
|
-
if (
|
|
14793
|
+
if (state2.role === "connecting")
|
|
14698
14794
|
return { variant: "info", text: "Connecting", tooltip: connecting };
|
|
14699
14795
|
return { variant: "neutral", text: "Another tab", tooltip: following2 };
|
|
14700
14796
|
}
|
|
@@ -21800,12 +21896,12 @@ function comparePreparedEntries(left, right) {
|
|
|
21800
21896
|
function comparePreparedPaths(left, right) {
|
|
21801
21897
|
return comparePreparedEntries(left, right);
|
|
21802
21898
|
}
|
|
21803
|
-
function comparePreparedPathsWithCachedSortKeys(left, right,
|
|
21899
|
+
function comparePreparedPathsWithCachedSortKeys(left, right, cache4) {
|
|
21804
21900
|
const getCachedSortKey = (value) => {
|
|
21805
|
-
const existingKey =
|
|
21901
|
+
const existingKey = cache4.get(value);
|
|
21806
21902
|
if (existingKey != null) return existingKey;
|
|
21807
21903
|
const nextKey = createSegmentSortKey(value);
|
|
21808
|
-
|
|
21904
|
+
cache4.set(value, nextKey);
|
|
21809
21905
|
return nextKey;
|
|
21810
21906
|
};
|
|
21811
21907
|
const sharedDepth = Math.min(left.segments.length, right.segments.length);
|
|
@@ -22505,40 +22601,40 @@ function resolveInitialExpansion(initialExpansion) {
|
|
|
22505
22601
|
if (!Number.isInteger(initialExpansion) || initialExpansion < 0) throw new Error(`initialExpansion must be "open", "closed", or a non-negative integer depth. Received: ${String(initialExpansion)}`);
|
|
22506
22602
|
return initialExpansion;
|
|
22507
22603
|
}
|
|
22508
|
-
function isDirectoryExpandedByDefault(
|
|
22604
|
+
function isDirectoryExpandedByDefault(state2, node) {
|
|
22509
22605
|
if (hasNodeFlag(node, 2)) return true;
|
|
22510
|
-
if (
|
|
22511
|
-
if (
|
|
22512
|
-
return getNodeDepth(node) <=
|
|
22606
|
+
if (state2.defaultExpansion === "open") return true;
|
|
22607
|
+
if (state2.defaultExpansion === "closed") return false;
|
|
22608
|
+
return getNodeDepth(node) <= state2.defaultExpansion;
|
|
22513
22609
|
}
|
|
22514
|
-
function isDirectoryExpanded(
|
|
22610
|
+
function isDirectoryExpanded(state2, nodeId, node = state2.snapshot.nodes[nodeId]) {
|
|
22515
22611
|
if (node == null || !isDirectoryNode(node)) return false;
|
|
22516
|
-
if (
|
|
22517
|
-
if (
|
|
22518
|
-
if (
|
|
22519
|
-
return isDirectoryExpandedByDefault(
|
|
22612
|
+
if (state2.directoriesOpenByDefault && !state2.hasCollapsedDirectoryOverrides) return true;
|
|
22613
|
+
if (state2.collapsedDirectoryIds.has(nodeId)) return false;
|
|
22614
|
+
if (state2.expandedDirectoryIds.has(nodeId)) return true;
|
|
22615
|
+
return isDirectoryExpandedByDefault(state2, node);
|
|
22520
22616
|
}
|
|
22521
|
-
function setDirectoryExpanded(
|
|
22617
|
+
function setDirectoryExpanded(state2, nodeId, expanded, node = state2.snapshot.nodes[nodeId]) {
|
|
22522
22618
|
if (node == null || !isDirectoryNode(node)) return;
|
|
22523
|
-
const expandedByDefault = isDirectoryExpandedByDefault(
|
|
22619
|
+
const expandedByDefault = isDirectoryExpandedByDefault(state2, node);
|
|
22524
22620
|
if (expanded) {
|
|
22525
22621
|
if (expandedByDefault) {
|
|
22526
|
-
|
|
22527
|
-
|
|
22622
|
+
state2.collapsedDirectoryIds.delete(nodeId);
|
|
22623
|
+
state2.hasCollapsedDirectoryOverrides = state2.collapsedDirectoryIds.size > 0;
|
|
22528
22624
|
return;
|
|
22529
22625
|
}
|
|
22530
|
-
|
|
22626
|
+
state2.expandedDirectoryIds.add(nodeId);
|
|
22531
22627
|
return;
|
|
22532
22628
|
}
|
|
22533
22629
|
if (expandedByDefault) {
|
|
22534
|
-
|
|
22535
|
-
|
|
22630
|
+
state2.collapsedDirectoryIds.add(nodeId);
|
|
22631
|
+
state2.hasCollapsedDirectoryOverrides = true;
|
|
22536
22632
|
return;
|
|
22537
22633
|
}
|
|
22538
|
-
|
|
22634
|
+
state2.expandedDirectoryIds.delete(nodeId);
|
|
22539
22635
|
}
|
|
22540
|
-
function getOrCreateDirectoryLoadInfo(
|
|
22541
|
-
const existingInfo =
|
|
22636
|
+
function getOrCreateDirectoryLoadInfo(state2, nodeId) {
|
|
22637
|
+
const existingInfo = state2.directoryLoadInfoById.get(nodeId);
|
|
22542
22638
|
if (existingInfo != null) return existingInfo;
|
|
22543
22639
|
const nextInfo = {
|
|
22544
22640
|
activeAttemptId: null,
|
|
@@ -22546,14 +22642,14 @@ function getOrCreateDirectoryLoadInfo(state3, nodeId) {
|
|
|
22546
22642
|
nextAttemptId: 1,
|
|
22547
22643
|
state: "loaded"
|
|
22548
22644
|
};
|
|
22549
|
-
|
|
22645
|
+
state2.directoryLoadInfoById.set(nodeId, nextInfo);
|
|
22550
22646
|
return nextInfo;
|
|
22551
22647
|
}
|
|
22552
|
-
function getDirectoryLoadState(
|
|
22553
|
-
return
|
|
22648
|
+
function getDirectoryLoadState(state2, nodeId) {
|
|
22649
|
+
return state2.directoryLoadInfoById.get(nodeId)?.state ?? "loaded";
|
|
22554
22650
|
}
|
|
22555
|
-
function beginDirectoryLoad(
|
|
22556
|
-
const loadInfo = getOrCreateDirectoryLoadInfo(
|
|
22651
|
+
function beginDirectoryLoad(state2, nodeId) {
|
|
22652
|
+
const loadInfo = getOrCreateDirectoryLoadInfo(state2, nodeId);
|
|
22557
22653
|
if (loadInfo.state === "loading" && loadInfo.activeAttemptId != null) return {
|
|
22558
22654
|
attemptId: loadInfo.activeAttemptId,
|
|
22559
22655
|
nodeId,
|
|
@@ -22570,46 +22666,46 @@ function beginDirectoryLoad(state3, nodeId) {
|
|
|
22570
22666
|
reused: false
|
|
22571
22667
|
};
|
|
22572
22668
|
}
|
|
22573
|
-
function markDirectoryUnloadedState(
|
|
22574
|
-
const loadInfo = getOrCreateDirectoryLoadInfo(
|
|
22669
|
+
function markDirectoryUnloadedState(state2, nodeId) {
|
|
22670
|
+
const loadInfo = getOrCreateDirectoryLoadInfo(state2, nodeId);
|
|
22575
22671
|
loadInfo.activeAttemptId = null;
|
|
22576
22672
|
loadInfo.errorMessage = null;
|
|
22577
22673
|
loadInfo.state = "unloaded";
|
|
22578
22674
|
}
|
|
22579
|
-
function completeDirectoryLoad(
|
|
22580
|
-
const loadInfo =
|
|
22675
|
+
function completeDirectoryLoad(state2, nodeId, attemptId) {
|
|
22676
|
+
const loadInfo = state2.directoryLoadInfoById.get(nodeId);
|
|
22581
22677
|
if (loadInfo == null || loadInfo.activeAttemptId !== attemptId) return false;
|
|
22582
22678
|
loadInfo.activeAttemptId = null;
|
|
22583
22679
|
loadInfo.errorMessage = null;
|
|
22584
22680
|
loadInfo.state = "loaded";
|
|
22585
22681
|
return true;
|
|
22586
22682
|
}
|
|
22587
|
-
function isDirectoryLoadAttemptCurrent(
|
|
22588
|
-
return
|
|
22683
|
+
function isDirectoryLoadAttemptCurrent(state2, nodeId, attemptId) {
|
|
22684
|
+
return state2.directoryLoadInfoById.get(nodeId)?.activeAttemptId === attemptId;
|
|
22589
22685
|
}
|
|
22590
|
-
function failDirectoryLoad(
|
|
22591
|
-
const loadInfo =
|
|
22686
|
+
function failDirectoryLoad(state2, nodeId, attemptId, errorMessage) {
|
|
22687
|
+
const loadInfo = state2.directoryLoadInfoById.get(nodeId);
|
|
22592
22688
|
if (loadInfo == null || loadInfo.activeAttemptId !== attemptId) return false;
|
|
22593
22689
|
loadInfo.activeAttemptId = null;
|
|
22594
22690
|
loadInfo.errorMessage = errorMessage ?? null;
|
|
22595
22691
|
loadInfo.state = "error";
|
|
22596
22692
|
return true;
|
|
22597
22693
|
}
|
|
22598
|
-
function clearDirectoryLoadInfo(
|
|
22599
|
-
|
|
22694
|
+
function clearDirectoryLoadInfo(state2, nodeId) {
|
|
22695
|
+
state2.directoryLoadInfoById.delete(nodeId);
|
|
22600
22696
|
}
|
|
22601
22697
|
|
|
22602
22698
|
// node_modules/@pierre/trees/dist/path-store/src/events.js
|
|
22603
|
-
function subscribe(
|
|
22699
|
+
function subscribe(state2, type, handler) {
|
|
22604
22700
|
const rawHandler = handler;
|
|
22605
|
-
const existingListeners =
|
|
22701
|
+
const existingListeners = state2.listeners.get(type);
|
|
22606
22702
|
if (existingListeners != null) existingListeners.add(rawHandler);
|
|
22607
|
-
else
|
|
22703
|
+
else state2.listeners.set(type, /* @__PURE__ */ new Set([rawHandler]));
|
|
22608
22704
|
return () => {
|
|
22609
|
-
const listeners =
|
|
22705
|
+
const listeners = state2.listeners.get(type);
|
|
22610
22706
|
if (listeners == null) return;
|
|
22611
22707
|
listeners.delete(rawHandler);
|
|
22612
|
-
if (listeners.size === 0)
|
|
22708
|
+
if (listeners.size === 0) state2.listeners.delete(type);
|
|
22613
22709
|
};
|
|
22614
22710
|
}
|
|
22615
22711
|
function createAddEvent(args2) {
|
|
@@ -22759,58 +22855,58 @@ function createCleanupEvent(args2) {
|
|
|
22759
22855
|
visibleCountDelta: null
|
|
22760
22856
|
};
|
|
22761
22857
|
}
|
|
22762
|
-
function finalizeEvent(
|
|
22858
|
+
function finalizeEvent(state2, previousVisibleCount, event2) {
|
|
22763
22859
|
return {
|
|
22764
22860
|
...event2,
|
|
22765
|
-
visibleCountDelta: getCurrentVisibleCount(
|
|
22861
|
+
visibleCountDelta: getCurrentVisibleCount(state2) - previousVisibleCount
|
|
22766
22862
|
};
|
|
22767
22863
|
}
|
|
22768
|
-
function batchEvents(
|
|
22769
|
-
const previousVisibleCount = getCurrentVisibleCount(
|
|
22864
|
+
function batchEvents(state2, run2) {
|
|
22865
|
+
const previousVisibleCount = getCurrentVisibleCount(state2);
|
|
22770
22866
|
const frame = createTransactionFrame();
|
|
22771
|
-
|
|
22867
|
+
state2.transactionStack.push(frame);
|
|
22772
22868
|
try {
|
|
22773
22869
|
run2();
|
|
22774
22870
|
} catch (error) {
|
|
22775
|
-
finishTransaction(
|
|
22871
|
+
finishTransaction(state2, frame, false);
|
|
22776
22872
|
throw error;
|
|
22777
22873
|
}
|
|
22778
|
-
finishTransaction(
|
|
22874
|
+
finishTransaction(state2, frame, true, getCurrentVisibleCount(state2) - previousVisibleCount);
|
|
22779
22875
|
}
|
|
22780
|
-
function recordEvent(
|
|
22781
|
-
const instrumentation =
|
|
22876
|
+
function recordEvent(state2, event2) {
|
|
22877
|
+
const instrumentation = state2.instrumentation;
|
|
22782
22878
|
if (instrumentation == null) {
|
|
22783
|
-
recordEventNow(
|
|
22879
|
+
recordEventNow(state2, event2);
|
|
22784
22880
|
return;
|
|
22785
22881
|
}
|
|
22786
|
-
withBenchmarkPhase(instrumentation, "store.events.record", () => recordEventNow(
|
|
22882
|
+
withBenchmarkPhase(instrumentation, "store.events.record", () => recordEventNow(state2, event2));
|
|
22787
22883
|
}
|
|
22788
|
-
function recordEventNow(
|
|
22789
|
-
const currentFrame =
|
|
22884
|
+
function recordEventNow(state2, event2) {
|
|
22885
|
+
const currentFrame = state2.transactionStack[state2.transactionStack.length - 1] ?? null;
|
|
22790
22886
|
if (currentFrame == null) {
|
|
22791
|
-
emitEvent(
|
|
22887
|
+
emitEvent(state2, event2);
|
|
22792
22888
|
return;
|
|
22793
22889
|
}
|
|
22794
22890
|
currentFrame.events.push(event2);
|
|
22795
22891
|
mergeEventMetadataIntoFrame(currentFrame, event2);
|
|
22796
22892
|
}
|
|
22797
|
-
function finishTransaction(
|
|
22798
|
-
if (
|
|
22893
|
+
function finishTransaction(state2, frame, emit, visibleCountDelta = null) {
|
|
22894
|
+
if (state2.transactionStack.pop() !== frame) throw new Error("Transaction stack underflow");
|
|
22799
22895
|
if (!emit) return;
|
|
22800
|
-
const parentFrame =
|
|
22896
|
+
const parentFrame = state2.transactionStack[state2.transactionStack.length - 1] ?? null;
|
|
22801
22897
|
if (parentFrame != null) {
|
|
22802
|
-
const instrumentation2 =
|
|
22898
|
+
const instrumentation2 = state2.instrumentation;
|
|
22803
22899
|
if (instrumentation2 == null) mergeBatchFrameIntoParent(parentFrame, frame);
|
|
22804
22900
|
else withBenchmarkPhase(instrumentation2, "store.events.batch.merge", () => mergeBatchFrameIntoParent(parentFrame, frame));
|
|
22805
22901
|
return;
|
|
22806
22902
|
}
|
|
22807
22903
|
const batchEvent = createBatchEvent(frame, visibleCountDelta);
|
|
22808
|
-
const instrumentation =
|
|
22904
|
+
const instrumentation = state2.instrumentation;
|
|
22809
22905
|
if (instrumentation == null) {
|
|
22810
|
-
emitEvent(
|
|
22906
|
+
emitEvent(state2, batchEvent);
|
|
22811
22907
|
return;
|
|
22812
22908
|
}
|
|
22813
|
-
withBenchmarkPhase(instrumentation, "store.events.batch.commit", () => emitEvent(
|
|
22909
|
+
withBenchmarkPhase(instrumentation, "store.events.batch.commit", () => emitEvent(state2, batchEvent));
|
|
22814
22910
|
}
|
|
22815
22911
|
function createBatchEvent(frame, visibleCountDelta) {
|
|
22816
22912
|
return {
|
|
@@ -22835,48 +22931,48 @@ function mergeEventMetadataIntoFrame(frame, event2) {
|
|
|
22835
22931
|
for (const nodeId of event2.affectedNodeIds) frame.affectedNodeIds.add(nodeId);
|
|
22836
22932
|
for (const nodeId of event2.affectedAncestorIds) frame.affectedAncestorIds.add(nodeId);
|
|
22837
22933
|
}
|
|
22838
|
-
function emitEvent(
|
|
22839
|
-
const instrumentation =
|
|
22934
|
+
function emitEvent(state2, event2) {
|
|
22935
|
+
const instrumentation = state2.instrumentation;
|
|
22840
22936
|
if (instrumentation == null) {
|
|
22841
|
-
emitEventNow(
|
|
22937
|
+
emitEventNow(state2, event2);
|
|
22842
22938
|
return;
|
|
22843
22939
|
}
|
|
22844
|
-
withBenchmarkPhase(instrumentation, "store.events.emit", () => emitEventNow(
|
|
22940
|
+
withBenchmarkPhase(instrumentation, "store.events.emit", () => emitEventNow(state2, event2));
|
|
22845
22941
|
}
|
|
22846
|
-
function emitEventNow(
|
|
22847
|
-
|
|
22848
|
-
|
|
22942
|
+
function emitEventNow(state2, event2) {
|
|
22943
|
+
state2.listeners.get(event2.operation)?.forEach((handler) => handler(event2));
|
|
22944
|
+
state2.listeners.get("*")?.forEach((handler) => handler(event2));
|
|
22849
22945
|
}
|
|
22850
|
-
function getCurrentVisibleCount(
|
|
22851
|
-
return
|
|
22946
|
+
function getCurrentVisibleCount(state2) {
|
|
22947
|
+
return state2.snapshot.nodes[state2.snapshot.rootId]?.visibleSubtreeCount ?? 0;
|
|
22852
22948
|
}
|
|
22853
22949
|
|
|
22854
22950
|
// node_modules/@pierre/trees/dist/path-store/src/flatten.js
|
|
22855
|
-
function getFlattenedChildDirectoryId(
|
|
22856
|
-
if (
|
|
22857
|
-
const directoryNode =
|
|
22951
|
+
function getFlattenedChildDirectoryId(state2, directoryNodeId) {
|
|
22952
|
+
if (state2.snapshot.options.flattenEmptyDirectories !== true) return null;
|
|
22953
|
+
const directoryNode = state2.snapshot.nodes[directoryNodeId];
|
|
22858
22954
|
if (directoryNode == null || !isDirectoryNode(directoryNode) || hasNodeFlag(directoryNode, 2)) return null;
|
|
22859
|
-
const directoryIndex =
|
|
22955
|
+
const directoryIndex = state2.snapshot.directories.get(directoryNodeId);
|
|
22860
22956
|
if (directoryIndex == null || directoryIndex.childIds.length !== 1) return null;
|
|
22861
22957
|
const childId = directoryIndex.childIds[0];
|
|
22862
22958
|
if (childId == null) return null;
|
|
22863
|
-
const childNode =
|
|
22959
|
+
const childNode = state2.snapshot.nodes[childId];
|
|
22864
22960
|
if (childNode == null || !isDirectoryNode(childNode)) return null;
|
|
22865
22961
|
return childId;
|
|
22866
22962
|
}
|
|
22867
|
-
function getFlattenedTerminalDirectoryId(
|
|
22963
|
+
function getFlattenedTerminalDirectoryId(state2, directoryNodeId) {
|
|
22868
22964
|
let currentDirectoryId = directoryNodeId;
|
|
22869
22965
|
while (true) {
|
|
22870
|
-
const nextDirectoryId = getFlattenedChildDirectoryId(
|
|
22966
|
+
const nextDirectoryId = getFlattenedChildDirectoryId(state2, currentDirectoryId);
|
|
22871
22967
|
if (nextDirectoryId == null) return currentDirectoryId;
|
|
22872
22968
|
currentDirectoryId = nextDirectoryId;
|
|
22873
22969
|
}
|
|
22874
22970
|
}
|
|
22875
|
-
function collectFlattenedDirectoryChainIds(
|
|
22971
|
+
function collectFlattenedDirectoryChainIds(state2, directoryNodeId) {
|
|
22876
22972
|
const chainIds = [directoryNodeId];
|
|
22877
22973
|
let currentDirectoryId = directoryNodeId;
|
|
22878
22974
|
while (true) {
|
|
22879
|
-
const nextDirectoryId = getFlattenedChildDirectoryId(
|
|
22975
|
+
const nextDirectoryId = getFlattenedChildDirectoryId(state2, currentDirectoryId);
|
|
22880
22976
|
if (nextDirectoryId == null) return chainIds;
|
|
22881
22977
|
chainIds.push(nextDirectoryId);
|
|
22882
22978
|
currentDirectoryId = nextDirectoryId;
|
|
@@ -22884,144 +22980,144 @@ function collectFlattenedDirectoryChainIds(state3, directoryNodeId) {
|
|
|
22884
22980
|
}
|
|
22885
22981
|
|
|
22886
22982
|
// node_modules/@pierre/trees/dist/path-store/src/canonical.js
|
|
22887
|
-
function listPaths(
|
|
22888
|
-
const nodeId = path == null ?
|
|
22983
|
+
function listPaths(state2, path) {
|
|
22984
|
+
const nodeId = path == null ? state2.snapshot.rootId : findNodeId(state2, path);
|
|
22889
22985
|
if (nodeId == null) return [];
|
|
22890
|
-
return collectCanonicalEntries(
|
|
22986
|
+
return collectCanonicalEntries(state2, nodeId);
|
|
22891
22987
|
}
|
|
22892
|
-
function addPath(
|
|
22988
|
+
function addPath(state2, path) {
|
|
22893
22989
|
const preparedPath = parseInputPath(path);
|
|
22894
22990
|
const parentSegments = preparedPath.isDirectory ? preparedPath.segments : preparedPath.segments.slice(0, -1);
|
|
22895
|
-
const previousProjectionSignature = getCollapsedProjectionSignature(
|
|
22896
|
-
const { createdNodeIds, directoryId } = ensureDirectoryChain(
|
|
22991
|
+
const previousProjectionSignature = getCollapsedProjectionSignature(state2, findDeepestExistingDirectoryId(state2, parentSegments));
|
|
22992
|
+
const { createdNodeIds, directoryId } = ensureDirectoryChain(state2, parentSegments);
|
|
22897
22993
|
const affectedNodeIds = new Set(createdNodeIds);
|
|
22898
22994
|
let addedNodeId = directoryId;
|
|
22899
22995
|
if (preparedPath.isDirectory) {
|
|
22900
|
-
const directoryNode = requireNode(
|
|
22996
|
+
const directoryNode = requireNode(state2, directoryId);
|
|
22901
22997
|
if (hasNodeFlag(directoryNode, 1)) throw new Error(`Path already exists: "${path}"`);
|
|
22902
22998
|
addNodeFlag(directoryNode, 1);
|
|
22903
|
-
|
|
22999
|
+
state2.pathCacheByNodeId.set(directoryId, {
|
|
22904
23000
|
path,
|
|
22905
|
-
version:
|
|
23001
|
+
version: state2.pathCacheVersion
|
|
22906
23002
|
});
|
|
22907
23003
|
affectedNodeIds.add(directoryId);
|
|
22908
23004
|
} else {
|
|
22909
|
-
addedNodeId = createFileNode(
|
|
23005
|
+
addedNodeId = createFileNode(state2, directoryId, preparedPath.basename);
|
|
22910
23006
|
affectedNodeIds.add(addedNodeId);
|
|
22911
23007
|
}
|
|
22912
|
-
recomputeCountsUpwardFrom(
|
|
22913
|
-
const nextProjectionSignature = getCollapsedProjectionSignature(
|
|
23008
|
+
recomputeCountsUpwardFrom(state2, directoryId);
|
|
23009
|
+
const nextProjectionSignature = getCollapsedProjectionSignature(state2, directoryId);
|
|
22914
23010
|
return createAddEvent({
|
|
22915
|
-
affectedAncestorIds: collectAncestorIds(
|
|
23011
|
+
affectedAncestorIds: collectAncestorIds(state2, addedNodeId),
|
|
22916
23012
|
affectedNodeIds: [...affectedNodeIds],
|
|
22917
23013
|
path,
|
|
22918
23014
|
projectionChanged: didProjectionChange(previousProjectionSignature, nextProjectionSignature)
|
|
22919
23015
|
});
|
|
22920
23016
|
}
|
|
22921
|
-
function removePath(
|
|
22922
|
-
const nodeId = findNodeId(
|
|
23017
|
+
function removePath(state2, path, options) {
|
|
23018
|
+
const nodeId = findNodeId(state2, path);
|
|
22923
23019
|
if (nodeId == null) throw new Error(`Path does not exist: "${path}"`);
|
|
22924
|
-
const node = requireNode(
|
|
23020
|
+
const node = requireNode(state2, nodeId);
|
|
22925
23021
|
if (hasNodeFlag(node, 2)) throw new Error("The root node cannot be removed");
|
|
22926
|
-
if (isDirectoryNode(node) && getDirectoryIndex(
|
|
23022
|
+
if (isDirectoryNode(node) && getDirectoryIndex(state2, nodeId).childIds.length > 0 && options.recursive !== true) throw new Error(`Cannot remove a non-empty directory without recursive: "${path}"`);
|
|
22927
23023
|
const parentId = node.parentId;
|
|
22928
|
-
const previousProjectionSignature = getCollapsedProjectionSignature(
|
|
22929
|
-
const removedNodeIds = removeSubtree(
|
|
22930
|
-
removeChildReference(
|
|
22931
|
-
promoteEmptyAncestorsToExplicit(
|
|
22932
|
-
recomputeCountsUpwardFrom(
|
|
22933
|
-
const nextProjectionSignature = getCollapsedProjectionSignature(
|
|
23024
|
+
const previousProjectionSignature = getCollapsedProjectionSignature(state2, parentId);
|
|
23025
|
+
const removedNodeIds = removeSubtree(state2, nodeId);
|
|
23026
|
+
removeChildReference(state2, parentId, nodeId, node.nameId);
|
|
23027
|
+
promoteEmptyAncestorsToExplicit(state2, parentId);
|
|
23028
|
+
recomputeCountsUpwardFrom(state2, parentId);
|
|
23029
|
+
const nextProjectionSignature = getCollapsedProjectionSignature(state2, parentId);
|
|
22934
23030
|
return createRemoveEvent({
|
|
22935
|
-
affectedAncestorIds: collectAncestorIds(
|
|
23031
|
+
affectedAncestorIds: collectAncestorIds(state2, parentId),
|
|
22936
23032
|
affectedNodeIds: removedNodeIds,
|
|
22937
23033
|
path,
|
|
22938
23034
|
projectionChanged: didProjectionChange(previousProjectionSignature, nextProjectionSignature),
|
|
22939
23035
|
recursive: options.recursive === true
|
|
22940
23036
|
});
|
|
22941
23037
|
}
|
|
22942
|
-
function movePath(
|
|
22943
|
-
const sourceNodeId = findNodeId(
|
|
23038
|
+
function movePath(state2, fromPath, toPath, options) {
|
|
23039
|
+
const sourceNodeId = findNodeId(state2, fromPath);
|
|
22944
23040
|
if (sourceNodeId == null) throw new Error(`Source path does not exist: "${fromPath}"`);
|
|
22945
|
-
const sourceNode = requireNode(
|
|
23041
|
+
const sourceNode = requireNode(state2, sourceNodeId);
|
|
22946
23042
|
if (hasNodeFlag(sourceNode, 2)) throw new Error("The root node cannot be moved");
|
|
22947
23043
|
const collision = options.collision ?? "error";
|
|
22948
|
-
const moveTarget = resolveMoveTarget(
|
|
22949
|
-
const previousSourceProjectionSignature = getCollapsedProjectionSignature(
|
|
22950
|
-
const previousTargetProjectionSignature = getCollapsedProjectionSignature(
|
|
22951
|
-
const sourceName = getSegmentValue(
|
|
22952
|
-
const targetNameId = internSegment(
|
|
23044
|
+
const moveTarget = resolveMoveTarget(state2, sourceNodeId, toPath);
|
|
23045
|
+
const previousSourceProjectionSignature = getCollapsedProjectionSignature(state2, sourceNode.parentId);
|
|
23046
|
+
const previousTargetProjectionSignature = getCollapsedProjectionSignature(state2, moveTarget.parentId);
|
|
23047
|
+
const sourceName = getSegmentValue(state2.snapshot.segmentTable, sourceNode.nameId);
|
|
23048
|
+
const targetNameId = internSegment(state2.snapshot.segmentTable, moveTarget.basename);
|
|
22953
23049
|
if (moveTarget.parentId === sourceNode.parentId && sourceName === moveTarget.basename) return null;
|
|
22954
|
-
if (isDirectoryNode(sourceNode) && isAncestor(
|
|
22955
|
-
const siblingCollisionId = ensureChildIdByNameId(
|
|
23050
|
+
if (isDirectoryNode(sourceNode) && isAncestor(state2, sourceNodeId, moveTarget.parentId)) throw new Error("Cannot move a directory into one of its descendants");
|
|
23051
|
+
const siblingCollisionId = ensureChildIdByNameId(state2.snapshot.nodes, getDirectoryIndex(state2, moveTarget.parentId)).get(targetNameId);
|
|
22956
23052
|
const collisionNodeId = moveTarget.existingNodeId ?? siblingCollisionId ?? null;
|
|
22957
23053
|
if (collisionNodeId != null && collisionNodeId !== sourceNodeId) {
|
|
22958
|
-
if (handleMoveCollision(
|
|
23054
|
+
if (handleMoveCollision(state2, collisionNodeId, collision, getNodeKind(sourceNode)) === "skip") return null;
|
|
22959
23055
|
}
|
|
22960
23056
|
const previousParentId = sourceNode.parentId;
|
|
22961
|
-
removeChildReference(
|
|
23057
|
+
removeChildReference(state2, previousParentId, sourceNodeId, sourceNode.nameId);
|
|
22962
23058
|
sourceNode.parentId = moveTarget.parentId;
|
|
22963
23059
|
sourceNode.nameId = targetNameId;
|
|
22964
|
-
|
|
22965
|
-
recomputeDepths(
|
|
22966
|
-
insertChildReference(
|
|
22967
|
-
promoteEmptyAncestorsToExplicit(
|
|
22968
|
-
|
|
22969
|
-
recomputeCountsUpwardFrom(
|
|
22970
|
-
if (moveTarget.parentId !== previousParentId) recomputeCountsUpwardFrom(
|
|
22971
|
-
const nextSourceProjectionSignature = getCollapsedProjectionSignature(
|
|
22972
|
-
const nextTargetProjectionSignature = getCollapsedProjectionSignature(
|
|
23060
|
+
state2.pathCacheByNodeId.delete(sourceNodeId);
|
|
23061
|
+
recomputeDepths(state2, sourceNodeId);
|
|
23062
|
+
insertChildReference(state2, moveTarget.parentId, sourceNodeId);
|
|
23063
|
+
promoteEmptyAncestorsToExplicit(state2, previousParentId);
|
|
23064
|
+
state2.pathCacheVersion++;
|
|
23065
|
+
recomputeCountsUpwardFrom(state2, previousParentId);
|
|
23066
|
+
if (moveTarget.parentId !== previousParentId) recomputeCountsUpwardFrom(state2, moveTarget.parentId);
|
|
23067
|
+
const nextSourceProjectionSignature = getCollapsedProjectionSignature(state2, previousParentId);
|
|
23068
|
+
const nextTargetProjectionSignature = getCollapsedProjectionSignature(state2, moveTarget.parentId);
|
|
22973
23069
|
return createMoveEvent({
|
|
22974
|
-
affectedAncestorIds: [.../* @__PURE__ */ new Set([...collectAncestorIds(
|
|
23070
|
+
affectedAncestorIds: [.../* @__PURE__ */ new Set([...collectAncestorIds(state2, previousParentId), ...collectAncestorIds(state2, moveTarget.parentId)])],
|
|
22975
23071
|
affectedNodeIds: [sourceNodeId],
|
|
22976
23072
|
from: fromPath,
|
|
22977
23073
|
projectionChanged: didAnyProjectionChange([previousSourceProjectionSignature, previousTargetProjectionSignature], [nextSourceProjectionSignature, nextTargetProjectionSignature]),
|
|
22978
|
-
to: materializeNodePath(
|
|
23074
|
+
to: materializeNodePath(state2, sourceNodeId)
|
|
22979
23075
|
});
|
|
22980
23076
|
}
|
|
22981
|
-
function getCachedNodePath(
|
|
22982
|
-
const cachedEntry =
|
|
22983
|
-
return cachedEntry != null && cachedEntry.version ===
|
|
23077
|
+
function getCachedNodePath(state2, nodeId) {
|
|
23078
|
+
const cachedEntry = state2.pathCacheByNodeId.get(nodeId);
|
|
23079
|
+
return cachedEntry != null && cachedEntry.version === state2.pathCacheVersion ? cachedEntry.path : null;
|
|
22984
23080
|
}
|
|
22985
|
-
function setCachedNodePath(
|
|
22986
|
-
|
|
23081
|
+
function setCachedNodePath(state2, nodeId, path) {
|
|
23082
|
+
state2.pathCacheByNodeId.set(nodeId, {
|
|
22987
23083
|
path,
|
|
22988
|
-
version:
|
|
23084
|
+
version: state2.pathCacheVersion
|
|
22989
23085
|
});
|
|
22990
23086
|
return path;
|
|
22991
23087
|
}
|
|
22992
|
-
function materializeNodePath(
|
|
22993
|
-
const node = requireNode(
|
|
22994
|
-
const cachedPath = getCachedNodePath(
|
|
23088
|
+
function materializeNodePath(state2, nodeId) {
|
|
23089
|
+
const node = requireNode(state2, nodeId);
|
|
23090
|
+
const cachedPath = getCachedNodePath(state2, nodeId);
|
|
22995
23091
|
if (cachedPath != null) return cachedPath;
|
|
22996
|
-
if (hasNodeFlag(node, 2)) return setCachedNodePath(
|
|
22997
|
-
const parentPath = materializeNodePath(
|
|
22998
|
-
const nodeName = getSegmentValue(
|
|
23092
|
+
if (hasNodeFlag(node, 2)) return setCachedNodePath(state2, nodeId, "");
|
|
23093
|
+
const parentPath = materializeNodePath(state2, node.parentId);
|
|
23094
|
+
const nodeName = getSegmentValue(state2.snapshot.segmentTable, node.nameId);
|
|
22999
23095
|
const path = parentPath.length === 0 ? nodeName : `${parentPath}${nodeName}`;
|
|
23000
|
-
return setCachedNodePath(
|
|
23096
|
+
return setCachedNodePath(state2, nodeId, isDirectoryNode(node) ? `${path}/` : path);
|
|
23001
23097
|
}
|
|
23002
|
-
function recomputeCountsUpwardFrom(
|
|
23003
|
-
const instrumentation =
|
|
23098
|
+
function recomputeCountsUpwardFrom(state2, startNodeId) {
|
|
23099
|
+
const instrumentation = state2.instrumentation;
|
|
23004
23100
|
if (instrumentation == null) {
|
|
23005
|
-
recomputeCountsUpwardFromNow(
|
|
23101
|
+
recomputeCountsUpwardFromNow(state2, startNodeId);
|
|
23006
23102
|
return;
|
|
23007
23103
|
}
|
|
23008
|
-
withBenchmarkPhase(instrumentation, "store.recomputeCountsUpwardFrom", () => recomputeCountsUpwardFromNow(
|
|
23104
|
+
withBenchmarkPhase(instrumentation, "store.recomputeCountsUpwardFrom", () => recomputeCountsUpwardFromNow(state2, startNodeId));
|
|
23009
23105
|
}
|
|
23010
|
-
function recomputeCountsRecursive(
|
|
23106
|
+
function recomputeCountsRecursive(state2, nodeId) {
|
|
23011
23107
|
const stack = [[nodeId, 0]];
|
|
23012
|
-
const { nodes, directories } =
|
|
23108
|
+
const { nodes, directories } = state2.snapshot;
|
|
23013
23109
|
while (stack.length > 0) {
|
|
23014
23110
|
const frame = stack[stack.length - 1];
|
|
23015
23111
|
const nid = frame[0];
|
|
23016
23112
|
const node = nodes[nid];
|
|
23017
23113
|
if (node == null || !isDirectoryNode(node)) {
|
|
23018
|
-
recomputeNodeCounts(
|
|
23114
|
+
recomputeNodeCounts(state2, nid, node, true);
|
|
23019
23115
|
stack.pop();
|
|
23020
23116
|
continue;
|
|
23021
23117
|
}
|
|
23022
23118
|
const dirIndex = directories.get(nid);
|
|
23023
23119
|
if (dirIndex == null || frame[1] >= dirIndex.childIds.length) {
|
|
23024
|
-
recomputeNodeCounts(
|
|
23120
|
+
recomputeNodeCounts(state2, nid, node, true);
|
|
23025
23121
|
stack.pop();
|
|
23026
23122
|
continue;
|
|
23027
23123
|
}
|
|
@@ -23029,51 +23125,51 @@ function recomputeCountsRecursive(state3, nodeId) {
|
|
|
23029
23125
|
stack.push([childId, 0]);
|
|
23030
23126
|
}
|
|
23031
23127
|
}
|
|
23032
|
-
function collectAncestorIds(
|
|
23128
|
+
function collectAncestorIds(state2, nodeId) {
|
|
23033
23129
|
const ancestorIds = [];
|
|
23034
23130
|
let currentNodeId = nodeId;
|
|
23035
23131
|
while (currentNodeId != null) {
|
|
23036
|
-
const currentNode = requireNode(
|
|
23132
|
+
const currentNode = requireNode(state2, currentNodeId);
|
|
23037
23133
|
ancestorIds.push(currentNodeId);
|
|
23038
|
-
if (currentNodeId ===
|
|
23134
|
+
if (currentNodeId === state2.snapshot.rootId) break;
|
|
23039
23135
|
currentNodeId = currentNode.parentId;
|
|
23040
23136
|
}
|
|
23041
23137
|
return ancestorIds;
|
|
23042
23138
|
}
|
|
23043
|
-
function findNodeId(
|
|
23044
|
-
if (path.length === 0) return
|
|
23139
|
+
function findNodeId(state2, path) {
|
|
23140
|
+
if (path.length === 0) return state2.snapshot.rootId;
|
|
23045
23141
|
const lookupPath = parseLookupPath(path);
|
|
23046
|
-
return findNodeIdBySegments(
|
|
23142
|
+
return findNodeIdBySegments(state2, lookupPath.segments, lookupPath.requiresDirectory);
|
|
23047
23143
|
}
|
|
23048
|
-
function findNodeIdBySegments(
|
|
23049
|
-
let currentNodeId =
|
|
23144
|
+
function findNodeIdBySegments(state2, segments, requireDirectory) {
|
|
23145
|
+
let currentNodeId = state2.snapshot.rootId;
|
|
23050
23146
|
for (const segment2 of segments) {
|
|
23051
|
-
const segmentId =
|
|
23147
|
+
const segmentId = state2.snapshot.segmentTable.idByValue.get(segment2);
|
|
23052
23148
|
if (segmentId === void 0) return null;
|
|
23053
|
-
const currentIndex = getDirectoryIndex(
|
|
23054
|
-
const nextNodeId = ensureChildIdByNameId(
|
|
23149
|
+
const currentIndex = getDirectoryIndex(state2, currentNodeId);
|
|
23150
|
+
const nextNodeId = ensureChildIdByNameId(state2.snapshot.nodes, currentIndex).get(segmentId);
|
|
23055
23151
|
if (nextNodeId === void 0) return null;
|
|
23056
23152
|
currentNodeId = nextNodeId;
|
|
23057
23153
|
}
|
|
23058
|
-
const currentNode = requireNode(
|
|
23154
|
+
const currentNode = requireNode(state2, currentNodeId);
|
|
23059
23155
|
if (requireDirectory && !isDirectoryNode(currentNode)) return null;
|
|
23060
23156
|
return currentNodeId;
|
|
23061
23157
|
}
|
|
23062
|
-
function getDirectoryIndex(
|
|
23063
|
-
const directoryIndex =
|
|
23158
|
+
function getDirectoryIndex(state2, directoryId) {
|
|
23159
|
+
const directoryIndex = state2.snapshot.directories.get(directoryId);
|
|
23064
23160
|
if (directoryIndex === void 0) throw new Error(`Unknown directory child index for node ${String(directoryId)}`);
|
|
23065
23161
|
return directoryIndex;
|
|
23066
23162
|
}
|
|
23067
|
-
function requireNode(
|
|
23068
|
-
const node =
|
|
23163
|
+
function requireNode(state2, nodeId) {
|
|
23164
|
+
const node = state2.snapshot.nodes[nodeId];
|
|
23069
23165
|
if (node === void 0 || hasNodeFlag(node, 4)) throw new Error(`Unknown node ID: ${String(nodeId)}`);
|
|
23070
23166
|
return node;
|
|
23071
23167
|
}
|
|
23072
|
-
function collectCanonicalEntries(
|
|
23073
|
-
const rootNode =
|
|
23168
|
+
function collectCanonicalEntries(state2, nodeId) {
|
|
23169
|
+
const rootNode = state2.snapshot.nodes[nodeId];
|
|
23074
23170
|
if (rootNode === void 0 || hasNodeFlag(rootNode, 4)) return [];
|
|
23075
|
-
if (!isDirectoryNode(rootNode)) return [materializeNodePath(
|
|
23076
|
-
if (getDirectoryIndex(
|
|
23171
|
+
if (!isDirectoryNode(rootNode)) return [materializeNodePath(state2, nodeId)];
|
|
23172
|
+
if (getDirectoryIndex(state2, nodeId).childIds.length === 0) return hasNodeFlag(rootNode, 1) && !hasNodeFlag(rootNode, 2) ? [materializeNodePath(state2, nodeId)] : [];
|
|
23077
23173
|
const entries = [];
|
|
23078
23174
|
const stack = [{
|
|
23079
23175
|
childIndex: 0,
|
|
@@ -23082,19 +23178,19 @@ function collectCanonicalEntries(state3, nodeId) {
|
|
|
23082
23178
|
while (stack.length > 0) {
|
|
23083
23179
|
const frame = stack[stack.length - 1];
|
|
23084
23180
|
if (frame == null) break;
|
|
23085
|
-
const currentNode =
|
|
23181
|
+
const currentNode = state2.snapshot.nodes[frame.nodeId];
|
|
23086
23182
|
if (currentNode === void 0 || hasNodeFlag(currentNode, 4)) {
|
|
23087
23183
|
stack.pop();
|
|
23088
23184
|
continue;
|
|
23089
23185
|
}
|
|
23090
23186
|
if (!isDirectoryNode(currentNode)) {
|
|
23091
|
-
entries.push(materializeNodePath(
|
|
23187
|
+
entries.push(materializeNodePath(state2, frame.nodeId));
|
|
23092
23188
|
stack.pop();
|
|
23093
23189
|
continue;
|
|
23094
23190
|
}
|
|
23095
|
-
const currentIndex = getDirectoryIndex(
|
|
23191
|
+
const currentIndex = getDirectoryIndex(state2, frame.nodeId);
|
|
23096
23192
|
if (currentIndex.childIds.length === 0) {
|
|
23097
|
-
if (hasNodeFlag(currentNode, 1) && !hasNodeFlag(currentNode, 2)) entries.push(materializeNodePath(
|
|
23193
|
+
if (hasNodeFlag(currentNode, 1) && !hasNodeFlag(currentNode, 2)) entries.push(materializeNodePath(state2, frame.nodeId));
|
|
23098
23194
|
stack.pop();
|
|
23099
23195
|
continue;
|
|
23100
23196
|
}
|
|
@@ -23111,19 +23207,19 @@ function collectCanonicalEntries(state3, nodeId) {
|
|
|
23111
23207
|
}
|
|
23112
23208
|
return entries;
|
|
23113
23209
|
}
|
|
23114
|
-
function ensureDirectoryChain(
|
|
23210
|
+
function ensureDirectoryChain(state2, directorySegments) {
|
|
23115
23211
|
const createdNodeIds = [];
|
|
23116
|
-
let currentDirectoryId =
|
|
23212
|
+
let currentDirectoryId = state2.snapshot.rootId;
|
|
23117
23213
|
for (const segment2 of directorySegments) {
|
|
23118
|
-
const segmentId = internSegment(
|
|
23119
|
-
const currentIndex = getDirectoryIndex(
|
|
23120
|
-
const existingChildId = ensureChildIdByNameId(
|
|
23214
|
+
const segmentId = internSegment(state2.snapshot.segmentTable, segment2);
|
|
23215
|
+
const currentIndex = getDirectoryIndex(state2, currentDirectoryId);
|
|
23216
|
+
const existingChildId = ensureChildIdByNameId(state2.snapshot.nodes, currentIndex).get(segmentId);
|
|
23121
23217
|
if (existingChildId !== void 0) {
|
|
23122
|
-
if (!isDirectoryNode(requireNode(
|
|
23218
|
+
if (!isDirectoryNode(requireNode(state2, existingChildId))) throw new Error(`Cannot create a directory that collides with an existing file: "${segment2}"`);
|
|
23123
23219
|
currentDirectoryId = existingChildId;
|
|
23124
23220
|
continue;
|
|
23125
23221
|
}
|
|
23126
|
-
currentDirectoryId = createDirectoryNode(
|
|
23222
|
+
currentDirectoryId = createDirectoryNode(state2, currentDirectoryId, segmentId);
|
|
23127
23223
|
createdNodeIds.push(currentDirectoryId);
|
|
23128
23224
|
}
|
|
23129
23225
|
return {
|
|
@@ -23131,43 +23227,43 @@ function ensureDirectoryChain(state3, directorySegments) {
|
|
|
23131
23227
|
directoryId: currentDirectoryId
|
|
23132
23228
|
};
|
|
23133
23229
|
}
|
|
23134
|
-
function createDirectoryNode(
|
|
23135
|
-
const parentNode = requireNode(
|
|
23136
|
-
const nodeId =
|
|
23137
|
-
|
|
23230
|
+
function createDirectoryNode(state2, parentId, nameId) {
|
|
23231
|
+
const parentNode = requireNode(state2, parentId);
|
|
23232
|
+
const nodeId = state2.snapshot.nodes.length;
|
|
23233
|
+
state2.snapshot.nodes.push({
|
|
23138
23234
|
depthAndFlags: createNodeDepthAndFlags(getNodeDepth(parentNode) + 1, 0, 1),
|
|
23139
23235
|
nameId,
|
|
23140
23236
|
parentId,
|
|
23141
23237
|
subtreeNodeCount: 1,
|
|
23142
23238
|
visibleSubtreeCount: 1
|
|
23143
23239
|
});
|
|
23144
|
-
|
|
23145
|
-
insertChildReference(
|
|
23146
|
-
if (
|
|
23147
|
-
|
|
23148
|
-
|
|
23240
|
+
state2.snapshot.directories.set(nodeId, createDirectoryChildIndex());
|
|
23241
|
+
insertChildReference(state2, parentId, nodeId);
|
|
23242
|
+
if (state2.collapseNewDirectoriesByDefault) {
|
|
23243
|
+
state2.collapsedDirectoryIds.add(nodeId);
|
|
23244
|
+
state2.hasCollapsedDirectoryOverrides = true;
|
|
23149
23245
|
}
|
|
23150
|
-
|
|
23246
|
+
state2.activeNodeCount++;
|
|
23151
23247
|
return nodeId;
|
|
23152
23248
|
}
|
|
23153
|
-
function createFileNode(
|
|
23154
|
-
const nameId = internSegment(
|
|
23155
|
-
const parentIndex = getDirectoryIndex(
|
|
23156
|
-
if (ensureChildIdByNameId(
|
|
23157
|
-
const parentNode = requireNode(
|
|
23158
|
-
const nodeId =
|
|
23159
|
-
|
|
23249
|
+
function createFileNode(state2, parentId, basename3) {
|
|
23250
|
+
const nameId = internSegment(state2.snapshot.segmentTable, basename3);
|
|
23251
|
+
const parentIndex = getDirectoryIndex(state2, parentId);
|
|
23252
|
+
if (ensureChildIdByNameId(state2.snapshot.nodes, parentIndex).has(nameId)) throw new Error(`Path already exists: "${buildPathPreview(state2, parentId, basename3)}"`);
|
|
23253
|
+
const parentNode = requireNode(state2, parentId);
|
|
23254
|
+
const nodeId = state2.snapshot.nodes.length;
|
|
23255
|
+
state2.snapshot.nodes.push({
|
|
23160
23256
|
depthAndFlags: createNodeDepthAndFlags(getNodeDepth(parentNode) + 1, 0),
|
|
23161
23257
|
nameId,
|
|
23162
23258
|
parentId,
|
|
23163
23259
|
subtreeNodeCount: 1,
|
|
23164
23260
|
visibleSubtreeCount: 1
|
|
23165
23261
|
});
|
|
23166
|
-
insertChildReference(
|
|
23167
|
-
|
|
23262
|
+
insertChildReference(state2, parentId, nodeId);
|
|
23263
|
+
state2.activeNodeCount++;
|
|
23168
23264
|
return nodeId;
|
|
23169
23265
|
}
|
|
23170
|
-
function findChildInsertIndex(
|
|
23266
|
+
function findChildInsertIndex(state2, parentIndex, childId) {
|
|
23171
23267
|
let low = 0;
|
|
23172
23268
|
let high = parentIndex.childIds.length;
|
|
23173
23269
|
while (low < high) {
|
|
@@ -23177,72 +23273,72 @@ function findChildInsertIndex(state3, parentIndex, childId) {
|
|
|
23177
23273
|
high = middle;
|
|
23178
23274
|
continue;
|
|
23179
23275
|
}
|
|
23180
|
-
if (compareSiblingNodes(
|
|
23276
|
+
if (compareSiblingNodes(state2, childId, existingChildId) < 0) high = middle;
|
|
23181
23277
|
else low = middle + 1;
|
|
23182
23278
|
}
|
|
23183
23279
|
return low;
|
|
23184
23280
|
}
|
|
23185
|
-
function insertChildReference(
|
|
23186
|
-
const parentIndex = getDirectoryIndex(
|
|
23187
|
-
const childNode = requireNode(
|
|
23188
|
-
ensureChildIdByNameId(
|
|
23281
|
+
function insertChildReference(state2, parentId, childId) {
|
|
23282
|
+
const parentIndex = getDirectoryIndex(state2, parentId);
|
|
23283
|
+
const childNode = requireNode(state2, childId);
|
|
23284
|
+
ensureChildIdByNameId(state2.snapshot.nodes, parentIndex).set(childNode.nameId, childId);
|
|
23189
23285
|
applyChildAggregateDelta(parentIndex, childId, childNode.subtreeNodeCount, childNode.visibleSubtreeCount);
|
|
23190
|
-
const insertIndex = findChildInsertIndex(
|
|
23286
|
+
const insertIndex = findChildInsertIndex(state2, parentIndex, childId);
|
|
23191
23287
|
parentIndex.childIds.splice(insertIndex, 0, childId);
|
|
23192
23288
|
updateChildPositionsFrom(parentIndex, insertIndex);
|
|
23193
|
-
rebuildVisibleChildChunks(
|
|
23289
|
+
rebuildVisibleChildChunks(state2.snapshot.nodes, parentIndex);
|
|
23194
23290
|
}
|
|
23195
|
-
function removeChildReference(
|
|
23196
|
-
const parentIndex = getDirectoryIndex(
|
|
23291
|
+
function removeChildReference(state2, parentId, childId, childNameId) {
|
|
23292
|
+
const parentIndex = getDirectoryIndex(state2, parentId);
|
|
23197
23293
|
const positions2 = ensureChildPositions(parentIndex);
|
|
23198
23294
|
const childIndex = positions2.get(childId) ?? -1;
|
|
23199
|
-
ensureChildIdByNameId(
|
|
23295
|
+
ensureChildIdByNameId(state2.snapshot.nodes, parentIndex).delete(childNameId);
|
|
23200
23296
|
positions2.delete(childId);
|
|
23201
|
-
const childNode =
|
|
23297
|
+
const childNode = state2.snapshot.nodes[childId];
|
|
23202
23298
|
if (childNode != null) applyChildAggregateDelta(parentIndex, childId, -childNode.subtreeNodeCount, -childNode.visibleSubtreeCount);
|
|
23203
23299
|
if (childIndex >= 0) {
|
|
23204
23300
|
parentIndex.childIds.splice(childIndex, 1);
|
|
23205
23301
|
updateChildPositionsFrom(parentIndex, childIndex);
|
|
23206
|
-
rebuildVisibleChildChunks(
|
|
23302
|
+
rebuildVisibleChildChunks(state2.snapshot.nodes, parentIndex);
|
|
23207
23303
|
}
|
|
23208
23304
|
}
|
|
23209
|
-
function compareSiblingNodes(
|
|
23210
|
-
const sortOption =
|
|
23211
|
-
if (sortOption === "default") return compareSiblingNodesDefault(
|
|
23212
|
-
return sortOption(createCompareEntry2(
|
|
23305
|
+
function compareSiblingNodes(state2, leftId, rightId) {
|
|
23306
|
+
const sortOption = state2.snapshot.options.sort;
|
|
23307
|
+
if (sortOption === "default") return compareSiblingNodesDefault(state2, leftId, rightId);
|
|
23308
|
+
return sortOption(createCompareEntry2(state2, leftId), createCompareEntry2(state2, rightId));
|
|
23213
23309
|
}
|
|
23214
|
-
function compareSiblingNodesDefault(
|
|
23215
|
-
const leftNode = requireNode(
|
|
23216
|
-
const rightNode = requireNode(
|
|
23310
|
+
function compareSiblingNodesDefault(state2, leftId, rightId) {
|
|
23311
|
+
const leftNode = requireNode(state2, leftId);
|
|
23312
|
+
const rightNode = requireNode(state2, rightId);
|
|
23217
23313
|
const leftIsDirectory = isDirectoryNode(leftNode);
|
|
23218
23314
|
if (leftIsDirectory !== isDirectoryNode(rightNode)) return leftIsDirectory ? -1 : 1;
|
|
23219
|
-
const comparison = compareSegmentSortKeys(getSegmentSortKey(
|
|
23315
|
+
const comparison = compareSegmentSortKeys(getSegmentSortKey(state2.snapshot.segmentTable, leftNode.nameId), getSegmentSortKey(state2.snapshot.segmentTable, rightNode.nameId));
|
|
23220
23316
|
if (comparison !== 0) return comparison;
|
|
23221
|
-
const leftName = getSegmentValue(
|
|
23222
|
-
const rightName = getSegmentValue(
|
|
23317
|
+
const leftName = getSegmentValue(state2.snapshot.segmentTable, leftNode.nameId);
|
|
23318
|
+
const rightName = getSegmentValue(state2.snapshot.segmentTable, rightNode.nameId);
|
|
23223
23319
|
if (leftName !== rightName) return leftName < rightName ? -1 : 1;
|
|
23224
23320
|
return leftId < rightId ? -1 : 1;
|
|
23225
23321
|
}
|
|
23226
|
-
function createCompareEntry2(
|
|
23227
|
-
const node = requireNode(
|
|
23228
|
-
const path = materializeNodePath(
|
|
23322
|
+
function createCompareEntry2(state2, nodeId) {
|
|
23323
|
+
const node = requireNode(state2, nodeId);
|
|
23324
|
+
const path = materializeNodePath(state2, nodeId);
|
|
23229
23325
|
const isDirectory = isDirectoryNode(node);
|
|
23230
23326
|
const normalizedPath = isDirectory ? path.slice(0, -1) : path;
|
|
23231
23327
|
return {
|
|
23232
|
-
basename: getSegmentValue(
|
|
23328
|
+
basename: getSegmentValue(state2.snapshot.segmentTable, node.nameId),
|
|
23233
23329
|
depth: getNodeDepth(node),
|
|
23234
23330
|
isDirectory,
|
|
23235
23331
|
path,
|
|
23236
23332
|
segments: normalizedPath.length === 0 ? [] : normalizedPath.split("/")
|
|
23237
23333
|
};
|
|
23238
23334
|
}
|
|
23239
|
-
function resolveMoveTarget(
|
|
23240
|
-
const sourceNode = requireNode(
|
|
23241
|
-
const existingDestinationId = findNodeId(
|
|
23335
|
+
function resolveMoveTarget(state2, sourceNodeId, toPath) {
|
|
23336
|
+
const sourceNode = requireNode(state2, sourceNodeId);
|
|
23337
|
+
const existingDestinationId = findNodeId(state2, toPath);
|
|
23242
23338
|
if (existingDestinationId != null) {
|
|
23243
|
-
const existingDestination = requireNode(
|
|
23339
|
+
const existingDestination = requireNode(state2, existingDestinationId);
|
|
23244
23340
|
if (isDirectoryNode(existingDestination)) return {
|
|
23245
|
-
basename: getSegmentValue(
|
|
23341
|
+
basename: getSegmentValue(state2.snapshot.segmentTable, sourceNode.nameId),
|
|
23246
23342
|
existingNodeId: null,
|
|
23247
23343
|
parentId: existingDestinationId
|
|
23248
23344
|
};
|
|
@@ -23256,7 +23352,7 @@ function resolveMoveTarget(state3, sourceNodeId, toPath) {
|
|
|
23256
23352
|
const destinationLookup = parseLookupPath(toPath);
|
|
23257
23353
|
const basename3 = destinationLookup.segments[destinationLookup.segments.length - 1] ?? "";
|
|
23258
23354
|
const parentSegments = destinationLookup.segments.slice(0, -1);
|
|
23259
|
-
const parentId = parentSegments.length === 0 ?
|
|
23355
|
+
const parentId = parentSegments.length === 0 ? state2.snapshot.rootId : findNodeIdBySegments(state2, parentSegments, true);
|
|
23260
23356
|
if (parentId == null) throw new Error(`Destination parent does not exist: "${toPath}"`);
|
|
23261
23357
|
return {
|
|
23262
23358
|
basename: basename3,
|
|
@@ -23264,21 +23360,21 @@ function resolveMoveTarget(state3, sourceNodeId, toPath) {
|
|
|
23264
23360
|
parentId
|
|
23265
23361
|
};
|
|
23266
23362
|
}
|
|
23267
|
-
function handleMoveCollision(
|
|
23363
|
+
function handleMoveCollision(state2, collisionNodeId, strategy, sourceKind) {
|
|
23268
23364
|
if (strategy === "skip") return "skip";
|
|
23269
|
-
if (strategy === "error") throw new Error(`Destination already exists: "${materializeNodePath(
|
|
23270
|
-
const collisionNode = requireNode(
|
|
23365
|
+
if (strategy === "error") throw new Error(`Destination already exists: "${materializeNodePath(state2, collisionNodeId)}"`);
|
|
23366
|
+
const collisionNode = requireNode(state2, collisionNodeId);
|
|
23271
23367
|
if (getNodeKind(collisionNode) !== sourceKind) throw new Error("replace collision requires the same source and destination kinds");
|
|
23272
|
-
if (isDirectoryNode(collisionNode) && getDirectoryIndex(
|
|
23368
|
+
if (isDirectoryNode(collisionNode) && getDirectoryIndex(state2, collisionNodeId).childIds.length > 0) throw new Error("replace collision does not support non-empty directories");
|
|
23273
23369
|
const collisionParentId = collisionNode.parentId;
|
|
23274
23370
|
const collisionNameId = collisionNode.nameId;
|
|
23275
|
-
removeSubtree(
|
|
23276
|
-
removeChildReference(
|
|
23277
|
-
promoteEmptyAncestorsToExplicit(
|
|
23278
|
-
recomputeCountsUpwardFrom(
|
|
23371
|
+
removeSubtree(state2, collisionNodeId);
|
|
23372
|
+
removeChildReference(state2, collisionParentId, collisionNodeId, collisionNameId);
|
|
23373
|
+
promoteEmptyAncestorsToExplicit(state2, collisionParentId);
|
|
23374
|
+
recomputeCountsUpwardFrom(state2, collisionParentId);
|
|
23279
23375
|
return "handled";
|
|
23280
23376
|
}
|
|
23281
|
-
function removeSubtree(
|
|
23377
|
+
function removeSubtree(state2, nodeId) {
|
|
23282
23378
|
const removedNodeIds = [];
|
|
23283
23379
|
const stack = [{
|
|
23284
23380
|
nodeId,
|
|
@@ -23287,15 +23383,15 @@ function removeSubtree(state3, nodeId) {
|
|
|
23287
23383
|
while (stack.length > 0) {
|
|
23288
23384
|
const frame = stack.pop();
|
|
23289
23385
|
if (frame == null) break;
|
|
23290
|
-
const node = requireNode(
|
|
23386
|
+
const node = requireNode(state2, frame.nodeId);
|
|
23291
23387
|
if (frame.visitedChildren || !isDirectoryNode(node)) {
|
|
23292
|
-
if (isDirectoryNode(node))
|
|
23388
|
+
if (isDirectoryNode(node)) state2.snapshot.directories.delete(frame.nodeId);
|
|
23293
23389
|
addNodeFlag(node, 4);
|
|
23294
|
-
|
|
23295
|
-
if (
|
|
23296
|
-
|
|
23297
|
-
clearDirectoryLoadInfo(
|
|
23298
|
-
|
|
23390
|
+
state2.pathCacheByNodeId.delete(frame.nodeId);
|
|
23391
|
+
if (state2.collapsedDirectoryIds.delete(frame.nodeId)) state2.hasCollapsedDirectoryOverrides = state2.collapsedDirectoryIds.size > 0;
|
|
23392
|
+
state2.expandedDirectoryIds.delete(frame.nodeId);
|
|
23393
|
+
clearDirectoryLoadInfo(state2, frame.nodeId);
|
|
23394
|
+
state2.activeNodeCount--;
|
|
23299
23395
|
removedNodeIds.push(frame.nodeId);
|
|
23300
23396
|
continue;
|
|
23301
23397
|
}
|
|
@@ -23303,7 +23399,7 @@ function removeSubtree(state3, nodeId) {
|
|
|
23303
23399
|
nodeId: frame.nodeId,
|
|
23304
23400
|
visitedChildren: true
|
|
23305
23401
|
});
|
|
23306
|
-
const directoryIndex = getDirectoryIndex(
|
|
23402
|
+
const directoryIndex = getDirectoryIndex(state2, frame.nodeId);
|
|
23307
23403
|
for (let childIndex = directoryIndex.childIds.length - 1; childIndex >= 0; childIndex--) {
|
|
23308
23404
|
const childId = directoryIndex.childIds[childIndex];
|
|
23309
23405
|
if (childId != null) stack.push({
|
|
@@ -23314,38 +23410,38 @@ function removeSubtree(state3, nodeId) {
|
|
|
23314
23410
|
}
|
|
23315
23411
|
return removedNodeIds;
|
|
23316
23412
|
}
|
|
23317
|
-
function promoteEmptyAncestorsToExplicit(
|
|
23413
|
+
function promoteEmptyAncestorsToExplicit(state2, startDirectoryId) {
|
|
23318
23414
|
let currentDirectoryId = startDirectoryId;
|
|
23319
23415
|
while (currentDirectoryId != null) {
|
|
23320
|
-
const currentNode = requireNode(
|
|
23416
|
+
const currentNode = requireNode(state2, currentDirectoryId);
|
|
23321
23417
|
if (!isDirectoryNode(currentNode) || hasNodeFlag(currentNode, 2)) return;
|
|
23322
|
-
if (getDirectoryIndex(
|
|
23418
|
+
if (getDirectoryIndex(state2, currentDirectoryId).childIds.length > 0) return;
|
|
23323
23419
|
addNodeFlag(currentNode, 1);
|
|
23324
23420
|
currentDirectoryId = currentNode.parentId === currentDirectoryId ? null : currentNode.parentId;
|
|
23325
23421
|
}
|
|
23326
23422
|
}
|
|
23327
|
-
function findDeepestExistingDirectoryId(
|
|
23328
|
-
let currentDirectoryId =
|
|
23423
|
+
function findDeepestExistingDirectoryId(state2, segments) {
|
|
23424
|
+
let currentDirectoryId = state2.snapshot.rootId;
|
|
23329
23425
|
for (const segment2 of segments) {
|
|
23330
|
-
const segmentId =
|
|
23426
|
+
const segmentId = state2.snapshot.segmentTable.idByValue.get(segment2);
|
|
23331
23427
|
if (segmentId == null) break;
|
|
23332
|
-
const nextNodeId = ensureChildIdByNameId(
|
|
23428
|
+
const nextNodeId = ensureChildIdByNameId(state2.snapshot.nodes, getDirectoryIndex(state2, currentDirectoryId)).get(segmentId);
|
|
23333
23429
|
if (nextNodeId == null) break;
|
|
23334
|
-
if (!isDirectoryNode(requireNode(
|
|
23430
|
+
if (!isDirectoryNode(requireNode(state2, nextNodeId))) break;
|
|
23335
23431
|
currentDirectoryId = nextNodeId;
|
|
23336
23432
|
}
|
|
23337
23433
|
return currentDirectoryId;
|
|
23338
23434
|
}
|
|
23339
|
-
function getCollapsedProjectionSignature(
|
|
23340
|
-
const collapsedAncestorId = findNearestCollapsedAncestor(
|
|
23435
|
+
function getCollapsedProjectionSignature(state2, startDirectoryId) {
|
|
23436
|
+
const collapsedAncestorId = findNearestCollapsedAncestor(state2, startDirectoryId);
|
|
23341
23437
|
if (collapsedAncestorId == null) return null;
|
|
23342
|
-
const terminalDirectoryId = getFlattenedTerminalDirectoryId(
|
|
23343
|
-
const terminalNode = requireNode(
|
|
23344
|
-
const flattenedSegmentPaths = collapsedAncestorId === terminalDirectoryId ? null : collectFlattenedDirectoryChainIds(
|
|
23438
|
+
const terminalDirectoryId = getFlattenedTerminalDirectoryId(state2, collapsedAncestorId);
|
|
23439
|
+
const terminalNode = requireNode(state2, terminalDirectoryId);
|
|
23440
|
+
const flattenedSegmentPaths = collapsedAncestorId === terminalDirectoryId ? null : collectFlattenedDirectoryChainIds(state2, collapsedAncestorId).map((nodeId) => materializeNodePath(state2, nodeId));
|
|
23345
23441
|
return JSON.stringify({
|
|
23346
23442
|
flattenedSegmentPaths,
|
|
23347
|
-
hasChildren: getDirectoryIndex(
|
|
23348
|
-
path: materializeNodePath(
|
|
23443
|
+
hasChildren: getDirectoryIndex(state2, terminalDirectoryId).childIds.length > 0,
|
|
23444
|
+
path: materializeNodePath(state2, terminalDirectoryId),
|
|
23349
23445
|
terminalKind: getNodeKind(terminalNode)
|
|
23350
23446
|
});
|
|
23351
23447
|
}
|
|
@@ -23360,67 +23456,67 @@ function didAnyProjectionChange(previousProjectionSignatures, nextProjectionSign
|
|
|
23360
23456
|
}
|
|
23361
23457
|
return false;
|
|
23362
23458
|
}
|
|
23363
|
-
function findNearestCollapsedAncestor(
|
|
23459
|
+
function findNearestCollapsedAncestor(state2, startDirectoryId) {
|
|
23364
23460
|
let currentDirectoryId = startDirectoryId;
|
|
23365
23461
|
while (currentDirectoryId != null) {
|
|
23366
|
-
const currentNode = requireNode(
|
|
23462
|
+
const currentNode = requireNode(state2, currentDirectoryId);
|
|
23367
23463
|
if (!isDirectoryNode(currentNode) || hasNodeFlag(currentNode, 2)) return null;
|
|
23368
|
-
if (!isDirectoryExpanded(
|
|
23464
|
+
if (!isDirectoryExpanded(state2, currentDirectoryId, currentNode)) return currentDirectoryId;
|
|
23369
23465
|
currentDirectoryId = currentNode.parentId;
|
|
23370
23466
|
}
|
|
23371
23467
|
return null;
|
|
23372
23468
|
}
|
|
23373
|
-
function recomputeDepths(
|
|
23374
|
-
const node = requireNode(
|
|
23375
|
-
setNodeDepth(node, (nodeId ===
|
|
23469
|
+
function recomputeDepths(state2, nodeId) {
|
|
23470
|
+
const node = requireNode(state2, nodeId);
|
|
23471
|
+
setNodeDepth(node, (nodeId === state2.snapshot.rootId ? -1 : getNodeDepth(requireNode(state2, node.parentId))) + 1);
|
|
23376
23472
|
if (!isDirectoryNode(node)) return;
|
|
23377
|
-
const directoryIndex = getDirectoryIndex(
|
|
23378
|
-
for (const childId of directoryIndex.childIds) recomputeDepths(
|
|
23473
|
+
const directoryIndex = getDirectoryIndex(state2, nodeId);
|
|
23474
|
+
for (const childId of directoryIndex.childIds) recomputeDepths(state2, childId);
|
|
23379
23475
|
}
|
|
23380
|
-
function isAncestor(
|
|
23476
|
+
function isAncestor(state2, ancestorNodeId, nodeId) {
|
|
23381
23477
|
let currentNodeId = nodeId;
|
|
23382
23478
|
while (currentNodeId != null) {
|
|
23383
23479
|
if (currentNodeId === ancestorNodeId) return true;
|
|
23384
|
-
const currentNode = requireNode(
|
|
23385
|
-
if (currentNodeId ===
|
|
23480
|
+
const currentNode = requireNode(state2, currentNodeId);
|
|
23481
|
+
if (currentNodeId === state2.snapshot.rootId) return false;
|
|
23386
23482
|
currentNodeId = currentNode.parentId;
|
|
23387
23483
|
}
|
|
23388
23484
|
return false;
|
|
23389
23485
|
}
|
|
23390
|
-
function recomputeNodeCounts(
|
|
23391
|
-
const instrumentation =
|
|
23486
|
+
function recomputeNodeCounts(state2, nodeId, currentNode = requireNode(state2, nodeId), rebuildChildAggregates = false) {
|
|
23487
|
+
const instrumentation = state2.instrumentation;
|
|
23392
23488
|
if (instrumentation == null) {
|
|
23393
|
-
recomputeNodeCountsNow(
|
|
23489
|
+
recomputeNodeCountsNow(state2, nodeId, currentNode, rebuildChildAggregates);
|
|
23394
23490
|
return;
|
|
23395
23491
|
}
|
|
23396
|
-
withBenchmarkPhase(instrumentation, "store.recomputeNodeCounts", () => recomputeNodeCountsNow(
|
|
23492
|
+
withBenchmarkPhase(instrumentation, "store.recomputeNodeCounts", () => recomputeNodeCountsNow(state2, nodeId, currentNode, rebuildChildAggregates));
|
|
23397
23493
|
}
|
|
23398
|
-
function recomputeCountsUpwardFromNow(
|
|
23494
|
+
function recomputeCountsUpwardFromNow(state2, startNodeId) {
|
|
23399
23495
|
let currentNodeId = startNodeId;
|
|
23400
23496
|
while (currentNodeId != null) {
|
|
23401
|
-
const currentNode = requireNode(
|
|
23497
|
+
const currentNode = requireNode(state2, currentNodeId);
|
|
23402
23498
|
const previousSubtreeNodeCount = currentNode.subtreeNodeCount;
|
|
23403
23499
|
const previousVisibleSubtreeCount = currentNode.visibleSubtreeCount;
|
|
23404
|
-
recomputeNodeCounts(
|
|
23405
|
-
if (currentNodeId ===
|
|
23500
|
+
recomputeNodeCounts(state2, currentNodeId, currentNode);
|
|
23501
|
+
if (currentNodeId === state2.snapshot.rootId) return;
|
|
23406
23502
|
const subtreeNodeDelta = currentNode.subtreeNodeCount - previousSubtreeNodeCount;
|
|
23407
23503
|
const visibleSubtreeDelta = currentNode.visibleSubtreeCount - previousVisibleSubtreeCount;
|
|
23408
23504
|
const parentId = currentNode.parentId;
|
|
23409
|
-
if (subtreeNodeDelta !== 0 || visibleSubtreeDelta !== 0) applyChildAggregateDelta(getDirectoryIndex(
|
|
23505
|
+
if (subtreeNodeDelta !== 0 || visibleSubtreeDelta !== 0) applyChildAggregateDelta(getDirectoryIndex(state2, parentId), currentNodeId, subtreeNodeDelta, visibleSubtreeDelta);
|
|
23410
23506
|
currentNodeId = parentId;
|
|
23411
23507
|
}
|
|
23412
23508
|
}
|
|
23413
|
-
function recomputeNodeCountsNow(
|
|
23509
|
+
function recomputeNodeCountsNow(state2, nodeId, currentNode, rebuildChildAggregates) {
|
|
23414
23510
|
if (!isDirectoryNode(currentNode)) {
|
|
23415
23511
|
currentNode.subtreeNodeCount = 1;
|
|
23416
23512
|
currentNode.visibleSubtreeCount = 1;
|
|
23417
23513
|
return;
|
|
23418
23514
|
}
|
|
23419
|
-
const currentIndex = getDirectoryIndex(
|
|
23515
|
+
const currentIndex = getDirectoryIndex(state2, nodeId);
|
|
23420
23516
|
if (rebuildChildAggregates) {
|
|
23421
|
-
const instrumentation =
|
|
23422
|
-
if (instrumentation == null) rebuildDirectoryChildAggregates(
|
|
23423
|
-
else withBenchmarkPhase(instrumentation, "store.recomputeNodeCounts.rebuildChildAggregates", () => rebuildDirectoryChildAggregates(
|
|
23517
|
+
const instrumentation = state2.instrumentation;
|
|
23518
|
+
if (instrumentation == null) rebuildDirectoryChildAggregates(state2.snapshot.nodes, currentIndex);
|
|
23519
|
+
else withBenchmarkPhase(instrumentation, "store.recomputeNodeCounts.rebuildChildAggregates", () => rebuildDirectoryChildAggregates(state2.snapshot.nodes, currentIndex));
|
|
23424
23520
|
}
|
|
23425
23521
|
const subtreeNodeCount = 1 + currentIndex.totalChildSubtreeNodeCount;
|
|
23426
23522
|
const visibleChildCount = currentIndex.totalChildVisibleSubtreeCount;
|
|
@@ -23429,10 +23525,10 @@ function recomputeNodeCountsNow(state3, nodeId, currentNode, rebuildChildAggrega
|
|
|
23429
23525
|
currentNode.visibleSubtreeCount = visibleChildCount;
|
|
23430
23526
|
return;
|
|
23431
23527
|
}
|
|
23432
|
-
currentNode.visibleSubtreeCount = getFlattenedChildDirectoryId(
|
|
23528
|
+
currentNode.visibleSubtreeCount = getFlattenedChildDirectoryId(state2, nodeId) != null ? visibleChildCount : isDirectoryExpanded(state2, nodeId, currentNode) ? 1 + visibleChildCount : 1;
|
|
23433
23529
|
}
|
|
23434
|
-
function buildPathPreview(
|
|
23435
|
-
const parentPath = materializeNodePath(
|
|
23530
|
+
function buildPathPreview(state2, parentId, basename3) {
|
|
23531
|
+
const parentPath = materializeNodePath(state2, parentId);
|
|
23436
23532
|
return parentPath.length === 0 ? basename3 : `${parentPath}${basename3}`;
|
|
23437
23533
|
}
|
|
23438
23534
|
|
|
@@ -23440,16 +23536,16 @@ function buildPathPreview(state3, parentId, basename3) {
|
|
|
23440
23536
|
function isLiveNode(node) {
|
|
23441
23537
|
return node != null && !hasNodeFlag(node, 4);
|
|
23442
23538
|
}
|
|
23443
|
-
function isLiveDirectoryNode(
|
|
23444
|
-
const node =
|
|
23539
|
+
function isLiveDirectoryNode(state2, nodeId) {
|
|
23540
|
+
const node = state2.snapshot.nodes[nodeId];
|
|
23445
23541
|
if (!isLiveNode(node) || !isDirectoryNode(node) || hasNodeFlag(node, 2)) return null;
|
|
23446
23542
|
return node;
|
|
23447
23543
|
}
|
|
23448
|
-
function countCachedPathEntries(
|
|
23544
|
+
function countCachedPathEntries(state2) {
|
|
23449
23545
|
let cachedPathEntryCount = 0;
|
|
23450
|
-
for (const [nodeId, cachedEntry] of
|
|
23451
|
-
if (cachedEntry.version !==
|
|
23452
|
-
if (!isLiveNode(
|
|
23546
|
+
for (const [nodeId, cachedEntry] of state2.pathCacheByNodeId) {
|
|
23547
|
+
if (cachedEntry.version !== state2.pathCacheVersion) continue;
|
|
23548
|
+
if (!isLiveNode(state2.snapshot.nodes[nodeId])) continue;
|
|
23453
23549
|
cachedPathEntryCount += 1;
|
|
23454
23550
|
}
|
|
23455
23551
|
return cachedPathEntryCount;
|
|
@@ -23457,13 +23553,13 @@ function countCachedPathEntries(state3) {
|
|
|
23457
23553
|
function countSegmentEntries(segmentTable) {
|
|
23458
23554
|
return Math.max(0, segmentTable.valueById.length - 1);
|
|
23459
23555
|
}
|
|
23460
|
-
function createCleanupMetricSnapshot(
|
|
23556
|
+
function createCleanupMetricSnapshot(state2) {
|
|
23461
23557
|
return {
|
|
23462
|
-
activeNodeCount:
|
|
23463
|
-
cachedPathEntryCount: countCachedPathEntries(
|
|
23464
|
-
loadInfoEntryCount:
|
|
23465
|
-
segmentCount: countSegmentEntries(
|
|
23466
|
-
totalNodeSlotCount: Math.max(0,
|
|
23558
|
+
activeNodeCount: state2.activeNodeCount,
|
|
23559
|
+
cachedPathEntryCount: countCachedPathEntries(state2),
|
|
23560
|
+
loadInfoEntryCount: state2.directoryLoadInfoById.size,
|
|
23561
|
+
segmentCount: countSegmentEntries(state2.snapshot.segmentTable),
|
|
23562
|
+
totalNodeSlotCount: Math.max(0, state2.snapshot.nodes.length - 1)
|
|
23467
23563
|
};
|
|
23468
23564
|
}
|
|
23469
23565
|
function createCleanupResult(mode2, idsPreserved, before, after) {
|
|
@@ -23486,20 +23582,20 @@ function createCleanupResult(mode2, idsPreserved, before, after) {
|
|
|
23486
23582
|
totalNodeSlotCountBefore: before.totalNodeSlotCount
|
|
23487
23583
|
};
|
|
23488
23584
|
}
|
|
23489
|
-
function collectExpansionOverridePaths(
|
|
23585
|
+
function collectExpansionOverridePaths(state2) {
|
|
23490
23586
|
const collapsedPaths = [];
|
|
23491
23587
|
const expandedPaths = [];
|
|
23492
|
-
for (const nodeId of
|
|
23493
|
-
for (const nodeId of
|
|
23588
|
+
for (const nodeId of state2.collapsedDirectoryIds) if (isLiveDirectoryNode(state2, nodeId) != null) collapsedPaths.push(materializeNodePath(state2, nodeId));
|
|
23589
|
+
for (const nodeId of state2.expandedDirectoryIds) if (isLiveDirectoryNode(state2, nodeId) != null) expandedPaths.push(materializeNodePath(state2, nodeId));
|
|
23494
23590
|
return {
|
|
23495
23591
|
collapsedPaths,
|
|
23496
23592
|
expandedPaths
|
|
23497
23593
|
};
|
|
23498
23594
|
}
|
|
23499
|
-
function collectDirectoryLoadInfos(
|
|
23595
|
+
function collectDirectoryLoadInfos(state2) {
|
|
23500
23596
|
const retainedInfos = [];
|
|
23501
|
-
for (const [nodeId, info] of
|
|
23502
|
-
if (isLiveDirectoryNode(
|
|
23597
|
+
for (const [nodeId, info] of state2.directoryLoadInfoById) {
|
|
23598
|
+
if (isLiveDirectoryNode(state2, nodeId) == null || getDirectoryLoadState(state2, nodeId) === "loaded") continue;
|
|
23503
23599
|
retainedInfos.push({
|
|
23504
23600
|
info: {
|
|
23505
23601
|
activeAttemptId: null,
|
|
@@ -23507,33 +23603,33 @@ function collectDirectoryLoadInfos(state3) {
|
|
|
23507
23603
|
nextAttemptId: info.nextAttemptId,
|
|
23508
23604
|
state: info.state
|
|
23509
23605
|
},
|
|
23510
|
-
path: materializeNodePath(
|
|
23606
|
+
path: materializeNodePath(state2, nodeId)
|
|
23511
23607
|
});
|
|
23512
23608
|
}
|
|
23513
23609
|
return retainedInfos;
|
|
23514
23610
|
}
|
|
23515
|
-
function restoreExpansionOverridePaths(
|
|
23516
|
-
|
|
23517
|
-
|
|
23518
|
-
|
|
23611
|
+
function restoreExpansionOverridePaths(state2, persistedExpansionState) {
|
|
23612
|
+
state2.collapsedDirectoryIds.clear();
|
|
23613
|
+
state2.hasCollapsedDirectoryOverrides = false;
|
|
23614
|
+
state2.expandedDirectoryIds.clear();
|
|
23519
23615
|
for (const path of persistedExpansionState.expandedPaths) {
|
|
23520
|
-
const nodeId = findNodeId(
|
|
23616
|
+
const nodeId = findNodeId(state2, path);
|
|
23521
23617
|
if (nodeId == null) continue;
|
|
23522
|
-
setDirectoryExpanded(
|
|
23618
|
+
setDirectoryExpanded(state2, nodeId, true, requireNode(state2, nodeId));
|
|
23523
23619
|
}
|
|
23524
23620
|
for (const path of persistedExpansionState.collapsedPaths) {
|
|
23525
|
-
const nodeId = findNodeId(
|
|
23621
|
+
const nodeId = findNodeId(state2, path);
|
|
23526
23622
|
if (nodeId == null) continue;
|
|
23527
|
-
setDirectoryExpanded(
|
|
23623
|
+
setDirectoryExpanded(state2, nodeId, false, requireNode(state2, nodeId));
|
|
23528
23624
|
}
|
|
23529
23625
|
}
|
|
23530
|
-
function restoreDirectoryLoadInfos(
|
|
23531
|
-
|
|
23626
|
+
function restoreDirectoryLoadInfos(state2, persistedLoadInfos) {
|
|
23627
|
+
state2.directoryLoadInfoById.clear();
|
|
23532
23628
|
for (const retainedInfo of persistedLoadInfos) {
|
|
23533
|
-
const nodeId = findNodeId(
|
|
23629
|
+
const nodeId = findNodeId(state2, retainedInfo.path);
|
|
23534
23630
|
if (nodeId == null) continue;
|
|
23535
|
-
if (isLiveDirectoryNode(
|
|
23536
|
-
|
|
23631
|
+
if (isLiveDirectoryNode(state2, nodeId) == null) continue;
|
|
23632
|
+
state2.directoryLoadInfoById.set(nodeId, {
|
|
23537
23633
|
activeAttemptId: null,
|
|
23538
23634
|
errorMessage: retainedInfo.info.errorMessage,
|
|
23539
23635
|
nextAttemptId: retainedInfo.info.nextAttemptId,
|
|
@@ -23541,18 +23637,18 @@ function restoreDirectoryLoadInfos(state3, persistedLoadInfos) {
|
|
|
23541
23637
|
});
|
|
23542
23638
|
}
|
|
23543
23639
|
}
|
|
23544
|
-
function clearPathCaches(
|
|
23545
|
-
|
|
23546
|
-
|
|
23547
|
-
|
|
23640
|
+
function clearPathCaches(state2) {
|
|
23641
|
+
state2.pathCacheVersion += 1;
|
|
23642
|
+
state2.pathCacheByNodeId.clear();
|
|
23643
|
+
state2.pathCacheByNodeId.set(state2.snapshot.rootId, {
|
|
23548
23644
|
path: "",
|
|
23549
|
-
version:
|
|
23645
|
+
version: state2.pathCacheVersion
|
|
23550
23646
|
});
|
|
23551
23647
|
}
|
|
23552
|
-
function rebuildSegmentTablePreservingNodeIds(
|
|
23553
|
-
const previousSegmentTable =
|
|
23648
|
+
function rebuildSegmentTablePreservingNodeIds(state2) {
|
|
23649
|
+
const previousSegmentTable = state2.snapshot.segmentTable;
|
|
23554
23650
|
const nextSegmentTable = createSegmentTable();
|
|
23555
|
-
for (const node of
|
|
23651
|
+
for (const node of state2.snapshot.nodes) {
|
|
23556
23652
|
if (!isLiveNode(node)) continue;
|
|
23557
23653
|
if (hasNodeFlag(node, 2)) {
|
|
23558
23654
|
node.nameId = 0;
|
|
@@ -23560,75 +23656,75 @@ function rebuildSegmentTablePreservingNodeIds(state3) {
|
|
|
23560
23656
|
}
|
|
23561
23657
|
node.nameId = internSegment(nextSegmentTable, getSegmentValue(previousSegmentTable, node.nameId));
|
|
23562
23658
|
}
|
|
23563
|
-
|
|
23659
|
+
state2.snapshot.segmentTable = nextSegmentTable;
|
|
23564
23660
|
}
|
|
23565
|
-
function rebuildDirectoryIndexes(
|
|
23566
|
-
for (const [directoryId, directoryIndex] of
|
|
23567
|
-
const directoryNode =
|
|
23661
|
+
function rebuildDirectoryIndexes(state2) {
|
|
23662
|
+
for (const [directoryId, directoryIndex] of state2.snapshot.directories) {
|
|
23663
|
+
const directoryNode = state2.snapshot.nodes[directoryId];
|
|
23568
23664
|
if (!isLiveNode(directoryNode) || !isDirectoryNode(directoryNode)) {
|
|
23569
|
-
|
|
23665
|
+
state2.snapshot.directories.delete(directoryId);
|
|
23570
23666
|
continue;
|
|
23571
23667
|
}
|
|
23572
23668
|
const liveChildIds = directoryIndex.childIds.filter((childId) => {
|
|
23573
|
-
const childNode =
|
|
23669
|
+
const childNode = state2.snapshot.nodes[childId];
|
|
23574
23670
|
return isLiveNode(childNode) && childNode.parentId === directoryId;
|
|
23575
23671
|
});
|
|
23576
23672
|
directoryIndex.childIds = liveChildIds;
|
|
23577
|
-
directoryIndex.childIdByNameId = new Map(liveChildIds.map((childId) => [requireNode(
|
|
23673
|
+
directoryIndex.childIdByNameId = new Map(liveChildIds.map((childId) => [requireNode(state2, childId).nameId, childId]));
|
|
23578
23674
|
directoryIndex.childPositionById = new Map(liveChildIds.map((childId, childIndex) => [childId, childIndex]));
|
|
23579
|
-
rebuildDirectoryChildAggregates(
|
|
23675
|
+
rebuildDirectoryChildAggregates(state2.snapshot.nodes, directoryIndex);
|
|
23580
23676
|
}
|
|
23581
23677
|
}
|
|
23582
|
-
function trimTrailingRemovedNodeSlots(
|
|
23583
|
-
let lastNodeIndex =
|
|
23584
|
-
while (lastNodeIndex >
|
|
23585
|
-
const node =
|
|
23678
|
+
function trimTrailingRemovedNodeSlots(state2) {
|
|
23679
|
+
let lastNodeIndex = state2.snapshot.nodes.length - 1;
|
|
23680
|
+
while (lastNodeIndex > state2.snapshot.rootId) {
|
|
23681
|
+
const node = state2.snapshot.nodes[lastNodeIndex];
|
|
23586
23682
|
if (isLiveNode(node)) break;
|
|
23587
23683
|
lastNodeIndex -= 1;
|
|
23588
23684
|
}
|
|
23589
|
-
|
|
23590
|
-
}
|
|
23591
|
-
function runStableCleanup(
|
|
23592
|
-
const persistedExpansionState = collectExpansionOverridePaths(
|
|
23593
|
-
const persistedLoadInfos = collectDirectoryLoadInfos(
|
|
23594
|
-
withBenchmarkPhase(
|
|
23595
|
-
withBenchmarkPhase(
|
|
23596
|
-
withBenchmarkPhase(
|
|
23597
|
-
withBenchmarkPhase(
|
|
23598
|
-
withBenchmarkPhase(
|
|
23599
|
-
withBenchmarkPhase(
|
|
23600
|
-
withBenchmarkPhase(
|
|
23601
|
-
}
|
|
23602
|
-
function runAggressiveCleanup(
|
|
23603
|
-
const persistedExpansionState = collectExpansionOverridePaths(
|
|
23604
|
-
const persistedLoadInfos = collectDirectoryLoadInfos(
|
|
23605
|
-
const canonicalPaths = withBenchmarkPhase(
|
|
23606
|
-
const builderOptions = attachBenchmarkInstrumentation({ ...
|
|
23607
|
-
const rebuiltSnapshot = withBenchmarkPhase(
|
|
23685
|
+
state2.snapshot.nodes.length = lastNodeIndex + 1;
|
|
23686
|
+
}
|
|
23687
|
+
function runStableCleanup(state2) {
|
|
23688
|
+
const persistedExpansionState = collectExpansionOverridePaths(state2);
|
|
23689
|
+
const persistedLoadInfos = collectDirectoryLoadInfos(state2);
|
|
23690
|
+
withBenchmarkPhase(state2.instrumentation, "store.cleanup.stable.clearPathCaches", () => clearPathCaches(state2));
|
|
23691
|
+
withBenchmarkPhase(state2.instrumentation, "store.cleanup.stable.rebuildSegmentTable", () => rebuildSegmentTablePreservingNodeIds(state2));
|
|
23692
|
+
withBenchmarkPhase(state2.instrumentation, "store.cleanup.stable.rebuildDirectoryIndexes", () => rebuildDirectoryIndexes(state2));
|
|
23693
|
+
withBenchmarkPhase(state2.instrumentation, "store.cleanup.stable.trimTrailingRemovedNodeSlots", () => trimTrailingRemovedNodeSlots(state2));
|
|
23694
|
+
withBenchmarkPhase(state2.instrumentation, "store.cleanup.stable.restoreExpansionOverrides", () => restoreExpansionOverridePaths(state2, persistedExpansionState));
|
|
23695
|
+
withBenchmarkPhase(state2.instrumentation, "store.cleanup.stable.restoreDirectoryLoadInfos", () => restoreDirectoryLoadInfos(state2, persistedLoadInfos));
|
|
23696
|
+
withBenchmarkPhase(state2.instrumentation, "store.cleanup.stable.recomputeCounts", () => recomputeCountsRecursive(state2, state2.snapshot.rootId));
|
|
23697
|
+
}
|
|
23698
|
+
function runAggressiveCleanup(state2) {
|
|
23699
|
+
const persistedExpansionState = collectExpansionOverridePaths(state2);
|
|
23700
|
+
const persistedLoadInfos = collectDirectoryLoadInfos(state2);
|
|
23701
|
+
const canonicalPaths = withBenchmarkPhase(state2.instrumentation, "store.cleanup.aggressive.listPaths", () => listPaths(state2));
|
|
23702
|
+
const builderOptions = attachBenchmarkInstrumentation({ ...state2.snapshot.options }, state2.instrumentation);
|
|
23703
|
+
const rebuiltSnapshot = withBenchmarkPhase(state2.instrumentation, "store.cleanup.aggressive.rebuildSnapshot", () => {
|
|
23608
23704
|
const builder = new PathStoreBuilder(builderOptions);
|
|
23609
23705
|
builder.appendPaths(canonicalPaths);
|
|
23610
23706
|
return builder.finish();
|
|
23611
23707
|
});
|
|
23612
|
-
|
|
23613
|
-
|
|
23614
|
-
|
|
23708
|
+
state2.snapshot = rebuiltSnapshot;
|
|
23709
|
+
state2.activeNodeCount = rebuiltSnapshot.nodes.length - 1;
|
|
23710
|
+
state2.pathCacheByNodeId = /* @__PURE__ */ new Map([[rebuiltSnapshot.rootId, {
|
|
23615
23711
|
path: "",
|
|
23616
23712
|
version: 0
|
|
23617
23713
|
}]]);
|
|
23618
|
-
|
|
23619
|
-
withBenchmarkPhase(
|
|
23620
|
-
withBenchmarkPhase(
|
|
23621
|
-
withBenchmarkPhase(
|
|
23714
|
+
state2.pathCacheVersion = 0;
|
|
23715
|
+
withBenchmarkPhase(state2.instrumentation, "store.cleanup.aggressive.restoreExpansionOverrides", () => restoreExpansionOverridePaths(state2, persistedExpansionState));
|
|
23716
|
+
withBenchmarkPhase(state2.instrumentation, "store.cleanup.aggressive.restoreDirectoryLoadInfos", () => restoreDirectoryLoadInfos(state2, persistedLoadInfos));
|
|
23717
|
+
withBenchmarkPhase(state2.instrumentation, "store.cleanup.aggressive.recomputeCounts", () => recomputeCountsRecursive(state2, state2.snapshot.rootId));
|
|
23622
23718
|
}
|
|
23623
|
-
function hasActiveCleanupBlockingLoads(
|
|
23624
|
-
for (const loadInfo of
|
|
23719
|
+
function hasActiveCleanupBlockingLoads(state2) {
|
|
23720
|
+
for (const loadInfo of state2.directoryLoadInfoById.values()) if (loadInfo.state === "loading" && loadInfo.activeAttemptId != null) return true;
|
|
23625
23721
|
return false;
|
|
23626
23722
|
}
|
|
23627
|
-
function cleanupPathStoreState(
|
|
23628
|
-
const before = createCleanupMetricSnapshot(
|
|
23629
|
-
if (mode2 === "stable") withBenchmarkPhase(
|
|
23630
|
-
else withBenchmarkPhase(
|
|
23631
|
-
const after = createCleanupMetricSnapshot(
|
|
23723
|
+
function cleanupPathStoreState(state2, mode2) {
|
|
23724
|
+
const before = createCleanupMetricSnapshot(state2);
|
|
23725
|
+
if (mode2 === "stable") withBenchmarkPhase(state2.instrumentation, "store.cleanup.stable", () => runStableCleanup(state2));
|
|
23726
|
+
else withBenchmarkPhase(state2.instrumentation, "store.cleanup.aggressive", () => runAggressiveCleanup(state2));
|
|
23727
|
+
const after = createCleanupMetricSnapshot(state2);
|
|
23632
23728
|
return createCleanupResult(mode2, mode2 === "stable", before, after);
|
|
23633
23729
|
}
|
|
23634
23730
|
|
|
@@ -23644,33 +23740,33 @@ function ensureProjectionDepthCapacity(depthTable, depth) {
|
|
|
23644
23740
|
nextDepthTable.set(depthTable);
|
|
23645
23741
|
return nextDepthTable;
|
|
23646
23742
|
}
|
|
23647
|
-
function getVisibleCount(
|
|
23648
|
-
return requireNode(
|
|
23743
|
+
function getVisibleCount(state2) {
|
|
23744
|
+
return requireNode(state2, state2.snapshot.rootId).visibleSubtreeCount;
|
|
23649
23745
|
}
|
|
23650
|
-
function getVisibleRowSubtreeEndIndex(
|
|
23651
|
-
const terminalNode = requireNode(
|
|
23746
|
+
function getVisibleRowSubtreeEndIndex(state2, cursor, index, totalVisibleCount) {
|
|
23747
|
+
const terminalNode = requireNode(state2, cursor.terminalNodeId);
|
|
23652
23748
|
const subtreeSize = Math.max(1, terminalNode.visibleSubtreeCount);
|
|
23653
23749
|
return Math.min(totalVisibleCount - 1, index + subtreeSize - 1);
|
|
23654
23750
|
}
|
|
23655
|
-
function materializeVisibleAncestorRow(
|
|
23751
|
+
function materializeVisibleAncestorRow(state2, entry, totalVisibleCount, ancestorPaths) {
|
|
23656
23752
|
return {
|
|
23657
23753
|
ancestorPaths,
|
|
23658
23754
|
index: entry.index,
|
|
23659
23755
|
posInSet: entry.posInSet,
|
|
23660
|
-
row: materializeVisibleRow(
|
|
23756
|
+
row: materializeVisibleRow(state2, entry.cursor),
|
|
23661
23757
|
setSize: entry.setSize,
|
|
23662
|
-
subtreeEndIndex: getVisibleRowSubtreeEndIndex(
|
|
23758
|
+
subtreeEndIndex: getVisibleRowSubtreeEndIndex(state2, entry.cursor, entry.index, totalVisibleCount)
|
|
23663
23759
|
};
|
|
23664
23760
|
}
|
|
23665
|
-
function selectVisibleRowContextWithinDirectory(
|
|
23666
|
-
const directoryIndex = getDirectoryIndex(
|
|
23667
|
-
const { childIndex, childVisibleIndex, localVisibleIndex } = selectChildIndexByVisibleIndex(
|
|
23761
|
+
function selectVisibleRowContextWithinDirectory(state2, directoryNodeId, index, directoryStartIndex, parentVisibleDepth, ancestors2) {
|
|
23762
|
+
const directoryIndex = getDirectoryIndex(state2, directoryNodeId);
|
|
23763
|
+
const { childIndex, childVisibleIndex, localVisibleIndex } = selectChildIndexByVisibleIndex(state2.snapshot.nodes, directoryIndex, index);
|
|
23668
23764
|
const childId = directoryIndex.childIds[childIndex];
|
|
23669
23765
|
if (childId == null) throw new Error(`Visible index ${String(index)} is out of range`);
|
|
23670
|
-
return selectVisibleRowContextWithinSubtree(
|
|
23766
|
+
return selectVisibleRowContextWithinSubtree(state2, childId, localVisibleIndex, directoryStartIndex + childVisibleIndex, parentVisibleDepth + 1, childIndex, directoryIndex.childIds.length, ancestors2);
|
|
23671
23767
|
}
|
|
23672
|
-
function selectVisibleRowContextWithinSubtree(
|
|
23673
|
-
if (!isDirectoryNode(requireNode(
|
|
23768
|
+
function selectVisibleRowContextWithinSubtree(state2, nodeId, index, rowIndex, visibleDepth, posInSet, setSize, ancestors2) {
|
|
23769
|
+
if (!isDirectoryNode(requireNode(state2, nodeId))) {
|
|
23674
23770
|
if (index === 0) return {
|
|
23675
23771
|
ancestors: ancestors2,
|
|
23676
23772
|
cursor: {
|
|
@@ -23684,7 +23780,7 @@ function selectVisibleRowContextWithinSubtree(state3, nodeId, index, rowIndex, v
|
|
|
23684
23780
|
};
|
|
23685
23781
|
throw new Error(`Visible index ${String(index)} is out of range for file`);
|
|
23686
23782
|
}
|
|
23687
|
-
const currentCursor = createVisibleRowCursor(
|
|
23783
|
+
const currentCursor = createVisibleRowCursor(state2, nodeId, visibleDepth);
|
|
23688
23784
|
if (index === 0) return {
|
|
23689
23785
|
ancestors: ancestors2,
|
|
23690
23786
|
cursor: currentCursor,
|
|
@@ -23692,20 +23788,20 @@ function selectVisibleRowContextWithinSubtree(state3, nodeId, index, rowIndex, v
|
|
|
23692
23788
|
posInSet,
|
|
23693
23789
|
setSize
|
|
23694
23790
|
};
|
|
23695
|
-
const terminalNode = requireNode(
|
|
23696
|
-
if (!isDirectoryNode(terminalNode) || !isDirectoryExpanded(
|
|
23697
|
-
return selectVisibleRowContextWithinDirectory(
|
|
23791
|
+
const terminalNode = requireNode(state2, currentCursor.terminalNodeId);
|
|
23792
|
+
if (!isDirectoryNode(terminalNode) || !isDirectoryExpanded(state2, currentCursor.terminalNodeId, terminalNode)) throw new Error(`Visible index ${String(index)} is out of range for collapsed directory`);
|
|
23793
|
+
return selectVisibleRowContextWithinDirectory(state2, currentCursor.terminalNodeId, index - 1, rowIndex + 1, currentCursor.visibleDepth, [...ancestors2, {
|
|
23698
23794
|
cursor: currentCursor,
|
|
23699
23795
|
index: rowIndex,
|
|
23700
23796
|
posInSet,
|
|
23701
23797
|
setSize
|
|
23702
23798
|
}]);
|
|
23703
23799
|
}
|
|
23704
|
-
function getVisibleRowContext(
|
|
23705
|
-
const totalVisibleCount = getVisibleCount(
|
|
23800
|
+
function getVisibleRowContext(state2, index) {
|
|
23801
|
+
const totalVisibleCount = getVisibleCount(state2);
|
|
23706
23802
|
if (index < 0 || index >= totalVisibleCount) return null;
|
|
23707
|
-
const selected = selectVisibleRowContextWithinDirectory(
|
|
23708
|
-
const ancestorPaths = selected.ancestors.map((ancestor) => materializeNodePath(
|
|
23803
|
+
const selected = selectVisibleRowContextWithinDirectory(state2, state2.snapshot.rootId, index, 0, -1, []);
|
|
23804
|
+
const ancestorPaths = selected.ancestors.map((ancestor) => materializeNodePath(state2, ancestor.cursor.terminalNodeId));
|
|
23709
23805
|
let cachedAncestorRows = null;
|
|
23710
23806
|
return {
|
|
23711
23807
|
ancestorPaths,
|
|
@@ -23714,7 +23810,7 @@ function getVisibleRowContext(state3, index) {
|
|
|
23714
23810
|
const ancestorRows = [];
|
|
23715
23811
|
const rowAncestorPaths = [];
|
|
23716
23812
|
for (const ancestor of selected.ancestors) {
|
|
23717
|
-
const ancestorRow = materializeVisibleAncestorRow(
|
|
23813
|
+
const ancestorRow = materializeVisibleAncestorRow(state2, ancestor, totalVisibleCount, [...rowAncestorPaths]);
|
|
23718
23814
|
ancestorRows.push(ancestorRow);
|
|
23719
23815
|
rowAncestorPaths.push(ancestorRow.row.path);
|
|
23720
23816
|
}
|
|
@@ -23723,121 +23819,121 @@ function getVisibleRowContext(state3, index) {
|
|
|
23723
23819
|
},
|
|
23724
23820
|
index: selected.index,
|
|
23725
23821
|
posInSet: selected.posInSet,
|
|
23726
|
-
row: materializeVisibleRow(
|
|
23822
|
+
row: materializeVisibleRow(state2, selected.cursor),
|
|
23727
23823
|
setSize: selected.setSize,
|
|
23728
|
-
subtreeEndIndex: getVisibleRowSubtreeEndIndex(
|
|
23824
|
+
subtreeEndIndex: getVisibleRowSubtreeEndIndex(state2, selected.cursor, selected.index, totalVisibleCount)
|
|
23729
23825
|
};
|
|
23730
23826
|
}
|
|
23731
|
-
function getVisibleSlice(
|
|
23732
|
-
const instrumentation =
|
|
23733
|
-
const totalVisibleCount = getVisibleCount(
|
|
23827
|
+
function getVisibleSlice(state2, start, end) {
|
|
23828
|
+
const instrumentation = state2.instrumentation;
|
|
23829
|
+
const totalVisibleCount = getVisibleCount(state2);
|
|
23734
23830
|
if (totalVisibleCount <= 0 || end < start) return [];
|
|
23735
23831
|
const normalizedStart = Math.max(0, Math.min(start, totalVisibleCount - 1));
|
|
23736
23832
|
const normalizedEnd = Math.max(normalizedStart, Math.min(end, totalVisibleCount - 1));
|
|
23737
23833
|
if (instrumentation == null) {
|
|
23738
|
-
if (normalizedStart === 0) return collectVisibleRowsDFS(
|
|
23834
|
+
if (normalizedStart === 0) return collectVisibleRowsDFS(state2, normalizedEnd + 1);
|
|
23739
23835
|
const rows2 = [];
|
|
23740
|
-
let currentCursor2 = selectVisibleRow(
|
|
23836
|
+
let currentCursor2 = selectVisibleRow(state2, normalizedStart);
|
|
23741
23837
|
for (let visibleIndex = normalizedStart; visibleIndex <= normalizedEnd && currentCursor2 != null; visibleIndex++) {
|
|
23742
|
-
const row = materializeVisibleRow(
|
|
23838
|
+
const row = materializeVisibleRow(state2, currentCursor2);
|
|
23743
23839
|
rows2.push(row);
|
|
23744
|
-
currentCursor2 = getNextVisibleRowCursor(
|
|
23840
|
+
currentCursor2 = getNextVisibleRowCursor(state2, currentCursor2);
|
|
23745
23841
|
}
|
|
23746
23842
|
return rows2;
|
|
23747
23843
|
}
|
|
23748
23844
|
const rows = [];
|
|
23749
23845
|
let flattenedRowCount = 0;
|
|
23750
23846
|
let flattenedSegmentCount = 0;
|
|
23751
|
-
let currentCursor = withBenchmarkPhase(instrumentation, "store.getVisibleSlice.selectFirstRow", () => selectVisibleRow(
|
|
23847
|
+
let currentCursor = withBenchmarkPhase(instrumentation, "store.getVisibleSlice.selectFirstRow", () => selectVisibleRow(state2, normalizedStart));
|
|
23752
23848
|
for (let visibleIndex = normalizedStart; visibleIndex <= normalizedEnd && currentCursor != null; visibleIndex++) {
|
|
23753
|
-
const row = withBenchmarkPhase(instrumentation, "store.getVisibleSlice.materializeRow", () => materializeVisibleRow(
|
|
23849
|
+
const row = withBenchmarkPhase(instrumentation, "store.getVisibleSlice.materializeRow", () => materializeVisibleRow(state2, currentCursor));
|
|
23754
23850
|
rows.push(row);
|
|
23755
23851
|
if (row.isFlattened) {
|
|
23756
23852
|
flattenedRowCount++;
|
|
23757
23853
|
flattenedSegmentCount += row.flattenedSegments?.length ?? 0;
|
|
23758
23854
|
}
|
|
23759
|
-
currentCursor = withBenchmarkPhase(instrumentation, "store.getVisibleSlice.advanceCursor", () => getNextVisibleRowCursor(
|
|
23855
|
+
currentCursor = withBenchmarkPhase(instrumentation, "store.getVisibleSlice.advanceCursor", () => getNextVisibleRowCursor(state2, currentCursor));
|
|
23760
23856
|
}
|
|
23761
23857
|
setBenchmarkCounter(instrumentation, "workload.visibleRowsRead", rows.length);
|
|
23762
23858
|
setBenchmarkCounter(instrumentation, "workload.flattenedRowsRead", flattenedRowCount);
|
|
23763
23859
|
setBenchmarkCounter(instrumentation, "workload.flattenedSegmentsRead", flattenedSegmentCount);
|
|
23764
23860
|
return rows;
|
|
23765
23861
|
}
|
|
23766
|
-
function getVisibleTreeProjectionData(
|
|
23767
|
-
const instrumentation =
|
|
23768
|
-
if (instrumentation == null) return buildVisibleTreeProjectionDataDFS(
|
|
23769
|
-
return withBenchmarkPhase(instrumentation, "store.getVisibleTreeProjection", () => buildVisibleTreeProjectionDataDFS(
|
|
23862
|
+
function getVisibleTreeProjectionData(state2, maxRows = getVisibleCount(state2)) {
|
|
23863
|
+
const instrumentation = state2.instrumentation;
|
|
23864
|
+
if (instrumentation == null) return buildVisibleTreeProjectionDataDFS(state2, maxRows);
|
|
23865
|
+
return withBenchmarkPhase(instrumentation, "store.getVisibleTreeProjection", () => buildVisibleTreeProjectionDataDFS(state2, maxRows));
|
|
23770
23866
|
}
|
|
23771
|
-
function getVisibleTreeProjection(
|
|
23772
|
-
return createVisibleTreeProjectionFromData(getVisibleTreeProjectionData(
|
|
23867
|
+
function getVisibleTreeProjection(state2) {
|
|
23868
|
+
return createVisibleTreeProjectionFromData(getVisibleTreeProjectionData(state2));
|
|
23773
23869
|
}
|
|
23774
|
-
function getVisibleIndexByPath(
|
|
23775
|
-
const nodeId = findNodeId(
|
|
23776
|
-
if (nodeId == null || nodeId ===
|
|
23777
|
-
if (isDirectoryNode(requireNode(
|
|
23870
|
+
function getVisibleIndexByPath(state2, path) {
|
|
23871
|
+
const nodeId = findNodeId(state2, path);
|
|
23872
|
+
if (nodeId == null || nodeId === state2.snapshot.rootId) return null;
|
|
23873
|
+
if (isDirectoryNode(requireNode(state2, nodeId)) && getFlattenedTerminalDirectoryId(state2, nodeId) !== nodeId) return null;
|
|
23778
23874
|
let visibleIndex = 0;
|
|
23779
23875
|
let currentNodeId = nodeId;
|
|
23780
|
-
const { nodes, rootId } =
|
|
23876
|
+
const { nodes, rootId } = state2.snapshot;
|
|
23781
23877
|
while (currentNodeId !== rootId) {
|
|
23782
|
-
const parentId = requireNode(
|
|
23783
|
-
const parentIndex = getDirectoryIndex(
|
|
23878
|
+
const parentId = requireNode(state2, currentNodeId).parentId;
|
|
23879
|
+
const parentIndex = getDirectoryIndex(state2, parentId);
|
|
23784
23880
|
const childPosition = ensureChildPositions(parentIndex).get(currentNodeId);
|
|
23785
23881
|
if (childPosition == null) throw new Error(`Child ${String(currentNodeId)} was not found in its parent index`);
|
|
23786
23882
|
visibleIndex += getVisibleChildPrefixCount(nodes, parentIndex, childPosition);
|
|
23787
23883
|
if (parentId !== rootId) {
|
|
23788
|
-
const parentNode = requireNode(
|
|
23789
|
-
const flattenedChildDirectoryId = getFlattenedChildDirectoryId(
|
|
23790
|
-
if (!isDirectoryExpanded(
|
|
23791
|
-
if (getFlattenedTerminalDirectoryId(
|
|
23884
|
+
const parentNode = requireNode(state2, parentId);
|
|
23885
|
+
const flattenedChildDirectoryId = getFlattenedChildDirectoryId(state2, parentId);
|
|
23886
|
+
if (!isDirectoryExpanded(state2, parentId, parentNode) && flattenedChildDirectoryId !== currentNodeId) return null;
|
|
23887
|
+
if (getFlattenedTerminalDirectoryId(state2, parentId) === parentId) visibleIndex += 1;
|
|
23792
23888
|
}
|
|
23793
23889
|
currentNodeId = parentId;
|
|
23794
23890
|
}
|
|
23795
23891
|
return visibleIndex;
|
|
23796
23892
|
}
|
|
23797
|
-
function expandPath(
|
|
23798
|
-
const directoryNodeId = findNodeId(
|
|
23893
|
+
function expandPath(state2, path) {
|
|
23894
|
+
const directoryNodeId = findNodeId(state2, path);
|
|
23799
23895
|
if (directoryNodeId == null) throw new Error(`Path does not exist: "${path}"`);
|
|
23800
|
-
const directoryNode = requireNode(
|
|
23896
|
+
const directoryNode = requireNode(state2, directoryNodeId);
|
|
23801
23897
|
if (!isDirectoryNode(directoryNode)) throw new Error(`Path is not a directory: "${path}"`);
|
|
23802
|
-
if (isDirectoryExpanded(
|
|
23803
|
-
setDirectoryExpanded(
|
|
23804
|
-
recomputeCountsUpwardFrom(
|
|
23898
|
+
if (isDirectoryExpanded(state2, directoryNodeId, directoryNode)) return null;
|
|
23899
|
+
setDirectoryExpanded(state2, directoryNodeId, true, directoryNode);
|
|
23900
|
+
recomputeCountsUpwardFrom(state2, directoryNodeId);
|
|
23805
23901
|
return createExpandEvent({
|
|
23806
|
-
affectedAncestorIds: collectAncestorIds(
|
|
23902
|
+
affectedAncestorIds: collectAncestorIds(state2, directoryNodeId),
|
|
23807
23903
|
affectedNodeIds: [directoryNodeId],
|
|
23808
23904
|
path,
|
|
23809
23905
|
projectionChanged: true
|
|
23810
23906
|
});
|
|
23811
23907
|
}
|
|
23812
|
-
function collapsePath(
|
|
23813
|
-
const directoryNodeId = findNodeId(
|
|
23908
|
+
function collapsePath(state2, path) {
|
|
23909
|
+
const directoryNodeId = findNodeId(state2, path);
|
|
23814
23910
|
if (directoryNodeId == null) throw new Error(`Path does not exist: "${path}"`);
|
|
23815
|
-
const directoryNode = requireNode(
|
|
23911
|
+
const directoryNode = requireNode(state2, directoryNodeId);
|
|
23816
23912
|
if (!isDirectoryNode(directoryNode)) throw new Error(`Path is not a directory: "${path}"`);
|
|
23817
|
-
if (!isDirectoryExpanded(
|
|
23818
|
-
setDirectoryExpanded(
|
|
23819
|
-
recomputeCountsUpwardFrom(
|
|
23913
|
+
if (!isDirectoryExpanded(state2, directoryNodeId, directoryNode)) return null;
|
|
23914
|
+
setDirectoryExpanded(state2, directoryNodeId, false, directoryNode);
|
|
23915
|
+
recomputeCountsUpwardFrom(state2, directoryNodeId);
|
|
23820
23916
|
return createCollapseEvent({
|
|
23821
|
-
affectedAncestorIds: collectAncestorIds(
|
|
23917
|
+
affectedAncestorIds: collectAncestorIds(state2, directoryNodeId),
|
|
23822
23918
|
affectedNodeIds: [directoryNodeId],
|
|
23823
23919
|
path,
|
|
23824
23920
|
projectionChanged: true
|
|
23825
23921
|
});
|
|
23826
23922
|
}
|
|
23827
|
-
function selectVisibleRow(
|
|
23828
|
-
if (index < 0 || index >= getVisibleCount(
|
|
23829
|
-
return selectVisibleRowWithinDirectory(
|
|
23923
|
+
function selectVisibleRow(state2, index) {
|
|
23924
|
+
if (index < 0 || index >= getVisibleCount(state2)) return null;
|
|
23925
|
+
return selectVisibleRowWithinDirectory(state2, state2.snapshot.rootId, index, -1);
|
|
23830
23926
|
}
|
|
23831
|
-
function selectVisibleRowWithinDirectory(
|
|
23832
|
-
const directoryIndex = getDirectoryIndex(
|
|
23833
|
-
const instrumentation =
|
|
23834
|
-
const { childIndex, localVisibleIndex } = instrumentation == null ? selectChildIndexByVisibleIndex(
|
|
23927
|
+
function selectVisibleRowWithinDirectory(state2, directoryNodeId, index, parentVisibleDepth) {
|
|
23928
|
+
const directoryIndex = getDirectoryIndex(state2, directoryNodeId);
|
|
23929
|
+
const instrumentation = state2.instrumentation;
|
|
23930
|
+
const { childIndex, localVisibleIndex } = instrumentation == null ? selectChildIndexByVisibleIndex(state2.snapshot.nodes, directoryIndex, index) : withBenchmarkPhase(instrumentation, "store.getVisibleSlice.selectChildIndex", () => selectChildIndexByVisibleIndex(state2.snapshot.nodes, directoryIndex, index));
|
|
23835
23931
|
const childId = directoryIndex.childIds[childIndex];
|
|
23836
|
-
if (childId != null) return selectVisibleRowWithinSubtree(
|
|
23932
|
+
if (childId != null) return selectVisibleRowWithinSubtree(state2, childId, localVisibleIndex, parentVisibleDepth + 1);
|
|
23837
23933
|
throw new Error(`Visible index ${String(index)} is out of range`);
|
|
23838
23934
|
}
|
|
23839
|
-
function selectVisibleRowWithinSubtree(
|
|
23840
|
-
if (!isDirectoryNode(requireNode(
|
|
23935
|
+
function selectVisibleRowWithinSubtree(state2, nodeId, index, visibleDepth) {
|
|
23936
|
+
if (!isDirectoryNode(requireNode(state2, nodeId))) {
|
|
23841
23937
|
if (index === 0) return {
|
|
23842
23938
|
headNodeId: nodeId,
|
|
23843
23939
|
terminalNodeId: nodeId,
|
|
@@ -23845,57 +23941,57 @@ function selectVisibleRowWithinSubtree(state3, nodeId, index, visibleDepth) {
|
|
|
23845
23941
|
};
|
|
23846
23942
|
throw new Error(`Visible index ${String(index)} is out of range for file`);
|
|
23847
23943
|
}
|
|
23848
|
-
const currentCursor = createVisibleRowCursor(
|
|
23944
|
+
const currentCursor = createVisibleRowCursor(state2, nodeId, visibleDepth);
|
|
23849
23945
|
if (index === 0) return currentCursor;
|
|
23850
|
-
const terminalNode = requireNode(
|
|
23851
|
-
if (!isDirectoryNode(terminalNode) || !isDirectoryExpanded(
|
|
23852
|
-
return selectVisibleRowWithinDirectory(
|
|
23946
|
+
const terminalNode = requireNode(state2, currentCursor.terminalNodeId);
|
|
23947
|
+
if (!isDirectoryNode(terminalNode) || !isDirectoryExpanded(state2, currentCursor.terminalNodeId, terminalNode)) throw new Error(`Visible index ${String(index)} is out of range for collapsed directory`);
|
|
23948
|
+
return selectVisibleRowWithinDirectory(state2, currentCursor.terminalNodeId, index - 1, currentCursor.visibleDepth);
|
|
23853
23949
|
}
|
|
23854
|
-
function createVisibleRowCursor(
|
|
23855
|
-
if (!isDirectoryNode(requireNode(
|
|
23950
|
+
function createVisibleRowCursor(state2, nodeId, visibleDepth) {
|
|
23951
|
+
if (!isDirectoryNode(requireNode(state2, nodeId))) return {
|
|
23856
23952
|
headNodeId: nodeId,
|
|
23857
23953
|
terminalNodeId: nodeId,
|
|
23858
23954
|
visibleDepth
|
|
23859
23955
|
};
|
|
23860
|
-
if (
|
|
23956
|
+
if (state2.instrumentation == null) return {
|
|
23861
23957
|
headNodeId: nodeId,
|
|
23862
|
-
terminalNodeId: getFlattenedTerminalDirectoryId(
|
|
23958
|
+
terminalNodeId: getFlattenedTerminalDirectoryId(state2, nodeId),
|
|
23863
23959
|
visibleDepth
|
|
23864
23960
|
};
|
|
23865
23961
|
return {
|
|
23866
23962
|
headNodeId: nodeId,
|
|
23867
|
-
terminalNodeId: withBenchmarkPhase(
|
|
23963
|
+
terminalNodeId: withBenchmarkPhase(state2.instrumentation, "store.getVisibleSlice.flatten.resolveTerminalDirectory", () => getFlattenedTerminalDirectoryId(state2, nodeId)),
|
|
23868
23964
|
visibleDepth
|
|
23869
23965
|
};
|
|
23870
23966
|
}
|
|
23871
|
-
function isVisibleRowHeadNode(
|
|
23872
|
-
const node = requireNode(
|
|
23967
|
+
function isVisibleRowHeadNode(state2, nodeId) {
|
|
23968
|
+
const node = requireNode(state2, nodeId);
|
|
23873
23969
|
if (!isDirectoryNode(node)) return true;
|
|
23874
23970
|
const parentId = node.parentId;
|
|
23875
|
-
if (parentId ===
|
|
23876
|
-
return getFlattenedChildDirectoryId(
|
|
23971
|
+
if (parentId === state2.snapshot.rootId) return true;
|
|
23972
|
+
return getFlattenedChildDirectoryId(state2, parentId) !== nodeId;
|
|
23877
23973
|
}
|
|
23878
|
-
function getNextVisibleRowCursor(
|
|
23879
|
-
const terminalNode = requireNode(
|
|
23974
|
+
function getNextVisibleRowCursor(state2, currentCursor) {
|
|
23975
|
+
const terminalNode = requireNode(state2, currentCursor.terminalNodeId);
|
|
23880
23976
|
if (isDirectoryNode(terminalNode)) {
|
|
23881
|
-
const currentIndex = getDirectoryIndex(
|
|
23882
|
-
if (isDirectoryExpanded(
|
|
23977
|
+
const currentIndex = getDirectoryIndex(state2, currentCursor.terminalNodeId);
|
|
23978
|
+
if (isDirectoryExpanded(state2, currentCursor.terminalNodeId, terminalNode) && currentIndex.childIds.length > 0) {
|
|
23883
23979
|
const firstChildId = currentIndex.childIds[0];
|
|
23884
|
-
return firstChildId == null ? null : selectVisibleRowWithinSubtree(
|
|
23980
|
+
return firstChildId == null ? null : selectVisibleRowWithinSubtree(state2, firstChildId, 0, currentCursor.visibleDepth + 1);
|
|
23885
23981
|
}
|
|
23886
23982
|
}
|
|
23887
23983
|
let currentNodeId = currentCursor.terminalNodeId;
|
|
23888
23984
|
let currentVisibleDepth = currentCursor.visibleDepth;
|
|
23889
23985
|
while (true) {
|
|
23890
|
-
const currentNode = requireNode(
|
|
23891
|
-
if (currentNodeId ===
|
|
23986
|
+
const currentNode = requireNode(state2, currentNodeId);
|
|
23987
|
+
if (currentNodeId === state2.snapshot.rootId) return null;
|
|
23892
23988
|
const parentId = currentNode.parentId;
|
|
23893
|
-
const parentIndex = getDirectoryIndex(
|
|
23989
|
+
const parentIndex = getDirectoryIndex(state2, parentId);
|
|
23894
23990
|
const siblingIndex = ensureChildPositions(parentIndex).get(currentNodeId) ?? -1;
|
|
23895
23991
|
if (siblingIndex < 0) throw new Error(`Child ${String(currentNodeId)} was not found in its parent index`);
|
|
23896
23992
|
const nextSiblingId = parentIndex.childIds[siblingIndex + 1] ?? null;
|
|
23897
|
-
if (nextSiblingId != null) return selectVisibleRowWithinSubtree(
|
|
23898
|
-
if (isVisibleRowHeadNode(
|
|
23993
|
+
if (nextSiblingId != null) return selectVisibleRowWithinSubtree(state2, nextSiblingId, 0, currentVisibleDepth);
|
|
23994
|
+
if (isVisibleRowHeadNode(state2, currentNodeId)) currentVisibleDepth--;
|
|
23899
23995
|
currentNodeId = parentId;
|
|
23900
23996
|
}
|
|
23901
23997
|
}
|
|
@@ -23920,7 +24016,7 @@ function createVisibleTreeProjectionFromData(projection) {
|
|
|
23920
24016
|
}
|
|
23921
24017
|
};
|
|
23922
24018
|
}
|
|
23923
|
-
function buildVisibleTreeProjectionDataDFS(
|
|
24019
|
+
function buildVisibleTreeProjectionDataDFS(state2, maxRows) {
|
|
23924
24020
|
const paths = new Array(maxRows);
|
|
23925
24021
|
const parentRowIndex = new Int32Array(maxRows);
|
|
23926
24022
|
const posInSetByIndex = new Int32Array(maxRows);
|
|
@@ -23928,16 +24024,16 @@ function buildVisibleTreeProjectionDataDFS(state3, maxRows) {
|
|
|
23928
24024
|
let lastRowAtDepth = new Int32Array(INITIAL_PROJECTION_DEPTH_CAPACITY);
|
|
23929
24025
|
lastRowAtDepth.fill(-1);
|
|
23930
24026
|
let rowCount = 0;
|
|
23931
|
-
const { nodes, directories, segmentTable } =
|
|
24027
|
+
const { nodes, directories, segmentTable } = state2.snapshot;
|
|
23932
24028
|
const stack = [[
|
|
23933
|
-
directories.get(
|
|
24029
|
+
directories.get(state2.snapshot.rootId),
|
|
23934
24030
|
0,
|
|
23935
24031
|
-1,
|
|
23936
24032
|
""
|
|
23937
24033
|
]];
|
|
23938
|
-
const flattenEnabled =
|
|
23939
|
-
const pathCacheByNodeId =
|
|
23940
|
-
const pathCacheVersion =
|
|
24034
|
+
const flattenEnabled = state2.snapshot.options.flattenEmptyDirectories;
|
|
24035
|
+
const pathCacheByNodeId = state2.pathCacheByNodeId;
|
|
24036
|
+
const pathCacheVersion = state2.pathCacheVersion;
|
|
23941
24037
|
const segmentValues = segmentTable.valueById;
|
|
23942
24038
|
while (stack.length > 0 && rowCount < maxRows) {
|
|
23943
24039
|
const frame = stack[stack.length - 1];
|
|
@@ -23958,8 +24054,8 @@ function buildVisibleTreeProjectionDataDFS(state3, maxRows) {
|
|
|
23958
24054
|
const cachedPathEntry = pathCacheByNodeId.get(childId);
|
|
23959
24055
|
path = cachedPathEntry != null && cachedPathEntry.version === pathCacheVersion ? cachedPathEntry.path : `${parentPath}${segmentValues[childNode.nameId]}`;
|
|
23960
24056
|
} else {
|
|
23961
|
-
terminalNodeId = flattenEnabled ? getFlattenedTerminalDirectoryId(
|
|
23962
|
-
path = terminalNodeId === childId ? `${parentPath}${segmentValues[childNode.nameId]}/` : materializeNodePath(
|
|
24057
|
+
terminalNodeId = flattenEnabled ? getFlattenedTerminalDirectoryId(state2, childId) : childId;
|
|
24058
|
+
path = terminalNodeId === childId ? `${parentPath}${segmentValues[childNode.nameId]}/` : materializeNodePath(state2, terminalNodeId);
|
|
23963
24059
|
}
|
|
23964
24060
|
parentRowIndex[rowCount] = lastRowAtDepth[visibleDepth];
|
|
23965
24061
|
paths[rowCount] = path;
|
|
@@ -23968,7 +24064,7 @@ function buildVisibleTreeProjectionDataDFS(state3, maxRows) {
|
|
|
23968
24064
|
lastRowAtDepth[visibleDepth + 1] = rowCount;
|
|
23969
24065
|
rowCount += 1;
|
|
23970
24066
|
const terminalNode = nodes[terminalNodeId];
|
|
23971
|
-
if (terminalNode != null && isDirectoryNode(terminalNode) && isDirectoryExpanded(
|
|
24067
|
+
if (terminalNode != null && isDirectoryNode(terminalNode) && isDirectoryExpanded(state2, terminalNodeId, terminalNode)) stack.push([
|
|
23972
24068
|
directories.get(terminalNodeId),
|
|
23973
24069
|
0,
|
|
23974
24070
|
visibleDepth,
|
|
@@ -23996,19 +24092,19 @@ function buildVisibleTreeProjectionDataDFS(state3, maxRows) {
|
|
|
23996
24092
|
}
|
|
23997
24093
|
};
|
|
23998
24094
|
}
|
|
23999
|
-
function collectVisibleRowsDFS(
|
|
24095
|
+
function collectVisibleRowsDFS(state2, maxRows) {
|
|
24000
24096
|
const rows = new Array(maxRows);
|
|
24001
24097
|
let rowCount = 0;
|
|
24002
|
-
const { nodes, directories, segmentTable } =
|
|
24098
|
+
const { nodes, directories, segmentTable } = state2.snapshot;
|
|
24003
24099
|
const stack = [[
|
|
24004
|
-
directories.get(
|
|
24100
|
+
directories.get(state2.snapshot.rootId),
|
|
24005
24101
|
0,
|
|
24006
24102
|
-1
|
|
24007
24103
|
]];
|
|
24008
24104
|
const segmentValues = segmentTable.valueById;
|
|
24009
|
-
const flattenEnabled =
|
|
24010
|
-
const pathCacheByNodeId =
|
|
24011
|
-
const pathCacheVersion =
|
|
24105
|
+
const flattenEnabled = state2.snapshot.options.flattenEmptyDirectories;
|
|
24106
|
+
const pathCacheByNodeId = state2.pathCacheByNodeId;
|
|
24107
|
+
const pathCacheVersion = state2.pathCacheVersion;
|
|
24012
24108
|
while (stack.length > 0 && rowCount < maxRows) {
|
|
24013
24109
|
const frame = stack[stack.length - 1];
|
|
24014
24110
|
const dirIndex = frame[0];
|
|
@@ -24032,19 +24128,19 @@ function collectVisibleRowsDFS(state3, maxRows) {
|
|
|
24032
24128
|
kind: "file",
|
|
24033
24129
|
loadState: void 0,
|
|
24034
24130
|
name: segmentValues[childNode.nameId],
|
|
24035
|
-
path: cachedPathEntry != null && cachedPathEntry.version === pathCacheVersion ? cachedPathEntry.path : materializeNodePath(
|
|
24131
|
+
path: cachedPathEntry != null && cachedPathEntry.version === pathCacheVersion ? cachedPathEntry.path : materializeNodePath(state2, childId)
|
|
24036
24132
|
};
|
|
24037
24133
|
continue;
|
|
24038
24134
|
}
|
|
24039
|
-
const terminalNodeId = flattenEnabled ? getFlattenedTerminalDirectoryId(
|
|
24135
|
+
const terminalNodeId = flattenEnabled ? getFlattenedTerminalDirectoryId(state2, childId) : childId;
|
|
24040
24136
|
const cursor = {
|
|
24041
24137
|
headNodeId: childId,
|
|
24042
24138
|
terminalNodeId,
|
|
24043
24139
|
visibleDepth
|
|
24044
24140
|
};
|
|
24045
|
-
rows[rowCount++] = materializeVisibleRow(
|
|
24141
|
+
rows[rowCount++] = materializeVisibleRow(state2, cursor);
|
|
24046
24142
|
const terminalNode = nodes[terminalNodeId];
|
|
24047
|
-
if (terminalNode != null && isDirectoryNode(terminalNode) && isDirectoryExpanded(
|
|
24143
|
+
if (terminalNode != null && isDirectoryNode(terminalNode) && isDirectoryExpanded(state2, terminalNodeId, terminalNode)) stack.push([
|
|
24048
24144
|
directories.get(terminalNodeId),
|
|
24049
24145
|
0,
|
|
24050
24146
|
visibleDepth
|
|
@@ -24053,29 +24149,29 @@ function collectVisibleRowsDFS(state3, maxRows) {
|
|
|
24053
24149
|
if (rowCount < maxRows) rows.length = rowCount;
|
|
24054
24150
|
return rows;
|
|
24055
24151
|
}
|
|
24056
|
-
function materializeVisibleRow(
|
|
24057
|
-
const terminalNode = requireNode(
|
|
24058
|
-
const loadState = isDirectoryNode(terminalNode) ? getVisibleRowLoadState(
|
|
24059
|
-
const path = materializeNodePath(
|
|
24060
|
-
const name = getSegmentValue(
|
|
24061
|
-
const hasChildren = isDirectoryNode(terminalNode) && getDirectoryIndex(
|
|
24152
|
+
function materializeVisibleRow(state2, cursor) {
|
|
24153
|
+
const terminalNode = requireNode(state2, cursor.terminalNodeId);
|
|
24154
|
+
const loadState = isDirectoryNode(terminalNode) ? getVisibleRowLoadState(state2, cursor) : null;
|
|
24155
|
+
const path = materializeNodePath(state2, cursor.terminalNodeId);
|
|
24156
|
+
const name = getSegmentValue(state2.snapshot.segmentTable, terminalNode.nameId);
|
|
24157
|
+
const hasChildren = isDirectoryNode(terminalNode) && getDirectoryIndex(state2, cursor.terminalNodeId).childIds.length > 0;
|
|
24062
24158
|
const isFlattened = cursor.headNodeId !== cursor.terminalNodeId;
|
|
24063
|
-
const instrumentation =
|
|
24064
|
-
const flattenedSegments = isFlattened ? instrumentation == null ? collectFlattenedDirectoryChainIds(
|
|
24065
|
-
const node = requireNode(
|
|
24159
|
+
const instrumentation = state2.instrumentation;
|
|
24160
|
+
const flattenedSegments = isFlattened ? instrumentation == null ? collectFlattenedDirectoryChainIds(state2, cursor.headNodeId).map((nodeId) => {
|
|
24161
|
+
const node = requireNode(state2, nodeId);
|
|
24066
24162
|
return {
|
|
24067
24163
|
isTerminal: nodeId === cursor.terminalNodeId,
|
|
24068
|
-
name: getSegmentValue(
|
|
24164
|
+
name: getSegmentValue(state2.snapshot.segmentTable, node.nameId),
|
|
24069
24165
|
nodeId,
|
|
24070
|
-
path: materializeNodePath(
|
|
24166
|
+
path: materializeNodePath(state2, nodeId)
|
|
24071
24167
|
};
|
|
24072
|
-
}) : withBenchmarkPhase(instrumentation, "store.getVisibleSlice.flatten.collectSegments", () => collectFlattenedDirectoryChainIds(
|
|
24073
|
-
const node = requireNode(
|
|
24168
|
+
}) : withBenchmarkPhase(instrumentation, "store.getVisibleSlice.flatten.collectSegments", () => collectFlattenedDirectoryChainIds(state2, cursor.headNodeId).map((nodeId) => {
|
|
24169
|
+
const node = requireNode(state2, nodeId);
|
|
24074
24170
|
return {
|
|
24075
24171
|
isTerminal: nodeId === cursor.terminalNodeId,
|
|
24076
|
-
name: getSegmentValue(
|
|
24172
|
+
name: getSegmentValue(state2.snapshot.segmentTable, node.nameId),
|
|
24077
24173
|
nodeId,
|
|
24078
|
-
path: materializeNodePath(
|
|
24174
|
+
path: materializeNodePath(state2, nodeId)
|
|
24079
24175
|
};
|
|
24080
24176
|
})) : void 0;
|
|
24081
24177
|
return {
|
|
@@ -24083,7 +24179,7 @@ function materializeVisibleRow(state3, cursor) {
|
|
|
24083
24179
|
flattenedSegments,
|
|
24084
24180
|
hasChildren,
|
|
24085
24181
|
id: cursor.terminalNodeId,
|
|
24086
|
-
isExpanded: isDirectoryNode(terminalNode) && isDirectoryExpanded(
|
|
24182
|
+
isExpanded: isDirectoryNode(terminalNode) && isDirectoryExpanded(state2, cursor.terminalNodeId, terminalNode),
|
|
24087
24183
|
isFlattened,
|
|
24088
24184
|
isLoading: loadState === "loading",
|
|
24089
24185
|
kind: isDirectoryNode(terminalNode) ? "directory" : "file",
|
|
@@ -24092,13 +24188,13 @@ function materializeVisibleRow(state3, cursor) {
|
|
|
24092
24188
|
path
|
|
24093
24189
|
};
|
|
24094
24190
|
}
|
|
24095
|
-
function getVisibleRowLoadState(
|
|
24096
|
-
if (cursor.headNodeId === cursor.terminalNodeId) return getDirectoryLoadState(
|
|
24097
|
-
const chainNodeIds = collectFlattenedDirectoryChainIds(
|
|
24191
|
+
function getVisibleRowLoadState(state2, cursor) {
|
|
24192
|
+
if (cursor.headNodeId === cursor.terminalNodeId) return getDirectoryLoadState(state2, cursor.terminalNodeId);
|
|
24193
|
+
const chainNodeIds = collectFlattenedDirectoryChainIds(state2, cursor.headNodeId);
|
|
24098
24194
|
let hasUnloaded = false;
|
|
24099
24195
|
let hasError = false;
|
|
24100
24196
|
for (const nodeId of chainNodeIds) {
|
|
24101
|
-
const loadState = getDirectoryLoadState(
|
|
24197
|
+
const loadState = getDirectoryLoadState(state2, nodeId);
|
|
24102
24198
|
if (loadState === "loading") return "loading";
|
|
24103
24199
|
if (loadState === "error") {
|
|
24104
24200
|
hasError = true;
|
|
@@ -24192,8 +24288,8 @@ function sweepOpenVisibleCountsSoa(store2) {
|
|
|
24192
24288
|
}
|
|
24193
24289
|
|
|
24194
24290
|
// node_modules/@pierre/trees/dist/path-store/src/store.js
|
|
24195
|
-
function initializeOpenVisibleCounts(
|
|
24196
|
-
const { directories, nodes, options, rootId, presortedDirectoryNodeIds } =
|
|
24291
|
+
function initializeOpenVisibleCounts(state2) {
|
|
24292
|
+
const { directories, nodes, options, rootId, presortedDirectoryNodeIds } = state2.snapshot;
|
|
24197
24293
|
const flattenEmptyDirectories = options.flattenEmptyDirectories === true;
|
|
24198
24294
|
const walkDirectory = (nodeId) => {
|
|
24199
24295
|
const currentNode = nodes[nodeId];
|
|
@@ -24243,9 +24339,9 @@ function initializeOpenVisibleCounts(state3) {
|
|
|
24243
24339
|
rootNode.subtreeNodeCount = 1 + rootTotalChildSubtreeNodeCount;
|
|
24244
24340
|
rootNode.visibleSubtreeCount = rootTotalChildVisibleSubtreeCount;
|
|
24245
24341
|
}
|
|
24246
|
-
function initializeOpenVisibleCountsViaSoa(
|
|
24247
|
-
const { directories, nodes, rootId } =
|
|
24248
|
-
const soa = buildSoaNodeStore(
|
|
24342
|
+
function initializeOpenVisibleCountsViaSoa(state2) {
|
|
24343
|
+
const { directories, nodes, rootId } = state2.snapshot;
|
|
24344
|
+
const soa = buildSoaNodeStore(state2.snapshot);
|
|
24249
24345
|
sweepOpenVisibleCountsSoa(soa);
|
|
24250
24346
|
const subtreeNodeCount = soa.subtreeNodeCount;
|
|
24251
24347
|
const visibleSubtreeCount = soa.visibleSubtreeCount;
|
|
@@ -27369,17 +27465,17 @@ function RenameInput({ ariaLabel, isFlattened = false, ref, value, onBlur, onInp
|
|
|
27369
27465
|
|
|
27370
27466
|
// node_modules/@pierre/trees/dist/render/rowAttributes.js
|
|
27371
27467
|
function computeFileTreeRowElementAttributes(input) {
|
|
27372
|
-
const { row, mode: mode2, targetPath, ariaLabel, domId, isParked, itemHeight, features, state:
|
|
27468
|
+
const { row, mode: mode2, targetPath, ariaLabel, domId, isParked, itemHeight, features, state: state2, extraStyle } = input;
|
|
27373
27469
|
const isSticky = mode2 === "sticky";
|
|
27374
27470
|
const parentPath = row.ancestorPaths.at(-1) ?? "";
|
|
27375
27471
|
const stateAttributes = {};
|
|
27376
|
-
if (
|
|
27472
|
+
if (state2.isFocusRinged) stateAttributes["data-item-focused"] = true;
|
|
27377
27473
|
if (row.isSelected) stateAttributes["data-item-selected"] = true;
|
|
27378
|
-
if (
|
|
27379
|
-
if (
|
|
27380
|
-
if (
|
|
27381
|
-
if (
|
|
27382
|
-
if (
|
|
27474
|
+
if (state2.isContextHovered) stateAttributes["data-item-context-hover"] = "true";
|
|
27475
|
+
if (state2.isDragTarget) stateAttributes["data-item-drag-target"] = true;
|
|
27476
|
+
if (state2.isDragging) stateAttributes["data-item-dragging"] = true;
|
|
27477
|
+
if (state2.effectiveGitStatus != null) stateAttributes["data-item-git-status"] = state2.effectiveGitStatus;
|
|
27478
|
+
if (state2.containsGitChange) stateAttributes["data-item-contains-git-change"] = "true";
|
|
27383
27479
|
return {
|
|
27384
27480
|
"aria-expanded": !isSticky && row.kind === "directory" ? row.isExpanded : void 0,
|
|
27385
27481
|
"aria-haspopup": features.contextMenuEnabled ? "menu" : void 0,
|
|
@@ -30189,19 +30285,10 @@ var lickLabels = {
|
|
|
30189
30285
|
"sudo-request": ["Permission", "notice"]
|
|
30190
30286
|
};
|
|
30191
30287
|
var toolStates = {
|
|
30192
|
-
running:
|
|
30193
|
-
|
|
30194
|
-
|
|
30195
|
-
|
|
30196
|
-
done: [
|
|
30197
|
-
"Done",
|
|
30198
|
-
b`<swc-icon-checkmark-circle size="s" aria-hidden="true"></swc-icon-checkmark-circle>`
|
|
30199
|
-
],
|
|
30200
|
-
error: [
|
|
30201
|
-
"Failed",
|
|
30202
|
-
b`<swc-icon-alert-diamond size="s" aria-hidden="true"></swc-icon-alert-diamond>`
|
|
30203
|
-
],
|
|
30204
|
-
cancelled: ["Cancelled", b`<swc-icon-cancel size="s" aria-hidden="true"></swc-icon-cancel>`]
|
|
30288
|
+
running: "Running",
|
|
30289
|
+
done: "Done",
|
|
30290
|
+
error: "Failed",
|
|
30291
|
+
cancelled: "Cancelled"
|
|
30205
30292
|
};
|
|
30206
30293
|
var stepStates = {
|
|
30207
30294
|
running: "active",
|
|
@@ -30291,11 +30378,8 @@ function toolSummary(calls) {
|
|
|
30291
30378
|
}
|
|
30292
30379
|
return [...counts].sort((a23, b13) => b13[1] - a23[1]).map(([kind, count]) => `${count} ${count === 1 ? kind.one : kind.many}`).join(", ");
|
|
30293
30380
|
}
|
|
30294
|
-
function state2(status2, label = toolStates[status2][0]) {
|
|
30295
|
-
return b`<span class="state" data-state=${status2}>${toolStates[status2][1]}<span>${label}</span></span>`;
|
|
30296
|
-
}
|
|
30297
30381
|
function statusLabel2(status2) {
|
|
30298
|
-
return toolStates[status2]
|
|
30382
|
+
return toolStates[status2];
|
|
30299
30383
|
}
|
|
30300
30384
|
function overall(calls) {
|
|
30301
30385
|
const count = (status3) => calls.filter((call) => call.status === status3).length;
|
|
@@ -30418,32 +30502,31 @@ function notes(list5) {
|
|
|
30418
30502
|
}
|
|
30419
30503
|
function tool(call, color = "light", options = {}) {
|
|
30420
30504
|
const kind = toolKind(call.name);
|
|
30421
|
-
|
|
30422
|
-
|
|
30423
|
-
<span class="head">
|
|
30424
|
-
<swc-icon-chevron-right class="chevron" size="s" aria-hidden="true"></swc-icon-chevron-right>
|
|
30425
|
-
${chip(call, options.model ?? null)}
|
|
30426
|
-
<span class="title">${call.title}</span>
|
|
30427
|
-
<span class="name">${call.name}</span>
|
|
30428
|
-
${call.meta ? b`<span class="tool-meta">${call.meta}</span>` : A}
|
|
30429
|
-
${state2(call.status)}
|
|
30430
|
-
</span>
|
|
30431
|
-
${call.image ? b`<span class="thumb"><img src=${call.image} alt="" /></span>` : A}
|
|
30432
|
-
</summary>
|
|
30433
|
-
<div class="call">
|
|
30505
|
+
const label = `${call.title}, ${statusLabel2(call.status)}`;
|
|
30506
|
+
const content = b`<div class="call">
|
|
30434
30507
|
${body(call, color)}
|
|
30435
30508
|
${call.output ? b`<pre class="output">${call.output}</pre>` : A}
|
|
30436
30509
|
${call.notes?.length ? notes(call.notes) : A}
|
|
30437
30510
|
${call.image ? b`<img class="shot" src=${call.image} alt=${call.title} />` : A}
|
|
30511
|
+
${call.meta ? b`<span class="tool-meta">${call.meta}</span>` : A}
|
|
30438
30512
|
${options.owner ? b`<span class="ran">Ran at ${when(options.owner.at)}</span>` : A}
|
|
30439
|
-
</div
|
|
30513
|
+
</div>`;
|
|
30514
|
+
if (!options.run) {
|
|
30515
|
+
return b`<div class="tool" id=${`run-${call.id}`} role="region" aria-label=${label} data-id=${options.owner?.id ?? A} data-status=${call.status} data-tool=${call.name} data-kind=${kind.id}>${content}</div>`;
|
|
30516
|
+
}
|
|
30517
|
+
return b`<details class="tool run" id=${`run-${call.id}`} data-id=${options.owner?.id ?? A} data-status=${call.status} data-tool=${call.name} data-kind=${kind.id} ?open=${!!options.open} @toggle=${options.toggle ?? A}>
|
|
30518
|
+
<summary class="strip" aria-label=${label}>
|
|
30519
|
+
<span class="icons"><span class="run">${chip(call, options.model ?? null)}</span></span>
|
|
30520
|
+
<span class="label">${call.title}</span>
|
|
30521
|
+
</summary>
|
|
30522
|
+
${content}
|
|
30440
30523
|
</details>`;
|
|
30441
30524
|
}
|
|
30442
30525
|
var clusterSize = 3;
|
|
30443
30526
|
function runs(calls, handlers) {
|
|
30444
30527
|
const groups2 = calls.length >= clusterSize ? [calls] : calls.map((call) => [call]);
|
|
30445
30528
|
return groups2.map(
|
|
30446
|
-
(group) => b`<slicc-tool-runs .calls=${group} .model=${handlers.model} .owners=${handlers.owners ?? null} .color=${handlers.color}></slicc-tool-runs>`
|
|
30529
|
+
(group) => b`<slicc-tool-runs .calls=${group} .agent=${handlers.agentId ?? ""} .model=${handlers.model} .owners=${handlers.owners ?? null} .color=${handlers.color}></slicc-tool-runs>`
|
|
30447
30530
|
);
|
|
30448
30531
|
}
|
|
30449
30532
|
function media(items) {
|
|
@@ -30981,21 +31064,6 @@ var messageCss = i`
|
|
|
30981
31064
|
summary::-webkit-details-marker {
|
|
30982
31065
|
display: none;
|
|
30983
31066
|
}
|
|
30984
|
-
details.tool > summary {
|
|
30985
|
-
padding-inline: var(--swc-spacing-100);
|
|
30986
|
-
}
|
|
30987
|
-
details.tool > summary {
|
|
30988
|
-
flex-direction: column;
|
|
30989
|
-
align-items: stretch;
|
|
30990
|
-
justify-content: center;
|
|
30991
|
-
gap: 0;
|
|
30992
|
-
}
|
|
30993
|
-
details.tool > summary > .head {
|
|
30994
|
-
display: flex;
|
|
30995
|
-
align-items: center;
|
|
30996
|
-
gap: var(--swc-spacing-100);
|
|
30997
|
-
min-inline-size: 0;
|
|
30998
|
-
}
|
|
30999
31067
|
details.tool > summary:hover,
|
|
31000
31068
|
.runs button:hover {
|
|
31001
31069
|
background: var(--swc-gray-100);
|
|
@@ -31014,75 +31082,39 @@ var messageCss = i`
|
|
|
31014
31082
|
details[open] > summary .chevron {
|
|
31015
31083
|
transform: rotate(90deg);
|
|
31016
31084
|
}
|
|
31017
|
-
.
|
|
31018
|
-
.
|
|
31019
|
-
.runs .names,
|
|
31020
|
-
.lick .text {
|
|
31085
|
+
.lick .text,
|
|
31086
|
+
.runs .label {
|
|
31021
31087
|
min-inline-size: 0;
|
|
31022
31088
|
overflow: hidden;
|
|
31023
31089
|
text-overflow: ellipsis;
|
|
31024
31090
|
white-space: nowrap;
|
|
31025
31091
|
}
|
|
31026
|
-
.tool .title {
|
|
31027
|
-
flex: 0 1 auto;
|
|
31028
|
-
font-weight: var(--swc-medium-font-weight);
|
|
31029
|
-
}
|
|
31030
31092
|
.lick .text {
|
|
31031
31093
|
flex: 1;
|
|
31032
31094
|
}
|
|
31033
|
-
.tool .name {
|
|
31034
|
-
flex: 0 0.001 auto;
|
|
31035
|
-
max-inline-size: 50%;
|
|
31036
|
-
font-family: var(--swc-code-font-family-stack);
|
|
31037
|
-
color: var(--swc-neutral-subdued-content-color-default);
|
|
31038
|
-
}
|
|
31039
|
-
.tool-meta {
|
|
31040
|
-
flex: none;
|
|
31041
|
-
color: var(--swc-neutral-subdued-content-color-default);
|
|
31042
|
-
}
|
|
31043
|
-
.runs .summary .names {
|
|
31044
|
-
flex: 0 1 auto;
|
|
31045
|
-
}
|
|
31046
|
-
.state {
|
|
31047
|
-
display: inline-flex;
|
|
31048
|
-
align-items: center;
|
|
31049
|
-
gap: var(--swc-spacing-75);
|
|
31050
|
-
flex: none;
|
|
31051
|
-
margin-inline-start: auto;
|
|
31052
|
-
padding-inline-start: var(--swc-spacing-100);
|
|
31053
|
-
color: var(--swc-neutral-subdued-content-color-default);
|
|
31054
|
-
}
|
|
31055
|
-
.state[data-state='done'] swc-icon-checkmark-circle {
|
|
31056
|
-
color: var(--swc-positive-visual-color);
|
|
31057
|
-
}
|
|
31058
|
-
.state[data-state='running'] {
|
|
31059
|
-
color: var(--swc-neutral-content-color-default);
|
|
31060
|
-
}
|
|
31061
|
-
.state[data-state='error'] {
|
|
31062
|
-
color: var(--swc-negative-content-color-default);
|
|
31063
|
-
font-weight: var(--swc-bold-font-weight);
|
|
31064
|
-
}
|
|
31065
31095
|
swc-system-message > slicc-tool-runs + slicc-tool-runs {
|
|
31066
31096
|
margin-block-start: var(--swc-spacing-75);
|
|
31067
31097
|
}
|
|
31068
31098
|
slicc-tool-runs {
|
|
31069
31099
|
display: block;
|
|
31100
|
+
container-type: inline-size;
|
|
31070
31101
|
}
|
|
31071
31102
|
.runs {
|
|
31103
|
+
--run-size: var(--swc-spacing-500);
|
|
31104
|
+
--run-gap: var(--swc-spacing-25);
|
|
31105
|
+
--run-icons: calc(5 * var(--run-size) + 4 * var(--run-gap));
|
|
31072
31106
|
display: flex;
|
|
31073
31107
|
flex-direction: column;
|
|
31074
|
-
align-items: center;
|
|
31075
31108
|
min-inline-size: 0;
|
|
31109
|
+
margin-inline: var(--swc-spacing-700);
|
|
31076
31110
|
}
|
|
31077
|
-
.
|
|
31078
|
-
|
|
31079
|
-
|
|
31080
|
-
|
|
31081
|
-
|
|
31082
|
-
|
|
31083
|
-
|
|
31084
|
-
margin-inline: auto;
|
|
31085
|
-
padding-inline: var(--swc-spacing-100) var(--swc-spacing-200);
|
|
31111
|
+
.strip {
|
|
31112
|
+
display: grid;
|
|
31113
|
+
grid-template-columns: var(--run-icons) minmax(0, 1fr);
|
|
31114
|
+
align-items: center;
|
|
31115
|
+
gap: var(--swc-spacing-50) var(--swc-spacing-200);
|
|
31116
|
+
min-block-size: 0;
|
|
31117
|
+
padding: var(--swc-spacing-50);
|
|
31086
31118
|
border: var(--swc-border-width-100) solid var(--swc-gray-200);
|
|
31087
31119
|
border-radius: var(--swc-corner-radius-500);
|
|
31088
31120
|
background: var(--swc-background-layer-1-color);
|
|
@@ -31091,39 +31123,28 @@ var messageCss = i`
|
|
|
31091
31123
|
details.run[open] > summary {
|
|
31092
31124
|
margin-block-end: var(--swc-spacing-75);
|
|
31093
31125
|
}
|
|
31094
|
-
|
|
31095
|
-
details.run > summary .thumb {
|
|
31096
|
-
display: none;
|
|
31097
|
-
}
|
|
31098
|
-
details.run > summary .state {
|
|
31099
|
-
padding-inline-start: 0;
|
|
31100
|
-
}
|
|
31101
|
-
details.run > .call {
|
|
31102
|
-
padding-inline-start: var(--swc-spacing-100);
|
|
31103
|
-
}
|
|
31104
|
-
.strip {
|
|
31126
|
+
.icons {
|
|
31105
31127
|
display: flex;
|
|
31106
|
-
|
|
31128
|
+
gap: var(--run-gap);
|
|
31129
|
+
overflow-x: auto;
|
|
31130
|
+
scrollbar-width: none;
|
|
31131
|
+
}
|
|
31132
|
+
.icons > .run {
|
|
31133
|
+
display: inline-flex;
|
|
31134
|
+
flex: none;
|
|
31107
31135
|
align-items: center;
|
|
31108
31136
|
justify-content: center;
|
|
31109
|
-
|
|
31110
|
-
|
|
31111
|
-
padding: var(--swc-spacing-50) var(--swc-spacing-75);
|
|
31112
|
-
border: var(--swc-border-width-100) solid var(--swc-gray-200);
|
|
31113
|
-
border-radius: var(--swc-corner-radius-500);
|
|
31114
|
-
background: var(--swc-background-layer-1-color);
|
|
31115
|
-
box-sizing: border-box;
|
|
31137
|
+
inline-size: var(--run-size);
|
|
31138
|
+
block-size: var(--run-size);
|
|
31116
31139
|
}
|
|
31117
|
-
.
|
|
31118
|
-
|
|
31119
|
-
|
|
31120
|
-
|
|
31121
|
-
|
|
31140
|
+
.runs .label {
|
|
31141
|
+
block-size: var(--run-size);
|
|
31142
|
+
padding-inline: var(--swc-spacing-100);
|
|
31143
|
+
line-height: var(--run-size);
|
|
31144
|
+
text-align: end;
|
|
31145
|
+
font-weight: var(--swc-medium-font-weight);
|
|
31122
31146
|
}
|
|
31123
31147
|
.runs button {
|
|
31124
|
-
display: inline-flex;
|
|
31125
|
-
align-items: center;
|
|
31126
|
-
gap: var(--swc-spacing-75);
|
|
31127
31148
|
margin: 0;
|
|
31128
31149
|
padding: 0;
|
|
31129
31150
|
border: 0;
|
|
@@ -31137,25 +31158,21 @@ var messageCss = i`
|
|
|
31137
31158
|
outline: var(--swc-focus-indicator-thickness) solid var(--swc-focus-indicator-color);
|
|
31138
31159
|
outline-offset: calc(-1 * var(--swc-focus-indicator-thickness));
|
|
31139
31160
|
}
|
|
31140
|
-
button.run {
|
|
31141
|
-
justify-content: center;
|
|
31142
|
-
inline-size: var(--swc-spacing-500);
|
|
31143
|
-
block-size: var(--swc-spacing-500);
|
|
31144
|
-
}
|
|
31145
31161
|
button.run[aria-expanded='true'] {
|
|
31146
31162
|
background: var(--swc-accent-subtle-background-color-default);
|
|
31147
31163
|
}
|
|
31148
|
-
|
|
31149
|
-
|
|
31150
|
-
|
|
31151
|
-
|
|
31152
|
-
|
|
31153
|
-
|
|
31154
|
-
|
|
31155
|
-
|
|
31156
|
-
|
|
31157
|
-
|
|
31158
|
-
|
|
31164
|
+
@container (inline-size < 480px) {
|
|
31165
|
+
.runs {
|
|
31166
|
+
margin-inline: var(--swc-spacing-300);
|
|
31167
|
+
}
|
|
31168
|
+
.strip {
|
|
31169
|
+
grid-template-columns: minmax(0, 1fr);
|
|
31170
|
+
}
|
|
31171
|
+
.icons {
|
|
31172
|
+
inline-size: calc(
|
|
31173
|
+
round(down, 100% + var(--run-gap), var(--run-size) + var(--run-gap)) - var(--run-gap)
|
|
31174
|
+
);
|
|
31175
|
+
}
|
|
31159
31176
|
}
|
|
31160
31177
|
.cards {
|
|
31161
31178
|
margin-block-start: var(--swc-spacing-75);
|
|
@@ -31237,12 +31254,12 @@ var messageCss = i`
|
|
|
31237
31254
|
display: flex;
|
|
31238
31255
|
flex-direction: column;
|
|
31239
31256
|
gap: var(--swc-spacing-100);
|
|
31240
|
-
padding: var(--swc-spacing-75) var(--swc-spacing-
|
|
31257
|
+
padding-block: var(--swc-spacing-75) var(--swc-spacing-200);
|
|
31241
31258
|
}
|
|
31242
31259
|
.call:empty {
|
|
31243
31260
|
display: none;
|
|
31244
31261
|
}
|
|
31245
|
-
.call > .ran {
|
|
31262
|
+
.call > :is(.ran, .tool-meta) {
|
|
31246
31263
|
font-size: var(--swc-font-size-75);
|
|
31247
31264
|
color: var(--swc-neutral-subdued-content-color-default);
|
|
31248
31265
|
}
|
|
@@ -31302,19 +31319,6 @@ var messageCss = i`
|
|
|
31302
31319
|
white-space: pre-wrap;
|
|
31303
31320
|
overflow-wrap: anywhere;
|
|
31304
31321
|
}
|
|
31305
|
-
.thumb {
|
|
31306
|
-
padding-inline-start: calc(var(--swc-spacing-100) + var(--swc-spacing-300));
|
|
31307
|
-
padding-block: var(--swc-spacing-75);
|
|
31308
|
-
}
|
|
31309
|
-
.thumb img {
|
|
31310
|
-
display: block;
|
|
31311
|
-
max-inline-size: min(100%, calc(var(--swc-spacing-1000) * 2));
|
|
31312
|
-
max-block-size: calc(var(--swc-spacing-1000) * 1.25);
|
|
31313
|
-
border-radius: var(--swc-corner-radius-75);
|
|
31314
|
-
}
|
|
31315
|
-
details[open] > summary .thumb {
|
|
31316
|
-
display: none;
|
|
31317
|
-
}
|
|
31318
31322
|
.shot {
|
|
31319
31323
|
display: block;
|
|
31320
31324
|
max-inline-size: min(100%, calc(var(--swc-spacing-1000) * 5));
|
|
@@ -31661,7 +31665,7 @@ function requiresText(item2, all2) {
|
|
|
31661
31665
|
].filter(Boolean);
|
|
31662
31666
|
return parts2.length ? parts2.join("; ") : null;
|
|
31663
31667
|
}
|
|
31664
|
-
var snapshot = (items) => new Map(items.map(({ id, state:
|
|
31668
|
+
var snapshot = (items) => new Map(items.map(({ id, state: state2, error }) => [id, { state: state2, error }]));
|
|
31665
31669
|
function settled2(failures, before, after) {
|
|
31666
31670
|
return new Map(
|
|
31667
31671
|
[...failures].filter(([id]) => {
|
|
@@ -32077,8 +32081,8 @@ var SliccUpdates = class extends ModelElement {
|
|
|
32077
32081
|
return b`<span>Checked <time datetime=${date.toISOString()}>${shown4}</time></span>`;
|
|
32078
32082
|
}
|
|
32079
32083
|
#item(item2) {
|
|
32080
|
-
const [variant,
|
|
32081
|
-
const label = item2.state === "failed" && item2.from !== null ? "Update failed" :
|
|
32084
|
+
const [variant, state2] = states[item2.state];
|
|
32085
|
+
const label = item2.state === "failed" && item2.from !== null ? "Update failed" : state2;
|
|
32082
32086
|
const error = this.failures.get(item2.id) ?? item2.error;
|
|
32083
32087
|
return b`<swc-divider size="s"></swc-divider>
|
|
32084
32088
|
<article data-id=${item2.id} data-state=${item2.state} aria-label=${item2.label}>
|
|
@@ -33026,10 +33030,10 @@ var SliccApp = class extends ThemedElement {
|
|
|
33026
33030
|
<swc-tooltip for="updates" placement="bottom">${text2}</swc-tooltip>`;
|
|
33027
33031
|
}
|
|
33028
33032
|
#tabsIndicator() {
|
|
33029
|
-
const
|
|
33030
|
-
const light = tabsLight(
|
|
33031
|
-
if (!
|
|
33032
|
-
return b`<span id="tabs" class="tabs" tabindex="0" role="img" data-tabs data-role=${
|
|
33033
|
+
const state2 = this.model?.tabs?.state();
|
|
33034
|
+
const light = tabsLight(state2);
|
|
33035
|
+
if (!state2 || !light) return A;
|
|
33036
|
+
return b`<span id="tabs" class="tabs" tabindex="0" role="img" data-tabs data-role=${state2.role} ?data-stalled=${state2.stalled} data-skew=${state2.skew ?? A} aria-label=${`${light.text}. ${light.tooltip}`}>
|
|
33033
33037
|
<swc-status-light size="s" variant=${light.variant}>${this.screen === "phone" ? A : light.text}</swc-status-light>
|
|
33034
33038
|
</span>
|
|
33035
33039
|
<swc-tooltip for="tabs" placement="bottom">${light.tooltip}</swc-tooltip>`;
|
|
@@ -33048,9 +33052,9 @@ var SliccApp = class extends ThemedElement {
|
|
|
33048
33052
|
const port = this.model?.network;
|
|
33049
33053
|
if (!port || !this.#offers("network")) return A;
|
|
33050
33054
|
const status2 = networkStatus(port);
|
|
33051
|
-
const [variant,
|
|
33055
|
+
const [variant, state2] = networkHealth[status2.health];
|
|
33052
33056
|
const label = networkLabel(status2);
|
|
33053
|
-
const content = this.screen === "phone" ? networkIcon[status2.health] : b`<swc-status-light size="s" variant=${variant}>Network${status2.health === "ok" ? A : b`<span class="state"> ${
|
|
33057
|
+
const content = this.screen === "phone" ? networkIcon[status2.health] : b`<swc-status-light size="s" variant=${variant}>Network${status2.health === "ok" ? A : b`<span class="state"> ${state2.toLowerCase()}</span>`}</swc-status-light>`;
|
|
33054
33058
|
return b`<swc-action-button id="network" quiet size="s" data-network data-health=${status2.health} accessible-label=${label} @click=${() => this.show("network")}>${content}</swc-action-button>
|
|
33055
33059
|
<swc-tooltip for="network" placement="bottom">${status2.detail ?? label}${status2.tailnet?.state === "running" ? " Tailscale is connected." : ""}</swc-tooltip>`;
|
|
33056
33060
|
}
|
|
@@ -33349,6 +33353,10 @@ function origin() {
|
|
|
33349
33353
|
const active = focused();
|
|
33350
33354
|
return active?.closest("slicc-terminal") ?? active;
|
|
33351
33355
|
}
|
|
33356
|
+
var inCwd = (approval) => approval.alwaysScope === "cwd" && !!approval.cwd;
|
|
33357
|
+
function alwaysHint(approval) {
|
|
33358
|
+
return inCwd(approval) ? `Always allow lets ${approval.requester.name} run exactly this command with sudo, in ${approval.cwd}, without asking again.` : `Always allow lets ${approval.requester.name} run exactly this command with sudo without asking again.`;
|
|
33359
|
+
}
|
|
33352
33360
|
function waiting(model, now) {
|
|
33353
33361
|
return [...model?.approvals?.list() ?? []].filter((approval) => approval.expiresAt > now).sort((a23, b13) => a23.createdAt - b13.createdAt);
|
|
33354
33362
|
}
|
|
@@ -33606,12 +33614,12 @@ var SliccApprovals = class extends ModelElement {
|
|
|
33606
33614
|
${this.#request(approval)}
|
|
33607
33615
|
${approval.cwd ? b`<p class="cwd">In ${approval.cwd}</p>` : A}
|
|
33608
33616
|
${rules ? b`<div class="rules" data-secret-rules=${rules}><swc-icon-alert-triangle size="s" aria-hidden="true"></swc-icon-alert-triangle><p>${verdict.certain ? b`<strong>This changes secret rules.</strong> It names <code>${rules}</code>, where SLICC keeps which secrets programs may use and where they may be sent.` : b`<strong>This may change secret rules.</strong> SLICC can't tell where <code>${rules}</code> leads, and it could reach the files where SLICC keeps which secrets programs may use and where they may be sent.`} Allow it only if you asked for this change.</p></div>` : A}
|
|
33609
|
-
${always ? b`<p class="hint"
|
|
33617
|
+
${always ? b`<p class="hint">${alwaysHint(approval)}</p>` : A}
|
|
33610
33618
|
${failure2 ? b`<p class="problem" role="alert" data-error><swc-icon-alert-triangle size="s" aria-hidden="true"></swc-icon-alert-triangle><span>${failure2}</span></p>` : A}
|
|
33611
33619
|
<p class="timer" data-timer>Denied automatically in ${countdown(approval.expiresAt - this.now)}.</p>
|
|
33612
33620
|
${rest.length ? b`<p class="more" data-more>${rest.length === 1 ? "1 more request is waiting." : `${rest.length} more requests are waiting.`}</p>` : A}
|
|
33613
33621
|
${this.#button(approval, "deny", "Deny", "secondary")}
|
|
33614
|
-
${always ? this.#button(approval, "always", "Always allow", "secondary") : A}
|
|
33622
|
+
${always ? this.#button(approval, "always", inCwd(approval) ? "Always allow in this directory" : "Always allow", "secondary") : A}
|
|
33615
33623
|
${this.#button(approval, "once", "Allow once", "accent")}
|
|
33616
33624
|
</sp-alert-dialog>`
|
|
33617
33625
|
);
|
|
@@ -35727,6 +35735,7 @@ var navigation = /* @__PURE__ */ new Set([
|
|
|
35727
35735
|
"PageUp",
|
|
35728
35736
|
"PageDown"
|
|
35729
35737
|
]);
|
|
35738
|
+
var upward = /* @__PURE__ */ new Set(["ArrowUp", "PageUp", "Home"]);
|
|
35730
35739
|
var compactWidth = 560;
|
|
35731
35740
|
var failed = (message) => message.role === "assistant" ? message.status === "error" : message.role === "system" && message.kind === "error";
|
|
35732
35741
|
function carriesFiles(event2) {
|
|
@@ -35923,7 +35932,7 @@ var SliccChat = class extends ThemedElement {
|
|
|
35923
35932
|
model: null,
|
|
35924
35933
|
readOnly: false,
|
|
35925
35934
|
answer: (questionId, answer) => this.model?.agent.answer(this.#id(), questionId, answer),
|
|
35926
|
-
resolve: (messageId,
|
|
35935
|
+
resolve: (messageId, state2) => this.model?.agent.resolveLick(this.#id(), messageId, state2),
|
|
35927
35936
|
action: (action, messageId) => this.#action(action, messageId),
|
|
35928
35937
|
dropping: (messageId) => failedTurns(this.model.agent.messages(this.#id()), messageId).length,
|
|
35929
35938
|
open: (path) => this.dispatchEvent(
|
|
@@ -35974,6 +35983,12 @@ var SliccChat = class extends ThemedElement {
|
|
|
35974
35983
|
}
|
|
35975
35984
|
#stuck = true;
|
|
35976
35985
|
#last = 0;
|
|
35986
|
+
#height = 0;
|
|
35987
|
+
#input = Number.NEGATIVE_INFINITY;
|
|
35988
|
+
#up = Number.NEGATIVE_INFINITY;
|
|
35989
|
+
#from = 0;
|
|
35990
|
+
#start = 0;
|
|
35991
|
+
#settle;
|
|
35977
35992
|
#tail = "";
|
|
35978
35993
|
#sent(agentId) {
|
|
35979
35994
|
const last = this.model?.agent.messages(agentId).at(-1);
|
|
@@ -35988,12 +36003,42 @@ var SliccChat = class extends ThemedElement {
|
|
|
35988
36003
|
const log = this.#log();
|
|
35989
36004
|
log.scrollTop = log.scrollHeight;
|
|
35990
36005
|
this.#last = log.scrollTop;
|
|
36006
|
+
this.#height = log.scrollHeight;
|
|
35991
36007
|
}
|
|
35992
36008
|
#scroll = () => {
|
|
35993
36009
|
const log = this.#log();
|
|
35994
|
-
|
|
35995
|
-
|
|
36010
|
+
const reader = log.scrollHeight <= this.#height || this.#height - log.scrollTop - log.clientHeight >= 48 || performance.now() - this.#input < 1e3;
|
|
36011
|
+
const rising = performance.now() - this.#up < 1e3 && log.scrollTop <= this.#from;
|
|
36012
|
+
if (log.scrollHeight - log.scrollTop - log.clientHeight < 48) this.#stuck ||= !rising;
|
|
36013
|
+
else if (reader && log.scrollTop < this.#last) this.#stuck = false;
|
|
35996
36014
|
this.#last = log.scrollTop;
|
|
36015
|
+
this.#height = log.scrollHeight;
|
|
36016
|
+
};
|
|
36017
|
+
#intent = {
|
|
36018
|
+
passive: true,
|
|
36019
|
+
handleEvent: (event2) => {
|
|
36020
|
+
this.#input = performance.now();
|
|
36021
|
+
const up = event2 instanceof WheelEvent ? event2.deltaY < 0 && !event2.ctrlKey : event2 instanceof KeyboardEvent && (upward.has(event2.key) || event2.key === " " && event2.shiftKey);
|
|
36022
|
+
const at = this.#log().scrollTop;
|
|
36023
|
+
if (!up || at <= 0) return;
|
|
36024
|
+
this.#from = at;
|
|
36025
|
+
this.#up = this.#input;
|
|
36026
|
+
if (this.#settle === void 0) this.#start = Math.max(at, this.#last);
|
|
36027
|
+
this.#stuck = false;
|
|
36028
|
+
clearTimeout(this.#settle);
|
|
36029
|
+
this.#settle = setTimeout(() => {
|
|
36030
|
+
this.#settle = void 0;
|
|
36031
|
+
if (this.#start - this.#log().scrollTop >= 48) return;
|
|
36032
|
+
this.#stuck = true;
|
|
36033
|
+
this.#pin();
|
|
36034
|
+
}, 400);
|
|
36035
|
+
}
|
|
36036
|
+
};
|
|
36037
|
+
#hold = (event2) => {
|
|
36038
|
+
if (event2.target === event2.currentTarget) this.#input = Number.POSITIVE_INFINITY;
|
|
36039
|
+
};
|
|
36040
|
+
#release = () => {
|
|
36041
|
+
if (this.#input === Number.POSITIVE_INFINITY) this.#input = performance.now();
|
|
35997
36042
|
};
|
|
35998
36043
|
#refresh(jump) {
|
|
35999
36044
|
if (jump) this.#stuck = true;
|
|
@@ -36008,11 +36053,16 @@ var SliccChat = class extends ThemedElement {
|
|
|
36008
36053
|
}
|
|
36009
36054
|
connectedCallback() {
|
|
36010
36055
|
super.connectedCallback();
|
|
36056
|
+
globalThis.addEventListener("pointerup", this.#release, true);
|
|
36057
|
+
globalThis.addEventListener("pointercancel", this.#release, true);
|
|
36011
36058
|
if (this.hasUpdated) this.#observe();
|
|
36012
36059
|
}
|
|
36013
36060
|
disconnectedCallback() {
|
|
36014
36061
|
super.disconnectedCallback();
|
|
36062
|
+
globalThis.removeEventListener("pointerup", this.#release, true);
|
|
36063
|
+
globalThis.removeEventListener("pointercancel", this.#release, true);
|
|
36015
36064
|
this.#resize.disconnect();
|
|
36065
|
+
clearTimeout(this.#settle);
|
|
36016
36066
|
}
|
|
36017
36067
|
firstUpdated() {
|
|
36018
36068
|
this.#observe();
|
|
@@ -36184,6 +36234,7 @@ var SliccChat = class extends ThemedElement {
|
|
|
36184
36234
|
const agent = this.#agent();
|
|
36185
36235
|
const watch = watchOnly(this.model);
|
|
36186
36236
|
this.#handlers.readOnly = !!agent?.frozen || !!watch;
|
|
36237
|
+
this.#handlers.agentId = agent?.id;
|
|
36187
36238
|
const messages = agent ? this.model?.agent.messages(agent.id) ?? [] : [];
|
|
36188
36239
|
this.#tail = messages.at(-1)?.id ?? "";
|
|
36189
36240
|
return b`
|
|
@@ -36198,6 +36249,11 @@ var SliccChat = class extends ThemedElement {
|
|
|
36198
36249
|
aria-label="Conversation"
|
|
36199
36250
|
tabindex="-1"
|
|
36200
36251
|
@scroll=${this.#scroll}
|
|
36252
|
+
@wheel=${this.#intent}
|
|
36253
|
+
@touchstart=${this.#intent}
|
|
36254
|
+
@touchmove=${this.#intent}
|
|
36255
|
+
@keydown=${this.#intent}
|
|
36256
|
+
@pointerdown=${this.#hold}
|
|
36201
36257
|
>
|
|
36202
36258
|
<div class="column" @keydown=${this.#keys}>
|
|
36203
36259
|
${agent && messages.length > 0 ? b`<swc-conversation-thread>${c(
|
|
@@ -37140,8 +37196,8 @@ function fieldOf(error, field) {
|
|
|
37140
37196
|
return isVaultFailure(error) && error.code === "EINVAL" ? field : null;
|
|
37141
37197
|
}
|
|
37142
37198
|
function away(vault) {
|
|
37143
|
-
const
|
|
37144
|
-
return
|
|
37199
|
+
const state2 = vault.availability?.() ?? (vault.status() ? "ready" : "waiting");
|
|
37200
|
+
return state2 === "connecting" || state2 === "waiting";
|
|
37145
37201
|
}
|
|
37146
37202
|
function take(input) {
|
|
37147
37203
|
const value = input.value;
|
|
@@ -37321,10 +37377,10 @@ var SliccVaultButton = class extends i2 {
|
|
|
37321
37377
|
const at = order.indexOf(null);
|
|
37322
37378
|
order[event2.direction === "next" ? at + 1 : at - 1]?.focus();
|
|
37323
37379
|
} else if (event2.event === "popup") {
|
|
37324
|
-
const { intent, state:
|
|
37380
|
+
const { intent, state: state2 } = event2;
|
|
37325
37381
|
this.dispatchEvent(
|
|
37326
37382
|
new CustomEvent("vault-popup", {
|
|
37327
|
-
detail: { intent, state:
|
|
37383
|
+
detail: { intent, state: state2 },
|
|
37328
37384
|
bubbles: true,
|
|
37329
37385
|
composed: true
|
|
37330
37386
|
})
|
|
@@ -37795,8 +37851,8 @@ var SliccComposer = class extends ThemedElement {
|
|
|
37795
37851
|
];
|
|
37796
37852
|
}
|
|
37797
37853
|
#held() {
|
|
37798
|
-
const
|
|
37799
|
-
return
|
|
37854
|
+
const state2 = this.model?.follow?.state();
|
|
37855
|
+
return state2?.link === "reconnecting" ? state2.owner : null;
|
|
37800
37856
|
}
|
|
37801
37857
|
#switch(id) {
|
|
37802
37858
|
if (this.#agent)
|
|
@@ -38958,7 +39014,7 @@ var SliccNotices = class extends ModelElement {
|
|
|
38958
39014
|
// src/app/secrets.ts
|
|
38959
39015
|
var kinds = { secret: null, grant: "Sign-in", model: "Model key", mcp: "MCP server" };
|
|
38960
39016
|
var lockModes = {
|
|
38961
|
-
auto: "Unlocks
|
|
39017
|
+
auto: "Unlocks automatically in this browser",
|
|
38962
39018
|
passkey: "Unlocks with a passkey",
|
|
38963
39019
|
passphrase: "Unlocks with a passphrase"
|
|
38964
39020
|
};
|
|
@@ -39219,6 +39275,7 @@ var SliccSecrets = class extends ThemedElement {
|
|
|
39219
39275
|
font-weight: var(--swc-bold-font-weight);
|
|
39220
39276
|
}
|
|
39221
39277
|
.box .actions,
|
|
39278
|
+
.locked,
|
|
39222
39279
|
.buttons {
|
|
39223
39280
|
display: flex;
|
|
39224
39281
|
flex-wrap: wrap;
|
|
@@ -39782,7 +39839,7 @@ var SliccSecrets = class extends ThemedElement {
|
|
|
39782
39839
|
</div>`;
|
|
39783
39840
|
}
|
|
39784
39841
|
#locked(locked) {
|
|
39785
|
-
return locked ? b`<p class="muted" data-locked>Unlock the vault first</p>` : A;
|
|
39842
|
+
return locked ? b`<div class="locked"><p class="muted" data-locked>Unlock the vault first</p>${this.#button({ intent: { kind: "unlock" }, label: "Unlock", size: "s", variant: "accent" }, "unlock")}</div>` : A;
|
|
39786
39843
|
}
|
|
39787
39844
|
#valueForm(vault, form, locked) {
|
|
39788
39845
|
const save = () => this.save(vault);
|
|
@@ -40806,9 +40863,9 @@ function literal(value) {
|
|
|
40806
40863
|
return "null";
|
|
40807
40864
|
}
|
|
40808
40865
|
}
|
|
40809
|
-
function store(
|
|
40866
|
+
function store(state2) {
|
|
40810
40867
|
return `(() => {
|
|
40811
|
-
let state = ${literal(
|
|
40868
|
+
let state = ${literal(state2)};
|
|
40812
40869
|
const tag = Math.random().toString(36).slice(2);
|
|
40813
40870
|
const pending = new Map();
|
|
40814
40871
|
let next = 0;
|
|
@@ -40846,11 +40903,11 @@ function store(state3) {
|
|
|
40846
40903
|
});
|
|
40847
40904
|
})();`;
|
|
40848
40905
|
}
|
|
40849
|
-
function frameDocument(source, color, name,
|
|
40906
|
+
function frameDocument(source, color, name, state2) {
|
|
40850
40907
|
const scheme = `<style>${sprinkleTokens}${sprinkle_theme_default}</style>`;
|
|
40851
40908
|
const light = `<script>document.documentElement.classList.toggle('theme-light', ${color === "light"});<\/script>`;
|
|
40852
40909
|
const script = `<script data-name="${name.replace(/"/g, """)}">${bridge}<\/script>`;
|
|
40853
|
-
const injection = light + scheme + script + (
|
|
40910
|
+
const injection = light + scheme + script + (state2 ? `<script>${store(state2.value)}<\/script>` : "");
|
|
40854
40911
|
const head2 = source.match(/<head\b[^>]*>/i);
|
|
40855
40912
|
if (!head2 || head2.index === void 0) return injection + source;
|
|
40856
40913
|
const at = head2.index + head2[0].length;
|
|
@@ -41112,12 +41169,12 @@ var SliccSprinkle = class extends ThemedElement {
|
|
|
41112
41169
|
return this.model?.sprinkles.list().find((candidate) => candidate.id === this.sprinkle);
|
|
41113
41170
|
}
|
|
41114
41171
|
#frame = { key: "", doc: "" };
|
|
41115
|
-
#document(data,
|
|
41116
|
-
const key2 = `${!!
|
|
41172
|
+
#document(data, state2) {
|
|
41173
|
+
const key2 = `${!!state2}
|
|
41117
41174
|
${data.name}
|
|
41118
41175
|
${data.html}`;
|
|
41119
41176
|
if (this.#frame.key !== key2)
|
|
41120
|
-
this.#frame = { key: key2, doc: frameDocument(data.html, this.color, data.name,
|
|
41177
|
+
this.#frame = { key: key2, doc: frameDocument(data.html, this.color, data.name, state2) };
|
|
41121
41178
|
return this.#frame.doc;
|
|
41122
41179
|
}
|
|
41123
41180
|
updated(changed) {
|
|
@@ -41141,13 +41198,13 @@ ${data.html}`;
|
|
|
41141
41198
|
}
|
|
41142
41199
|
const bridged = !!this.model?.sprinkles.call;
|
|
41143
41200
|
if (bridged && !this.#held.ready) return b``;
|
|
41144
|
-
const
|
|
41201
|
+
const state2 = bridged ? this.#held : void 0;
|
|
41145
41202
|
const watch = !!watchOnly(this.model);
|
|
41146
41203
|
const caption = watch ? b`<span class="view-only" data-view-only>View only on this device</span>` : A;
|
|
41147
41204
|
const style = `color-scheme:${this.color};${this.inline ? `height:${this.height}px;` : ""}`;
|
|
41148
41205
|
const frame = b`${i17(
|
|
41149
41206
|
this.#mounts,
|
|
41150
|
-
b`<iframe title=${data.title} sandbox="allow-scripts" ?inert=${watch} style=${style} .srcdoc=${this.#document(data,
|
|
41207
|
+
b`<iframe title=${data.title} sandbox="allow-scripts" ?inert=${watch} style=${style} .srcdoc=${this.#document(data, state2)}></iframe>`
|
|
41151
41208
|
)}`;
|
|
41152
41209
|
if (!this.inline)
|
|
41153
41210
|
return watch ? b`<div class="panel"><div class="bar">${caption}</div>${frame}</div>` : frame;
|
|
@@ -41165,16 +41222,29 @@ ${data.html}`;
|
|
|
41165
41222
|
|
|
41166
41223
|
// src/app/tool-runs.ts
|
|
41167
41224
|
var opened = /* @__PURE__ */ new Map();
|
|
41225
|
+
var caches = /* @__PURE__ */ new WeakMap();
|
|
41226
|
+
function cache(port) {
|
|
41227
|
+
const found = caches.get(port);
|
|
41228
|
+
if (found) return found;
|
|
41229
|
+
const fresh2 = { done: /* @__PURE__ */ new Map(), latest: /* @__PURE__ */ new Map(), asked: /* @__PURE__ */ new Set() };
|
|
41230
|
+
caches.set(port, fresh2);
|
|
41231
|
+
return fresh2;
|
|
41232
|
+
}
|
|
41168
41233
|
var SliccToolRuns = class extends i2 {
|
|
41169
41234
|
static properties = {
|
|
41170
41235
|
calls: { attribute: false },
|
|
41236
|
+
agent: { attribute: false },
|
|
41171
41237
|
color: { attribute: false },
|
|
41172
41238
|
model: { attribute: false },
|
|
41173
41239
|
owners: { attribute: false }
|
|
41174
41240
|
};
|
|
41241
|
+
#icons = null;
|
|
41242
|
+
#count = 0;
|
|
41243
|
+
#resize = new ResizeObserver(() => this.#end());
|
|
41175
41244
|
constructor() {
|
|
41176
41245
|
super();
|
|
41177
41246
|
this.calls = [];
|
|
41247
|
+
this.agent = "";
|
|
41178
41248
|
this.color = "light";
|
|
41179
41249
|
this.model = null;
|
|
41180
41250
|
this.owners = null;
|
|
@@ -41182,9 +41252,20 @@ var SliccToolRuns = class extends i2 {
|
|
|
41182
41252
|
createRenderRoot() {
|
|
41183
41253
|
return this;
|
|
41184
41254
|
}
|
|
41255
|
+
connectedCallback() {
|
|
41256
|
+
super.connectedCallback();
|
|
41257
|
+
if (this.#icons) this.#resize.observe(this.#icons);
|
|
41258
|
+
}
|
|
41259
|
+
disconnectedCallback() {
|
|
41260
|
+
super.disconnectedCallback();
|
|
41261
|
+
this.#resize.disconnect();
|
|
41262
|
+
}
|
|
41185
41263
|
get #anchor() {
|
|
41186
41264
|
return this.calls[0]?.id ?? "";
|
|
41187
41265
|
}
|
|
41266
|
+
get #key() {
|
|
41267
|
+
return this.calls.map((call) => call.id).join(" ");
|
|
41268
|
+
}
|
|
41188
41269
|
get #open() {
|
|
41189
41270
|
return opened.get(this.#anchor) ?? "";
|
|
41190
41271
|
}
|
|
@@ -41195,9 +41276,55 @@ var SliccToolRuns = class extends i2 {
|
|
|
41195
41276
|
}
|
|
41196
41277
|
#toggled(call, event2) {
|
|
41197
41278
|
const open = event2.currentTarget.open;
|
|
41198
|
-
|
|
41199
|
-
if (open
|
|
41200
|
-
|
|
41279
|
+
if (open) this.#set(call.id);
|
|
41280
|
+
else if (this.#open === call.id) this.#set("");
|
|
41281
|
+
}
|
|
41282
|
+
#ask() {
|
|
41283
|
+
const port = this.model?.agent;
|
|
41284
|
+
if (this.calls.length < 2 || !port?.toolLabel) return;
|
|
41285
|
+
const store2 = cache(port);
|
|
41286
|
+
const key2 = `${this.agent} ${this.#key}`;
|
|
41287
|
+
const anchor = `${this.agent} ${this.#anchor}`;
|
|
41288
|
+
if (store2.asked.has(key2)) return;
|
|
41289
|
+
store2.asked.add(key2);
|
|
41290
|
+
port.toolLabel(
|
|
41291
|
+
this.agent,
|
|
41292
|
+
this.calls.map((call) => call.id)
|
|
41293
|
+
).then(
|
|
41294
|
+
(text2) => {
|
|
41295
|
+
const label = text2?.trim();
|
|
41296
|
+
if (!label) return;
|
|
41297
|
+
store2.done.set(key2, label);
|
|
41298
|
+
store2.latest.set(anchor, label);
|
|
41299
|
+
this.requestUpdate();
|
|
41300
|
+
},
|
|
41301
|
+
() => void 0
|
|
41302
|
+
);
|
|
41303
|
+
}
|
|
41304
|
+
#label() {
|
|
41305
|
+
const port = this.model?.agent;
|
|
41306
|
+
const store2 = port ? caches.get(port) : void 0;
|
|
41307
|
+
if (!store2) return "";
|
|
41308
|
+
return store2.done.get(`${this.agent} ${this.#key}`) ?? store2.latest.get(`${this.agent} ${this.#anchor}`) ?? "";
|
|
41309
|
+
}
|
|
41310
|
+
#end() {
|
|
41311
|
+
const icons3 = this.#icons;
|
|
41312
|
+
const rtl = getComputedStyle(icons3).direction === "rtl";
|
|
41313
|
+
icons3.scrollLeft = rtl ? -icons3.scrollWidth : icons3.scrollWidth;
|
|
41314
|
+
}
|
|
41315
|
+
willUpdate() {
|
|
41316
|
+
this.#ask();
|
|
41317
|
+
}
|
|
41318
|
+
updated() {
|
|
41319
|
+
const icons3 = this.querySelector(".icons");
|
|
41320
|
+
if (icons3 !== this.#icons) {
|
|
41321
|
+
this.#resize.disconnect();
|
|
41322
|
+
this.#resize.observe(icons3);
|
|
41323
|
+
this.#icons = icons3;
|
|
41324
|
+
}
|
|
41325
|
+
if (this.calls.length === this.#count) return;
|
|
41326
|
+
this.#count = this.calls.length;
|
|
41327
|
+
this.#end();
|
|
41201
41328
|
}
|
|
41202
41329
|
#card(call, run2) {
|
|
41203
41330
|
const open = this.#open;
|
|
@@ -41216,17 +41343,15 @@ var SliccToolRuns = class extends i2 {
|
|
|
41216
41343
|
}
|
|
41217
41344
|
const open = this.#open;
|
|
41218
41345
|
const [status2, label] = overall(calls);
|
|
41346
|
+
const summary = `${toolSummary(calls)}. ${label}`;
|
|
41347
|
+
const text2 = this.#label();
|
|
41219
41348
|
const pick = (id) => this.#set(open === id ? "" : id);
|
|
41220
41349
|
return b`<div class="runs" data-runs="cluster" data-status=${status2} data-count=${calls.length}>
|
|
41221
|
-
<div class="strip">
|
|
41222
|
-
<span class="icons" role="group" aria-label=${
|
|
41350
|
+
<div class="strip" title=${summary}>
|
|
41351
|
+
<span class="icons" role="group" aria-label=${summary}>${calls.map(
|
|
41223
41352
|
(call) => b`<button type="button" class="run" data-action="open-run" data-target=${call.id} data-status=${call.status} aria-expanded=${open === call.id ? "true" : "false"} aria-controls=${`run-${call.id}`} aria-label=${`${call.title}, ${statusLabel2(call.status)}`} title=${call.title} @click=${() => pick(call.id)}>${chip(call, this.model)}</button>`
|
|
41224
41353
|
)}</span>
|
|
41225
|
-
<button type="button" class="
|
|
41226
|
-
<swc-icon-chevron-right class="chevron" size="s" aria-hidden="true"></swc-icon-chevron-right>
|
|
41227
|
-
<span class="names">${toolSummary(calls)}</span>
|
|
41228
|
-
${state2(status2, label)}
|
|
41229
|
-
</button>
|
|
41354
|
+
<button type="button" class="label" data-action="open-cluster" aria-expanded=${open === "all" ? "true" : "false"} aria-label=${text2 ? A : "Show all runs"} @click=${() => pick("all")}>${text2}</button>
|
|
41230
41355
|
</div>
|
|
41231
41356
|
<div class="cards" ?hidden=${!open}>${calls.map(
|
|
41232
41357
|
(call) => b`<div class="slot" ?hidden=${open !== "all" && open !== call.id}>${this.#card(call, false)}</div>`
|
|
@@ -47415,8 +47540,8 @@ async function createShikiPrimitiveAsync(options) {
|
|
|
47415
47540
|
});
|
|
47416
47541
|
}
|
|
47417
47542
|
var _grammarStateMap = /* @__PURE__ */ new WeakMap();
|
|
47418
|
-
function setLastGrammarStateToMap(keys,
|
|
47419
|
-
_grammarStateMap.set(keys,
|
|
47543
|
+
function setLastGrammarStateToMap(keys, state2) {
|
|
47544
|
+
_grammarStateMap.set(keys, state2);
|
|
47420
47545
|
}
|
|
47421
47546
|
function getLastGrammarStateFromMap(keys) {
|
|
47422
47547
|
return _grammarStateMap.get(keys);
|
|
@@ -47485,9 +47610,9 @@ function getScopes(stack) {
|
|
|
47485
47610
|
pushScope(stack);
|
|
47486
47611
|
return scopes;
|
|
47487
47612
|
}
|
|
47488
|
-
function getGrammarStack(
|
|
47489
|
-
if (!(
|
|
47490
|
-
return
|
|
47613
|
+
function getGrammarStack(state2, theme3) {
|
|
47614
|
+
if (!(state2 instanceof GrammarState)) throw new ShikiError2("Invalid grammar state");
|
|
47615
|
+
return state2.getInternalStack(theme3);
|
|
47491
47616
|
}
|
|
47492
47617
|
var RE_COMMA = /,/;
|
|
47493
47618
|
var RE_SPACE = / /;
|
|
@@ -49490,17 +49615,17 @@ function stringifyEntities(value, options) {
|
|
|
49490
49615
|
var htmlCommentRegex = /^>|^->|<!--|-->|--!>|<!-$/g;
|
|
49491
49616
|
var bogusCommentEntitySubset = [">"];
|
|
49492
49617
|
var commentEntitySubset = ["<", ">"];
|
|
49493
|
-
function comment(node, _1, _22,
|
|
49494
|
-
return
|
|
49618
|
+
function comment(node, _1, _22, state2) {
|
|
49619
|
+
return state2.settings.bogusComments ? "<?" + stringifyEntities(
|
|
49495
49620
|
node.value,
|
|
49496
|
-
Object.assign({},
|
|
49621
|
+
Object.assign({}, state2.settings.characterReferences, {
|
|
49497
49622
|
subset: bogusCommentEntitySubset
|
|
49498
49623
|
})
|
|
49499
49624
|
) + ">" : "<!--" + node.value.replace(htmlCommentRegex, encode2) + "-->";
|
|
49500
49625
|
function encode2($0) {
|
|
49501
49626
|
return stringifyEntities(
|
|
49502
49627
|
$0,
|
|
49503
|
-
Object.assign({},
|
|
49628
|
+
Object.assign({}, state2.settings.characterReferences, {
|
|
49504
49629
|
subset: commentEntitySubset
|
|
49505
49630
|
})
|
|
49506
49631
|
);
|
|
@@ -49508,8 +49633,8 @@ function comment(node, _1, _22, state3) {
|
|
|
49508
49633
|
}
|
|
49509
49634
|
|
|
49510
49635
|
// node_modules/hast-util-to-html/lib/handle/doctype.js
|
|
49511
|
-
function doctype(_1, _22, _32,
|
|
49512
|
-
return "<!" + (
|
|
49636
|
+
function doctype(_1, _22, _32, state2) {
|
|
49637
|
+
return "<!" + (state2.settings.upperDoctype ? "DOCTYPE" : "doctype") + (state2.settings.tightDoctype ? "" : " ") + "html>";
|
|
49513
49638
|
}
|
|
49514
49639
|
|
|
49515
49640
|
// node_modules/ccount/index.js
|
|
@@ -49734,26 +49859,26 @@ var constants = {
|
|
|
49734
49859
|
['\0"&'.split(""), "\0\"&'`".split("")]
|
|
49735
49860
|
]
|
|
49736
49861
|
};
|
|
49737
|
-
function element(node, index, parent,
|
|
49738
|
-
const schema =
|
|
49739
|
-
const omit = schema.space === "svg" ? false :
|
|
49740
|
-
let selfClosing = schema.space === "svg" ?
|
|
49862
|
+
function element(node, index, parent, state2) {
|
|
49863
|
+
const schema = state2.schema;
|
|
49864
|
+
const omit = schema.space === "svg" ? false : state2.settings.omitOptionalTags;
|
|
49865
|
+
let selfClosing = schema.space === "svg" ? state2.settings.closeEmptyElements : state2.settings.voids.includes(node.tagName.toLowerCase());
|
|
49741
49866
|
const parts2 = [];
|
|
49742
49867
|
let last;
|
|
49743
49868
|
if (schema.space === "html" && node.tagName === "svg") {
|
|
49744
|
-
|
|
49869
|
+
state2.schema = svg3;
|
|
49745
49870
|
}
|
|
49746
|
-
const attributes = serializeAttributes(
|
|
49747
|
-
const content =
|
|
49871
|
+
const attributes = serializeAttributes(state2, node.properties);
|
|
49872
|
+
const content = state2.all(
|
|
49748
49873
|
schema.space === "html" && node.tagName === "template" ? node.content : node
|
|
49749
49874
|
);
|
|
49750
|
-
|
|
49875
|
+
state2.schema = schema;
|
|
49751
49876
|
if (content) selfClosing = false;
|
|
49752
49877
|
if (attributes || !omit || !opening(node, index, parent)) {
|
|
49753
49878
|
parts2.push("<", node.tagName, attributes ? " " + attributes : "");
|
|
49754
|
-
if (selfClosing && (schema.space === "svg" ||
|
|
49879
|
+
if (selfClosing && (schema.space === "svg" || state2.settings.closeSelfClosing)) {
|
|
49755
49880
|
last = attributes.charAt(attributes.length - 1);
|
|
49756
|
-
if (!
|
|
49881
|
+
if (!state2.settings.tightSelfClosing || last === "/" || last && last !== '"' && last !== "'") {
|
|
49757
49882
|
parts2.push(" ");
|
|
49758
49883
|
}
|
|
49759
49884
|
parts2.push("/");
|
|
@@ -49766,31 +49891,31 @@ function element(node, index, parent, state3) {
|
|
|
49766
49891
|
}
|
|
49767
49892
|
return parts2.join("");
|
|
49768
49893
|
}
|
|
49769
|
-
function serializeAttributes(
|
|
49894
|
+
function serializeAttributes(state2, properties) {
|
|
49770
49895
|
const values = [];
|
|
49771
49896
|
let index = -1;
|
|
49772
49897
|
let key2;
|
|
49773
49898
|
if (properties) {
|
|
49774
49899
|
for (key2 in properties) {
|
|
49775
49900
|
if (properties[key2] !== null && properties[key2] !== void 0) {
|
|
49776
|
-
const value = serializeAttribute(
|
|
49901
|
+
const value = serializeAttribute(state2, key2, properties[key2]);
|
|
49777
49902
|
if (value) values.push(value);
|
|
49778
49903
|
}
|
|
49779
49904
|
}
|
|
49780
49905
|
}
|
|
49781
49906
|
while (++index < values.length) {
|
|
49782
|
-
const last =
|
|
49907
|
+
const last = state2.settings.tightAttributes ? values[index].charAt(values[index].length - 1) : void 0;
|
|
49783
49908
|
if (index !== values.length - 1 && last !== '"' && last !== "'") {
|
|
49784
49909
|
values[index] += " ";
|
|
49785
49910
|
}
|
|
49786
49911
|
}
|
|
49787
49912
|
return values.join("");
|
|
49788
49913
|
}
|
|
49789
|
-
function serializeAttribute(
|
|
49790
|
-
const info = find(
|
|
49791
|
-
const x7 =
|
|
49792
|
-
const y10 =
|
|
49793
|
-
let quote =
|
|
49914
|
+
function serializeAttribute(state2, key2, value) {
|
|
49915
|
+
const info = find(state2.schema, key2);
|
|
49916
|
+
const x7 = state2.settings.allowParseErrors && state2.schema.space === "html" ? 0 : 1;
|
|
49917
|
+
const y10 = state2.settings.allowDangerousCharacters ? 0 : 1;
|
|
49918
|
+
let quote = state2.quote;
|
|
49794
49919
|
let result;
|
|
49795
49920
|
if (info.overloadedBoolean && (value === info.attribute || value === "")) {
|
|
49796
49921
|
value = true;
|
|
@@ -49802,32 +49927,32 @@ function serializeAttribute(state3, key2, value) {
|
|
|
49802
49927
|
}
|
|
49803
49928
|
const name = stringifyEntities(
|
|
49804
49929
|
info.attribute,
|
|
49805
|
-
Object.assign({},
|
|
49930
|
+
Object.assign({}, state2.settings.characterReferences, {
|
|
49806
49931
|
// Always encode without parse errors in non-HTML.
|
|
49807
49932
|
subset: constants.name[x7][y10]
|
|
49808
49933
|
})
|
|
49809
49934
|
);
|
|
49810
49935
|
if (value === true) return name;
|
|
49811
49936
|
value = Array.isArray(value) ? (info.commaSeparated ? stringify : stringify2)(value, {
|
|
49812
|
-
padLeft: !
|
|
49937
|
+
padLeft: !state2.settings.tightCommaSeparatedLists
|
|
49813
49938
|
}) : String(value);
|
|
49814
|
-
if (
|
|
49815
|
-
if (
|
|
49939
|
+
if (state2.settings.collapseEmptyAttributes && !value) return name;
|
|
49940
|
+
if (state2.settings.preferUnquoted) {
|
|
49816
49941
|
result = stringifyEntities(
|
|
49817
49942
|
value,
|
|
49818
|
-
Object.assign({},
|
|
49943
|
+
Object.assign({}, state2.settings.characterReferences, {
|
|
49819
49944
|
attribute: true,
|
|
49820
49945
|
subset: constants.unquoted[x7][y10]
|
|
49821
49946
|
})
|
|
49822
49947
|
);
|
|
49823
49948
|
}
|
|
49824
49949
|
if (result !== value) {
|
|
49825
|
-
if (
|
|
49826
|
-
quote =
|
|
49950
|
+
if (state2.settings.quoteSmart && ccount(value, quote) > ccount(value, state2.alternative)) {
|
|
49951
|
+
quote = state2.alternative;
|
|
49827
49952
|
}
|
|
49828
49953
|
result = quote + stringifyEntities(
|
|
49829
49954
|
value,
|
|
49830
|
-
Object.assign({},
|
|
49955
|
+
Object.assign({}, state2.settings.characterReferences, {
|
|
49831
49956
|
// Always encode without parse errors in non-HTML.
|
|
49832
49957
|
subset: (quote === "'" ? constants.single : constants.double)[x7][y10],
|
|
49833
49958
|
attribute: true
|
|
@@ -49839,23 +49964,23 @@ function serializeAttribute(state3, key2, value) {
|
|
|
49839
49964
|
|
|
49840
49965
|
// node_modules/hast-util-to-html/lib/handle/text.js
|
|
49841
49966
|
var textEntitySubset = ["<", "&"];
|
|
49842
|
-
function text(node, _9, parent,
|
|
49967
|
+
function text(node, _9, parent, state2) {
|
|
49843
49968
|
return parent && parent.type === "element" && (parent.tagName === "script" || parent.tagName === "style") ? node.value : stringifyEntities(
|
|
49844
49969
|
node.value,
|
|
49845
|
-
Object.assign({},
|
|
49970
|
+
Object.assign({}, state2.settings.characterReferences, {
|
|
49846
49971
|
subset: textEntitySubset
|
|
49847
49972
|
})
|
|
49848
49973
|
);
|
|
49849
49974
|
}
|
|
49850
49975
|
|
|
49851
49976
|
// node_modules/hast-util-to-html/lib/handle/raw.js
|
|
49852
|
-
function raw(node, index, parent,
|
|
49853
|
-
return
|
|
49977
|
+
function raw(node, index, parent, state2) {
|
|
49978
|
+
return state2.settings.allowDangerousHtml ? node.value : text(node, index, parent, state2);
|
|
49854
49979
|
}
|
|
49855
49980
|
|
|
49856
49981
|
// node_modules/hast-util-to-html/lib/handle/root.js
|
|
49857
|
-
function root(node, _1, _22,
|
|
49858
|
-
return
|
|
49982
|
+
function root(node, _1, _22, state2) {
|
|
49983
|
+
return state2.all(node);
|
|
49859
49984
|
}
|
|
49860
49985
|
|
|
49861
49986
|
// node_modules/hast-util-to-html/lib/handle/index.js
|
|
@@ -49886,7 +50011,7 @@ function toHtml(tree, options) {
|
|
|
49886
50011
|
if (quote !== '"' && quote !== "'") {
|
|
49887
50012
|
throw new Error("Invalid quote `" + quote + "`, expected `'` or `\"`");
|
|
49888
50013
|
}
|
|
49889
|
-
const
|
|
50014
|
+
const state2 = {
|
|
49890
50015
|
one,
|
|
49891
50016
|
all,
|
|
49892
50017
|
settings: {
|
|
@@ -49912,7 +50037,7 @@ function toHtml(tree, options) {
|
|
|
49912
50037
|
quote,
|
|
49913
50038
|
alternative
|
|
49914
50039
|
};
|
|
49915
|
-
return
|
|
50040
|
+
return state2.one(
|
|
49916
50041
|
Array.isArray(tree) ? { type: "root", children: tree } : tree,
|
|
49917
50042
|
void 0,
|
|
49918
50043
|
void 0
|
|
@@ -51073,11 +51198,11 @@ var JavaScriptScanner = class {
|
|
|
51073
51198
|
constructor(patterns, options = {}) {
|
|
51074
51199
|
this.patterns = patterns;
|
|
51075
51200
|
this.options = options;
|
|
51076
|
-
const { forgiving = false, cache:
|
|
51201
|
+
const { forgiving = false, cache: cache4, regexConstructor } = options;
|
|
51077
51202
|
if (!regexConstructor) throw new Error("Option `regexConstructor` is not provided");
|
|
51078
51203
|
this.regexps = patterns.map((p17) => {
|
|
51079
51204
|
if (typeof p17 !== "string") return p17;
|
|
51080
|
-
const cached =
|
|
51205
|
+
const cached = cache4?.get(p17);
|
|
51081
51206
|
if (cached) {
|
|
51082
51207
|
if (cached instanceof RegExp) return cached;
|
|
51083
51208
|
if (forgiving) return null;
|
|
@@ -51085,10 +51210,10 @@ var JavaScriptScanner = class {
|
|
|
51085
51210
|
}
|
|
51086
51211
|
try {
|
|
51087
51212
|
const regex = regexConstructor(p17);
|
|
51088
|
-
|
|
51213
|
+
cache4?.set(p17, regex);
|
|
51089
51214
|
return regex;
|
|
51090
51215
|
} catch (e122) {
|
|
51091
|
-
|
|
51216
|
+
cache4?.set(p17, e122);
|
|
51092
51217
|
if (forgiving) return null;
|
|
51093
51218
|
throw e122;
|
|
51094
51219
|
}
|
|
@@ -52813,9 +52938,9 @@ var FirstPassVisitor = {
|
|
|
52813
52938
|
}
|
|
52814
52939
|
}
|
|
52815
52940
|
},
|
|
52816
|
-
Assertion({ node, parent, key: key2, container, root: root2, remove: remove2, replaceWith },
|
|
52941
|
+
Assertion({ node, parent, key: key2, container, root: root2, remove: remove2, replaceWith }, state2) {
|
|
52817
52942
|
const { kind, negate } = node;
|
|
52818
|
-
const { asciiWordBoundaries, avoidSubclass, supportedGNodes, wordIsAscii } =
|
|
52943
|
+
const { asciiWordBoundaries, avoidSubclass, supportedGNodes, wordIsAscii } = state2;
|
|
52819
52944
|
if (kind === "text_segment_boundary") {
|
|
52820
52945
|
throw new Error(`Unsupported text segment boundary "\\${negate ? "Y" : "y"}"`);
|
|
52821
52946
|
} else if (kind === "line_end") {
|
|
@@ -52838,7 +52963,7 @@ var FirstPassVisitor = {
|
|
|
52838
52963
|
throw new Error(r39`Uses "\G" in a way that requires a subclass`);
|
|
52839
52964
|
} else {
|
|
52840
52965
|
replaceWith(setParent(F5("string_start"), parent));
|
|
52841
|
-
|
|
52966
|
+
state2.strategy = "clip_search";
|
|
52842
52967
|
}
|
|
52843
52968
|
}
|
|
52844
52969
|
} else if (kind === "string_end" || kind === "string_start") {
|
|
@@ -53031,10 +53156,10 @@ var FirstPassVisitor = {
|
|
|
53031
53156
|
disable && !Object.keys(disable).length && delete node.flags.disable;
|
|
53032
53157
|
!node.flags.enable && !node.flags.disable && delete node.flags;
|
|
53033
53158
|
},
|
|
53034
|
-
LookaroundAssertion({ node },
|
|
53159
|
+
LookaroundAssertion({ node }, state2) {
|
|
53035
53160
|
const { kind } = node;
|
|
53036
53161
|
if (kind === "lookbehind") {
|
|
53037
|
-
|
|
53162
|
+
state2.passedLookbehind = true;
|
|
53038
53163
|
}
|
|
53039
53164
|
},
|
|
53040
53165
|
NamedCallout({ node, parent, replaceWith }) {
|
|
@@ -53161,17 +53286,17 @@ var SecondPassVisitor = {
|
|
|
53161
53286
|
}
|
|
53162
53287
|
},
|
|
53163
53288
|
Group: {
|
|
53164
|
-
enter({ node },
|
|
53165
|
-
|
|
53289
|
+
enter({ node }, state2) {
|
|
53290
|
+
state2.prevFlags = state2.currentFlags;
|
|
53166
53291
|
if (node.flags) {
|
|
53167
|
-
|
|
53292
|
+
state2.currentFlags = getNewCurrentFlags(state2.currentFlags, node.flags);
|
|
53168
53293
|
}
|
|
53169
53294
|
},
|
|
53170
|
-
exit(_9,
|
|
53171
|
-
|
|
53295
|
+
exit(_9, state2) {
|
|
53296
|
+
state2.currentFlags = state2.prevFlags;
|
|
53172
53297
|
}
|
|
53173
53298
|
},
|
|
53174
|
-
Subroutine({ node, parent, replaceWith },
|
|
53299
|
+
Subroutine({ node, parent, replaceWith }, state2) {
|
|
53175
53300
|
const { isRecursive, ref } = node;
|
|
53176
53301
|
if (isRecursive) {
|
|
53177
53302
|
let reffed = parent;
|
|
@@ -53180,14 +53305,14 @@ var SecondPassVisitor = {
|
|
|
53180
53305
|
break;
|
|
53181
53306
|
}
|
|
53182
53307
|
}
|
|
53183
|
-
|
|
53308
|
+
state2.reffedNodesByReferencer.set(node, reffed);
|
|
53184
53309
|
return;
|
|
53185
53310
|
}
|
|
53186
|
-
const reffedGroupNode =
|
|
53311
|
+
const reffedGroupNode = state2.subroutineRefMap.get(ref);
|
|
53187
53312
|
const isGlobalRecursion = ref === 0;
|
|
53188
53313
|
const expandedSubroutine = isGlobalRecursion ? createRecursion(0) : (
|
|
53189
53314
|
// The reffed group might itself contain subroutines, which are expanded during sub-traversal
|
|
53190
|
-
cloneCapturingGroup(reffedGroupNode,
|
|
53315
|
+
cloneCapturingGroup(reffedGroupNode, state2.groupOriginByCopy, null)
|
|
53191
53316
|
);
|
|
53192
53317
|
let replacement = expandedSubroutine;
|
|
53193
53318
|
if (!isGlobalRecursion) {
|
|
@@ -53195,8 +53320,8 @@ var SecondPassVisitor = {
|
|
|
53195
53320
|
reffedGroupNode,
|
|
53196
53321
|
(p17) => p17.type === "Group" && !!p17.flags
|
|
53197
53322
|
));
|
|
53198
|
-
const reffedGroupFlags = reffedGroupFlagMods ? getNewCurrentFlags(
|
|
53199
|
-
if (!areFlagsEqual(reffedGroupFlags,
|
|
53323
|
+
const reffedGroupFlags = reffedGroupFlagMods ? getNewCurrentFlags(state2.globalFlags, reffedGroupFlagMods) : state2.globalFlags;
|
|
53324
|
+
if (!areFlagsEqual(reffedGroupFlags, state2.currentFlags)) {
|
|
53200
53325
|
replacement = A8({
|
|
53201
53326
|
flags: getFlagModsFromFlags(reffedGroupFlags)
|
|
53202
53327
|
});
|
|
@@ -53207,12 +53332,12 @@ var SecondPassVisitor = {
|
|
|
53207
53332
|
}
|
|
53208
53333
|
};
|
|
53209
53334
|
var ThirdPassVisitor = {
|
|
53210
|
-
Backreference({ node, parent, replaceWith },
|
|
53335
|
+
Backreference({ node, parent, replaceWith }, state2) {
|
|
53211
53336
|
if (node.orphan) {
|
|
53212
|
-
|
|
53337
|
+
state2.highestOrphanBackref = Math.max(state2.highestOrphanBackref, node.ref);
|
|
53213
53338
|
return;
|
|
53214
53339
|
}
|
|
53215
|
-
const reffedNodes =
|
|
53340
|
+
const reffedNodes = state2.reffedNodesByReferencer.get(node);
|
|
53216
53341
|
const participants = reffedNodes.filter((reffed) => canParticipateWithNode(reffed, node));
|
|
53217
53342
|
if (!participants.length) {
|
|
53218
53343
|
replaceWith(setParentDeep(K2({ negate: true }), parent));
|
|
@@ -53228,28 +53353,28 @@ var ThirdPassVisitor = {
|
|
|
53228
53353
|
node.ref = participants[0].number;
|
|
53229
53354
|
}
|
|
53230
53355
|
},
|
|
53231
|
-
CapturingGroup({ node },
|
|
53232
|
-
node.number = ++
|
|
53356
|
+
CapturingGroup({ node }, state2) {
|
|
53357
|
+
node.number = ++state2.numCapturesToLeft;
|
|
53233
53358
|
if (node.name) {
|
|
53234
|
-
if (
|
|
53359
|
+
if (state2.groupsByName.get(node.name).get(node).hasDuplicateNameToRemove) {
|
|
53235
53360
|
delete node.name;
|
|
53236
53361
|
}
|
|
53237
53362
|
}
|
|
53238
53363
|
},
|
|
53239
53364
|
Regex: {
|
|
53240
|
-
exit({ node },
|
|
53241
|
-
const numCapsNeeded = Math.max(
|
|
53365
|
+
exit({ node }, state2) {
|
|
53366
|
+
const numCapsNeeded = Math.max(state2.highestOrphanBackref - state2.numCapturesToLeft, 0);
|
|
53242
53367
|
for (let i26 = 0; i26 < numCapsNeeded; i26++) {
|
|
53243
53368
|
const emptyCapture = P4();
|
|
53244
53369
|
node.body.at(-1).body.push(emptyCapture);
|
|
53245
53370
|
}
|
|
53246
53371
|
}
|
|
53247
53372
|
},
|
|
53248
|
-
Subroutine({ node },
|
|
53373
|
+
Subroutine({ node }, state2) {
|
|
53249
53374
|
if (!node.isRecursive || node.ref === 0) {
|
|
53250
53375
|
return;
|
|
53251
53376
|
}
|
|
53252
|
-
node.ref =
|
|
53377
|
+
node.ref = state2.reffedNodesByReferencer.get(node).number;
|
|
53253
53378
|
}
|
|
53254
53379
|
};
|
|
53255
53380
|
function addParentProperties(root2) {
|
|
@@ -53491,7 +53616,7 @@ function generate(ast, options) {
|
|
|
53491
53616
|
ignoreCase: !!((ast.flags.ignoreCase || hasCaseInsensitiveNode) && !hasCaseSensitiveNode)
|
|
53492
53617
|
};
|
|
53493
53618
|
let lastNode = ast;
|
|
53494
|
-
const
|
|
53619
|
+
const state2 = {
|
|
53495
53620
|
accuracy: opts.accuracy,
|
|
53496
53621
|
appliedGlobalFlags,
|
|
53497
53622
|
captureMap: /* @__PURE__ */ new Map(),
|
|
@@ -53509,10 +53634,10 @@ function generate(ast, options) {
|
|
|
53509
53634
|
verbose: opts.verbose
|
|
53510
53635
|
};
|
|
53511
53636
|
function gen(node) {
|
|
53512
|
-
|
|
53637
|
+
state2.lastNode = lastNode;
|
|
53513
53638
|
lastNode = node;
|
|
53514
53639
|
const fn = throwIfNullish(generator[node.type], `Unexpected node type "${node.type}"`);
|
|
53515
|
-
return fn(node,
|
|
53640
|
+
return fn(node, state2, gen);
|
|
53516
53641
|
}
|
|
53517
53642
|
const result = {
|
|
53518
53643
|
pattern: ast.body.map(gen).join("|"),
|
|
@@ -53527,7 +53652,7 @@ function generate(ast, options) {
|
|
|
53527
53652
|
}
|
|
53528
53653
|
result._captureTransfers = /* @__PURE__ */ new Map();
|
|
53529
53654
|
result._hiddenCaptures = [];
|
|
53530
|
-
|
|
53655
|
+
state2.captureMap.forEach((value, key2) => {
|
|
53531
53656
|
if (value.hidden) {
|
|
53532
53657
|
result._hiddenCaptures.push(key2);
|
|
53533
53658
|
}
|
|
@@ -53539,37 +53664,37 @@ function generate(ast, options) {
|
|
|
53539
53664
|
}
|
|
53540
53665
|
var FlagModifierVisitor = {
|
|
53541
53666
|
"*": {
|
|
53542
|
-
enter({ node },
|
|
53667
|
+
enter({ node }, state2) {
|
|
53543
53668
|
if (isAnyGroup(node)) {
|
|
53544
|
-
const currentModI =
|
|
53545
|
-
|
|
53669
|
+
const currentModI = state2.getCurrentModI();
|
|
53670
|
+
state2.pushModI(
|
|
53546
53671
|
node.flags ? getNewCurrentFlags({ ignoreCase: currentModI }, node.flags).ignoreCase : currentModI
|
|
53547
53672
|
);
|
|
53548
53673
|
}
|
|
53549
53674
|
},
|
|
53550
|
-
exit({ node },
|
|
53675
|
+
exit({ node }, state2) {
|
|
53551
53676
|
if (isAnyGroup(node)) {
|
|
53552
|
-
|
|
53677
|
+
state2.popModI();
|
|
53553
53678
|
}
|
|
53554
53679
|
}
|
|
53555
53680
|
},
|
|
53556
|
-
Backreference(_9,
|
|
53557
|
-
|
|
53681
|
+
Backreference(_9, state2) {
|
|
53682
|
+
state2.setHasCasedChar();
|
|
53558
53683
|
},
|
|
53559
|
-
Character({ node },
|
|
53684
|
+
Character({ node }, state2) {
|
|
53560
53685
|
if (charHasCase(cp(node.value))) {
|
|
53561
|
-
|
|
53686
|
+
state2.setHasCasedChar();
|
|
53562
53687
|
}
|
|
53563
53688
|
},
|
|
53564
|
-
CharacterClassRange({ node, skip },
|
|
53689
|
+
CharacterClassRange({ node, skip }, state2) {
|
|
53565
53690
|
skip();
|
|
53566
53691
|
if (getCasesOutsideCharClassRange(node, { firstOnly: true }).length) {
|
|
53567
|
-
|
|
53692
|
+
state2.setHasCasedChar();
|
|
53568
53693
|
}
|
|
53569
53694
|
},
|
|
53570
|
-
CharacterSet({ node },
|
|
53695
|
+
CharacterSet({ node }, state2) {
|
|
53571
53696
|
if (node.kind === "property" && UnicodePropertiesWithSpecificCase.has(node.value)) {
|
|
53572
|
-
|
|
53697
|
+
state2.setHasCasedChar();
|
|
53573
53698
|
}
|
|
53574
53699
|
}
|
|
53575
53700
|
};
|
|
@@ -53598,11 +53723,11 @@ var generator = {
|
|
|
53598
53723
|
/**
|
|
53599
53724
|
@param {BackreferenceNode} node
|
|
53600
53725
|
*/
|
|
53601
|
-
Backreference({ ref },
|
|
53726
|
+
Backreference({ ref }, state2) {
|
|
53602
53727
|
if (typeof ref !== "number") {
|
|
53603
53728
|
throw new Error("Unexpected named backref in transformed AST");
|
|
53604
53729
|
}
|
|
53605
|
-
if (!
|
|
53730
|
+
if (!state2.useFlagMods && state2.accuracy === "strict" && state2.currentFlags.ignoreCase && !state2.captureMap.get(ref).ignoreCase) {
|
|
53606
53731
|
throw new Error("Use of case-insensitive backref to case-sensitive group requires target ES2025 or non-strict accuracy");
|
|
53607
53732
|
}
|
|
53608
53733
|
return "\\" + ref;
|
|
@@ -53610,55 +53735,55 @@ var generator = {
|
|
|
53610
53735
|
/**
|
|
53611
53736
|
@param {CapturingGroupNode} node
|
|
53612
53737
|
*/
|
|
53613
|
-
CapturingGroup(node,
|
|
53738
|
+
CapturingGroup(node, state2, gen) {
|
|
53614
53739
|
const { body: body4, name, number: number2 } = node;
|
|
53615
|
-
const data = { ignoreCase:
|
|
53616
|
-
const origin2 =
|
|
53740
|
+
const data = { ignoreCase: state2.currentFlags.ignoreCase };
|
|
53741
|
+
const origin2 = state2.originMap.get(node);
|
|
53617
53742
|
if (origin2) {
|
|
53618
53743
|
data.hidden = true;
|
|
53619
53744
|
if (number2 > origin2.number) {
|
|
53620
53745
|
data.transferTo = origin2.number;
|
|
53621
53746
|
}
|
|
53622
53747
|
}
|
|
53623
|
-
|
|
53748
|
+
state2.captureMap.set(number2, data);
|
|
53624
53749
|
return `(${name ? `?<${name}>` : ""}${body4.map(gen).join("|")})`;
|
|
53625
53750
|
},
|
|
53626
53751
|
/**
|
|
53627
53752
|
@param {CharacterNode} node
|
|
53628
53753
|
*/
|
|
53629
|
-
Character({ value },
|
|
53754
|
+
Character({ value }, state2) {
|
|
53630
53755
|
const char = cp(value);
|
|
53631
53756
|
const escaped = getCharEscape(value, {
|
|
53632
|
-
escDigit:
|
|
53633
|
-
inCharClass:
|
|
53634
|
-
useFlagV:
|
|
53757
|
+
escDigit: state2.lastNode.type === "Backreference",
|
|
53758
|
+
inCharClass: state2.inCharClass,
|
|
53759
|
+
useFlagV: state2.useFlagV
|
|
53635
53760
|
});
|
|
53636
53761
|
if (escaped !== char) {
|
|
53637
53762
|
return escaped;
|
|
53638
53763
|
}
|
|
53639
|
-
if (
|
|
53764
|
+
if (state2.useAppliedIgnoreCase && state2.currentFlags.ignoreCase && charHasCase(char)) {
|
|
53640
53765
|
const cases = getIgnoreCaseMatchChars(char);
|
|
53641
|
-
return
|
|
53766
|
+
return state2.inCharClass ? cases.join("") : cases.length > 1 ? `[${cases.join("")}]` : cases[0];
|
|
53642
53767
|
}
|
|
53643
53768
|
return char;
|
|
53644
53769
|
},
|
|
53645
53770
|
/**
|
|
53646
53771
|
@param {CharacterClassNode} node
|
|
53647
53772
|
*/
|
|
53648
|
-
CharacterClass(node,
|
|
53773
|
+
CharacterClass(node, state2, gen) {
|
|
53649
53774
|
const { kind, negate, parent } = node;
|
|
53650
53775
|
let { body: body4 } = node;
|
|
53651
|
-
if (kind === "intersection" && !
|
|
53776
|
+
if (kind === "intersection" && !state2.useFlagV) {
|
|
53652
53777
|
throw new Error("Use of character class intersection requires min target ES2024");
|
|
53653
53778
|
}
|
|
53654
|
-
if (envFlags.bugFlagVLiteralHyphenIsRange &&
|
|
53779
|
+
if (envFlags.bugFlagVLiteralHyphenIsRange && state2.useFlagV && body4.some(isLiteralHyphen)) {
|
|
53655
53780
|
body4 = [m15(45), ...body4.filter((kid) => !isLiteralHyphen(kid))];
|
|
53656
53781
|
}
|
|
53657
53782
|
const genClass = () => `[${negate ? "^" : ""}${body4.map(gen).join(kind === "intersection" ? "&&" : "")}]`;
|
|
53658
|
-
if (!
|
|
53783
|
+
if (!state2.inCharClass) {
|
|
53659
53784
|
if (
|
|
53660
53785
|
// Already established `kind !== 'intersection'` if `!state.useFlagV`; don't check again
|
|
53661
|
-
(!
|
|
53786
|
+
(!state2.useFlagV || envFlags.bugNestedClassIgnoresNegation) && !negate
|
|
53662
53787
|
) {
|
|
53663
53788
|
const negatedChildClasses = body4.filter(
|
|
53664
53789
|
(kid) => kid.type === "CharacterClass" && kid.kind === "union" && kid.negate
|
|
@@ -53685,21 +53810,21 @@ var generator = {
|
|
|
53685
53810
|
return gen(group);
|
|
53686
53811
|
}
|
|
53687
53812
|
}
|
|
53688
|
-
|
|
53813
|
+
state2.inCharClass = true;
|
|
53689
53814
|
const result = genClass();
|
|
53690
|
-
|
|
53815
|
+
state2.inCharClass = false;
|
|
53691
53816
|
return result;
|
|
53692
53817
|
}
|
|
53693
53818
|
const firstEl = body4[0];
|
|
53694
53819
|
if (
|
|
53695
53820
|
// Already established that the parent is a char class via `inCharClass`; don't check again
|
|
53696
53821
|
kind === "union" && !negate && firstEl && // Allows many nested classes to work with `target` ES2018 which doesn't support nesting
|
|
53697
|
-
((!
|
|
53822
|
+
((!state2.useFlagV || !state2.verbose) && parent.kind === "union" && !(envFlags.bugFlagVLiteralHyphenIsRange && state2.useFlagV) || !state2.verbose && parent.kind === "intersection" && // JS doesn't allow intersection with union or ranges
|
|
53698
53823
|
body4.length === 1 && firstEl.type !== "CharacterClassRange")
|
|
53699
53824
|
) {
|
|
53700
53825
|
return body4.map(gen).join("");
|
|
53701
53826
|
}
|
|
53702
|
-
if (!
|
|
53827
|
+
if (!state2.useFlagV && parent.type === "CharacterClass") {
|
|
53703
53828
|
throw new Error("Uses nested character class in a way that requires min target ES2024");
|
|
53704
53829
|
}
|
|
53705
53830
|
return genClass();
|
|
@@ -53707,18 +53832,18 @@ var generator = {
|
|
|
53707
53832
|
/**
|
|
53708
53833
|
@param {CharacterClassRangeNode} node
|
|
53709
53834
|
*/
|
|
53710
|
-
CharacterClassRange(node,
|
|
53835
|
+
CharacterClassRange(node, state2) {
|
|
53711
53836
|
const min2 = node.min.value;
|
|
53712
53837
|
const max2 = node.max.value;
|
|
53713
53838
|
const escOpts = {
|
|
53714
53839
|
escDigit: false,
|
|
53715
53840
|
inCharClass: true,
|
|
53716
|
-
useFlagV:
|
|
53841
|
+
useFlagV: state2.useFlagV
|
|
53717
53842
|
};
|
|
53718
53843
|
const minStr = getCharEscape(min2, escOpts);
|
|
53719
53844
|
const maxStr = getCharEscape(max2, escOpts);
|
|
53720
53845
|
const extraChars = /* @__PURE__ */ new Set();
|
|
53721
|
-
if (
|
|
53846
|
+
if (state2.useAppliedIgnoreCase && state2.currentFlags.ignoreCase) {
|
|
53722
53847
|
const charsOutsideRange = getCasesOutsideCharClassRange(node);
|
|
53723
53848
|
const ranges = getCodePointRangesFromChars(charsOutsideRange);
|
|
53724
53849
|
ranges.forEach((value) => {
|
|
@@ -53732,9 +53857,9 @@ var generator = {
|
|
|
53732
53857
|
/**
|
|
53733
53858
|
@param {CharacterSetNode} node
|
|
53734
53859
|
*/
|
|
53735
|
-
CharacterSet({ kind, negate, value, key: key2 },
|
|
53860
|
+
CharacterSet({ kind, negate, value, key: key2 }, state2) {
|
|
53736
53861
|
if (kind === "dot") {
|
|
53737
|
-
return
|
|
53862
|
+
return state2.currentFlags.dotAll ? state2.appliedGlobalFlags.dotAll || state2.useFlagMods ? "." : "[^]" : (
|
|
53738
53863
|
// Onig's only line break char is line feed, unlike JS
|
|
53739
53864
|
r39`[^\n]`
|
|
53740
53865
|
);
|
|
@@ -53743,7 +53868,7 @@ var generator = {
|
|
|
53743
53868
|
return negate ? r39`\D` : r39`\d`;
|
|
53744
53869
|
}
|
|
53745
53870
|
if (kind === "property") {
|
|
53746
|
-
if (
|
|
53871
|
+
if (state2.useAppliedIgnoreCase && state2.currentFlags.ignoreCase && UnicodePropertiesWithSpecificCase.has(value)) {
|
|
53747
53872
|
throw new Error(`Unicode property "${value}" can't be case-insensitive when other chars have specific case`);
|
|
53748
53873
|
}
|
|
53749
53874
|
return `${negate ? r39`\P` : r39`\p`}{${key2 ? `${key2}=` : ""}${value}}`;
|
|
@@ -53756,28 +53881,28 @@ var generator = {
|
|
|
53756
53881
|
/**
|
|
53757
53882
|
@param {FlagsNode} node
|
|
53758
53883
|
*/
|
|
53759
|
-
Flags(node,
|
|
53884
|
+
Flags(node, state2) {
|
|
53760
53885
|
return (
|
|
53761
53886
|
// The transformer should never turn on the properties for flags d, g, m since Onig doesn't
|
|
53762
53887
|
// have equivs. Flag m is never used since Onig uses different line break chars than JS
|
|
53763
53888
|
// (node.hasIndices ? 'd' : '') +
|
|
53764
53889
|
// (node.global ? 'g' : '') +
|
|
53765
53890
|
// (node.multiline ? 'm' : '') +
|
|
53766
|
-
(
|
|
53891
|
+
(state2.appliedGlobalFlags.ignoreCase ? "i" : "") + (node.dotAll ? "s" : "") + (node.sticky ? "y" : "")
|
|
53767
53892
|
);
|
|
53768
53893
|
},
|
|
53769
53894
|
/**
|
|
53770
53895
|
@param {GroupNode} node
|
|
53771
53896
|
*/
|
|
53772
|
-
Group({ atomic: atomic2, body: body4, flags, parent },
|
|
53773
|
-
const currentFlags =
|
|
53897
|
+
Group({ atomic: atomic2, body: body4, flags, parent }, state2, gen) {
|
|
53898
|
+
const currentFlags = state2.currentFlags;
|
|
53774
53899
|
if (flags) {
|
|
53775
|
-
|
|
53900
|
+
state2.currentFlags = getNewCurrentFlags(currentFlags, flags);
|
|
53776
53901
|
}
|
|
53777
53902
|
const contents = body4.map(gen).join("|");
|
|
53778
|
-
const result = !
|
|
53779
|
-
parent.type !== "Quantifier" && !atomic2 && (!
|
|
53780
|
-
|
|
53903
|
+
const result = !state2.verbose && body4.length === 1 && // Single alt
|
|
53904
|
+
parent.type !== "Quantifier" && !atomic2 && (!state2.useFlagMods || !flags) ? contents : `(?${getGroupPrefix(atomic2, flags, state2.useFlagMods)}${contents})`;
|
|
53905
|
+
state2.currentFlags = currentFlags;
|
|
53781
53906
|
return result;
|
|
53782
53907
|
},
|
|
53783
53908
|
/**
|
|
@@ -53796,11 +53921,11 @@ var generator = {
|
|
|
53796
53921
|
/**
|
|
53797
53922
|
@param {SubroutineNode & {isRecursive: true}} node
|
|
53798
53923
|
*/
|
|
53799
|
-
Subroutine({ isRecursive, ref },
|
|
53924
|
+
Subroutine({ isRecursive, ref }, state2) {
|
|
53800
53925
|
if (!isRecursive) {
|
|
53801
53926
|
throw new Error("Unexpected non-recursive subroutine in transformed AST");
|
|
53802
53927
|
}
|
|
53803
|
-
const limit2 =
|
|
53928
|
+
const limit2 = state2.recursionLimit;
|
|
53804
53929
|
return ref === 0 ? `(?R=${limit2})` : r39`\g<${ref}&R=${limit2}>`;
|
|
53805
53930
|
}
|
|
53806
53931
|
};
|
|
@@ -55766,13 +55891,13 @@ var InteractionManager = class {
|
|
|
55766
55891
|
}
|
|
55767
55892
|
};
|
|
55768
55893
|
}
|
|
55769
|
-
resolveLineRenderRange(
|
|
55770
|
-
if (
|
|
55771
|
-
const rowRange = this.getIndexesFromSelection(
|
|
55894
|
+
resolveLineRenderRange(state2, split, source) {
|
|
55895
|
+
if (state2.range == null) return;
|
|
55896
|
+
const rowRange = this.getIndexesFromSelection(state2.range, split);
|
|
55772
55897
|
if (rowRange == null) {
|
|
55773
55898
|
console.error({
|
|
55774
55899
|
rowRange,
|
|
55775
|
-
range:
|
|
55900
|
+
range: state2.range
|
|
55776
55901
|
});
|
|
55777
55902
|
throw new Error(`InteractionManager.renderSelection: No valid ${source} rowRange`);
|
|
55778
55903
|
}
|
|
@@ -57054,14 +57179,14 @@ function isDefaultRenderRange(renderRange) {
|
|
|
57054
57179
|
}
|
|
57055
57180
|
|
|
57056
57181
|
// node_modules/@pierre/diffs/dist/utils/processLine.js
|
|
57057
|
-
function processLine(node, line,
|
|
57058
|
-
const lineInfo = typeof
|
|
57182
|
+
function processLine(node, line, state2) {
|
|
57183
|
+
const lineInfo = typeof state2.lineInfo === "function" ? state2.lineInfo(line) : state2.lineInfo[line - 1];
|
|
57059
57184
|
if (lineInfo == null) {
|
|
57060
57185
|
const errorMessage = `processLine: line ${line}, contains no state.lineInfo`;
|
|
57061
57186
|
console.error(errorMessage, {
|
|
57062
57187
|
node,
|
|
57063
57188
|
line,
|
|
57064
|
-
state:
|
|
57189
|
+
state: state2
|
|
57065
57190
|
});
|
|
57066
57191
|
throw new Error(errorMessage);
|
|
57067
57192
|
}
|
|
@@ -57213,7 +57338,7 @@ function cyrb53(str, seed2 = 0) {
|
|
|
57213
57338
|
|
|
57214
57339
|
// node_modules/@pierre/diffs/dist/utils/createTransformerWithState.js
|
|
57215
57340
|
function createTransformerWithState(useTokenTransformer = false, useCSSClasses = false) {
|
|
57216
|
-
const
|
|
57341
|
+
const state2 = { lineInfo: [] };
|
|
57217
57342
|
const transformers = [{
|
|
57218
57343
|
line(node) {
|
|
57219
57344
|
delete node.properties.class;
|
|
@@ -57227,7 +57352,7 @@ function createTransformerWithState(useTokenTransformer = false, useCSSClasses =
|
|
|
57227
57352
|
for (const node of code2.children) {
|
|
57228
57353
|
if (node.type !== "element") continue;
|
|
57229
57354
|
if (useTokenTransformer) wrapTokenFragments(node);
|
|
57230
|
-
children.push(processLine(node, index,
|
|
57355
|
+
children.push(processLine(node, index, state2));
|
|
57231
57356
|
index++;
|
|
57232
57357
|
}
|
|
57233
57358
|
code2.children = children;
|
|
@@ -57269,7 +57394,7 @@ function createTransformerWithState(useTokenTransformer = false, useCSSClasses =
|
|
|
57269
57394
|
return node;
|
|
57270
57395
|
} });
|
|
57271
57396
|
return {
|
|
57272
|
-
state:
|
|
57397
|
+
state: state2,
|
|
57273
57398
|
transformers,
|
|
57274
57399
|
toClass
|
|
57275
57400
|
};
|
|
@@ -57362,9 +57487,9 @@ function hoverWouldEraseText(hover, bg, fg) {
|
|
|
57362
57487
|
}
|
|
57363
57488
|
|
|
57364
57489
|
// node_modules/@pierre/theming/dist/modules/normalizeThemeColors.js
|
|
57365
|
-
var
|
|
57490
|
+
var cache2 = /* @__PURE__ */ new WeakMap();
|
|
57366
57491
|
function normalizeThemeColors(theme3) {
|
|
57367
|
-
const cached =
|
|
57492
|
+
const cached = cache2.get(theme3);
|
|
57368
57493
|
if (cached != null) return cached;
|
|
57369
57494
|
const originalColors = theme3.colors ?? {};
|
|
57370
57495
|
const colors = { ...originalColors };
|
|
@@ -57391,7 +57516,7 @@ function normalizeThemeColors(theme3) {
|
|
|
57391
57516
|
...theme3,
|
|
57392
57517
|
colors: Object.freeze(colors)
|
|
57393
57518
|
});
|
|
57394
|
-
|
|
57519
|
+
cache2.set(theme3, result);
|
|
57395
57520
|
return result;
|
|
57396
57521
|
}
|
|
57397
57522
|
function fill(colors, key2, value) {
|
|
@@ -57522,14 +57647,14 @@ function renderFileWithHighlighter(file, highlighter2, { theme: theme3, tokenize
|
|
|
57522
57647
|
totalLines = Infinity;
|
|
57523
57648
|
}
|
|
57524
57649
|
const isWindowedHighlight = startingLine > 0 || totalLines < Infinity;
|
|
57525
|
-
const { state:
|
|
57650
|
+
const { state: state2, transformers } = createTransformerWithState(useTokenTransformer);
|
|
57526
57651
|
const lang = forcePlainText ? "text" : file.lang ?? getFiletypeFromFileName(file.name);
|
|
57527
57652
|
const baseThemeType = typeof theme3 === "string" ? highlighter2.getTheme(theme3).type : void 0;
|
|
57528
57653
|
const themeStyles = getHighlighterThemeStyles({
|
|
57529
57654
|
theme: theme3,
|
|
57530
57655
|
highlighter: highlighter2
|
|
57531
57656
|
});
|
|
57532
|
-
|
|
57657
|
+
state2.lineInfo = (shikiLineNumber) => ({
|
|
57533
57658
|
type: "context",
|
|
57534
57659
|
lineIndex: shikiLineNumber - 1 + startingLine,
|
|
57535
57660
|
lineNumber: shikiLineNumber + startingLine
|
|
@@ -57760,14 +57885,14 @@ var FileRenderer = class {
|
|
|
57760
57885
|
this.file = file;
|
|
57761
57886
|
const { options } = this.getRenderOptions(file);
|
|
57762
57887
|
const massiveFile = isFileMassive(this.getOrCreateLineCache(file).length, this.getTokenizeMaxLength());
|
|
57763
|
-
let
|
|
57764
|
-
if (
|
|
57888
|
+
let cache4 = this.workerManager?.getFileResultCache(file);
|
|
57889
|
+
if (cache4 != null && !areFileRenderOptionsEqual(options, cache4.options)) cache4 = void 0;
|
|
57765
57890
|
this.renderCache ??= {
|
|
57766
57891
|
file,
|
|
57767
57892
|
hydrated: true,
|
|
57768
57893
|
options,
|
|
57769
57894
|
highlighted: !massiveFile && !isFilePlainText(file),
|
|
57770
|
-
result: massiveFile ? void 0 :
|
|
57895
|
+
result: massiveFile ? void 0 : cache4?.result,
|
|
57771
57896
|
renderRange: void 0
|
|
57772
57897
|
};
|
|
57773
57898
|
if (!this.editSessionActive && this.workerManager?.isWorkingPool() === true) {
|
|
@@ -58177,9 +58302,9 @@ var FileRenderer = class {
|
|
|
58177
58302
|
}
|
|
58178
58303
|
getMatchingWorkerResultCache(file, options) {
|
|
58179
58304
|
if (this.editSessionActive) return;
|
|
58180
|
-
const
|
|
58181
|
-
if (
|
|
58182
|
-
return
|
|
58305
|
+
const cache4 = this.workerManager?.getFileResultCache(file);
|
|
58306
|
+
if (cache4 == null || !areFileRenderOptionsEqual(options, cache4.options)) return;
|
|
58307
|
+
return cache4;
|
|
58183
58308
|
}
|
|
58184
58309
|
getReadyRenderResult(file, options) {
|
|
58185
58310
|
const { pendingHighlightResult } = this;
|
|
@@ -59330,18 +59455,18 @@ var File = class {
|
|
|
59330
59455
|
if (renderAnnotation != null && lineAnnotations.length > 0) for (const [index, annotation] of lineAnnotations.entries()) {
|
|
59331
59456
|
const name = this.getAnnotationSlotName(annotation);
|
|
59332
59457
|
const id = `${index}-${name}`;
|
|
59333
|
-
let
|
|
59334
|
-
if (
|
|
59335
|
-
|
|
59458
|
+
let cache4 = this.annotationCache.get(id);
|
|
59459
|
+
if (cache4 == null || !areLineAnnotationsEqual(annotation, cache4.annotation)) {
|
|
59460
|
+
cache4?.element.remove();
|
|
59336
59461
|
const content = renderAnnotation(annotation);
|
|
59337
59462
|
if (content == null) continue;
|
|
59338
|
-
|
|
59463
|
+
cache4 = {
|
|
59339
59464
|
element: createAnnotationWrapperNode(name),
|
|
59340
59465
|
annotation
|
|
59341
59466
|
};
|
|
59342
|
-
|
|
59343
|
-
this.fileContainer.appendChild(
|
|
59344
|
-
this.annotationCache.set(id,
|
|
59467
|
+
cache4.element.appendChild(content);
|
|
59468
|
+
this.fileContainer.appendChild(cache4.element);
|
|
59469
|
+
this.annotationCache.set(id, cache4);
|
|
59345
59470
|
}
|
|
59346
59471
|
staleAnnotations.delete(id);
|
|
59347
59472
|
}
|
|
@@ -61732,7 +61857,7 @@ function iterateOverDiff({ diff, diffStyle, startingLine = 0, totalLines = Infin
|
|
|
61732
61857
|
expandedHunks,
|
|
61733
61858
|
collapsedContextThreshold
|
|
61734
61859
|
});
|
|
61735
|
-
const
|
|
61860
|
+
const state2 = {
|
|
61736
61861
|
viewportStart: startingLine,
|
|
61737
61862
|
viewportEnd: startingLine + totalLines,
|
|
61738
61863
|
isWindowedHighlight: startingLine > 0 || totalLines < Infinity,
|
|
@@ -61740,44 +61865,44 @@ function iterateOverDiff({ diff, diffStyle, startingLine = 0, totalLines = Infin
|
|
|
61740
61865
|
unifiedCount: iterationStart.unifiedCount,
|
|
61741
61866
|
finalHunkIndex: diff.hunks.length - 1,
|
|
61742
61867
|
shouldBreak() {
|
|
61743
|
-
if (!
|
|
61744
|
-
const breakUnified =
|
|
61745
|
-
const breakSplit =
|
|
61868
|
+
if (!state2.isWindowedHighlight) return false;
|
|
61869
|
+
const breakUnified = state2.unifiedCount >= startingLine + totalLines;
|
|
61870
|
+
const breakSplit = state2.splitCount >= startingLine + totalLines;
|
|
61746
61871
|
if (diffStyle === "unified") return breakUnified;
|
|
61747
61872
|
else if (diffStyle === "split") return breakSplit;
|
|
61748
61873
|
else return breakUnified && breakSplit;
|
|
61749
61874
|
},
|
|
61750
61875
|
shouldSkip(unifiedCount, splitCount) {
|
|
61751
|
-
if (!
|
|
61752
|
-
const skipUnified = unifiedCount > 0 &&
|
|
61753
|
-
const skipSplit = splitCount > 0 &&
|
|
61876
|
+
if (!state2.isWindowedHighlight) return false;
|
|
61877
|
+
const skipUnified = unifiedCount > 0 && state2.unifiedCount + unifiedCount <= startingLine;
|
|
61878
|
+
const skipSplit = splitCount > 0 && state2.splitCount + splitCount <= startingLine;
|
|
61754
61879
|
if (diffStyle === "unified") return skipUnified;
|
|
61755
61880
|
else if (diffStyle === "split") return skipSplit;
|
|
61756
61881
|
else return skipUnified && skipSplit;
|
|
61757
61882
|
},
|
|
61758
61883
|
incrementCounts(unifiedValue, splitValue) {
|
|
61759
|
-
if (diffStyle === "unified" || diffStyle === "both")
|
|
61760
|
-
if (diffStyle === "split" || diffStyle === "both")
|
|
61884
|
+
if (diffStyle === "unified" || diffStyle === "both") state2.unifiedCount += unifiedValue;
|
|
61885
|
+
if (diffStyle === "split" || diffStyle === "both") state2.splitCount += splitValue;
|
|
61761
61886
|
},
|
|
61762
61887
|
isInWindow(unifiedHeight, splitHeight) {
|
|
61763
|
-
if (!
|
|
61764
|
-
const unifiedInWindow =
|
|
61765
|
-
const splitInWindow =
|
|
61888
|
+
if (!state2.isWindowedHighlight) return true;
|
|
61889
|
+
const unifiedInWindow = state2.isInUnifiedWindow(unifiedHeight);
|
|
61890
|
+
const splitInWindow = state2.isInSplitWindow(splitHeight);
|
|
61766
61891
|
if (diffStyle === "unified") return unifiedInWindow;
|
|
61767
61892
|
else if (diffStyle === "split") return splitInWindow;
|
|
61768
61893
|
else return unifiedInWindow || splitInWindow;
|
|
61769
61894
|
},
|
|
61770
61895
|
isInUnifiedWindow(unifiedHeight) {
|
|
61771
|
-
return !
|
|
61896
|
+
return !state2.isWindowedHighlight || state2.unifiedCount >= startingLine - unifiedHeight && state2.unifiedCount < startingLine + totalLines;
|
|
61772
61897
|
},
|
|
61773
61898
|
isInSplitWindow(splitHeight) {
|
|
61774
|
-
return !
|
|
61899
|
+
return !state2.isWindowedHighlight || state2.splitCount >= startingLine - splitHeight && state2.splitCount < startingLine + totalLines;
|
|
61775
61900
|
},
|
|
61776
61901
|
emit(props, silent2 = false) {
|
|
61777
61902
|
if (!silent2) {
|
|
61778
|
-
if (diffStyle === "unified")
|
|
61779
|
-
else if (diffStyle === "split")
|
|
61780
|
-
else
|
|
61903
|
+
if (diffStyle === "unified") state2.incrementCounts(1, 0);
|
|
61904
|
+
else if (diffStyle === "split") state2.incrementCounts(0, 1);
|
|
61905
|
+
else state2.incrementCounts(1, 1);
|
|
61781
61906
|
}
|
|
61782
61907
|
return callback(props) ?? false;
|
|
61783
61908
|
}
|
|
@@ -61794,7 +61919,7 @@ function iterateOverDiff({ diff, diffStyle, startingLine = 0, totalLines = Infin
|
|
|
61794
61919
|
};
|
|
61795
61920
|
const hunk = diff.hunks[hunkIndex];
|
|
61796
61921
|
if (hunk == null) throw new Error("iterateOverDiff: invalid hunk index");
|
|
61797
|
-
if (
|
|
61922
|
+
if (state2.shouldBreak()) break;
|
|
61798
61923
|
const deletionBoundary = getHunkSideStartBoundary(hunk.deletionStart, hunk.deletionCount);
|
|
61799
61924
|
const additionBoundary = getHunkSideStartBoundary(hunk.additionStart, hunk.additionCount);
|
|
61800
61925
|
const deletionStartIndex = !diff.isPartial && hunk.deletionCount === 0 ? deletionBoundary : hunk.deletionLineIndex;
|
|
@@ -61806,7 +61931,7 @@ function iterateOverDiff({ diff, diffStyle, startingLine = 0, totalLines = Infin
|
|
|
61806
61931
|
hunkIndex,
|
|
61807
61932
|
collapsedContextThreshold
|
|
61808
61933
|
});
|
|
61809
|
-
const trailingRegion = hunkIndex ===
|
|
61934
|
+
const trailingRegion = hunkIndex === state2.finalHunkIndex ? getTrailingExpandedRegion({
|
|
61810
61935
|
fileDiff: diff,
|
|
61811
61936
|
hunkIndex,
|
|
61812
61937
|
expandedHunks,
|
|
@@ -61815,15 +61940,15 @@ function iterateOverDiff({ diff, diffStyle, startingLine = 0, totalLines = Infin
|
|
|
61815
61940
|
}) : void 0;
|
|
61816
61941
|
const expandedLineCount = leadingRegion.fromStart + leadingRegion.fromEnd;
|
|
61817
61942
|
let consumedCollapsed = leadingRegion.collapsedLines === 0;
|
|
61818
|
-
if (!
|
|
61943
|
+
if (!state2.shouldSkip(expandedLineCount, expandedLineCount)) {
|
|
61819
61944
|
let unifiedLineIndex2 = hunk.unifiedLineStart - leadingRegion.rangeSize;
|
|
61820
61945
|
let splitLineIndex2 = hunk.splitLineStart - leadingRegion.rangeSize;
|
|
61821
61946
|
let deletionLineIndex2 = deletionStartIndex - leadingRegion.rangeSize;
|
|
61822
61947
|
let additionLineIndex2 = additionStartIndex - leadingRegion.rangeSize;
|
|
61823
61948
|
let deletionLineNumber2 = deletionBoundary + 1 - leadingRegion.rangeSize;
|
|
61824
61949
|
let additionLineNumber2 = additionBoundary + 1 - leadingRegion.rangeSize;
|
|
61825
|
-
if (walkContextLines(
|
|
61826
|
-
return
|
|
61950
|
+
if (walkContextLines(state2, leadingRegion.fromStart, diffStyle, (index) => {
|
|
61951
|
+
return state2.emit({
|
|
61827
61952
|
hunkIndex,
|
|
61828
61953
|
hunk,
|
|
61829
61954
|
collapsedBefore: 0,
|
|
@@ -61851,8 +61976,8 @@ function iterateOverDiff({ diff, diffStyle, startingLine = 0, totalLines = Infin
|
|
|
61851
61976
|
additionLineIndex2 = additionStartIndex - leadingRegion.fromEnd;
|
|
61852
61977
|
deletionLineNumber2 = deletionBoundary + 1 - leadingRegion.fromEnd;
|
|
61853
61978
|
additionLineNumber2 = additionBoundary + 1 - leadingRegion.fromEnd;
|
|
61854
|
-
if (walkContextLines(
|
|
61855
|
-
return
|
|
61979
|
+
if (walkContextLines(state2, leadingRegion.fromEnd, diffStyle, (index) => {
|
|
61980
|
+
return state2.emit({
|
|
61856
61981
|
hunkIndex,
|
|
61857
61982
|
hunk,
|
|
61858
61983
|
collapsedBefore: consumePendingCollapsed(),
|
|
@@ -61877,7 +62002,7 @@ function iterateOverDiff({ diff, diffStyle, startingLine = 0, totalLines = Infin
|
|
|
61877
62002
|
consumePendingCollapsed();
|
|
61878
62003
|
})) break hunkIterator;
|
|
61879
62004
|
} else {
|
|
61880
|
-
|
|
62005
|
+
state2.incrementCounts(expandedLineCount, expandedLineCount);
|
|
61881
62006
|
consumePendingCollapsed();
|
|
61882
62007
|
}
|
|
61883
62008
|
let unifiedLineIndex = hunk.unifiedLineStart;
|
|
@@ -61888,15 +62013,15 @@ function iterateOverDiff({ diff, diffStyle, startingLine = 0, totalLines = Infin
|
|
|
61888
62013
|
let additionLineNumber = additionBoundary + 1;
|
|
61889
62014
|
const lastContent = hunk.hunkContent.at(-1);
|
|
61890
62015
|
for (const content of hunk.hunkContent) {
|
|
61891
|
-
if (
|
|
62016
|
+
if (state2.shouldBreak()) break hunkIterator;
|
|
61892
62017
|
const isLastContent = content === lastContent;
|
|
61893
62018
|
if (content.type === "context") {
|
|
61894
|
-
if (!
|
|
61895
|
-
if (walkContextLines(
|
|
62019
|
+
if (!state2.shouldSkip(content.lines, content.lines)) {
|
|
62020
|
+
if (walkContextLines(state2, content.lines, diffStyle, (index) => {
|
|
61896
62021
|
const isLastLine = isLastContent && index === content.lines - 1;
|
|
61897
62022
|
const unifiedRowIndex = unifiedLineIndex + index;
|
|
61898
62023
|
const splitRowIndex = splitLineIndex + index;
|
|
61899
|
-
return
|
|
62024
|
+
return state2.emit({
|
|
61900
62025
|
hunkIndex,
|
|
61901
62026
|
hunk,
|
|
61902
62027
|
collapsedBefore: consumePendingCollapsed(),
|
|
@@ -61921,7 +62046,7 @@ function iterateOverDiff({ diff, diffStyle, startingLine = 0, totalLines = Infin
|
|
|
61921
62046
|
consumePendingCollapsed();
|
|
61922
62047
|
})) break hunkIterator;
|
|
61923
62048
|
} else {
|
|
61924
|
-
|
|
62049
|
+
state2.incrementCounts(content.lines, content.lines);
|
|
61925
62050
|
consumePendingCollapsed();
|
|
61926
62051
|
}
|
|
61927
62052
|
unifiedLineIndex += content.lines;
|
|
@@ -61933,12 +62058,12 @@ function iterateOverDiff({ diff, diffStyle, startingLine = 0, totalLines = Infin
|
|
|
61933
62058
|
} else {
|
|
61934
62059
|
const splitCount = Math.max(content.deletions, content.additions);
|
|
61935
62060
|
const unifiedCount = content.deletions + content.additions;
|
|
61936
|
-
if (!
|
|
61937
|
-
const iterationRanges = getChangeIterationRanges(
|
|
62061
|
+
if (!state2.shouldSkip(unifiedCount, splitCount)) {
|
|
62062
|
+
const iterationRanges = getChangeIterationRanges(state2, content, diffStyle);
|
|
61938
62063
|
if ((iterationRanges[0]?.[0] ?? 0) > 0) consumePendingCollapsed();
|
|
61939
62064
|
for (const [rangeStart, rangeEnd] of iterationRanges) for (let index = rangeStart; index < rangeEnd; index++) {
|
|
61940
62065
|
const collapsedAfter = getTrailingCollapsedAfter(unifiedLineIndex + index, diffStyle === "unified" ? splitLineIndex + (index < content.deletions ? index : index - content.deletions) : splitLineIndex + index);
|
|
61941
|
-
if (
|
|
62066
|
+
if (state2.emit(getChangeLineData({
|
|
61942
62067
|
hunkIndex,
|
|
61943
62068
|
hunk,
|
|
61944
62069
|
collapsedBefore: consumePendingCollapsed(),
|
|
@@ -61959,7 +62084,7 @@ function iterateOverDiff({ diff, diffStyle, startingLine = 0, totalLines = Infin
|
|
|
61959
62084
|
}
|
|
61960
62085
|
}
|
|
61961
62086
|
consumePendingCollapsed();
|
|
61962
|
-
|
|
62087
|
+
state2.incrementCounts(unifiedCount, splitCount);
|
|
61963
62088
|
unifiedLineIndex += unifiedCount;
|
|
61964
62089
|
splitLineIndex += splitCount;
|
|
61965
62090
|
deletionLineIndex += content.deletions;
|
|
@@ -61971,9 +62096,9 @@ function iterateOverDiff({ diff, diffStyle, startingLine = 0, totalLines = Infin
|
|
|
61971
62096
|
if (trailingRegion != null) {
|
|
61972
62097
|
const { collapsedLines, fromStart, fromEnd } = trailingRegion;
|
|
61973
62098
|
const len = fromStart + fromEnd;
|
|
61974
|
-
if (walkContextLines(
|
|
62099
|
+
if (walkContextLines(state2, len, diffStyle, (index) => {
|
|
61975
62100
|
const isLastLine = index === len - 1;
|
|
61976
|
-
return
|
|
62101
|
+
return state2.emit({
|
|
61977
62102
|
hunkIndex: diff.hunks.length,
|
|
61978
62103
|
hunk: void 0,
|
|
61979
62104
|
collapsedBefore: 0,
|
|
@@ -61994,7 +62119,7 @@ function iterateOverDiff({ diff, diffStyle, startingLine = 0, totalLines = Infin
|
|
|
61994
62119
|
noEOFCR: false
|
|
61995
62120
|
}
|
|
61996
62121
|
});
|
|
61997
|
-
}, void 0, () =>
|
|
62122
|
+
}, void 0, () => state2.shouldBreak())) break hunkIterator;
|
|
61998
62123
|
}
|
|
61999
62124
|
}
|
|
62000
62125
|
}
|
|
@@ -62078,16 +62203,16 @@ function getHunkPrefixCounts({ diff, expandedHunks, collapsedContextThreshold })
|
|
|
62078
62203
|
}
|
|
62079
62204
|
return prefixCounts;
|
|
62080
62205
|
}
|
|
62081
|
-
function getContextLineIterationBounds(
|
|
62082
|
-
if (!
|
|
62206
|
+
function getContextLineIterationBounds(state2, count, diffStyle) {
|
|
62207
|
+
if (!state2.isWindowedHighlight || count <= 0) return [0, count];
|
|
62083
62208
|
const ranges = [];
|
|
62084
62209
|
function pushRange(currentCount) {
|
|
62085
|
-
const start2 = Math.max(0,
|
|
62086
|
-
const end2 = Math.min(count,
|
|
62210
|
+
const start2 = Math.max(0, state2.viewportStart - currentCount);
|
|
62211
|
+
const end2 = Math.min(count, state2.viewportEnd - currentCount);
|
|
62087
62212
|
if (end2 > start2) ranges.push([start2, end2]);
|
|
62088
62213
|
}
|
|
62089
|
-
if (diffStyle !== "split") pushRange(
|
|
62090
|
-
if (diffStyle !== "unified") pushRange(
|
|
62214
|
+
if (diffStyle !== "split") pushRange(state2.unifiedCount);
|
|
62215
|
+
if (diffStyle !== "unified") pushRange(state2.splitCount);
|
|
62091
62216
|
if (ranges.length === 0) return [0, 0];
|
|
62092
62217
|
let start = ranges[0][0];
|
|
62093
62218
|
let end = ranges[0][1];
|
|
@@ -62098,36 +62223,36 @@ function getContextLineIterationBounds(state3, count, diffStyle) {
|
|
|
62098
62223
|
}
|
|
62099
62224
|
return [start, end];
|
|
62100
62225
|
}
|
|
62101
|
-
function walkContextLines(
|
|
62102
|
-
const [startIndex, endIndex] = getContextLineIterationBounds(
|
|
62226
|
+
function walkContextLines(state2, count, diffStyle, callback, onSkippedStart, shouldBreak) {
|
|
62227
|
+
const [startIndex, endIndex] = getContextLineIterationBounds(state2, count, diffStyle);
|
|
62103
62228
|
if (startIndex > 0) {
|
|
62104
|
-
|
|
62229
|
+
state2.incrementCounts(startIndex, startIndex);
|
|
62105
62230
|
onSkippedStart?.();
|
|
62106
62231
|
}
|
|
62107
62232
|
let index = startIndex;
|
|
62108
62233
|
while (index < count) {
|
|
62109
62234
|
if (shouldBreak?.() === true) return true;
|
|
62110
62235
|
if (index >= endIndex) {
|
|
62111
|
-
|
|
62236
|
+
state2.incrementCounts(count - index, count - index);
|
|
62112
62237
|
break;
|
|
62113
62238
|
}
|
|
62114
|
-
if (
|
|
62239
|
+
if (state2.isInWindow(0, 0)) {
|
|
62115
62240
|
if (callback(index) === true) return true;
|
|
62116
|
-
} else
|
|
62241
|
+
} else state2.incrementCounts(1, 1);
|
|
62117
62242
|
index++;
|
|
62118
62243
|
}
|
|
62119
62244
|
return false;
|
|
62120
62245
|
}
|
|
62121
|
-
function getChangeIterationRanges(
|
|
62122
|
-
if (!
|
|
62246
|
+
function getChangeIterationRanges(state2, content, diffStyle) {
|
|
62247
|
+
if (!state2.isWindowedHighlight) return [[0, diffStyle === "unified" ? content.deletions + content.additions : Math.max(content.deletions, content.additions)]];
|
|
62123
62248
|
const useUnified = diffStyle !== "split";
|
|
62124
62249
|
const useSplit = diffStyle !== "unified";
|
|
62125
62250
|
const iterationSpace = diffStyle === "unified" ? "unified" : "split";
|
|
62126
62251
|
const iterationRanges = [];
|
|
62127
62252
|
function getVisibleRange(start, count) {
|
|
62128
|
-
if (start + count <=
|
|
62129
|
-
const visibleStart = Math.max(0,
|
|
62130
|
-
const visibleEnd = Math.min(count,
|
|
62253
|
+
if (start + count <= state2.viewportStart || start >= state2.viewportEnd) return;
|
|
62254
|
+
const visibleStart = Math.max(0, state2.viewportStart - start);
|
|
62255
|
+
const visibleEnd = Math.min(count, state2.viewportEnd - start);
|
|
62131
62256
|
return visibleEnd > visibleStart ? [visibleStart, visibleEnd] : void 0;
|
|
62132
62257
|
}
|
|
62133
62258
|
function mapRangeToIteration(range3, kind) {
|
|
@@ -62140,12 +62265,12 @@ function getChangeIterationRanges(state3, content, diffStyle) {
|
|
|
62140
62265
|
if (end > start) iterationRanges.push([start, end]);
|
|
62141
62266
|
}
|
|
62142
62267
|
if (useUnified) {
|
|
62143
|
-
pushRange(getVisibleRange(
|
|
62144
|
-
pushRange(getVisibleRange(
|
|
62268
|
+
pushRange(getVisibleRange(state2.unifiedCount, content.deletions), "deletions");
|
|
62269
|
+
pushRange(getVisibleRange(state2.unifiedCount + content.deletions, content.additions), "additions");
|
|
62145
62270
|
}
|
|
62146
62271
|
if (useSplit) {
|
|
62147
|
-
pushRange(getVisibleRange(
|
|
62148
|
-
pushRange(getVisibleRange(
|
|
62272
|
+
pushRange(getVisibleRange(state2.splitCount, content.deletions), "deletions");
|
|
62273
|
+
pushRange(getVisibleRange(state2.splitCount, content.additions), "additions");
|
|
62149
62274
|
}
|
|
62150
62275
|
if (iterationRanges.length === 0) return iterationRanges;
|
|
62151
62276
|
iterationRanges.sort((a23, b13) => a23[0] - b13[0]);
|
|
@@ -62461,7 +62586,7 @@ function createBucket() {
|
|
|
62461
62586
|
function renderTwoFiles({ deletionFile, additionFile, deletionInfo, additionInfo, highlighter: highlighter2, deletionDecorations, additionDecorations, languageOverride, options: { theme: themeOrThemes, ...options } }) {
|
|
62462
62587
|
const deletionLang = languageOverride ?? getFiletypeFromFileName(deletionFile.name);
|
|
62463
62588
|
const additionLang = languageOverride ?? getFiletypeFromFileName(additionFile.name);
|
|
62464
|
-
const { state:
|
|
62589
|
+
const { state: state2, transformers } = createTransformerWithState(options.useTokenTransformer);
|
|
62465
62590
|
const hastConfig = (() => {
|
|
62466
62591
|
return typeof themeOrThemes === "string" ? {
|
|
62467
62592
|
...options,
|
|
@@ -62487,7 +62612,7 @@ function renderTwoFiles({ deletionFile, additionFile, deletionInfo, additionInfo
|
|
|
62487
62612
|
deletionLines: (() => {
|
|
62488
62613
|
if (deletionFile.contents === "") return [];
|
|
62489
62614
|
hastConfig.lang = deletionLang;
|
|
62490
|
-
|
|
62615
|
+
state2.lineInfo = deletionInfo;
|
|
62491
62616
|
hastConfig.decorations = deletionDecorations;
|
|
62492
62617
|
return getLineNodes(highlighter2.codeToHast(cleanLastNewline(deletionFile.contents), hastConfig));
|
|
62493
62618
|
})(),
|
|
@@ -62495,7 +62620,7 @@ function renderTwoFiles({ deletionFile, additionFile, deletionInfo, additionInfo
|
|
|
62495
62620
|
if (additionFile.contents === "") return [];
|
|
62496
62621
|
hastConfig.lang = additionLang;
|
|
62497
62622
|
hastConfig.decorations = additionDecorations;
|
|
62498
|
-
|
|
62623
|
+
state2.lineInfo = additionInfo;
|
|
62499
62624
|
return getLineNodes(highlighter2.codeToHast(cleanLastNewline(additionFile.contents), hastConfig));
|
|
62500
62625
|
})()
|
|
62501
62626
|
};
|
|
@@ -63544,14 +63669,14 @@ var DiffHunksRenderer = class {
|
|
|
63544
63669
|
this.diff = diff;
|
|
63545
63670
|
const { options } = this.getRenderOptions(diff);
|
|
63546
63671
|
const massiveDiff = isDiffMassive(diff, this.getTokenizeMaxLength());
|
|
63547
|
-
let
|
|
63548
|
-
if (
|
|
63672
|
+
let cache4 = this.workerManager?.getDiffResultCache(diff);
|
|
63673
|
+
if (cache4 != null && !areDiffRenderOptionsEqual(options, cache4.options)) cache4 = void 0;
|
|
63549
63674
|
this.renderCache ??= {
|
|
63550
63675
|
diff,
|
|
63551
63676
|
hydrated: true,
|
|
63552
63677
|
highlighted: !massiveDiff && !isDiffPlainText(diff),
|
|
63553
63678
|
options,
|
|
63554
|
-
result: massiveDiff ? void 0 :
|
|
63679
|
+
result: massiveDiff ? void 0 : cache4?.result,
|
|
63555
63680
|
renderRange: void 0
|
|
63556
63681
|
};
|
|
63557
63682
|
if (!this.editSessionActive && this.workerManager?.isWorkingPool() === true) {
|
|
@@ -63761,9 +63886,9 @@ var DiffHunksRenderer = class {
|
|
|
63761
63886
|
}
|
|
63762
63887
|
getMatchingWorkerResultCache(diff, options) {
|
|
63763
63888
|
if (this.editSessionActive) return;
|
|
63764
|
-
const
|
|
63765
|
-
if (
|
|
63766
|
-
return
|
|
63889
|
+
const cache4 = this.workerManager?.getDiffResultCache(diff);
|
|
63890
|
+
if (cache4 == null || !areDiffRenderOptionsEqual(options, cache4.options)) return;
|
|
63891
|
+
return cache4;
|
|
63767
63892
|
}
|
|
63768
63893
|
getReadyRenderResult(diff, options) {
|
|
63769
63894
|
const { pendingHighlightResult } = this;
|
|
@@ -65678,20 +65803,20 @@ var FileDiff = class {
|
|
|
65678
65803
|
const staleSeparators = new Map(this.separatorCache);
|
|
65679
65804
|
for (const hunk of hunkData) {
|
|
65680
65805
|
const id = hunk.slotName;
|
|
65681
|
-
let
|
|
65682
|
-
if (
|
|
65683
|
-
|
|
65806
|
+
let cache4 = this.separatorCache.get(id);
|
|
65807
|
+
if (cache4 == null || !areHunkDataEqual(hunk, cache4.hunkData)) {
|
|
65808
|
+
cache4?.element.remove();
|
|
65684
65809
|
const element2 = document.createElement("div");
|
|
65685
65810
|
element2.style.display = "contents";
|
|
65686
65811
|
element2.slot = hunk.slotName;
|
|
65687
65812
|
const child = hunkSeparators(hunk, this);
|
|
65688
65813
|
if (child != null) element2.appendChild(child);
|
|
65689
65814
|
this.fileContainer.appendChild(element2);
|
|
65690
|
-
|
|
65815
|
+
cache4 = {
|
|
65691
65816
|
element: element2,
|
|
65692
65817
|
hunkData: hunk
|
|
65693
65818
|
};
|
|
65694
|
-
this.separatorCache.set(id,
|
|
65819
|
+
this.separatorCache.set(id, cache4);
|
|
65695
65820
|
}
|
|
65696
65821
|
staleSeparators.delete(id);
|
|
65697
65822
|
}
|
|
@@ -65712,18 +65837,18 @@ var FileDiff = class {
|
|
|
65712
65837
|
if (renderAnnotation != null && lineAnnotations.length > 0) for (const [index, annotation] of lineAnnotations.entries()) {
|
|
65713
65838
|
const name = this.getAnnotationSlotName(annotation);
|
|
65714
65839
|
const id = `${index}-${name}`;
|
|
65715
|
-
let
|
|
65716
|
-
if (
|
|
65717
|
-
|
|
65840
|
+
let cache4 = this.annotationCache.get(id);
|
|
65841
|
+
if (cache4 == null || !areDiffLineAnnotationsEqual(annotation, cache4.annotation)) {
|
|
65842
|
+
cache4?.element.remove();
|
|
65718
65843
|
const content = renderAnnotation(annotation);
|
|
65719
65844
|
if (content == null) continue;
|
|
65720
|
-
|
|
65845
|
+
cache4 = {
|
|
65721
65846
|
element: createAnnotationWrapperNode(name),
|
|
65722
65847
|
annotation
|
|
65723
65848
|
};
|
|
65724
|
-
|
|
65725
|
-
this.fileContainer.appendChild(
|
|
65726
|
-
this.annotationCache.set(id,
|
|
65849
|
+
cache4.element.appendChild(content);
|
|
65850
|
+
this.fileContainer.appendChild(cache4.element);
|
|
65851
|
+
this.annotationCache.set(id, cache4);
|
|
65727
65852
|
}
|
|
65728
65853
|
staleAnnotations.delete(id);
|
|
65729
65854
|
}
|
|
@@ -66469,13 +66594,13 @@ function getElementChildren(node) {
|
|
|
66469
66594
|
var code_default = ':host {\n display: block;\n height: 100%;\n overflow: auto;\n background: var(--spectrum-background-layer-2-color, #fff);\n --diffs-font-family: var(\n --spectrum-code-font-family-stack,\n ui-monospace,\n "SF Mono",\n Menlo,\n Consolas,\n monospace\n );\n --diffs-font-size: var(--spectrum-font-size-75, 12px);\n --diffs-bg-context-override: var(--spectrum-background-layer-2-color, #fff);\n --diffs-bg-context-gutter-override: var(--spectrum-background-layer-1-color, #f8f8f8);\n --diffs-bg-buffer-override: var(--spectrum-background-layer-1-color, #f8f8f8);\n --diffs-bg-separator-override: var(--spectrum-background-layer-1-color, #f8f8f8);\n --diffs-fg-number-override: var(--spectrum-gray-600, #717171);\n}\n\n.empty {\n padding: 24px;\n color: var(--spectrum-neutral-subdued-content-color-default, #505050);\n font-family: var(--spectrum-sans-font-family-stack, system-ui, sans-serif);\n font-size: var(--spectrum-font-size-75, 12px);\n}\n';
|
|
66470
66595
|
|
|
66471
66596
|
// src/components/sheets.ts
|
|
66472
|
-
var
|
|
66597
|
+
var cache3 = /* @__PURE__ */ new WeakMap();
|
|
66473
66598
|
function adoptStyles(root2, ...texts) {
|
|
66474
66599
|
const document2 = root2.ownerDocument;
|
|
66475
|
-
let sheets =
|
|
66600
|
+
let sheets = cache3.get(document2);
|
|
66476
66601
|
if (!sheets) {
|
|
66477
66602
|
sheets = /* @__PURE__ */ new Map();
|
|
66478
|
-
|
|
66603
|
+
cache3.set(document2, sheets);
|
|
66479
66604
|
}
|
|
66480
66605
|
const adopted = texts.map((text2) => {
|
|
66481
66606
|
let sheet2 = sheets.get(text2);
|
|
@@ -68121,11 +68246,11 @@ var Splitview = class {
|
|
|
68121
68246
|
else this.updateSash(sash, 3);
|
|
68122
68247
|
}
|
|
68123
68248
|
}
|
|
68124
|
-
updateSash(sash,
|
|
68125
|
-
toggleClass(sash.container, "dv-disabled",
|
|
68126
|
-
toggleClass(sash.container, "dv-enabled",
|
|
68127
|
-
toggleClass(sash.container, "dv-maximum",
|
|
68128
|
-
toggleClass(sash.container, "dv-minimum",
|
|
68249
|
+
updateSash(sash, state2) {
|
|
68250
|
+
toggleClass(sash.container, "dv-disabled", state2 === 2);
|
|
68251
|
+
toggleClass(sash.container, "dv-enabled", state2 === 3);
|
|
68252
|
+
toggleClass(sash.container, "dv-maximum", state2 === 0);
|
|
68253
|
+
toggleClass(sash.container, "dv-minimum", state2 === 1);
|
|
68129
68254
|
}
|
|
68130
68255
|
createViewContainer() {
|
|
68131
68256
|
const element2 = document.createElement("div");
|
|
@@ -70324,14 +70449,14 @@ var Droptarget = class Droptarget2 extends CompositeDisposable {
|
|
|
70324
70449
|
onDrop: (e122) => {
|
|
70325
70450
|
var _this$options$getOver7, _this$options6;
|
|
70326
70451
|
e122.preventDefault();
|
|
70327
|
-
const
|
|
70452
|
+
const state2 = this._state;
|
|
70328
70453
|
const edge = this._edge;
|
|
70329
70454
|
this.removeDropTarget();
|
|
70330
70455
|
(_this$options$getOver7 = (_this$options6 = this.options).getOverrideTarget) === null || _this$options$getOver7 === void 0 || (_this$options$getOver7 = _this$options$getOver7.call(_this$options6)) === null || _this$options$getOver7 === void 0 || _this$options$getOver7.clear();
|
|
70331
|
-
if (
|
|
70456
|
+
if (state2) {
|
|
70332
70457
|
e122.stopPropagation();
|
|
70333
70458
|
this._onDrop.fire({
|
|
70334
|
-
position:
|
|
70459
|
+
position: state2,
|
|
70335
70460
|
nativeEvent: e122,
|
|
70336
70461
|
edge
|
|
70337
70462
|
});
|
|
@@ -70805,13 +70930,13 @@ var PointerDropTarget = class extends CompositeDisposable {
|
|
|
70805
70930
|
}
|
|
70806
70931
|
_onDropEvent(event2) {
|
|
70807
70932
|
var _this$options$getOver5, _this$options4;
|
|
70808
|
-
const
|
|
70933
|
+
const state2 = this._state;
|
|
70809
70934
|
const edge = this._edge;
|
|
70810
70935
|
const overrideTarget = (_this$options$getOver5 = (_this$options4 = this.options).getOverrideTarget) === null || _this$options$getOver5 === void 0 ? void 0 : _this$options$getOver5.call(_this$options4);
|
|
70811
70936
|
this._removeOverlay();
|
|
70812
70937
|
overrideTarget === null || overrideTarget === void 0 || overrideTarget.clear();
|
|
70813
|
-
if (
|
|
70814
|
-
position:
|
|
70938
|
+
if (state2) this._onDrop.fire({
|
|
70939
|
+
position: state2,
|
|
70815
70940
|
nativeEvent: event2.pointerEvent,
|
|
70816
70941
|
edge
|
|
70817
70942
|
});
|
|
@@ -76864,10 +76989,10 @@ var GridviewPanel = class extends BasePanelView {
|
|
|
76864
76989
|
});
|
|
76865
76990
|
}
|
|
76866
76991
|
toJSON() {
|
|
76867
|
-
const
|
|
76992
|
+
const state2 = super.toJSON();
|
|
76868
76993
|
const maximum = (value) => value === Number.MAX_SAFE_INTEGER ? void 0 : value;
|
|
76869
76994
|
const minimum = (value) => value <= 0 ? void 0 : value;
|
|
76870
|
-
return _objectSpread2(_objectSpread2({},
|
|
76995
|
+
return _objectSpread2(_objectSpread2({}, state2), {}, {
|
|
76871
76996
|
minimumHeight: minimum(this.minimumHeight),
|
|
76872
76997
|
maximumHeight: maximum(this.maximumHeight),
|
|
76873
76998
|
minimumWidth: minimum(this.minimumWidth),
|
|
@@ -77359,17 +77484,17 @@ var DockviewPanel = class extends CompositeDisposable {
|
|
|
77359
77484
|
for (const key2 of Object.keys(event2.params)) if (event2.params[key2] === void 0) delete this._params[key2];
|
|
77360
77485
|
this.view.update({ params: this._params });
|
|
77361
77486
|
}
|
|
77362
|
-
updateFromStateModel(
|
|
77487
|
+
updateFromStateModel(state2) {
|
|
77363
77488
|
var _state$params, _state$title, _state$renderer, _state$pinned, _this$accessor$option;
|
|
77364
|
-
this._maximumHeight =
|
|
77365
|
-
this._minimumHeight =
|
|
77366
|
-
this._maximumWidth =
|
|
77367
|
-
this._minimumWidth =
|
|
77368
|
-
this._params = (_state$params =
|
|
77489
|
+
this._maximumHeight = state2.maximumHeight;
|
|
77490
|
+
this._minimumHeight = state2.minimumHeight;
|
|
77491
|
+
this._maximumWidth = state2.maximumWidth;
|
|
77492
|
+
this._minimumWidth = state2.minimumWidth;
|
|
77493
|
+
this._params = (_state$params = state2.params) !== null && _state$params !== void 0 ? _state$params : {};
|
|
77369
77494
|
this.view.update({ params: this._params });
|
|
77370
|
-
this.setTitle((_state$title =
|
|
77371
|
-
this.setRenderer((_state$renderer =
|
|
77372
|
-
this.setPinned(((_state$pinned =
|
|
77495
|
+
this.setTitle((_state$title = state2.title) !== null && _state$title !== void 0 ? _state$title : this.id);
|
|
77496
|
+
this.setRenderer((_state$renderer = state2.renderer) !== null && _state$renderer !== void 0 ? _state$renderer : this.accessor.renderer);
|
|
77497
|
+
this.setPinned(((_state$pinned = state2.pinned) !== null && _state$pinned !== void 0 ? _state$pinned : false) && !!((_this$accessor$option = this.accessor.options.pinnedTabs) === null || _this$accessor$option === void 0 ? void 0 : _this$accessor$option.enabled));
|
|
77373
77498
|
}
|
|
77374
77499
|
updateParentGroup(group, options) {
|
|
77375
77500
|
this._group = group;
|
|
@@ -78647,36 +78772,36 @@ var HeaderActionsService = class {
|
|
|
78647
78772
|
}
|
|
78648
78773
|
refresh(group) {
|
|
78649
78774
|
if (!(group === null || group === void 0 ? void 0 : group.model)) return;
|
|
78650
|
-
const
|
|
78651
|
-
this._refreshSlot("left", group,
|
|
78652
|
-
this._refreshSlot("right", group,
|
|
78653
|
-
this._refreshSlot("prefix", group,
|
|
78775
|
+
const state2 = this._ensureState(group);
|
|
78776
|
+
this._refreshSlot("left", group, state2.left);
|
|
78777
|
+
this._refreshSlot("right", group, state2.right);
|
|
78778
|
+
this._refreshSlot("prefix", group, state2.prefix);
|
|
78654
78779
|
}
|
|
78655
78780
|
refreshAll() {
|
|
78656
78781
|
for (const group of this._host.groups) this.refresh(group);
|
|
78657
78782
|
}
|
|
78658
78783
|
disposeGroup(group) {
|
|
78659
|
-
const
|
|
78660
|
-
if (!
|
|
78661
|
-
|
|
78662
|
-
|
|
78663
|
-
|
|
78784
|
+
const state2 = this._perGroup.get(group);
|
|
78785
|
+
if (!state2) return;
|
|
78786
|
+
state2.left.dispose();
|
|
78787
|
+
state2.right.dispose();
|
|
78788
|
+
state2.prefix.dispose();
|
|
78664
78789
|
this._perGroup.delete(group);
|
|
78665
78790
|
}
|
|
78666
78791
|
dispose() {
|
|
78667
78792
|
for (const group of [...this._perGroup.keys()]) this.disposeGroup(group);
|
|
78668
78793
|
}
|
|
78669
78794
|
_ensureState(group) {
|
|
78670
|
-
let
|
|
78671
|
-
if (!
|
|
78672
|
-
|
|
78795
|
+
let state2 = this._perGroup.get(group);
|
|
78796
|
+
if (!state2) {
|
|
78797
|
+
state2 = {
|
|
78673
78798
|
left: new MutableDisposable(),
|
|
78674
78799
|
right: new MutableDisposable(),
|
|
78675
78800
|
prefix: new MutableDisposable()
|
|
78676
78801
|
};
|
|
78677
|
-
this._perGroup.set(group,
|
|
78802
|
+
this._perGroup.set(group, state2);
|
|
78678
78803
|
}
|
|
78679
|
-
return
|
|
78804
|
+
return state2;
|
|
78680
78805
|
}
|
|
78681
78806
|
_refreshSlot(slot, group, disposable) {
|
|
78682
78807
|
const factory = this._host.options[SLOT_OPTION_KEY[slot]];
|
|
@@ -80375,16 +80500,16 @@ var ShellManager = class {
|
|
|
80375
80500
|
"bottom"
|
|
80376
80501
|
]) {
|
|
80377
80502
|
var _state$collapsed;
|
|
80378
|
-
const
|
|
80503
|
+
const state2 = data[position];
|
|
80379
80504
|
const view = this._getView(position);
|
|
80380
|
-
if (!
|
|
80381
|
-
view.restoreExpandedSize(
|
|
80382
|
-
view.setCollapsed((_state$collapsed =
|
|
80383
|
-
if (
|
|
80505
|
+
if (!state2 || !view) continue;
|
|
80506
|
+
view.restoreExpandedSize(state2.size);
|
|
80507
|
+
view.setCollapsed((_state$collapsed = state2.collapsed) !== null && _state$collapsed !== void 0 ? _state$collapsed : false);
|
|
80508
|
+
if (state2.collapsed) {
|
|
80384
80509
|
this._pendingSizes.delete(position);
|
|
80385
80510
|
this._resizeView(position, view.collapsedSize);
|
|
80386
|
-
} else this.resizeEdgeGroup(position,
|
|
80387
|
-
this.setEdgeGroupVisible(position, !!
|
|
80511
|
+
} else this.resizeEdgeGroup(position, state2.size);
|
|
80512
|
+
this.setEdgeGroupVisible(position, !!state2.visible);
|
|
80388
80513
|
}
|
|
80389
80514
|
}
|
|
80390
80515
|
dispose() {
|