mesurer-solid 0.2.3-beta.12 → 0.2.3-beta.13
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.js +214 -205
- package/dist/inject-script.js +4 -4
- package/dist/inject.js +221 -212
- package/dist/plugins.js +172 -163
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -23747,7 +23747,9 @@ function Ww(e) {
|
|
|
23747
23747
|
let r = Math.hypot(t.clientX - n.x, t.clientY - n.y), i = e.runtime.annotations().find((e) => e.id === n.id);
|
|
23748
23748
|
r > 8 || !i || (f = n.id, h(i));
|
|
23749
23749
|
}, _ = () => {
|
|
23750
|
-
e.onCancel(), e.onOpenChange(!1), e.
|
|
23750
|
+
e.onCancel(), e.onOpenChange(!1), e.ownerWindow.queueMicrotask(() => {
|
|
23751
|
+
e.rendererRoot?.querySelector("button[data-mesurer-tool-id=\"context.notes\"]")?.focus();
|
|
23752
|
+
});
|
|
23751
23753
|
};
|
|
23752
23754
|
e.ownerWindow.addEventListener("pointerup", g, !0), Ln(() => e.ownerWindow.removeEventListener("pointerup", g, !0));
|
|
23753
23755
|
let v = (t) => {
|
|
@@ -27502,7 +27504,7 @@ function CO(e) {
|
|
|
27502
27504
|
}
|
|
27503
27505
|
//#endregion
|
|
27504
27506
|
//#region src/version.ts
|
|
27505
|
-
var wO = "0.2.3-beta.
|
|
27507
|
+
var wO = "0.2.3-beta.13", TO = Yy, EO = Xy, DO = () => ({
|
|
27506
27508
|
...Gb(),
|
|
27507
27509
|
version: wO
|
|
27508
27510
|
}), OO = EO, kO = (e, t) => e.left <= t.left + t.width && e.left + e.width >= t.left && e.top <= t.top + t.height && e.top + e.height >= t.top, AO = (e) => {
|
|
@@ -28104,22 +28106,22 @@ async function $O(e, t, n) {
|
|
|
28104
28106
|
var ek = vT, tk = yT, nk = () => ({
|
|
28105
28107
|
...GT(),
|
|
28106
28108
|
version: wO
|
|
28107
|
-
}), rk = "mesurer.context", ik = "context:v1", ak = "mesurer.context.settings", ok = "context.ui", sk = "data-mesurer-direct-text-edit-active",
|
|
28109
|
+
}), rk = "mesurer.context", ik = "context:v1", ak = "mesurer.context.settings", ok = "context.ui", sk = "context.notes-open", ck = "data-mesurer-direct-text-edit-active", lk = {
|
|
28108
28110
|
viewBox: "0 0 256 256",
|
|
28109
28111
|
paths: ["M216,32H88a8,8,0,0,0-8,8V80H40a8,8,0,0,0-8,8V216a8,8,0,0,0,8,8H168a8,8,0,0,0,8-8V176h40a8,8,0,0,0,8-8V40A8,8,0,0,0,216,32ZM160,208H48V96H160Zm48-48H176V88a8,8,0,0,0-8-8H96V48H208Z"]
|
|
28110
|
-
},
|
|
28112
|
+
}, uk = {
|
|
28111
28113
|
viewBox: "0 0 256 256",
|
|
28112
28114
|
paths: ["M152,40a8,8,0,0,1-8,8H112a8,8,0,0,1,0-16h32A8,8,0,0,1,152,40Zm-8,168H112a8,8,0,0,0,0,16h32a8,8,0,0,0,0-16ZM208,32H184a8,8,0,0,0,0,16h24V72a8,8,0,0,0,16,0V48A16,16,0,0,0,208,32Zm8,72a8,8,0,0,0-8,8v32a8,8,0,0,0,16,0V112A8,8,0,0,0,216,104Zm0,72a8,8,0,0,0-8,8v24H184a8,8,0,0,0,0,16h24a16,16,0,0,0,16-16V184A8,8,0,0,0,216,176ZM40,152a8,8,0,0,0,8-8V112a8,8,0,0,0-16,0v32A8,8,0,0,0,40,152Zm32,56H48V184a8,8,0,0,0-16,0v24a16,16,0,0,0,16,16H72a8,8,0,0,0,0-16ZM72,32H48A16,16,0,0,0,32,48V72a8,8,0,0,0,16,0V48H72a8,8,0,0,0,0-16Z"]
|
|
28113
|
-
},
|
|
28115
|
+
}, dk = {
|
|
28114
28116
|
viewBox: "0 0 256 256",
|
|
28115
28117
|
paths: ["M229.66,58.34l-32-32a8,8,0,0,0-11.32,0l-96,96A8,8,0,0,0,88,128v32a8,8,0,0,0,8,8h32a8,8,0,0,0,5.66-2.34l96-96A8,8,0,0,0,229.66,58.34ZM124.69,152H104V131.31l64-64L188.69,88ZM200,76.69,179.31,56,192,43.31,212.69,64ZM224,128v80a16,16,0,0,1-16,16H48a16,16,0,0,1-16-16V48A16,16,0,0,1,48,32h80a8,8,0,0,1,0,16H48V208H208V128a8,8,0,0,1,16,0Z"]
|
|
28116
|
-
},
|
|
28118
|
+
}, fk = {
|
|
28117
28119
|
viewBox: "0 0 256 256",
|
|
28118
28120
|
paths: ["M40 40h176v16H40zm0 48h176v16H40zm0 48h112v16H40zm0 48h112v16H40zM184 144l40 40-48 48-40-40z"]
|
|
28119
|
-
},
|
|
28121
|
+
}, pk = async (e, t, n = 1) => {
|
|
28120
28122
|
await e.fonts?.ready;
|
|
28121
28123
|
for (let e = 0; e < Math.max(1, n); e += 1) await new Promise((e) => t.requestAnimationFrame(() => e()));
|
|
28122
|
-
},
|
|
28124
|
+
}, mk = (e, t, n, r) => {
|
|
28123
28125
|
let i = async (i) => WO({
|
|
28124
28126
|
runtime: e,
|
|
28125
28127
|
ownerDocument: t,
|
|
@@ -28133,14 +28135,14 @@ var ek = vT, tk = yT, nk = () => ({
|
|
|
28133
28135
|
copyContext: async (e) => $O(t, n, await a(e)),
|
|
28134
28136
|
select: async (r) => {
|
|
28135
28137
|
let a = Array.isArray(r) ? [...r] : [String(r)];
|
|
28136
|
-
return e.select(a), await
|
|
28138
|
+
return e.select(a), await pk(t, n), i({ scope: "selection" });
|
|
28137
28139
|
},
|
|
28138
28140
|
annotations: async () => e.annotations(),
|
|
28139
28141
|
removeAnnotation: async (r, i) => {
|
|
28140
|
-
e.removeAnnotation(r, i), await
|
|
28142
|
+
e.removeAnnotation(r, i), await pk(t, n);
|
|
28141
28143
|
},
|
|
28142
28144
|
review: async (i) => {
|
|
28143
|
-
if (await
|
|
28145
|
+
if (await pk(t, n), i) return QO({
|
|
28144
28146
|
runtime: e,
|
|
28145
28147
|
ownerDocument: t,
|
|
28146
28148
|
ownerWindow: n,
|
|
@@ -28158,17 +28160,17 @@ var ek = vT, tk = yT, nk = () => ({
|
|
|
28158
28160
|
},
|
|
28159
28161
|
capturePlan: async (e) => JO(await i(e)),
|
|
28160
28162
|
prepareCapture: async () => {
|
|
28161
|
-
e.prepareCapture(), await
|
|
28163
|
+
e.prepareCapture(), await pk(t, n);
|
|
28162
28164
|
},
|
|
28163
28165
|
finishCapture: async () => {
|
|
28164
|
-
e.finishCapture(), await
|
|
28166
|
+
e.finishCapture(), await pk(t, n);
|
|
28165
28167
|
}
|
|
28166
28168
|
};
|
|
28167
|
-
},
|
|
28169
|
+
}, hk = (e, t) => {
|
|
28168
28170
|
let n = e.currentSelection();
|
|
28169
28171
|
return n.elements.length > 0 || n.region !== null && !t?.querySelector("[data-mesurer-responsive-stage]");
|
|
28170
28172
|
};
|
|
28171
|
-
function
|
|
28173
|
+
function gk(e = {}) {
|
|
28172
28174
|
return {
|
|
28173
28175
|
id: rk,
|
|
28174
28176
|
version: wO,
|
|
@@ -28179,59 +28181,66 @@ function hk(e = {}) {
|
|
|
28179
28181
|
if (!n) throw Error("Mesurer context plugin requires the renderer runtime service.");
|
|
28180
28182
|
let r = n.rendererRoot;
|
|
28181
28183
|
if (!r) throw Error("Mesurer Notes requires the renderer root.");
|
|
28182
|
-
let i = n.createWorkspaceRuntime(rk), a = n.createAnnotationRevealCoordinator(i), [o, s] = G(!1)
|
|
28183
|
-
t.
|
|
28184
|
+
let i = n.createWorkspaceRuntime(rk), a = n.createAnnotationRevealCoordinator(i), [o, s] = G(!1);
|
|
28185
|
+
t.state.register({
|
|
28186
|
+
id: sk,
|
|
28187
|
+
initial: !1
|
|
28188
|
+
});
|
|
28189
|
+
let c = (e) => {
|
|
28190
|
+
s(e), t.state.get(sk) !== e && t.state.update(sk, () => e);
|
|
28191
|
+
}, l = () => t.state.get(sk) ?? !1, u = mk(i, n.ownerDocument, n.ownerWindow, () => t.service.get(tk)?.list() ?? []);
|
|
28192
|
+
t.service.provide(ik, u), t.state.register({
|
|
28184
28193
|
id: ak,
|
|
28185
28194
|
initial: { ui: e.ui ?? !0 },
|
|
28186
28195
|
persist: !0
|
|
28187
28196
|
}), t.state.register({
|
|
28188
28197
|
id: ok,
|
|
28189
|
-
initial: { hasSelection:
|
|
28198
|
+
initial: { hasSelection: hk(i, n.rendererRoot) }
|
|
28190
28199
|
});
|
|
28191
|
-
let
|
|
28192
|
-
e || (
|
|
28200
|
+
let d = () => t.state.get("mesurer.context.settings")?.ui ?? !0, f = () => hk(i, n.rendererRoot), p = (e) => {
|
|
28201
|
+
e || (c(!1), a.cancel()), t.state.update(ak, (t) => ({
|
|
28193
28202
|
...t,
|
|
28194
28203
|
ui: e
|
|
28195
28204
|
}));
|
|
28196
|
-
},
|
|
28197
|
-
elements: [...
|
|
28198
|
-
region:
|
|
28199
|
-
},
|
|
28200
|
-
let e = i.currentSelection(), r = !
|
|
28201
|
-
|
|
28205
|
+
}, m = null, h = null, g = null, _ = null, [v, y] = G(!!n.rendererRoot?.querySelector("[data-mesurer-responsive-stage]")), b = null, x = i.currentSelection(), S = {
|
|
28206
|
+
elements: [...x.elements],
|
|
28207
|
+
region: x.region ? { ...x.region } : null
|
|
28208
|
+
}, C = (e, t) => e.elements.length !== t.elements.length || e.elements.some((e, n) => e !== t.elements[n]) ? !1 : e.region === t.region ? !0 : !e.region || !t.region ? !1 : e.region.left === t.region.left && e.region.top === t.region.top && e.region.width === t.region.width && e.region.height === t.region.height, w = i.subscribe(() => {
|
|
28209
|
+
let e = i.currentSelection(), r = !C(S, e);
|
|
28210
|
+
S = {
|
|
28202
28211
|
elements: [...e.elements],
|
|
28203
28212
|
region: e.region ? { ...e.region } : null
|
|
28204
|
-
}, i.selectGestureActive() ?
|
|
28205
|
-
let a =
|
|
28213
|
+
}, i.selectGestureActive() ? m?.abandonNoteComposer() : r && m?.closeNoteComposer();
|
|
28214
|
+
let a = hk(i, n.rendererRoot);
|
|
28206
28215
|
a !== (t.state.get(ok)?.hasSelection ?? !1) && t.state.update(ok, () => ({ hasSelection: a }));
|
|
28207
28216
|
});
|
|
28208
|
-
t.command.register("context.copy", () =>
|
|
28209
|
-
let
|
|
28210
|
-
let e =
|
|
28211
|
-
e && (n.rendererRoot?.hasAttribute(
|
|
28212
|
-
},
|
|
28213
|
-
|
|
28214
|
-
},
|
|
28215
|
-
if (
|
|
28216
|
-
if (
|
|
28217
|
-
let e = new n.ownerWindow.MutationObserver(
|
|
28218
|
-
|
|
28217
|
+
t.command.register("context.copy", () => u.copyContext()), t.command.register("context.copy-selection", () => u.copyContext({ scope: "selection" }));
|
|
28218
|
+
let T = () => {
|
|
28219
|
+
let e = g?.element;
|
|
28220
|
+
e && (n.rendererRoot?.hasAttribute(ck) ? e.setAttribute(ck, "true") : e.removeAttribute(ck));
|
|
28221
|
+
}, E = () => {
|
|
28222
|
+
_?.disconnect(), _ = null, m = null, h?.(), h = null, g?.dispose(), g = null;
|
|
28223
|
+
}, D = () => {
|
|
28224
|
+
if (g) return;
|
|
28225
|
+
if (g = Jw(n), b = g.element.parentNode, g.element.dataset.mesurerLayer = "evidence", g.element.dataset.mesurerContextRoot = "true", n.rendererRoot) {
|
|
28226
|
+
let e = new n.ownerWindow.MutationObserver(T);
|
|
28227
|
+
_ = e, e.observe(n.rendererRoot, {
|
|
28219
28228
|
attributes: !0,
|
|
28220
|
-
attributeFilter: [
|
|
28221
|
-
}),
|
|
28229
|
+
attributeFilter: [ck]
|
|
28230
|
+
}), T();
|
|
28222
28231
|
}
|
|
28223
28232
|
let e = {
|
|
28224
28233
|
runtime: i,
|
|
28225
|
-
onCopy:
|
|
28234
|
+
onCopy: u.copyContext,
|
|
28226
28235
|
onController: (e) => {
|
|
28227
|
-
|
|
28236
|
+
m = e;
|
|
28228
28237
|
},
|
|
28229
28238
|
get coordinateSpace() {
|
|
28230
|
-
return
|
|
28239
|
+
return v() ? "viewport" : "document";
|
|
28231
28240
|
},
|
|
28232
28241
|
rendererRoot: n.rendererRoot
|
|
28233
28242
|
};
|
|
28234
|
-
|
|
28243
|
+
h = Po(() => [bo(Hw, so(e, { get ownerWindow() {
|
|
28235
28244
|
return n.ownerWindow;
|
|
28236
28245
|
} })), bo(ns, {
|
|
28237
28246
|
mount: r,
|
|
@@ -28248,7 +28257,7 @@ function hk(e = {}) {
|
|
|
28248
28257
|
return o();
|
|
28249
28258
|
},
|
|
28250
28259
|
onOpenChange: (e) => {
|
|
28251
|
-
|
|
28260
|
+
c(e), e || a.cancel();
|
|
28252
28261
|
},
|
|
28253
28262
|
get onReveal() {
|
|
28254
28263
|
return a.reveal;
|
|
@@ -28257,29 +28266,29 @@ function hk(e = {}) {
|
|
|
28257
28266
|
return a.cancel;
|
|
28258
28267
|
},
|
|
28259
28268
|
onOpenAnnotation: (e) => {
|
|
28260
|
-
if (
|
|
28261
|
-
|
|
28269
|
+
if (m) {
|
|
28270
|
+
m.openAnnotation(e);
|
|
28262
28271
|
return;
|
|
28263
28272
|
}
|
|
28264
28273
|
n.ownerDocument.querySelector(`[data-mesurer-annotation-marker='true'][data-mesurer-annotation-id="${CSS.escape(e)}"]`)?.click();
|
|
28265
28274
|
}
|
|
28266
28275
|
});
|
|
28267
28276
|
}
|
|
28268
|
-
})],
|
|
28269
|
-
},
|
|
28270
|
-
|
|
28277
|
+
})], g.element), dn(v) && n.rendererRoot && (n.rendererRoot.append(g.element), g.element.style.zIndex = "90");
|
|
28278
|
+
}, O = () => {
|
|
28279
|
+
d() ? D() : E();
|
|
28271
28280
|
};
|
|
28272
|
-
|
|
28273
|
-
let
|
|
28281
|
+
O(), t.state.subscribe(O);
|
|
28282
|
+
let k = () => {
|
|
28274
28283
|
let e = !!n.rendererRoot?.querySelector("[data-mesurer-responsive-stage]");
|
|
28275
|
-
if (e === dn(
|
|
28276
|
-
let t = e ? n.rendererRoot :
|
|
28277
|
-
t &&
|
|
28284
|
+
if (e === dn(v) || (y(e), !g)) return;
|
|
28285
|
+
let t = e ? n.rendererRoot : b;
|
|
28286
|
+
t && g.element.parentNode !== t && t.appendChild(g.element), g.element.style.zIndex = e ? "90" : "", dn(() => m?.closeNoteComposer());
|
|
28278
28287
|
};
|
|
28279
|
-
n.ownerWindow.addEventListener("mesurer:responsive-stage-change",
|
|
28280
|
-
|
|
28288
|
+
n.ownerWindow.addEventListener("mesurer:responsive-stage-change", k), t.command.register("context.add-note", () => {
|
|
28289
|
+
f() && m?.openNoteComposer();
|
|
28281
28290
|
}), t.command.register("context.notes", () => {
|
|
28282
|
-
|
|
28291
|
+
d() && (o() && a.cancel(), c(!dn(o)));
|
|
28283
28292
|
}), t.tool.register({
|
|
28284
28293
|
id: "context.copy",
|
|
28285
28294
|
label: "Copy context",
|
|
@@ -28287,8 +28296,8 @@ function hk(e = {}) {
|
|
|
28287
28296
|
command: "context.copy",
|
|
28288
28297
|
order: 70,
|
|
28289
28298
|
toolbarMode: "always",
|
|
28290
|
-
icon:
|
|
28291
|
-
hidden: () => !
|
|
28299
|
+
icon: lk,
|
|
28300
|
+
hidden: () => !d()
|
|
28292
28301
|
}), t.tool.register({
|
|
28293
28302
|
id: "context.copy-selection",
|
|
28294
28303
|
label: "Copy selection",
|
|
@@ -28296,9 +28305,9 @@ function hk(e = {}) {
|
|
|
28296
28305
|
command: "context.copy-selection",
|
|
28297
28306
|
order: 71,
|
|
28298
28307
|
toolbarMode: "always",
|
|
28299
|
-
icon:
|
|
28300
|
-
hidden: () => !
|
|
28301
|
-
disabled: () => !
|
|
28308
|
+
icon: uk,
|
|
28309
|
+
hidden: () => !d(),
|
|
28310
|
+
disabled: () => !f()
|
|
28302
28311
|
}), t.tool.register({
|
|
28303
28312
|
id: "context.add-note",
|
|
28304
28313
|
label: "Add note",
|
|
@@ -28306,9 +28315,9 @@ function hk(e = {}) {
|
|
|
28306
28315
|
command: "context.add-note",
|
|
28307
28316
|
order: 72,
|
|
28308
28317
|
toolbarMode: "always",
|
|
28309
|
-
icon:
|
|
28310
|
-
hidden: () => !
|
|
28311
|
-
disabled: () => !
|
|
28318
|
+
icon: dk,
|
|
28319
|
+
hidden: () => !d(),
|
|
28320
|
+
disabled: () => !f()
|
|
28312
28321
|
}), t.tool.register({
|
|
28313
28322
|
id: "context.notes",
|
|
28314
28323
|
label: "Notes",
|
|
@@ -28316,9 +28325,9 @@ function hk(e = {}) {
|
|
|
28316
28325
|
order: 73,
|
|
28317
28326
|
toolbarMode: "always",
|
|
28318
28327
|
compactPinned: !0,
|
|
28319
|
-
icon:
|
|
28320
|
-
active:
|
|
28321
|
-
hidden: () => !
|
|
28328
|
+
icon: fk,
|
|
28329
|
+
active: l,
|
|
28330
|
+
hidden: () => !d()
|
|
28322
28331
|
}), t.settings.register({
|
|
28323
28332
|
id: "context",
|
|
28324
28333
|
label: "Context",
|
|
@@ -28328,18 +28337,18 @@ function hk(e = {}) {
|
|
|
28328
28337
|
id: "ui",
|
|
28329
28338
|
label: "Context tools",
|
|
28330
28339
|
description: "Show Copy Context, Copy Selection, Add Note, and annotation controls.",
|
|
28331
|
-
value:
|
|
28332
|
-
set:
|
|
28340
|
+
value: d,
|
|
28341
|
+
set: p
|
|
28333
28342
|
}]
|
|
28334
28343
|
}), t.lifecycle.onDispose(() => {
|
|
28335
|
-
a.dispose(),
|
|
28344
|
+
a.dispose(), w(), n.ownerWindow.removeEventListener("mesurer:responsive-stage-change", k), E(), i.dispose();
|
|
28336
28345
|
});
|
|
28337
28346
|
}
|
|
28338
28347
|
};
|
|
28339
28348
|
}
|
|
28340
28349
|
//#endregion
|
|
28341
28350
|
//#region src/host-layer.ts
|
|
28342
|
-
var
|
|
28351
|
+
var _k = {
|
|
28343
28352
|
display: "block",
|
|
28344
28353
|
position: "fixed",
|
|
28345
28354
|
inset: "0",
|
|
@@ -28381,48 +28390,48 @@ var gk = {
|
|
|
28381
28390
|
"letter-spacing": "normal",
|
|
28382
28391
|
direction: "ltr"
|
|
28383
28392
|
};
|
|
28384
|
-
function _k(e) {
|
|
28385
|
-
for (let [t, n] of Object.entries(gk)) e.style.setProperty(t, n, "important");
|
|
28386
|
-
}
|
|
28387
28393
|
function vk(e) {
|
|
28394
|
+
for (let [t, n] of Object.entries(_k)) e.style.setProperty(t, n, "important");
|
|
28395
|
+
}
|
|
28396
|
+
function yk(e) {
|
|
28388
28397
|
return "popover" in e && "showPopover" in e && typeof e.showPopover == "function" && "hidePopover" in e && typeof e.hidePopover == "function";
|
|
28389
28398
|
}
|
|
28390
|
-
var
|
|
28391
|
-
function
|
|
28392
|
-
if (!
|
|
28399
|
+
var bk = (e) => "newState" in e, xk = (e) => e.localName === "dialog";
|
|
28400
|
+
function Sk(e) {
|
|
28401
|
+
if (!xk(e) || !e.open) return !1;
|
|
28393
28402
|
try {
|
|
28394
28403
|
return e.matches(":modal");
|
|
28395
28404
|
} catch {
|
|
28396
28405
|
return !1;
|
|
28397
28406
|
}
|
|
28398
28407
|
}
|
|
28399
|
-
function
|
|
28400
|
-
|
|
28408
|
+
function Ck(e, t, n = !0) {
|
|
28409
|
+
vk(e);
|
|
28401
28410
|
let r = e.ownerDocument, i = r.defaultView ?? window, a = t, o = !1, s = "fixed", c = !1, l = 0, u = [];
|
|
28402
|
-
if (n &&
|
|
28411
|
+
if (n && yk(e) && (e.popover = "manual"), t.append(e), n && yk(e)) try {
|
|
28403
28412
|
e.showPopover(), c = e.matches(":popover-open"), c && (s = "top-layer");
|
|
28404
28413
|
} catch {
|
|
28405
28414
|
e.removeAttribute("popover");
|
|
28406
28415
|
}
|
|
28407
28416
|
let d = () => {
|
|
28408
|
-
if (!(!c || !
|
|
28417
|
+
if (!(!c || !yk(e))) try {
|
|
28409
28418
|
e.matches(":popover-open") || e.showPopover();
|
|
28410
28419
|
} catch {}
|
|
28411
28420
|
}, f = (t) => {
|
|
28412
28421
|
if (e.parentNode === t) return;
|
|
28413
|
-
let n = c &&
|
|
28414
|
-
if (n &&
|
|
28422
|
+
let n = c && yk(e) && e.matches(":popover-open");
|
|
28423
|
+
if (n && yk(e)) try {
|
|
28415
28424
|
e.hidePopover();
|
|
28416
28425
|
} catch {}
|
|
28417
|
-
t.append(e),
|
|
28426
|
+
t.append(e), vk(e), n && d();
|
|
28418
28427
|
}, p = () => {
|
|
28419
|
-
u = u.filter((e) => e.isConnected &&
|
|
28428
|
+
u = u.filter((e) => e.isConnected && Sk(e)), f(u.at(-1) ?? a);
|
|
28420
28429
|
}, m = (e) => {
|
|
28421
28430
|
u = u.filter((t) => t !== e), u.push(e), p();
|
|
28422
28431
|
}, h = (e) => {
|
|
28423
28432
|
u = u.filter((t) => t !== e), p();
|
|
28424
28433
|
}, g = () => {
|
|
28425
|
-
if (!(o || !c || !
|
|
28434
|
+
if (!(o || !c || !yk(e))) try {
|
|
28426
28435
|
e.matches(":popover-open") && e.hidePopover(), e.showPopover();
|
|
28427
28436
|
} catch {}
|
|
28428
28437
|
}, _ = () => {
|
|
@@ -28431,27 +28440,27 @@ function Sk(e, t, n = !0) {
|
|
|
28431
28440
|
}));
|
|
28432
28441
|
}, v = (t) => {
|
|
28433
28442
|
if (!c || t.target === e) return;
|
|
28434
|
-
let n =
|
|
28443
|
+
let n = bk(t) ? t.newState : void 0, r = t.target;
|
|
28435
28444
|
if (r instanceof i.Element) {
|
|
28436
|
-
if (
|
|
28437
|
-
n === "open" &&
|
|
28445
|
+
if (xk(r)) {
|
|
28446
|
+
n === "open" && Sk(r) ? (m(r), _()) : n === "closed" ? h(r) : n === "open" && _();
|
|
28438
28447
|
return;
|
|
28439
28448
|
}
|
|
28440
28449
|
n === "open" && r.hasAttribute("popover") && _();
|
|
28441
28450
|
}
|
|
28442
28451
|
}, y = (e) => {
|
|
28443
28452
|
let t = e.target;
|
|
28444
|
-
t instanceof i.Element &&
|
|
28453
|
+
t instanceof i.Element && xk(t) && h(t);
|
|
28445
28454
|
}, b = () => {
|
|
28446
28455
|
r.fullscreenElement && _();
|
|
28447
28456
|
}, x = (e) => {
|
|
28448
|
-
|
|
28449
|
-
for (let t of e.querySelectorAll("dialog"))
|
|
28457
|
+
Sk(e) && m(e);
|
|
28458
|
+
for (let t of e.querySelectorAll("dialog")) Sk(t) && m(t);
|
|
28450
28459
|
}, S = new i.MutationObserver((e) => {
|
|
28451
28460
|
if (c) for (let t of e) {
|
|
28452
28461
|
if (t.type === "attributes") {
|
|
28453
28462
|
let e = t.target;
|
|
28454
|
-
e instanceof i.Element &&
|
|
28463
|
+
e instanceof i.Element && xk(e) && (Sk(e) ? m(e) : h(e));
|
|
28455
28464
|
}
|
|
28456
28465
|
for (let e of t.addedNodes) e instanceof i.Element && x(e);
|
|
28457
28466
|
u.some((e) => !e.isConnected) && p();
|
|
@@ -28467,7 +28476,7 @@ function Sk(e, t, n = !0) {
|
|
|
28467
28476
|
bringToFront: g,
|
|
28468
28477
|
dispose() {
|
|
28469
28478
|
if (!o) {
|
|
28470
|
-
if (o = !0, l && i.cancelAnimationFrame(l), r.removeEventListener("toggle", v, !0), r.removeEventListener("close", y, !0), r.removeEventListener("fullscreenchange", b, !0), S.disconnect(), c &&
|
|
28479
|
+
if (o = !0, l && i.cancelAnimationFrame(l), r.removeEventListener("toggle", v, !0), r.removeEventListener("close", y, !0), r.removeEventListener("fullscreenchange", b, !0), S.disconnect(), c && yk(e) && e.matches(":popover-open")) try {
|
|
28471
28480
|
e.hidePopover();
|
|
28472
28481
|
} catch {}
|
|
28473
28482
|
u = [];
|
|
@@ -28477,7 +28486,7 @@ function Sk(e, t, n = !0) {
|
|
|
28477
28486
|
}
|
|
28478
28487
|
//#endregion
|
|
28479
28488
|
//#region src/plugins/codex/index.ts
|
|
28480
|
-
var
|
|
28489
|
+
var wk = "mesurer.codex", Tk = "codex:v1", Ek = "mesurer.plugin.before-disable", Dk = 2e3, Ok = 750, kk = 2e3, Ak = 1800, jk = 2e3, Mk = 12e4, Nk = 10, Pk = 5, Fk = "http://127.0.0.1:47365", Ik = "mesurer-codex", Lk = 2, Rk = [
|
|
28481
28490
|
"thread-discovery-v1",
|
|
28482
28491
|
"durable-queue-v1",
|
|
28483
28492
|
"history-recovery-v2",
|
|
@@ -28485,33 +28494,33 @@ var Ck = "mesurer.codex", wk = "codex:v1", Tk = "mesurer.plugin.before-disable",
|
|
|
28485
28494
|
"idle-safe-shutdown-v1",
|
|
28486
28495
|
"nonterminal-retention-v1",
|
|
28487
28496
|
"instance-binding-v1"
|
|
28488
|
-
],
|
|
28497
|
+
], zk = 1500, Bk = 15e3, Vk = 5e3, Hk = [
|
|
28489
28498
|
"Implement the current human feedback from Mesurer in this project.",
|
|
28490
28499
|
"Treat the rendered page as the source of truth, preserve unrelated Mesurer review state,",
|
|
28491
28500
|
"and verify the affected UI in the live page with Mesurer before claiming completion."
|
|
28492
|
-
].join(" "),
|
|
28501
|
+
].join(" "), Uk = {
|
|
28493
28502
|
viewBox: "0 0 256 256",
|
|
28494
28503
|
paths: ["M224,48,32,120l88,32,32,88Z M120,152l104-104"]
|
|
28495
|
-
},
|
|
28504
|
+
}, Wk = {
|
|
28496
28505
|
viewBox: "0 0 256 256",
|
|
28497
28506
|
paths: ["M72,32H184a8,8,0,0,1,0,16h-8v20.69a40,40,0,0,1-11.72,28.28L137.25,124l27.03,27.03A40,40,0,0,1,176,179.31V208h8a8,8,0,0,1,0,16H72a8,8,0,0,1,0-16h8V179.31a40,40,0,0,1,11.72-28.28L118.75,124,91.72,96.97A40,40,0,0,1,80,68.69V48H72a8,8,0,0,1,0-16Zm24,16V68.69a24,24,0,0,0,7.03,16.97L128,110.63l24.97-24.97A24,24,0,0,0,160,68.69V48Zm32,90.63-24.97,24.97A24,24,0,0,0,96,180.57V208h64V180.57a24,24,0,0,0-7.03-16.97Z"]
|
|
28498
|
-
},
|
|
28507
|
+
}, Gk = {
|
|
28499
28508
|
viewBox: "0 0 256 256",
|
|
28500
28509
|
paths: ["M229.66,77.66l-128,128a8,8,0,0,1-11.32,0l-56-56a8,8,0,0,1,11.32-11.32L96,188.69,218.34,66.34a8,8,0,0,1,11.32,11.32Z"]
|
|
28501
|
-
},
|
|
28510
|
+
}, Kk = class extends Error {
|
|
28502
28511
|
issue;
|
|
28503
28512
|
constructor(e, t) {
|
|
28504
28513
|
super(t), this.issue = e, this.name = "BrowserBridgeConnectionError";
|
|
28505
28514
|
}
|
|
28506
|
-
},
|
|
28515
|
+
}, qk = () => {
|
|
28507
28516
|
try {
|
|
28508
28517
|
let e = globalThis.location;
|
|
28509
28518
|
return e?.origin ? `mesurer-codex-ui:v2:${e.origin}${e.pathname}` : null;
|
|
28510
28519
|
} catch {
|
|
28511
28520
|
return null;
|
|
28512
28521
|
}
|
|
28513
|
-
},
|
|
28514
|
-
let e =
|
|
28522
|
+
}, Jk = () => {
|
|
28523
|
+
let e = qk();
|
|
28515
28524
|
if (!e) return null;
|
|
28516
28525
|
try {
|
|
28517
28526
|
let t = globalThis.sessionStorage?.getItem(e);
|
|
@@ -28539,35 +28548,35 @@ var Ck = "mesurer.codex", wk = "codex:v1", Tk = "mesurer.plugin.before-disable",
|
|
|
28539
28548
|
} catch {
|
|
28540
28549
|
return null;
|
|
28541
28550
|
}
|
|
28542
|
-
},
|
|
28543
|
-
let t =
|
|
28551
|
+
}, Yk = (e) => {
|
|
28552
|
+
let t = qk();
|
|
28544
28553
|
if (t) try {
|
|
28545
28554
|
globalThis.sessionStorage?.setItem(t, JSON.stringify(e));
|
|
28546
28555
|
} catch {}
|
|
28547
|
-
}, Yk = (e) => {
|
|
28548
|
-
let t = Pk.endsWith("/") ? Pk : `${Pk}/`;
|
|
28549
|
-
return new URL(e, t).toString();
|
|
28550
28556
|
}, Xk = (e) => {
|
|
28557
|
+
let t = Fk.endsWith("/") ? Fk : `${Fk}/`;
|
|
28558
|
+
return new URL(e, t).toString();
|
|
28559
|
+
}, Zk = (e) => {
|
|
28551
28560
|
let t = e.bridge;
|
|
28552
|
-
if (!t) throw new
|
|
28553
|
-
if (t.name !==
|
|
28554
|
-
if (t.protocol !==
|
|
28555
|
-
if (e.access?.allowed === !1) throw new
|
|
28556
|
-
let n = new Set(Array.isArray(t.capabilities) ? t.capabilities : []), r =
|
|
28557
|
-
if (r.length > 0) throw new
|
|
28558
|
-
if (!t.instanceId?.trim()) throw new
|
|
28559
|
-
},
|
|
28561
|
+
if (!t) throw new Kk("port-conflict", "Another local service or an outdated Mesurer Codex Bridge is using port 47365. Mesurer will not send data to an unverified service.");
|
|
28562
|
+
if (t.name !== Ik) throw new Kk("port-conflict", `Another local service is using port 47365 (${t.name ?? "unknown"}). Mesurer will not send Codex data to it.`);
|
|
28563
|
+
if (t.protocol !== Lk) throw new Kk("version-mismatch", `Mesurer Codex Bridge is out of date (protocol ${t.protocol ?? "unknown"}; expected ${Lk}). Restart the matching Mesurer Codex Bridge helper.`);
|
|
28564
|
+
if (e.access?.allowed === !1) throw new Kk("origin-denied", `Mesurer Codex Bridge does not allow this browser origin (${globalThis.location?.origin ?? "this page"}). Allow this origin when starting the bridge.`);
|
|
28565
|
+
let n = new Set(Array.isArray(t.capabilities) ? t.capabilities : []), r = Rk.filter((e) => !n.has(e));
|
|
28566
|
+
if (r.length > 0) throw new Kk("capability-mismatch", `Mesurer Codex Bridge is missing required capabilities: ${r.join(", ")}. Restart or update the matching helper.`);
|
|
28567
|
+
if (!t.instanceId?.trim()) throw new Kk("capability-mismatch", "Mesurer Codex Bridge did not provide an instance identity. Restart or update the matching helper.");
|
|
28568
|
+
}, Qk = (e) => e.includes("does not allow this browser origin") ? "origin-denied" : e.includes("out of date") ? "version-mismatch" : e.includes("missing required capabilities") || e.includes("did not provide an instance identity") ? "capability-mismatch" : e.includes("Another local service") ? "port-conflict" : e.includes("instance changed") ? "instance-changed" : e.includes("timed out") ? "timed-out" : e.includes("companion is unavailable") ? "not-running" : null, $k = (e) => e instanceof Kk ? e.issue : e instanceof Error ? Qk(e.message) : null, eA = async (e) => {
|
|
28560
28569
|
let t, n;
|
|
28561
|
-
if (e.action === "health") t =
|
|
28570
|
+
if (e.action === "health") t = Xk("health");
|
|
28562
28571
|
else if (e.action === "threads") {
|
|
28563
28572
|
let n = new URLSearchParams();
|
|
28564
|
-
n.set("limit", String(e.limit ??
|
|
28565
|
-
} else if (e.action === "target") t =
|
|
28573
|
+
n.set("limit", String(e.limit ?? Nk)), e.thread && n.set("thread", e.thread), t = `${Xk("threads")}?${n.toString()}`;
|
|
28574
|
+
} else if (e.action === "target") t = Xk("target"), n = {
|
|
28566
28575
|
method: "POST",
|
|
28567
28576
|
headers: { "Content-Type": "application/json" },
|
|
28568
28577
|
body: JSON.stringify({ thread: e.thread })
|
|
28569
28578
|
};
|
|
28570
|
-
else if (e.action === "queue") t =
|
|
28579
|
+
else if (e.action === "queue") t = Xk("send"), n = {
|
|
28571
28580
|
method: "POST",
|
|
28572
28581
|
headers: { "Content-Type": "application/json" },
|
|
28573
28582
|
body: JSON.stringify({
|
|
@@ -28575,8 +28584,8 @@ var Ck = "mesurer.codex", wk = "codex:v1", Tk = "mesurer.plugin.before-disable",
|
|
|
28575
28584
|
thread: e.thread
|
|
28576
28585
|
})
|
|
28577
28586
|
};
|
|
28578
|
-
else if (e.action === "delivery") t =
|
|
28579
|
-
else if (e.action === "restore") t =
|
|
28587
|
+
else if (e.action === "delivery") t = Xk(`deliveries/${encodeURIComponent(String(e.deliveryId ?? ""))}`);
|
|
28588
|
+
else if (e.action === "restore") t = Xk("deliveries/restore"), n = {
|
|
28580
28589
|
method: "POST",
|
|
28581
28590
|
headers: { "Content-Type": "application/json" },
|
|
28582
28591
|
body: JSON.stringify({
|
|
@@ -28590,14 +28599,14 @@ var Ck = "mesurer.codex", wk = "codex:v1", Tk = "mesurer.plugin.before-disable",
|
|
|
28590
28599
|
else throw Error(`Codex browser companion does not support ${e.action}.`);
|
|
28591
28600
|
if (e.action !== "health") {
|
|
28592
28601
|
let t = e.bridgeInstanceId?.trim();
|
|
28593
|
-
if (!t) throw new
|
|
28602
|
+
if (!t) throw new Kk("instance-changed", "Mesurer Codex Bridge instance changed before this request could be verified.");
|
|
28594
28603
|
let r = new Headers(n?.headers);
|
|
28595
28604
|
r.set("X-Mesurer-Bridge-Instance", t), n = {
|
|
28596
28605
|
...n,
|
|
28597
28606
|
headers: r
|
|
28598
28607
|
};
|
|
28599
28608
|
}
|
|
28600
|
-
let r = new AbortController(), i = e.action === "health" || e.action === "threads" ?
|
|
28609
|
+
let r = new AbortController(), i = e.action === "health" || e.action === "threads" ? zk : Bk, a = globalThis.setTimeout(() => r.abort(), i);
|
|
28601
28610
|
try {
|
|
28602
28611
|
let i = await fetch(t, {
|
|
28603
28612
|
...n,
|
|
@@ -28608,23 +28617,23 @@ var Ck = "mesurer.codex", wk = "codex:v1", Tk = "mesurer.plugin.before-disable",
|
|
|
28608
28617
|
} catch {
|
|
28609
28618
|
o = { error: a };
|
|
28610
28619
|
}
|
|
28611
|
-
if (e.action === "health" &&
|
|
28612
|
-
let e = o.error ?? `Mesurer Codex companion returned HTTP ${i.status}.`, t =
|
|
28613
|
-
throw t ? new
|
|
28620
|
+
if (e.action === "health" && Zk(o), !i.ok || o.ok === !1) {
|
|
28621
|
+
let e = o.error ?? `Mesurer Codex companion returned HTTP ${i.status}.`, t = Qk(e);
|
|
28622
|
+
throw t ? new Kk(t, e) : Error(e);
|
|
28614
28623
|
}
|
|
28615
28624
|
return o;
|
|
28616
28625
|
} catch (e) {
|
|
28617
|
-
throw e instanceof Error && e.name === "AbortError" ? new
|
|
28626
|
+
throw e instanceof Error && e.name === "AbortError" ? new Kk("timed-out", "Mesurer Codex companion timed out.") : e instanceof TypeError ? new Kk("not-running", `Mesurer Codex companion is unavailable at ${Fk}.`) : e;
|
|
28618
28627
|
} finally {
|
|
28619
28628
|
globalThis.clearTimeout(a);
|
|
28620
28629
|
}
|
|
28621
|
-
},
|
|
28630
|
+
}, tA = async (e) => {
|
|
28622
28631
|
let t = window.__MESURER_HOST__?.codexBridge;
|
|
28623
28632
|
if (!t) throw Error("Codex native host bridge is unavailable.");
|
|
28624
28633
|
let n = await t(e);
|
|
28625
28634
|
if (n.ok === !1) throw Error(n.error ?? "Codex Bridge request failed.");
|
|
28626
28635
|
return n;
|
|
28627
|
-
},
|
|
28636
|
+
}, nA = (e) => {
|
|
28628
28637
|
let t = e.runtime;
|
|
28629
28638
|
return !t || ![
|
|
28630
28639
|
"shared",
|
|
@@ -28642,10 +28651,10 @@ var Ck = "mesurer.codex", wk = "codex:v1", Tk = "mesurer.plugin.before-disable",
|
|
|
28642
28651
|
available: t.available === !0,
|
|
28643
28652
|
reason: t.reason
|
|
28644
28653
|
};
|
|
28645
|
-
},
|
|
28654
|
+
}, rA = (e) => ({
|
|
28646
28655
|
thread: e.thread?.trim() || null,
|
|
28647
28656
|
threads: Array.isArray(e.threads) ? e.threads.filter((e) => e.trim().length > 0) : []
|
|
28648
|
-
}),
|
|
28657
|
+
}), iA = (e) => {
|
|
28649
28658
|
let t = e.deliveryId?.trim(), n = e.thread?.trim(), r = e.status;
|
|
28650
28659
|
if (!t || !n || !r) throw Error("Codex Bridge returned an invalid delivery state.");
|
|
28651
28660
|
let i = {
|
|
@@ -28657,7 +28666,7 @@ var Ck = "mesurer.codex", wk = "codex:v1", Tk = "mesurer.plugin.before-disable",
|
|
|
28657
28666
|
updatedAt: Number.isFinite(e.updatedAt) ? Number(e.updatedAt) : 0
|
|
28658
28667
|
};
|
|
28659
28668
|
return e.queuedSubmissionId !== void 0 && (i.queuedSubmissionId = e.queuedSubmissionId?.trim() || null), e.clientUserMessageId !== void 0 && (i.clientUserMessageId = e.clientUserMessageId?.trim() || null), e.dispatch !== void 0 && (i.dispatch = e.dispatch), e.dispatchError !== void 0 && (i.dispatchError = e.dispatchError?.trim() || null), i;
|
|
28660
|
-
},
|
|
28669
|
+
}, aA = (e) => ({
|
|
28661
28670
|
thread: e.thread?.trim() || null,
|
|
28662
28671
|
threads: Array.isArray(e.threadDetails) ? e.threadDetails.flatMap((e) => {
|
|
28663
28672
|
let t = e.id?.trim() ?? "";
|
|
@@ -28669,7 +28678,7 @@ var Ck = "mesurer.codex", wk = "codex:v1", Tk = "mesurer.plugin.before-disable",
|
|
|
28669
28678
|
}] : [];
|
|
28670
28679
|
}) : [],
|
|
28671
28680
|
hasMore: e.hasMore === !0
|
|
28672
|
-
}),
|
|
28681
|
+
}), oA = async (e, t, n) => {
|
|
28673
28682
|
let r = t?.instruction?.trim() || n, i = await e.annotations(), a = t?.annotationIds, o = (a ? a.flatMap((e) => {
|
|
28674
28683
|
let t = i.find((t) => t.id === e);
|
|
28675
28684
|
return t ? [t] : [];
|
|
@@ -28700,18 +28709,18 @@ var Ck = "mesurer.codex", wk = "codex:v1", Tk = "mesurer.plugin.before-disable",
|
|
|
28700
28709
|
])
|
|
28701
28710
|
].join("\n").trimEnd()
|
|
28702
28711
|
};
|
|
28703
|
-
},
|
|
28704
|
-
function
|
|
28705
|
-
let t = e.instruction?.trim() ||
|
|
28712
|
+
}, sA = (e) => e.length > 16 ? `${e.slice(0, 8)}…${e.slice(-4)}` : e, cA = (e, t = 42) => e.length > t ? `${e.slice(0, t - 1)}…` : e, lA = (e) => $k(e) !== null || e instanceof Error && (e.message === "Codex Bridge is unavailable in this host." || e.message.includes("Codex Bridge lease") || e.message.includes("Mesurer Codex Bridge"));
|
|
28713
|
+
function uA(e = {}) {
|
|
28714
|
+
let t = e.instruction?.trim() || Hk, n = e.ui ?? !0, r = e.clearCompletedAnnotations ?? !0;
|
|
28706
28715
|
return {
|
|
28707
|
-
id:
|
|
28716
|
+
id: wk,
|
|
28708
28717
|
version: wO,
|
|
28709
28718
|
requires: [ik],
|
|
28710
|
-
provides: [
|
|
28719
|
+
provides: [Tk],
|
|
28711
28720
|
async setup(e) {
|
|
28712
28721
|
let i = e.service.get(ik);
|
|
28713
28722
|
if (!i) throw Error("Mesurer Codex plugin requires context() from mesurer-solid/plugins.");
|
|
28714
|
-
let a = n ?
|
|
28723
|
+
let a = n ? Jk() : null, o = "unknown", s = null, c = !1, l = a?.originThread ?? null, u = a?.selectedThread ?? a?.originThread ?? null, d = !1, f = null, p = [], m = [], h = !1, g = Pk, _, v = "", y = null, b = a?.delivery ? {
|
|
28715
28724
|
id: a.delivery.id,
|
|
28716
28725
|
thread: a.delivery.thread,
|
|
28717
28726
|
status: a.delivery.status,
|
|
@@ -28726,22 +28735,22 @@ function lA(e = {}) {
|
|
|
28726
28735
|
if (!A) try {
|
|
28727
28736
|
let t = e.action === "queue" || e.action === "target" || e.action === "delivery" || e.action === "restore";
|
|
28728
28737
|
if (e.action === "health") {
|
|
28729
|
-
let t = await
|
|
28738
|
+
let t = await eA(e);
|
|
28730
28739
|
return O = t.bridge?.instanceId?.trim() || null, D = Date.now(), t;
|
|
28731
28740
|
}
|
|
28732
|
-
return (!O || t || Date.now() - D >=
|
|
28741
|
+
return (!O || t || Date.now() - D >= Vk) && (O = (await eA({
|
|
28733
28742
|
action: "health",
|
|
28734
28743
|
thread: u ?? l ?? void 0
|
|
28735
|
-
})).bridge?.instanceId?.trim() || null, D = Date.now()), await
|
|
28744
|
+
})).bridge?.instanceId?.trim() || null, D = Date.now()), await eA({
|
|
28736
28745
|
...e,
|
|
28737
28746
|
bridgeInstanceId: O ?? void 0
|
|
28738
28747
|
});
|
|
28739
28748
|
} catch (e) {
|
|
28740
28749
|
throw D = 0, O = null, e;
|
|
28741
28750
|
}
|
|
28742
|
-
if (e.action === "activate" || e.action === "runtime") return
|
|
28751
|
+
if (e.action === "activate" || e.action === "runtime") return tA(e);
|
|
28743
28752
|
if (!E) throw Error("Codex Bridge lease is not active for this plugin.");
|
|
28744
|
-
return
|
|
28753
|
+
return tA({
|
|
28745
28754
|
...e,
|
|
28746
28755
|
leaseId: E
|
|
28747
28756
|
});
|
|
@@ -28749,7 +28758,7 @@ function lA(e = {}) {
|
|
|
28749
28758
|
if (!A) return;
|
|
28750
28759
|
let e = E;
|
|
28751
28760
|
if (e) {
|
|
28752
|
-
if ((await
|
|
28761
|
+
if ((await tA({
|
|
28753
28762
|
action: "deactivate",
|
|
28754
28763
|
leaseId: e
|
|
28755
28764
|
})).released !== !0) throw Error("Codex Bridge did not confirm lease release.");
|
|
@@ -28757,13 +28766,13 @@ function lA(e = {}) {
|
|
|
28757
28766
|
}
|
|
28758
28767
|
};
|
|
28759
28768
|
if (A) {
|
|
28760
|
-
let e = await
|
|
28769
|
+
let e = await tA({
|
|
28761
28770
|
action: "activate",
|
|
28762
28771
|
thread: u ?? l ?? void 0
|
|
28763
28772
|
}), t = e.leaseId?.trim();
|
|
28764
28773
|
if (!t) throw Error("Codex Bridge did not return an activation lease.");
|
|
28765
|
-
E = t, o = "available", s =
|
|
28766
|
-
let n =
|
|
28774
|
+
E = t, o = "available", s = nA(e);
|
|
28775
|
+
let n = rA(e);
|
|
28767
28776
|
c = !0, f = n.thread, p = n.threads;
|
|
28768
28777
|
}
|
|
28769
28778
|
e.lifecycle.onDispose(() => {
|
|
@@ -28771,12 +28780,12 @@ function lA(e = {}) {
|
|
|
28771
28780
|
let t = e instanceof Error ? e.message : String(e);
|
|
28772
28781
|
console.error(`[Mesurer] Failed to release Codex host lease: ${t}`);
|
|
28773
28782
|
});
|
|
28774
|
-
}), e.hook.on(
|
|
28783
|
+
}), e.hook.on(Ek, async (e) => {
|
|
28775
28784
|
e === "mesurer.codex" && await M();
|
|
28776
28785
|
});
|
|
28777
28786
|
let N = async () => {
|
|
28778
28787
|
if (!A) return null;
|
|
28779
|
-
let e =
|
|
28788
|
+
let e = nA(await j({ action: "runtime" }));
|
|
28780
28789
|
if (!e) throw Error("Codex Bridge returned an invalid runtime state.");
|
|
28781
28790
|
return s = e, e;
|
|
28782
28791
|
}, P = async () => {
|
|
@@ -28784,8 +28793,8 @@ function lA(e = {}) {
|
|
|
28784
28793
|
action: "health",
|
|
28785
28794
|
thread: u ?? l ?? void 0
|
|
28786
28795
|
});
|
|
28787
|
-
return s =
|
|
28788
|
-
}, F = P, I = async (e) =>
|
|
28796
|
+
return s = nA(e) ?? s, rA(e);
|
|
28797
|
+
}, F = P, I = async (e) => iA(await j({
|
|
28789
28798
|
action: "delivery",
|
|
28790
28799
|
deliveryId: e
|
|
28791
28800
|
})), L = async (e) => {
|
|
@@ -28795,13 +28804,13 @@ function lA(e = {}) {
|
|
|
28795
28804
|
deliveryId: e.id,
|
|
28796
28805
|
thread: e.thread
|
|
28797
28806
|
};
|
|
28798
|
-
return e.queuedSubmissionId && (t.queuedSubmissionId = e.queuedSubmissionId), e.clientUserMessageId && (t.clientUserMessageId = e.clientUserMessageId), e.message && (t.message = e.message),
|
|
28807
|
+
return e.queuedSubmissionId && (t.queuedSubmissionId = e.queuedSubmissionId), e.clientUserMessageId && (t.clientUserMessageId = e.clientUserMessageId), e.message && (t.message = e.message), iA(await j(t));
|
|
28799
28808
|
}, R = async (e = {}) => {
|
|
28800
28809
|
let t = {
|
|
28801
28810
|
action: "threads",
|
|
28802
|
-
limit: e.limit ??
|
|
28811
|
+
limit: e.limit ?? Nk
|
|
28803
28812
|
}, n = e.thread?.trim();
|
|
28804
|
-
return n && (t.thread = n),
|
|
28813
|
+
return n && (t.thread = n), aA(await j(t));
|
|
28805
28814
|
}, z = () => u ?? l ?? (d ? null : f), B = () => {
|
|
28806
28815
|
if (!n) return;
|
|
28807
28816
|
let e = b?.id && (b.status === "queued" || b.status === "working" || b.status === "completed" || b.status === "interrupted" || b.status === "failed") ? {
|
|
@@ -28816,7 +28825,7 @@ function lA(e = {}) {
|
|
|
28816
28825
|
annotationSnapshots: b.annotationSnapshots,
|
|
28817
28826
|
message: b.message
|
|
28818
28827
|
} : null;
|
|
28819
|
-
|
|
28828
|
+
Yk({
|
|
28820
28829
|
version: 1,
|
|
28821
28830
|
originThread: l,
|
|
28822
28831
|
selectedThread: u,
|
|
@@ -28834,12 +28843,12 @@ function lA(e = {}) {
|
|
|
28834
28843
|
"queueing",
|
|
28835
28844
|
"queued",
|
|
28836
28845
|
"working"
|
|
28837
|
-
].includes(b.status) ?
|
|
28846
|
+
].includes(b.status) ? Wk : b.status === "completed" ? Gk : Uk : Uk, te = () => {
|
|
28838
28847
|
let e = [], t = /* @__PURE__ */ new Set(), n = (n) => {
|
|
28839
28848
|
t.has(n.id) || (t.add(n.id), e.push(n));
|
|
28840
28849
|
}, r = (e) => ({
|
|
28841
28850
|
id: e,
|
|
28842
|
-
title: `Codex ${
|
|
28851
|
+
title: `Codex ${sA(e)}`,
|
|
28843
28852
|
updatedAt: null,
|
|
28844
28853
|
connected: !0
|
|
28845
28854
|
});
|
|
@@ -28877,22 +28886,22 @@ function lA(e = {}) {
|
|
|
28877
28886
|
let t = e.id === l ? "Current · " : e.connected ? "Loaded · " : "", r = b?.thread === e.id ? ` · ${U(b.status)}` : "";
|
|
28878
28887
|
return {
|
|
28879
28888
|
id: `codex.thread.${e.id}`,
|
|
28880
|
-
label: `${t}${
|
|
28889
|
+
label: `${t}${cA(e.title)}${r}`,
|
|
28881
28890
|
checked: () => n === e.id,
|
|
28882
28891
|
disabled: () => H(),
|
|
28883
28892
|
run() {
|
|
28884
28893
|
H() || (V(e.id, !l), oe());
|
|
28885
28894
|
}
|
|
28886
28895
|
};
|
|
28887
|
-
})), g <
|
|
28896
|
+
})), g < Nk && (e.length > g || h) && r.push({
|
|
28888
28897
|
id: "codex.thread.show-more",
|
|
28889
28898
|
label: "Show 5 more…",
|
|
28890
28899
|
run() {
|
|
28891
|
-
g =
|
|
28900
|
+
g = Nk, oe();
|
|
28892
28901
|
}
|
|
28893
28902
|
}), b?.queuedSubmissionId && b.status === "queued" && (b.dispatch === "desktop-opened" || b.dispatch === "desktop-wake-failed") && r.push({
|
|
28894
28903
|
id: "codex.delivery.receipt",
|
|
28895
|
-
label: `Receipt · ${
|
|
28904
|
+
label: `Receipt · ${sA(b.queuedSubmissionId)}`,
|
|
28896
28905
|
disabled: () => !0,
|
|
28897
28906
|
run: () => void 0
|
|
28898
28907
|
}), r;
|
|
@@ -28929,7 +28938,7 @@ function lA(e = {}) {
|
|
|
28929
28938
|
}, se = async (e) => {
|
|
28930
28939
|
if (o !== "available") return;
|
|
28931
28940
|
let t = await R({
|
|
28932
|
-
limit:
|
|
28941
|
+
limit: Nk,
|
|
28933
28942
|
thread: e ?? void 0
|
|
28934
28943
|
});
|
|
28935
28944
|
m = t.threads, h = t.hasMore, p = t.threads.filter((e) => e.connected).map((e) => e.id), f = t.thread;
|
|
@@ -28941,7 +28950,7 @@ function lA(e = {}) {
|
|
|
28941
28950
|
let t = u ?? l;
|
|
28942
28951
|
t && p.includes(t) ? d = !1 : p.length === 1 ? V(p[0], !0) : d = !0, !d && t && B();
|
|
28943
28952
|
} catch (e) {
|
|
28944
|
-
throw o = "unavailable", k = A ? null :
|
|
28953
|
+
throw o = "unavailable", k = A ? null : $k(e) ?? "unavailable", s = await N().catch(() => s), e;
|
|
28945
28954
|
} finally {
|
|
28946
28955
|
y = null, oe();
|
|
28947
28956
|
}
|
|
@@ -28951,7 +28960,7 @@ function lA(e = {}) {
|
|
|
28951
28960
|
}, le = () => {
|
|
28952
28961
|
C && globalThis.clearTimeout(C), C = globalThis.setTimeout(() => {
|
|
28953
28962
|
C = 0, b?.status === "completed" && (b = null, B(), oe());
|
|
28954
|
-
},
|
|
28963
|
+
}, Ak);
|
|
28955
28964
|
}, ue = async (e) => {
|
|
28956
28965
|
if (!(!b || b.id !== e.id)) {
|
|
28957
28966
|
if (b = {
|
|
@@ -28980,7 +28989,7 @@ function lA(e = {}) {
|
|
|
28980
28989
|
if (t) {
|
|
28981
28990
|
B(), oe(), S = globalThis.setTimeout(() => {
|
|
28982
28991
|
S = 0, de(e.id);
|
|
28983
|
-
},
|
|
28992
|
+
}, Ok);
|
|
28984
28993
|
return;
|
|
28985
28994
|
}
|
|
28986
28995
|
}
|
|
@@ -28990,14 +28999,14 @@ function lA(e = {}) {
|
|
|
28990
28999
|
if (e.status === "interrupted") {
|
|
28991
29000
|
B(), oe();
|
|
28992
29001
|
let t = e.updatedAt > 0 ? e.updatedAt : Date.now();
|
|
28993
|
-
Date.now() - t <
|
|
29002
|
+
Date.now() - t < Mk && (S = globalThis.setTimeout(() => {
|
|
28994
29003
|
S = 0, de(e.id);
|
|
28995
|
-
},
|
|
29004
|
+
}, jk));
|
|
28996
29005
|
return;
|
|
28997
29006
|
}
|
|
28998
29007
|
oe(), S = globalThis.setTimeout(() => {
|
|
28999
29008
|
S = 0, de(e.id);
|
|
29000
|
-
},
|
|
29009
|
+
}, kk);
|
|
29001
29010
|
}
|
|
29002
29011
|
}, de = async (e) => {
|
|
29003
29012
|
if (!(T || b?.id !== e)) try {
|
|
@@ -29021,7 +29030,7 @@ function lA(e = {}) {
|
|
|
29021
29030
|
b = {
|
|
29022
29031
|
...b,
|
|
29023
29032
|
status: "failed"
|
|
29024
|
-
}, B(),
|
|
29033
|
+
}, B(), lA(n) && (o = "unavailable"), oe();
|
|
29025
29034
|
}
|
|
29026
29035
|
}, fe = {
|
|
29027
29036
|
health: P,
|
|
@@ -29033,11 +29042,11 @@ function lA(e = {}) {
|
|
|
29033
29042
|
let n = await j({
|
|
29034
29043
|
action: "target",
|
|
29035
29044
|
thread: t
|
|
29036
|
-
}), r =
|
|
29037
|
-
return s =
|
|
29045
|
+
}), r = rA(n);
|
|
29046
|
+
return s = nA(n) ?? s, V(t, !l), f = r.thread, p = r.threads, o = "available", c = !0, oe(), r;
|
|
29038
29047
|
},
|
|
29039
29048
|
async queue(e) {
|
|
29040
|
-
let r = await
|
|
29049
|
+
let r = await oA(i, e, t), a = e?.thread?.trim(), s = a || (n ? z() : null);
|
|
29041
29050
|
if (n && !a && (d || !s)) throw Error("Choose a Codex thread before queueing feedback.");
|
|
29042
29051
|
let c = { message: r.message };
|
|
29043
29052
|
s && (c.thread = s);
|
|
@@ -29060,14 +29069,14 @@ function lA(e = {}) {
|
|
|
29060
29069
|
message: r.message
|
|
29061
29070
|
}), n;
|
|
29062
29071
|
} catch (e) {
|
|
29063
|
-
throw n &&
|
|
29072
|
+
throw n && lA(e) && (o = "unavailable", k = A ? null : $k(e) ?? "unavailable", oe()), e;
|
|
29064
29073
|
}
|
|
29065
29074
|
},
|
|
29066
29075
|
send(e) {
|
|
29067
29076
|
return fe.queue(e);
|
|
29068
29077
|
}
|
|
29069
29078
|
};
|
|
29070
|
-
e.service.provide(
|
|
29079
|
+
e.service.provide(Tk, fe);
|
|
29071
29080
|
let pe = async () => {
|
|
29072
29081
|
if (!(w || H())) {
|
|
29073
29082
|
if (b?.status === "failed" && b.id) {
|
|
@@ -29107,9 +29116,9 @@ function lA(e = {}) {
|
|
|
29107
29116
|
updatedAt: 0
|
|
29108
29117
|
}) : S = globalThis.setTimeout(() => {
|
|
29109
29118
|
S = 0, de(e.deliveryId);
|
|
29110
|
-
},
|
|
29119
|
+
}, Ok) : C = globalThis.setTimeout(() => {
|
|
29111
29120
|
C = 0, b?.id === null && b?.status === "queued" && (b = null, B(), oe());
|
|
29112
|
-
},
|
|
29121
|
+
}, Ak);
|
|
29113
29122
|
} catch (e) {
|
|
29114
29123
|
b = null, B(), oe();
|
|
29115
29124
|
let t = e instanceof Error ? e.message : String(e);
|
|
@@ -29138,7 +29147,7 @@ function lA(e = {}) {
|
|
|
29138
29147
|
}, 0));
|
|
29139
29148
|
let t = globalThis.setInterval(() => {
|
|
29140
29149
|
A && !c || ne(!0).catch(() => void 0);
|
|
29141
|
-
}, A ?
|
|
29150
|
+
}, A ? Dk : Vk);
|
|
29142
29151
|
e.lifecycle.onDispose(() => {
|
|
29143
29152
|
T = !0, ce(), globalThis.clearInterval(t), _?.dispose(), _ = void 0;
|
|
29144
29153
|
});
|
|
@@ -29148,18 +29157,18 @@ function lA(e = {}) {
|
|
|
29148
29157
|
}
|
|
29149
29158
|
//#endregion
|
|
29150
29159
|
//#region src/recording.ts
|
|
29151
|
-
var
|
|
29160
|
+
var dA = qE, fA = (e = {}) => ({
|
|
29152
29161
|
...mD(e),
|
|
29153
29162
|
version: wO
|
|
29154
|
-
}),
|
|
29163
|
+
}), pA = DD, mA = (e = {}) => ({
|
|
29155
29164
|
...qD(e),
|
|
29156
29165
|
version: wO
|
|
29157
|
-
}),
|
|
29166
|
+
}), hA = () => globalThis.window?.__MESURER_HOST__?.codexBridge !== void 0, gA = [
|
|
29158
29167
|
{
|
|
29159
29168
|
id: rk,
|
|
29160
29169
|
label: "Context",
|
|
29161
29170
|
order: 30,
|
|
29162
|
-
create:
|
|
29171
|
+
create: gk,
|
|
29163
29172
|
settingsIds: ["context"],
|
|
29164
29173
|
hiddenSettingsControlIds: ["ui"]
|
|
29165
29174
|
},
|
|
@@ -29177,35 +29186,35 @@ var uA = qE, dA = (e = {}) => ({
|
|
|
29177
29186
|
create: nk
|
|
29178
29187
|
},
|
|
29179
29188
|
{
|
|
29180
|
-
id:
|
|
29189
|
+
id: pA,
|
|
29181
29190
|
label: "Screenshot",
|
|
29182
29191
|
order: 40,
|
|
29183
|
-
create:
|
|
29192
|
+
create: mA,
|
|
29184
29193
|
settingsIds: ["screenshot"],
|
|
29185
29194
|
hiddenSettingsControlIds: ["tool"]
|
|
29186
29195
|
},
|
|
29187
29196
|
{
|
|
29188
|
-
id:
|
|
29197
|
+
id: dA,
|
|
29189
29198
|
label: "Recording",
|
|
29190
29199
|
order: 42,
|
|
29191
|
-
create:
|
|
29200
|
+
create: fA,
|
|
29192
29201
|
settingsIds: ["recording"],
|
|
29193
29202
|
hiddenSettingsControlIds: ["tool"]
|
|
29194
29203
|
},
|
|
29195
29204
|
{
|
|
29196
|
-
id:
|
|
29205
|
+
id: wk,
|
|
29197
29206
|
label: "Codex",
|
|
29198
29207
|
order: 45,
|
|
29199
|
-
create:
|
|
29208
|
+
create: uA
|
|
29200
29209
|
}
|
|
29201
|
-
],
|
|
29202
|
-
let t = e !== void 0, n = new Map((e ?? []).map((e) => [e.id, e])), r = new Set(
|
|
29210
|
+
], _A = (e) => {
|
|
29211
|
+
let t = e !== void 0, n = new Map((e ?? []).map((e) => [e.id, e])), r = new Set(gA.map((e) => e.id)), i = gA.map((e) => {
|
|
29203
29212
|
let r = n.get(e.id);
|
|
29204
29213
|
return {
|
|
29205
29214
|
...e,
|
|
29206
29215
|
settingsIds: e.settingsIds ? [...e.settingsIds] : void 0,
|
|
29207
29216
|
hiddenSettingsControlIds: e.hiddenSettingsControlIds ? [...e.hiddenSettingsControlIds] : void 0,
|
|
29208
|
-
enabled: t ? !!r : e.id === "mesurer.codex" ?
|
|
29217
|
+
enabled: t ? !!r : e.id === "mesurer.codex" ? hA() : e.enabled !== !1,
|
|
29209
29218
|
create: r ? () => r : e.create
|
|
29210
29219
|
};
|
|
29211
29220
|
});
|
|
@@ -29216,16 +29225,16 @@ var uA = qE, dA = (e = {}) => ({
|
|
|
29216
29225
|
create: () => n
|
|
29217
29226
|
});
|
|
29218
29227
|
return i;
|
|
29219
|
-
},
|
|
29220
|
-
function
|
|
29228
|
+
}, vA = (e) => e;
|
|
29229
|
+
function yA() {
|
|
29221
29230
|
return RO();
|
|
29222
29231
|
}
|
|
29223
|
-
async function
|
|
29232
|
+
async function bA(e = {}) {
|
|
29224
29233
|
return zO(e);
|
|
29225
29234
|
}
|
|
29226
29235
|
//#endregion
|
|
29227
29236
|
//#region src/index.tsx
|
|
29228
|
-
var
|
|
29237
|
+
var xA = {
|
|
29229
29238
|
select: "select",
|
|
29230
29239
|
xray: "xray",
|
|
29231
29240
|
colorPicker: "color-picker",
|
|
@@ -29236,7 +29245,7 @@ var bA = {
|
|
|
29236
29245
|
distance: "distance",
|
|
29237
29246
|
settings: "settings"
|
|
29238
29247
|
};
|
|
29239
|
-
function
|
|
29248
|
+
function SA(e = {}) {
|
|
29240
29249
|
if (!("document" in globalThis)) throw Error("mountMesurer() requires a browser or Electron renderer document.");
|
|
29241
29250
|
let { target: t = document.body, isolate: n = !0, shadowMode: r = "open", topLayer: i = !0, agent: a = !1, signal: o, onPluginHost: s, onPluginsReady: c, plugins: l, excludeBuiltins: u, excludePlugins: d, ...f } = e;
|
|
29242
29251
|
if (o?.aborted) throw o.reason ?? new DOMException("Mesurer mount aborted.", "AbortError");
|
|
@@ -29329,7 +29338,7 @@ function xA(e = {}) {
|
|
|
29329
29338
|
} catch {}
|
|
29330
29339
|
let h = p.createElement("div");
|
|
29331
29340
|
h.dataset.mesurerIsland = "true";
|
|
29332
|
-
let g =
|
|
29341
|
+
let g = Ck(h, t, i), _ = h, v = h, y = h;
|
|
29333
29342
|
if (n) {
|
|
29334
29343
|
let e = h.attachShadow({ mode: r });
|
|
29335
29344
|
v = p.createElement("div"), v.dataset.mesurerIslandMount = "true", e.append(v), _ = e, y = e;
|
|
@@ -29399,8 +29408,8 @@ function xA(e = {}) {
|
|
|
29399
29408
|
}), se = {
|
|
29400
29409
|
...f,
|
|
29401
29410
|
version: wO,
|
|
29402
|
-
plugins:
|
|
29403
|
-
excludePlugins: u ? u.map((e) =>
|
|
29411
|
+
plugins: _A(l),
|
|
29412
|
+
excludePlugins: u ? u.map((e) => xA[e]) : [...d ?? []]
|
|
29404
29413
|
}, ce = Po(() => bo(Tw, so(se, {
|
|
29405
29414
|
portalTarget: y,
|
|
29406
29415
|
pageTarget: t,
|
|
@@ -29469,6 +29478,6 @@ function xA(e = {}) {
|
|
|
29469
29478
|
}
|
|
29470
29479
|
return ge;
|
|
29471
29480
|
}
|
|
29472
|
-
var
|
|
29481
|
+
var CA = SA;
|
|
29473
29482
|
//#endregion
|
|
29474
|
-
export { xO as MESURER_TEXT_EDIT_SERVICE_ID, wO as MESURER_VERSION, WO as captureMesurerContext, $O as copyTextToClipboard, CO as createMesurerAgentHarness, JO as createMesurerCapturePlan,
|
|
29483
|
+
export { xO as MESURER_TEXT_EDIT_SERVICE_ID, wO as MESURER_VERSION, WO as captureMesurerContext, $O as copyTextToClipboard, CO as createMesurerAgentHarness, JO as createMesurerCapturePlan, yA as createMesurerPluginHost, bA as createMesurerRuntime, vA as defineMesurerPlugin, qO as formatMesurerContext, CA as mountMeasurer, SA as mountMesurer, QO as reviewMesurerAnnotation };
|