visual-remote 0.3.2 → 0.3.3
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 +12 -0
- package/apps/cli/dist/direct-exec-mcp.js +1 -1
- package/apps/cli/dist/index.js +32 -13
- package/apps/cli/dist/next.js +32 -12
- package/apps/cli/dist/vite.js +114 -45
- package/package.json +3 -3
- package/packages/overlay/dist/client.js +5 -5
- package/packages/overlay/dist/viewer.js +3 -3
package/README.md
CHANGED
|
@@ -55,6 +55,11 @@ http://localhost:9011/_visual/* → 내부 Visual Remote Bridge로만 전달
|
|
|
55
55
|
이미 실행 중이던 개발 서버가 있다면 `init` 후 한 번 재시작해야 변경된 설정이
|
|
56
56
|
적용됩니다. Portr를 사용할 때도 내부 Bridge 포트가 아니라 기존 앱 포트만 노출합니다.
|
|
57
57
|
|
|
58
|
+
Next.js 기본 로컬 통합은 같은 프로토콜·앱 포트의 `localhost`와 `127.0.0.1`을
|
|
59
|
+
모두 허용합니다. `gateway.publicUrl`이나 비어 있지 않은 `security.allowedOrigins`를
|
|
60
|
+
직접 설정하면 이 별칭 자동 허용은 적용하지 않습니다. LAN·터널 주소는 해당 설정에
|
|
61
|
+
명시해야 하며, 무관한 주소나 다른 포트는 자동으로 허용하지 않습니다.
|
|
62
|
+
|
|
58
63
|
자동 통합은 Vite와 Next.js 프로젝트를 지원합니다. 다른 프레임워크나 설정 파일을
|
|
59
64
|
자동으로 수정하고 싶지 않은 프로젝트에서는 아래의 `attach` 방식을 사용할 수 있습니다.
|
|
60
65
|
|
|
@@ -256,6 +261,13 @@ Overlay에서 `작업 보드 ↗`를 다시 눌러 새 세션을 엽니다. 연
|
|
|
256
261
|
|
|
257
262
|
같은 Git 작업 트리에서는 쓰기 작업을 한 번에 하나만 실행합니다. HMR, 브라우저
|
|
258
263
|
오류와 설정된 검증 명령의 결과가 확정된 뒤 큐의 다음 요청을 처리합니다.
|
|
264
|
+
되돌리기 역시 같은 쓰기 잠금을 사용합니다. 되돌리기 중 들어온 새 요청은 큐에서
|
|
265
|
+
대기하고, Bridge 종료도 진행 중인 되돌리기가 끝날 때까지 기다립니다.
|
|
266
|
+
|
|
267
|
+
중단된 작업을 복구할 때 이미 저장된 작업 후 스냅샷은 덮어쓰지 않습니다.
|
|
268
|
+
그 스냅샷 이후 사용자가 수정한 작업 대상 파일은 되돌리기 시 충돌로 처리해 보존합니다.
|
|
269
|
+
저장된 스냅샷 참조가 유효하지 않으면 현재 파일로 대체하지 않고 안전하지 않은 작업으로
|
|
270
|
+
표시해 되돌리기를 차단합니다.
|
|
259
271
|
|
|
260
272
|
## 명령줄 명령
|
|
261
273
|
|
|
@@ -626,7 +626,7 @@ async function executeReadOnlyBatch(request, options) {
|
|
|
626
626
|
// ../../package.json
|
|
627
627
|
var package_default = {
|
|
628
628
|
name: "visual-remote",
|
|
629
|
-
version: "0.3.
|
|
629
|
+
version: "0.3.3",
|
|
630
630
|
description: "Visual bridge from a running web UI to a coding agent in its Git worktree",
|
|
631
631
|
type: "module",
|
|
632
632
|
packageManager: "pnpm@10.34.5",
|
package/apps/cli/dist/index.js
CHANGED
|
@@ -4031,6 +4031,7 @@ var TaskService = class {
|
|
|
4031
4031
|
return publicTask(accepted);
|
|
4032
4032
|
}
|
|
4033
4033
|
async revert(id) {
|
|
4034
|
+
if (this.#closed) throw new TaskServiceError("SERVICE_CLOSED", "Task service is closed");
|
|
4034
4035
|
if (this.#activeTaskId || this.#recovering || this.#recoveryQueue.length > 0) {
|
|
4035
4036
|
throw new TaskServiceError(
|
|
4036
4037
|
"WRITER_BUSY",
|
|
@@ -4046,12 +4047,19 @@ var TaskService = class {
|
|
|
4046
4047
|
if (!latest || latest.id !== id) {
|
|
4047
4048
|
throw new TaskServiceError("NOT_LATEST_TASK", "Only the latest completed task can be reverted");
|
|
4048
4049
|
}
|
|
4049
|
-
|
|
4050
|
-
|
|
4051
|
-
|
|
4052
|
-
|
|
4053
|
-
|
|
4054
|
-
|
|
4050
|
+
this.#activeTaskId = id;
|
|
4051
|
+
try {
|
|
4052
|
+
await this.#git.revert(id, task.beforeRef, task.afterRef);
|
|
4053
|
+
const reverted = this.#transition(id, "reverted", {
|
|
4054
|
+
completedAt: this.#now().toISOString()
|
|
4055
|
+
});
|
|
4056
|
+
this.#emit("task.reverted", { task: publicTask(reverted) }, id);
|
|
4057
|
+
return publicTask(reverted);
|
|
4058
|
+
} finally {
|
|
4059
|
+
this.#activeTaskId = void 0;
|
|
4060
|
+
if (!this.#closed) void this.#drain();
|
|
4061
|
+
this.#resolveIdleIfNeeded();
|
|
4062
|
+
}
|
|
4055
4063
|
}
|
|
4056
4064
|
async waitForIdle() {
|
|
4057
4065
|
if (!this.#activeTaskId && this.#queue.length === 0 && this.#recoveryQueue.length === 0 && !this.#recovering && !this.#draining) {
|
|
@@ -4062,7 +4070,7 @@ var TaskService = class {
|
|
|
4062
4070
|
async close() {
|
|
4063
4071
|
if (this.#closed) return;
|
|
4064
4072
|
this.#closed = true;
|
|
4065
|
-
if (this.#activeTaskId &&
|
|
4073
|
+
if (this.#activeTaskId && this.#activeAbort) {
|
|
4066
4074
|
this.#cancelRequested.add(this.#activeTaskId);
|
|
4067
4075
|
this.#activeAbort?.abort(new AgentCanceledError("Task service is closing"));
|
|
4068
4076
|
}
|
|
@@ -4127,9 +4135,12 @@ var TaskService = class {
|
|
|
4127
4135
|
if (!task.beforeRef) {
|
|
4128
4136
|
throw new Error("Interrupted task is missing its before snapshot");
|
|
4129
4137
|
}
|
|
4130
|
-
|
|
4131
|
-
|
|
4132
|
-
|
|
4138
|
+
let afterRef = task.afterRef;
|
|
4139
|
+
if (!afterRef) {
|
|
4140
|
+
afterRef = (await this.#git.createSnapshot(taskId, "after")).ref;
|
|
4141
|
+
this.#store.updateTask(taskId, { afterRef });
|
|
4142
|
+
}
|
|
4143
|
+
const diff = await this.#git.diff(task.beforeRef, afterRef);
|
|
4133
4144
|
this.#store.updateTask(taskId, {
|
|
4134
4145
|
diffText: diff.text,
|
|
4135
4146
|
changedFiles: diff.files
|
|
@@ -4201,7 +4212,7 @@ var TaskService = class {
|
|
|
4201
4212
|
}
|
|
4202
4213
|
}
|
|
4203
4214
|
async #drain() {
|
|
4204
|
-
if (this.#draining || this.#closed || this.#recovering || this.#recoveryQueue.length > 0) {
|
|
4215
|
+
if (this.#draining || this.#activeTaskId || this.#closed || this.#recovering || this.#recoveryQueue.length > 0) {
|
|
4205
4216
|
return;
|
|
4206
4217
|
}
|
|
4207
4218
|
this.#draining = true;
|
|
@@ -5787,6 +5798,13 @@ async function startBridgeCore(options, dependencies) {
|
|
|
5787
5798
|
controlService = await resolveControlService(dependencies, controlContext);
|
|
5788
5799
|
const allowedOrigins = new Set(loadedConfig.config.security.allowedOrigins);
|
|
5789
5800
|
if (publicUrl !== void 0) allowedOrigins.add(new URL(publicUrl).origin);
|
|
5801
|
+
if (options.fallbackLoopbackOrigins === true && options.publicUrl === void 0 && loadedConfig.config.gateway.publicUrl === void 0 && loadedConfig.config.security.allowedOrigins.length === 0 && publicUrl !== void 0) {
|
|
5802
|
+
const loopbackUrl = new URL(publicUrl);
|
|
5803
|
+
if (loopbackUrl.hostname === "localhost" || loopbackUrl.hostname === "127.0.0.1") {
|
|
5804
|
+
loopbackUrl.hostname = loopbackUrl.hostname === "localhost" ? "127.0.0.1" : "localhost";
|
|
5805
|
+
allowedOrigins.add(loopbackUrl.origin);
|
|
5806
|
+
}
|
|
5807
|
+
}
|
|
5790
5808
|
gateway = createGatewayServer({
|
|
5791
5809
|
upstream: options.upstreamUrl,
|
|
5792
5810
|
pairingToken: token,
|
|
@@ -5890,7 +5908,8 @@ async function startAttachBridge(options, dependencies = {}) {
|
|
|
5890
5908
|
...options.listen === void 0 ? {} : { listen: options.listen },
|
|
5891
5909
|
...options.host === void 0 ? {} : { host: options.host },
|
|
5892
5910
|
...options.publicUrl === void 0 ? {} : { publicUrl: options.publicUrl },
|
|
5893
|
-
...options.fallbackPublicUrl === void 0 ? {} : { fallbackPublicUrl: options.fallbackPublicUrl }
|
|
5911
|
+
...options.fallbackPublicUrl === void 0 ? {} : { fallbackPublicUrl: options.fallbackPublicUrl },
|
|
5912
|
+
...options.fallbackLoopbackOrigins === void 0 ? {} : { fallbackLoopbackOrigins: options.fallbackLoopbackOrigins }
|
|
5894
5913
|
},
|
|
5895
5914
|
dependencies
|
|
5896
5915
|
);
|
|
@@ -6672,7 +6691,7 @@ function formatBridgeStatus(status) {
|
|
|
6672
6691
|
// ../../package.json
|
|
6673
6692
|
var package_default = {
|
|
6674
6693
|
name: "visual-remote",
|
|
6675
|
-
version: "0.3.
|
|
6694
|
+
version: "0.3.3",
|
|
6676
6695
|
description: "Visual bridge from a running web UI to a coding agent in its Git worktree",
|
|
6677
6696
|
type: "module",
|
|
6678
6697
|
packageManager: "pnpm@10.34.5",
|
package/apps/cli/dist/next.js
CHANGED
|
@@ -3032,6 +3032,7 @@ var TaskService = class {
|
|
|
3032
3032
|
return publicTask(accepted);
|
|
3033
3033
|
}
|
|
3034
3034
|
async revert(id) {
|
|
3035
|
+
if (this.#closed) throw new TaskServiceError("SERVICE_CLOSED", "Task service is closed");
|
|
3035
3036
|
if (this.#activeTaskId || this.#recovering || this.#recoveryQueue.length > 0) {
|
|
3036
3037
|
throw new TaskServiceError(
|
|
3037
3038
|
"WRITER_BUSY",
|
|
@@ -3047,12 +3048,19 @@ var TaskService = class {
|
|
|
3047
3048
|
if (!latest || latest.id !== id) {
|
|
3048
3049
|
throw new TaskServiceError("NOT_LATEST_TASK", "Only the latest completed task can be reverted");
|
|
3049
3050
|
}
|
|
3050
|
-
|
|
3051
|
-
|
|
3052
|
-
|
|
3053
|
-
|
|
3054
|
-
|
|
3055
|
-
|
|
3051
|
+
this.#activeTaskId = id;
|
|
3052
|
+
try {
|
|
3053
|
+
await this.#git.revert(id, task.beforeRef, task.afterRef);
|
|
3054
|
+
const reverted = this.#transition(id, "reverted", {
|
|
3055
|
+
completedAt: this.#now().toISOString()
|
|
3056
|
+
});
|
|
3057
|
+
this.#emit("task.reverted", { task: publicTask(reverted) }, id);
|
|
3058
|
+
return publicTask(reverted);
|
|
3059
|
+
} finally {
|
|
3060
|
+
this.#activeTaskId = void 0;
|
|
3061
|
+
if (!this.#closed) void this.#drain();
|
|
3062
|
+
this.#resolveIdleIfNeeded();
|
|
3063
|
+
}
|
|
3056
3064
|
}
|
|
3057
3065
|
async waitForIdle() {
|
|
3058
3066
|
if (!this.#activeTaskId && this.#queue.length === 0 && this.#recoveryQueue.length === 0 && !this.#recovering && !this.#draining) {
|
|
@@ -3063,7 +3071,7 @@ var TaskService = class {
|
|
|
3063
3071
|
async close() {
|
|
3064
3072
|
if (this.#closed) return;
|
|
3065
3073
|
this.#closed = true;
|
|
3066
|
-
if (this.#activeTaskId &&
|
|
3074
|
+
if (this.#activeTaskId && this.#activeAbort) {
|
|
3067
3075
|
this.#cancelRequested.add(this.#activeTaskId);
|
|
3068
3076
|
this.#activeAbort?.abort(new AgentCanceledError("Task service is closing"));
|
|
3069
3077
|
}
|
|
@@ -3128,9 +3136,12 @@ var TaskService = class {
|
|
|
3128
3136
|
if (!task.beforeRef) {
|
|
3129
3137
|
throw new Error("Interrupted task is missing its before snapshot");
|
|
3130
3138
|
}
|
|
3131
|
-
|
|
3132
|
-
|
|
3133
|
-
|
|
3139
|
+
let afterRef = task.afterRef;
|
|
3140
|
+
if (!afterRef) {
|
|
3141
|
+
afterRef = (await this.#git.createSnapshot(taskId, "after")).ref;
|
|
3142
|
+
this.#store.updateTask(taskId, { afterRef });
|
|
3143
|
+
}
|
|
3144
|
+
const diff = await this.#git.diff(task.beforeRef, afterRef);
|
|
3134
3145
|
this.#store.updateTask(taskId, {
|
|
3135
3146
|
diffText: diff.text,
|
|
3136
3147
|
changedFiles: diff.files
|
|
@@ -3202,7 +3213,7 @@ var TaskService = class {
|
|
|
3202
3213
|
}
|
|
3203
3214
|
}
|
|
3204
3215
|
async #drain() {
|
|
3205
|
-
if (this.#draining || this.#closed || this.#recovering || this.#recoveryQueue.length > 0) {
|
|
3216
|
+
if (this.#draining || this.#activeTaskId || this.#closed || this.#recovering || this.#recoveryQueue.length > 0) {
|
|
3206
3217
|
return;
|
|
3207
3218
|
}
|
|
3208
3219
|
this.#draining = true;
|
|
@@ -5715,6 +5726,13 @@ async function startBridgeCore(options, dependencies) {
|
|
|
5715
5726
|
controlService = await resolveControlService(dependencies, controlContext);
|
|
5716
5727
|
const allowedOrigins = new Set(loadedConfig.config.security.allowedOrigins);
|
|
5717
5728
|
if (publicUrl !== void 0) allowedOrigins.add(new URL(publicUrl).origin);
|
|
5729
|
+
if (options.fallbackLoopbackOrigins === true && options.publicUrl === void 0 && loadedConfig.config.gateway.publicUrl === void 0 && loadedConfig.config.security.allowedOrigins.length === 0 && publicUrl !== void 0) {
|
|
5730
|
+
const loopbackUrl = new URL(publicUrl);
|
|
5731
|
+
if (loopbackUrl.hostname === "localhost" || loopbackUrl.hostname === "127.0.0.1") {
|
|
5732
|
+
loopbackUrl.hostname = loopbackUrl.hostname === "localhost" ? "127.0.0.1" : "localhost";
|
|
5733
|
+
allowedOrigins.add(loopbackUrl.origin);
|
|
5734
|
+
}
|
|
5735
|
+
}
|
|
5718
5736
|
gateway = createGatewayServer({
|
|
5719
5737
|
upstream: options.upstreamUrl,
|
|
5720
5738
|
pairingToken: token,
|
|
@@ -5818,7 +5836,8 @@ async function startAttachBridge(options, dependencies = {}) {
|
|
|
5818
5836
|
...options.listen === void 0 ? {} : { listen: options.listen },
|
|
5819
5837
|
...options.host === void 0 ? {} : { host: options.host },
|
|
5820
5838
|
...options.publicUrl === void 0 ? {} : { publicUrl: options.publicUrl },
|
|
5821
|
-
...options.fallbackPublicUrl === void 0 ? {} : { fallbackPublicUrl: options.fallbackPublicUrl }
|
|
5839
|
+
...options.fallbackPublicUrl === void 0 ? {} : { fallbackPublicUrl: options.fallbackPublicUrl },
|
|
5840
|
+
...options.fallbackLoopbackOrigins === void 0 ? {} : { fallbackLoopbackOrigins: options.fallbackLoopbackOrigins }
|
|
5822
5841
|
},
|
|
5823
5842
|
dependencies
|
|
5824
5843
|
);
|
|
@@ -5913,6 +5932,7 @@ async function startOrReuseBridge(options, cwd) {
|
|
|
5913
5932
|
{
|
|
5914
5933
|
upstream: resolveNextUpstream(options),
|
|
5915
5934
|
fallbackPublicUrl: resolveNextPublicUrl(options),
|
|
5935
|
+
fallbackLoopbackOrigins: true,
|
|
5916
5936
|
...options.bridgeHost === void 0 ? {} : { host: options.bridgeHost },
|
|
5917
5937
|
...options.bridgePort === void 0 ? {} : { listen: options.bridgePort }
|
|
5918
5938
|
},
|
package/apps/cli/dist/vite.js
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
// src/vite.ts
|
|
2
|
+
import { AsyncLocalStorage } from "node:async_hooks";
|
|
2
3
|
import { resolve as resolve7 } from "node:path";
|
|
3
4
|
|
|
4
5
|
// ../../packages/bridge-core/src/agents/types.ts
|
|
@@ -3032,6 +3033,7 @@ var TaskService = class {
|
|
|
3032
3033
|
return publicTask(accepted);
|
|
3033
3034
|
}
|
|
3034
3035
|
async revert(id) {
|
|
3036
|
+
if (this.#closed) throw new TaskServiceError("SERVICE_CLOSED", "Task service is closed");
|
|
3035
3037
|
if (this.#activeTaskId || this.#recovering || this.#recoveryQueue.length > 0) {
|
|
3036
3038
|
throw new TaskServiceError(
|
|
3037
3039
|
"WRITER_BUSY",
|
|
@@ -3047,12 +3049,19 @@ var TaskService = class {
|
|
|
3047
3049
|
if (!latest || latest.id !== id) {
|
|
3048
3050
|
throw new TaskServiceError("NOT_LATEST_TASK", "Only the latest completed task can be reverted");
|
|
3049
3051
|
}
|
|
3050
|
-
|
|
3051
|
-
|
|
3052
|
-
|
|
3053
|
-
|
|
3054
|
-
|
|
3055
|
-
|
|
3052
|
+
this.#activeTaskId = id;
|
|
3053
|
+
try {
|
|
3054
|
+
await this.#git.revert(id, task.beforeRef, task.afterRef);
|
|
3055
|
+
const reverted = this.#transition(id, "reverted", {
|
|
3056
|
+
completedAt: this.#now().toISOString()
|
|
3057
|
+
});
|
|
3058
|
+
this.#emit("task.reverted", { task: publicTask(reverted) }, id);
|
|
3059
|
+
return publicTask(reverted);
|
|
3060
|
+
} finally {
|
|
3061
|
+
this.#activeTaskId = void 0;
|
|
3062
|
+
if (!this.#closed) void this.#drain();
|
|
3063
|
+
this.#resolveIdleIfNeeded();
|
|
3064
|
+
}
|
|
3056
3065
|
}
|
|
3057
3066
|
async waitForIdle() {
|
|
3058
3067
|
if (!this.#activeTaskId && this.#queue.length === 0 && this.#recoveryQueue.length === 0 && !this.#recovering && !this.#draining) {
|
|
@@ -3063,7 +3072,7 @@ var TaskService = class {
|
|
|
3063
3072
|
async close() {
|
|
3064
3073
|
if (this.#closed) return;
|
|
3065
3074
|
this.#closed = true;
|
|
3066
|
-
if (this.#activeTaskId &&
|
|
3075
|
+
if (this.#activeTaskId && this.#activeAbort) {
|
|
3067
3076
|
this.#cancelRequested.add(this.#activeTaskId);
|
|
3068
3077
|
this.#activeAbort?.abort(new AgentCanceledError("Task service is closing"));
|
|
3069
3078
|
}
|
|
@@ -3128,9 +3137,12 @@ var TaskService = class {
|
|
|
3128
3137
|
if (!task.beforeRef) {
|
|
3129
3138
|
throw new Error("Interrupted task is missing its before snapshot");
|
|
3130
3139
|
}
|
|
3131
|
-
|
|
3132
|
-
|
|
3133
|
-
|
|
3140
|
+
let afterRef = task.afterRef;
|
|
3141
|
+
if (!afterRef) {
|
|
3142
|
+
afterRef = (await this.#git.createSnapshot(taskId, "after")).ref;
|
|
3143
|
+
this.#store.updateTask(taskId, { afterRef });
|
|
3144
|
+
}
|
|
3145
|
+
const diff = await this.#git.diff(task.beforeRef, afterRef);
|
|
3134
3146
|
this.#store.updateTask(taskId, {
|
|
3135
3147
|
diffText: diff.text,
|
|
3136
3148
|
changedFiles: diff.files
|
|
@@ -3202,7 +3214,7 @@ var TaskService = class {
|
|
|
3202
3214
|
}
|
|
3203
3215
|
}
|
|
3204
3216
|
async #drain() {
|
|
3205
|
-
if (this.#draining || this.#closed || this.#recovering || this.#recoveryQueue.length > 0) {
|
|
3217
|
+
if (this.#draining || this.#activeTaskId || this.#closed || this.#recovering || this.#recoveryQueue.length > 0) {
|
|
3206
3218
|
return;
|
|
3207
3219
|
}
|
|
3208
3220
|
this.#draining = true;
|
|
@@ -5715,6 +5727,13 @@ async function startBridgeCore(options, dependencies) {
|
|
|
5715
5727
|
controlService = await resolveControlService(dependencies, controlContext);
|
|
5716
5728
|
const allowedOrigins = new Set(loadedConfig.config.security.allowedOrigins);
|
|
5717
5729
|
if (publicUrl !== void 0) allowedOrigins.add(new URL(publicUrl).origin);
|
|
5730
|
+
if (options.fallbackLoopbackOrigins === true && options.publicUrl === void 0 && loadedConfig.config.gateway.publicUrl === void 0 && loadedConfig.config.security.allowedOrigins.length === 0 && publicUrl !== void 0) {
|
|
5731
|
+
const loopbackUrl = new URL(publicUrl);
|
|
5732
|
+
if (loopbackUrl.hostname === "localhost" || loopbackUrl.hostname === "127.0.0.1") {
|
|
5733
|
+
loopbackUrl.hostname = loopbackUrl.hostname === "localhost" ? "127.0.0.1" : "localhost";
|
|
5734
|
+
allowedOrigins.add(loopbackUrl.origin);
|
|
5735
|
+
}
|
|
5736
|
+
}
|
|
5718
5737
|
gateway = createGatewayServer({
|
|
5719
5738
|
upstream: options.upstreamUrl,
|
|
5720
5739
|
pairingToken: token,
|
|
@@ -5818,7 +5837,8 @@ async function startAttachBridge(options, dependencies = {}) {
|
|
|
5818
5837
|
...options.listen === void 0 ? {} : { listen: options.listen },
|
|
5819
5838
|
...options.host === void 0 ? {} : { host: options.host },
|
|
5820
5839
|
...options.publicUrl === void 0 ? {} : { publicUrl: options.publicUrl },
|
|
5821
|
-
...options.fallbackPublicUrl === void 0 ? {} : { fallbackPublicUrl: options.fallbackPublicUrl }
|
|
5840
|
+
...options.fallbackPublicUrl === void 0 ? {} : { fallbackPublicUrl: options.fallbackPublicUrl },
|
|
5841
|
+
...options.fallbackLoopbackOrigins === void 0 ? {} : { fallbackLoopbackOrigins: options.fallbackLoopbackOrigins }
|
|
5822
5842
|
},
|
|
5823
5843
|
dependencies
|
|
5824
5844
|
);
|
|
@@ -5832,6 +5852,49 @@ async function startAttachBridge(options, dependencies = {}) {
|
|
|
5832
5852
|
}
|
|
5833
5853
|
|
|
5834
5854
|
// src/vite.ts
|
|
5855
|
+
var bridgesKey = /* @__PURE__ */ Symbol.for("visual-remote.vite.bridges");
|
|
5856
|
+
var bridgeState = globalThis;
|
|
5857
|
+
var bridges = bridgeState[bridgesKey] ??= /* @__PURE__ */ new Map();
|
|
5858
|
+
var restartsKey = /* @__PURE__ */ Symbol.for("visual-remote.vite.restarts");
|
|
5859
|
+
var restartState = globalThis;
|
|
5860
|
+
var restarts = restartState[restartsKey] ??= new AsyncLocalStorage();
|
|
5861
|
+
async function acquireBridge(options, config) {
|
|
5862
|
+
const root = projectRoot(config, options.cwd);
|
|
5863
|
+
let shared = bridges.get(root);
|
|
5864
|
+
if (shared?.closing !== void 0) {
|
|
5865
|
+
await shared.closing;
|
|
5866
|
+
return acquireBridge(options, config);
|
|
5867
|
+
}
|
|
5868
|
+
if (shared === void 0) {
|
|
5869
|
+
shared = { bridge: startOrReuseBridge(options, config), users: 0 };
|
|
5870
|
+
bridges.set(root, shared);
|
|
5871
|
+
}
|
|
5872
|
+
const entry = shared;
|
|
5873
|
+
entry.users += 1;
|
|
5874
|
+
let releasePromise;
|
|
5875
|
+
const release = () => {
|
|
5876
|
+
releasePromise ??= (async () => {
|
|
5877
|
+
entry.users -= 1;
|
|
5878
|
+
if (entry.users !== 0) return;
|
|
5879
|
+
entry.closing = (async () => {
|
|
5880
|
+
try {
|
|
5881
|
+
const bridge = await entry.bridge.catch(() => void 0);
|
|
5882
|
+
await bridge?.ownedBridge?.close();
|
|
5883
|
+
} finally {
|
|
5884
|
+
bridges.delete(root);
|
|
5885
|
+
}
|
|
5886
|
+
})();
|
|
5887
|
+
await entry.closing;
|
|
5888
|
+
})();
|
|
5889
|
+
return releasePromise;
|
|
5890
|
+
};
|
|
5891
|
+
try {
|
|
5892
|
+
return { bridge: await entry.bridge, release };
|
|
5893
|
+
} catch (error) {
|
|
5894
|
+
await release();
|
|
5895
|
+
throw error;
|
|
5896
|
+
}
|
|
5897
|
+
}
|
|
5835
5898
|
function projectRoot(config, configuredRoot) {
|
|
5836
5899
|
if (configuredRoot !== void 0) return resolve7(configuredRoot);
|
|
5837
5900
|
return resolve7(process.cwd(), typeof config.root === "string" ? config.root : ".");
|
|
@@ -5869,32 +5932,11 @@ async function startOrReuseBridge(options, config) {
|
|
|
5869
5932
|
}
|
|
5870
5933
|
}
|
|
5871
5934
|
function visualRemote(options = {}) {
|
|
5872
|
-
let bridgePromise;
|
|
5873
5935
|
let pairingUrlAnnounced = false;
|
|
5874
|
-
const closeBridge = async () => {
|
|
5875
|
-
if (bridgePromise === void 0) return;
|
|
5876
|
-
const bridge = await bridgePromise.catch(() => void 0);
|
|
5877
|
-
await bridge?.ownedBridge?.close();
|
|
5878
|
-
};
|
|
5879
5936
|
return {
|
|
5880
5937
|
name: "visual-remote",
|
|
5881
5938
|
apply: "serve",
|
|
5882
5939
|
enforce: "pre",
|
|
5883
|
-
async config(config) {
|
|
5884
|
-
bridgePromise ??= startOrReuseBridge(options, config);
|
|
5885
|
-
const bridge = await bridgePromise;
|
|
5886
|
-
bridge.ownedBridge?.gateway.server.unref();
|
|
5887
|
-
return {
|
|
5888
|
-
server: {
|
|
5889
|
-
proxy: {
|
|
5890
|
-
"/_visual": {
|
|
5891
|
-
target: bridge.gatewayUrl,
|
|
5892
|
-
ws: true
|
|
5893
|
-
}
|
|
5894
|
-
}
|
|
5895
|
-
}
|
|
5896
|
-
};
|
|
5897
|
-
},
|
|
5898
5940
|
transformIndexHtml: {
|
|
5899
5941
|
order: "pre",
|
|
5900
5942
|
handler(html) {
|
|
@@ -5910,21 +5952,48 @@ function visualRemote(options = {}) {
|
|
|
5910
5952
|
];
|
|
5911
5953
|
}
|
|
5912
5954
|
},
|
|
5913
|
-
configureServer(server) {
|
|
5914
|
-
|
|
5915
|
-
|
|
5916
|
-
|
|
5917
|
-
|
|
5918
|
-
|
|
5919
|
-
|
|
5955
|
+
async configureServer(server) {
|
|
5956
|
+
const candidate = { config: server.config, close: server.close };
|
|
5957
|
+
restarts.getStore()?.push(candidate);
|
|
5958
|
+
const restart = server.restart;
|
|
5959
|
+
server.restart = (forceOptimize) => {
|
|
5960
|
+
const candidates = [];
|
|
5961
|
+
return restarts.run(candidates, async () => {
|
|
5962
|
+
try {
|
|
5963
|
+
return await restart(forceOptimize);
|
|
5964
|
+
} finally {
|
|
5965
|
+
for (const replacement of candidates) {
|
|
5966
|
+
if (replacement.config !== server.config) await replacement.close();
|
|
5967
|
+
}
|
|
5968
|
+
}
|
|
5920
5969
|
});
|
|
5921
|
-
}
|
|
5970
|
+
};
|
|
5971
|
+
const serverLease = await acquireBridge(options, server.config);
|
|
5972
|
+
const close = server.close;
|
|
5973
|
+
server.close = async () => {
|
|
5974
|
+
try {
|
|
5975
|
+
await close();
|
|
5976
|
+
} finally {
|
|
5977
|
+
await serverLease.release();
|
|
5978
|
+
}
|
|
5979
|
+
};
|
|
5980
|
+
candidate.close = server.close;
|
|
5922
5981
|
server.httpServer?.once("close", () => {
|
|
5923
|
-
void
|
|
5982
|
+
void serverLease.release();
|
|
5924
5983
|
});
|
|
5925
|
-
|
|
5926
|
-
|
|
5927
|
-
|
|
5984
|
+
const { bridge } = serverLease;
|
|
5985
|
+
bridge.ownedBridge?.gateway.server.unref();
|
|
5986
|
+
server.config.server.proxy ??= {};
|
|
5987
|
+
server.config.server.proxy["/_visual"] = {
|
|
5988
|
+
target: bridge.gatewayUrl,
|
|
5989
|
+
ws: true
|
|
5990
|
+
};
|
|
5991
|
+
if (!pairingUrlAnnounced) {
|
|
5992
|
+
pairingUrlAnnounced = true;
|
|
5993
|
+
server.config.logger.info(
|
|
5994
|
+
bridge.openUrl === void 0 ? `[visual-remote] Reusing Bridge: ${bridge.gatewayUrl}` : `[visual-remote] Pair: ${bridge.openUrl}`
|
|
5995
|
+
);
|
|
5996
|
+
}
|
|
5928
5997
|
}
|
|
5929
5998
|
};
|
|
5930
5999
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "visual-remote",
|
|
3
|
-
"version": "0.3.
|
|
3
|
+
"version": "0.3.3",
|
|
4
4
|
"description": "Visual bridge from a running web UI to a coding agent in its Git worktree",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"repository": {
|
|
@@ -78,10 +78,10 @@
|
|
|
78
78
|
"typescript": "^7.0.2",
|
|
79
79
|
"vite": "^8.1.5",
|
|
80
80
|
"vitest": "^4.1.10",
|
|
81
|
-
"@visual-remote/bridge-core": "0.1.0",
|
|
82
81
|
"@visual-remote/cli": "0.1.0",
|
|
83
|
-
"@visual-remote/overlay": "0.1.0",
|
|
84
82
|
"@visual-remote/gateway": "0.1.0",
|
|
83
|
+
"@visual-remote/bridge-core": "0.1.0",
|
|
84
|
+
"@visual-remote/overlay": "0.1.0",
|
|
85
85
|
"@visual-remote/protocol": "0.1.0"
|
|
86
86
|
},
|
|
87
87
|
"scripts": {
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
var Me,C,Mt,Vn,oe,At,Nt,$t,Ge,Pe,xe,Ht,Qe,Xe,Je,Yn,Ie={},qe=[],Gn=/acit|ex(?:s|g|n|p|$)|rph|grid|ows|mnc|ntw|ine[ch]|zoo|^ord|itera/i,Ne=Array.isArray;function ee(e,t){for(var n in t)e[n]=t[n];return e}function Ze(e){e&&e.parentNode&&e.parentNode.removeChild(e)}function Xn(e,t,n){var o,r,i,a={};for(i in t)i=="key"?o=t[i]:i=="ref"?r=t[i]:a[i]=t[i];if(arguments.length>2&&(a.children=arguments.length>3?Me.call(arguments,2):n),typeof e=="function"&&e.defaultProps!=null)for(i in e.defaultProps)a[i]===void 0&&(a[i]=e.defaultProps[i]);return Le(e,a,o,r,null)}function Le(e,t,n,o,r){var i={type:e,props:t,key:n,ref:o,__k:null,__:null,__b:0,__e:null,__c:null,constructor:void 0,__v:r??++Mt,__i:-1,__u:0};return r==null&&C.vnode!=null&&C.vnode(i),i}function te(e){return e.children}function Ae(e,t){this.props=e,this.context=t}function de(e,t){if(t==null)return e.__?de(e.__,e.__i+1):null;for(var n;t<e.__k.length;t++)if((n=e.__k[t])!=null&&n.__e!=null)return n.__e;return typeof e.type=="function"?de(e):null}function Jn(e){if(e.__P&&e.__d){var t=e.__v,n=t.__e,o=[],r=[],i=ee({},t);i.__v=t.__v+1,C.vnode&&C.vnode(i),et(e.__P,i,t,e.__n,e.__P.namespaceURI,32&t.__u?[n]:null,o,n??de(t),!!(32&t.__u),r),i.__v=t.__v,i.__.__k[i.__i]=i,Dt(o,i,r),t.__e=t.__=null,i.__e!=n&&Bt(i)}}function Bt(e){if((e=e.__)!=null&&e.__c!=null)return e.__e=e.__c.base=null,e.__k.some(function(t){if(t!=null&&t.__e!=null)return e.__e=e.__c.base=t.__e}),Bt(e)}function It(e){(!e.__d&&(e.__d=!0)&&oe.push(e)&&!Fe.__r++||At!=C.debounceRendering)&&((At=C.debounceRendering)||Nt)(Fe)}function Fe(){try{for(var e,t=1;oe.length;)oe.length>t&&oe.sort($t),e=oe.shift(),t=oe.length,Jn(e)}finally{oe.length=Fe.__r=0}}function Ut(e,t,n,o,r,i,a,l,f,c,h){var _,s,m,T,y,E,b,w=o&&o.__k||qe,L=t.length;for(f=Qn(n,t,w,f,L),_=0;_<L;_++)(m=n.__k[_])!=null&&(s=m.__i!=-1&&w[m.__i]||Ie,m.__i=_,E=et(e,m,s,r,i,a,l,f,c,h),T=m.__e,m.ref&&s.ref!=m.ref&&(s.ref&&tt(s.ref,null,m),h.push(m.ref,m.__c||T,m)),y==null&&T!=null&&(y=T),(b=!!(4&m.__u))||s.__k===m.__k?(f=jt(m,f,e,b),b&&s.__e&&(s.__e=null)):typeof m.type=="function"&&E!==void 0?f=E:T&&(f=T.nextSibling),m.__u&=-7);return n.__e=y,f}function Qn(e,t,n,o,r){var i,a,l,f,c,h=n.length,_=h,s=0;for(e.__k=new Array(r),i=0;i<r;i++)(a=t[i])!=null&&typeof a!="boolean"&&typeof a!="function"?(typeof a=="string"||typeof a=="number"||typeof a=="bigint"||a.constructor==String?a=e.__k[i]=Le(null,a,null,null,null):Ne(a)?a=e.__k[i]=Le(te,{children:a},null,null,null):a.constructor===void 0&&a.__b>0?a=e.__k[i]=Le(a.type,a.props,a.key,a.ref?a.ref:null,a.__v):e.__k[i]=a,f=i+s,a.__=e,a.__b=e.__b+1,l=null,(c=a.__i=Zn(a,n,f,_))!=-1&&(_--,(l=n[c])&&(l.__u|=2)),l==null||l.__v==null?(c==-1&&(r>h?s--:r<h&&s++),typeof a.type!="function"&&(a.__u|=4)):c!=f&&(c==f-1?s--:c==f+1?s++:(c>f?s--:s++,a.__u|=4))):e.__k[i]=null;if(_)for(i=0;i<h;i++)(l=n[i])!=null&&(2&l.__u)==0&&(l.__e==o&&(o=de(l)),Wt(l,l));return o}function jt(e,t,n,o){var r,i;if(typeof e.type=="function"){for(r=e.__k,i=0;r&&i<r.length;i++)r[i]&&(r[i].__=e,t=jt(r[i],t,n,o));return t}e.__e!=t&&(o&&(t&&e.type&&!t.parentNode&&(t=de(e)),n.insertBefore(e.__e,t||null)),t=e.__e);do t=t&&t.nextSibling;while(t!=null&&t.nodeType==8);return t}function Zn(e,t,n,o){var r,i,a,l=e.key,f=e.type,c=t[n],h=c!=null&&(2&c.__u)==0;if(c===null&&l==null||h&&l==c.key&&f==c.type)return n;if(o>(h?1:0)){for(r=n-1,i=n+1;r>=0||i<t.length;)if((c=t[a=r>=0?r--:i++])!=null&&(2&c.__u)==0&&l==c.key&&f==c.type)return a}return-1}function qt(e,t,n){t[0]=="-"?e.setProperty(t,n??""):e[t]=n==null?"":typeof n!="number"||Gn.test(t)?n:n+"px"}function Re(e,t,n,o,r){var i,a;e:if(t=="style")if(typeof n=="string")e.style.cssText=n;else{if(typeof o=="string"&&(e.style.cssText=o=""),o)for(t in o)n&&t in n||qt(e.style,t,"");if(n)for(t in n)o&&n[t]==o[t]||qt(e.style,t,n[t])}else if(t[0]=="o"&&t[1]=="n")i=t!=(t=t.replace(Ht,"$1")),a=t.toLowerCase(),t=a in e||t=="onFocusOut"||t=="onFocusIn"?a.slice(2):t.slice(2),e.l||(e.l={}),e.l[t+i]=n,n?o?n[xe]=o[xe]:(n[xe]=Qe,e.addEventListener(t,i?Je:Xe,i)):e.removeEventListener(t,i?Je:Xe,i);else{if(r=="http://www.w3.org/2000/svg")t=t.replace(/xlink(H|:h)/,"h").replace(/sName$/,"s");else if(t!="width"&&t!="height"&&t!="href"&&t!="list"&&t!="form"&&t!="tabIndex"&&t!="download"&&t!="rowSpan"&&t!="colSpan"&&t!="role"&&t!="popover"&&t in e)try{e[t]=n??"";break e}catch{}typeof n=="function"||(n==null||n===!1&&t[4]!="-"?e.removeAttribute(t):e.setAttribute(t,t=="popover"&&n==1?"":n))}}function Ft(e){return function(t){if(this.l){var n=this.l[t.type+e];if(t[Pe]==null)t[Pe]=Qe++;else if(t[Pe]<n[xe])return;return n(C.event?C.event(t):t)}}}function et(e,t,n,o,r,i,a,l,f,c){var h,_,s,m,T,y,E,b,w,L,j,z,Y,O,A,q,B=t.type;if(t.constructor!==void 0)return null;128&n.__u&&(f=!!(32&n.__u),i=[l=t.__e=n.__e]),(h=C.__b)&&h(t);e:if(typeof B=="function"){_=a.length;try{if(w=t.props,L=B.prototype&&B.prototype.render,j=(h=B.contextType)&&o[h.__c],z=h?j?j.props.value:h.__:o,n.__c?b=(s=t.__c=n.__c).__=s.__E:(L?t.__c=s=new B(w,z):(t.__c=s=new Ae(w,z),s.constructor=B,s.render=to),j&&j.sub(s),s.state||(s.state={}),s.__n=o,m=s.__d=!0,s.__h=[],s._sb=[]),L&&s.__s==null&&(s.__s=s.state),L&&B.getDerivedStateFromProps!=null&&(s.__s==s.state&&(s.__s=ee({},s.__s)),ee(s.__s,B.getDerivedStateFromProps(w,s.__s))),T=s.props,y=s.state,s.__v=t,m)L&&B.getDerivedStateFromProps==null&&s.componentWillMount!=null&&s.componentWillMount(),L&&s.componentDidMount!=null&&s.__h.push(s.componentDidMount);else{if(L&&B.getDerivedStateFromProps==null&&w!==T&&s.componentWillReceiveProps!=null&&s.componentWillReceiveProps(w,z),t.__v==n.__v||!s.__e&&s.shouldComponentUpdate!=null&&s.shouldComponentUpdate(w,s.__s,z)===!1){t.__v!=n.__v&&(s.props=w,s.state=s.__s,s.__d=!1),t.__e=n.__e,t.__k=n.__k,t.__k.some(function(J){J&&(J.__=t)}),qe.push.apply(s.__h,s._sb),s._sb=[],s.__h.length&&a.push(s);break e}s.componentWillUpdate!=null&&s.componentWillUpdate(w,s.__s,z),L&&s.componentDidUpdate!=null&&s.__h.push(function(){s.componentDidUpdate(T,y,E)})}if(s.context=z,s.props=w,s.__P=e,s.__e=!1,Y=C.__r,O=0,L)s.state=s.__s,s.__d=!1,Y&&Y(t),h=s.render(s.props,s.state,s.context),qe.push.apply(s.__h,s._sb),s._sb=[];else do s.__d=!1,Y&&Y(t),h=s.render(s.props,s.state,s.context),s.state=s.__s;while(s.__d&&++O<25);s.state=s.__s,s.getChildContext!=null&&(o=ee(ee({},o),s.getChildContext())),L&&!m&&s.getSnapshotBeforeUpdate!=null&&(E=s.getSnapshotBeforeUpdate(T,y)),A=h!=null&&h.type===te&&h.key==null?zt(h.props.children):h,l=Ut(e,Ne(A)?A:[A],t,n,o,r,i,a,l,f,c),s.base=t.__e,t.__u&=-161,s.__h.length&&a.push(s),b&&(s.__E=s.__=null)}catch(J){if(a.length=_,t.__v=null,f||i!=null){if(J.then){for(t.__u|=f?160:128;l&&l.nodeType==8&&l.nextSibling;)l=l.nextSibling;i!=null&&(i[i.indexOf(l)]=null),t.__e=l}else if(i!=null)for(q=i.length;q--;)Ze(i[q])}else t.__e=n.__e;t.__k==null&&(t.__k=n.__k||[]),J.then||Ot(t),C.__e(J,t,n)}}else i==null&&t.__v==n.__v?(t.__k=n.__k,t.__e=n.__e):l=t.__e=eo(n.__e,t,n,o,r,i,a,f,c);return(h=C.diffed)&&h(t),128&t.__u?void 0:l}function Ot(e){e&&(e.__c&&(e.__c.__e=!0),e.__k&&e.__k.some(Ot))}function Dt(e,t,n){for(var o=0;o<n.length;o++)tt(n[o],n[++o],n[++o]);C.__c&&C.__c(t,e),e.some(function(r){try{e=r.__h,r.__h=[],e.some(function(i){i.call(r)})}catch(i){C.__e(i,r.__v)}})}function zt(e){return typeof e!="object"||e==null||e.__b>0?e:Ne(e)?e.map(zt):e.constructor!==void 0?null:ee({},e)}function eo(e,t,n,o,r,i,a,l,f){var c,h,_,s,m,T,y,E=n.props||Ie,b=t.props,w=t.type;if(w=="svg"?r="http://www.w3.org/2000/svg":w=="math"?r="http://www.w3.org/1998/Math/MathML":r||(r="http://www.w3.org/1999/xhtml"),i!=null){for(c=0;c<i.length;c++)if((m=i[c])&&"setAttribute"in m==!!w&&(w?m.localName==w:m.nodeType==3)){e=m,i[c]=null;break}}if(e==null){if(w==null)return document.createTextNode(b);e=document.createElementNS(r,w,b.is&&b),l&&(C.__m&&C.__m(t,i),l=!1),i=null}if(w==null)E===b||l&&e.data==b||(e.data=b);else{if(i=w=="textarea"&&b.defaultValue!=null?null:i&&Me.call(e.childNodes),!l&&i!=null)for(E={},c=0;c<e.attributes.length;c++)E[(m=e.attributes[c]).name]=m.value;for(c in E)m=E[c],c=="dangerouslySetInnerHTML"?_=m:c=="children"||c in b||c=="value"&&"defaultValue"in b||c=="checked"&&"defaultChecked"in b||Re(e,c,null,m,r);for(c in b)m=b[c],c=="children"?s=m:c=="dangerouslySetInnerHTML"?h=m:c=="value"?T=m:c=="checked"?y=m:l&&typeof m!="function"||E[c]===m||Re(e,c,m,E[c],r);if(h)l||_&&(h.__html==_.__html||h.__html==e.innerHTML)||(e.innerHTML=h.__html),t.__k=[];else if(_&&(e.innerHTML=""),Ut(t.type=="template"?e.content:e,Ne(s)?s:[s],t,n,o,w=="foreignObject"?"http://www.w3.org/1999/xhtml":r,i,a,i?i[0]:n.__k&&de(n,0),l,f),i!=null)for(c=i.length;c--;)Ze(i[c]);l&&w!="textarea"||(c="value",w=="progress"&&T==null?e.removeAttribute("value"):T!=null&&(T!==e[c]||w=="progress"&&!T||w=="option"&&T!=E[c])&&Re(e,c,T,E[c],r),c="checked",y!=null&&y!=e[c]&&Re(e,c,y,E[c],r))}return e}function tt(e,t,n){try{if(typeof e=="function"){var o=typeof e.__u=="function";o&&e.__u(),o&&t==null||(e.__u=e(t))}else e.current=t}catch(r){C.__e(r,n)}}function Wt(e,t,n){var o,r;if(C.unmount&&C.unmount(e),(o=e.ref)&&(o.current&&o.current!=e.__e||tt(o,null,t)),(o=e.__c)!=null){if(o.componentWillUnmount)try{o.componentWillUnmount()}catch(i){C.__e(i,t)}o.base=o.__P=o.__n=null}if(o=e.__k)for(r=0;r<o.length;r++)o[r]&&Wt(o[r],t,n||typeof e.type!="function");n||Ze(e.__e),e.__c=e.__=e.__e=void 0}function to(e,t,n){return this.constructor(e,n)}function Kt(e,t,n){var o,r,i,a;t==document&&(t=document.documentElement),C.__&&C.__(e,t),r=(o=typeof n=="function")?null:n&&n.__k||t.__k,i=[],a=[],et(t,e=(!o&&n||t).__k=Xn(te,null,[e]),r||Ie,Ie,t.namespaceURI,!o&&n?[n]:r?null:t.firstChild?Me.call(t.childNodes):null,i,!o&&n?n:r?r.__e:t.firstChild,o,a),Dt(i,e,a),e.props.children=null}Me=qe.slice,C={__e:function(e,t,n,o){for(var r,i,a;t=t.__;)if((r=t.__c)&&!r.__)try{if((i=r.constructor)&&i.getDerivedStateFromError!=null&&(r.setState(i.getDerivedStateFromError(e)),a=r.__d),r.componentDidCatch!=null&&(r.componentDidCatch(e,o||{}),a=r.__d),a)return r.__E=r}catch(l){e=l}throw e}},Mt=0,Vn=function(e){return e!=null&&e.constructor===void 0},Ae.prototype.setState=function(e,t){var n;n=this.__s!=null&&this.__s!=this.state?this.__s:this.__s=ee({},this.state),typeof e=="function"&&(e=e(ee({},n),this.props)),e&&ee(n,e),e!=null&&this.__v&&(t&&this._sb.push(t),It(this))},Ae.prototype.forceUpdate=function(e){this.__v&&(this.__e=!0,e&&this.__h.push(e),It(this))},Ae.prototype.render=te,oe=[],Nt=typeof Promise=="function"?Promise.prototype.then.bind(Promise.resolve()):setTimeout,$t=function(e,t){return e.__v.__b-t.__v.__b},Fe.__r=0,Ge=Math.random().toString(8),Pe="__d"+Ge,xe="__a"+Ge,Ht=/(PointerCapture)$|Capture$/i,Qe=0,Xe=Ft(!1),Je=Ft(!0),Yn=0;var pe,F,nt,Vt,ye=0,tn=[],N=C,Yt=N.__b,Gt=N.__r,Xt=N.diffed,Jt=N.__c,Qt=N.unmount,Zt=N.__;function He(e,t){N.__h&&N.__h(F,e,ye||t),ye=0;var n=F.__H||(F.__H={__:[],__h:[]});return e>=n.__.length&&n.__.push({}),n.__[e]}function $(e){return ye=1,no(on,e)}function no(e,t,n){var o=He(pe++,2);if(o.t=e,!o.__c&&(o.__=[n?n(t):on(void 0,t),function(l){var f=o.__N?o.__N[0]:o.__[0],c=o.t(f,l);f!==c&&(o.__N=[c,o.__[1]],o.__c.setState({}))}],o.__c=F,!F.__f)){var r=function(l,f,c){if(!o.__c.__H)return!0;var h=!1,_=o.__c.props!==l;if(o.__c.__H.__.some(function(m){if(m.__N){h=!0;var T=m.__[0];m.__=m.__N,m.__N=void 0,T!==m.__[0]&&(_=!0)}}),i){var s=i.call(this,l,f,c);return h?s||_:s}return!h||_};F.__f=!0;var i=F.shouldComponentUpdate,a=F.componentWillUpdate;F.componentWillUpdate=function(l,f,c){if(this.__e){var h=i;i=void 0,r(l,f,c),i=h}a&&a.call(this,l,f,c)},F.shouldComponentUpdate=r}return o.__N||o.__}function K(e,t){var n=He(pe++,3);!N.__s&&rt(n.__H,t)&&(n.__=e,n.u=t,F.__H.__h.push(n))}function nn(e,t){var n=He(pe++,4);!N.__s&&rt(n.__H,t)&&(n.__=e,n.u=t,F.__h.push(n))}function V(e){return ye=5,ie(function(){return{current:e}},[])}function ie(e,t){var n=He(pe++,7);return rt(n.__H,t)&&(n.__=e(),n.__H=t,n.__h=e),n.__}function Z(e,t){return ye=8,ie(function(){return e},t)}function oo(){for(var e;e=tn.shift();){var t=e.__H;if(e.__P&&t)try{t.__h.some($e),t.__h.some(ot),t.__h=[]}catch(n){t.__h=[],N.__e(n,e.__v)}}}N.__b=function(e){F=null,Yt&&Yt(e)},N.__=function(e,t){e&&t.__k&&t.__k.__m&&(e.__m=t.__k.__m),Zt&&Zt(e,t)},N.__r=function(e){Gt&&Gt(e),pe=0;var t=(F=e.__c).__H;t&&(nt===F?(t.__h=[],F.__h=[],t.__.some(function(n){n.__N&&(n.__=n.__N),n.u=n.__N=void 0})):(t.__h.some($e),t.__h.some(ot),t.__h=[],pe=0)),nt=F},N.diffed=function(e){Xt&&Xt(e);var t=e.__c;t&&t.__H&&(t.__H.__h.length&&(tn.push(t)!==1&&Vt===N.requestAnimationFrame||((Vt=N.requestAnimationFrame)||ro)(oo)),t.__H.__.some(function(n){n.u&&(n.__H=n.u,n.u=void 0)})),nt=F=null},N.__c=function(e,t){t.some(function(n){try{n.__h.some($e),n.__h=n.__h.filter(function(o){return!o.__||ot(o)})}catch(o){t.some(function(r){r.__h&&(r.__h=[])}),t=[],N.__e(o,n.__v)}}),Jt&&Jt(e,t)},N.unmount=function(e){Qt&&Qt(e);var t,n=e.__c;n&&n.__H&&(n.__H.__.some(function(o){try{$e(o)}catch(r){t=r}}),n.__H=void 0,t&&N.__e(t,n.__v))};var en=typeof requestAnimationFrame=="function";function ro(e){var t,n=function(){clearTimeout(o),en&&cancelAnimationFrame(t),setTimeout(e)},o=setTimeout(n,35);en&&(t=requestAnimationFrame(n))}function $e(e){var t=F,n=e.__c;typeof n=="function"&&(e.__c=void 0,n()),F=t}function ot(e){var t=F;e.__c=e.__(),F=t}function rt(e,t){return!e||e.length!==t.length||t.some(function(n,o){return n!==e[o]})}function on(e,t){return typeof t=="function"?t(e):t}function rn(e,t,n){return n<t?t:Math.min(Math.max(e,t),n)}function it(e,t){let n=Math.min(e.x,t.x),o=Math.min(e.y,t.y);return{x:n,y:o,width:Math.abs(t.x-e.x),height:Math.abs(t.y-e.y)}}function io(e,t){let n=Math.max(0,Math.min(e.x+e.width,t.x+t.width)-Math.max(e.x,t.x)),o=Math.max(0,Math.min(e.y+e.height,t.y+t.height)-Math.max(e.y,t.y));return n*o}function at(e,t){let n=e.width*e.height;return n>0?io(e,t)/n:0}function an(e,t,n,o=12,r=10,i=o){let a=Math.max(o,i),l=n.height-(e.y+e.height)-o,f=e.y-a,c=n.width-(e.x+e.width)-o,h=e.x-o,_;l>=t.height+r?_="below":f>=t.height+r?_="above":c>=t.width+r?_="right":h>=t.width+r?_="left":_=l>=f?"below":"above";let s=_==="right"?e.x+e.width+r:_==="left"?e.x-t.width-r:e.x,m=_==="below"?e.y+e.height+r:_==="above"?e.y-t.height-r:e.y;return{left:rn(s,o,n.width-t.width-o),top:rn(m,a,n.height-t.height-o),placement:_}}function ao(e,t){let n=e.startsWith("#")?e.slice(1):e;if(!n.includes(`${t}=`))return{token:null,remainingHash:e};let o=new URLSearchParams(n),r=o.get(t);o.delete(t);let i=o.toString();return{token:r?.trim()||null,remainingHash:i?`#${i}`:""}}function Be(e){return ao(e,"visual-pair")}function st(e,t){return e.key==="Enter"&&!e.shiftKey&&!e.isComposing&&!t}function P(e,t){let n=e.replace(/\s+/g," ").trim();return n.length<=t?n:`${n.slice(0,Math.max(0,t-1)).trimEnd()}\u2026`}var ct="visual-bridge:pairing-token";var sn="visual-bridge:browser-session",ln="visual-bridge:last-sequence",so="visual-bridge:viewer-last-sequence",co=new Set(["queued","preparing","snapshotting_before","resolving_context","running_agent","snapshotting_after","diffing","waiting_hmr","verifying","review","accepted","reverted","failed","canceled","unsafe"]);function Ue(e){try{return sessionStorage.getItem(e)}catch{return null}}function lt(e,t){try{sessionStorage.setItem(e,t)}catch{}}function lo(e){try{sessionStorage.removeItem(e)}catch{}}function un(e){try{return JSON.parse(e)}catch{return e}}function D(e){return typeof e=="object"&&e!==null?e:null}function dn(){let e=Be(location.hash);if(e.token){Ue(ct)!==e.token&&lo(ln),lt(ct,e.token);let t=`${location.pathname}${location.search}${e.remainingHash}`;return history.replaceState(history.state,"",t),e.token}return Ue(ct)??""}function pn(){let e=Ue(sn);if(e)return e;let t=crypto.randomUUID();return lt(sn,t),t}function uo(e){let t=Ue(e);if(t===null)return null;let n=Number.parseInt(t,10);return Number.isFinite(n)&&n>=0?n:null}function po(){let e=new URL("/_visual/ws",location.href);return e.protocol=location.protocol==="https:"?"wss:":"ws:",e.href}var je=class{browserSessionId;token;mode;getPageState;sequenceStorageKey;onSnapshot;onEvent;onSequenceGap;socket=null;heartbeatTimer;reconnectTimer;reconnectAttempt=0;manuallyClosed=!1;state="connecting";projectId;lastSequence;hasReplaySequence;constructor(t){this.token=t.token,this.browserSessionId=t.browserSessionId,this.mode=t.mode??"control",this.getPageState=t.getPageState??(()=>({})),this.sequenceStorageKey=this.mode==="viewer"?so:ln;let n=uo(this.sequenceStorageKey);this.lastSequence=n??0,this.hasReplaySequence=n!==null||this.mode==="control",this.onSnapshot=t.onSnapshot,this.onEvent=t.onEvent,this.onSequenceGap=t.onSequenceGap??(()=>{})}connect(){this.manuallyClosed=!1,this.openSocket()}close(){this.manuallyClosed=!0,this.clearTimers(),this.socket?.close(),this.socket=null}send(t,n){if(this.socket?.readyState!==WebSocket.OPEN)return!1;let o={id:crypto.randomUUID(),type:t,browserSessionId:this.browserSessionId,payload:n};return this.socket.send(JSON.stringify(o)),!0}emitSnapshot(){this.onSnapshot({state:this.state,...this.projectId?{projectId:this.projectId}:{},lastSequence:this.lastSequence})}openSocket(){this.clearTimers(),this.state=this.reconnectAttempt>0?"reconnecting":"connecting",this.emitSnapshot();let t;try{t=new WebSocket(po())}catch{this.scheduleReconnect();return}this.socket=t,t.addEventListener("open",()=>{this.reconnectAttempt=0,this.send("auth",{token:this.token})}),t.addEventListener("message",n=>{this.handleMessage(String(n.data))}),t.addEventListener("close",n=>{if(this.socket=null,n.code===4001||n.code===4401){this.state="unauthorized",this.emitSnapshot();return}this.manuallyClosed||this.scheduleReconnect()}),t.addEventListener("error",()=>{this.state==="connecting"&&(this.state="offline",this.emitSnapshot())})}handleMessage(t){let n=D(un(t));if(!(!n||typeof n.type!="string")){if(n.type==="auth.ok"){this.projectId=typeof n.projectId=="string"?n.projectId:this.projectId,this.state="connected",this.emitSnapshot(),this.send("browser.hello",{...this.hasReplaySequence?{lastSeq:this.lastSequence}:{},...this.mode==="control"?this.getPageState():{}}),this.mode==="control"&&(this.heartbeatTimer=window.setInterval(()=>{this.send("browser.heartbeat",{lastSeq:this.lastSequence,...this.getPageState()})},15e3));return}if(n.type==="auth.error"||n.type==="error.unauthorized"){this.state="unauthorized",this.emitSnapshot(),this.socket?.close(4401,"Pairing rejected");return}if(typeof n.seq=="number"){if(n.seq<=this.lastSequence&&this.hasReplaySequence)return;this.hasReplaySequence&&n.seq>this.lastSequence+1&&this.onSequenceGap({expectedSequence:this.lastSequence+1,receivedSequence:n.seq}),this.lastSequence=n.seq,this.hasReplaySequence=!0,lt(this.sequenceStorageKey,String(this.lastSequence)),this.emitSnapshot()}typeof n.projectId=="string"&&(this.projectId=n.projectId),this.onEvent(n)}}scheduleReconnect(){if(this.clearTimers(),this.manuallyClosed)return;this.reconnectAttempt+=1,this.state="reconnecting",this.emitSnapshot();let t=Math.min(1e4,500*2**(this.reconnectAttempt-1));this.reconnectTimer=window.setTimeout(()=>this.openSocket(),t)}clearTimers(){this.heartbeatTimer!==void 0&&(clearInterval(this.heartbeatTimer),this.heartbeatTimer=void 0),this.reconnectTimer!==void 0&&(clearTimeout(this.reconnectTimer),this.reconnectTimer=void 0)}};async function ae(e,t,n){let o=new Headers(n?.headers);e&&o.set("Authorization",`Bearer ${e}`),n?.body&&!o.has("Content-Type")&&o.set("Content-Type","application/json");let r=await fetch(t,{...n,headers:o});if(!r.ok){let i=P(await r.text(),180);throw new Error(i||`Bridge request failed (${r.status} ${r.statusText})`)}return r}async function se(e){let t=await e.text();return t?un(t):null}async function fn(e){let t=await se(await ae(e,"/_visual/api/viewer-session")),n=D(t)?.viewerUrl;if(typeof n!="string"||!n.startsWith("/_visual/viewer#visual-view="))throw new Error("Bridge returned an invalid viewer session URL");return n}async function mn(e){let t=await se(await ae(e,"/_visual/api/project")),n=D(t),o=D(n?.project);return typeof n?.id=="string"?n.id:typeof n?.projectId=="string"?n.projectId:typeof o?.id=="string"?o.id:void 0}async function fo(e,t={}){let n=new URLSearchParams;t.limit!==void 0&&n.set("limit",String(t.limit)),t.cursor!==void 0&&(n.set("before",t.cursor.createdAt),n.set("beforeId",t.cursor.id));let o=n.toString(),r=o?`?${o}`:"",i=await se(await ae(e,`/_visual/api/tasks${r}`)),a=D(i);return(Array.isArray(i)?i:Array.isArray(a?.tasks)?a.tasks:[]).filter(f=>{let c=D(f);return typeof c?.id=="string"&&typeof c.projectId=="string"&&typeof c.status=="string"&&co.has(c.status)&&typeof c.requestText=="string"&&(c.scope==="instance"||c.scope==="component"||c.scope==="page"||c.scope==="project")&&typeof c.originBrowserSessionId=="string"&&Array.isArray(c.changedFiles)&&c.changedFiles.every(h=>typeof h=="string")&&typeof c.createdAt=="string"})}async function gn(e,t){let n=await fo(e);for(let o of n)if(o.originBrowserSessionId===t)return o}function cn(e){return Array.isArray(e)?e.filter(t=>typeof t=="string"):[]}function hn(e){let t=cn(e);if(t.length>0||Array.isArray(e))return t;let n=D(e);return cn(n?.files??n?.changedFiles??n?.data)}function mo(e){if(typeof e=="string")return e;let t=D(e),n=t?.diff??t?.content??t?.data;return typeof n=="string"?n:""}function go(e){let t=/^(?:\/usr)?\/bin\/(?:bash|sh|zsh)\s+-lc\s+([\s\S]+)$/u.exec(e.trim());if(!t?.[1])return e;let n=t[1].trim();return n.length>=2&&(n.startsWith("'")&&n.endsWith("'")||n.startsWith('"')&&n.endsWith('"'))?n.slice(1,-1):n}function ho(e){if(typeof e.command!="string")return null;let t=go(e.command),n=e.usedRtk===!0||/^rtk(?:\s|$)/u.test(t)?"RTK":"\uBA85\uB839",r=[typeof e.cwd=="string"?e.cwd.split(/[\\/]/u).filter(Boolean).at(-1):void 0,typeof e.durationMs=="number"?`${e.durationMs}ms`:void 0,e.timedOut===!0?"\uC2DC\uAC04 \uCD08\uACFC":void 0,e.truncated===!0?"\uCD9C\uB825 \uCD95\uC57D":void 0].filter(i=>!!i);return P(`${n} \xB7 ${t}${r.length>0?` \xB7 ${r.join(" \xB7 ")}`:""}`,500)}function _n(e){if(typeof e=="string")return P(e,500);let t=D(e);if(!t)return null;let n=D(t.event)??t,o=typeof n.type=="string"?n.type:void 0;if(o==="command")return ho(n);if(o==="tool_start"&&typeof n.name=="string")return n.name==="command_execution"||n.name==="direct_exec"?null:P(`\uB3C4\uAD6C \uC2DC\uC791 \xB7 ${n.name}${typeof n.summary=="string"?` \xB7 ${n.summary}`:""}`,500);if(o==="tool_end"&&typeof n.name=="string")return n.name==="command_execution"||n.name==="direct_exec"?null:P(`\uB3C4\uAD6C ${n.ok===!1?"\uC2E4\uD328":"\uC644\uB8CC"} \xB7 ${n.name}`,500);if(o==="phase"&&typeof n.name=="string")return P(`\uB2E8\uACC4 \xB7 ${n.name}`,500);if(o==="file_hint"&&typeof n.path=="string")return P(`\uD30C\uC77C \xB7 ${n.path}`,500);if(o==="usage"&&typeof n.inputTokens=="number"&&typeof n.outputTokens=="number")return P(`\uD1A0\uD070 \xB7 \uC785\uB825 ${n.inputTokens.toLocaleString("en-US")}${typeof n.cachedInputTokens=="number"?` \xB7 \uCE90\uC2DC ${n.cachedInputTokens.toLocaleString("en-US")}`:""} \xB7 \uCD9C\uB825 ${n.outputTokens.toLocaleString("en-US")}`,500);let r=n.message??n.text??n.summary??n.command??n.error??t.message;return typeof r=="string"?P(r,500):null}async function bn(e,t,n){let o=`/_visual/api/tasks/${encodeURIComponent(t)}`,r=n===void 0?void 0:{signal:n},[i,a,l]=await Promise.allSettled([ae(e,`${o}/files`,r).then(se),ae(e,`${o}/diff`,r).then(se),ae(e,`${o}/logs`,r).then(se)]),f=[i,a,l].find(E=>E.status==="rejected"&&E.reason instanceof DOMException&&E.reason.name==="AbortError");if(f!==void 0)throw f.reason;let c=i.status==="fulfilled"?hn(i.value):[],h=a.status==="fulfilled"?mo(a.value):"",_=l.status==="fulfilled"?l.value:[],s=D(_),m=Array.isArray(_)?_:Array.isArray(s?.logs)?s.logs:[],T=Array.isArray(m)?m.map(_n).filter(E=>!!E).slice(-40):[],y=[];return i.status==="rejected"&&y.push("files"),a.status==="rejected"&&y.push("diff"),l.status==="rejected"&&y.push("logs"),{changedFiles:c,diff:h,logs:T,unavailable:y}}async function vn(e,t,n){return se(await ae(e,`/_visual/api/tasks/${encodeURIComponent(t)}/${n}`,{method:"POST"}))}function Oe(e){let t=D(e.payload),o=D(t?.task)??t;return o&&typeof o.id=="string"?o:void 0}function xn(e,t,n){let o=Oe(e),r=e.taskId??o?.id;return r?e.type==="task.queued"?o?.originBrowserSessionId===t?{accept:!0,bind:!0,taskId:r}:{accept:!1,bind:!1,taskId:r}:{accept:n===r,bind:!1,taskId:r}:{accept:!1,bind:!1}}function yn(e){let t=Oe(e);if(t?.status)return t.status;let n=D(e.payload),o=n?.phase??n?.status;return typeof o=="string"?o:void 0}function wn(e){let t=D(e.payload);return _n(t?.event??t)}function kn(e){let t=D(e.payload);return hn(t?.changedFiles??t?.files??[])}var ce="__visual_bridge_root",_o=new Set(["SCRIPT","STYLE","META","LINK","NOSCRIPT","TEMPLATE"]),bo=new Set(["alt","aria-label","aria-labelledby","aria-describedby","role","title","type","placeholder","data-testid","data-test-id","data-component","data-component-name","data-source","data-source-file","data-source-line","data-source-column","data-react-source"]),Sn=/(?:auth|cookie|credential|csrf|jwt|key|password|secret|session|token|value)/i,Rn=[["display","display"],["position","position"],["width","width"],["height","height"],["margin","margin"],["padding","padding"],["gap","gap"],["borderRadius","border-radius"],["fontSize","font-size"],["fontWeight","font-weight"],["lineHeight","line-height"],["color","color"],["backgroundColor","background-color"],["flexDirection","flex-direction"],["alignItems","align-items"],["justifyContent","justify-content"],["gridTemplateColumns","grid-template-columns"],["zIndex","z-index"]],vo={a:"link",button:"button",footer:"contentinfo",form:"form",header:"banner",img:"img",main:"main",nav:"navigation",select:"combobox",textarea:"textbox"};function we(e){return typeof e=="object"&&e!==null?e:null}function H(e){let t=e?.trim();return t||void 0}function fe(e){let t=typeof e=="number"?e:Number.parseInt(String(e),10);return Number.isInteger(t)&&t>0?t:void 0}function Pn(e,t){let n=H(typeof e.fileName=="string"?e.fileName:typeof e.filePath=="string"?e.filePath:typeof e.file=="string"?e.file:void 0);if(!n)return;let o=fe(e.lineNumber??e.line),r=fe(e.columnNumber??e.column),i=H(typeof e.componentName=="string"?e.componentName:t);return{filePath:n,...o?{lineNumber:o}:{},...r?{columnNumber:r}:{},...i?{componentName:i}:{}}}function xo(e,t){let n=e.trim();if(!n)return;if(n.startsWith("{"))try{let l=we(JSON.parse(n));return l?Pn(l,t):void 0}catch{return}let o=/^(.*):(\d+)(?::(\d+))?$/.exec(n),r=H(o?.[1]??n);if(!r)return;let i=fe(o?.[2]),a=fe(o?.[3]);return{filePath:r,...i?{lineNumber:i}:{},...a?{columnNumber:a}:{},...t?{componentName:t}:{}}}function yo(e){let t=H(e.getAttribute("data-component-name"))??H(e.getAttribute("data-component")),n=e.getAttribute("data-react-source")??e.getAttribute("data-source");if(n){let a=xo(n,t);if(a)return a}let o=H(e.getAttribute("data-source-file")??e.getAttribute("data-file")??void 0);if(!o)return;let r=fe(e.getAttribute("data-source-line")),i=fe(e.getAttribute("data-source-column"));return{filePath:o,...r?{lineNumber:r}:{},...i?{columnNumber:i}:{},...t?{componentName:t}:{}}}function wo(e){let t=e.type;if(typeof t=="function"){let o=t;return H(typeof o.displayName=="string"?o.displayName:typeof o.name=="string"?o.name:void 0)}let n=we(t);return H(typeof n?.displayName=="string"?n.displayName:typeof n?.name=="string"?n.name:void 0)}function ko(e,t){let n=typeof e=="string"?e:e instanceof Error?e.stack:void 0;if(!n)return[];let o=[];for(let r of n.split(`
|
|
2
|
-
`)){let i=/(?:\(|\s)([^()\s]+):(\d+):(\d+)\)?$/.exec(r.trim());if(!(!i?.[1]||i[1].includes("node_modules"))&&(o.push({filePath:i[1],lineNumber:Number(i[2]),columnNumber:Number(i[3]),...t?{componentName:t}:{}}),o.length===8))break}return o}function
|
|
1
|
+
var He,I,Ht,Xn,oe,Ft,Bt,Ut,Qe,Le,ye,Ot,tt,Ze,et,Jn,Me={},Ne=[],Qn=/acit|ex(?:s|g|n|p|$)|rph|grid|ows|mnc|ntw|ine[ch]|zoo|^ord|itera/i,Be=Array.isArray;function Z(e,t){for(var n in t)e[n]=t[n];return e}function nt(e){e&&e.parentNode&&e.parentNode.removeChild(e)}function Zn(e,t,n){var o,r,i,a={};for(i in t)i=="key"?o=t[i]:i=="ref"?r=t[i]:a[i]=t[i];if(arguments.length>2&&(a.children=arguments.length>3?He.call(arguments,2):n),typeof e=="function"&&e.defaultProps!=null)for(i in e.defaultProps)a[i]===void 0&&(a[i]=e.defaultProps[i]);return qe(e,a,o,r,null)}function qe(e,t,n,o,r){var i={type:e,props:t,key:n,ref:o,__k:null,__:null,__b:0,__e:null,__c:null,constructor:void 0,__v:r??++Ht,__i:-1,__u:0};return r==null&&I.vnode!=null&&I.vnode(i),i}function ee(e){return e.children}function Fe(e,t){this.props=e,this.context=t}function pe(e,t){if(t==null)return e.__?pe(e.__,e.__i+1):null;for(var n;t<e.__k.length;t++)if((n=e.__k[t])!=null&&n.__e!=null)return n.__e;return typeof e.type=="function"?pe(e):null}function eo(e){if(e.__P&&e.__d){var t=e.__v,n=t.__e,o=[],r=[],i=Z({},t);i.__v=t.__v+1,I.vnode&&I.vnode(i),ot(e.__P,i,t,e.__n,e.__P.namespaceURI,32&t.__u?[n]:null,o,n??pe(t),!!(32&t.__u),r),i.__v=t.__v,i.__.__k[i.__i]=i,Kt(o,i,r),t.__e=t.__=null,i.__e!=n&&jt(i)}}function jt(e){if((e=e.__)!=null&&e.__c!=null)return e.__e=e.__c.base=null,e.__k.some(function(t){if(t!=null&&t.__e!=null)return e.__e=e.__c.base=t.__e}),jt(e)}function Mt(e){(!e.__d&&(e.__d=!0)&&oe.push(e)&&!$e.__r++||Ft!=I.debounceRendering)&&((Ft=I.debounceRendering)||Bt)($e)}function $e(){try{for(var e,t=1;oe.length;)oe.length>t&&oe.sort(Ut),e=oe.shift(),t=oe.length,eo(e)}finally{oe.length=$e.__r=0}}function Dt(e,t,n,o,r,i,a,l,f,c,h){var _,s,g,E,w,R,C,S=o&&o.__k||Ne,y=t.length;for(f=to(n,t,S,f,y),_=0;_<y;_++)(g=n.__k[_])!=null&&(s=g.__i!=-1&&S[g.__i]||Me,g.__i=_,R=ot(e,g,s,r,i,a,l,f,c,h),E=g.__e,g.ref&&s.ref!=g.ref&&(s.ref&&rt(s.ref,null,g),h.push(g.ref,g.__c||E,g)),w==null&&E!=null&&(w=E),(C=!!(4&g.__u))||s.__k===g.__k?(f=zt(g,f,e,C),C&&s.__e&&(s.__e=null)):typeof g.type=="function"&&R!==void 0?f=R:E&&(f=E.nextSibling),g.__u&=-7);return n.__e=w,f}function to(e,t,n,o,r){var i,a,l,f,c,h=n.length,_=h,s=0;for(e.__k=new Array(r),i=0;i<r;i++)(a=t[i])!=null&&typeof a!="boolean"&&typeof a!="function"?(typeof a=="string"||typeof a=="number"||typeof a=="bigint"||a.constructor==String?a=e.__k[i]=qe(null,a,null,null,null):Be(a)?a=e.__k[i]=qe(ee,{children:a},null,null,null):a.constructor===void 0&&a.__b>0?a=e.__k[i]=qe(a.type,a.props,a.key,a.ref?a.ref:null,a.__v):e.__k[i]=a,f=i+s,a.__=e,a.__b=e.__b+1,l=null,(c=a.__i=no(a,n,f,_))!=-1&&(_--,(l=n[c])&&(l.__u|=2)),l==null||l.__v==null?(c==-1&&(r>h?s--:r<h&&s++),typeof a.type!="function"&&(a.__u|=4)):c!=f&&(c==f-1?s--:c==f+1?s++:(c>f?s--:s++,a.__u|=4))):e.__k[i]=null;if(_)for(i=0;i<h;i++)(l=n[i])!=null&&(2&l.__u)==0&&(l.__e==o&&(o=pe(l)),Yt(l,l));return o}function zt(e,t,n,o){var r,i;if(typeof e.type=="function"){for(r=e.__k,i=0;r&&i<r.length;i++)r[i]&&(r[i].__=e,t=zt(r[i],t,n,o));return t}e.__e!=t&&(o&&(t&&e.type&&!t.parentNode&&(t=pe(e)),n.insertBefore(e.__e,t||null)),t=e.__e);do t=t&&t.nextSibling;while(t!=null&&t.nodeType==8);return t}function no(e,t,n,o){var r,i,a,l=e.key,f=e.type,c=t[n],h=c!=null&&(2&c.__u)==0;if(c===null&&l==null||h&&l==c.key&&f==c.type)return n;if(o>(h?1:0)){for(r=n-1,i=n+1;r>=0||i<t.length;)if((c=t[a=r>=0?r--:i++])!=null&&(2&c.__u)==0&&l==c.key&&f==c.type)return a}return-1}function Nt(e,t,n){t[0]=="-"?e.setProperty(t,n??""):e[t]=n==null?"":typeof n!="number"||Qn.test(t)?n:n+"px"}function Ae(e,t,n,o,r){var i,a;e:if(t=="style")if(typeof n=="string")e.style.cssText=n;else{if(typeof o=="string"&&(e.style.cssText=o=""),o)for(t in o)n&&t in n||Nt(e.style,t,"");if(n)for(t in n)o&&n[t]==o[t]||Nt(e.style,t,n[t])}else if(t[0]=="o"&&t[1]=="n")i=t!=(t=t.replace(Ot,"$1")),a=t.toLowerCase(),t=a in e||t=="onFocusOut"||t=="onFocusIn"?a.slice(2):t.slice(2),e.l||(e.l={}),e.l[t+i]=n,n?o?n[ye]=o[ye]:(n[ye]=tt,e.addEventListener(t,i?et:Ze,i)):e.removeEventListener(t,i?et:Ze,i);else{if(r=="http://www.w3.org/2000/svg")t=t.replace(/xlink(H|:h)/,"h").replace(/sName$/,"s");else if(t!="width"&&t!="height"&&t!="href"&&t!="list"&&t!="form"&&t!="tabIndex"&&t!="download"&&t!="rowSpan"&&t!="colSpan"&&t!="role"&&t!="popover"&&t in e)try{e[t]=n??"";break e}catch{}typeof n=="function"||(n==null||n===!1&&t[4]!="-"?e.removeAttribute(t):e.setAttribute(t,t=="popover"&&n==1?"":n))}}function $t(e){return function(t){if(this.l){var n=this.l[t.type+e];if(t[Le]==null)t[Le]=tt++;else if(t[Le]<n[ye])return;return n(I.event?I.event(t):t)}}}function ot(e,t,n,o,r,i,a,l,f,c){var h,_,s,g,E,w,R,C,S,y,X,B,j,te,M,U,D=t.type;if(t.constructor!==void 0)return null;128&n.__u&&(f=!!(32&n.__u),i=[l=t.__e=n.__e]),(h=I.__b)&&h(t);e:if(typeof D=="function"){_=a.length;try{if(S=t.props,y=D.prototype&&D.prototype.render,X=(h=D.contextType)&&o[h.__c],B=h?X?X.props.value:h.__:o,n.__c?C=(s=t.__c=n.__c).__=s.__E:(y?t.__c=s=new D(S,B):(t.__c=s=new Fe(S,B),s.constructor=D,s.render=ro),X&&X.sub(s),s.state||(s.state={}),s.__n=o,g=s.__d=!0,s.__h=[],s._sb=[]),y&&s.__s==null&&(s.__s=s.state),y&&D.getDerivedStateFromProps!=null&&(s.__s==s.state&&(s.__s=Z({},s.__s)),Z(s.__s,D.getDerivedStateFromProps(S,s.__s))),E=s.props,w=s.state,s.__v=t,g)y&&D.getDerivedStateFromProps==null&&s.componentWillMount!=null&&s.componentWillMount(),y&&s.componentDidMount!=null&&s.__h.push(s.componentDidMount);else{if(y&&D.getDerivedStateFromProps==null&&S!==E&&s.componentWillReceiveProps!=null&&s.componentWillReceiveProps(S,B),t.__v==n.__v||!s.__e&&s.shouldComponentUpdate!=null&&s.shouldComponentUpdate(S,s.__s,B)===!1){t.__v!=n.__v&&(s.props=S,s.state=s.__s,s.__d=!1),t.__e=n.__e,t.__k=n.__k,t.__k.some(function(q){q&&(q.__=t)}),Ne.push.apply(s.__h,s._sb),s._sb=[],s.__h.length&&a.push(s);break e}s.componentWillUpdate!=null&&s.componentWillUpdate(S,s.__s,B),y&&s.componentDidUpdate!=null&&s.__h.push(function(){s.componentDidUpdate(E,w,R)})}if(s.context=B,s.props=S,s.__P=e,s.__e=!1,j=I.__r,te=0,y)s.state=s.__s,s.__d=!1,j&&j(t),h=s.render(s.props,s.state,s.context),Ne.push.apply(s.__h,s._sb),s._sb=[];else do s.__d=!1,j&&j(t),h=s.render(s.props,s.state,s.context),s.state=s.__s;while(s.__d&&++te<25);s.state=s.__s,s.getChildContext!=null&&(o=Z(Z({},o),s.getChildContext())),y&&!g&&s.getSnapshotBeforeUpdate!=null&&(R=s.getSnapshotBeforeUpdate(E,w)),M=h!=null&&h.type===ee&&h.key==null?Vt(h.props.children):h,l=Dt(e,Be(M)?M:[M],t,n,o,r,i,a,l,f,c),s.base=t.__e,t.__u&=-161,s.__h.length&&a.push(s),C&&(s.__E=s.__=null)}catch(q){if(a.length=_,t.__v=null,f||i!=null){if(q.then){for(t.__u|=f?160:128;l&&l.nodeType==8&&l.nextSibling;)l=l.nextSibling;i!=null&&(i[i.indexOf(l)]=null),t.__e=l}else if(i!=null)for(U=i.length;U--;)nt(i[U])}else t.__e=n.__e;t.__k==null&&(t.__k=n.__k||[]),q.then||Wt(t),I.__e(q,t,n)}}else i==null&&t.__v==n.__v?(t.__k=n.__k,t.__e=n.__e):l=t.__e=oo(n.__e,t,n,o,r,i,a,f,c);return(h=I.diffed)&&h(t),128&t.__u?void 0:l}function Wt(e){e&&(e.__c&&(e.__c.__e=!0),e.__k&&e.__k.some(Wt))}function Kt(e,t,n){for(var o=0;o<n.length;o++)rt(n[o],n[++o],n[++o]);I.__c&&I.__c(t,e),e.some(function(r){try{e=r.__h,r.__h=[],e.some(function(i){i.call(r)})}catch(i){I.__e(i,r.__v)}})}function Vt(e){return typeof e!="object"||e==null||e.__b>0?e:Be(e)?e.map(Vt):e.constructor!==void 0?null:Z({},e)}function oo(e,t,n,o,r,i,a,l,f){var c,h,_,s,g,E,w,R=n.props||Me,C=t.props,S=t.type;if(S=="svg"?r="http://www.w3.org/2000/svg":S=="math"?r="http://www.w3.org/1998/Math/MathML":r||(r="http://www.w3.org/1999/xhtml"),i!=null){for(c=0;c<i.length;c++)if((g=i[c])&&"setAttribute"in g==!!S&&(S?g.localName==S:g.nodeType==3)){e=g,i[c]=null;break}}if(e==null){if(S==null)return document.createTextNode(C);e=document.createElementNS(r,S,C.is&&C),l&&(I.__m&&I.__m(t,i),l=!1),i=null}if(S==null)R===C||l&&e.data==C||(e.data=C);else{if(i=S=="textarea"&&C.defaultValue!=null?null:i&&He.call(e.childNodes),!l&&i!=null)for(R={},c=0;c<e.attributes.length;c++)R[(g=e.attributes[c]).name]=g.value;for(c in R)g=R[c],c=="dangerouslySetInnerHTML"?_=g:c=="children"||c in C||c=="value"&&"defaultValue"in C||c=="checked"&&"defaultChecked"in C||Ae(e,c,null,g,r);for(c in C)g=C[c],c=="children"?s=g:c=="dangerouslySetInnerHTML"?h=g:c=="value"?E=g:c=="checked"?w=g:l&&typeof g!="function"||R[c]===g||Ae(e,c,g,R[c],r);if(h)l||_&&(h.__html==_.__html||h.__html==e.innerHTML)||(e.innerHTML=h.__html),t.__k=[];else if(_&&(e.innerHTML=""),Dt(t.type=="template"?e.content:e,Be(s)?s:[s],t,n,o,S=="foreignObject"?"http://www.w3.org/1999/xhtml":r,i,a,i?i[0]:n.__k&&pe(n,0),l,f),i!=null)for(c=i.length;c--;)nt(i[c]);l&&S!="textarea"||(c="value",S=="progress"&&E==null?e.removeAttribute("value"):E!=null&&(E!==e[c]||S=="progress"&&!E||S=="option"&&E!=R[c])&&Ae(e,c,E,R[c],r),c="checked",w!=null&&w!=e[c]&&Ae(e,c,w,R[c],r))}return e}function rt(e,t,n){try{if(typeof e=="function"){var o=typeof e.__u=="function";o&&e.__u(),o&&t==null||(e.__u=e(t))}else e.current=t}catch(r){I.__e(r,n)}}function Yt(e,t,n){var o,r;if(I.unmount&&I.unmount(e),(o=e.ref)&&(o.current&&o.current!=e.__e||rt(o,null,t)),(o=e.__c)!=null){if(o.componentWillUnmount)try{o.componentWillUnmount()}catch(i){I.__e(i,t)}o.base=o.__P=o.__n=null}if(o=e.__k)for(r=0;r<o.length;r++)o[r]&&Yt(o[r],t,n||typeof e.type!="function");n||nt(e.__e),e.__c=e.__=e.__e=void 0}function ro(e,t,n){return this.constructor(e,n)}function Gt(e,t,n){var o,r,i,a;t==document&&(t=document.documentElement),I.__&&I.__(e,t),r=(o=typeof n=="function")?null:n&&n.__k||t.__k,i=[],a=[],ot(t,e=(!o&&n||t).__k=Zn(ee,null,[e]),r||Me,Me,t.namespaceURI,!o&&n?[n]:r?null:t.firstChild?He.call(t.childNodes):null,i,!o&&n?n:r?r.__e:t.firstChild,o,a),Kt(i,e,a),e.props.children=null}He=Ne.slice,I={__e:function(e,t,n,o){for(var r,i,a;t=t.__;)if((r=t.__c)&&!r.__)try{if((i=r.constructor)&&i.getDerivedStateFromError!=null&&(r.setState(i.getDerivedStateFromError(e)),a=r.__d),r.componentDidCatch!=null&&(r.componentDidCatch(e,o||{}),a=r.__d),a)return r.__E=r}catch(l){e=l}throw e}},Ht=0,Xn=function(e){return e!=null&&e.constructor===void 0},Fe.prototype.setState=function(e,t){var n;n=this.__s!=null&&this.__s!=this.state?this.__s:this.__s=Z({},this.state),typeof e=="function"&&(e=e(Z({},n),this.props)),e&&Z(n,e),e!=null&&this.__v&&(t&&this._sb.push(t),Mt(this))},Fe.prototype.forceUpdate=function(e){this.__v&&(this.__e=!0,e&&this.__h.push(e),Mt(this))},Fe.prototype.render=ee,oe=[],Bt=typeof Promise=="function"?Promise.prototype.then.bind(Promise.resolve()):setTimeout,Ut=function(e,t){return e.__v.__b-t.__v.__b},$e.__r=0,Qe=Math.random().toString(8),Le="__d"+Qe,ye="__a"+Qe,Ot=/(PointerCapture)$|Capture$/i,tt=0,Ze=$t(!1),et=$t(!0),Jn=0;var fe,F,it,Xt,we=0,rn=[],N=I,Jt=N.__b,Qt=N.__r,Zt=N.diffed,en=N.__c,tn=N.unmount,nn=N.__;function Oe(e,t){N.__h&&N.__h(F,e,we||t),we=0;var n=F.__H||(F.__H={__:[],__h:[]});return e>=n.__.length&&n.__.push({}),n.__[e]}function $(e){return we=1,io(sn,e)}function io(e,t,n){var o=Oe(fe++,2);if(o.t=e,!o.__c&&(o.__=[n?n(t):sn(void 0,t),function(l){var f=o.__N?o.__N[0]:o.__[0],c=o.t(f,l);f!==c&&(o.__N=[c,o.__[1]],o.__c.setState({}))}],o.__c=F,!F.__f)){var r=function(l,f,c){if(!o.__c.__H)return!0;var h=!1,_=o.__c.props!==l;if(o.__c.__H.__.some(function(g){if(g.__N){h=!0;var E=g.__[0];g.__=g.__N,g.__N=void 0,E!==g.__[0]&&(_=!0)}}),i){var s=i.call(this,l,f,c);return h?s||_:s}return!h||_};F.__f=!0;var i=F.shouldComponentUpdate,a=F.componentWillUpdate;F.componentWillUpdate=function(l,f,c){if(this.__e){var h=i;i=void 0,r(l,f,c),i=h}a&&a.call(this,l,f,c)},F.shouldComponentUpdate=r}return o.__N||o.__}function V(e,t){var n=Oe(fe++,3);!N.__s&&st(n.__H,t)&&(n.__=e,n.u=t,F.__H.__h.push(n))}function an(e,t){var n=Oe(fe++,4);!N.__s&&st(n.__H,t)&&(n.__=e,n.u=t,F.__h.push(n))}function W(e){return we=5,ae(function(){return{current:e}},[])}function ae(e,t){var n=Oe(fe++,7);return st(n.__H,t)&&(n.__=e(),n.__H=t,n.__h=e),n.__}function Q(e,t){return we=8,ae(function(){return e},t)}function ao(){for(var e;e=rn.shift();){var t=e.__H;if(e.__P&&t)try{t.__h.some(Ue),t.__h.some(at),t.__h=[]}catch(n){t.__h=[],N.__e(n,e.__v)}}}N.__b=function(e){F=null,Jt&&Jt(e)},N.__=function(e,t){e&&t.__k&&t.__k.__m&&(e.__m=t.__k.__m),nn&&nn(e,t)},N.__r=function(e){Qt&&Qt(e),fe=0;var t=(F=e.__c).__H;t&&(it===F?(t.__h=[],F.__h=[],t.__.some(function(n){n.__N&&(n.__=n.__N),n.u=n.__N=void 0})):(t.__h.some(Ue),t.__h.some(at),t.__h=[],fe=0)),it=F},N.diffed=function(e){Zt&&Zt(e);var t=e.__c;t&&t.__H&&(t.__H.__h.length&&(rn.push(t)!==1&&Xt===N.requestAnimationFrame||((Xt=N.requestAnimationFrame)||so)(ao)),t.__H.__.some(function(n){n.u&&(n.__H=n.u,n.u=void 0)})),it=F=null},N.__c=function(e,t){t.some(function(n){try{n.__h.some(Ue),n.__h=n.__h.filter(function(o){return!o.__||at(o)})}catch(o){t.some(function(r){r.__h&&(r.__h=[])}),t=[],N.__e(o,n.__v)}}),en&&en(e,t)},N.unmount=function(e){tn&&tn(e);var t,n=e.__c;n&&n.__H&&(n.__H.__.some(function(o){try{Ue(o)}catch(r){t=r}}),n.__H=void 0,t&&N.__e(t,n.__v))};var on=typeof requestAnimationFrame=="function";function so(e){var t,n=function(){clearTimeout(o),on&&cancelAnimationFrame(t),setTimeout(e)},o=setTimeout(n,35);on&&(t=requestAnimationFrame(n))}function Ue(e){var t=F,n=e.__c;typeof n=="function"&&(e.__c=void 0,n()),F=t}function at(e){var t=F;e.__c=e.__(),F=t}function st(e,t){return!e||e.length!==t.length||t.some(function(n,o){return n!==e[o]})}function sn(e,t){return typeof t=="function"?t(e):t}function cn(e,t,n){return n<t?t:Math.min(Math.max(e,t),n)}function ct(e,t){let n=Math.min(e.x,t.x),o=Math.min(e.y,t.y);return{x:n,y:o,width:Math.abs(t.x-e.x),height:Math.abs(t.y-e.y)}}function co(e,t){let n=Math.max(0,Math.min(e.x+e.width,t.x+t.width)-Math.max(e.x,t.x)),o=Math.max(0,Math.min(e.y+e.height,t.y+t.height)-Math.max(e.y,t.y));return n*o}function lt(e,t){let n=e.width*e.height;return n>0?co(e,t)/n:0}function ln(e,t,n,o=12,r=10,i=o){let a=Math.max(o,i),l=n.height-(e.y+e.height)-o,f=e.y-a,c=n.width-(e.x+e.width)-o,h=e.x-o,_;l>=t.height+r?_="below":f>=t.height+r?_="above":c>=t.width+r?_="right":h>=t.width+r?_="left":_=l>=f?"below":"above";let s=_==="right"?e.x+e.width+r:_==="left"?e.x-t.width-r:e.x,g=_==="below"?e.y+e.height+r:_==="above"?e.y-t.height-r:e.y;return{left:cn(s,o,n.width-t.width-o),top:cn(g,a,n.height-t.height-o),placement:_}}function lo(e,t){let n=e.startsWith("#")?e.slice(1):e;if(!n.includes(`${t}=`))return{token:null,remainingHash:e};let o=new URLSearchParams(n),r=o.get(t);o.delete(t);let i=o.toString();return{token:r?.trim()||null,remainingHash:i?`#${i}`:""}}function je(e){return lo(e,"visual-pair")}function ut(e,t){return e.key==="Enter"&&!e.shiftKey&&!e.isComposing&&!t}function L(e,t){let n=e.replace(/\s+/g," ").trim();return n.length<=t?n:`${n.slice(0,Math.max(0,t-1)).trimEnd()}\u2026`}var dt="visual-bridge:pairing-token";var un="visual-bridge:browser-session",pn="visual-bridge:last-sequence",uo="visual-bridge:viewer-last-sequence",po=new Set(["queued","preparing","snapshotting_before","resolving_context","running_agent","snapshotting_after","diffing","waiting_hmr","verifying","review","accepted","reverted","failed","canceled","unsafe"]);function De(e){try{return sessionStorage.getItem(e)}catch{return null}}function pt(e,t){try{sessionStorage.setItem(e,t)}catch{}}function fo(e){try{sessionStorage.removeItem(e)}catch{}}function fn(e){try{return JSON.parse(e)}catch{return e}}function z(e){return typeof e=="object"&&e!==null?e:null}function gn(){let e=je(location.hash);if(e.token){De(dt)!==e.token&&fo(pn),pt(dt,e.token);let t=`${location.pathname}${location.search}${e.remainingHash}`;return history.replaceState(history.state,"",t),e.token}return De(dt)??""}function mn(){let e=De(un);if(e)return e;let t=crypto.randomUUID();return pt(un,t),t}function go(e){let t=De(e);if(t===null)return null;let n=Number.parseInt(t,10);return Number.isFinite(n)&&n>=0?n:null}function mo(){let e=new URL("/_visual/ws",location.href);return e.protocol=location.protocol==="https:"?"wss:":"ws:",e.href}var ze=class{browserSessionId;token;mode;getPageState;sequenceStorageKey;onSnapshot;onEvent;onSequenceGap;socket=null;heartbeatTimer;reconnectTimer;reconnectAttempt=0;manuallyClosed=!1;state="connecting";projectId;lastSequence;hasReplaySequence;constructor(t){this.token=t.token,this.browserSessionId=t.browserSessionId,this.mode=t.mode??"control",this.getPageState=t.getPageState??(()=>({})),this.sequenceStorageKey=this.mode==="viewer"?uo:pn;let n=go(this.sequenceStorageKey);this.lastSequence=n??0,this.hasReplaySequence=n!==null||this.mode==="control",this.onSnapshot=t.onSnapshot,this.onEvent=t.onEvent,this.onSequenceGap=t.onSequenceGap??(()=>{})}connect(){this.manuallyClosed=!1,this.openSocket()}close(){this.manuallyClosed=!0,this.clearTimers(),this.socket?.close(),this.socket=null}send(t,n){if(this.socket?.readyState!==WebSocket.OPEN)return!1;let o={id:crypto.randomUUID(),type:t,browserSessionId:this.browserSessionId,payload:n};return this.socket.send(JSON.stringify(o)),!0}emitSnapshot(){this.onSnapshot({state:this.state,...this.projectId?{projectId:this.projectId}:{},lastSequence:this.lastSequence})}openSocket(){this.clearTimers(),this.state=this.reconnectAttempt>0?"reconnecting":"connecting",this.emitSnapshot();let t;try{t=new WebSocket(mo())}catch{this.scheduleReconnect();return}this.socket=t,t.addEventListener("open",()=>{this.reconnectAttempt=0,this.send("auth",{token:this.token})}),t.addEventListener("message",n=>{this.handleMessage(String(n.data))}),t.addEventListener("close",n=>{if(this.socket=null,n.code===4001||n.code===4401){this.state="unauthorized",this.emitSnapshot();return}this.manuallyClosed||this.scheduleReconnect()}),t.addEventListener("error",()=>{this.state==="connecting"&&(this.state="offline",this.emitSnapshot())})}handleMessage(t){let n=z(fn(t));if(!(!n||typeof n.type!="string")){if(n.type==="auth.ok"){this.projectId=typeof n.projectId=="string"?n.projectId:this.projectId,this.state="connected",this.emitSnapshot(),this.send("browser.hello",{...this.hasReplaySequence?{lastSeq:this.lastSequence}:{},...this.mode==="control"?this.getPageState():{}}),this.mode==="control"&&(this.heartbeatTimer=window.setInterval(()=>{this.send("browser.heartbeat",{lastSeq:this.lastSequence,...this.getPageState()})},15e3));return}if(n.type==="auth.error"||n.type==="error.unauthorized"){this.state="unauthorized",this.emitSnapshot(),this.socket?.close(4401,"Pairing rejected");return}if(typeof n.seq=="number"){if(n.seq<=this.lastSequence&&this.hasReplaySequence)return;this.hasReplaySequence&&n.seq>this.lastSequence+1&&this.onSequenceGap({expectedSequence:this.lastSequence+1,receivedSequence:n.seq}),this.lastSequence=n.seq,this.hasReplaySequence=!0,pt(this.sequenceStorageKey,String(this.lastSequence)),this.emitSnapshot()}typeof n.projectId=="string"&&(this.projectId=n.projectId),this.onEvent(n)}}scheduleReconnect(){if(this.clearTimers(),this.manuallyClosed)return;this.reconnectAttempt+=1,this.state="reconnecting",this.emitSnapshot();let t=Math.min(1e4,500*2**(this.reconnectAttempt-1));this.reconnectTimer=window.setTimeout(()=>this.openSocket(),t)}clearTimers(){this.heartbeatTimer!==void 0&&(clearInterval(this.heartbeatTimer),this.heartbeatTimer=void 0),this.reconnectTimer!==void 0&&(clearTimeout(this.reconnectTimer),this.reconnectTimer=void 0)}};async function se(e,t,n){let o=new Headers(n?.headers);e&&o.set("Authorization",`Bearer ${e}`),n?.body&&!o.has("Content-Type")&&o.set("Content-Type","application/json");let r=await fetch(t,{...n,headers:o});if(!r.ok){let i=L(await r.text(),180);throw new Error(i||`Bridge request failed (${r.status} ${r.statusText})`)}return r}async function ce(e){let t=await e.text();return t?fn(t):null}async function hn(e){let t=await ce(await se(e,"/_visual/api/viewer-session")),n=z(t)?.viewerUrl;if(typeof n!="string"||!n.startsWith("/_visual/viewer#visual-view="))throw new Error("Bridge returned an invalid viewer session URL");return n}async function _n(e){let t=await ce(await se(e,"/_visual/api/project")),n=z(t),o=z(n?.project);return typeof n?.id=="string"?n.id:typeof n?.projectId=="string"?n.projectId:typeof o?.id=="string"?o.id:void 0}async function ho(e,t={}){let n=new URLSearchParams;t.limit!==void 0&&n.set("limit",String(t.limit)),t.cursor!==void 0&&(n.set("before",t.cursor.createdAt),n.set("beforeId",t.cursor.id));let o=n.toString(),r=o?`?${o}`:"",i=await ce(await se(e,`/_visual/api/tasks${r}`,t.signal?{signal:t.signal}:void 0)),a=z(i);return(Array.isArray(i)?i:Array.isArray(a?.tasks)?a.tasks:[]).filter(f=>{let c=z(f);return typeof c?.id=="string"&&typeof c.projectId=="string"&&typeof c.status=="string"&&po.has(c.status)&&typeof c.requestText=="string"&&(c.scope==="instance"||c.scope==="component"||c.scope==="page"||c.scope==="project")&&typeof c.originBrowserSessionId=="string"&&Array.isArray(c.changedFiles)&&c.changedFiles.every(h=>typeof h=="string")&&typeof c.createdAt=="string"})}async function bn(e,t,n){let o=await ho(e,n?{signal:n}:void 0);for(let r of o)if(r.originBrowserSessionId===t)return r}function dn(e){return Array.isArray(e)?e.filter(t=>typeof t=="string"):[]}function vn(e){let t=dn(e);if(t.length>0||Array.isArray(e))return t;let n=z(e);return dn(n?.files??n?.changedFiles??n?.data)}function _o(e){if(typeof e=="string")return e;let t=z(e),n=t?.diff??t?.content??t?.data;return typeof n=="string"?n:""}function bo(e){let t=/^(?:\/usr)?\/bin\/(?:bash|sh|zsh)\s+-lc\s+([\s\S]+)$/u.exec(e.trim());if(!t?.[1])return e;let n=t[1].trim();return n.length>=2&&(n.startsWith("'")&&n.endsWith("'")||n.startsWith('"')&&n.endsWith('"'))?n.slice(1,-1):n}function vo(e){if(typeof e.command!="string")return null;let t=bo(e.command),n=e.usedRtk===!0||/^rtk(?:\s|$)/u.test(t)?"RTK":"\uBA85\uB839",r=[typeof e.cwd=="string"?e.cwd.split(/[\\/]/u).filter(Boolean).at(-1):void 0,typeof e.durationMs=="number"?`${e.durationMs}ms`:void 0,e.timedOut===!0?"\uC2DC\uAC04 \uCD08\uACFC":void 0,e.truncated===!0?"\uCD9C\uB825 \uCD95\uC57D":void 0].filter(i=>!!i);return L(`${n} \xB7 ${t}${r.length>0?` \xB7 ${r.join(" \xB7 ")}`:""}`,500)}function xn(e){if(typeof e=="string")return L(e,500);let t=z(e);if(!t)return null;let n=z(t.event)??t,o=typeof n.type=="string"?n.type:void 0;if(o==="command")return vo(n);if(o==="tool_start"&&typeof n.name=="string")return n.name==="command_execution"||n.name==="direct_exec"?null:L(`\uB3C4\uAD6C \uC2DC\uC791 \xB7 ${n.name}${typeof n.summary=="string"?` \xB7 ${n.summary}`:""}`,500);if(o==="tool_end"&&typeof n.name=="string")return n.name==="command_execution"||n.name==="direct_exec"?null:L(`\uB3C4\uAD6C ${n.ok===!1?"\uC2E4\uD328":"\uC644\uB8CC"} \xB7 ${n.name}`,500);if(o==="phase"&&typeof n.name=="string")return L(`\uB2E8\uACC4 \xB7 ${n.name}`,500);if(o==="file_hint"&&typeof n.path=="string")return L(`\uD30C\uC77C \xB7 ${n.path}`,500);if(o==="usage"&&typeof n.inputTokens=="number"&&typeof n.outputTokens=="number")return L(`\uD1A0\uD070 \xB7 \uC785\uB825 ${n.inputTokens.toLocaleString("en-US")}${typeof n.cachedInputTokens=="number"?` \xB7 \uCE90\uC2DC ${n.cachedInputTokens.toLocaleString("en-US")}`:""} \xB7 \uCD9C\uB825 ${n.outputTokens.toLocaleString("en-US")}`,500);let r=n.message??n.text??n.summary??n.command??n.error??t.message;return typeof r=="string"?L(r,500):null}async function yn(e,t,n){let o=`/_visual/api/tasks/${encodeURIComponent(t)}`,r=n===void 0?void 0:{signal:n},[i,a,l]=await Promise.allSettled([se(e,`${o}/files`,r).then(ce),se(e,`${o}/diff`,r).then(ce),se(e,`${o}/logs`,r).then(ce)]),f=[i,a,l].find(R=>R.status==="rejected"&&R.reason instanceof DOMException&&R.reason.name==="AbortError");if(f!==void 0)throw f.reason;let c=i.status==="fulfilled"?vn(i.value):[],h=a.status==="fulfilled"?_o(a.value):"",_=l.status==="fulfilled"?l.value:[],s=z(_),g=Array.isArray(_)?_:Array.isArray(s?.logs)?s.logs:[],E=Array.isArray(g)?g.map(xn).filter(R=>!!R).slice(-40):[],w=[];return i.status==="rejected"&&w.push("files"),a.status==="rejected"&&w.push("diff"),l.status==="rejected"&&w.push("logs"),{changedFiles:c,diff:h,logs:E,unavailable:w}}async function wn(e,t,n){return ce(await se(e,`/_visual/api/tasks/${encodeURIComponent(t)}/${n}`,{method:"POST"}))}function ke(e){let t=z(e.payload),o=z(t?.task)??t;return o&&typeof o.id=="string"?o:void 0}function kn(e,t,n){let o=ke(e),r=e.taskId??o?.id;return r?e.type==="task.queued"?o?.originBrowserSessionId===t?{accept:!0,bind:!0,taskId:r}:{accept:!1,bind:!1,taskId:r}:{accept:n===r,bind:!1,taskId:r}:{accept:!1,bind:!1}}function Sn(e){let t=ke(e);if(t?.status)return t.status;let n=z(e.payload),o=n?.phase??n?.status;return typeof o=="string"?o:void 0}function Tn(e){let t=z(e.payload);return xn(t?.event??t)}function En(e){let t=z(e.payload);return vn(t?.changedFiles??t?.files??[])}var le="__visual_bridge_root",xo=new Set(["SCRIPT","STYLE","META","LINK","NOSCRIPT","TEMPLATE"]),yo=new Set(["alt","aria-label","aria-labelledby","aria-describedby","role","title","type","placeholder","data-testid","data-test-id","data-component","data-component-name","data-source","data-source-file","data-source-line","data-source-column","data-react-source"]),Cn=/(?:auth|cookie|credential|csrf|jwt|key|password|secret|session|token|value)/i,An=[["display","display"],["position","position"],["width","width"],["height","height"],["margin","margin"],["padding","padding"],["gap","gap"],["borderRadius","border-radius"],["fontSize","font-size"],["fontWeight","font-weight"],["lineHeight","line-height"],["color","color"],["backgroundColor","background-color"],["flexDirection","flex-direction"],["alignItems","align-items"],["justifyContent","justify-content"],["gridTemplateColumns","grid-template-columns"],["zIndex","z-index"]],wo={a:"link",button:"button",footer:"contentinfo",form:"form",header:"banner",img:"img",main:"main",nav:"navigation",select:"combobox",textarea:"textbox"};function Se(e){return typeof e=="object"&&e!==null?e:null}function H(e){let t=e?.trim();return t||void 0}function ge(e){let t=typeof e=="number"?e:Number.parseInt(String(e),10);return Number.isInteger(t)&&t>0?t:void 0}function Ln(e,t){let n=H(typeof e.fileName=="string"?e.fileName:typeof e.filePath=="string"?e.filePath:typeof e.file=="string"?e.file:void 0);if(!n)return;let o=ge(e.lineNumber??e.line),r=ge(e.columnNumber??e.column),i=H(typeof e.componentName=="string"?e.componentName:t);return{filePath:n,...o?{lineNumber:o}:{},...r?{columnNumber:r}:{},...i?{componentName:i}:{}}}function ko(e,t){let n=e.trim();if(!n)return;if(n.startsWith("{"))try{let l=Se(JSON.parse(n));return l?Ln(l,t):void 0}catch{return}let o=/^(.*):(\d+)(?::(\d+))?$/.exec(n),r=H(o?.[1]??n);if(!r)return;let i=ge(o?.[2]),a=ge(o?.[3]);return{filePath:r,...i?{lineNumber:i}:{},...a?{columnNumber:a}:{},...t?{componentName:t}:{}}}function So(e){let t=H(e.getAttribute("data-component-name"))??H(e.getAttribute("data-component")),n=e.getAttribute("data-react-source")??e.getAttribute("data-source");if(n){let a=ko(n,t);if(a)return a}let o=H(e.getAttribute("data-source-file")??e.getAttribute("data-file")??void 0);if(!o)return;let r=ge(e.getAttribute("data-source-line")),i=ge(e.getAttribute("data-source-column"));return{filePath:o,...r?{lineNumber:r}:{},...i?{columnNumber:i}:{},...t?{componentName:t}:{}}}function To(e){let t=e.type;if(typeof t=="function"){let o=t;return H(typeof o.displayName=="string"?o.displayName:typeof o.name=="string"?o.name:void 0)}let n=Se(t);return H(typeof n?.displayName=="string"?n.displayName:typeof n?.name=="string"?n.name:void 0)}function Eo(e,t){let n=typeof e=="string"?e:e instanceof Error?e.stack:void 0;if(!n)return[];let o=[];for(let r of n.split(`
|
|
2
|
+
`)){let i=/(?:\(|\s)([^()\s]+):(\d+):(\d+)\)?$/.exec(r.trim());if(!(!i?.[1]||i[1].includes("node_modules"))&&(o.push({filePath:i[1],lineNumber:Number(i[2]),columnNumber:Number(i[3]),...t?{componentName:t}:{}}),o.length===8))break}return o}function Rn(e){let t=e,n=Object.keys(t).find(a=>a.startsWith("__reactFiber$")||a.startsWith("__reactInternalInstance$")),o=n?Se(t[n]):null,r=[],i=new Set;for(let a=0;o&&a<20&&r.length<8;a+=1){let l=To(o),f=Se(o._debugSource),c=f?Ln(f,l):void 0,h=c?[c]:Eo(o._debugStack,l);for(let _ of h){let s=`${_.filePath}:${_.lineNumber??0}:${_.columnNumber??0}`;if(i.has(s)||(r.push(_),i.add(s)),r.length===8)break}o=Se(o.return)}return r}function Co(e){let t=e;for(let o=0;t&&o<5;o+=1){let r=So(t);if(r){let i=Rn(e);return{primary:r,stack:[r,...i].filter((a,l,f)=>f.findIndex(c=>c.filePath===a.filePath&&c.lineNumber===a.lineNumber&&c.columnNumber===a.columnNumber)===l).slice(0,8),confidence:o===0?"exact":"probable"}}t=t.parentElement}let n=Rn(e);return n.length>0?{primary:n[0],stack:n,confidence:"probable"}:{stack:[],confidence:"unknown"}}function Ro(e){if(e.id===le||e.closest(`#${le}`))return!0;let t=e.getRootNode();return t instanceof ShadowRoot&&t.host.id===le}function me(e){if(!(e instanceof HTMLElement)||xo.has(e.tagName)||Ro(e))return!1;let t=e.getBoundingClientRect();if(t.width<1||t.height<1)return!1;let n=getComputedStyle(e);return n.display!=="none"&&n.visibility!=="hidden"&&Number.parseFloat(n.opacity||"1")>0}function gt(e,t){for(let n of document.elementsFromPoint(e,t))if(me(n))return n;return null}function Io(e){let t={};for(let n of e.attributes){let o=n.name.toLowerCase(),r=o.startsWith("data-")&&!Cn.test(o)&&/(?:component|source|test|qa|variant)/i.test(o);(yo.has(o)||r)&&!Cn.test(o)&&(t[o]=L(n.value,200))}return t}function We(e){return H(e.getAttribute("role"))??wo[e.tagName.toLowerCase()]??(e instanceof HTMLInputElement?"textbox":void 0)}function mt(e){let t=H(e.getAttribute("aria-label"));if(t)return L(t,200);if(e instanceof HTMLImageElement)return H(e.alt);if(e instanceof HTMLInputElement||e instanceof HTMLSelectElement||e instanceof HTMLTextAreaElement){let o=e.labels?.[0],r=H(o?.innerText);return r?L(r,200):H(e.getAttribute("placeholder"))}let n=H(e.innerText);return n?L(n,200):H(e.title)}function In(e){return typeof CSS<"u"&&typeof CSS.escape=="function"?CSS.escape(e):e.replace(/[^a-zA-Z0-9_-]/g,t=>`\\${t}`)}function Po(e){let t=e.getAttribute("data-testid")??e.getAttribute("data-test-id");if(t)return`[data-testid="${In(t)}"]`;if(e.id)return`#${In(e.id)}`;let n=[],o=e;for(;o&&o!==document.body&&n.length<5;){let r=o.parentElement,i=o.tagName.toLowerCase(),a=o.tagName;if(!r){n.unshift(i);break}let l=Array.from(r.children).filter(c=>c.tagName===a),f=l.length>1?`:nth-of-type(${l.indexOf(o)+1})`:"";n.unshift(`${i}${f}`),o=r}return n.join(" > ")}function Ao(e){let t=[],n=e.getAttribute("data-testid")??e.getAttribute("data-test-id");n&&t.push({type:"testid",value:n,confidence:1}),e.id&&t.push({type:"id",value:e.id,confidence:.98});let o=We(e),r=mt(e);o&&t.push({type:"role",value:r?`${o}:${r}`:o,confidence:r?.9:.72});let i=Po(e);i&&(t.push({type:"css",value:i,confidence:.68}),t.push({type:"dom-path",value:i,confidence:.5}));let a=H(e.innerText);return a&&!(e instanceof HTMLInputElement)&&t.push({type:"text",value:L(a,100),confidence:.45}),t}var Pn={testid:0,id:1,role:2,css:3,"dom-path":4,text:5},Lo=new Map(An);function ft(e,t){let n=0;for(let o of e){if(n+=1,n>2500)break;if(me(o)&&t(o))return o}return null}function qo(e,t){try{let n=e.querySelector(t);return n&&me(n)?n:null}catch{return null}}function Fo(e,t,n){if(n.type==="testid")return ft(e.querySelectorAll("[data-testid], [data-test-id]"),r=>r.getAttribute("data-testid")===n.value||r.getAttribute("data-test-id")===n.value);if(n.type==="id"){let r=e.getElementById(n.value);return r&&me(r)?r:null}if(n.type==="role"){let r=n.value.indexOf(":"),i=t.dom.role??(r<0?n.value:n.value.slice(0,r)),a=t.dom.accessibleName??(r<0?void 0:n.value.slice(r+1));return ft(e.querySelectorAll("[role], a[href], button, footer, form, header, img, input, main, nav, select, textarea"),l=>We(l)===i&&(a===void 0||mt(l)===a))}if(n.type==="css"||n.type==="dom-path")return qo(e,n.value);let o=L(n.value,100);return ft(e.querySelectorAll("*"),r=>r.tagName.toLowerCase()!==t.dom.tagName?!1:L(r.innerText??"",100)===o)}function Mo(e,t){let n=[...e.dom.locatorCandidates].sort((o,r)=>Pn[o.type]-Pn[r.type]||r.confidence-o.confidence);for(let o of n){let r=Fo(t,e,o);if(r)return r}return null}function No(e,t){if(e.dom.text!==void 0&&L(t.innerText??"",500)!==e.dom.text)return!0;let n=getComputedStyle(t);return Object.entries(e.styles).some(([o,r])=>{let i=Lo.get(o);return i!==void 0&&n.getPropertyValue(i)!==r})}function qn(e,t=document){if(e.length===0)return{state:"unverified",targetCount:0,foundCount:0,changedCount:0};let n=0,o=0;for(let r of e){let i=Mo(r,t);i&&(n+=1,No(r,i)&&(o+=1))}return{state:n!==e.length?"not-found":o>0?"found-and-changed":"found-no-visible-change",targetCount:e.length,foundCount:n,changedCount:o}}function $o(e){let t=[],n=e.parentElement;for(;n&&n!==document.body&&t.length<8;){let o=n.parentElement?Array.from(n.parentElement.children).indexOf(n):void 0,r=H(n.id);t.unshift({tagName:n.tagName.toLowerCase(),...r?{id:r}:{},classNames:Array.from(n.classList).slice(0,20),...o!==void 0&&o>=0?{siblingIndex:o}:{}}),n=n.parentElement}return t}function ue(e){let t=e.getBoundingClientRect();return{x:t.x,y:t.y,width:t.width,height:t.height}}async function he(e,t){await Promise.resolve();let n=getComputedStyle(e),o=Array.from(e.classList).slice(0,100);for(;o.join(" ").length>2e3;)o.pop();let r={};for(let[h,_]of An){let s=n.getPropertyValue(_);s&&(r[h]=L(s,160))}let i=H(e.id),a=e instanceof HTMLInputElement||e instanceof HTMLTextAreaElement||e instanceof HTMLSelectElement?void 0:H(e.innerText),l=We(e),f=mt(e),c=Co(e);return{targetId:crypto.randomUUID(),order:t,dom:{tagName:e.tagName.toLowerCase(),...i?{id:i}:{},classNames:o,...a?{text:L(a,500)}:{},...l?{role:l}:{},...f?{accessibleName:L(f,200)}:{},attributes:Io(e),rect:ue(e),locatorCandidates:Ao(e),parentPath:$o(e)},styles:r,source:c}}function Fn(e){let t=[],n=Math.max(e.width*e.height,1),o=document.body?.querySelectorAll("*")??[],r=0;for(let i of o){if(r+=1,r>4e3)break;if(!me(i))continue;let a=ue(i),l=lt(a,e);if(l<=0)continue;let c=!!We(i)||/^(A|BUTTON|INPUT|SELECT|TEXTAREA|SUMMARY)$/.test(i.tagName),h=a.width*a.height/n,_=i.children.length<=2;!c&&!_&&h>.88||!c&&l<.12||t.push({element:i,score:l+(c?1.5:0)+(_?.35:0),index:r})}return t.sort((i,a)=>a.score-i.score||i.index-a.index).slice(0,20).sort((i,a)=>i.index-a.index).map(({element:i})=>i)}function Ke(){let e=["main","header","nav","aside","footer","[role='main']","[role='navigation']","h1","h2","button","a[href]","input","select","textarea","[role='button']"],t=[],n=new Set;for(let o of document.querySelectorAll(e.join(",")))if(!(n.has(o)||!me(o)||lt(ue(o),{x:0,y:0,width:innerWidth,height:innerHeight})<=0)&&(t.push(o),n.add(o),t.length===20))break;return t}function ht(e){let t=e.targets.map((o,r)=>({...o,order:r})),n=e.mode==="element"?{mode:"element",targets:t.slice(0,1)}:e.mode==="multi"?{mode:"multi",targets:t.slice(0,8)}:e.mode==="region"?{mode:"region",region:e.region??{x:0,y:0,width:0,height:0},targets:t.slice(0,20)}:{mode:"page",targets:t.slice(0,20)};return{version:1,projectId:e.projectId||"current",browserSessionId:e.browserSessionId,page:{url:location.href,pathname:location.pathname,title:document.title,viewport:{width:innerWidth,height:innerHeight},devicePixelRatio:devicePixelRatio||1,scroll:{x:scrollX,y:scrollY},renderRevision:e.renderRevision},selection:n,request:{text:e.requestText.trim(),scope:e.scope}}}var Mn=String.raw`
|
|
3
3
|
--graphite: #20211f;
|
|
4
4
|
--graphite-2: #30312e;
|
|
5
5
|
--strip: #f4efe3;
|
|
@@ -11,7 +11,7 @@ var Me,C,Mt,Vn,oe,At,Nt,$t,Ge,Pe,xe,Ht,Qe,Xe,Je,Yn,Ie={},qe=[],Gn=/acit|ex(?:s|g
|
|
|
11
11
|
--dispatch-dark: #9f3108;
|
|
12
12
|
--verified: #087f8c;
|
|
13
13
|
--danger: #a72920;
|
|
14
|
-
`;var
|
|
14
|
+
`;var Nn=String.raw`
|
|
15
15
|
:host {
|
|
16
16
|
all: initial;
|
|
17
17
|
position: fixed;
|
|
@@ -35,7 +35,7 @@ var Me,C,Mt,Vn,oe,At,Nt,$t,Ge,Pe,xe,Ht,Qe,Xe,Je,Yn,Ie={},qe=[],Gn=/acit|ex(?:s|g
|
|
|
35
35
|
}
|
|
36
36
|
|
|
37
37
|
.visual-shell {
|
|
38
|
-
${
|
|
38
|
+
${Mn}
|
|
39
39
|
position: fixed;
|
|
40
40
|
inset: 0;
|
|
41
41
|
color: var(--ink);
|
|
@@ -880,4 +880,4 @@ var Me,C,Mt,Vn,oe,At,Nt,$t,Ge,Pe,xe,Ht,Qe,Xe,Je,Yn,Ie={},qe=[],Gn=/acit|ex(?:s|g
|
|
|
880
880
|
animation: none !important;
|
|
881
881
|
}
|
|
882
882
|
}
|
|
883
|
-
`;var Mo=0;function p(e,t,n,o,r,i){t||(t={});var a,l,f=t;if("ref"in f)for(l in f={},t)l=="ref"?a=t[l]:f[l]=t[l];var c={type:e,props:f,key:n,ref:a,__k:null,__:null,__b:0,__e:null,__c:null,constructor:void 0,__v:--Mo,__i:-1,__u:0,__source:r,__self:i};if(typeof e=="function"&&(a=e.defaultProps))for(l in a)f[l]===void 0&&(f[l]=a[l]);return C.vnode&&C.vnode(c),c}var mt={queued:"\uB300\uAE30 \uC911",preparing:"\uC791\uC5C5 \uC900\uBE44",snapshotting_before:"\uBCC0\uACBD \uC804 \uC2A4\uB0C5\uC0F7",resolving_context:"\uC18C\uC2A4 \uD655\uC778",running_agent:"\uC5D0\uC774\uC804\uD2B8 \uC218\uC815 \uC911",snapshotting_after:"\uBCC0\uACBD \uD6C4 \uC2A4\uB0C5\uC0F7",diffing:"\uBCC0\uACBD \uBC94\uC704 \uACC4\uC0B0",waiting_hmr:"\uD654\uBA74 \uBC18\uC601 \uB300\uAE30",verifying:"\uAC80\uC99D \uC911",review:"\uAC80\uD1A0 \uB300\uAE30",accepted:"\uBCC0\uACBD \uC720\uC9C0",reverted:"\uB418\uB3CC\uB9AC\uAE30 \uC644\uB8CC",failed:"\uC791\uC5C5 \uC2E4\uD328",canceled:"\uC791\uC5C5 \uCDE8\uC18C",unsafe:"\uC548\uC804 \uD655\uC778 \uD544\uC694"},Nn={unpaired:"\uD398\uC5B4\uB9C1 \uD544\uC694",connecting:"\uC5F0\uACB0 \uC911",connected:"Bridge \uC5F0\uACB0\uB428",reconnecting:"\uC7AC\uC5F0\uACB0 \uC911",offline:"Bridge \uC751\uB2F5 \uC5C6\uC74C",unauthorized:"\uD398\uC5B4\uB9C1 \uAC70\uBD80\uB428"},No={unpaired:"\uD398\uC5B4\uB9C1",connecting:"\uC5F0\uACB0 \uC911",connected:"\uC5F0\uACB0\uB428",reconnecting:"\uC7AC\uC5F0\uACB0",offline:"\uC751\uB2F5 \uC5C6\uC74C",unauthorized:"\uAC70\uBD80\uB428"},ue=new Set(["queued","preparing","snapshotting_before","resolving_context","running_agent","snapshotting_after","diffing","waiting_hmr","verifying"]),$n=new Set(["failed","unsafe"]);function ke(e){return e.composedPath().some(t=>t instanceof HTMLElement&&t.id===ce)}function $o(e){if(!e)return"\uD604\uC7AC \uD398\uC774\uC9C0";if(!e.context)return"\uC18C\uC2A4 \uC704\uCE58 \uD655\uC778 \uC911\u2026";let t=e.context.source.primary;if(t){let r=t.lineNumber?`:${t.lineNumber}`:"";return`${t.componentName?`${t.componentName} \xB7 `:""}${t.filePath}${r}`}let n=e.context.dom,o=n.id?`#${n.id}`:n.classNames[0]?`.${n.classNames[0]}`:"";return`${n.tagName}${o} \xB7 source unknown`}function Ho(e){switch(e){case"passed":return"\uAC80\uC99D \uD1B5\uACFC";case"partial":return"\uBD80\uBD84 \uAC80\uC99D";case"failed":return"\uAC80\uC99D \uC2E4\uD328";default:return"\uBBF8\uAC80\uC99D"}}function Bo(e){if(e instanceof Error)return e.stack??e.message;if(typeof e=="string")return e;try{return JSON.stringify(e)}catch{return String(e)}}function Fn({rect:e,kind:t,label:n}){return p("div",{class:"reticle","data-kind":t,style:{left:`${e.x}px`,top:`${e.y}px`,width:`${e.width}px`,height:`${e.height}px`},"aria-hidden":"true",children:n?p("span",{class:"reticle-label",children:n}):null})}function Uo({panelRef:e,position:t,selection:n,mode:o,connectionState:r,requestText:i,scope:a,composingRef:l,onRequestText:f,onScope:c,onSubmit:h}){let _=V(null),s=n[0],m=n.filter(y=>!y.context).length;K(()=>{_.current?.focus()},[]);let T=y=>{st({key:y.key,shiftKey:y.shiftKey,isComposing:y.isComposing},!!l.current)&&(y.preventDefault(),h())};return p("section",{ref:e,class:"strip",style:{left:`${t.left}px`,top:`${t.top}px`},"aria-label":o==="region"?"\uC601\uC5ED \uC218\uC815 \uC694\uCCAD \uC791\uC131":"\uC218\uC815 \uC694\uCCAD \uC791\uC131",children:[p("header",{class:"strip-head",children:[p("span",{class:"strip-title",children:o==="region"?"\uB4DC\uB798\uADF8\uD55C \uD654\uBA74 \uC601\uC5ED":$o(s)}),p("span",{class:"strip-code machine",children:o==="element"?"TARGET 1":o==="multi"?`TARGETS ${n.length}/8`:o==="region"?"REGION":"PAGE"})]}),p("div",{class:"strip-body",children:[p("div",{class:"selection-readout",children:[p("strong",{children:o==="page"?"\uD604\uC7AC \uD398\uC774\uC9C0 \uCEE8\uD14D\uC2A4\uD2B8":o==="region"?"\uC601\uC5ED \uC120\uD0DD\uB428":`${n.length}\uAC1C \uB300\uC0C1 \uC120\uD0DD`}),p("span",{children:m>0?o==="region"?`\uBC94\uC704 \uC548 \uC694\uC18C ${m}\uAC1C \uD655\uC778 \uC911`:`\uC18C\uC2A4 ${m}\uAC1C \uD655\uC778 \uC911`:o==="region"?`\uBC94\uC704 \uC548 \uC694\uC18C ${n.length}\uAC1C \uD3EC\uD568`:"\uCEE8\uD14D\uC2A4\uD2B8 \uC900\uBE44\uB428"})]}),p("label",{class:"visually-hidden",for:"visual-request",children:"\uC218\uC815 \uC694\uCCAD"}),p("textarea",{ref:_,id:"visual-request",class:"request-field",value:i,maxLength:1e4,placeholder:"\uC120\uD0DD\uD55C \uD654\uBA74\uC744 \uC5B4\uB5BB\uAC8C \uBC14\uAFC0\uAE4C\uC694?",onInput:y=>f(y.currentTarget.value),onCompositionStart:()=>{l.current=!0},onCompositionEnd:()=>{l.current=!1},onKeyDown:T}),p("p",{class:"input-note",children:"Enter\uB85C \uBCF4\uB0B4\uAE30 \xB7 Shift+Enter\uB85C \uC904\uBC14\uAFC8"}),p("div",{class:"request-meta",children:[p("label",{class:"field-label",children:["\uC801\uC6A9 \uBC94\uC704",p("select",{value:a,onChange:y=>c(y.currentTarget.value),children:[p("option",{value:"instance",children:"\uC120\uD0DD\uD55C \uC778\uC2A4\uD134\uC2A4"}),p("option",{value:"component",children:"\uACF5\uC6A9 \uCEF4\uD3EC\uB10C\uD2B8"}),p("option",{value:"page",children:"\uD604\uC7AC \uD398\uC774\uC9C0"}),p("option",{value:"project",children:"\uD504\uB85C\uC81D\uD2B8 \uC804\uCCB4"})]})]}),p("button",{type:"button",class:"primary",disabled:!i.trim()||m>0||r!=="connected",onClick:h,children:"\uC694\uCCAD \uBCF4\uB0B4\uAE30"})]}),r!=="connected"?p("div",{class:"error-banner",role:"status",children:["\uC5F0\uACB0 \uC0C1\uD0DC: ",Nn[r],". Bridge \uC5F0\uACB0 \uD6C4 \uC694\uCCAD\uD560 \uC218 \uC788\uC2B5\uB2C8\uB2E4."]}):null]})]})}function jo({panelRef:e,position:t,task:n,followUpOpen:o,followUpText:r,composingRef:i,busyAction:a,onCancel:l,onAccept:f,onRevert:c,onToggleFollowUp:h,onFollowUpText:_,onFollowUp:s,onNewRequest:m,onDismiss:T}){let y=ue.has(n.status),E=n.changedFiles.length>0||!!n.diff,b=n.status==="review"||(n.status==="failed"||n.status==="canceled")&&E,w=n.status==="review"||n.status==="accepted"||n.status==="reverted",L=n.status==="accepted"||n.status==="reverted"||(n.status==="failed"||n.status==="canceled")&&!E,j=$n.has(n.status)||n.verification==="failed",z=j?"error":n.status==="canceled"?"canceled":w?"complete":"active",Y=n.logs.slice(-4),O=A=>{st({key:A.key,shiftKey:A.shiftKey,isComposing:A.isComposing},!!i.current)&&(A.preventDefault(),s())};return p("section",{id:"visual-task-strip",ref:e,class:"strip",style:{left:`${t.left}px`,top:`${t.top}px`},"aria-label":"\uC791\uC5C5 \uC9C4\uD589\uACFC \uAC80\uD1A0",children:[p("header",{class:"strip-head",children:[p("span",{class:"strip-title",children:P(n.requestText,72)}),p("span",{class:"strip-code machine",children:n.id?`TASK ${n.id.slice(0,8)}`:"DISPATCH"})]}),p("div",{class:"strip-body",children:[p("div",{class:"status-row",role:"status",children:[p("span",{class:"phase-mark","data-state":n.status,"data-terminal":w?"true":"false","data-error":j?"true":"false","aria-hidden":"true"}),p("span",{class:"phase-copy",children:[p("strong",{children:mt[n.status]}),p("span",{children:n.logs.at(-1)??"Bridge\uC5D0\uC11C \uC791\uC5C5 \uC0C1\uD0DC\uB97C \uAE30\uB2E4\uB9AC\uB294 \uC911\uC785\uB2C8\uB2E4."})]}),p("span",{class:"phase-count machine",children:[n.changedFiles.length," files"]})]}),p("div",{class:"progress-track","data-active":y?"true":"false","data-outcome":z,children:p("span",{})}),Y.length>0?p("ul",{class:"log-summary","aria-label":"\uCD5C\uADFC \uC791\uC5C5 \uB85C\uADF8",children:Y.map((A,q)=>p("li",{children:A},`${q}-${A}`))}):p("p",{class:"empty-line",children:"\uC544\uC9C1 \uD45C\uC2DC\uD560 \uC791\uC5C5 \uB85C\uADF8\uAC00 \uC5C6\uC2B5\uB2C8\uB2E4."}),n.error?p("div",{class:"error-banner",role:"alert",children:["\uC624\uB958: ",n.error]}):null,n.unavailableArtifacts&&n.unavailableArtifacts.length>0?p("div",{class:"error-banner",role:"status",children:["\uC77C\uBD80 \uC791\uC5C5 \uC815\uBCF4\uB97C \uBD88\uB7EC\uC624\uC9C0 \uBABB\uD588\uC2B5\uB2C8\uB2E4: ",n.unavailableArtifacts.join(", "),". \uC791\uC5C5 \uBCF4\uB4DC\uC5D0\uC11C \uB2E4\uC2DC \uD655\uC778\uD574 \uC8FC\uC138\uC694."]}):null,n.status==="unsafe"?p("div",{class:"error-banner",role:"alert",children:"\uD5C8\uC6A9 \uBC94\uC704 \uBC16\uC758 \uD30C\uC77C \uB610\uB294 Git \uC0C1\uD0DC\uAC00 \uC791\uC5C5 \uC911 \uBC14\uB00C\uC5B4 \uC790\uB3D9 \uC720\uC9C0\xB7\uB418\uB3CC\uB9AC\uAE30\uB97C \uC7A0\uAC14\uC2B5\uB2C8\uB2E4. \uC544\uB798 diff\uC5D0\uB294 \uD5C8\uC6A9\uB41C \uACBD\uB85C\uB9CC \uD45C\uC2DC\uB429\uB2C8\uB2E4. \uC791\uC5C5 \uC624\uB958\uC640 Git \uC0C1\uD0DC\uB97C \uD655\uC778\uD55C \uB4A4 Git\uC5D0\uC11C \uBCC0\uACBD\uC744 \uC9C1\uC811 \uC720\uC9C0\uD558\uAC70\uB098 \uB418\uB3CC\uB9AC\uC138\uC694."}):null,n.changedFiles.length>0||b||w||n.status==="unsafe"?p(te,{children:[p("div",{class:"review-summary",children:[n.changedFiles.length>0?p("ul",{class:"file-list","aria-label":"\uBCC0\uACBD \uD30C\uC77C",children:n.changedFiles.map(A=>p("li",{children:["\u0394\xA0 ",A]},A))}):p("p",{class:"empty-line",children:"\uBCC0\uACBD \uD30C\uC77C\uC774 \uBCF4\uACE0\uB418\uC9C0 \uC54A\uC558\uC2B5\uB2C8\uB2E4."}),p("div",{class:"verification","data-status":n.verification??"unverified",children:[p("strong",{children:"\uAC80\uC99D"}),p("span",{children:Ho(n.verification)})]})]}),p("details",{class:"diff",children:[p("summary",{children:"Unified diff \uBCF4\uAE30"}),p("pre",{class:"diff-code",children:n.diff||"Diff\uB97C \uC544\uC9C1 \uBC1B\uC9C0 \uBABB\uD588\uC2B5\uB2C8\uB2E4."})]})]}):null,p("div",{class:"actions",children:[y?p("button",{type:"button",class:"quiet",disabled:!n.id||a,onClick:l,children:"\uC791\uC5C5 \uCDE8\uC18C"}):null,b?p(te,{children:[p("button",{type:"button",class:"primary",disabled:!n.id||a,onClick:f,children:"\uBCC0\uACBD \uC720\uC9C0"}),p("button",{type:"button",class:"secondary",disabled:!n.id||a,onClick:h,children:"\uD6C4\uC18D \uC218\uC815"}),p("button",{type:"button",class:"danger",disabled:!n.id||a,onClick:c,children:"\uB418\uB3CC\uB9AC\uAE30"})]}):null,L?p("button",{type:"button",class:"secondary",onClick:m,children:"\uC0C8 \uC694\uCCAD"}):null,y?null:p("button",{type:"button",class:"quiet",title:"\uC791\uC5C5 \uB0B4\uC5ED\uC740 \uC791\uC5C5 \uBCF4\uB4DC\uC5D0 \uB0A8\uAE30\uACE0 \uC774 \uD328\uB110\uB9CC \uB2EB\uAE30",onClick:T,children:"\uB2EB\uAE30"})]}),o&&b?p("div",{class:"follow-up",children:[p("label",{class:"field-label",for:"visual-follow-up",children:"\uD6C4\uC18D \uC218\uC815 \uB0B4\uC6A9"}),p("textarea",{id:"visual-follow-up",class:"request-field",value:r,maxLength:1e4,placeholder:"\uD604\uC7AC \uBCC0\uACBD\uC744 \uAE30\uC900\uC73C\uB85C \uCD94\uAC00\uD560 \uB0B4\uC6A9\uC744 \uC785\uB825\uD558\uC138\uC694.",onInput:A=>_(A.currentTarget.value),onCompositionStart:()=>{i.current=!0},onCompositionEnd:()=>{i.current=!1},onKeyDown:O}),p("button",{type:"button",class:"primary",disabled:!r.trim()||a,onClick:s,children:"\uD6C4\uC18D \uC694\uCCAD \uBCF4\uB0B4\uAE30"})]}):null]})]})}function Oo({task:e,busyAction:t,onExpand:n,onCancel:o}){let r=ue.has(e.status),i=["review","accepted","reverted"].includes(e.status),a=$n.has(e.status)||e.verification==="failed",l="visual-task-compact-phase",f="visual-task-compact-request",c="visual-task-compact-action";return p("section",{class:"task-compact","data-active":r?"true":"false","data-error":a?"true":"false","aria-label":"\uCD5C\uC18C\uD654\uB41C \uC791\uC5C5 \uC0C1\uD0DC",children:[p("button",{type:"button",class:"task-compact-main","aria-labelledby":`${l} ${f} ${c}`,onClick:n,children:[p("span",{class:"phase-mark","data-state":e.status,"data-terminal":i?"true":"false","data-error":a?"true":"false","aria-hidden":"true"}),p("span",{class:"task-compact-copy",children:[p("strong",{id:l,children:mt[e.status]}),p("span",{id:f,class:"task-compact-request",children:e.requestText}),p("span",{id:c,class:"visually-hidden",children:"\uC791\uC5C5 \uC0C1\uC138 \uD3BC\uCE58\uAE30"})]})]}),r?p("button",{type:"button",class:"task-compact-cancel",disabled:!e.id||t,onClick:o,children:"\uCDE8\uC18C"}):null]})}function Do({host:e}){let t=ie(()=>Be(location.hash).token!==null,[]),n=ie(dn,[]),o=ie(pn,[]),r=V(null),i=V([]),a=V(""),l=V(void 0),f=V(null),c=V(null),h=V(!1),_=V(1),s=V(null),m=V(null),T=V(null),[y,E]=$(t),[b,w]=$("element"),[L,j]=$([]),[z,Y]=$(null),[O,A]=$(null),[q,B]=$(!1),[J,gt]=$(""),[he,We]=$("instance"),[G,Hn]=$(1),[ht,_t]=$(0),[ne,Bn]=$({state:"connecting",lastSequence:0}),[Se,Ke]=$("current"),[bt,vt]=$(null),[Un,xt]=$(!1),[g,W]=$(null),[U,Q]=$(!1),[yt,Ve]=$(!1),[_e,wt]=$(""),[kt,St]=$(!1),[Tt,jn]=$({left:12,top:64,placement:"below"});i.current=L,a.current=J,_.current=G,l.current=g?.id;let Et=!!(g&&(ue.has(g.status)||g.status==="review"&&!["passed","partial","failed"].includes(g.verification??""))),Te=Z(()=>({url:location.href,pathname:location.pathname,title:document.title,viewport:{width:innerWidth,height:innerHeight},renderRevision:_.current}),[]),Ee=Z(async d=>{let u=await bn(n,d);W(x=>x?.id===d?{...x,changedFiles:u.changedFiles.length>0?u.changedFiles:x.changedFiles,diff:u.diff||x.diff,logs:u.logs.length>0?u.logs:x.logs,unavailableArtifacts:u.unavailable}:x)},[n]),Ct=Z(d=>{let u=Oe(d),x=d.taskId??u?.id,R=yn(d),v=wn(d),S=kn(d);if(d.type==="project.state"){let k=d.payload;typeof k?.projectId=="string"&&Ke(k.projectId)}if(d.type==="command.error"){let k=d.payload;typeof k?.message=="string"&&W(M=>M&&{...M,status:M.status==="queued"&&!M.id?"failed":M.status,error:k.message});return}let I=xn(d,o,l.current);if(!(!I.accept||!I.taskId)){if(I.bind&&(l.current=I.taskId),u?.scope&&We(u.scope),d.type==="task.verification_result"){let k=d.payload,M=k.verificationStatus??k.status;typeof M=="string"&&W(X=>X&&{...X,verification:M})}(x||R||v||S.length>0||u)&&W(k=>{let M=k&&(!k.id||k.id===x)?k:{status:R??u?.status??"queued",requestText:u?.requestText??a.current,changedFiles:[],logs:[],diff:""},X=u?.error?.message??d.payload?.error?.message;return{...M,...x?{id:x}:{},status:R??u?.status??M.status,requestText:u?.requestText??M.requestText,changedFiles:S.length>0?S:u?.changedFiles?.length?u.changedFiles:M.changedFiles,logs:v?[...M.logs,v].slice(-40):M.logs,...u?.verificationStatus?{verification:u.verificationStatus}:{},...typeof X=="string"?{error:X}:{}}}),x&&(d.type==="task.diff_ready"||d.type==="task.completed"||d.type==="task.failed")&&Ee(x)}},[o,Ee]);K(()=>{let d=new je({token:n,browserSessionId:o,getPageState:Te,onSnapshot:u=>{Bn(u),u.projectId&&Ke(u.projectId)},onEvent:Ct});return r.current=d,d.connect(),mn(n).then(u=>{u&&Ke(u)}).catch(()=>{}),gn(n,o).then(u=>{u&&(W(x=>x||(l.current=u.id,{id:u.id,status:u.status,requestText:u.requestText,changedFiles:u.changedFiles,logs:[],diff:"",...u.verificationStatus?{verification:u.verificationStatus}:{},...u.error?.message?{error:u.error.message}:{}})),Ee(u.id))}).catch(()=>{}),()=>{d.close(),r.current=null}},[o,Ct,Ee,Te,n]),K(()=>{let d=!0;return xt(!1),fn(n).then(u=>{d&&vt(u)}).catch(()=>{d&&(vt(null),xt(!0))}),()=>{d=!1}},[n]),K(()=>{e.dataset.active=y?"true":"false",y&&requestAnimationFrame(()=>{T.current?.querySelector('button[aria-pressed="true"]')?.focus()})},[e,y]),K(()=>{if(!Et)return;let d,u,x=()=>{d!==void 0&&(clearTimeout(d),d=void 0),u!==void 0&&(clearTimeout(u),u=void 0),Hn(v=>v+1)},R=new MutationObserver(v=>{v.some(({target:I})=>I!==e&&!e.contains(I))&&(d!==void 0&&clearTimeout(d),d=window.setTimeout(x,150),u===void 0&&(u=window.setTimeout(x,1e3)))});return R.observe(document.documentElement,{attributes:!0,characterData:!0,childList:!0,subtree:!0}),()=>{R.disconnect(),d!==void 0&&clearTimeout(d),u!==void 0&&clearTimeout(u)}},[e,Et]),K(()=>{r.current?.send("browser.page_state",Te())},[Te,G]),K(()=>{if(ne.state!=="connected"||!g?.id||g.verification==="passed"||g.verification==="partial"||g.verification==="failed"||!ue.has(g.status)&&g.status!=="review")return;let d=f.current;if(!d){let S=`${g.id}:page-reloaded`;if(s.current===S)return;r.current?.send("verification.target_state",{taskId:g.id,state:"page-reloaded",renderRevision:G,targetCount:0,foundCount:0,changedCount:0})&&(s.current=S);return}let u=d.selection.targets;if(d.selection.mode==="page"||u.length===0||G<=d.page.renderRevision)return;let x=`${g.id}:${G}`;if(s.current===x)return;let R;try{R=Ln(u)}catch{R={state:"unverified",targetCount:u.length,foundCount:0,changedCount:0}}r.current?.send("verification.target_state",{taskId:g.id,renderRevision:G,...R})&&(s.current=x)},[ne.state,G,g?.id,g?.status,g?.verification]),K(()=>{let d=(k,M)=>{let X=P(M.map(Bo).join(" "),2e3);X&&r.current?.send("verification.console_events",{events:[{level:k,message:X,createdAt:new Date().toISOString()}]})},u=console.error,x=console.warn,R=(...k)=>{u.apply(console,k),d("error",k)},v=(...k)=>{x.apply(console,k),d("warning",k)},S=k=>{d("error",[k.error instanceof Error?k.error:k.message])},I=k=>{d("unhandled",[k.reason])};return console.error=R,console.warn=v,window.addEventListener("error",S),window.addEventListener("unhandledrejection",I),()=>{console.error===R&&(console.error=u),console.warn===v&&(console.warn=x),window.removeEventListener("error",S),window.removeEventListener("unhandledrejection",I)}},[]);let re=Z(()=>{j([]),Y(null),A(null),B(!1),gt(""),Ve(!1),c.current=null},[]),be=Z(d=>{let u=d.map(x=>({id:crypto.randomUUID(),element:x,context:null}));j(u);for(let[x,R]of u.entries())ge(R.element,x).then(v=>{j(S=>S.map(I=>I.id===R.id?{...I,context:v}:I))})},[]),On=Z(d=>{re(),Q(!!g),w(d),We(d==="page"?"page":"instance"),d==="page"&&(be(ze()),B(!0))},[be,re,g]);K(()=>{let d=u=>{if(u.key.toLowerCase()==="g"&&u.shiftKey&&(u.metaKey||u.ctrlKey)){u.preventDefault(),u.stopPropagation(),E(x=>!x);return}y&&(u.key==="Escape"?q?re():E(!1):u.key==="Enter"&&b==="multi"&&i.current.length>0&&!q&&(!g||U)&&!ke(u)&&(u.preventDefault(),B(!0)))};return window.addEventListener("keydown",d,!0),()=>window.removeEventListener("keydown",d,!0)},[b,y,q,re,g,U]),K(()=>{if(!y||q||g&&ue.has(g.status)&&!U){Y(null);return}let d=v=>{if(b==="region"&&c.current){A(it(c.current,{x:v.clientX,y:v.clientY}));return}if(b==="page"||ke(v))return;let S=dt(v.clientX,v.clientY);Y(I=>I===S?I:S)},u=v=>{v.button!==0||ke(v)||b==="page"||(v.preventDefault(),v.stopImmediatePropagation(),b==="region"&&(c.current={x:v.clientX,y:v.clientY},A({x:v.clientX,y:v.clientY,width:0,height:0}),j([])))},x=v=>{if(v.button!==0||ke(v)||b==="page"||(v.preventDefault(),v.stopImmediatePropagation(),b!=="region"||!c.current))return;let S=it(c.current,{x:v.clientX,y:v.clientY});if(c.current=null,S.width<5||S.height<5){A(null);return}A(S),be(An(S)),B(!0)},R=v=>{if(b==="region"||b==="page"||v.button!==0||ke(v))return;let S=dt(v.clientX,v.clientY);if(!S)return;if(v.preventDefault(),v.stopImmediatePropagation(),Q(!!g),!(b==="multi"||v.shiftKey)){be([S]),B(!0);return}b!=="multi"&&w("multi");let k=i.current,M=k.find(ve=>ve.element===S);if(M){j(k.filter(ve=>ve.id!==M.id));return}if(k.length>=8)return;let X={id:crypto.randomUUID(),element:S,context:null};j([...k,X]),ge(S,k.length).then(ve=>{j(Kn=>Kn.map(Ye=>Ye.id===X.id?{...Ye,context:ve}:Ye))})};return document.addEventListener("pointermove",d,!0),document.addEventListener("pointerdown",u,!0),document.addEventListener("pointerup",x,!0),document.addEventListener("click",R,!0),()=>{document.removeEventListener("pointermove",d,!0),document.removeEventListener("pointerdown",u,!0),document.removeEventListener("pointerup",x,!0),document.removeEventListener("click",R,!0)}},[be,b,y,q,g,U]),K(()=>{let d=0,u=()=>{cancelAnimationFrame(d),d=requestAnimationFrame(()=>_t(x=>x+1))};return window.addEventListener("resize",u),window.addEventListener("scroll",u,!0),()=>{cancelAnimationFrame(d),window.removeEventListener("resize",u),window.removeEventListener("scroll",u,!0)}},[]),K(()=>{if(!q&&!g)return;let d=m.current;if(!d)return;let u=0,x=new ResizeObserver(()=>{cancelAnimationFrame(u),u=requestAnimationFrame(()=>_t(R=>R+1))});return x.observe(d),()=>{cancelAnimationFrame(u),x.disconnect()}},[q,g?.id]);let Rt=ie(()=>{if(O)return O;let d=L.at(-1);return d?.element.isConnected?le(d.element):{x:12,y:52,width:1,height:1}},[ht,O,L]);nn(()=>{if(!q&&!g)return;let d=m.current;if(!d)return;let u=T.current?.getBoundingClientRect().bottom??52;jn(an(Rt,{width:d.offsetWidth||408,height:d.offsetHeight||300},{width:innerWidth,height:innerHeight},12,10,u+10))},[Rt,yt,q,g?.changedFiles.length,g?.diff,g?.logs.length,g?.status]);let Dn=Z(async()=>{let d=J.trim();if(!d||ne.state!=="connected")return;let u=await Promise.all(i.current.map(async(v,S)=>v.context??ge(v.element,S)));if(b==="element"&&u.length===0)return;if(b==="page"&&u.length===0){let v=ze();u=await Promise.all(v.map((S,I)=>ge(S,I)))}let x=ft({projectId:Se,browserSessionId:o,mode:b,targets:u,...O?{region:O}:{},requestText:d,scope:he,renderRevision:G});if(f.current=x,!r.current?.send("task.create",x)){Q(!1),W({status:"failed",requestText:d,changedFiles:[],logs:[],diff:"",error:"Bridge \uC5F0\uACB0\uC774 \uB04A\uC5B4\uC838 \uC694\uCCAD\uC744 \uBCF4\uB0B4\uC9C0 \uBABB\uD588\uC2B5\uB2C8\uB2E4. \uC7AC\uC5F0\uACB0 \uD6C4 \uB2E4\uC2DC \uC2DC\uB3C4\uD558\uC138\uC694."});return}W({status:"queued",requestText:d,changedFiles:[],logs:["\uC694\uCCAD\uC744 Bridge writer queue\uC5D0 \uC804\uB2EC\uD588\uC2B5\uB2C8\uB2E4."],diff:""}),Q(!1),B(!1)},[o,ne.state,b,Se,O,G,J,he]),Ce=Z(async d=>{if(g?.id){St(!0);try{await vn(n,g.id,d),W(u=>u&&{...u,status:d==="accept"?"accepted":d==="revert"?"reverted":"canceled",logs:[...u.logs,d==="accept"?"\uD604\uC7AC working tree \uBCC0\uACBD\uC744 \uC720\uC9C0\uD588\uC2B5\uB2C8\uB2E4.":d==="revert"?"\uCD5C\uC2E0 task \uBCC0\uACBD\uC744 \uB418\uB3CC\uB838\uC2B5\uB2C8\uB2E4.":"\uC791\uC5C5 \uCDE8\uC18C\uB97C \uC694\uCCAD\uD588\uC2B5\uB2C8\uB2E4."]})}catch(u){W(x=>x&&{...x,error:u instanceof Error?u.message:"\uC791\uC5C5 \uBA85\uB839\uC744 \uC644\uB8CC\uD558\uC9C0 \uBABB\uD588\uC2B5\uB2C8\uB2E4."})}finally{St(!1)}}},[g?.id,n]),zn=Z(async()=>{if(!g?.id||!_e.trim())return;let d=f.current;if(!d){let R=ze(),v=await Promise.all(R.map((S,I)=>ge(S,I)));d=ft({projectId:Se,browserSessionId:o,mode:"page",targets:v,requestText:g.requestText,scope:"page",renderRevision:G})}let u={...d,page:{...d.page,url:location.href,pathname:location.pathname,title:document.title,viewport:{width:innerWidth,height:innerHeight},devicePixelRatio:devicePixelRatio||1,scroll:{x:scrollX,y:scrollY},renderRevision:G},request:{text:_e.trim(),scope:he}};if(!r.current?.send("task.follow_up",{taskId:g.id,parentTaskId:g.id,contextBundle:u})){W(R=>R&&{...R,error:"Bridge\uAC00 \uC5F0\uACB0\uB418\uC9C0 \uC54A\uC544 \uD6C4\uC18D \uC694\uCCAD\uC744 \uBCF4\uB0B4\uC9C0 \uBABB\uD588\uC2B5\uB2C8\uB2E4."});return}W({status:"queued",requestText:_e.trim(),changedFiles:[],logs:[`${g.id.slice(0,8)} task\uB97C \uAE30\uC900\uC73C\uB85C \uD6C4\uC18D \uC694\uCCAD\uC744 \uBCF4\uB0C8\uC2B5\uB2C8\uB2E4.`],diff:""}),Q(!1),wt(""),Ve(!1),f.current=u},[o,_e,Se,G,he,g?.id,g?.requestText]),Wn=L.filter(d=>d.element.isConnected).map(d=>({item:d,rect:le(d.element)})),Pt=z?.isConnected&&!L.some(d=>d.element===z)?le(z):null,Lt=b==="element"?"\uC694\uC18C\uB97C \uD074\uB9AD\uD558\uC138\uC694 \xB7 Shift+Click\uC740 \uC5EC\uB7EC \uC694\uC18C":b==="multi"?`\uC694\uC18C\uB97C \uC120\uD0DD\uD558\uC138\uC694 (${L.length}/8) \xB7 Enter\uB85C \uC694\uCCAD \uC791\uC131`:b==="region"?"\uC694\uCCAD\uD560 \uC601\uC5ED\uC744 \uB4DC\uB798\uADF8\uD558\uC138\uC694":"\uD604\uC7AC \uD398\uC774\uC9C0\uC758 \uC8FC\uC694 \uCEE8\uD14D\uC2A4\uD2B8\uB97C \uC218\uC9D1\uD588\uC2B5\uB2C8\uB2E4";return p("div",{class:"visual-shell","data-open":y?"true":"false",children:[p("nav",{ref:T,class:"toolbar","aria-label":"Visual Bridge \uB3C4\uAD6C",children:[p("span",{class:"brand-mark",children:"Visual Bridge"}),p("div",{class:"mode-tabs",children:[["element","\uC694\uC18C"],["multi","\uC5EC\uB7EC \uC694\uC18C"],["region","\uC601\uC5ED"],["page","\uD398\uC774\uC9C0"]].map(([d,u])=>p("button",{type:"button","aria-pressed":b===d?"true":"false",disabled:!!(g&&ue.has(g.status)&&!U),onClick:()=>On(d),children:u},d))}),b==="multi"&&L.length>0&&!q&&(!g||U)?p("button",{type:"button",class:"primary",onClick:()=>B(!0),children:"\uC694\uCCAD \uC791\uC131"}):null,g&&!q?p("button",{type:"button",class:"task-toggle","aria-controls":"visual-task-strip","aria-expanded":U?"false":"true",title:U?"\uCD5C\uC18C\uD654\uB41C \uC791\uC5C5 \uC0C1\uC138 \uD3BC\uCE58\uAE30":"\uC791\uC5C5 \uC0C1\uD0DC\uB97C \uB0A8\uAE30\uACE0 \uD328\uB110 \uCD5C\uC18C\uD654",onClick:()=>{if(U){Q(!1);return}re(),Q(!0)},children:U?"\uC791\uC5C5 \uD3BC\uCE58\uAE30":"\uC791\uC5C5 \uCD5C\uC18C\uD654"}):null,bt?p("a",{class:"viewer-link",href:bt,target:"_blank",rel:"noopener","aria-label":"\uC804\uCCB4\uD654\uBA74 \uC791\uC5C5 \uBCF4\uB4DC\uB97C \uC0C8 \uD0ED\uC5D0\uC11C \uC5F4\uAE30",title:"\uC804\uCCB4\uD654\uBA74 \uC791\uC5C5 \uBCF4\uB4DC \uC5F4\uAE30",children:"\uC791\uC5C5 \uBCF4\uB4DC \u2197"}):p("button",{type:"button",class:"viewer-link",disabled:!0,title:Un?"\uC791\uC5C5 \uBCF4\uB4DC \uC5F0\uACB0\uC744 \uC900\uBE44\uD558\uC9C0 \uBABB\uD588\uC2B5\uB2C8\uB2E4":"\uC791\uC5C5 \uBCF4\uB4DC \uC900\uBE44 \uC911",children:"\uC791\uC5C5 \uBCF4\uB4DC"}),p("span",{class:"connection",role:"status",children:[p("span",{class:"state-dot","data-state":ne.state,"aria-hidden":"true"}),p("span",{class:"connection-label connection-label-full",children:Nn[ne.state]}),p("span",{class:"connection-label connection-label-compact",children:No[ne.state]})]})]}),g&&U?p(Oo,{task:g,busyAction:kt,onExpand:()=>Q(!1),onCancel:()=>{Ce("cancel")}}):null,!q&&(!g||U||!ue.has(g.status))&&Pt?p(Fn,{rect:Pt,kind:"hover"}):null,b!=="page"&&b!=="region"&&(!g||!U||q)?Wn.map(({item:d,rect:u},x)=>p(Fn,{rect:u,kind:"selected",...b==="multi"?{label:String(x+1)}:{}},d.id)):null,O&&(!g||!U||q)?p("div",{class:"region-box",style:{left:`${O.x}px`,top:`${O.y}px`,width:`${O.width}px`,height:`${O.height}px`},"aria-hidden":"true",children:p("span",{class:"region-box-label machine",children:"\uC601\uC5ED"})}):null,q&&(!g||U)?p(Uo,{panelRef:m,position:Tt,selection:L,mode:b,connectionState:ne.state,requestText:J,scope:he,composingRef:h,onRequestText:gt,onScope:We,onSubmit:()=>{Dn()}}):null,g&&!U?p(jo,{panelRef:m,position:Tt,task:g,followUpOpen:yt,followUpText:_e,composingRef:h,busyAction:kt,onCancel:()=>{Ce("cancel")},onAccept:()=>{Ce("accept")},onRevert:()=>{Ce("revert")},onToggleFollowUp:()=>Ve(d=>!d),onFollowUpText:wt,onFollowUp:()=>{zn()},onNewRequest:()=>{W(null),Q(!1),re()},onDismiss:()=>{l.current=void 0,W(null),Q(!1),re()}}):null,!q&&(!g||U)?p("div",{class:"selection-hint",children:Lt}):null,p("div",{class:"visually-hidden","aria-live":"polite",children:g?`${mt[g.status]}. ${g.logs.at(-1)??""}`:Lt}),p("span",{class:"visually-hidden",children:"Overlay \uC5F4\uAE30 \uB610\uB294 \uB2EB\uAE30: Command \uB610\uB294 Control + Shift + G"})]})}function Mn(){if(document.getElementById(ce)||!document.body)return;let e=document.createElement("div");e.id=ce,e.dataset.visualBridgeIgnore="true",e.dataset.active="false";let t=e.attachShadow({mode:"open"}),n=document.createElement("style");n.textContent=qn;let o=document.createElement("div");o.dataset.visualBridgeIgnore="true",t.append(n,o),document.body.append(e),Kt(p(Do,{host:e}),o)}document.readyState==="loading"?document.addEventListener("DOMContentLoaded",Mn,{once:!0}):Mn();
|
|
883
|
+
`;var Ho=0;function d(e,t,n,o,r,i){t||(t={});var a,l,f=t;if("ref"in f)for(l in f={},t)l=="ref"?a=t[l]:f[l]=t[l];var c={type:e,props:f,key:n,ref:a,__k:null,__:null,__b:0,__e:null,__c:null,constructor:void 0,__v:--Ho,__i:-1,__u:0,__source:r,__self:i};if(typeof e=="function"&&(a=e.defaultProps))for(l in a)f[l]===void 0&&(f[l]=a[l]);return I.vnode&&I.vnode(c),c}var _t={queued:"\uB300\uAE30 \uC911",preparing:"\uC791\uC5C5 \uC900\uBE44",snapshotting_before:"\uBCC0\uACBD \uC804 \uC2A4\uB0C5\uC0F7",resolving_context:"\uC18C\uC2A4 \uD655\uC778",running_agent:"\uC5D0\uC774\uC804\uD2B8 \uC218\uC815 \uC911",snapshotting_after:"\uBCC0\uACBD \uD6C4 \uC2A4\uB0C5\uC0F7",diffing:"\uBCC0\uACBD \uBC94\uC704 \uACC4\uC0B0",waiting_hmr:"\uD654\uBA74 \uBC18\uC601 \uB300\uAE30",verifying:"\uAC80\uC99D \uC911",review:"\uAC80\uD1A0 \uB300\uAE30",accepted:"\uBCC0\uACBD \uC720\uC9C0",reverted:"\uB418\uB3CC\uB9AC\uAE30 \uC644\uB8CC",failed:"\uC791\uC5C5 \uC2E4\uD328",canceled:"\uC791\uC5C5 \uCDE8\uC18C",unsafe:"\uC548\uC804 \uD655\uC778 \uD544\uC694"},Bn={unpaired:"\uD398\uC5B4\uB9C1 \uD544\uC694",connecting:"\uC5F0\uACB0 \uC911",connected:"Bridge \uC5F0\uACB0\uB428",reconnecting:"\uC7AC\uC5F0\uACB0 \uC911",offline:"Bridge \uC751\uB2F5 \uC5C6\uC74C",unauthorized:"\uD398\uC5B4\uB9C1 \uAC70\uBD80\uB428"},Bo={unpaired:"\uD398\uC5B4\uB9C1",connecting:"\uC5F0\uACB0 \uC911",connected:"\uC5F0\uACB0\uB428",reconnecting:"\uC7AC\uC5F0\uACB0",offline:"\uC751\uB2F5 \uC5C6\uC74C",unauthorized:"\uAC70\uBD80\uB428"},de=new Set(["queued","preparing","snapshotting_before","resolving_context","running_agent","snapshotting_after","diffing","waiting_hmr","verifying"]),Un=new Set(["failed","unsafe"]),Uo=3e3;function Te(e){return e.composedPath().some(t=>t instanceof HTMLElement&&t.id===le)}function Oo(e){if(!e)return"\uD604\uC7AC \uD398\uC774\uC9C0";if(!e.context)return"\uC18C\uC2A4 \uC704\uCE58 \uD655\uC778 \uC911\u2026";let t=e.context.source.primary;if(t){let r=t.lineNumber?`:${t.lineNumber}`:"";return`${t.componentName?`${t.componentName} \xB7 `:""}${t.filePath}${r}`}let n=e.context.dom,o=n.id?`#${n.id}`:n.classNames[0]?`.${n.classNames[0]}`:"";return`${n.tagName}${o} \xB7 source unknown`}function jo(e){switch(e){case"passed":return"\uAC80\uC99D \uD1B5\uACFC";case"partial":return"\uBD80\uBD84 \uAC80\uC99D";case"failed":return"\uAC80\uC99D \uC2E4\uD328";default:return"\uBBF8\uAC80\uC99D"}}function Do(e){if(e instanceof Error)return e.stack??e.message;if(typeof e=="string")return e;try{return JSON.stringify(e)}catch{return String(e)}}function $n({rect:e,kind:t,label:n}){return d("div",{class:"reticle","data-kind":t,style:{left:`${e.x}px`,top:`${e.y}px`,width:`${e.width}px`,height:`${e.height}px`},"aria-hidden":"true",children:n?d("span",{class:"reticle-label",children:n}):null})}function zo({panelRef:e,position:t,selection:n,mode:o,connectionState:r,requestText:i,scope:a,composingRef:l,onRequestText:f,onScope:c,onSubmit:h}){let _=W(null),s=n[0],g=n.filter(w=>!w.context).length;V(()=>{_.current?.focus()},[]);let E=w=>{ut({key:w.key,shiftKey:w.shiftKey,isComposing:w.isComposing},!!l.current)&&(w.preventDefault(),h())};return d("section",{ref:e,class:"strip",style:{left:`${t.left}px`,top:`${t.top}px`},"aria-label":o==="region"?"\uC601\uC5ED \uC218\uC815 \uC694\uCCAD \uC791\uC131":"\uC218\uC815 \uC694\uCCAD \uC791\uC131",children:[d("header",{class:"strip-head",children:[d("span",{class:"strip-title",children:o==="region"?"\uB4DC\uB798\uADF8\uD55C \uD654\uBA74 \uC601\uC5ED":Oo(s)}),d("span",{class:"strip-code machine",children:o==="element"?"TARGET 1":o==="multi"?`TARGETS ${n.length}/8`:o==="region"?"REGION":"PAGE"})]}),d("div",{class:"strip-body",children:[d("div",{class:"selection-readout",children:[d("strong",{children:o==="page"?"\uD604\uC7AC \uD398\uC774\uC9C0 \uCEE8\uD14D\uC2A4\uD2B8":o==="region"?"\uC601\uC5ED \uC120\uD0DD\uB428":`${n.length}\uAC1C \uB300\uC0C1 \uC120\uD0DD`}),d("span",{children:g>0?o==="region"?`\uBC94\uC704 \uC548 \uC694\uC18C ${g}\uAC1C \uD655\uC778 \uC911`:`\uC18C\uC2A4 ${g}\uAC1C \uD655\uC778 \uC911`:o==="region"?`\uBC94\uC704 \uC548 \uC694\uC18C ${n.length}\uAC1C \uD3EC\uD568`:"\uCEE8\uD14D\uC2A4\uD2B8 \uC900\uBE44\uB428"})]}),d("label",{class:"visually-hidden",for:"visual-request",children:"\uC218\uC815 \uC694\uCCAD"}),d("textarea",{ref:_,id:"visual-request",class:"request-field",value:i,maxLength:1e4,placeholder:"\uC120\uD0DD\uD55C \uD654\uBA74\uC744 \uC5B4\uB5BB\uAC8C \uBC14\uAFC0\uAE4C\uC694?",onInput:w=>f(w.currentTarget.value),onCompositionStart:()=>{l.current=!0},onCompositionEnd:()=>{l.current=!1},onKeyDown:E}),d("p",{class:"input-note",children:"Enter\uB85C \uBCF4\uB0B4\uAE30 \xB7 Shift+Enter\uB85C \uC904\uBC14\uAFC8"}),d("div",{class:"request-meta",children:[d("label",{class:"field-label",children:["\uC801\uC6A9 \uBC94\uC704",d("select",{value:a,onChange:w=>c(w.currentTarget.value),children:[d("option",{value:"instance",children:"\uC120\uD0DD\uD55C \uC778\uC2A4\uD134\uC2A4"}),d("option",{value:"component",children:"\uACF5\uC6A9 \uCEF4\uD3EC\uB10C\uD2B8"}),d("option",{value:"page",children:"\uD604\uC7AC \uD398\uC774\uC9C0"}),d("option",{value:"project",children:"\uD504\uB85C\uC81D\uD2B8 \uC804\uCCB4"})]})]}),d("button",{type:"button",class:"primary",disabled:!i.trim()||g>0||r!=="connected",onClick:h,children:"\uC694\uCCAD \uBCF4\uB0B4\uAE30"})]}),r!=="connected"?d("div",{class:"error-banner",role:"status",children:["\uC5F0\uACB0 \uC0C1\uD0DC: ",Bn[r],". Bridge \uC5F0\uACB0 \uD6C4 \uC694\uCCAD\uD560 \uC218 \uC788\uC2B5\uB2C8\uB2E4."]}):null]})]})}function Wo({panelRef:e,position:t,task:n,followUpOpen:o,followUpText:r,composingRef:i,busyAction:a,onCancel:l,onAccept:f,onRevert:c,onToggleFollowUp:h,onFollowUpText:_,onFollowUp:s,onNewRequest:g,onDismiss:E}){let w=de.has(n.status),R=n.changedFiles.length>0||!!n.diff,C=n.status==="review"||(n.status==="failed"||n.status==="canceled")&&R,S=n.status==="review"||n.status==="accepted"||n.status==="reverted",y=n.status==="accepted"||n.status==="reverted"||(n.status==="failed"||n.status==="canceled")&&!R,X=Un.has(n.status)||n.verification==="failed",B=X?"error":n.status==="canceled"?"canceled":S?"complete":"active",j=n.logs.slice(-4),te=M=>{ut({key:M.key,shiftKey:M.shiftKey,isComposing:M.isComposing},!!i.current)&&(M.preventDefault(),s())};return d("section",{id:"visual-task-strip",ref:e,class:"strip",style:{left:`${t.left}px`,top:`${t.top}px`},"aria-label":"\uC791\uC5C5 \uC9C4\uD589\uACFC \uAC80\uD1A0",children:[d("header",{class:"strip-head",children:[d("span",{class:"strip-title",children:L(n.requestText,72)}),d("span",{class:"strip-code machine",children:n.id?`TASK ${n.id.slice(0,8)}`:"DISPATCH"})]}),d("div",{class:"strip-body",children:[d("div",{class:"status-row",role:"status",children:[d("span",{class:"phase-mark","data-state":n.status,"data-terminal":S?"true":"false","data-error":X?"true":"false","aria-hidden":"true"}),d("span",{class:"phase-copy",children:[d("strong",{children:_t[n.status]}),d("span",{children:n.logs.at(-1)??"Bridge\uC5D0\uC11C \uC791\uC5C5 \uC0C1\uD0DC\uB97C \uAE30\uB2E4\uB9AC\uB294 \uC911\uC785\uB2C8\uB2E4."})]}),d("span",{class:"phase-count machine",children:[n.changedFiles.length," files"]})]}),d("div",{class:"progress-track","data-active":w?"true":"false","data-outcome":B,children:d("span",{})}),j.length>0?d("ul",{class:"log-summary","aria-label":"\uCD5C\uADFC \uC791\uC5C5 \uB85C\uADF8",children:j.map((M,U)=>d("li",{children:M},`${U}-${M}`))}):d("p",{class:"empty-line",children:"\uC544\uC9C1 \uD45C\uC2DC\uD560 \uC791\uC5C5 \uB85C\uADF8\uAC00 \uC5C6\uC2B5\uB2C8\uB2E4."}),n.error?d("div",{class:"error-banner",role:"alert",children:["\uC624\uB958: ",n.error]}):null,n.unavailableArtifacts&&n.unavailableArtifacts.length>0?d("div",{class:"error-banner",role:"status",children:["\uC77C\uBD80 \uC791\uC5C5 \uC815\uBCF4\uB97C \uBD88\uB7EC\uC624\uC9C0 \uBABB\uD588\uC2B5\uB2C8\uB2E4: ",n.unavailableArtifacts.join(", "),". \uC791\uC5C5 \uBCF4\uB4DC\uC5D0\uC11C \uB2E4\uC2DC \uD655\uC778\uD574 \uC8FC\uC138\uC694."]}):null,n.status==="unsafe"?d("div",{class:"error-banner",role:"alert",children:"\uD5C8\uC6A9 \uBC94\uC704 \uBC16\uC758 \uD30C\uC77C \uB610\uB294 Git \uC0C1\uD0DC\uAC00 \uC791\uC5C5 \uC911 \uBC14\uB00C\uC5B4 \uC790\uB3D9 \uC720\uC9C0\xB7\uB418\uB3CC\uB9AC\uAE30\uB97C \uC7A0\uAC14\uC2B5\uB2C8\uB2E4. \uC544\uB798 diff\uC5D0\uB294 \uD5C8\uC6A9\uB41C \uACBD\uB85C\uB9CC \uD45C\uC2DC\uB429\uB2C8\uB2E4. \uC791\uC5C5 \uC624\uB958\uC640 Git \uC0C1\uD0DC\uB97C \uD655\uC778\uD55C \uB4A4 Git\uC5D0\uC11C \uBCC0\uACBD\uC744 \uC9C1\uC811 \uC720\uC9C0\uD558\uAC70\uB098 \uB418\uB3CC\uB9AC\uC138\uC694."}):null,n.changedFiles.length>0||C||S||n.status==="unsafe"?d(ee,{children:[d("div",{class:"review-summary",children:[n.changedFiles.length>0?d("ul",{class:"file-list","aria-label":"\uBCC0\uACBD \uD30C\uC77C",children:n.changedFiles.map(M=>d("li",{children:["\u0394\xA0 ",M]},M))}):d("p",{class:"empty-line",children:"\uBCC0\uACBD \uD30C\uC77C\uC774 \uBCF4\uACE0\uB418\uC9C0 \uC54A\uC558\uC2B5\uB2C8\uB2E4."}),d("div",{class:"verification","data-status":n.verification??"unverified",children:[d("strong",{children:"\uAC80\uC99D"}),d("span",{children:jo(n.verification)})]})]}),d("details",{class:"diff",children:[d("summary",{children:"Unified diff \uBCF4\uAE30"}),d("pre",{class:"diff-code",children:n.diff||"Diff\uB97C \uC544\uC9C1 \uBC1B\uC9C0 \uBABB\uD588\uC2B5\uB2C8\uB2E4."})]})]}):null,d("div",{class:"actions",children:[w?d("button",{type:"button",class:"quiet",disabled:!n.id||a,onClick:l,children:"\uC791\uC5C5 \uCDE8\uC18C"}):null,C?d(ee,{children:[d("button",{type:"button",class:"primary",disabled:!n.id||a,onClick:f,children:"\uBCC0\uACBD \uC720\uC9C0"}),d("button",{type:"button",class:"secondary",disabled:!n.id||a,onClick:h,children:"\uD6C4\uC18D \uC218\uC815"}),d("button",{type:"button",class:"danger",disabled:!n.id||a,onClick:c,children:"\uB418\uB3CC\uB9AC\uAE30"})]}):null,y?d("button",{type:"button",class:"secondary",onClick:g,children:"\uC0C8 \uC694\uCCAD"}):null,w?null:d("button",{type:"button",class:"quiet",title:"\uC791\uC5C5 \uB0B4\uC5ED\uC740 \uC791\uC5C5 \uBCF4\uB4DC\uC5D0 \uB0A8\uAE30\uACE0 \uC774 \uD328\uB110\uB9CC \uB2EB\uAE30",onClick:E,children:"\uB2EB\uAE30"})]}),o&&C?d("div",{class:"follow-up",children:[d("label",{class:"field-label",for:"visual-follow-up",children:"\uD6C4\uC18D \uC218\uC815 \uB0B4\uC6A9"}),d("textarea",{id:"visual-follow-up",class:"request-field",value:r,maxLength:1e4,placeholder:"\uD604\uC7AC \uBCC0\uACBD\uC744 \uAE30\uC900\uC73C\uB85C \uCD94\uAC00\uD560 \uB0B4\uC6A9\uC744 \uC785\uB825\uD558\uC138\uC694.",onInput:M=>_(M.currentTarget.value),onCompositionStart:()=>{i.current=!0},onCompositionEnd:()=>{i.current=!1},onKeyDown:te}),d("button",{type:"button",class:"primary",disabled:!r.trim()||a,onClick:s,children:"\uD6C4\uC18D \uC694\uCCAD \uBCF4\uB0B4\uAE30"})]}):null]})]})}function Ko({task:e,busyAction:t,onExpand:n,onCancel:o}){let r=de.has(e.status),i=["review","accepted","reverted"].includes(e.status),a=Un.has(e.status)||e.verification==="failed",l="visual-task-compact-phase",f="visual-task-compact-request",c="visual-task-compact-action";return d("section",{class:"task-compact","data-active":r?"true":"false","data-error":a?"true":"false","aria-label":"\uCD5C\uC18C\uD654\uB41C \uC791\uC5C5 \uC0C1\uD0DC",children:[d("button",{type:"button",class:"task-compact-main","aria-labelledby":`${l} ${f} ${c}`,onClick:n,children:[d("span",{class:"phase-mark","data-state":e.status,"data-terminal":i?"true":"false","data-error":a?"true":"false","aria-hidden":"true"}),d("span",{class:"task-compact-copy",children:[d("strong",{id:l,children:_t[e.status]}),d("span",{id:f,class:"task-compact-request",children:e.requestText}),d("span",{id:c,class:"visually-hidden",children:"\uC791\uC5C5 \uC0C1\uC138 \uD3BC\uCE58\uAE30"})]})]}),r?d("button",{type:"button",class:"task-compact-cancel",disabled:!e.id||t,onClick:o,children:"\uCDE8\uC18C"}):null]})}function Vo({host:e}){let t=ae(()=>je(location.hash).token!==null,[]),n=ae(gn,[]),o=ae(mn,[]),r=W(null),i=W([]),a=W(""),l=W(void 0),f=W(null),c=W(!0),h=W(null),_=W(null),s=W(!1),g=W(1),E=W(null),w=W(null),R=W(null),[C,S]=$(t),[y,X]=$("element"),[B,j]=$([]),[te,M]=$(null),[U,D]=$(null),[q,re]=$(!1),[Ee,bt]=$(""),[_e,Ve]=$("instance"),[Y,On]=$(1),[vt,xt]=$(0),[ne,jn]=$({state:"connecting",lastSequence:0}),[Ce,Ye]=$("current"),[yt,wt]=$(null),[Dn,kt]=$(!1),[m,K]=$(null),[O,J]=$(!1),[St,Ge]=$(!1),[be,Tt]=$(""),[Et,Ct]=$(null),Rt=Et!==null&&Et.taskId===m?.id,[It,zn]=$({left:12,top:64,placement:"below"});i.current=B,a.current=Ee,g.current=Y,l.current=m?.id;let Pt=!!(m&&(de.has(m.status)||m.status==="review"&&!["passed","partial","failed"].includes(m.verification??""))),Re=Q(()=>({url:location.href,pathname:location.pathname,title:document.title,viewport:{width:innerWidth,height:innerHeight},renderRevision:g.current}),[]),Ie=Q(async u=>{let p=await yn(n,u);c.current&&K(b=>b?.id===u?{...b,changedFiles:p.changedFiles.length>0?p.changedFiles:b.changedFiles,diff:p.diff||b.diff,logs:p.logs.length>0?p.logs:b.logs,unavailableArtifacts:p.unavailable}:b)},[n]),Xe=Q(u=>{let p=ke(u),b=u.taskId??p?.id,k=Sn(u),x=Tn(u),T=En(u);if(u.type==="project.state"){let v=u.payload;typeof v?.projectId=="string"&&Ye(v.projectId)}if(u.type==="command.error"){let v=u.payload;typeof v?.message=="string"&&K(A=>A&&{...A,status:A.status==="queued"&&!A.id?"failed":A.status,error:v.message});return}let P=kn(u,o,l.current);if(!(!P.accept||!P.taskId)){if(P.bind&&(l.current=P.taskId),p?.scope&&Ve(p.scope),u.type==="task.verification_result"){let v=u.payload,A=v.verificationStatus??v.status;typeof A=="string"&&K(G=>G&&{...G,verification:A})}(b||k||x||T.length>0||p)&&K(v=>{let A=v&&(!v.id||v.id===b)?v:{status:k??p?.status??"queued",requestText:p?.requestText??a.current,changedFiles:[],logs:[],diff:""},G=p?.error?.message??u.payload?.error?.message;return{...A,...b?{id:b}:{},status:k??p?.status??A.status,requestText:p?.requestText??A.requestText,changedFiles:T.length>0?T:p?.changedFiles?.length?p.changedFiles:A.changedFiles,logs:x?[...A.logs,x].slice(-40):A.logs,...p?.verificationStatus?{verification:p.verificationStatus}:{},...typeof G=="string"?{error:G}:{}}}),b&&(u.type==="task.diff_ready"||u.type==="task.completed"||u.type==="task.failed")&&Ie(b)}},[o,Ie]);V(()=>{let u=!0;c.current=!0;let p=!0,b=[],k=new AbortController,x=()=>{if(p){if(p=!1,window.clearTimeout(T),u){if(!l.current)for(let v of b){let A=ke(v);if(A?.originBrowserSessionId===o){l.current=A.id;break}}for(let v of b)Xe(v)}b.length=0}},T=window.setTimeout(()=>{x(),k.abort()},Uo),P=new ze({token:n,browserSessionId:o,getPageState:Re,onSnapshot:v=>{u&&(jn(v),v.projectId&&Ye(v.projectId))},onEvent:v=>{u&&(p?b.push(v):Xe(v))}});return r.current=P,P.connect(),_n(n).then(v=>{u&&v&&Ye(v)}).catch(()=>{}),bn(n,o,k.signal).then(v=>{!u||!p||!v||(K(A=>A||(l.current=v.id,{id:v.id,status:v.status,requestText:v.requestText,changedFiles:v.changedFiles,logs:[],diff:"",...v.verificationStatus?{verification:v.verificationStatus}:{},...v.error?.message?{error:v.error.message}:{}})),Ie(v.id))}).catch(()=>{}).finally(x),()=>{u=!1,p=!1,window.clearTimeout(T),k.abort(),c.current=!1,b.length=0,f.current=null,P.close(),r.current=null}},[o,Xe,Ie,Re,n]),V(()=>{let u=!0;return kt(!1),hn(n).then(p=>{u&&wt(p)}).catch(()=>{u&&(wt(null),kt(!0))}),()=>{u=!1}},[n]),V(()=>{e.dataset.active=C?"true":"false",C&&requestAnimationFrame(()=>{R.current?.querySelector('button[aria-pressed="true"]')?.focus()})},[e,C]),V(()=>{if(!Pt)return;let u,p,b=()=>{u!==void 0&&(clearTimeout(u),u=void 0),p!==void 0&&(clearTimeout(p),p=void 0),On(x=>x+1)},k=new MutationObserver(x=>{x.some(({target:P})=>P!==e&&!e.contains(P))&&(u!==void 0&&clearTimeout(u),u=window.setTimeout(b,150),p===void 0&&(p=window.setTimeout(b,1e3)))});return k.observe(document.documentElement,{attributes:!0,characterData:!0,childList:!0,subtree:!0}),()=>{k.disconnect(),u!==void 0&&clearTimeout(u),p!==void 0&&clearTimeout(p)}},[e,Pt]),V(()=>{r.current?.send("browser.page_state",Re())},[Re,Y]),V(()=>{if(ne.state!=="connected"||!m?.id||m.verification==="passed"||m.verification==="partial"||m.verification==="failed"||!de.has(m.status)&&m.status!=="review")return;let u=h.current;if(!u){let T=`${m.id}:page-reloaded`;if(E.current===T)return;r.current?.send("verification.target_state",{taskId:m.id,state:"page-reloaded",renderRevision:Y,targetCount:0,foundCount:0,changedCount:0})&&(E.current=T);return}let p=u.selection.targets;if(u.selection.mode==="page"||p.length===0||Y<=u.page.renderRevision)return;let b=`${m.id}:${Y}`;if(E.current===b)return;let k;try{k=qn(p)}catch{k={state:"unverified",targetCount:p.length,foundCount:0,changedCount:0}}r.current?.send("verification.target_state",{taskId:m.id,renderRevision:Y,...k})&&(E.current=b)},[ne.state,Y,m?.id,m?.status,m?.verification]),V(()=>{let u=(v,A)=>{let G=L(A.map(Do).join(" "),2e3);G&&r.current?.send("verification.console_events",{events:[{level:v,message:G,createdAt:new Date().toISOString()}]})},p=console.error,b=console.warn,k=(...v)=>{p.apply(console,v),u("error",v)},x=(...v)=>{b.apply(console,v),u("warning",v)},T=v=>{u("error",[v.error instanceof Error?v.error:v.message])},P=v=>{u("unhandled",[v.reason])};return console.error=k,console.warn=x,window.addEventListener("error",T),window.addEventListener("unhandledrejection",P),()=>{console.error===k&&(console.error=p),console.warn===x&&(console.warn=b),window.removeEventListener("error",T),window.removeEventListener("unhandledrejection",P)}},[]);let ie=Q(()=>{j([]),M(null),D(null),re(!1),bt(""),Ge(!1),_.current=null},[]),ve=Q(u=>{let p=u.map(b=>({id:crypto.randomUUID(),element:b,context:null}));j(p);for(let[b,k]of p.entries())he(k.element,b).then(x=>{j(T=>T.map(P=>P.id===k.id?{...P,context:x}:P))})},[]),Wn=Q(u=>{ie(),J(!!m),X(u),Ve(u==="page"?"page":"instance"),u==="page"&&(ve(Ke()),re(!0))},[ve,ie,m]);V(()=>{let u=p=>{if(p.key.toLowerCase()==="g"&&p.shiftKey&&(p.metaKey||p.ctrlKey)){p.preventDefault(),p.stopPropagation(),S(b=>!b);return}C&&(p.key==="Escape"?q?ie():S(!1):p.key==="Enter"&&y==="multi"&&i.current.length>0&&!q&&(!m||O)&&!Te(p)&&(p.preventDefault(),re(!0)))};return window.addEventListener("keydown",u,!0),()=>window.removeEventListener("keydown",u,!0)},[y,C,q,ie,m,O]),V(()=>{if(!C||q||m&&de.has(m.status)&&!O){M(null);return}let u=x=>{if(y==="region"&&_.current){D(ct(_.current,{x:x.clientX,y:x.clientY}));return}if(y==="page"||Te(x))return;let T=gt(x.clientX,x.clientY);M(P=>P===T?P:T)},p=x=>{x.button!==0||Te(x)||y==="page"||(x.preventDefault(),x.stopImmediatePropagation(),y==="region"&&(_.current={x:x.clientX,y:x.clientY},D({x:x.clientX,y:x.clientY,width:0,height:0}),j([])))},b=x=>{if(x.button!==0||Te(x)||y==="page"||(x.preventDefault(),x.stopImmediatePropagation(),y!=="region"||!_.current))return;let T=ct(_.current,{x:x.clientX,y:x.clientY});if(_.current=null,T.width<5||T.height<5){D(null);return}D(T),ve(Fn(T)),re(!0)},k=x=>{if(y==="region"||y==="page"||x.button!==0||Te(x))return;let T=gt(x.clientX,x.clientY);if(!T)return;if(x.preventDefault(),x.stopImmediatePropagation(),J(!!m),!(y==="multi"||x.shiftKey)){ve([T]),re(!0);return}y!=="multi"&&X("multi");let v=i.current,A=v.find(xe=>xe.element===T);if(A){j(v.filter(xe=>xe.id!==A.id));return}if(v.length>=8)return;let G={id:crypto.randomUUID(),element:T,context:null};j([...v,G]),he(T,v.length).then(xe=>{j(Gn=>Gn.map(Je=>Je.id===G.id?{...Je,context:xe}:Je))})};return document.addEventListener("pointermove",u,!0),document.addEventListener("pointerdown",p,!0),document.addEventListener("pointerup",b,!0),document.addEventListener("click",k,!0),()=>{document.removeEventListener("pointermove",u,!0),document.removeEventListener("pointerdown",p,!0),document.removeEventListener("pointerup",b,!0),document.removeEventListener("click",k,!0)}},[ve,y,C,q,m,O]),V(()=>{let u=0,p=()=>{cancelAnimationFrame(u),u=requestAnimationFrame(()=>xt(b=>b+1))};return window.addEventListener("resize",p),window.addEventListener("scroll",p,!0),()=>{cancelAnimationFrame(u),window.removeEventListener("resize",p),window.removeEventListener("scroll",p,!0)}},[]),V(()=>{if(!q&&!m)return;let u=w.current;if(!u)return;let p=0,b=new ResizeObserver(()=>{cancelAnimationFrame(p),p=requestAnimationFrame(()=>xt(k=>k+1))});return b.observe(u),()=>{cancelAnimationFrame(p),b.disconnect()}},[q,m?.id]);let At=ae(()=>{if(U)return U;let u=B.at(-1);return u?.element.isConnected?ue(u.element):{x:12,y:52,width:1,height:1}},[vt,U,B]);an(()=>{if(!q&&!m)return;let u=w.current;if(!u)return;let p=R.current?.getBoundingClientRect().bottom??52;zn(ln(At,{width:u.offsetWidth||408,height:u.offsetHeight||300},{width:innerWidth,height:innerHeight},12,10,p+10))},[At,St,q,m?.changedFiles.length,m?.diff,m?.logs.length,m?.status]);let Kn=Q(async()=>{let u=Ee.trim();if(!u||ne.state!=="connected")return;let p=await Promise.all(i.current.map(async(x,T)=>x.context??he(x.element,T)));if(y==="element"&&p.length===0)return;if(y==="page"&&p.length===0){let x=Ke();p=await Promise.all(x.map((T,P)=>he(T,P)))}let b=ht({projectId:Ce,browserSessionId:o,mode:y,targets:p,...U?{region:U}:{},requestText:u,scope:_e,renderRevision:Y});if(h.current=b,!r.current?.send("task.create",b)){J(!1),K({status:"failed",requestText:u,changedFiles:[],logs:[],diff:"",error:"Bridge \uC5F0\uACB0\uC774 \uB04A\uC5B4\uC838 \uC694\uCCAD\uC744 \uBCF4\uB0B4\uC9C0 \uBABB\uD588\uC2B5\uB2C8\uB2E4. \uC7AC\uC5F0\uACB0 \uD6C4 \uB2E4\uC2DC \uC2DC\uB3C4\uD558\uC138\uC694."});return}K({status:"queued",requestText:u,changedFiles:[],logs:["\uC694\uCCAD\uC744 Bridge writer queue\uC5D0 \uC804\uB2EC\uD588\uC2B5\uB2C8\uB2E4."],diff:""}),J(!1),re(!1)},[o,ne.state,y,Ce,U,Y,Ee,_e]),Pe=Q(async u=>{if(!m?.id||f.current?.taskId===m.id)return;let p={taskId:m.id};f.current=p,Ct(p);try{if(await wn(n,p.taskId,u),f.current!==p)return;K(b=>b?.id===p.taskId?{...b,status:u==="accept"?"accepted":u==="revert"?"reverted":"canceled",logs:[...b.logs,u==="accept"?"\uD604\uC7AC working tree \uBCC0\uACBD\uC744 \uC720\uC9C0\uD588\uC2B5\uB2C8\uB2E4.":u==="revert"?"\uCD5C\uC2E0 task \uBCC0\uACBD\uC744 \uB418\uB3CC\uB838\uC2B5\uB2C8\uB2E4.":"\uC791\uC5C5 \uCDE8\uC18C\uB97C \uC694\uCCAD\uD588\uC2B5\uB2C8\uB2E4."]}:b)}catch(b){if(f.current!==p)return;K(k=>k?.id===p.taskId?{...k,error:b instanceof Error?b.message:"\uC791\uC5C5 \uBA85\uB839\uC744 \uC644\uB8CC\uD558\uC9C0 \uBABB\uD588\uC2B5\uB2C8\uB2E4."}:k)}finally{f.current===p&&(f.current=null,Ct(b=>b===p?null:b))}},[m?.id,n]),Vn=Q(async()=>{if(!m?.id||!be.trim())return;let u=h.current;if(!u){let k=Ke(),x=await Promise.all(k.map((T,P)=>he(T,P)));u=ht({projectId:Ce,browserSessionId:o,mode:"page",targets:x,requestText:m.requestText,scope:"page",renderRevision:Y})}let p={...u,page:{...u.page,url:location.href,pathname:location.pathname,title:document.title,viewport:{width:innerWidth,height:innerHeight},devicePixelRatio:devicePixelRatio||1,scroll:{x:scrollX,y:scrollY},renderRevision:Y},request:{text:be.trim(),scope:_e}};if(!r.current?.send("task.follow_up",{taskId:m.id,parentTaskId:m.id,contextBundle:p})){K(k=>k&&{...k,error:"Bridge\uAC00 \uC5F0\uACB0\uB418\uC9C0 \uC54A\uC544 \uD6C4\uC18D \uC694\uCCAD\uC744 \uBCF4\uB0B4\uC9C0 \uBABB\uD588\uC2B5\uB2C8\uB2E4."});return}K({status:"queued",requestText:be.trim(),changedFiles:[],logs:[`${m.id.slice(0,8)} task\uB97C \uAE30\uC900\uC73C\uB85C \uD6C4\uC18D \uC694\uCCAD\uC744 \uBCF4\uB0C8\uC2B5\uB2C8\uB2E4.`],diff:""}),J(!1),Tt(""),Ge(!1),h.current=p},[o,be,Ce,Y,_e,m?.id,m?.requestText]),Yn=B.filter(u=>u.element.isConnected).map(u=>({item:u,rect:ue(u.element)})),Lt=te?.isConnected&&!B.some(u=>u.element===te)?ue(te):null,qt=y==="element"?"\uC694\uC18C\uB97C \uD074\uB9AD\uD558\uC138\uC694 \xB7 Shift+Click\uC740 \uC5EC\uB7EC \uC694\uC18C":y==="multi"?`\uC694\uC18C\uB97C \uC120\uD0DD\uD558\uC138\uC694 (${B.length}/8) \xB7 Enter\uB85C \uC694\uCCAD \uC791\uC131`:y==="region"?"\uC694\uCCAD\uD560 \uC601\uC5ED\uC744 \uB4DC\uB798\uADF8\uD558\uC138\uC694":"\uD604\uC7AC \uD398\uC774\uC9C0\uC758 \uC8FC\uC694 \uCEE8\uD14D\uC2A4\uD2B8\uB97C \uC218\uC9D1\uD588\uC2B5\uB2C8\uB2E4";return d("div",{class:"visual-shell","data-open":C?"true":"false",children:[d("nav",{ref:R,class:"toolbar","aria-label":"Visual Bridge \uB3C4\uAD6C",children:[d("span",{class:"brand-mark",children:"Visual Bridge"}),d("div",{class:"mode-tabs",children:[["element","\uC694\uC18C"],["multi","\uC5EC\uB7EC \uC694\uC18C"],["region","\uC601\uC5ED"],["page","\uD398\uC774\uC9C0"]].map(([u,p])=>d("button",{type:"button","aria-pressed":y===u?"true":"false",disabled:!!(m&&de.has(m.status)&&!O),onClick:()=>Wn(u),children:p},u))}),y==="multi"&&B.length>0&&!q&&(!m||O)?d("button",{type:"button",class:"primary",onClick:()=>re(!0),children:"\uC694\uCCAD \uC791\uC131"}):null,m&&!q?d("button",{type:"button",class:"task-toggle","aria-controls":"visual-task-strip","aria-expanded":O?"false":"true",title:O?"\uCD5C\uC18C\uD654\uB41C \uC791\uC5C5 \uC0C1\uC138 \uD3BC\uCE58\uAE30":"\uC791\uC5C5 \uC0C1\uD0DC\uB97C \uB0A8\uAE30\uACE0 \uD328\uB110 \uCD5C\uC18C\uD654",onClick:()=>{if(O){J(!1);return}ie(),J(!0)},children:O?"\uC791\uC5C5 \uD3BC\uCE58\uAE30":"\uC791\uC5C5 \uCD5C\uC18C\uD654"}):null,yt?d("a",{class:"viewer-link",href:yt,target:"_blank",rel:"noopener","aria-label":"\uC804\uCCB4\uD654\uBA74 \uC791\uC5C5 \uBCF4\uB4DC\uB97C \uC0C8 \uD0ED\uC5D0\uC11C \uC5F4\uAE30",title:"\uC804\uCCB4\uD654\uBA74 \uC791\uC5C5 \uBCF4\uB4DC \uC5F4\uAE30",children:"\uC791\uC5C5 \uBCF4\uB4DC \u2197"}):d("button",{type:"button",class:"viewer-link",disabled:!0,title:Dn?"\uC791\uC5C5 \uBCF4\uB4DC \uC5F0\uACB0\uC744 \uC900\uBE44\uD558\uC9C0 \uBABB\uD588\uC2B5\uB2C8\uB2E4":"\uC791\uC5C5 \uBCF4\uB4DC \uC900\uBE44 \uC911",children:"\uC791\uC5C5 \uBCF4\uB4DC"}),d("span",{class:"connection",role:"status",children:[d("span",{class:"state-dot","data-state":ne.state,"aria-hidden":"true"}),d("span",{class:"connection-label connection-label-full",children:Bn[ne.state]}),d("span",{class:"connection-label connection-label-compact",children:Bo[ne.state]})]})]}),m&&O?d(Ko,{task:m,busyAction:Rt,onExpand:()=>J(!1),onCancel:()=>{Pe("cancel")}}):null,!q&&(!m||O||!de.has(m.status))&&Lt?d($n,{rect:Lt,kind:"hover"}):null,y!=="page"&&y!=="region"&&(!m||!O||q)?Yn.map(({item:u,rect:p},b)=>d($n,{rect:p,kind:"selected",...y==="multi"?{label:String(b+1)}:{}},u.id)):null,U&&(!m||!O||q)?d("div",{class:"region-box",style:{left:`${U.x}px`,top:`${U.y}px`,width:`${U.width}px`,height:`${U.height}px`},"aria-hidden":"true",children:d("span",{class:"region-box-label machine",children:"\uC601\uC5ED"})}):null,q&&(!m||O)?d(zo,{panelRef:w,position:It,selection:B,mode:y,connectionState:ne.state,requestText:Ee,scope:_e,composingRef:s,onRequestText:bt,onScope:Ve,onSubmit:()=>{Kn()}}):null,m&&!O?d(Wo,{panelRef:w,position:It,task:m,followUpOpen:St,followUpText:be,composingRef:s,busyAction:Rt,onCancel:()=>{Pe("cancel")},onAccept:()=>{Pe("accept")},onRevert:()=>{Pe("revert")},onToggleFollowUp:()=>Ge(u=>!u),onFollowUpText:Tt,onFollowUp:()=>{Vn()},onNewRequest:()=>{K(null),J(!1),ie()},onDismiss:()=>{l.current=void 0,K(null),J(!1),ie()}}):null,!q&&(!m||O)?d("div",{class:"selection-hint",children:qt}):null,d("div",{class:"visually-hidden","aria-live":"polite",children:m?`${_t[m.status]}. ${m.logs.at(-1)??""}`:qt}),d("span",{class:"visually-hidden",children:"Overlay \uC5F4\uAE30 \uB610\uB294 \uB2EB\uAE30: Command \uB610\uB294 Control + Shift + G"})]})}function Hn(){if(document.getElementById(le)||!document.body)return;let e=document.createElement("div");e.id=le,e.dataset.visualBridgeIgnore="true",e.dataset.active="false";let t=e.attachShadow({mode:"open"}),n=document.createElement("style");n.textContent=Nn;let o=document.createElement("div");o.dataset.visualBridgeIgnore="true",t.append(n,o),document.body.append(e),Gt(d(Vo,{host:e}),o)}document.readyState==="loading"?document.addEventListener("DOMContentLoaded",Hn,{once:!0}):Hn();
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
var xe,v,rt,tn,O,Ze,it,ot,Ce,he,ne,at,Fe,Ae,Pe,nn,me={},ve=[],rn=/acit|ex(?:s|g|n|p|$)|rph|grid|ows|mnc|ntw|ine[ch]|zoo|^ord|itera/i,ye=Array.isArray;function B(e,t){for(var n in t)e[n]=t[n];return e}function qe(e){e&&e.parentNode&&e.parentNode.removeChild(e)}function on(e,t,n){var r,s,o,c={};for(o in t)o=="key"?r=t[o]:o=="ref"?s=t[o]:c[o]=t[o];if(arguments.length>2&&(c.children=arguments.length>3?xe.call(arguments,2):n),typeof e=="function"&&e.defaultProps!=null)for(o in e.defaultProps)c[o]===void 0&&(c[o]=e.defaultProps[o]);return ge(e,c,r,s,null)}function ge(e,t,n,r,s){var o={type:e,props:t,key:n,ref:r,__k:null,__:null,__b:0,__e:null,__c:null,constructor:void 0,__v:s??++rt,__i:-1,__u:0};return s==null&&v.vnode!=null&&v.vnode(o),o}function V(e){return e.children}function _e(e,t){this.props=e,this.context=t}function Z(e,t){if(t==null)return e.__?Z(e.__,e.__i+1):null;for(var n;t<e.__k.length;t++)if((n=e.__k[t])!=null&&n.__e!=null)return n.__e;return typeof e.type=="function"?Z(e):null}function an(e){if(e.__P&&e.__d){var t=e.__v,n=t.__e,r=[],s=[],o=B({},t);o.__v=t.__v+1,v.vnode&&v.vnode(o),je(e.__P,o,t,e.__n,e.__P.namespaceURI,32&t.__u?[n]:null,r,n??Z(t),!!(32&t.__u),s),o.__v=t.__v,o.__.__k[o.__i]=o,ut(r,o,s),t.__e=t.__=null,o.__e!=n&&st(o)}}function st(e){if((e=e.__)!=null&&e.__c!=null)return e.__e=e.__c.base=null,e.__k.some(function(t){if(t!=null&&t.__e!=null)return e.__e=e.__c.base=t.__e}),st(e)}function et(e){(!e.__d&&(e.__d=!0)&&O.push(e)&&!be.__r++||Ze!=v.debounceRendering)&&((Ze=v.debounceRendering)||it)(be)}function be(){try{for(var e,t=1;O.length;)O.length>t&&O.sort(ot),e=O.shift(),t=O.length,an(e)}finally{O.length=be.__r=0}}function lt(e,t,n,r,s,o,c,d,f,l,h){var b,a,p,x,w,k,y,g=r&&r.__k||ve,A=t.length;for(f=sn(n,t,g,f,A),b=0;b<A;b++)(p=n.__k[b])!=null&&(a=p.__i!=-1&&g[p.__i]||me,p.__i=b,k=je(e,p,a,s,o,c,d,f,l,h),x=p.__e,p.ref&&a.ref!=p.ref&&(a.ref&&$e(a.ref,null,p),h.push(p.ref,p.__c||x,p)),w==null&&x!=null&&(w=x),(y=!!(4&p.__u))||a.__k===p.__k?(f=ct(p,f,e,y),y&&a.__e&&(a.__e=null)):typeof p.type=="function"&&k!==void 0?f=k:x&&(f=x.nextSibling),p.__u&=-7);return n.__e=w,f}function sn(e,t,n,r,s){var o,c,d,f,l,h=n.length,b=h,a=0;for(e.__k=new Array(s),o=0;o<s;o++)(c=t[o])!=null&&typeof c!="boolean"&&typeof c!="function"?(typeof c=="string"||typeof c=="number"||typeof c=="bigint"||c.constructor==String?c=e.__k[o]=ge(null,c,null,null,null):ye(c)?c=e.__k[o]=ge(V,{children:c},null,null,null):c.constructor===void 0&&c.__b>0?c=e.__k[o]=ge(c.type,c.props,c.key,c.ref?c.ref:null,c.__v):e.__k[o]=c,f=o+a,c.__=e,c.__b=e.__b+1,d=null,(l=c.__i=ln(c,n,f,b))!=-1&&(b--,(d=n[l])&&(d.__u|=2)),d==null||d.__v==null?(l==-1&&(s>h?a--:s<h&&a++),typeof c.type!="function"&&(c.__u|=4)):l!=f&&(l==f-1?a--:l==f+1?a++:(l>f?a--:a++,c.__u|=4))):e.__k[o]=null;if(b)for(o=0;o<h;o++)(d=n[o])!=null&&(2&d.__u)==0&&(d.__e==r&&(r=Z(d)),ft(d,d));return r}function ct(e,t,n,r){var s,o;if(typeof e.type=="function"){for(s=e.__k,o=0;s&&o<s.length;o++)s[o]&&(s[o].__=e,t=ct(s[o],t,n,r));return t}e.__e!=t&&(r&&(t&&e.type&&!t.parentNode&&(t=Z(e)),n.insertBefore(e.__e,t||null)),t=e.__e);do t=t&&t.nextSibling;while(t!=null&&t.nodeType==8);return t}function ln(e,t,n,r){var s,o,c,d=e.key,f=e.type,l=t[n],h=l!=null&&(2&l.__u)==0;if(l===null&&d==null||h&&d==l.key&&f==l.type)return n;if(r>(h?1:0)){for(s=n-1,o=n+1;s>=0||o<t.length;)if((l=t[c=s>=0?s--:o++])!=null&&(2&l.__u)==0&&d==l.key&&f==l.type)return c}return-1}function tt(e,t,n){t[0]=="-"?e.setProperty(t,n??""):e[t]=n==null?"":typeof n!="number"||rn.test(t)?n:n+"px"}function fe(e,t,n,r,s){var o,c;e:if(t=="style")if(typeof n=="string")e.style.cssText=n;else{if(typeof r=="string"&&(e.style.cssText=r=""),r)for(t in r)n&&t in n||tt(e.style,t,"");if(n)for(t in n)r&&n[t]==r[t]||tt(e.style,t,n[t])}else if(t[0]=="o"&&t[1]=="n")o=t!=(t=t.replace(at,"$1")),c=t.toLowerCase(),t=c in e||t=="onFocusOut"||t=="onFocusIn"?c.slice(2):t.slice(2),e.l||(e.l={}),e.l[t+o]=n,n?r?n[ne]=r[ne]:(n[ne]=Fe,e.addEventListener(t,o?Pe:Ae,o)):e.removeEventListener(t,o?Pe:Ae,o);else{if(s=="http://www.w3.org/2000/svg")t=t.replace(/xlink(H|:h)/,"h").replace(/sName$/,"s");else if(t!="width"&&t!="height"&&t!="href"&&t!="list"&&t!="form"&&t!="tabIndex"&&t!="download"&&t!="rowSpan"&&t!="colSpan"&&t!="role"&&t!="popover"&&t in e)try{e[t]=n??"";break e}catch{}typeof n=="function"||(n==null||n===!1&&t[4]!="-"?e.removeAttribute(t):e.setAttribute(t,t=="popover"&&n==1?"":n))}}function nt(e){return function(t){if(this.l){var n=this.l[t.type+e];if(t[he]==null)t[he]=Fe++;else if(t[he]<n[ne])return;return n(v.event?v.event(t):t)}}}function je(e,t,n,r,s,o,c,d,f,l){var h,b,a,p,x,w,k,y,g,A,K,L,z,H,G,N,$=t.type;if(t.constructor!==void 0)return null;128&n.__u&&(f=!!(32&n.__u),o=[d=t.__e=n.__e]),(h=v.__b)&&h(t);e:if(typeof $=="function"){b=c.length;try{if(g=t.props,A=$.prototype&&$.prototype.render,K=(h=$.contextType)&&r[h.__c],L=h?K?K.props.value:h.__:r,n.__c?y=(a=t.__c=n.__c).__=a.__E:(A?t.__c=a=new $(g,L):(t.__c=a=new _e(g,L),a.constructor=$,a.render=dn),K&&K.sub(a),a.state||(a.state={}),a.__n=r,p=a.__d=!0,a.__h=[],a._sb=[]),A&&a.__s==null&&(a.__s=a.state),A&&$.getDerivedStateFromProps!=null&&(a.__s==a.state&&(a.__s=B({},a.__s)),B(a.__s,$.getDerivedStateFromProps(g,a.__s))),x=a.props,w=a.state,a.__v=t,p)A&&$.getDerivedStateFromProps==null&&a.componentWillMount!=null&&a.componentWillMount(),A&&a.componentDidMount!=null&&a.__h.push(a.componentDidMount);else{if(A&&$.getDerivedStateFromProps==null&&g!==x&&a.componentWillReceiveProps!=null&&a.componentWillReceiveProps(g,L),t.__v==n.__v||!a.__e&&a.shouldComponentUpdate!=null&&a.shouldComponentUpdate(g,a.__s,L)===!1){t.__v!=n.__v&&(a.props=g,a.state=a.__s,a.__d=!1),t.__e=n.__e,t.__k=n.__k,t.__k.some(function(W){W&&(W.__=t)}),ve.push.apply(a.__h,a._sb),a._sb=[],a.__h.length&&c.push(a);break e}a.componentWillUpdate!=null&&a.componentWillUpdate(g,a.__s,L),A&&a.componentDidUpdate!=null&&a.__h.push(function(){a.componentDidUpdate(x,w,k)})}if(a.context=L,a.props=g,a.__P=e,a.__e=!1,z=v.__r,H=0,A)a.state=a.__s,a.__d=!1,z&&z(t),h=a.render(a.props,a.state,a.context),ve.push.apply(a.__h,a._sb),a._sb=[];else do a.__d=!1,z&&z(t),h=a.render(a.props,a.state,a.context),a.state=a.__s;while(a.__d&&++H<25);a.state=a.__s,a.getChildContext!=null&&(r=B(B({},r),a.getChildContext())),A&&!p&&a.getSnapshotBeforeUpdate!=null&&(k=a.getSnapshotBeforeUpdate(x,w)),G=h!=null&&h.type===V&&h.key==null?pt(h.props.children):h,d=lt(e,ye(G)?G:[G],t,n,r,s,o,c,d,f,l),a.base=t.__e,t.__u&=-161,a.__h.length&&c.push(a),y&&(a.__E=a.__=null)}catch(W){if(c.length=b,t.__v=null,f||o!=null){if(W.then){for(t.__u|=f?160:128;d&&d.nodeType==8&&d.nextSibling;)d=d.nextSibling;o!=null&&(o[o.indexOf(d)]=null),t.__e=d}else if(o!=null)for(N=o.length;N--;)qe(o[N])}else t.__e=n.__e;t.__k==null&&(t.__k=n.__k||[]),W.then||dt(t),v.__e(W,t,n)}}else o==null&&t.__v==n.__v?(t.__k=n.__k,t.__e=n.__e):d=t.__e=cn(n.__e,t,n,r,s,o,c,f,l);return(h=v.diffed)&&h(t),128&t.__u?void 0:d}function dt(e){e&&(e.__c&&(e.__c.__e=!0),e.__k&&e.__k.some(dt))}function ut(e,t,n){for(var r=0;r<n.length;r++)$e(n[r],n[++r],n[++r]);v.__c&&v.__c(t,e),e.some(function(s){try{e=s.__h,s.__h=[],e.some(function(o){o.call(s)})}catch(o){v.__e(o,s.__v)}})}function pt(e){return typeof e!="object"||e==null||e.__b>0?e:ye(e)?e.map(pt):e.constructor!==void 0?null:B({},e)}function cn(e,t,n,r,s,o,c,d,f){var l,h,b,a,p,x,w,k=n.props||me,y=t.props,g=t.type;if(g=="svg"?s="http://www.w3.org/2000/svg":g=="math"?s="http://www.w3.org/1998/Math/MathML":s||(s="http://www.w3.org/1999/xhtml"),o!=null){for(l=0;l<o.length;l++)if((p=o[l])&&"setAttribute"in p==!!g&&(g?p.localName==g:p.nodeType==3)){e=p,o[l]=null;break}}if(e==null){if(g==null)return document.createTextNode(y);e=document.createElementNS(s,g,y.is&&y),d&&(v.__m&&v.__m(t,o),d=!1),o=null}if(g==null)k===y||d&&e.data==y||(e.data=y);else{if(o=g=="textarea"&&y.defaultValue!=null?null:o&&xe.call(e.childNodes),!d&&o!=null)for(k={},l=0;l<e.attributes.length;l++)k[(p=e.attributes[l]).name]=p.value;for(l in k)p=k[l],l=="dangerouslySetInnerHTML"?b=p:l=="children"||l in y||l=="value"&&"defaultValue"in y||l=="checked"&&"defaultChecked"in y||fe(e,l,null,p,s);for(l in y)p=y[l],l=="children"?a=p:l=="dangerouslySetInnerHTML"?h=p:l=="value"?x=p:l=="checked"?w=p:d&&typeof p!="function"||k[l]===p||fe(e,l,p,k[l],s);if(h)d||b&&(h.__html==b.__html||h.__html==e.innerHTML)||(e.innerHTML=h.__html),t.__k=[];else if(b&&(e.innerHTML=""),lt(t.type=="template"?e.content:e,ye(a)?a:[a],t,n,r,g=="foreignObject"?"http://www.w3.org/1999/xhtml":s,o,c,o?o[0]:n.__k&&Z(n,0),d,f),o!=null)for(l=o.length;l--;)qe(o[l]);d&&g!="textarea"||(l="value",g=="progress"&&x==null?e.removeAttribute("value"):x!=null&&(x!==e[l]||g=="progress"&&!x||g=="option"&&x!=k[l])&&fe(e,l,x,k[l],s),l="checked",w!=null&&w!=e[l]&&fe(e,l,w,k[l],s))}return e}function $e(e,t,n){try{if(typeof e=="function"){var r=typeof e.__u=="function";r&&e.__u(),r&&t==null||(e.__u=e(t))}else e.current=t}catch(s){v.__e(s,n)}}function ft(e,t,n){var r,s;if(v.unmount&&v.unmount(e),(r=e.ref)&&(r.current&&r.current!=e.__e||$e(r,null,t)),(r=e.__c)!=null){if(r.componentWillUnmount)try{r.componentWillUnmount()}catch(o){v.__e(o,t)}r.base=r.__P=r.__n=null}if(r=e.__k)for(s=0;s<r.length;s++)r[s]&&ft(r[s],t,n||typeof e.type!="function");n||qe(e.__e),e.__c=e.__=e.__e=void 0}function dn(e,t,n){return this.constructor(e,n)}function ht(e,t,n){var r,s,o,c;t==document&&(t=document.documentElement),v.__&&v.__(e,t),s=(r=typeof n=="function")?null:n&&n.__k||t.__k,o=[],c=[],je(t,e=(!r&&n||t).__k=on(V,null,[e]),s||me,me,t.namespaceURI,!r&&n?[n]:s?null:t.firstChild?xe.call(t.childNodes):null,o,!r&&n?n:s?s.__e:t.firstChild,r,c),ut(o,e,c),e.props.children=null}xe=ve.slice,v={__e:function(e,t,n,r){for(var s,o,c;t=t.__;)if((s=t.__c)&&!s.__)try{if((o=s.constructor)&&o.getDerivedStateFromError!=null&&(s.setState(o.getDerivedStateFromError(e)),c=s.__d),s.componentDidCatch!=null&&(s.componentDidCatch(e,r||{}),c=s.__d),c)return s.__E=s}catch(d){e=d}throw e}},rt=0,tn=function(e){return e!=null&&e.constructor===void 0},_e.prototype.setState=function(e,t){var n;n=this.__s!=null&&this.__s!=this.state?this.__s:this.__s=B({},this.state),typeof e=="function"&&(e=e(B({},n),this.props)),e&&B(n,e),e!=null&&this.__v&&(t&&this._sb.push(t),et(this))},_e.prototype.forceUpdate=function(e){this.__v&&(this.__e=!0,e&&this.__h.push(e),et(this))},_e.prototype.render=V,O=[],it=typeof Promise=="function"?Promise.prototype.then.bind(Promise.resolve()):setTimeout,ot=function(e,t){return e.__v.__b-t.__v.__b},be.__r=0,Ce=Math.random().toString(8),he="__d"+Ce,ne="__a"+Ce,at=/(PointerCapture)$|Capture$/i,Fe=0,Ae=nt(!1),Pe=nt(!0),nn=0;var re,T,Me,gt,ie=0,wt=[],I=v,_t=I.__b,mt=I.__r,vt=I.diffed,bt=I.__c,xt=I.unmount,yt=I.__;function Le(e,t){I.__h&&I.__h(T,e,ie||t),ie=0;var n=T.__H||(T.__H={__:[],__h:[]});return e>=n.__.length&&n.__.push({}),n.__[e]}function F(e){return ie=1,un(Tt,e)}function un(e,t,n){var r=Le(re++,2);if(r.t=e,!r.__c&&(r.__=[n?n(t):Tt(void 0,t),function(d){var f=r.__N?r.__N[0]:r.__[0],l=r.t(f,d);f!==l&&(r.__N=[l,r.__[1]],r.__c.setState({}))}],r.__c=T,!T.__f)){var s=function(d,f,l){if(!r.__c.__H)return!0;var h=!1,b=r.__c.props!==d;if(r.__c.__H.__.some(function(p){if(p.__N){h=!0;var x=p.__[0];p.__=p.__N,p.__N=void 0,x!==p.__[0]&&(b=!0)}}),o){var a=o.call(this,d,f,l);return h?a||b:a}return!h||b};T.__f=!0;var o=T.shouldComponentUpdate,c=T.componentWillUpdate;T.componentWillUpdate=function(d,f,l){if(this.__e){var h=o;o=void 0,s(d,f,l),o=h}c&&c.call(this,d,f,l)},T.shouldComponentUpdate=s}return r.__N||r.__}function oe(e,t){var n=Le(re++,3);!I.__s&&St(n.__H,t)&&(n.__=e,n.u=t,T.__H.__h.push(n))}function U(e){return ie=5,J(function(){return{current:e}},[])}function J(e,t){var n=Le(re++,7);return St(n.__H,t)&&(n.__=e(),n.__H=t,n.__h=e),n.__}function ee(e,t){return ie=8,J(function(){return e},t)}function pn(){for(var e;e=wt.shift();){var t=e.__H;if(e.__P&&t)try{t.__h.some(ke),t.__h.some(ze),t.__h=[]}catch(n){t.__h=[],I.__e(n,e.__v)}}}I.__b=function(e){T=null,_t&&_t(e)},I.__=function(e,t){e&&t.__k&&t.__k.__m&&(e.__m=t.__k.__m),yt&&yt(e,t)},I.__r=function(e){mt&&mt(e),re=0;var t=(T=e.__c).__H;t&&(Me===T?(t.__h=[],T.__h=[],t.__.some(function(n){n.__N&&(n.__=n.__N),n.u=n.__N=void 0})):(t.__h.some(ke),t.__h.some(ze),t.__h=[],re=0)),Me=T},I.diffed=function(e){vt&&vt(e);var t=e.__c;t&&t.__H&&(t.__H.__h.length&&(wt.push(t)!==1&>===I.requestAnimationFrame||((gt=I.requestAnimationFrame)||fn)(pn)),t.__H.__.some(function(n){n.u&&(n.__H=n.u,n.u=void 0)})),Me=T=null},I.__c=function(e,t){t.some(function(n){try{n.__h.some(ke),n.__h=n.__h.filter(function(r){return!r.__||ze(r)})}catch(r){t.some(function(s){s.__h&&(s.__h=[])}),t=[],I.__e(r,n.__v)}}),bt&&bt(e,t)},I.unmount=function(e){xt&&xt(e);var t,n=e.__c;n&&n.__H&&(n.__H.__.some(function(r){try{ke(r)}catch(s){t=s}}),n.__H=void 0,t&&I.__e(t,n.__v))};var kt=typeof requestAnimationFrame=="function";function fn(e){var t,n=function(){clearTimeout(r),kt&&cancelAnimationFrame(t),setTimeout(e)},r=setTimeout(n,35);kt&&(t=requestAnimationFrame(n))}function ke(e){var t=T,n=e.__c;typeof n=="function"&&(e.__c=void 0,n()),T=t}function ze(e){var t=T;e.__c=e.__(),T=t}function St(e,t){return!e||e.length!==t.length||t.some(function(n,r){return n!==e[r]})}function Tt(e,t){return typeof t=="function"?t(e):t}function hn(e,t){let n=e.startsWith("#")?e.slice(1):e;if(!n.includes(`${t}=`))return{token:null,remainingHash:e};let r=new URLSearchParams(n),s=r.get(t);r.delete(t);let o=r.toString();return{token:s?.trim()||null,remainingHash:o?`#${o}`:""}}function Et(e){return hn(e,"visual-view")}function q(e,t){let n=e.replace(/\s+/g," ").trim();return n.length<=t?n:`${n.slice(0,Math.max(0,t-1)).trimEnd()}\u2026`}var Ue="visual-bridge:viewer-token";var gn="visual-bridge:last-sequence",Rt="visual-bridge:viewer-last-sequence",_n=new Set(["queued","preparing","snapshotting_before","resolving_context","running_agent","snapshotting_after","diffing","waiting_hmr","verifying","review","accepted","reverted","failed","canceled","unsafe"]);function De(e){try{return sessionStorage.getItem(e)}catch{return null}}function Ct(e,t){try{sessionStorage.setItem(e,t)}catch{}}function mn(e){try{sessionStorage.removeItem(e)}catch{}}function At(e){try{return JSON.parse(e)}catch{return e}}function j(e){return typeof e=="object"&&e!==null?e:null}function Pt(){let e=Et(location.hash);if(e.token){De(Ue)!==e.token&&mn(Rt),Ct(Ue,e.token);let t=`${location.pathname}${location.search}${e.remainingHash}`;return history.replaceState(history.state,"",t),e.token}return De(Ue)}function vn(e){let t=De(e);if(t===null)return null;let n=Number.parseInt(t,10);return Number.isFinite(n)&&n>=0?n:null}function bn(){let e=new URL("/_visual/ws",location.href);return e.protocol=location.protocol==="https:"?"wss:":"ws:",e.href}var we=class{browserSessionId;token;mode;getPageState;sequenceStorageKey;onSnapshot;onEvent;onSequenceGap;socket=null;heartbeatTimer;reconnectTimer;reconnectAttempt=0;manuallyClosed=!1;state="connecting";projectId;lastSequence;hasReplaySequence;constructor(t){this.token=t.token,this.browserSessionId=t.browserSessionId,this.mode=t.mode??"control",this.getPageState=t.getPageState??(()=>({})),this.sequenceStorageKey=this.mode==="viewer"?Rt:gn;let n=vn(this.sequenceStorageKey);this.lastSequence=n??0,this.hasReplaySequence=n!==null||this.mode==="control",this.onSnapshot=t.onSnapshot,this.onEvent=t.onEvent,this.onSequenceGap=t.onSequenceGap??(()=>{})}connect(){this.manuallyClosed=!1,this.openSocket()}close(){this.manuallyClosed=!0,this.clearTimers(),this.socket?.close(),this.socket=null}send(t,n){if(this.socket?.readyState!==WebSocket.OPEN)return!1;let r={id:crypto.randomUUID(),type:t,browserSessionId:this.browserSessionId,payload:n};return this.socket.send(JSON.stringify(r)),!0}emitSnapshot(){this.onSnapshot({state:this.state,...this.projectId?{projectId:this.projectId}:{},lastSequence:this.lastSequence})}openSocket(){this.clearTimers(),this.state=this.reconnectAttempt>0?"reconnecting":"connecting",this.emitSnapshot();let t;try{t=new WebSocket(bn())}catch{this.scheduleReconnect();return}this.socket=t,t.addEventListener("open",()=>{this.reconnectAttempt=0,this.send("auth",{token:this.token})}),t.addEventListener("message",n=>{this.handleMessage(String(n.data))}),t.addEventListener("close",n=>{if(this.socket=null,n.code===4001||n.code===4401){this.state="unauthorized",this.emitSnapshot();return}this.manuallyClosed||this.scheduleReconnect()}),t.addEventListener("error",()=>{this.state==="connecting"&&(this.state="offline",this.emitSnapshot())})}handleMessage(t){let n=j(At(t));if(!(!n||typeof n.type!="string")){if(n.type==="auth.ok"){this.projectId=typeof n.projectId=="string"?n.projectId:this.projectId,this.state="connected",this.emitSnapshot(),this.send("browser.hello",{...this.hasReplaySequence?{lastSeq:this.lastSequence}:{},...this.mode==="control"?this.getPageState():{}}),this.mode==="control"&&(this.heartbeatTimer=window.setInterval(()=>{this.send("browser.heartbeat",{lastSeq:this.lastSequence,...this.getPageState()})},15e3));return}if(n.type==="auth.error"||n.type==="error.unauthorized"){this.state="unauthorized",this.emitSnapshot(),this.socket?.close(4401,"Pairing rejected");return}if(typeof n.seq=="number"){if(n.seq<=this.lastSequence&&this.hasReplaySequence)return;this.hasReplaySequence&&n.seq>this.lastSequence+1&&this.onSequenceGap({expectedSequence:this.lastSequence+1,receivedSequence:n.seq}),this.lastSequence=n.seq,this.hasReplaySequence=!0,Ct(this.sequenceStorageKey,String(this.lastSequence)),this.emitSnapshot()}typeof n.projectId=="string"&&(this.projectId=n.projectId),this.onEvent(n)}}scheduleReconnect(){if(this.clearTimers(),this.manuallyClosed)return;this.reconnectAttempt+=1,this.state="reconnecting",this.emitSnapshot();let t=Math.min(1e4,500*2**(this.reconnectAttempt-1));this.reconnectTimer=window.setTimeout(()=>this.openSocket(),t)}clearTimers(){this.heartbeatTimer!==void 0&&(clearInterval(this.heartbeatTimer),this.heartbeatTimer=void 0),this.reconnectTimer!==void 0&&(clearTimeout(this.reconnectTimer),this.reconnectTimer=void 0)}};async function ae(e,t,n){let r=new Headers(n?.headers);e&&r.set("Authorization",`Bearer ${e}`),n?.body&&!r.has("Content-Type")&&r.set("Content-Type","application/json");let s=await fetch(t,{...n,headers:r});if(!s.ok){let o=q(await s.text(),180);throw new Error(o||`Bridge request failed (${s.status} ${s.statusText})`)}return s}async function se(e){let t=await e.text();return t?At(t):null}async function Ft(e){let t=await se(await ae(e,"/_visual/api/project")),n=j(t),r=j(n?.project);return typeof n?.id=="string"?n.id:typeof n?.projectId=="string"?n.projectId:typeof r?.id=="string"?r.id:void 0}async function Be(e,t={}){let n=new URLSearchParams;t.limit!==void 0&&n.set("limit",String(t.limit)),t.cursor!==void 0&&(n.set("before",t.cursor.createdAt),n.set("beforeId",t.cursor.id));let r=n.toString(),s=r?`?${r}`:"",o=await se(await ae(e,`/_visual/api/tasks${s}`)),c=j(o);return(Array.isArray(o)?o:Array.isArray(c?.tasks)?c.tasks:[]).filter(f=>{let l=j(f);return typeof l?.id=="string"&&typeof l.projectId=="string"&&typeof l.status=="string"&&_n.has(l.status)&&typeof l.requestText=="string"&&(l.scope==="instance"||l.scope==="component"||l.scope==="page"||l.scope==="project")&&typeof l.originBrowserSessionId=="string"&&Array.isArray(l.changedFiles)&&l.changedFiles.every(h=>typeof h=="string")&&typeof l.createdAt=="string"})}function It(e){return Array.isArray(e)?e.filter(t=>typeof t=="string"):[]}function qt(e){let t=It(e);if(t.length>0||Array.isArray(e))return t;let n=j(e);return It(n?.files??n?.changedFiles??n?.data)}function xn(e){if(typeof e=="string")return e;let t=j(e),n=t?.diff??t?.content??t?.data;return typeof n=="string"?n:""}function yn(e){let t=/^(?:\/usr)?\/bin\/(?:bash|sh|zsh)\s+-lc\s+([\s\S]+)$/u.exec(e.trim());if(!t?.[1])return e;let n=t[1].trim();return n.length>=2&&(n.startsWith("'")&&n.endsWith("'")||n.startsWith('"')&&n.endsWith('"'))?n.slice(1,-1):n}function kn(e){if(typeof e.command!="string")return null;let t=yn(e.command),n=e.usedRtk===!0||/^rtk(?:\s|$)/u.test(t)?"RTK":"\uBA85\uB839",s=[typeof e.cwd=="string"?e.cwd.split(/[\\/]/u).filter(Boolean).at(-1):void 0,typeof e.durationMs=="number"?`${e.durationMs}ms`:void 0,e.timedOut===!0?"\uC2DC\uAC04 \uCD08\uACFC":void 0,e.truncated===!0?"\uCD9C\uB825 \uCD95\uC57D":void 0].filter(o=>!!o);return q(`${n} \xB7 ${t}${s.length>0?` \xB7 ${s.join(" \xB7 ")}`:""}`,500)}function jt(e){if(typeof e=="string")return q(e,500);let t=j(e);if(!t)return null;let n=j(t.event)??t,r=typeof n.type=="string"?n.type:void 0;if(r==="command")return kn(n);if(r==="tool_start"&&typeof n.name=="string")return n.name==="command_execution"||n.name==="direct_exec"?null:q(`\uB3C4\uAD6C \uC2DC\uC791 \xB7 ${n.name}${typeof n.summary=="string"?` \xB7 ${n.summary}`:""}`,500);if(r==="tool_end"&&typeof n.name=="string")return n.name==="command_execution"||n.name==="direct_exec"?null:q(`\uB3C4\uAD6C ${n.ok===!1?"\uC2E4\uD328":"\uC644\uB8CC"} \xB7 ${n.name}`,500);if(r==="phase"&&typeof n.name=="string")return q(`\uB2E8\uACC4 \xB7 ${n.name}`,500);if(r==="file_hint"&&typeof n.path=="string")return q(`\uD30C\uC77C \xB7 ${n.path}`,500);if(r==="usage"&&typeof n.inputTokens=="number"&&typeof n.outputTokens=="number")return q(`\uD1A0\uD070 \xB7 \uC785\uB825 ${n.inputTokens.toLocaleString("en-US")}${typeof n.cachedInputTokens=="number"?` \xB7 \uCE90\uC2DC ${n.cachedInputTokens.toLocaleString("en-US")}`:""} \xB7 \uCD9C\uB825 ${n.outputTokens.toLocaleString("en-US")}`,500);let s=n.message??n.text??n.summary??n.command??n.error??t.message;return typeof s=="string"?q(s,500):null}async function $t(e,t,n){let r=`/_visual/api/tasks/${encodeURIComponent(t)}`,s=n===void 0?void 0:{signal:n},[o,c,d]=await Promise.allSettled([ae(e,`${r}/files`,s).then(se),ae(e,`${r}/diff`,s).then(se),ae(e,`${r}/logs`,s).then(se)]),f=[o,c,d].find(k=>k.status==="rejected"&&k.reason instanceof DOMException&&k.reason.name==="AbortError");if(f!==void 0)throw f.reason;let l=o.status==="fulfilled"?qt(o.value):[],h=c.status==="fulfilled"?xn(c.value):"",b=d.status==="fulfilled"?d.value:[],a=j(b),p=Array.isArray(b)?b:Array.isArray(a?.logs)?a.logs:[],x=Array.isArray(p)?p.map(jt).filter(k=>!!k).slice(-40):[],w=[];return o.status==="rejected"&&w.push("files"),c.status==="rejected"&&w.push("diff"),d.status==="rejected"&&w.push("logs"),{changedFiles:l,diff:h,logs:x,unavailable:w}}function Mt(e){let t=j(e.payload),r=j(t?.task)??t;return r&&typeof r.id=="string"?r:void 0}function zt(e){let t=j(e.payload);return jt(t?.event??t)}function Lt(e){let t=j(e.payload);return qt(t?.changedFiles??t?.files??[])}var Ut=String.raw`
|
|
1
|
+
var xe,v,rt,tn,O,Ze,it,ot,Ae,he,ne,at,Fe,Ce,Pe,nn,me={},ve=[],rn=/acit|ex(?:s|g|n|p|$)|rph|grid|ows|mnc|ntw|ine[ch]|zoo|^ord|itera/i,ye=Array.isArray;function B(e,t){for(var n in t)e[n]=t[n];return e}function qe(e){e&&e.parentNode&&e.parentNode.removeChild(e)}function on(e,t,n){var r,s,o,c={};for(o in t)o=="key"?r=t[o]:o=="ref"?s=t[o]:c[o]=t[o];if(arguments.length>2&&(c.children=arguments.length>3?xe.call(arguments,2):n),typeof e=="function"&&e.defaultProps!=null)for(o in e.defaultProps)c[o]===void 0&&(c[o]=e.defaultProps[o]);return ge(e,c,r,s,null)}function ge(e,t,n,r,s){var o={type:e,props:t,key:n,ref:r,__k:null,__:null,__b:0,__e:null,__c:null,constructor:void 0,__v:s??++rt,__i:-1,__u:0};return s==null&&v.vnode!=null&&v.vnode(o),o}function V(e){return e.children}function _e(e,t){this.props=e,this.context=t}function Z(e,t){if(t==null)return e.__?Z(e.__,e.__i+1):null;for(var n;t<e.__k.length;t++)if((n=e.__k[t])!=null&&n.__e!=null)return n.__e;return typeof e.type=="function"?Z(e):null}function an(e){if(e.__P&&e.__d){var t=e.__v,n=t.__e,r=[],s=[],o=B({},t);o.__v=t.__v+1,v.vnode&&v.vnode(o),je(e.__P,o,t,e.__n,e.__P.namespaceURI,32&t.__u?[n]:null,r,n??Z(t),!!(32&t.__u),s),o.__v=t.__v,o.__.__k[o.__i]=o,ut(r,o,s),t.__e=t.__=null,o.__e!=n&&st(o)}}function st(e){if((e=e.__)!=null&&e.__c!=null)return e.__e=e.__c.base=null,e.__k.some(function(t){if(t!=null&&t.__e!=null)return e.__e=e.__c.base=t.__e}),st(e)}function et(e){(!e.__d&&(e.__d=!0)&&O.push(e)&&!be.__r++||Ze!=v.debounceRendering)&&((Ze=v.debounceRendering)||it)(be)}function be(){try{for(var e,t=1;O.length;)O.length>t&&O.sort(ot),e=O.shift(),t=O.length,an(e)}finally{O.length=be.__r=0}}function lt(e,t,n,r,s,o,c,d,f,l,h){var b,a,p,x,w,k,y,g=r&&r.__k||ve,C=t.length;for(f=sn(n,t,g,f,C),b=0;b<C;b++)(p=n.__k[b])!=null&&(a=p.__i!=-1&&g[p.__i]||me,p.__i=b,k=je(e,p,a,s,o,c,d,f,l,h),x=p.__e,p.ref&&a.ref!=p.ref&&(a.ref&&$e(a.ref,null,p),h.push(p.ref,p.__c||x,p)),w==null&&x!=null&&(w=x),(y=!!(4&p.__u))||a.__k===p.__k?(f=ct(p,f,e,y),y&&a.__e&&(a.__e=null)):typeof p.type=="function"&&k!==void 0?f=k:x&&(f=x.nextSibling),p.__u&=-7);return n.__e=w,f}function sn(e,t,n,r,s){var o,c,d,f,l,h=n.length,b=h,a=0;for(e.__k=new Array(s),o=0;o<s;o++)(c=t[o])!=null&&typeof c!="boolean"&&typeof c!="function"?(typeof c=="string"||typeof c=="number"||typeof c=="bigint"||c.constructor==String?c=e.__k[o]=ge(null,c,null,null,null):ye(c)?c=e.__k[o]=ge(V,{children:c},null,null,null):c.constructor===void 0&&c.__b>0?c=e.__k[o]=ge(c.type,c.props,c.key,c.ref?c.ref:null,c.__v):e.__k[o]=c,f=o+a,c.__=e,c.__b=e.__b+1,d=null,(l=c.__i=ln(c,n,f,b))!=-1&&(b--,(d=n[l])&&(d.__u|=2)),d==null||d.__v==null?(l==-1&&(s>h?a--:s<h&&a++),typeof c.type!="function"&&(c.__u|=4)):l!=f&&(l==f-1?a--:l==f+1?a++:(l>f?a--:a++,c.__u|=4))):e.__k[o]=null;if(b)for(o=0;o<h;o++)(d=n[o])!=null&&(2&d.__u)==0&&(d.__e==r&&(r=Z(d)),ft(d,d));return r}function ct(e,t,n,r){var s,o;if(typeof e.type=="function"){for(s=e.__k,o=0;s&&o<s.length;o++)s[o]&&(s[o].__=e,t=ct(s[o],t,n,r));return t}e.__e!=t&&(r&&(t&&e.type&&!t.parentNode&&(t=Z(e)),n.insertBefore(e.__e,t||null)),t=e.__e);do t=t&&t.nextSibling;while(t!=null&&t.nodeType==8);return t}function ln(e,t,n,r){var s,o,c,d=e.key,f=e.type,l=t[n],h=l!=null&&(2&l.__u)==0;if(l===null&&d==null||h&&d==l.key&&f==l.type)return n;if(r>(h?1:0)){for(s=n-1,o=n+1;s>=0||o<t.length;)if((l=t[c=s>=0?s--:o++])!=null&&(2&l.__u)==0&&d==l.key&&f==l.type)return c}return-1}function tt(e,t,n){t[0]=="-"?e.setProperty(t,n??""):e[t]=n==null?"":typeof n!="number"||rn.test(t)?n:n+"px"}function fe(e,t,n,r,s){var o,c;e:if(t=="style")if(typeof n=="string")e.style.cssText=n;else{if(typeof r=="string"&&(e.style.cssText=r=""),r)for(t in r)n&&t in n||tt(e.style,t,"");if(n)for(t in n)r&&n[t]==r[t]||tt(e.style,t,n[t])}else if(t[0]=="o"&&t[1]=="n")o=t!=(t=t.replace(at,"$1")),c=t.toLowerCase(),t=c in e||t=="onFocusOut"||t=="onFocusIn"?c.slice(2):t.slice(2),e.l||(e.l={}),e.l[t+o]=n,n?r?n[ne]=r[ne]:(n[ne]=Fe,e.addEventListener(t,o?Pe:Ce,o)):e.removeEventListener(t,o?Pe:Ce,o);else{if(s=="http://www.w3.org/2000/svg")t=t.replace(/xlink(H|:h)/,"h").replace(/sName$/,"s");else if(t!="width"&&t!="height"&&t!="href"&&t!="list"&&t!="form"&&t!="tabIndex"&&t!="download"&&t!="rowSpan"&&t!="colSpan"&&t!="role"&&t!="popover"&&t in e)try{e[t]=n??"";break e}catch{}typeof n=="function"||(n==null||n===!1&&t[4]!="-"?e.removeAttribute(t):e.setAttribute(t,t=="popover"&&n==1?"":n))}}function nt(e){return function(t){if(this.l){var n=this.l[t.type+e];if(t[he]==null)t[he]=Fe++;else if(t[he]<n[ne])return;return n(v.event?v.event(t):t)}}}function je(e,t,n,r,s,o,c,d,f,l){var h,b,a,p,x,w,k,y,g,C,K,L,z,H,G,N,$=t.type;if(t.constructor!==void 0)return null;128&n.__u&&(f=!!(32&n.__u),o=[d=t.__e=n.__e]),(h=v.__b)&&h(t);e:if(typeof $=="function"){b=c.length;try{if(g=t.props,C=$.prototype&&$.prototype.render,K=(h=$.contextType)&&r[h.__c],L=h?K?K.props.value:h.__:r,n.__c?y=(a=t.__c=n.__c).__=a.__E:(C?t.__c=a=new $(g,L):(t.__c=a=new _e(g,L),a.constructor=$,a.render=dn),K&&K.sub(a),a.state||(a.state={}),a.__n=r,p=a.__d=!0,a.__h=[],a._sb=[]),C&&a.__s==null&&(a.__s=a.state),C&&$.getDerivedStateFromProps!=null&&(a.__s==a.state&&(a.__s=B({},a.__s)),B(a.__s,$.getDerivedStateFromProps(g,a.__s))),x=a.props,w=a.state,a.__v=t,p)C&&$.getDerivedStateFromProps==null&&a.componentWillMount!=null&&a.componentWillMount(),C&&a.componentDidMount!=null&&a.__h.push(a.componentDidMount);else{if(C&&$.getDerivedStateFromProps==null&&g!==x&&a.componentWillReceiveProps!=null&&a.componentWillReceiveProps(g,L),t.__v==n.__v||!a.__e&&a.shouldComponentUpdate!=null&&a.shouldComponentUpdate(g,a.__s,L)===!1){t.__v!=n.__v&&(a.props=g,a.state=a.__s,a.__d=!1),t.__e=n.__e,t.__k=n.__k,t.__k.some(function(W){W&&(W.__=t)}),ve.push.apply(a.__h,a._sb),a._sb=[],a.__h.length&&c.push(a);break e}a.componentWillUpdate!=null&&a.componentWillUpdate(g,a.__s,L),C&&a.componentDidUpdate!=null&&a.__h.push(function(){a.componentDidUpdate(x,w,k)})}if(a.context=L,a.props=g,a.__P=e,a.__e=!1,z=v.__r,H=0,C)a.state=a.__s,a.__d=!1,z&&z(t),h=a.render(a.props,a.state,a.context),ve.push.apply(a.__h,a._sb),a._sb=[];else do a.__d=!1,z&&z(t),h=a.render(a.props,a.state,a.context),a.state=a.__s;while(a.__d&&++H<25);a.state=a.__s,a.getChildContext!=null&&(r=B(B({},r),a.getChildContext())),C&&!p&&a.getSnapshotBeforeUpdate!=null&&(k=a.getSnapshotBeforeUpdate(x,w)),G=h!=null&&h.type===V&&h.key==null?pt(h.props.children):h,d=lt(e,ye(G)?G:[G],t,n,r,s,o,c,d,f,l),a.base=t.__e,t.__u&=-161,a.__h.length&&c.push(a),y&&(a.__E=a.__=null)}catch(W){if(c.length=b,t.__v=null,f||o!=null){if(W.then){for(t.__u|=f?160:128;d&&d.nodeType==8&&d.nextSibling;)d=d.nextSibling;o!=null&&(o[o.indexOf(d)]=null),t.__e=d}else if(o!=null)for(N=o.length;N--;)qe(o[N])}else t.__e=n.__e;t.__k==null&&(t.__k=n.__k||[]),W.then||dt(t),v.__e(W,t,n)}}else o==null&&t.__v==n.__v?(t.__k=n.__k,t.__e=n.__e):d=t.__e=cn(n.__e,t,n,r,s,o,c,f,l);return(h=v.diffed)&&h(t),128&t.__u?void 0:d}function dt(e){e&&(e.__c&&(e.__c.__e=!0),e.__k&&e.__k.some(dt))}function ut(e,t,n){for(var r=0;r<n.length;r++)$e(n[r],n[++r],n[++r]);v.__c&&v.__c(t,e),e.some(function(s){try{e=s.__h,s.__h=[],e.some(function(o){o.call(s)})}catch(o){v.__e(o,s.__v)}})}function pt(e){return typeof e!="object"||e==null||e.__b>0?e:ye(e)?e.map(pt):e.constructor!==void 0?null:B({},e)}function cn(e,t,n,r,s,o,c,d,f){var l,h,b,a,p,x,w,k=n.props||me,y=t.props,g=t.type;if(g=="svg"?s="http://www.w3.org/2000/svg":g=="math"?s="http://www.w3.org/1998/Math/MathML":s||(s="http://www.w3.org/1999/xhtml"),o!=null){for(l=0;l<o.length;l++)if((p=o[l])&&"setAttribute"in p==!!g&&(g?p.localName==g:p.nodeType==3)){e=p,o[l]=null;break}}if(e==null){if(g==null)return document.createTextNode(y);e=document.createElementNS(s,g,y.is&&y),d&&(v.__m&&v.__m(t,o),d=!1),o=null}if(g==null)k===y||d&&e.data==y||(e.data=y);else{if(o=g=="textarea"&&y.defaultValue!=null?null:o&&xe.call(e.childNodes),!d&&o!=null)for(k={},l=0;l<e.attributes.length;l++)k[(p=e.attributes[l]).name]=p.value;for(l in k)p=k[l],l=="dangerouslySetInnerHTML"?b=p:l=="children"||l in y||l=="value"&&"defaultValue"in y||l=="checked"&&"defaultChecked"in y||fe(e,l,null,p,s);for(l in y)p=y[l],l=="children"?a=p:l=="dangerouslySetInnerHTML"?h=p:l=="value"?x=p:l=="checked"?w=p:d&&typeof p!="function"||k[l]===p||fe(e,l,p,k[l],s);if(h)d||b&&(h.__html==b.__html||h.__html==e.innerHTML)||(e.innerHTML=h.__html),t.__k=[];else if(b&&(e.innerHTML=""),lt(t.type=="template"?e.content:e,ye(a)?a:[a],t,n,r,g=="foreignObject"?"http://www.w3.org/1999/xhtml":s,o,c,o?o[0]:n.__k&&Z(n,0),d,f),o!=null)for(l=o.length;l--;)qe(o[l]);d&&g!="textarea"||(l="value",g=="progress"&&x==null?e.removeAttribute("value"):x!=null&&(x!==e[l]||g=="progress"&&!x||g=="option"&&x!=k[l])&&fe(e,l,x,k[l],s),l="checked",w!=null&&w!=e[l]&&fe(e,l,w,k[l],s))}return e}function $e(e,t,n){try{if(typeof e=="function"){var r=typeof e.__u=="function";r&&e.__u(),r&&t==null||(e.__u=e(t))}else e.current=t}catch(s){v.__e(s,n)}}function ft(e,t,n){var r,s;if(v.unmount&&v.unmount(e),(r=e.ref)&&(r.current&&r.current!=e.__e||$e(r,null,t)),(r=e.__c)!=null){if(r.componentWillUnmount)try{r.componentWillUnmount()}catch(o){v.__e(o,t)}r.base=r.__P=r.__n=null}if(r=e.__k)for(s=0;s<r.length;s++)r[s]&&ft(r[s],t,n||typeof e.type!="function");n||qe(e.__e),e.__c=e.__=e.__e=void 0}function dn(e,t,n){return this.constructor(e,n)}function ht(e,t,n){var r,s,o,c;t==document&&(t=document.documentElement),v.__&&v.__(e,t),s=(r=typeof n=="function")?null:n&&n.__k||t.__k,o=[],c=[],je(t,e=(!r&&n||t).__k=on(V,null,[e]),s||me,me,t.namespaceURI,!r&&n?[n]:s?null:t.firstChild?xe.call(t.childNodes):null,o,!r&&n?n:s?s.__e:t.firstChild,r,c),ut(o,e,c),e.props.children=null}xe=ve.slice,v={__e:function(e,t,n,r){for(var s,o,c;t=t.__;)if((s=t.__c)&&!s.__)try{if((o=s.constructor)&&o.getDerivedStateFromError!=null&&(s.setState(o.getDerivedStateFromError(e)),c=s.__d),s.componentDidCatch!=null&&(s.componentDidCatch(e,r||{}),c=s.__d),c)return s.__E=s}catch(d){e=d}throw e}},rt=0,tn=function(e){return e!=null&&e.constructor===void 0},_e.prototype.setState=function(e,t){var n;n=this.__s!=null&&this.__s!=this.state?this.__s:this.__s=B({},this.state),typeof e=="function"&&(e=e(B({},n),this.props)),e&&B(n,e),e!=null&&this.__v&&(t&&this._sb.push(t),et(this))},_e.prototype.forceUpdate=function(e){this.__v&&(this.__e=!0,e&&this.__h.push(e),et(this))},_e.prototype.render=V,O=[],it=typeof Promise=="function"?Promise.prototype.then.bind(Promise.resolve()):setTimeout,ot=function(e,t){return e.__v.__b-t.__v.__b},be.__r=0,Ae=Math.random().toString(8),he="__d"+Ae,ne="__a"+Ae,at=/(PointerCapture)$|Capture$/i,Fe=0,Ce=nt(!1),Pe=nt(!0),nn=0;var re,T,Me,gt,ie=0,wt=[],I=v,_t=I.__b,mt=I.__r,vt=I.diffed,bt=I.__c,xt=I.unmount,yt=I.__;function Le(e,t){I.__h&&I.__h(T,e,ie||t),ie=0;var n=T.__H||(T.__H={__:[],__h:[]});return e>=n.__.length&&n.__.push({}),n.__[e]}function F(e){return ie=1,un(Tt,e)}function un(e,t,n){var r=Le(re++,2);if(r.t=e,!r.__c&&(r.__=[n?n(t):Tt(void 0,t),function(d){var f=r.__N?r.__N[0]:r.__[0],l=r.t(f,d);f!==l&&(r.__N=[l,r.__[1]],r.__c.setState({}))}],r.__c=T,!T.__f)){var s=function(d,f,l){if(!r.__c.__H)return!0;var h=!1,b=r.__c.props!==d;if(r.__c.__H.__.some(function(p){if(p.__N){h=!0;var x=p.__[0];p.__=p.__N,p.__N=void 0,x!==p.__[0]&&(b=!0)}}),o){var a=o.call(this,d,f,l);return h?a||b:a}return!h||b};T.__f=!0;var o=T.shouldComponentUpdate,c=T.componentWillUpdate;T.componentWillUpdate=function(d,f,l){if(this.__e){var h=o;o=void 0,s(d,f,l),o=h}c&&c.call(this,d,f,l)},T.shouldComponentUpdate=s}return r.__N||r.__}function oe(e,t){var n=Le(re++,3);!I.__s&&St(n.__H,t)&&(n.__=e,n.u=t,T.__H.__h.push(n))}function U(e){return ie=5,J(function(){return{current:e}},[])}function J(e,t){var n=Le(re++,7);return St(n.__H,t)&&(n.__=e(),n.__H=t,n.__h=e),n.__}function ee(e,t){return ie=8,J(function(){return e},t)}function pn(){for(var e;e=wt.shift();){var t=e.__H;if(e.__P&&t)try{t.__h.some(ke),t.__h.some(ze),t.__h=[]}catch(n){t.__h=[],I.__e(n,e.__v)}}}I.__b=function(e){T=null,_t&&_t(e)},I.__=function(e,t){e&&t.__k&&t.__k.__m&&(e.__m=t.__k.__m),yt&&yt(e,t)},I.__r=function(e){mt&&mt(e),re=0;var t=(T=e.__c).__H;t&&(Me===T?(t.__h=[],T.__h=[],t.__.some(function(n){n.__N&&(n.__=n.__N),n.u=n.__N=void 0})):(t.__h.some(ke),t.__h.some(ze),t.__h=[],re=0)),Me=T},I.diffed=function(e){vt&&vt(e);var t=e.__c;t&&t.__H&&(t.__H.__h.length&&(wt.push(t)!==1&>===I.requestAnimationFrame||((gt=I.requestAnimationFrame)||fn)(pn)),t.__H.__.some(function(n){n.u&&(n.__H=n.u,n.u=void 0)})),Me=T=null},I.__c=function(e,t){t.some(function(n){try{n.__h.some(ke),n.__h=n.__h.filter(function(r){return!r.__||ze(r)})}catch(r){t.some(function(s){s.__h&&(s.__h=[])}),t=[],I.__e(r,n.__v)}}),bt&&bt(e,t)},I.unmount=function(e){xt&&xt(e);var t,n=e.__c;n&&n.__H&&(n.__H.__.some(function(r){try{ke(r)}catch(s){t=s}}),n.__H=void 0,t&&I.__e(t,n.__v))};var kt=typeof requestAnimationFrame=="function";function fn(e){var t,n=function(){clearTimeout(r),kt&&cancelAnimationFrame(t),setTimeout(e)},r=setTimeout(n,35);kt&&(t=requestAnimationFrame(n))}function ke(e){var t=T,n=e.__c;typeof n=="function"&&(e.__c=void 0,n()),T=t}function ze(e){var t=T;e.__c=e.__(),T=t}function St(e,t){return!e||e.length!==t.length||t.some(function(n,r){return n!==e[r]})}function Tt(e,t){return typeof t=="function"?t(e):t}function hn(e,t){let n=e.startsWith("#")?e.slice(1):e;if(!n.includes(`${t}=`))return{token:null,remainingHash:e};let r=new URLSearchParams(n),s=r.get(t);r.delete(t);let o=r.toString();return{token:s?.trim()||null,remainingHash:o?`#${o}`:""}}function Et(e){return hn(e,"visual-view")}function q(e,t){let n=e.replace(/\s+/g," ").trim();return n.length<=t?n:`${n.slice(0,Math.max(0,t-1)).trimEnd()}\u2026`}var Ue="visual-bridge:viewer-token";var gn="visual-bridge:last-sequence",Rt="visual-bridge:viewer-last-sequence",_n=new Set(["queued","preparing","snapshotting_before","resolving_context","running_agent","snapshotting_after","diffing","waiting_hmr","verifying","review","accepted","reverted","failed","canceled","unsafe"]);function De(e){try{return sessionStorage.getItem(e)}catch{return null}}function At(e,t){try{sessionStorage.setItem(e,t)}catch{}}function mn(e){try{sessionStorage.removeItem(e)}catch{}}function Ct(e){try{return JSON.parse(e)}catch{return e}}function j(e){return typeof e=="object"&&e!==null?e:null}function Pt(){let e=Et(location.hash);if(e.token){De(Ue)!==e.token&&mn(Rt),At(Ue,e.token);let t=`${location.pathname}${location.search}${e.remainingHash}`;return history.replaceState(history.state,"",t),e.token}return De(Ue)}function vn(e){let t=De(e);if(t===null)return null;let n=Number.parseInt(t,10);return Number.isFinite(n)&&n>=0?n:null}function bn(){let e=new URL("/_visual/ws",location.href);return e.protocol=location.protocol==="https:"?"wss:":"ws:",e.href}var we=class{browserSessionId;token;mode;getPageState;sequenceStorageKey;onSnapshot;onEvent;onSequenceGap;socket=null;heartbeatTimer;reconnectTimer;reconnectAttempt=0;manuallyClosed=!1;state="connecting";projectId;lastSequence;hasReplaySequence;constructor(t){this.token=t.token,this.browserSessionId=t.browserSessionId,this.mode=t.mode??"control",this.getPageState=t.getPageState??(()=>({})),this.sequenceStorageKey=this.mode==="viewer"?Rt:gn;let n=vn(this.sequenceStorageKey);this.lastSequence=n??0,this.hasReplaySequence=n!==null||this.mode==="control",this.onSnapshot=t.onSnapshot,this.onEvent=t.onEvent,this.onSequenceGap=t.onSequenceGap??(()=>{})}connect(){this.manuallyClosed=!1,this.openSocket()}close(){this.manuallyClosed=!0,this.clearTimers(),this.socket?.close(),this.socket=null}send(t,n){if(this.socket?.readyState!==WebSocket.OPEN)return!1;let r={id:crypto.randomUUID(),type:t,browserSessionId:this.browserSessionId,payload:n};return this.socket.send(JSON.stringify(r)),!0}emitSnapshot(){this.onSnapshot({state:this.state,...this.projectId?{projectId:this.projectId}:{},lastSequence:this.lastSequence})}openSocket(){this.clearTimers(),this.state=this.reconnectAttempt>0?"reconnecting":"connecting",this.emitSnapshot();let t;try{t=new WebSocket(bn())}catch{this.scheduleReconnect();return}this.socket=t,t.addEventListener("open",()=>{this.reconnectAttempt=0,this.send("auth",{token:this.token})}),t.addEventListener("message",n=>{this.handleMessage(String(n.data))}),t.addEventListener("close",n=>{if(this.socket=null,n.code===4001||n.code===4401){this.state="unauthorized",this.emitSnapshot();return}this.manuallyClosed||this.scheduleReconnect()}),t.addEventListener("error",()=>{this.state==="connecting"&&(this.state="offline",this.emitSnapshot())})}handleMessage(t){let n=j(Ct(t));if(!(!n||typeof n.type!="string")){if(n.type==="auth.ok"){this.projectId=typeof n.projectId=="string"?n.projectId:this.projectId,this.state="connected",this.emitSnapshot(),this.send("browser.hello",{...this.hasReplaySequence?{lastSeq:this.lastSequence}:{},...this.mode==="control"?this.getPageState():{}}),this.mode==="control"&&(this.heartbeatTimer=window.setInterval(()=>{this.send("browser.heartbeat",{lastSeq:this.lastSequence,...this.getPageState()})},15e3));return}if(n.type==="auth.error"||n.type==="error.unauthorized"){this.state="unauthorized",this.emitSnapshot(),this.socket?.close(4401,"Pairing rejected");return}if(typeof n.seq=="number"){if(n.seq<=this.lastSequence&&this.hasReplaySequence)return;this.hasReplaySequence&&n.seq>this.lastSequence+1&&this.onSequenceGap({expectedSequence:this.lastSequence+1,receivedSequence:n.seq}),this.lastSequence=n.seq,this.hasReplaySequence=!0,At(this.sequenceStorageKey,String(this.lastSequence)),this.emitSnapshot()}typeof n.projectId=="string"&&(this.projectId=n.projectId),this.onEvent(n)}}scheduleReconnect(){if(this.clearTimers(),this.manuallyClosed)return;this.reconnectAttempt+=1,this.state="reconnecting",this.emitSnapshot();let t=Math.min(1e4,500*2**(this.reconnectAttempt-1));this.reconnectTimer=window.setTimeout(()=>this.openSocket(),t)}clearTimers(){this.heartbeatTimer!==void 0&&(clearInterval(this.heartbeatTimer),this.heartbeatTimer=void 0),this.reconnectTimer!==void 0&&(clearTimeout(this.reconnectTimer),this.reconnectTimer=void 0)}};async function ae(e,t,n){let r=new Headers(n?.headers);e&&r.set("Authorization",`Bearer ${e}`),n?.body&&!r.has("Content-Type")&&r.set("Content-Type","application/json");let s=await fetch(t,{...n,headers:r});if(!s.ok){let o=q(await s.text(),180);throw new Error(o||`Bridge request failed (${s.status} ${s.statusText})`)}return s}async function se(e){let t=await e.text();return t?Ct(t):null}async function Ft(e){let t=await se(await ae(e,"/_visual/api/project")),n=j(t),r=j(n?.project);return typeof n?.id=="string"?n.id:typeof n?.projectId=="string"?n.projectId:typeof r?.id=="string"?r.id:void 0}async function Be(e,t={}){let n=new URLSearchParams;t.limit!==void 0&&n.set("limit",String(t.limit)),t.cursor!==void 0&&(n.set("before",t.cursor.createdAt),n.set("beforeId",t.cursor.id));let r=n.toString(),s=r?`?${r}`:"",o=await se(await ae(e,`/_visual/api/tasks${s}`,t.signal?{signal:t.signal}:void 0)),c=j(o);return(Array.isArray(o)?o:Array.isArray(c?.tasks)?c.tasks:[]).filter(f=>{let l=j(f);return typeof l?.id=="string"&&typeof l.projectId=="string"&&typeof l.status=="string"&&_n.has(l.status)&&typeof l.requestText=="string"&&(l.scope==="instance"||l.scope==="component"||l.scope==="page"||l.scope==="project")&&typeof l.originBrowserSessionId=="string"&&Array.isArray(l.changedFiles)&&l.changedFiles.every(h=>typeof h=="string")&&typeof l.createdAt=="string"})}function It(e){return Array.isArray(e)?e.filter(t=>typeof t=="string"):[]}function qt(e){let t=It(e);if(t.length>0||Array.isArray(e))return t;let n=j(e);return It(n?.files??n?.changedFiles??n?.data)}function xn(e){if(typeof e=="string")return e;let t=j(e),n=t?.diff??t?.content??t?.data;return typeof n=="string"?n:""}function yn(e){let t=/^(?:\/usr)?\/bin\/(?:bash|sh|zsh)\s+-lc\s+([\s\S]+)$/u.exec(e.trim());if(!t?.[1])return e;let n=t[1].trim();return n.length>=2&&(n.startsWith("'")&&n.endsWith("'")||n.startsWith('"')&&n.endsWith('"'))?n.slice(1,-1):n}function kn(e){if(typeof e.command!="string")return null;let t=yn(e.command),n=e.usedRtk===!0||/^rtk(?:\s|$)/u.test(t)?"RTK":"\uBA85\uB839",s=[typeof e.cwd=="string"?e.cwd.split(/[\\/]/u).filter(Boolean).at(-1):void 0,typeof e.durationMs=="number"?`${e.durationMs}ms`:void 0,e.timedOut===!0?"\uC2DC\uAC04 \uCD08\uACFC":void 0,e.truncated===!0?"\uCD9C\uB825 \uCD95\uC57D":void 0].filter(o=>!!o);return q(`${n} \xB7 ${t}${s.length>0?` \xB7 ${s.join(" \xB7 ")}`:""}`,500)}function jt(e){if(typeof e=="string")return q(e,500);let t=j(e);if(!t)return null;let n=j(t.event)??t,r=typeof n.type=="string"?n.type:void 0;if(r==="command")return kn(n);if(r==="tool_start"&&typeof n.name=="string")return n.name==="command_execution"||n.name==="direct_exec"?null:q(`\uB3C4\uAD6C \uC2DC\uC791 \xB7 ${n.name}${typeof n.summary=="string"?` \xB7 ${n.summary}`:""}`,500);if(r==="tool_end"&&typeof n.name=="string")return n.name==="command_execution"||n.name==="direct_exec"?null:q(`\uB3C4\uAD6C ${n.ok===!1?"\uC2E4\uD328":"\uC644\uB8CC"} \xB7 ${n.name}`,500);if(r==="phase"&&typeof n.name=="string")return q(`\uB2E8\uACC4 \xB7 ${n.name}`,500);if(r==="file_hint"&&typeof n.path=="string")return q(`\uD30C\uC77C \xB7 ${n.path}`,500);if(r==="usage"&&typeof n.inputTokens=="number"&&typeof n.outputTokens=="number")return q(`\uD1A0\uD070 \xB7 \uC785\uB825 ${n.inputTokens.toLocaleString("en-US")}${typeof n.cachedInputTokens=="number"?` \xB7 \uCE90\uC2DC ${n.cachedInputTokens.toLocaleString("en-US")}`:""} \xB7 \uCD9C\uB825 ${n.outputTokens.toLocaleString("en-US")}`,500);let s=n.message??n.text??n.summary??n.command??n.error??t.message;return typeof s=="string"?q(s,500):null}async function $t(e,t,n){let r=`/_visual/api/tasks/${encodeURIComponent(t)}`,s=n===void 0?void 0:{signal:n},[o,c,d]=await Promise.allSettled([ae(e,`${r}/files`,s).then(se),ae(e,`${r}/diff`,s).then(se),ae(e,`${r}/logs`,s).then(se)]),f=[o,c,d].find(k=>k.status==="rejected"&&k.reason instanceof DOMException&&k.reason.name==="AbortError");if(f!==void 0)throw f.reason;let l=o.status==="fulfilled"?qt(o.value):[],h=c.status==="fulfilled"?xn(c.value):"",b=d.status==="fulfilled"?d.value:[],a=j(b),p=Array.isArray(b)?b:Array.isArray(a?.logs)?a.logs:[],x=Array.isArray(p)?p.map(jt).filter(k=>!!k).slice(-40):[],w=[];return o.status==="rejected"&&w.push("files"),c.status==="rejected"&&w.push("diff"),d.status==="rejected"&&w.push("logs"),{changedFiles:l,diff:h,logs:x,unavailable:w}}function Mt(e){let t=j(e.payload),r=j(t?.task)??t;return r&&typeof r.id=="string"?r:void 0}function zt(e){let t=j(e.payload);return jt(t?.event??t)}function Lt(e){let t=j(e.payload);return qt(t?.changedFiles??t?.files??[])}var Ut=String.raw`
|
|
2
2
|
--graphite: #20211f;
|
|
3
3
|
--graphite-2: #30312e;
|
|
4
4
|
--strip: #f4efe3;
|
|
@@ -1081,6 +1081,6 @@ var xe,v,rt,tn,O,Ze,it,ot,Ce,he,ne,at,Fe,Ae,Pe,nn,me={},ve=[],rn=/acit|ex(?:s|g|
|
|
|
1081
1081
|
animation: none;
|
|
1082
1082
|
}
|
|
1083
1083
|
}
|
|
1084
|
-
`;var wn=0;function i(e,t,n,r,s,o){t||(t={});var c,d,f=t;if("ref"in f)for(d in f={},t)d=="ref"?c=t[d]:f[d]=t[d];var l={type:e,props:f,key:n,ref:c,__k:null,__:null,__b:0,__e:null,__c:null,constructor:void 0,__v:--wn,__i:-1,__u:0,__source:s,__self:o};if(typeof e=="function"&&(c=e.defaultProps))for(d in c)f[d]===void 0&&(f[d]=c[d]);return v.vnode&&v.vnode(l),l}var le=100,Bt=le+1,Ht=6e4,Nt={queued:"\uB300\uAE30 \uC911",preparing:"\uC791\uC5C5 \uC900\uBE44",snapshotting_before:"\uBCC0\uACBD \uC804 \uC2A4\uB0C5\uC0F7",resolving_context:"\uC18C\uC2A4 \uD655\uC778",running_agent:"\uC5D0\uC774\uC804\uD2B8 \uC218\uC815 \uC911",snapshotting_after:"\uBCC0\uACBD \uD6C4 \uC2A4\uB0C5\uC0F7",diffing:"\uBCC0\uACBD \uBC94\uC704 \uACC4\uC0B0",waiting_hmr:"\uD654\uBA74 \uBC18\uC601 \uB300\uAE30",verifying:"\uAC80\uC99D \uC911",review:"\uAC80\uD1A0 \uB300\uAE30",accepted:"\uBCC0\uACBD \uC720\uC9C0",reverted:"\uB418\uB3CC\uB9AC\uAE30 \uC644\uB8CC",failed:"\uC791\uC5C5 \uC2E4\uD328",canceled:"\uC791\uC5C5 \uCDE8\uC18C",unsafe:"\uC548\uC804 \uD655\uC778 \uD544\uC694"},Ve=new Set(["queued","preparing","snapshotting_before","resolving_context","running_agent","snapshotting_after","diffing","waiting_hmr","verifying"]),Ke=new Set(["review","unsafe"]),Sn=new Set(["failed","canceled","unsafe"]),Wt={unpaired:"\uC5F0\uACB0 \uD544\uC694",connecting:"\uC5F0\uACB0 \uC911",connected:"\uC2E4\uC2DC\uAC04",reconnecting:"\uC7AC\uC5F0\uACB0 \uC911",offline:"\uC624\uD504\uB77C\uC778",unauthorized:"\uC778\uC99D \uB9CC\uB8CC"};function Ge(e){return Sn.has(e.status)||e.verificationStatus==="failed"}function Ot(e){switch(e){case"instance":return"\uC120\uD0DD\uD55C \uC778\uC2A4\uD134\uC2A4";case"component":return"\uACF5\uC6A9 \uCEF4\uD3EC\uB10C\uD2B8";case"page":return"\uD604\uC7AC \uD398\uC774\uC9C0";case"project":return"\uD504\uB85C\uC81D\uD2B8 \uC804\uCCB4"}}function Tn(e){switch(e){case"passed":return"\uAC80\uC99D \uD1B5\uACFC";case"partial":return"\uBD80\uBD84 \uAC80\uC99D";case"failed":return"\uAC80\uC99D \uC2E4\uD328";default:return"\uBBF8\uAC80\uC99D"}}function Vt(e){let t=e.completedAt??e.startedAt??e.createdAt,n=new Date(t);return Number.isNaN(n.getTime())?"\uC2DC\uAC04 \uBBF8\uC0C1":new Intl.DateTimeFormat("ko-KR",{year:"2-digit",month:"2-digit",day:"2-digit",hour:"2-digit",minute:"2-digit"}).format(n)}function En(e){return e?new Intl.DateTimeFormat("ko-KR",{hour:"2-digit",minute:"2-digit",second:"2-digit"}).format(e):"\uC544\uC9C1 \uAC31\uC2E0\uB418\uC9C0 \uC54A\uC74C"}function He(e,t){return t==="active"?Ve.has(e.status):t==="review"?Ke.has(e.status):t==="issue"?Ge(e):!0}function Kt(e){return Ge(e)?"issue":Ve.has(e.status)?"active":Ke.has(e.status)?"review":"done"}function In(e){let t=e instanceof Error?e.message:String(e);return q(t,180)}function Ne(e,t){let n=In(e);return n.includes("unauthorized")||n.includes("401")||n.includes("Invalid viewer token")?"\uC77D\uAE30 \uC804\uC6A9 \uC138\uC158\uC774 \uB9CC\uB8CC\uB418\uC5C8\uC2B5\uB2C8\uB2E4. Overlay\uC758 \u2018\uC791\uC5C5 \uBCF4\uB4DC\u2019 \uBC84\uD2BC\uC5D0\uC11C \uB2E4\uC2DC \uC5F4\uC5B4\uC8FC\uC138\uC694.":`${t} (${n})`}function Rn(e){return e==="files"?"\uBCC0\uACBD \uD30C\uC77C":e==="logs"?"\uC791\uC5C5 \uB85C\uADF8":"diff"}function Se(e){return[...e].sort((t,n)=>n.createdAt.localeCompare(t.createdAt)||n.id.localeCompare(t.id))}function
|
|
1084
|
+
`;var wn=0;function i(e,t,n,r,s,o){t||(t={});var c,d,f=t;if("ref"in f)for(d in f={},t)d=="ref"?c=t[d]:f[d]=t[d];var l={type:e,props:f,key:n,ref:c,__k:null,__:null,__b:0,__e:null,__c:null,constructor:void 0,__v:--wn,__i:-1,__u:0,__source:s,__self:o};if(typeof e=="function"&&(c=e.defaultProps))for(d in c)f[d]===void 0&&(f[d]=c[d]);return v.vnode&&v.vnode(l),l}var le=100,Bt=le+1,Ht=6e4,Nt={queued:"\uB300\uAE30 \uC911",preparing:"\uC791\uC5C5 \uC900\uBE44",snapshotting_before:"\uBCC0\uACBD \uC804 \uC2A4\uB0C5\uC0F7",resolving_context:"\uC18C\uC2A4 \uD655\uC778",running_agent:"\uC5D0\uC774\uC804\uD2B8 \uC218\uC815 \uC911",snapshotting_after:"\uBCC0\uACBD \uD6C4 \uC2A4\uB0C5\uC0F7",diffing:"\uBCC0\uACBD \uBC94\uC704 \uACC4\uC0B0",waiting_hmr:"\uD654\uBA74 \uBC18\uC601 \uB300\uAE30",verifying:"\uAC80\uC99D \uC911",review:"\uAC80\uD1A0 \uB300\uAE30",accepted:"\uBCC0\uACBD \uC720\uC9C0",reverted:"\uB418\uB3CC\uB9AC\uAE30 \uC644\uB8CC",failed:"\uC791\uC5C5 \uC2E4\uD328",canceled:"\uC791\uC5C5 \uCDE8\uC18C",unsafe:"\uC548\uC804 \uD655\uC778 \uD544\uC694"},Ve=new Set(["queued","preparing","snapshotting_before","resolving_context","running_agent","snapshotting_after","diffing","waiting_hmr","verifying"]),Ke=new Set(["review","unsafe"]),Sn=new Set(["failed","canceled","unsafe"]),Wt={unpaired:"\uC5F0\uACB0 \uD544\uC694",connecting:"\uC5F0\uACB0 \uC911",connected:"\uC2E4\uC2DC\uAC04",reconnecting:"\uC7AC\uC5F0\uACB0 \uC911",offline:"\uC624\uD504\uB77C\uC778",unauthorized:"\uC778\uC99D \uB9CC\uB8CC"};function Ge(e){return Sn.has(e.status)||e.verificationStatus==="failed"}function Ot(e){switch(e){case"instance":return"\uC120\uD0DD\uD55C \uC778\uC2A4\uD134\uC2A4";case"component":return"\uACF5\uC6A9 \uCEF4\uD3EC\uB10C\uD2B8";case"page":return"\uD604\uC7AC \uD398\uC774\uC9C0";case"project":return"\uD504\uB85C\uC81D\uD2B8 \uC804\uCCB4"}}function Tn(e){switch(e){case"passed":return"\uAC80\uC99D \uD1B5\uACFC";case"partial":return"\uBD80\uBD84 \uAC80\uC99D";case"failed":return"\uAC80\uC99D \uC2E4\uD328";default:return"\uBBF8\uAC80\uC99D"}}function Vt(e){let t=e.completedAt??e.startedAt??e.createdAt,n=new Date(t);return Number.isNaN(n.getTime())?"\uC2DC\uAC04 \uBBF8\uC0C1":new Intl.DateTimeFormat("ko-KR",{year:"2-digit",month:"2-digit",day:"2-digit",hour:"2-digit",minute:"2-digit"}).format(n)}function En(e){return e?new Intl.DateTimeFormat("ko-KR",{hour:"2-digit",minute:"2-digit",second:"2-digit"}).format(e):"\uC544\uC9C1 \uAC31\uC2E0\uB418\uC9C0 \uC54A\uC74C"}function He(e,t){return t==="active"?Ve.has(e.status):t==="review"?Ke.has(e.status):t==="issue"?Ge(e):!0}function Kt(e){return Ge(e)?"issue":Ve.has(e.status)?"active":Ke.has(e.status)?"review":"done"}function In(e){let t=e instanceof Error?e.message:String(e);return q(t,180)}function Ne(e,t){let n=In(e);return n.includes("unauthorized")||n.includes("401")||n.includes("Invalid viewer token")?"\uC77D\uAE30 \uC804\uC6A9 \uC138\uC158\uC774 \uB9CC\uB8CC\uB418\uC5C8\uC2B5\uB2C8\uB2E4. Overlay\uC758 \u2018\uC791\uC5C5 \uBCF4\uB4DC\u2019 \uBC84\uD2BC\uC5D0\uC11C \uB2E4\uC2DC \uC5F4\uC5B4\uC8FC\uC138\uC694.":`${t} (${n})`}function Rn(e){return e==="files"?"\uBCC0\uACBD \uD30C\uC77C":e==="logs"?"\uC791\uC5C5 \uB85C\uADF8":"diff"}function Se(e){return[...e].sort((t,n)=>n.createdAt.localeCompare(t.createdAt)||n.id.localeCompare(t.id))}function An(e,t){let n=e.findIndex(s=>s.id===t.id);if(n<0)return Se([t,...e]);let r=[...e];return r[n]=t,Se(r)}function We(e,t){let n=t.trim().toLocaleLowerCase("ko-KR");return n?[e.id,e.requestText,...e.changedFiles].some(r=>r.toLocaleLowerCase("ko-KR").includes(n)):!0}function Cn(e){return e instanceof Error&&e.name==="AbortError"}function Pn(){let e=J(Pt,[]),t=J(()=>crypto.randomUUID(),[]),n=U(null),r=U([]),s=U("all"),o=U(""),c=U(null),d=U(0),f=U(!1),l=U([]),h=U(e?"connecting":"unpaired"),[b,a]=F("current"),[p,x]=F([]),[w,k]=F("all"),[y,g]=F(""),[C,K]=F(null),[L,z]=F(null),[H,G]=F(!!e),[N,$]=F(!1),[W,Ye]=F(!1),[Je,Q]=F(null),[Yt,Te]=F(null),[Jt,Qt]=F(null),[Ee,Xt]=F({state:e?"connecting":"unpaired",lastSequence:0});r.current=p,s.current=w,o.current=y;let D=ee(async(u,_=!1)=>{let R=u?.id??null;if(n.current=R,K(R),c.current?.abort(),c.current=null,!u||!e){z(null);return}let P=new AbortController;c.current=P,z(A=>_&&A?.taskId===u.id?(()=>{let m={...A};return delete m.error,m})():{taskId:u.id,loading:!0,changedFiles:u.changedFiles,diff:"",logs:[],unavailable:[]});try{let A=await $t(e,u.id,P.signal);z(m=>m?.taskId===u.id&&!P.signal.aborted?{taskId:u.id,loading:!1,...A}:m)}catch(A){if(Cn(A))return;z(m=>m?.taskId===u.id?{...m,loading:!1,error:Ne(A,"\uC0C1\uC138 \uB0B4\uC5ED\uC744 \uBD88\uB7EC\uC624\uC9C0 \uBABB\uD588\uC2B5\uB2C8\uB2E4.")}:m)}finally{c.current===P&&(c.current=null)}},[e]),ce=ee(u=>{Te(new Date);let _=Mt(u);_&&x(m=>{let M=An(m,_);return r.current=M,M});let R=u.taskId??_?.id;if(!R||n.current!==R)return;let P=zt(u),A=Lt(u);if((P||A.length>0)&&z(m=>m?.taskId===R?{...m,changedFiles:A.length>0?A:m.changedFiles,logs:P?[...m.logs,P].slice(-40):m.logs}:m),["task.diff_ready","task.completed","task.failed","task.canceled","task.reverted","task.verification_result"].includes(u.type)){let m=_??r.current.find(M=>M.id===R);m&&D(m,!0)}},[D]),Qe=ee(u=>{if(!f.current){l.current.push(u);return}ce(u)},[ce]),Y=ee(async()=>{if(!e){Q("Overlay\uC758 \u2018\uC791\uC5C5 \uBCF4\uB4DC\u2019 \uBC84\uD2BC\uC5D0\uC11C \uB2E4\uC2DC \uC5F4\uC5B4\uC8FC\uC138\uC694.");return}let u=++d.current;f.current=!1,G(!0),Q(null);try{let[_,R]=await Promise.all([Be(e,{limit:Bt}),Ft(e)]);if(u!==d.current)return;let P=_.slice(0,le),A=Se(P);r.current=A,x(A),Ye(_.length>le),R&&a(R);let m=n.current?A.find(pe=>pe.id===n.current):void 0,M=m&&He(m,s.current)&&We(m,o.current)?m:A.find(pe=>He(pe,s.current)&&We(pe,o.current))??null;await D(M),Te(new Date)}catch(_){if(u!==d.current)return;Q(Ne(_,"\uC791\uC5C5 \uBAA9\uB85D\uC744 \uBD88\uB7EC\uC624\uC9C0 \uBABB\uD588\uC2B5\uB2C8\uB2E4. Bridge \uC5F0\uACB0\uC744 \uD655\uC778\uD574 \uC8FC\uC138\uC694."))}finally{if(u===d.current){f.current=!0;let _=l.current.splice(0).sort((R,P)=>R.seq-P.seq);for(let R of _)ce(R);G(!1)}}},[ce,D,e]),Zt=ee(async()=>{if(!e||N)return;let u=r.current.at(-1);if(u){$(!0),Q(null);try{let _=await Be(e,{limit:Bt,cursor:{id:u.id,createdAt:u.createdAt}}),R=_.slice(0,le);x(P=>{let A=new Map(P.map(M=>[M.id,M]));for(let M of R)A.set(M.id,M);let m=Se([...A.values()]);return r.current=m,m}),Ye(_.length>le),Te(new Date)}catch(_){Q(Ne(_,"\uC774\uC804 \uC791\uC5C5 \uAE30\uB85D\uC744 \uBD88\uB7EC\uC624\uC9C0 \uBABB\uD588\uC2B5\uB2C8\uB2E4."))}finally{$(!1)}}},[N,e]);oe(()=>{Y()},[Y]);let X=J(()=>p.filter(u=>He(u,w)&&We(u,y)),[w,y,p]);oe(()=>{let u=n.current;u&&X.some(_=>_.id===u)||D(X[0]??null)},[X,D]),oe(()=>{if(!e)return;let u=new we({token:e,mode:"viewer",browserSessionId:t,onSequenceGap:()=>{Y()},onSnapshot:_=>{let R=h.current;h.current=_.state,Xt(_),_.projectId&&a(_.projectId),_.state==="unauthorized"?Q("\uC77D\uAE30 \uC804\uC6A9 \uC138\uC158\uC774 \uB9CC\uB8CC\uB418\uC5C8\uC2B5\uB2C8\uB2E4. Overlay\uC758 \u2018\uC791\uC5C5 \uBCF4\uB4DC\u2019 \uBC84\uD2BC\uC5D0\uC11C \uB2E4\uC2DC \uC5F4\uC5B4\uC8FC\uC138\uC694."):_.state==="connected"&&(R==="offline"||R==="reconnecting")&&Y()},onEvent:Qe});return u.connect(),()=>u.close()},[Qe,Y,e,t]),oe(()=>()=>{c.current?.abort()},[]);let E=p.find(u=>u.id===C)??null,S=E&&L?.taskId===E.id?L:null,de=S&&S.changedFiles.length>0?S.changedFiles:E?.changedFiles??[],Ie=S?.diff??"",Re=Ie.length>Ht,te=E?.id===Jt,en=Re&&!te?`${Ie.slice(0,Ht)}
|
|
1085
1085
|
|
|
1086
|
-
\u2026 \uC131\uB2A5\uC744 \uC704\uD574 \uB098\uBA38\uC9C0 diff\uB97C \uC811\uC5C8\uC2B5\uB2C8\uB2E4.`:Ie,ue=J(()=>({all:p.length,active:p.filter(u=>Ve.has(u.status)).length,review:p.filter(u=>Ke.has(u.status)).length,issue:p.filter(Ge).length}),[p]),Xe=[{value:"all",label:"\uC804\uCCB4",count:ue.all},{value:"active",label:"\uC9C4\uD589 \uC911",count:ue.active},{value:"review",label:"\uAC80\uD1A0 \uD544\uC694",count:ue.review},{value:"issue",label:"\uBB38\uC81C",count:ue.issue}];return i("div",{class:"viewer-app","data-loading":H?"true":"false",children:[i("header",{class:"viewer-header",children:[i("div",{class:"viewer-brand",children:[i("span",{class:"brand-signal","aria-hidden":"true"}),i("span",{children:[i("strong",{children:"Visual Bridge"}),i("small",{children:"\uC791\uC5C5 \uBDF0\uC5B4"})]})]}),i("div",{class:"header-instruments",children:[i("span",{class:"project-readout",children:[i("small",{children:"PROJECT"}),i("strong",{children:b})]}),i("span",{class:"connection-readout","data-state":Ee.state,children:[i("small",{children:"STREAM"}),i("strong",{children:[i("span",{"aria-hidden":"true"}),Wt[Ee.state]]})]}),i("span",{class:"refresh-readout",children:[i("small",{children:"LAST SYNC"}),i("strong",{children:En(Yt)})]}),i("button",{type:"button",class:"refresh-button",disabled:H,onClick:()=>{Y()},children:H?"\uAC31\uC2E0 \uC911":"\uC0C8\uB85C\uACE0\uCE68"})]})]}),i("main",{class:"viewer-main",children:[i("section",{class:"viewer-intro","aria-labelledby":"viewer-title",children:[i("div",{children:[i("h1",{id:"viewer-title",children:"\uD504\uB85C\uC81D\uD2B8 \uC791\uC5C5 \uD750\uB984"}),i("p",{children:"\uC694\uCCAD\uBD80\uD130 \uAC80\uC99D \uACB0\uACFC\uAE4C\uC9C0, Bridge\uAC00 \uAE30\uB85D\uD55C task\uB97C \uD55C \uD654\uBA74\uC5D0\uC11C \uAC80\uD1A0\uD569\uB2C8\uB2E4."})]}),i("span",{class:"read-only-mark",children:"READ ONLY"})]}),i("nav",{class:"status-rail","aria-label":"\uC791\uC5C5 \uC0C1\uD0DC \uD544\uD130",children:Xe.map(u=>i("button",{type:"button","aria-pressed":w===u.value?"true":"false",onClick:()=>k(u.value),children:[i("span",{children:u.label}),i("strong",{class:"machine",children:u.count})]},u.value))}),Je?i("div",{class:"viewer-error",role:"alert",children:[i("span",{children:Je}),i("button",{type:"button",onClick:()=>{Y()},children:"\uB2E4\uC2DC \uC2DC\uB3C4"})]}):null,i("span",{class:"visually-hidden",role:"status","aria-live":"polite",children:H&&p.length===0?"\uC791\uC5C5 \uAE30\uB85D \uBD88\uB7EC\uC624\uB294 \uC911":E?`${q(E.requestText,80)} \uC791\uC5C5 \uC0C1\uC138 ${S?.loading?"\uBD88\uB7EC\uC624\uB294 \uC911":"\uC120\uD0DD\uB428"}, ${Wt[Ee.state]}`:"\uC120\uD0DD\uD55C \uC791\uC5C5 \uC5C6\uC74C"}),i("section",{class:"operations-board","aria-label":"\uC791\uC5C5 \uB300\uC2DC\uBCF4\uB4DC",children:[i("aside",{class:"task-ledger",children:[i("header",{class:"board-head",children:[i("div",{children:[i("h2",{children:"\uC791\uC5C5 \uBAA9\uB85D"}),i("p",{children:w==="all"?"\uD504\uB85C\uC81D\uD2B8 \uC804\uCCB4":Xe.find(u=>u.value===w)?.label})]}),i("div",{class:"board-head-tools",children:[i("span",{class:"machine",children:[X.length," / ",p.length]}),i("a",{class:"detail-jump",href:"#task-detail",children:"\uC0C1\uC138\uB85C \uC774\uB3D9"})]})]}),i("div",{class:"ledger-search",children:[i("label",{children:[i("span",{class:"visually-hidden",children:"\uC791\uC5C5 \uAC80\uC0C9"}),i("input",{type:"search",value:y,placeholder:"\uC694\uCCAD\xB7\uD30C\uC77C\xB7Task ID \uAC80\uC0C9",onInput:u=>g(u.currentTarget.value)})]}),i("span",{class:"machine",children:["\uBD88\uB7EC\uC628 ",p.length,"\uAC1C \uB0B4 \uAC80\uC0C9"]})]}),H&&p.length===0?i("div",{class:"ledger-state",role:"status",children:[i("strong",{children:"\uC791\uC5C5 \uAE30\uB85D\uC744 \uBD88\uB7EC\uC624\uB294 \uC911\uC785\uB2C8\uB2E4."}),i("span",{children:"Bridge task store\uB97C \uD655\uC778\uD558\uACE0 \uC788\uC2B5\uB2C8\uB2E4."})]}):X.length===0?i("div",{class:"ledger-state",children:[i("strong",{children:p.length===0?"\uC544\uC9C1 \uC791\uC5C5 \uAE30\uB85D\uC774 \uC5C6\uC2B5\uB2C8\uB2E4.":y.trim()?"\uAC80\uC0C9 \uACB0\uACFC\uAC00 \uC5C6\uC2B5\uB2C8\uB2E4.":"\uC774 \uC0C1\uD0DC\uC758 \uC791\uC5C5\uC774 \uC5C6\uC2B5\uB2C8\uB2E4."}),i("span",{children:p.length===0?"Overlay\uC5D0\uC11C \uBCC0\uACBD\uC744 \uC694\uCCAD\uD558\uBA74 \uC5EC\uAE30\uC5D0 \uAE30\uB85D\uB429\uB2C8\uB2E4.":y.trim()?"\uB2E4\uB978 \uAC80\uC0C9\uC5B4\uB97C \uC785\uB825\uD558\uAC70\uB098 \uAC80\uC0C9\uC744 \uC9C0\uC6CC\uBCF4\uC138\uC694.":"\uB2E4\uB978 \uC0C1\uD0DC \uD544\uD130\uB97C \uC120\uD0DD\uD574 \uBCF4\uC138\uC694."})]}):i("ol",{class:"task-list",children:X.map(u=>i("li",{children:i("button",{type:"button",class:"task-row","data-tone":Kt(u),"aria-current":u.id===
|
|
1086
|
+
\u2026 \uC131\uB2A5\uC744 \uC704\uD574 \uB098\uBA38\uC9C0 diff\uB97C \uC811\uC5C8\uC2B5\uB2C8\uB2E4.`:Ie,ue=J(()=>({all:p.length,active:p.filter(u=>Ve.has(u.status)).length,review:p.filter(u=>Ke.has(u.status)).length,issue:p.filter(Ge).length}),[p]),Xe=[{value:"all",label:"\uC804\uCCB4",count:ue.all},{value:"active",label:"\uC9C4\uD589 \uC911",count:ue.active},{value:"review",label:"\uAC80\uD1A0 \uD544\uC694",count:ue.review},{value:"issue",label:"\uBB38\uC81C",count:ue.issue}];return i("div",{class:"viewer-app","data-loading":H?"true":"false",children:[i("header",{class:"viewer-header",children:[i("div",{class:"viewer-brand",children:[i("span",{class:"brand-signal","aria-hidden":"true"}),i("span",{children:[i("strong",{children:"Visual Bridge"}),i("small",{children:"\uC791\uC5C5 \uBDF0\uC5B4"})]})]}),i("div",{class:"header-instruments",children:[i("span",{class:"project-readout",children:[i("small",{children:"PROJECT"}),i("strong",{children:b})]}),i("span",{class:"connection-readout","data-state":Ee.state,children:[i("small",{children:"STREAM"}),i("strong",{children:[i("span",{"aria-hidden":"true"}),Wt[Ee.state]]})]}),i("span",{class:"refresh-readout",children:[i("small",{children:"LAST SYNC"}),i("strong",{children:En(Yt)})]}),i("button",{type:"button",class:"refresh-button",disabled:H,onClick:()=>{Y()},children:H?"\uAC31\uC2E0 \uC911":"\uC0C8\uB85C\uACE0\uCE68"})]})]}),i("main",{class:"viewer-main",children:[i("section",{class:"viewer-intro","aria-labelledby":"viewer-title",children:[i("div",{children:[i("h1",{id:"viewer-title",children:"\uD504\uB85C\uC81D\uD2B8 \uC791\uC5C5 \uD750\uB984"}),i("p",{children:"\uC694\uCCAD\uBD80\uD130 \uAC80\uC99D \uACB0\uACFC\uAE4C\uC9C0, Bridge\uAC00 \uAE30\uB85D\uD55C task\uB97C \uD55C \uD654\uBA74\uC5D0\uC11C \uAC80\uD1A0\uD569\uB2C8\uB2E4."})]}),i("span",{class:"read-only-mark",children:"READ ONLY"})]}),i("nav",{class:"status-rail","aria-label":"\uC791\uC5C5 \uC0C1\uD0DC \uD544\uD130",children:Xe.map(u=>i("button",{type:"button","aria-pressed":w===u.value?"true":"false",onClick:()=>k(u.value),children:[i("span",{children:u.label}),i("strong",{class:"machine",children:u.count})]},u.value))}),Je?i("div",{class:"viewer-error",role:"alert",children:[i("span",{children:Je}),i("button",{type:"button",onClick:()=>{Y()},children:"\uB2E4\uC2DC \uC2DC\uB3C4"})]}):null,i("span",{class:"visually-hidden",role:"status","aria-live":"polite",children:H&&p.length===0?"\uC791\uC5C5 \uAE30\uB85D \uBD88\uB7EC\uC624\uB294 \uC911":E?`${q(E.requestText,80)} \uC791\uC5C5 \uC0C1\uC138 ${S?.loading?"\uBD88\uB7EC\uC624\uB294 \uC911":"\uC120\uD0DD\uB428"}, ${Wt[Ee.state]}`:"\uC120\uD0DD\uD55C \uC791\uC5C5 \uC5C6\uC74C"}),i("section",{class:"operations-board","aria-label":"\uC791\uC5C5 \uB300\uC2DC\uBCF4\uB4DC",children:[i("aside",{class:"task-ledger",children:[i("header",{class:"board-head",children:[i("div",{children:[i("h2",{children:"\uC791\uC5C5 \uBAA9\uB85D"}),i("p",{children:w==="all"?"\uD504\uB85C\uC81D\uD2B8 \uC804\uCCB4":Xe.find(u=>u.value===w)?.label})]}),i("div",{class:"board-head-tools",children:[i("span",{class:"machine",children:[X.length," / ",p.length]}),i("a",{class:"detail-jump",href:"#task-detail",children:"\uC0C1\uC138\uB85C \uC774\uB3D9"})]})]}),i("div",{class:"ledger-search",children:[i("label",{children:[i("span",{class:"visually-hidden",children:"\uC791\uC5C5 \uAC80\uC0C9"}),i("input",{type:"search",value:y,placeholder:"\uC694\uCCAD\xB7\uD30C\uC77C\xB7Task ID \uAC80\uC0C9",onInput:u=>g(u.currentTarget.value)})]}),i("span",{class:"machine",children:["\uBD88\uB7EC\uC628 ",p.length,"\uAC1C \uB0B4 \uAC80\uC0C9"]})]}),H&&p.length===0?i("div",{class:"ledger-state",role:"status",children:[i("strong",{children:"\uC791\uC5C5 \uAE30\uB85D\uC744 \uBD88\uB7EC\uC624\uB294 \uC911\uC785\uB2C8\uB2E4."}),i("span",{children:"Bridge task store\uB97C \uD655\uC778\uD558\uACE0 \uC788\uC2B5\uB2C8\uB2E4."})]}):X.length===0?i("div",{class:"ledger-state",children:[i("strong",{children:p.length===0?"\uC544\uC9C1 \uC791\uC5C5 \uAE30\uB85D\uC774 \uC5C6\uC2B5\uB2C8\uB2E4.":y.trim()?"\uAC80\uC0C9 \uACB0\uACFC\uAC00 \uC5C6\uC2B5\uB2C8\uB2E4.":"\uC774 \uC0C1\uD0DC\uC758 \uC791\uC5C5\uC774 \uC5C6\uC2B5\uB2C8\uB2E4."}),i("span",{children:p.length===0?"Overlay\uC5D0\uC11C \uBCC0\uACBD\uC744 \uC694\uCCAD\uD558\uBA74 \uC5EC\uAE30\uC5D0 \uAE30\uB85D\uB429\uB2C8\uB2E4.":y.trim()?"\uB2E4\uB978 \uAC80\uC0C9\uC5B4\uB97C \uC785\uB825\uD558\uAC70\uB098 \uAC80\uC0C9\uC744 \uC9C0\uC6CC\uBCF4\uC138\uC694.":"\uB2E4\uB978 \uC0C1\uD0DC \uD544\uD130\uB97C \uC120\uD0DD\uD574 \uBCF4\uC138\uC694."})]}):i("ol",{class:"task-list",children:X.map(u=>i("li",{children:i("button",{type:"button",class:"task-row","data-tone":Kt(u),"aria-current":u.id===C?"true":void 0,"aria-controls":"task-detail",onClick:()=>{D(u)},children:[i("span",{class:"task-state","aria-hidden":"true"}),i("span",{class:"task-copy",children:[i("strong",{children:q(u.requestText,110)}),i("span",{children:[Nt[u.status]," \xB7 ",Ot(u.scope)]})]}),i("span",{class:"task-meta machine",children:[i("span",{children:Vt(u)}),i("span",{children:[u.changedFiles.length," files"]})]})]})},u.id))}),W?i("div",{class:"ledger-footer",children:i("button",{type:"button",disabled:N,onClick:()=>{Zt()},children:N?"\uC774\uC804 \uAE30\uB85D \uBD88\uB7EC\uC624\uB294 \uC911":"\uC774\uC804 \uC791\uC5C5 \uB354 \uBCF4\uAE30"})}):p.length>0?i("div",{class:"ledger-footer ledger-end",children:i("span",{children:"\uBD88\uB7EC\uC628 \uC791\uC5C5 \uAE30\uB85D\uC758 \uB05D\uC785\uB2C8\uB2E4."})}):null]}),i("section",{id:"task-detail",class:"task-detail","aria-label":"\uC120\uD0DD\uD55C \uC791\uC5C5 \uC0C1\uC138",tabIndex:-1,children:E?i(V,{children:[i("header",{class:"detail-head",children:[i("div",{children:[i("span",{class:"detail-kicker machine",children:["TASK ",E.id.slice(0,12)]}),i("h2",{children:E.requestText})]}),i("span",{class:"detail-status","data-tone":Kt(E),children:[i("span",{"aria-hidden":"true"}),Nt[E.status]]})]}),i("dl",{class:"fact-strip",children:[i("div",{children:[i("dt",{children:"\uC801\uC6A9 \uBC94\uC704"}),i("dd",{children:Ot(E.scope)})]}),i("div",{children:[i("dt",{children:"\uAC80\uC99D"}),i("dd",{children:Tn(E.verificationStatus)})]}),i("div",{children:[i("dt",{children:"\uCD5C\uADFC \uC2DC\uAC01"}),i("dd",{class:"machine",children:Vt(E)})]}),i("div",{children:[i("dt",{children:"\uBCC0\uACBD \uD30C\uC77C"}),i("dd",{class:"machine",children:de.length})]})]}),i("div",{class:"detail-scroll",role:"region","aria-label":"\uC120\uD0DD\uD55C \uC791\uC5C5\uC758 \uBCC0\uACBD \uB0B4\uC5ED",tabIndex:0,children:[E.error?.message||S?.error||S&&S.unavailable.length>0?i("div",{class:"detail-alerts",role:"alert",children:[E.error?.message?i("div",{class:"detail-error",children:[i("strong",{children:"\uC791\uC5C5 \uC624\uB958"}),i("span",{children:E.error.message})]}):null,S?.error?i("div",{class:"detail-error",children:[i("span",{children:S.error}),i("button",{type:"button",onClick:()=>{D(E)},children:"\uB2E4\uC2DC \uC2DC\uB3C4"})]}):null,S&&S.unavailable.length>0?i("div",{class:"detail-error",children:[i("span",{children:["\uC77C\uBD80 \uB0B4\uC5ED\uC744 \uBD88\uB7EC\uC624\uC9C0 \uBABB\uD588\uC2B5\uB2C8\uB2E4: ",S.unavailable.map(Rn).join(", ")]}),i("button",{type:"button",onClick:()=>{D(E)},children:"\uB2E4\uC2DC \uC2DC\uB3C4"})]}):null]}):null,i("section",{class:"files-block","aria-labelledby":"files-title",children:[i("header",{children:[i("h3",{id:"files-title",children:"\uBCC0\uACBD \uD30C\uC77C"}),i("span",{class:"machine",children:de.length})]}),de.length>0?i("ul",{children:de.map(u=>i("li",{title:u,children:[i("span",{children:"\u0394"}),u]},u))}):i("p",{children:"\uBCF4\uACE0\uB41C \uBCC0\uACBD \uD30C\uC77C\uC774 \uC5C6\uC2B5\uB2C8\uB2E4."})]}),i("div",{class:"evidence-grid",children:[i("section",{class:"logs-block","aria-labelledby":"logs-title",children:[i("header",{children:[i("h3",{id:"logs-title",children:"\uC791\uC5C5 \uB85C\uADF8"}),i("span",{class:"machine",children:S?.logs.length??0})]}),S?.loading?i("p",{class:"block-state",children:"\uC0C1\uC138 \uB0B4\uC5ED\uC744 \uBD88\uB7EC\uC624\uB294 \uC911\uC785\uB2C8\uB2E4."}):S&&S.logs.length>0?i("ol",{tabIndex:0,"aria-label":"\uC791\uC5C5 \uB85C\uADF8 \uBAA9\uB85D",children:S.logs.map((u,_)=>i("li",{children:[i("span",{class:"machine",children:String(_+1).padStart(2,"0")}),u]},`${_}-${u}`))}):S?.unavailable.includes("logs")?null:i("p",{class:"block-state",children:"\uC800\uC7A5\uB41C \uC791\uC5C5 \uB85C\uADF8\uAC00 \uC5C6\uC2B5\uB2C8\uB2E4."})]}),i("section",{class:"diff-block","aria-labelledby":"diff-title",children:[i("header",{children:[i("h3",{id:"diff-title",children:"Unified diff"}),i("div",{class:"diff-head-tools",children:[i("span",{class:"machine",children:Re&&!te?"PREVIEW":"DIFF"}),Re?i("button",{type:"button",class:"diff-toggle","aria-expanded":te?"true":"false",onClick:()=>Qt(te?null:E.id),children:te?"\uBBF8\uB9AC\uBCF4\uAE30\uB85C \uC811\uAE30":"\uC804\uCCB4 diff \uD3BC\uCE58\uAE30"}):null]})]}),S?.loading?i("p",{class:"block-state",children:"Diff\uB97C \uBD88\uB7EC\uC624\uB294 \uC911\uC785\uB2C8\uB2E4."}):S?.unavailable.includes("diff")?null:i("pre",{tabIndex:0,"aria-label":"Unified diff \uB0B4\uC6A9",children:en||"\uC800\uC7A5\uB41C diff\uAC00 \uC5C6\uC2B5\uB2C8\uB2E4."})]})]})]})]}):i("div",{class:"detail-empty",children:[i("span",{class:"empty-reticle","aria-hidden":"true"}),i("strong",{children:"\uAC80\uD1A0\uD560 \uC791\uC5C5\uC744 \uC120\uD0DD\uD558\uC138\uC694."}),i("p",{children:"\uC67C\uCABD \uC791\uC5C5 \uBAA9\uB85D\uC5D0\uC11C task\uB97C \uC120\uD0DD\uD558\uBA74 \uC694\uCCAD, \uBCC0\uACBD \uD30C\uC77C, \uB85C\uADF8\uC640 diff\uAC00 \uD45C\uC2DC\uB429\uB2C8\uB2E4."})]})})]})]})]})}var Gt=document.createElement("style");Gt.textContent=Dt;document.head.append(Gt);var Oe=document.getElementById("visual-viewer-root");Oe&&(Oe.replaceChildren(),ht(i(Pn,{}),Oe));
|