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/inject.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) => {
|
|
@@ -27843,22 +27845,22 @@ async function YO(e, t, n) {
|
|
|
27843
27845
|
var XO = vT, ZO = yT, QO = () => ({
|
|
27844
27846
|
...GT(),
|
|
27845
27847
|
version: wO
|
|
27846
|
-
}), $O = "mesurer.context", ek = "context:v1", tk = "mesurer.context.settings", nk = "context.ui", rk = "data-mesurer-direct-text-edit-active",
|
|
27848
|
+
}), $O = "mesurer.context", ek = "context:v1", tk = "mesurer.context.settings", nk = "context.ui", rk = "context.notes-open", ik = "data-mesurer-direct-text-edit-active", ak = {
|
|
27847
27849
|
viewBox: "0 0 256 256",
|
|
27848
27850
|
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"]
|
|
27849
|
-
},
|
|
27851
|
+
}, ok = {
|
|
27850
27852
|
viewBox: "0 0 256 256",
|
|
27851
27853
|
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"]
|
|
27852
|
-
},
|
|
27854
|
+
}, sk = {
|
|
27853
27855
|
viewBox: "0 0 256 256",
|
|
27854
27856
|
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"]
|
|
27855
|
-
},
|
|
27857
|
+
}, ck = {
|
|
27856
27858
|
viewBox: "0 0 256 256",
|
|
27857
27859
|
paths: ["M40 40h176v16H40zm0 48h176v16H40zm0 48h112v16H40zm0 48h112v16H40zM184 144l40 40-48 48-40-40z"]
|
|
27858
|
-
},
|
|
27860
|
+
}, lk = async (e, t, n = 1) => {
|
|
27859
27861
|
await e.fonts?.ready;
|
|
27860
27862
|
for (let e = 0; e < Math.max(1, n); e += 1) await new Promise((e) => t.requestAnimationFrame(() => e()));
|
|
27861
|
-
},
|
|
27863
|
+
}, uk = (e, t, n, r) => {
|
|
27862
27864
|
let i = async (i) => BO({
|
|
27863
27865
|
runtime: e,
|
|
27864
27866
|
ownerDocument: t,
|
|
@@ -27872,14 +27874,14 @@ var XO = vT, ZO = yT, QO = () => ({
|
|
|
27872
27874
|
copyContext: async (e) => YO(t, n, await a(e)),
|
|
27873
27875
|
select: async (r) => {
|
|
27874
27876
|
let a = Array.isArray(r) ? [...r] : [String(r)];
|
|
27875
|
-
return e.select(a), await
|
|
27877
|
+
return e.select(a), await lk(t, n), i({ scope: "selection" });
|
|
27876
27878
|
},
|
|
27877
27879
|
annotations: async () => e.annotations(),
|
|
27878
27880
|
removeAnnotation: async (r, i) => {
|
|
27879
|
-
e.removeAnnotation(r, i), await
|
|
27881
|
+
e.removeAnnotation(r, i), await lk(t, n);
|
|
27880
27882
|
},
|
|
27881
27883
|
review: async (i) => {
|
|
27882
|
-
if (await
|
|
27884
|
+
if (await lk(t, n), i) return JO({
|
|
27883
27885
|
runtime: e,
|
|
27884
27886
|
ownerDocument: t,
|
|
27885
27887
|
ownerWindow: n,
|
|
@@ -27897,17 +27899,17 @@ var XO = vT, ZO = yT, QO = () => ({
|
|
|
27897
27899
|
},
|
|
27898
27900
|
capturePlan: async (e) => WO(await i(e)),
|
|
27899
27901
|
prepareCapture: async () => {
|
|
27900
|
-
e.prepareCapture(), await
|
|
27902
|
+
e.prepareCapture(), await lk(t, n);
|
|
27901
27903
|
},
|
|
27902
27904
|
finishCapture: async () => {
|
|
27903
|
-
e.finishCapture(), await
|
|
27905
|
+
e.finishCapture(), await lk(t, n);
|
|
27904
27906
|
}
|
|
27905
27907
|
};
|
|
27906
|
-
},
|
|
27908
|
+
}, dk = (e, t) => {
|
|
27907
27909
|
let n = e.currentSelection();
|
|
27908
27910
|
return n.elements.length > 0 || n.region !== null && !t?.querySelector("[data-mesurer-responsive-stage]");
|
|
27909
27911
|
};
|
|
27910
|
-
function
|
|
27912
|
+
function fk(e = {}) {
|
|
27911
27913
|
return {
|
|
27912
27914
|
id: $O,
|
|
27913
27915
|
version: wO,
|
|
@@ -27918,59 +27920,66 @@ function dk(e = {}) {
|
|
|
27918
27920
|
if (!n) throw Error("Mesurer context plugin requires the renderer runtime service.");
|
|
27919
27921
|
let r = n.rendererRoot;
|
|
27920
27922
|
if (!r) throw Error("Mesurer Notes requires the renderer root.");
|
|
27921
|
-
let i = n.createWorkspaceRuntime($O), a = n.createAnnotationRevealCoordinator(i), [o, s] = G(!1)
|
|
27922
|
-
t.
|
|
27923
|
+
let i = n.createWorkspaceRuntime($O), a = n.createAnnotationRevealCoordinator(i), [o, s] = G(!1);
|
|
27924
|
+
t.state.register({
|
|
27925
|
+
id: rk,
|
|
27926
|
+
initial: !1
|
|
27927
|
+
});
|
|
27928
|
+
let c = (e) => {
|
|
27929
|
+
s(e), t.state.get(rk) !== e && t.state.update(rk, () => e);
|
|
27930
|
+
}, l = () => t.state.get(rk) ?? !1, u = uk(i, n.ownerDocument, n.ownerWindow, () => t.service.get(ZO)?.list() ?? []);
|
|
27931
|
+
t.service.provide(ek, u), t.state.register({
|
|
27923
27932
|
id: tk,
|
|
27924
27933
|
initial: { ui: e.ui ?? !0 },
|
|
27925
27934
|
persist: !0
|
|
27926
27935
|
}), t.state.register({
|
|
27927
27936
|
id: nk,
|
|
27928
|
-
initial: { hasSelection:
|
|
27937
|
+
initial: { hasSelection: dk(i, n.rendererRoot) }
|
|
27929
27938
|
});
|
|
27930
|
-
let
|
|
27931
|
-
e || (
|
|
27939
|
+
let d = () => t.state.get("mesurer.context.settings")?.ui ?? !0, f = () => dk(i, n.rendererRoot), p = (e) => {
|
|
27940
|
+
e || (c(!1), a.cancel()), t.state.update(tk, (t) => ({
|
|
27932
27941
|
...t,
|
|
27933
27942
|
ui: e
|
|
27934
27943
|
}));
|
|
27935
|
-
},
|
|
27936
|
-
elements: [...
|
|
27937
|
-
region:
|
|
27938
|
-
},
|
|
27939
|
-
let e = i.currentSelection(), r = !
|
|
27940
|
-
|
|
27944
|
+
}, m = null, h = null, g = null, _ = null, [v, y] = G(!!n.rendererRoot?.querySelector("[data-mesurer-responsive-stage]")), b = null, x = i.currentSelection(), S = {
|
|
27945
|
+
elements: [...x.elements],
|
|
27946
|
+
region: x.region ? { ...x.region } : null
|
|
27947
|
+
}, 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(() => {
|
|
27948
|
+
let e = i.currentSelection(), r = !C(S, e);
|
|
27949
|
+
S = {
|
|
27941
27950
|
elements: [...e.elements],
|
|
27942
27951
|
region: e.region ? { ...e.region } : null
|
|
27943
|
-
}, i.selectGestureActive() ?
|
|
27944
|
-
let a =
|
|
27952
|
+
}, i.selectGestureActive() ? m?.abandonNoteComposer() : r && m?.closeNoteComposer();
|
|
27953
|
+
let a = dk(i, n.rendererRoot);
|
|
27945
27954
|
a !== (t.state.get(nk)?.hasSelection ?? !1) && t.state.update(nk, () => ({ hasSelection: a }));
|
|
27946
27955
|
});
|
|
27947
|
-
t.command.register("context.copy", () =>
|
|
27948
|
-
let
|
|
27949
|
-
let e =
|
|
27950
|
-
e && (n.rendererRoot?.hasAttribute(
|
|
27951
|
-
},
|
|
27952
|
-
|
|
27953
|
-
},
|
|
27954
|
-
if (
|
|
27955
|
-
if (
|
|
27956
|
-
let e = new n.ownerWindow.MutationObserver(
|
|
27957
|
-
|
|
27956
|
+
t.command.register("context.copy", () => u.copyContext()), t.command.register("context.copy-selection", () => u.copyContext({ scope: "selection" }));
|
|
27957
|
+
let T = () => {
|
|
27958
|
+
let e = g?.element;
|
|
27959
|
+
e && (n.rendererRoot?.hasAttribute(ik) ? e.setAttribute(ik, "true") : e.removeAttribute(ik));
|
|
27960
|
+
}, E = () => {
|
|
27961
|
+
_?.disconnect(), _ = null, m = null, h?.(), h = null, g?.dispose(), g = null;
|
|
27962
|
+
}, D = () => {
|
|
27963
|
+
if (g) return;
|
|
27964
|
+
if (g = Jw(n), b = g.element.parentNode, g.element.dataset.mesurerLayer = "evidence", g.element.dataset.mesurerContextRoot = "true", n.rendererRoot) {
|
|
27965
|
+
let e = new n.ownerWindow.MutationObserver(T);
|
|
27966
|
+
_ = e, e.observe(n.rendererRoot, {
|
|
27958
27967
|
attributes: !0,
|
|
27959
|
-
attributeFilter: [
|
|
27960
|
-
}),
|
|
27968
|
+
attributeFilter: [ik]
|
|
27969
|
+
}), T();
|
|
27961
27970
|
}
|
|
27962
27971
|
let e = {
|
|
27963
27972
|
runtime: i,
|
|
27964
|
-
onCopy:
|
|
27973
|
+
onCopy: u.copyContext,
|
|
27965
27974
|
onController: (e) => {
|
|
27966
|
-
|
|
27975
|
+
m = e;
|
|
27967
27976
|
},
|
|
27968
27977
|
get coordinateSpace() {
|
|
27969
|
-
return
|
|
27978
|
+
return v() ? "viewport" : "document";
|
|
27970
27979
|
},
|
|
27971
27980
|
rendererRoot: n.rendererRoot
|
|
27972
27981
|
};
|
|
27973
|
-
|
|
27982
|
+
h = Po(() => [bo(Hw, so(e, { get ownerWindow() {
|
|
27974
27983
|
return n.ownerWindow;
|
|
27975
27984
|
} })), bo(ns, {
|
|
27976
27985
|
mount: r,
|
|
@@ -27987,7 +27996,7 @@ function dk(e = {}) {
|
|
|
27987
27996
|
return o();
|
|
27988
27997
|
},
|
|
27989
27998
|
onOpenChange: (e) => {
|
|
27990
|
-
|
|
27999
|
+
c(e), e || a.cancel();
|
|
27991
28000
|
},
|
|
27992
28001
|
get onReveal() {
|
|
27993
28002
|
return a.reveal;
|
|
@@ -27996,29 +28005,29 @@ function dk(e = {}) {
|
|
|
27996
28005
|
return a.cancel;
|
|
27997
28006
|
},
|
|
27998
28007
|
onOpenAnnotation: (e) => {
|
|
27999
|
-
if (
|
|
28000
|
-
|
|
28008
|
+
if (m) {
|
|
28009
|
+
m.openAnnotation(e);
|
|
28001
28010
|
return;
|
|
28002
28011
|
}
|
|
28003
28012
|
n.ownerDocument.querySelector(`[data-mesurer-annotation-marker='true'][data-mesurer-annotation-id="${CSS.escape(e)}"]`)?.click();
|
|
28004
28013
|
}
|
|
28005
28014
|
});
|
|
28006
28015
|
}
|
|
28007
|
-
})],
|
|
28008
|
-
},
|
|
28009
|
-
|
|
28016
|
+
})], g.element), dn(v) && n.rendererRoot && (n.rendererRoot.append(g.element), g.element.style.zIndex = "90");
|
|
28017
|
+
}, O = () => {
|
|
28018
|
+
d() ? D() : E();
|
|
28010
28019
|
};
|
|
28011
|
-
|
|
28012
|
-
let
|
|
28020
|
+
O(), t.state.subscribe(O);
|
|
28021
|
+
let k = () => {
|
|
28013
28022
|
let e = !!n.rendererRoot?.querySelector("[data-mesurer-responsive-stage]");
|
|
28014
|
-
if (e === dn(
|
|
28015
|
-
let t = e ? n.rendererRoot :
|
|
28016
|
-
t &&
|
|
28023
|
+
if (e === dn(v) || (y(e), !g)) return;
|
|
28024
|
+
let t = e ? n.rendererRoot : b;
|
|
28025
|
+
t && g.element.parentNode !== t && t.appendChild(g.element), g.element.style.zIndex = e ? "90" : "", dn(() => m?.closeNoteComposer());
|
|
28017
28026
|
};
|
|
28018
|
-
n.ownerWindow.addEventListener("mesurer:responsive-stage-change",
|
|
28019
|
-
|
|
28027
|
+
n.ownerWindow.addEventListener("mesurer:responsive-stage-change", k), t.command.register("context.add-note", () => {
|
|
28028
|
+
f() && m?.openNoteComposer();
|
|
28020
28029
|
}), t.command.register("context.notes", () => {
|
|
28021
|
-
|
|
28030
|
+
d() && (o() && a.cancel(), c(!dn(o)));
|
|
28022
28031
|
}), t.tool.register({
|
|
28023
28032
|
id: "context.copy",
|
|
28024
28033
|
label: "Copy context",
|
|
@@ -28026,8 +28035,8 @@ function dk(e = {}) {
|
|
|
28026
28035
|
command: "context.copy",
|
|
28027
28036
|
order: 70,
|
|
28028
28037
|
toolbarMode: "always",
|
|
28029
|
-
icon:
|
|
28030
|
-
hidden: () => !
|
|
28038
|
+
icon: ak,
|
|
28039
|
+
hidden: () => !d()
|
|
28031
28040
|
}), t.tool.register({
|
|
28032
28041
|
id: "context.copy-selection",
|
|
28033
28042
|
label: "Copy selection",
|
|
@@ -28035,9 +28044,9 @@ function dk(e = {}) {
|
|
|
28035
28044
|
command: "context.copy-selection",
|
|
28036
28045
|
order: 71,
|
|
28037
28046
|
toolbarMode: "always",
|
|
28038
|
-
icon:
|
|
28039
|
-
hidden: () => !
|
|
28040
|
-
disabled: () => !
|
|
28047
|
+
icon: ok,
|
|
28048
|
+
hidden: () => !d(),
|
|
28049
|
+
disabled: () => !f()
|
|
28041
28050
|
}), t.tool.register({
|
|
28042
28051
|
id: "context.add-note",
|
|
28043
28052
|
label: "Add note",
|
|
@@ -28045,9 +28054,9 @@ function dk(e = {}) {
|
|
|
28045
28054
|
command: "context.add-note",
|
|
28046
28055
|
order: 72,
|
|
28047
28056
|
toolbarMode: "always",
|
|
28048
|
-
icon:
|
|
28049
|
-
hidden: () => !
|
|
28050
|
-
disabled: () => !
|
|
28057
|
+
icon: sk,
|
|
28058
|
+
hidden: () => !d(),
|
|
28059
|
+
disabled: () => !f()
|
|
28051
28060
|
}), t.tool.register({
|
|
28052
28061
|
id: "context.notes",
|
|
28053
28062
|
label: "Notes",
|
|
@@ -28055,9 +28064,9 @@ function dk(e = {}) {
|
|
|
28055
28064
|
order: 73,
|
|
28056
28065
|
toolbarMode: "always",
|
|
28057
28066
|
compactPinned: !0,
|
|
28058
|
-
icon:
|
|
28059
|
-
active:
|
|
28060
|
-
hidden: () => !
|
|
28067
|
+
icon: ck,
|
|
28068
|
+
active: l,
|
|
28069
|
+
hidden: () => !d()
|
|
28061
28070
|
}), t.settings.register({
|
|
28062
28071
|
id: "context",
|
|
28063
28072
|
label: "Context",
|
|
@@ -28067,18 +28076,18 @@ function dk(e = {}) {
|
|
|
28067
28076
|
id: "ui",
|
|
28068
28077
|
label: "Context tools",
|
|
28069
28078
|
description: "Show Copy Context, Copy Selection, Add Note, and annotation controls.",
|
|
28070
|
-
value:
|
|
28071
|
-
set:
|
|
28079
|
+
value: d,
|
|
28080
|
+
set: p
|
|
28072
28081
|
}]
|
|
28073
28082
|
}), t.lifecycle.onDispose(() => {
|
|
28074
|
-
a.dispose(),
|
|
28083
|
+
a.dispose(), w(), n.ownerWindow.removeEventListener("mesurer:responsive-stage-change", k), E(), i.dispose();
|
|
28075
28084
|
});
|
|
28076
28085
|
}
|
|
28077
28086
|
};
|
|
28078
28087
|
}
|
|
28079
28088
|
//#endregion
|
|
28080
28089
|
//#region src/host-layer.ts
|
|
28081
|
-
var
|
|
28090
|
+
var pk = {
|
|
28082
28091
|
display: "block",
|
|
28083
28092
|
position: "fixed",
|
|
28084
28093
|
inset: "0",
|
|
@@ -28120,48 +28129,48 @@ var fk = {
|
|
|
28120
28129
|
"letter-spacing": "normal",
|
|
28121
28130
|
direction: "ltr"
|
|
28122
28131
|
};
|
|
28123
|
-
function pk(e) {
|
|
28124
|
-
for (let [t, n] of Object.entries(fk)) e.style.setProperty(t, n, "important");
|
|
28125
|
-
}
|
|
28126
28132
|
function mk(e) {
|
|
28133
|
+
for (let [t, n] of Object.entries(pk)) e.style.setProperty(t, n, "important");
|
|
28134
|
+
}
|
|
28135
|
+
function hk(e) {
|
|
28127
28136
|
return "popover" in e && "showPopover" in e && typeof e.showPopover == "function" && "hidePopover" in e && typeof e.hidePopover == "function";
|
|
28128
28137
|
}
|
|
28129
|
-
var
|
|
28130
|
-
function
|
|
28131
|
-
if (!
|
|
28138
|
+
var gk = (e) => "newState" in e, _k = (e) => e.localName === "dialog";
|
|
28139
|
+
function vk(e) {
|
|
28140
|
+
if (!_k(e) || !e.open) return !1;
|
|
28132
28141
|
try {
|
|
28133
28142
|
return e.matches(":modal");
|
|
28134
28143
|
} catch {
|
|
28135
28144
|
return !1;
|
|
28136
28145
|
}
|
|
28137
28146
|
}
|
|
28138
|
-
function
|
|
28139
|
-
|
|
28147
|
+
function yk(e, t, n = !0) {
|
|
28148
|
+
mk(e);
|
|
28140
28149
|
let r = e.ownerDocument, i = r.defaultView ?? window, a = t, o = !1, s = "fixed", c = !1, l = 0, u = [];
|
|
28141
|
-
if (n &&
|
|
28150
|
+
if (n && hk(e) && (e.popover = "manual"), t.append(e), n && hk(e)) try {
|
|
28142
28151
|
e.showPopover(), c = e.matches(":popover-open"), c && (s = "top-layer");
|
|
28143
28152
|
} catch {
|
|
28144
28153
|
e.removeAttribute("popover");
|
|
28145
28154
|
}
|
|
28146
28155
|
let d = () => {
|
|
28147
|
-
if (!(!c || !
|
|
28156
|
+
if (!(!c || !hk(e))) try {
|
|
28148
28157
|
e.matches(":popover-open") || e.showPopover();
|
|
28149
28158
|
} catch {}
|
|
28150
28159
|
}, f = (t) => {
|
|
28151
28160
|
if (e.parentNode === t) return;
|
|
28152
|
-
let n = c &&
|
|
28153
|
-
if (n &&
|
|
28161
|
+
let n = c && hk(e) && e.matches(":popover-open");
|
|
28162
|
+
if (n && hk(e)) try {
|
|
28154
28163
|
e.hidePopover();
|
|
28155
28164
|
} catch {}
|
|
28156
|
-
t.append(e),
|
|
28165
|
+
t.append(e), mk(e), n && d();
|
|
28157
28166
|
}, p = () => {
|
|
28158
|
-
u = u.filter((e) => e.isConnected &&
|
|
28167
|
+
u = u.filter((e) => e.isConnected && vk(e)), f(u.at(-1) ?? a);
|
|
28159
28168
|
}, m = (e) => {
|
|
28160
28169
|
u = u.filter((t) => t !== e), u.push(e), p();
|
|
28161
28170
|
}, h = (e) => {
|
|
28162
28171
|
u = u.filter((t) => t !== e), p();
|
|
28163
28172
|
}, g = () => {
|
|
28164
|
-
if (!(o || !c || !
|
|
28173
|
+
if (!(o || !c || !hk(e))) try {
|
|
28165
28174
|
e.matches(":popover-open") && e.hidePopover(), e.showPopover();
|
|
28166
28175
|
} catch {}
|
|
28167
28176
|
}, _ = () => {
|
|
@@ -28170,27 +28179,27 @@ function vk(e, t, n = !0) {
|
|
|
28170
28179
|
}));
|
|
28171
28180
|
}, v = (t) => {
|
|
28172
28181
|
if (!c || t.target === e) return;
|
|
28173
|
-
let n =
|
|
28182
|
+
let n = gk(t) ? t.newState : void 0, r = t.target;
|
|
28174
28183
|
if (r instanceof i.Element) {
|
|
28175
|
-
if (
|
|
28176
|
-
n === "open" &&
|
|
28184
|
+
if (_k(r)) {
|
|
28185
|
+
n === "open" && vk(r) ? (m(r), _()) : n === "closed" ? h(r) : n === "open" && _();
|
|
28177
28186
|
return;
|
|
28178
28187
|
}
|
|
28179
28188
|
n === "open" && r.hasAttribute("popover") && _();
|
|
28180
28189
|
}
|
|
28181
28190
|
}, y = (e) => {
|
|
28182
28191
|
let t = e.target;
|
|
28183
|
-
t instanceof i.Element &&
|
|
28192
|
+
t instanceof i.Element && _k(t) && h(t);
|
|
28184
28193
|
}, b = () => {
|
|
28185
28194
|
r.fullscreenElement && _();
|
|
28186
28195
|
}, x = (e) => {
|
|
28187
|
-
|
|
28188
|
-
for (let t of e.querySelectorAll("dialog"))
|
|
28196
|
+
vk(e) && m(e);
|
|
28197
|
+
for (let t of e.querySelectorAll("dialog")) vk(t) && m(t);
|
|
28189
28198
|
}, S = new i.MutationObserver((e) => {
|
|
28190
28199
|
if (c) for (let t of e) {
|
|
28191
28200
|
if (t.type === "attributes") {
|
|
28192
28201
|
let e = t.target;
|
|
28193
|
-
e instanceof i.Element &&
|
|
28202
|
+
e instanceof i.Element && _k(e) && (vk(e) ? m(e) : h(e));
|
|
28194
28203
|
}
|
|
28195
28204
|
for (let e of t.addedNodes) e instanceof i.Element && x(e);
|
|
28196
28205
|
u.some((e) => !e.isConnected) && p();
|
|
@@ -28206,7 +28215,7 @@ function vk(e, t, n = !0) {
|
|
|
28206
28215
|
bringToFront: g,
|
|
28207
28216
|
dispose() {
|
|
28208
28217
|
if (!o) {
|
|
28209
|
-
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 &&
|
|
28218
|
+
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 && hk(e) && e.matches(":popover-open")) try {
|
|
28210
28219
|
e.hidePopover();
|
|
28211
28220
|
} catch {}
|
|
28212
28221
|
u = [];
|
|
@@ -28216,7 +28225,7 @@ function vk(e, t, n = !0) {
|
|
|
28216
28225
|
}
|
|
28217
28226
|
//#endregion
|
|
28218
28227
|
//#region src/plugins/codex/index.ts
|
|
28219
|
-
var
|
|
28228
|
+
var bk = "mesurer.codex", xk = "codex:v1", Sk = "mesurer.plugin.before-disable", Ck = 2e3, wk = 750, Tk = 2e3, Ek = 1800, Dk = 2e3, Ok = 12e4, kk = 10, Ak = 5, jk = "http://127.0.0.1:47365", Mk = "mesurer-codex", Nk = 2, Pk = [
|
|
28220
28229
|
"thread-discovery-v1",
|
|
28221
28230
|
"durable-queue-v1",
|
|
28222
28231
|
"history-recovery-v2",
|
|
@@ -28224,33 +28233,33 @@ var yk = "mesurer.codex", bk = "codex:v1", xk = "mesurer.plugin.before-disable",
|
|
|
28224
28233
|
"idle-safe-shutdown-v1",
|
|
28225
28234
|
"nonterminal-retention-v1",
|
|
28226
28235
|
"instance-binding-v1"
|
|
28227
|
-
],
|
|
28236
|
+
], Fk = 1500, Ik = 15e3, Lk = 5e3, Rk = [
|
|
28228
28237
|
"Implement the current human feedback from Mesurer in this project.",
|
|
28229
28238
|
"Treat the rendered page as the source of truth, preserve unrelated Mesurer review state,",
|
|
28230
28239
|
"and verify the affected UI in the live page with Mesurer before claiming completion."
|
|
28231
|
-
].join(" "),
|
|
28240
|
+
].join(" "), zk = {
|
|
28232
28241
|
viewBox: "0 0 256 256",
|
|
28233
28242
|
paths: ["M224,48,32,120l88,32,32,88Z M120,152l104-104"]
|
|
28234
|
-
},
|
|
28243
|
+
}, Bk = {
|
|
28235
28244
|
viewBox: "0 0 256 256",
|
|
28236
28245
|
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"]
|
|
28237
|
-
},
|
|
28246
|
+
}, Vk = {
|
|
28238
28247
|
viewBox: "0 0 256 256",
|
|
28239
28248
|
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"]
|
|
28240
|
-
},
|
|
28249
|
+
}, Hk = class extends Error {
|
|
28241
28250
|
issue;
|
|
28242
28251
|
constructor(e, t) {
|
|
28243
28252
|
super(t), this.issue = e, this.name = "BrowserBridgeConnectionError";
|
|
28244
28253
|
}
|
|
28245
|
-
},
|
|
28254
|
+
}, Uk = () => {
|
|
28246
28255
|
try {
|
|
28247
28256
|
let e = globalThis.location;
|
|
28248
28257
|
return e?.origin ? `mesurer-codex-ui:v2:${e.origin}${e.pathname}` : null;
|
|
28249
28258
|
} catch {
|
|
28250
28259
|
return null;
|
|
28251
28260
|
}
|
|
28252
|
-
},
|
|
28253
|
-
let e =
|
|
28261
|
+
}, Wk = () => {
|
|
28262
|
+
let e = Uk();
|
|
28254
28263
|
if (!e) return null;
|
|
28255
28264
|
try {
|
|
28256
28265
|
let t = globalThis.sessionStorage?.getItem(e);
|
|
@@ -28278,35 +28287,35 @@ var yk = "mesurer.codex", bk = "codex:v1", xk = "mesurer.plugin.before-disable",
|
|
|
28278
28287
|
} catch {
|
|
28279
28288
|
return null;
|
|
28280
28289
|
}
|
|
28281
|
-
},
|
|
28282
|
-
let t =
|
|
28290
|
+
}, Gk = (e) => {
|
|
28291
|
+
let t = Uk();
|
|
28283
28292
|
if (t) try {
|
|
28284
28293
|
globalThis.sessionStorage?.setItem(t, JSON.stringify(e));
|
|
28285
28294
|
} catch {}
|
|
28286
|
-
}, Gk = (e) => {
|
|
28287
|
-
let t = Ak.endsWith("/") ? Ak : `${Ak}/`;
|
|
28288
|
-
return new URL(e, t).toString();
|
|
28289
28295
|
}, Kk = (e) => {
|
|
28296
|
+
let t = jk.endsWith("/") ? jk : `${jk}/`;
|
|
28297
|
+
return new URL(e, t).toString();
|
|
28298
|
+
}, qk = (e) => {
|
|
28290
28299
|
let t = e.bridge;
|
|
28291
|
-
if (!t) throw new
|
|
28292
|
-
if (t.name !==
|
|
28293
|
-
if (t.protocol !==
|
|
28294
|
-
if (e.access?.allowed === !1) throw new
|
|
28295
|
-
let n = new Set(Array.isArray(t.capabilities) ? t.capabilities : []), r =
|
|
28296
|
-
if (r.length > 0) throw new
|
|
28297
|
-
if (!t.instanceId?.trim()) throw new
|
|
28298
|
-
},
|
|
28300
|
+
if (!t) throw new Hk("port-conflict", "Another local service or an outdated Mesurer Codex Bridge is using port 47365. Mesurer will not send data to an unverified service.");
|
|
28301
|
+
if (t.name !== Mk) throw new Hk("port-conflict", `Another local service is using port 47365 (${t.name ?? "unknown"}). Mesurer will not send Codex data to it.`);
|
|
28302
|
+
if (t.protocol !== Nk) throw new Hk("version-mismatch", `Mesurer Codex Bridge is out of date (protocol ${t.protocol ?? "unknown"}; expected ${Nk}). Restart the matching Mesurer Codex Bridge helper.`);
|
|
28303
|
+
if (e.access?.allowed === !1) throw new Hk("origin-denied", `Mesurer Codex Bridge does not allow this browser origin (${globalThis.location?.origin ?? "this page"}). Allow this origin when starting the bridge.`);
|
|
28304
|
+
let n = new Set(Array.isArray(t.capabilities) ? t.capabilities : []), r = Pk.filter((e) => !n.has(e));
|
|
28305
|
+
if (r.length > 0) throw new Hk("capability-mismatch", `Mesurer Codex Bridge is missing required capabilities: ${r.join(", ")}. Restart or update the matching helper.`);
|
|
28306
|
+
if (!t.instanceId?.trim()) throw new Hk("capability-mismatch", "Mesurer Codex Bridge did not provide an instance identity. Restart or update the matching helper.");
|
|
28307
|
+
}, Jk = (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, Yk = (e) => e instanceof Hk ? e.issue : e instanceof Error ? Jk(e.message) : null, Xk = async (e) => {
|
|
28299
28308
|
let t, n;
|
|
28300
|
-
if (e.action === "health") t =
|
|
28309
|
+
if (e.action === "health") t = Kk("health");
|
|
28301
28310
|
else if (e.action === "threads") {
|
|
28302
28311
|
let n = new URLSearchParams();
|
|
28303
|
-
n.set("limit", String(e.limit ??
|
|
28304
|
-
} else if (e.action === "target") t =
|
|
28312
|
+
n.set("limit", String(e.limit ?? kk)), e.thread && n.set("thread", e.thread), t = `${Kk("threads")}?${n.toString()}`;
|
|
28313
|
+
} else if (e.action === "target") t = Kk("target"), n = {
|
|
28305
28314
|
method: "POST",
|
|
28306
28315
|
headers: { "Content-Type": "application/json" },
|
|
28307
28316
|
body: JSON.stringify({ thread: e.thread })
|
|
28308
28317
|
};
|
|
28309
|
-
else if (e.action === "queue") t =
|
|
28318
|
+
else if (e.action === "queue") t = Kk("send"), n = {
|
|
28310
28319
|
method: "POST",
|
|
28311
28320
|
headers: { "Content-Type": "application/json" },
|
|
28312
28321
|
body: JSON.stringify({
|
|
@@ -28314,8 +28323,8 @@ var yk = "mesurer.codex", bk = "codex:v1", xk = "mesurer.plugin.before-disable",
|
|
|
28314
28323
|
thread: e.thread
|
|
28315
28324
|
})
|
|
28316
28325
|
};
|
|
28317
|
-
else if (e.action === "delivery") t =
|
|
28318
|
-
else if (e.action === "restore") t =
|
|
28326
|
+
else if (e.action === "delivery") t = Kk(`deliveries/${encodeURIComponent(String(e.deliveryId ?? ""))}`);
|
|
28327
|
+
else if (e.action === "restore") t = Kk("deliveries/restore"), n = {
|
|
28319
28328
|
method: "POST",
|
|
28320
28329
|
headers: { "Content-Type": "application/json" },
|
|
28321
28330
|
body: JSON.stringify({
|
|
@@ -28329,14 +28338,14 @@ var yk = "mesurer.codex", bk = "codex:v1", xk = "mesurer.plugin.before-disable",
|
|
|
28329
28338
|
else throw Error(`Codex browser companion does not support ${e.action}.`);
|
|
28330
28339
|
if (e.action !== "health") {
|
|
28331
28340
|
let t = e.bridgeInstanceId?.trim();
|
|
28332
|
-
if (!t) throw new
|
|
28341
|
+
if (!t) throw new Hk("instance-changed", "Mesurer Codex Bridge instance changed before this request could be verified.");
|
|
28333
28342
|
let r = new Headers(n?.headers);
|
|
28334
28343
|
r.set("X-Mesurer-Bridge-Instance", t), n = {
|
|
28335
28344
|
...n,
|
|
28336
28345
|
headers: r
|
|
28337
28346
|
};
|
|
28338
28347
|
}
|
|
28339
|
-
let r = new AbortController(), i = e.action === "health" || e.action === "threads" ?
|
|
28348
|
+
let r = new AbortController(), i = e.action === "health" || e.action === "threads" ? Fk : Ik, a = globalThis.setTimeout(() => r.abort(), i);
|
|
28340
28349
|
try {
|
|
28341
28350
|
let i = await fetch(t, {
|
|
28342
28351
|
...n,
|
|
@@ -28347,23 +28356,23 @@ var yk = "mesurer.codex", bk = "codex:v1", xk = "mesurer.plugin.before-disable",
|
|
|
28347
28356
|
} catch {
|
|
28348
28357
|
o = { error: a };
|
|
28349
28358
|
}
|
|
28350
|
-
if (e.action === "health" &&
|
|
28351
|
-
let e = o.error ?? `Mesurer Codex companion returned HTTP ${i.status}.`, t =
|
|
28352
|
-
throw t ? new
|
|
28359
|
+
if (e.action === "health" && qk(o), !i.ok || o.ok === !1) {
|
|
28360
|
+
let e = o.error ?? `Mesurer Codex companion returned HTTP ${i.status}.`, t = Jk(e);
|
|
28361
|
+
throw t ? new Hk(t, e) : Error(e);
|
|
28353
28362
|
}
|
|
28354
28363
|
return o;
|
|
28355
28364
|
} catch (e) {
|
|
28356
|
-
throw e instanceof Error && e.name === "AbortError" ? new
|
|
28365
|
+
throw e instanceof Error && e.name === "AbortError" ? new Hk("timed-out", "Mesurer Codex companion timed out.") : e instanceof TypeError ? new Hk("not-running", `Mesurer Codex companion is unavailable at ${jk}.`) : e;
|
|
28357
28366
|
} finally {
|
|
28358
28367
|
globalThis.clearTimeout(a);
|
|
28359
28368
|
}
|
|
28360
|
-
},
|
|
28369
|
+
}, Zk = async (e) => {
|
|
28361
28370
|
let t = window.__MESURER_HOST__?.codexBridge;
|
|
28362
28371
|
if (!t) throw Error("Codex native host bridge is unavailable.");
|
|
28363
28372
|
let n = await t(e);
|
|
28364
28373
|
if (n.ok === !1) throw Error(n.error ?? "Codex Bridge request failed.");
|
|
28365
28374
|
return n;
|
|
28366
|
-
},
|
|
28375
|
+
}, Qk = (e) => {
|
|
28367
28376
|
let t = e.runtime;
|
|
28368
28377
|
return !t || ![
|
|
28369
28378
|
"shared",
|
|
@@ -28381,10 +28390,10 @@ var yk = "mesurer.codex", bk = "codex:v1", xk = "mesurer.plugin.before-disable",
|
|
|
28381
28390
|
available: t.available === !0,
|
|
28382
28391
|
reason: t.reason
|
|
28383
28392
|
};
|
|
28384
|
-
},
|
|
28393
|
+
}, $k = (e) => ({
|
|
28385
28394
|
thread: e.thread?.trim() || null,
|
|
28386
28395
|
threads: Array.isArray(e.threads) ? e.threads.filter((e) => e.trim().length > 0) : []
|
|
28387
|
-
}),
|
|
28396
|
+
}), eA = (e) => {
|
|
28388
28397
|
let t = e.deliveryId?.trim(), n = e.thread?.trim(), r = e.status;
|
|
28389
28398
|
if (!t || !n || !r) throw Error("Codex Bridge returned an invalid delivery state.");
|
|
28390
28399
|
let i = {
|
|
@@ -28396,7 +28405,7 @@ var yk = "mesurer.codex", bk = "codex:v1", xk = "mesurer.plugin.before-disable",
|
|
|
28396
28405
|
updatedAt: Number.isFinite(e.updatedAt) ? Number(e.updatedAt) : 0
|
|
28397
28406
|
};
|
|
28398
28407
|
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;
|
|
28399
|
-
},
|
|
28408
|
+
}, tA = (e) => ({
|
|
28400
28409
|
thread: e.thread?.trim() || null,
|
|
28401
28410
|
threads: Array.isArray(e.threadDetails) ? e.threadDetails.flatMap((e) => {
|
|
28402
28411
|
let t = e.id?.trim() ?? "";
|
|
@@ -28408,7 +28417,7 @@ var yk = "mesurer.codex", bk = "codex:v1", xk = "mesurer.plugin.before-disable",
|
|
|
28408
28417
|
}] : [];
|
|
28409
28418
|
}) : [],
|
|
28410
28419
|
hasMore: e.hasMore === !0
|
|
28411
|
-
}),
|
|
28420
|
+
}), nA = async (e, t, n) => {
|
|
28412
28421
|
let r = t?.instruction?.trim() || n, i = await e.annotations(), a = t?.annotationIds, o = (a ? a.flatMap((e) => {
|
|
28413
28422
|
let t = i.find((t) => t.id === e);
|
|
28414
28423
|
return t ? [t] : [];
|
|
@@ -28439,18 +28448,18 @@ var yk = "mesurer.codex", bk = "codex:v1", xk = "mesurer.plugin.before-disable",
|
|
|
28439
28448
|
])
|
|
28440
28449
|
].join("\n").trimEnd()
|
|
28441
28450
|
};
|
|
28442
|
-
},
|
|
28443
|
-
function
|
|
28444
|
-
let t = e.instruction?.trim() ||
|
|
28451
|
+
}, rA = (e) => e.length > 16 ? `${e.slice(0, 8)}…${e.slice(-4)}` : e, iA = (e, t = 42) => e.length > t ? `${e.slice(0, t - 1)}…` : e, aA = (e) => Yk(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"));
|
|
28452
|
+
function oA(e = {}) {
|
|
28453
|
+
let t = e.instruction?.trim() || Rk, n = e.ui ?? !0, r = e.clearCompletedAnnotations ?? !0;
|
|
28445
28454
|
return {
|
|
28446
|
-
id:
|
|
28455
|
+
id: bk,
|
|
28447
28456
|
version: wO,
|
|
28448
28457
|
requires: [ek],
|
|
28449
|
-
provides: [
|
|
28458
|
+
provides: [xk],
|
|
28450
28459
|
async setup(e) {
|
|
28451
28460
|
let i = e.service.get(ek);
|
|
28452
28461
|
if (!i) throw Error("Mesurer Codex plugin requires context() from mesurer-solid/plugins.");
|
|
28453
|
-
let a = n ?
|
|
28462
|
+
let a = n ? Wk() : 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 = Ak, _, v = "", y = null, b = a?.delivery ? {
|
|
28454
28463
|
id: a.delivery.id,
|
|
28455
28464
|
thread: a.delivery.thread,
|
|
28456
28465
|
status: a.delivery.status,
|
|
@@ -28465,22 +28474,22 @@ function aA(e = {}) {
|
|
|
28465
28474
|
if (!A) try {
|
|
28466
28475
|
let t = e.action === "queue" || e.action === "target" || e.action === "delivery" || e.action === "restore";
|
|
28467
28476
|
if (e.action === "health") {
|
|
28468
|
-
let t = await
|
|
28477
|
+
let t = await Xk(e);
|
|
28469
28478
|
return O = t.bridge?.instanceId?.trim() || null, D = Date.now(), t;
|
|
28470
28479
|
}
|
|
28471
|
-
return (!O || t || Date.now() - D >=
|
|
28480
|
+
return (!O || t || Date.now() - D >= Lk) && (O = (await Xk({
|
|
28472
28481
|
action: "health",
|
|
28473
28482
|
thread: u ?? l ?? void 0
|
|
28474
|
-
})).bridge?.instanceId?.trim() || null, D = Date.now()), await
|
|
28483
|
+
})).bridge?.instanceId?.trim() || null, D = Date.now()), await Xk({
|
|
28475
28484
|
...e,
|
|
28476
28485
|
bridgeInstanceId: O ?? void 0
|
|
28477
28486
|
});
|
|
28478
28487
|
} catch (e) {
|
|
28479
28488
|
throw D = 0, O = null, e;
|
|
28480
28489
|
}
|
|
28481
|
-
if (e.action === "activate" || e.action === "runtime") return
|
|
28490
|
+
if (e.action === "activate" || e.action === "runtime") return Zk(e);
|
|
28482
28491
|
if (!E) throw Error("Codex Bridge lease is not active for this plugin.");
|
|
28483
|
-
return
|
|
28492
|
+
return Zk({
|
|
28484
28493
|
...e,
|
|
28485
28494
|
leaseId: E
|
|
28486
28495
|
});
|
|
@@ -28488,7 +28497,7 @@ function aA(e = {}) {
|
|
|
28488
28497
|
if (!A) return;
|
|
28489
28498
|
let e = E;
|
|
28490
28499
|
if (e) {
|
|
28491
|
-
if ((await
|
|
28500
|
+
if ((await Zk({
|
|
28492
28501
|
action: "deactivate",
|
|
28493
28502
|
leaseId: e
|
|
28494
28503
|
})).released !== !0) throw Error("Codex Bridge did not confirm lease release.");
|
|
@@ -28496,13 +28505,13 @@ function aA(e = {}) {
|
|
|
28496
28505
|
}
|
|
28497
28506
|
};
|
|
28498
28507
|
if (A) {
|
|
28499
|
-
let e = await
|
|
28508
|
+
let e = await Zk({
|
|
28500
28509
|
action: "activate",
|
|
28501
28510
|
thread: u ?? l ?? void 0
|
|
28502
28511
|
}), t = e.leaseId?.trim();
|
|
28503
28512
|
if (!t) throw Error("Codex Bridge did not return an activation lease.");
|
|
28504
|
-
E = t, o = "available", s =
|
|
28505
|
-
let n =
|
|
28513
|
+
E = t, o = "available", s = Qk(e);
|
|
28514
|
+
let n = $k(e);
|
|
28506
28515
|
c = !0, f = n.thread, p = n.threads;
|
|
28507
28516
|
}
|
|
28508
28517
|
e.lifecycle.onDispose(() => {
|
|
@@ -28510,12 +28519,12 @@ function aA(e = {}) {
|
|
|
28510
28519
|
let t = e instanceof Error ? e.message : String(e);
|
|
28511
28520
|
console.error(`[Mesurer] Failed to release Codex host lease: ${t}`);
|
|
28512
28521
|
});
|
|
28513
|
-
}), e.hook.on(
|
|
28522
|
+
}), e.hook.on(Sk, async (e) => {
|
|
28514
28523
|
e === "mesurer.codex" && await M();
|
|
28515
28524
|
});
|
|
28516
28525
|
let N = async () => {
|
|
28517
28526
|
if (!A) return null;
|
|
28518
|
-
let e =
|
|
28527
|
+
let e = Qk(await j({ action: "runtime" }));
|
|
28519
28528
|
if (!e) throw Error("Codex Bridge returned an invalid runtime state.");
|
|
28520
28529
|
return s = e, e;
|
|
28521
28530
|
}, P = async () => {
|
|
@@ -28523,8 +28532,8 @@ function aA(e = {}) {
|
|
|
28523
28532
|
action: "health",
|
|
28524
28533
|
thread: u ?? l ?? void 0
|
|
28525
28534
|
});
|
|
28526
|
-
return s =
|
|
28527
|
-
}, F = P, I = async (e) =>
|
|
28535
|
+
return s = Qk(e) ?? s, $k(e);
|
|
28536
|
+
}, F = P, I = async (e) => eA(await j({
|
|
28528
28537
|
action: "delivery",
|
|
28529
28538
|
deliveryId: e
|
|
28530
28539
|
})), L = async (e) => {
|
|
@@ -28534,13 +28543,13 @@ function aA(e = {}) {
|
|
|
28534
28543
|
deliveryId: e.id,
|
|
28535
28544
|
thread: e.thread
|
|
28536
28545
|
};
|
|
28537
|
-
return e.queuedSubmissionId && (t.queuedSubmissionId = e.queuedSubmissionId), e.clientUserMessageId && (t.clientUserMessageId = e.clientUserMessageId), e.message && (t.message = e.message),
|
|
28546
|
+
return e.queuedSubmissionId && (t.queuedSubmissionId = e.queuedSubmissionId), e.clientUserMessageId && (t.clientUserMessageId = e.clientUserMessageId), e.message && (t.message = e.message), eA(await j(t));
|
|
28538
28547
|
}, R = async (e = {}) => {
|
|
28539
28548
|
let t = {
|
|
28540
28549
|
action: "threads",
|
|
28541
|
-
limit: e.limit ??
|
|
28550
|
+
limit: e.limit ?? kk
|
|
28542
28551
|
}, n = e.thread?.trim();
|
|
28543
|
-
return n && (t.thread = n),
|
|
28552
|
+
return n && (t.thread = n), tA(await j(t));
|
|
28544
28553
|
}, z = () => u ?? l ?? (d ? null : f), B = () => {
|
|
28545
28554
|
if (!n) return;
|
|
28546
28555
|
let e = b?.id && (b.status === "queued" || b.status === "working" || b.status === "completed" || b.status === "interrupted" || b.status === "failed") ? {
|
|
@@ -28555,7 +28564,7 @@ function aA(e = {}) {
|
|
|
28555
28564
|
annotationSnapshots: b.annotationSnapshots,
|
|
28556
28565
|
message: b.message
|
|
28557
28566
|
} : null;
|
|
28558
|
-
|
|
28567
|
+
Gk({
|
|
28559
28568
|
version: 1,
|
|
28560
28569
|
originThread: l,
|
|
28561
28570
|
selectedThread: u,
|
|
@@ -28573,12 +28582,12 @@ function aA(e = {}) {
|
|
|
28573
28582
|
"queueing",
|
|
28574
28583
|
"queued",
|
|
28575
28584
|
"working"
|
|
28576
|
-
].includes(b.status) ?
|
|
28585
|
+
].includes(b.status) ? Bk : b.status === "completed" ? Vk : zk : zk, te = () => {
|
|
28577
28586
|
let e = [], t = /* @__PURE__ */ new Set(), n = (n) => {
|
|
28578
28587
|
t.has(n.id) || (t.add(n.id), e.push(n));
|
|
28579
28588
|
}, r = (e) => ({
|
|
28580
28589
|
id: e,
|
|
28581
|
-
title: `Codex ${
|
|
28590
|
+
title: `Codex ${rA(e)}`,
|
|
28582
28591
|
updatedAt: null,
|
|
28583
28592
|
connected: !0
|
|
28584
28593
|
});
|
|
@@ -28616,22 +28625,22 @@ function aA(e = {}) {
|
|
|
28616
28625
|
let t = e.id === l ? "Current · " : e.connected ? "Loaded · " : "", r = b?.thread === e.id ? ` · ${U(b.status)}` : "";
|
|
28617
28626
|
return {
|
|
28618
28627
|
id: `codex.thread.${e.id}`,
|
|
28619
|
-
label: `${t}${
|
|
28628
|
+
label: `${t}${iA(e.title)}${r}`,
|
|
28620
28629
|
checked: () => n === e.id,
|
|
28621
28630
|
disabled: () => H(),
|
|
28622
28631
|
run() {
|
|
28623
28632
|
H() || (V(e.id, !l), oe());
|
|
28624
28633
|
}
|
|
28625
28634
|
};
|
|
28626
|
-
})), g <
|
|
28635
|
+
})), g < kk && (e.length > g || h) && r.push({
|
|
28627
28636
|
id: "codex.thread.show-more",
|
|
28628
28637
|
label: "Show 5 more…",
|
|
28629
28638
|
run() {
|
|
28630
|
-
g =
|
|
28639
|
+
g = kk, oe();
|
|
28631
28640
|
}
|
|
28632
28641
|
}), b?.queuedSubmissionId && b.status === "queued" && (b.dispatch === "desktop-opened" || b.dispatch === "desktop-wake-failed") && r.push({
|
|
28633
28642
|
id: "codex.delivery.receipt",
|
|
28634
|
-
label: `Receipt · ${
|
|
28643
|
+
label: `Receipt · ${rA(b.queuedSubmissionId)}`,
|
|
28635
28644
|
disabled: () => !0,
|
|
28636
28645
|
run: () => void 0
|
|
28637
28646
|
}), r;
|
|
@@ -28668,7 +28677,7 @@ function aA(e = {}) {
|
|
|
28668
28677
|
}, se = async (e) => {
|
|
28669
28678
|
if (o !== "available") return;
|
|
28670
28679
|
let t = await R({
|
|
28671
|
-
limit:
|
|
28680
|
+
limit: kk,
|
|
28672
28681
|
thread: e ?? void 0
|
|
28673
28682
|
});
|
|
28674
28683
|
m = t.threads, h = t.hasMore, p = t.threads.filter((e) => e.connected).map((e) => e.id), f = t.thread;
|
|
@@ -28680,7 +28689,7 @@ function aA(e = {}) {
|
|
|
28680
28689
|
let t = u ?? l;
|
|
28681
28690
|
t && p.includes(t) ? d = !1 : p.length === 1 ? V(p[0], !0) : d = !0, !d && t && B();
|
|
28682
28691
|
} catch (e) {
|
|
28683
|
-
throw o = "unavailable", k = A ? null :
|
|
28692
|
+
throw o = "unavailable", k = A ? null : Yk(e) ?? "unavailable", s = await N().catch(() => s), e;
|
|
28684
28693
|
} finally {
|
|
28685
28694
|
y = null, oe();
|
|
28686
28695
|
}
|
|
@@ -28690,7 +28699,7 @@ function aA(e = {}) {
|
|
|
28690
28699
|
}, le = () => {
|
|
28691
28700
|
C && globalThis.clearTimeout(C), C = globalThis.setTimeout(() => {
|
|
28692
28701
|
C = 0, b?.status === "completed" && (b = null, B(), oe());
|
|
28693
|
-
},
|
|
28702
|
+
}, Ek);
|
|
28694
28703
|
}, ue = async (e) => {
|
|
28695
28704
|
if (!(!b || b.id !== e.id)) {
|
|
28696
28705
|
if (b = {
|
|
@@ -28719,7 +28728,7 @@ function aA(e = {}) {
|
|
|
28719
28728
|
if (t) {
|
|
28720
28729
|
B(), oe(), S = globalThis.setTimeout(() => {
|
|
28721
28730
|
S = 0, de(e.id);
|
|
28722
|
-
},
|
|
28731
|
+
}, wk);
|
|
28723
28732
|
return;
|
|
28724
28733
|
}
|
|
28725
28734
|
}
|
|
@@ -28729,14 +28738,14 @@ function aA(e = {}) {
|
|
|
28729
28738
|
if (e.status === "interrupted") {
|
|
28730
28739
|
B(), oe();
|
|
28731
28740
|
let t = e.updatedAt > 0 ? e.updatedAt : Date.now();
|
|
28732
|
-
Date.now() - t <
|
|
28741
|
+
Date.now() - t < Ok && (S = globalThis.setTimeout(() => {
|
|
28733
28742
|
S = 0, de(e.id);
|
|
28734
|
-
},
|
|
28743
|
+
}, Dk));
|
|
28735
28744
|
return;
|
|
28736
28745
|
}
|
|
28737
28746
|
oe(), S = globalThis.setTimeout(() => {
|
|
28738
28747
|
S = 0, de(e.id);
|
|
28739
|
-
},
|
|
28748
|
+
}, Tk);
|
|
28740
28749
|
}
|
|
28741
28750
|
}, de = async (e) => {
|
|
28742
28751
|
if (!(T || b?.id !== e)) try {
|
|
@@ -28760,7 +28769,7 @@ function aA(e = {}) {
|
|
|
28760
28769
|
b = {
|
|
28761
28770
|
...b,
|
|
28762
28771
|
status: "failed"
|
|
28763
|
-
}, B(),
|
|
28772
|
+
}, B(), aA(n) && (o = "unavailable"), oe();
|
|
28764
28773
|
}
|
|
28765
28774
|
}, fe = {
|
|
28766
28775
|
health: P,
|
|
@@ -28772,11 +28781,11 @@ function aA(e = {}) {
|
|
|
28772
28781
|
let n = await j({
|
|
28773
28782
|
action: "target",
|
|
28774
28783
|
thread: t
|
|
28775
|
-
}), r =
|
|
28776
|
-
return s =
|
|
28784
|
+
}), r = $k(n);
|
|
28785
|
+
return s = Qk(n) ?? s, V(t, !l), f = r.thread, p = r.threads, o = "available", c = !0, oe(), r;
|
|
28777
28786
|
},
|
|
28778
28787
|
async queue(e) {
|
|
28779
|
-
let r = await
|
|
28788
|
+
let r = await nA(i, e, t), a = e?.thread?.trim(), s = a || (n ? z() : null);
|
|
28780
28789
|
if (n && !a && (d || !s)) throw Error("Choose a Codex thread before queueing feedback.");
|
|
28781
28790
|
let c = { message: r.message };
|
|
28782
28791
|
s && (c.thread = s);
|
|
@@ -28799,14 +28808,14 @@ function aA(e = {}) {
|
|
|
28799
28808
|
message: r.message
|
|
28800
28809
|
}), n;
|
|
28801
28810
|
} catch (e) {
|
|
28802
|
-
throw n &&
|
|
28811
|
+
throw n && aA(e) && (o = "unavailable", k = A ? null : Yk(e) ?? "unavailable", oe()), e;
|
|
28803
28812
|
}
|
|
28804
28813
|
},
|
|
28805
28814
|
send(e) {
|
|
28806
28815
|
return fe.queue(e);
|
|
28807
28816
|
}
|
|
28808
28817
|
};
|
|
28809
|
-
e.service.provide(
|
|
28818
|
+
e.service.provide(xk, fe);
|
|
28810
28819
|
let pe = async () => {
|
|
28811
28820
|
if (!(w || H())) {
|
|
28812
28821
|
if (b?.status === "failed" && b.id) {
|
|
@@ -28846,9 +28855,9 @@ function aA(e = {}) {
|
|
|
28846
28855
|
updatedAt: 0
|
|
28847
28856
|
}) : S = globalThis.setTimeout(() => {
|
|
28848
28857
|
S = 0, de(e.deliveryId);
|
|
28849
|
-
},
|
|
28858
|
+
}, wk) : C = globalThis.setTimeout(() => {
|
|
28850
28859
|
C = 0, b?.id === null && b?.status === "queued" && (b = null, B(), oe());
|
|
28851
|
-
},
|
|
28860
|
+
}, Ek);
|
|
28852
28861
|
} catch (e) {
|
|
28853
28862
|
b = null, B(), oe();
|
|
28854
28863
|
let t = e instanceof Error ? e.message : String(e);
|
|
@@ -28877,7 +28886,7 @@ function aA(e = {}) {
|
|
|
28877
28886
|
}, 0));
|
|
28878
28887
|
let t = globalThis.setInterval(() => {
|
|
28879
28888
|
A && !c || ne(!0).catch(() => void 0);
|
|
28880
|
-
}, A ?
|
|
28889
|
+
}, A ? Ck : Lk);
|
|
28881
28890
|
e.lifecycle.onDispose(() => {
|
|
28882
28891
|
T = !0, ce(), globalThis.clearInterval(t), _?.dispose(), _ = void 0;
|
|
28883
28892
|
});
|
|
@@ -28887,18 +28896,18 @@ function aA(e = {}) {
|
|
|
28887
28896
|
}
|
|
28888
28897
|
//#endregion
|
|
28889
28898
|
//#region src/recording.ts
|
|
28890
|
-
var
|
|
28899
|
+
var sA = qE, cA = (e = {}) => ({
|
|
28891
28900
|
...mD(e),
|
|
28892
28901
|
version: wO
|
|
28893
|
-
}),
|
|
28902
|
+
}), lA = DD, uA = (e = {}) => ({
|
|
28894
28903
|
...qD(e),
|
|
28895
28904
|
version: wO
|
|
28896
|
-
}),
|
|
28905
|
+
}), dA = () => globalThis.window?.__MESURER_HOST__?.codexBridge !== void 0, fA = [
|
|
28897
28906
|
{
|
|
28898
28907
|
id: $O,
|
|
28899
28908
|
label: "Context",
|
|
28900
28909
|
order: 30,
|
|
28901
|
-
create:
|
|
28910
|
+
create: fk,
|
|
28902
28911
|
settingsIds: ["context"],
|
|
28903
28912
|
hiddenSettingsControlIds: ["ui"]
|
|
28904
28913
|
},
|
|
@@ -28916,35 +28925,35 @@ var oA = qE, sA = (e = {}) => ({
|
|
|
28916
28925
|
create: QO
|
|
28917
28926
|
},
|
|
28918
28927
|
{
|
|
28919
|
-
id:
|
|
28928
|
+
id: lA,
|
|
28920
28929
|
label: "Screenshot",
|
|
28921
28930
|
order: 40,
|
|
28922
|
-
create:
|
|
28931
|
+
create: uA,
|
|
28923
28932
|
settingsIds: ["screenshot"],
|
|
28924
28933
|
hiddenSettingsControlIds: ["tool"]
|
|
28925
28934
|
},
|
|
28926
28935
|
{
|
|
28927
|
-
id:
|
|
28936
|
+
id: sA,
|
|
28928
28937
|
label: "Recording",
|
|
28929
28938
|
order: 42,
|
|
28930
|
-
create:
|
|
28939
|
+
create: cA,
|
|
28931
28940
|
settingsIds: ["recording"],
|
|
28932
28941
|
hiddenSettingsControlIds: ["tool"]
|
|
28933
28942
|
},
|
|
28934
28943
|
{
|
|
28935
|
-
id:
|
|
28944
|
+
id: bk,
|
|
28936
28945
|
label: "Codex",
|
|
28937
28946
|
order: 45,
|
|
28938
|
-
create:
|
|
28947
|
+
create: oA
|
|
28939
28948
|
}
|
|
28940
|
-
],
|
|
28941
|
-
let t = e !== void 0, n = new Map((e ?? []).map((e) => [e.id, e])), r = new Set(
|
|
28949
|
+
], pA = (e) => {
|
|
28950
|
+
let t = e !== void 0, n = new Map((e ?? []).map((e) => [e.id, e])), r = new Set(fA.map((e) => e.id)), i = fA.map((e) => {
|
|
28942
28951
|
let r = n.get(e.id);
|
|
28943
28952
|
return {
|
|
28944
28953
|
...e,
|
|
28945
28954
|
settingsIds: e.settingsIds ? [...e.settingsIds] : void 0,
|
|
28946
28955
|
hiddenSettingsControlIds: e.hiddenSettingsControlIds ? [...e.hiddenSettingsControlIds] : void 0,
|
|
28947
|
-
enabled: t ? !!r : e.id === "mesurer.codex" ?
|
|
28956
|
+
enabled: t ? !!r : e.id === "mesurer.codex" ? dA() : e.enabled !== !1,
|
|
28948
28957
|
create: r ? () => r : e.create
|
|
28949
28958
|
};
|
|
28950
28959
|
});
|
|
@@ -28955,7 +28964,7 @@ var oA = qE, sA = (e = {}) => ({
|
|
|
28955
28964
|
create: () => n
|
|
28956
28965
|
});
|
|
28957
28966
|
return i;
|
|
28958
|
-
},
|
|
28967
|
+
}, mA = {
|
|
28959
28968
|
select: "select",
|
|
28960
28969
|
xray: "xray",
|
|
28961
28970
|
colorPicker: "color-picker",
|
|
@@ -28966,7 +28975,7 @@ var oA = qE, sA = (e = {}) => ({
|
|
|
28966
28975
|
distance: "distance",
|
|
28967
28976
|
settings: "settings"
|
|
28968
28977
|
};
|
|
28969
|
-
function
|
|
28978
|
+
function hA(e = {}) {
|
|
28970
28979
|
if (!("document" in globalThis)) throw Error("mountMesurer() requires a browser or Electron renderer document.");
|
|
28971
28980
|
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;
|
|
28972
28981
|
if (o?.aborted) throw o.reason ?? new DOMException("Mesurer mount aborted.", "AbortError");
|
|
@@ -29059,7 +29068,7 @@ function mA(e = {}) {
|
|
|
29059
29068
|
} catch {}
|
|
29060
29069
|
let h = p.createElement("div");
|
|
29061
29070
|
h.dataset.mesurerIsland = "true";
|
|
29062
|
-
let g =
|
|
29071
|
+
let g = yk(h, t, i), _ = h, v = h, y = h;
|
|
29063
29072
|
if (n) {
|
|
29064
29073
|
let e = h.attachShadow({ mode: r });
|
|
29065
29074
|
v = p.createElement("div"), v.dataset.mesurerIslandMount = "true", e.append(v), _ = e, y = e;
|
|
@@ -29129,8 +29138,8 @@ function mA(e = {}) {
|
|
|
29129
29138
|
}), se = {
|
|
29130
29139
|
...f,
|
|
29131
29140
|
version: wO,
|
|
29132
|
-
plugins:
|
|
29133
|
-
excludePlugins: u ? u.map((e) =>
|
|
29141
|
+
plugins: pA(l),
|
|
29142
|
+
excludePlugins: u ? u.map((e) => mA[e]) : [...d ?? []]
|
|
29134
29143
|
}, ce = Po(() => bo(Tw, so(se, {
|
|
29135
29144
|
portalTarget: y,
|
|
29136
29145
|
pageTarget: t,
|
|
@@ -29201,26 +29210,26 @@ function mA(e = {}) {
|
|
|
29201
29210
|
}
|
|
29202
29211
|
//#endregion
|
|
29203
29212
|
//#region src/inject.ts
|
|
29204
|
-
var
|
|
29213
|
+
var gA = globalThis.__MESURER_CONFIG__ ?? {}, _A = (() => {
|
|
29205
29214
|
try {
|
|
29206
29215
|
return !!window.frameElement?.hasAttribute("data-mesurer-responsive-frame");
|
|
29207
29216
|
} catch {
|
|
29208
29217
|
return !1;
|
|
29209
29218
|
}
|
|
29210
|
-
})(), { target:
|
|
29211
|
-
function
|
|
29212
|
-
let e =
|
|
29213
|
-
if (!e) throw Error(`Mesurer injection target not found: ${
|
|
29214
|
-
return
|
|
29215
|
-
...
|
|
29219
|
+
})(), { target: vA, globalName: yA = "__MESURER__", reuseExisting: bA = !0, recoverDisconnected: xA = !1, ...SA } = gA, CA = globalThis.__MESURER_INSTANCE__, wA = !_A && bA && CA?.element.isConnected ? CA : void 0;
|
|
29220
|
+
function TA() {
|
|
29221
|
+
let e = vA ? document.querySelector(vA) : document.body;
|
|
29222
|
+
if (!e) throw Error(`Mesurer injection target not found: ${vA}`);
|
|
29223
|
+
return _A || globalThis.__MESURER_INSTANCE__?.dispose(), hA({
|
|
29224
|
+
...SA,
|
|
29216
29225
|
target: e,
|
|
29217
29226
|
agent: {
|
|
29218
|
-
globalName:
|
|
29227
|
+
globalName: yA,
|
|
29219
29228
|
root: document
|
|
29220
29229
|
}
|
|
29221
29230
|
});
|
|
29222
29231
|
}
|
|
29223
|
-
var
|
|
29232
|
+
var EA = (e) => {
|
|
29224
29233
|
globalThis.__MESURER_INJECT_RECOVERY__?.stop();
|
|
29225
29234
|
let t = !1, n = !1, r = () => {
|
|
29226
29235
|
if (n = !1, t || globalThis.__MESURER_INSTANCE__?.element.isConnected) return;
|
|
@@ -29239,7 +29248,7 @@ var TA = (e) => {
|
|
|
29239
29248
|
}), globalThis.__MESURER_INJECT_RECOVERY__ = { stop() {
|
|
29240
29249
|
t = !0, i.disconnect();
|
|
29241
29250
|
} };
|
|
29242
|
-
},
|
|
29243
|
-
|
|
29251
|
+
}, DA = wA ?? TA();
|
|
29252
|
+
_A || (globalThis.__MESURER_INSTANCE__ = DA), _A || globalThis.__MESURER_INJECT_RECOVERY__?.stop(), _A || (globalThis.__MESURER_INJECT_RECOVERY__ = void 0), xA && !_A && EA(TA), _A || await DA.ready;
|
|
29244
29253
|
//#endregion
|
|
29245
|
-
export {
|
|
29254
|
+
export { DA as mesurer };
|