@pi-outpost/embed 0.51.0 → 0.53.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/{conversationExport-DFrrfjnb.js → conversationExport-BlW4R5hL.js} +45 -45
- package/dist/{conversationExport-CxRhxbfS.cjs → conversationExport-CPhTW6Ko.cjs} +2 -2
- package/dist/conversationHistory-DVdpMO_m.cjs +424 -0
- package/dist/{conversationHistory-Dy4nNb-F.js → conversationHistory-wmxP-e7h.js} +405 -195
- package/dist/pi-outpost-embed.cjs +40 -40
- package/dist/pi-outpost-embed.js +4541 -4216
- package/package.json +1 -1
- package/dist/conversationHistory-DuKHGllw.cjs +0 -342
|
@@ -21614,6 +21614,7 @@ var zT = {
|
|
|
21614
21614
|
UNDO: "pi-outpost:drawio-undo",
|
|
21615
21615
|
REDO: "pi-outpost:drawio-redo",
|
|
21616
21616
|
EXPORT_SVG: "pi-outpost:drawio-export-svg",
|
|
21617
|
+
WIRE_STYLE: "pi-outpost:drawio-wire-style",
|
|
21617
21618
|
CHANGED: "pi-outpost:drawio-changed",
|
|
21618
21619
|
SAVED: "pi-outpost:drawio-saved",
|
|
21619
21620
|
SVG: "pi-outpost:drawio-svg",
|
|
@@ -21697,7 +21698,8 @@ div.mxRubberband { position: absolute; overflow: hidden; border: 1px solid #29b6
|
|
|
21697
21698
|
return root.getElementsByTagName("diagram").length;
|
|
21698
21699
|
}
|
|
21699
21700
|
|
|
21700
|
-
|
|
21701
|
+
// \`start\`: the page to show first, when nothing is drawn yet; later texts keep the page shown
|
|
21702
|
+
function render(xml, dark, start) {
|
|
21701
21703
|
last = { xml: xml, dark: dark };
|
|
21702
21704
|
stopTouchUp();
|
|
21703
21705
|
document.body.className = dark ? "dark" : "";
|
|
@@ -21718,7 +21720,7 @@ div.mxRubberband { position: absolute; overflow: hidden; border: 1px solid #29b6
|
|
|
21718
21720
|
tell({ type: M.FAILED, message: "This is not a draw.io diagram: its root is <" + doc.documentElement.nodeName + ">, not <mxfile> or <mxGraphModel>." });
|
|
21719
21721
|
return;
|
|
21720
21722
|
}
|
|
21721
|
-
var page = viewer !== null ?
|
|
21723
|
+
var page = Math.min(viewer !== null ? viewer.currentPage || 0 : typeof start === "number" && start > 0 ? start : 0, pages - 1);
|
|
21722
21724
|
var container = document.createElement("div");
|
|
21723
21725
|
container.id = "diagram";
|
|
21724
21726
|
document.body.appendChild(container);
|
|
@@ -21766,7 +21768,79 @@ div.mxRubberband { position: absolute; overflow: hidden; border: 1px solid #29b6
|
|
|
21766
21768
|
var undo = touch.undo;
|
|
21767
21769
|
// A label being typed is an edit too: leaving now would drop it
|
|
21768
21770
|
var typing = viewer !== null && viewer.graph.isEditing();
|
|
21769
|
-
tell({ type: M.CHANGED, dirty: typing || undo.indexOfNextAdd !== touch.clean, canUndo: undo.canUndo(), canRedo: undo.canRedo() });
|
|
21771
|
+
tell({ type: M.CHANGED, dirty: typing || undo.indexOfNextAdd !== touch.clean, canUndo: undo.canUndo(), canRedo: undo.canRedo(), wireStyle: viewer === null ? null : targetWireStyle(viewer.graph) });
|
|
21772
|
+
}
|
|
21773
|
+
|
|
21774
|
+
// Wire styles as draw.io's Waypoints menu sets them (Menus.js, edgeStyleChange): the keys
|
|
21775
|
+
// each one writes, null removing a key
|
|
21776
|
+
var WIRE_STYLES = {
|
|
21777
|
+
straight: { edgeStyle: null, curved: null, noEdgeStyle: null, elbow: null },
|
|
21778
|
+
orthogonal: { edgeStyle: "orthogonalEdgeStyle", curved: null, noEdgeStyle: null, elbow: null },
|
|
21779
|
+
curved: { edgeStyle: "orthogonalEdgeStyle", curved: "1", noEdgeStyle: null, elbow: null }
|
|
21780
|
+
};
|
|
21781
|
+
|
|
21782
|
+
function wireStyleOf(graph, cell) {
|
|
21783
|
+
var style = graph.getCurrentCellStyle(cell);
|
|
21784
|
+
if (style.noEdgeStyle == 1 || style.edgeStyle == null || style.edgeStyle === "none") return "straight";
|
|
21785
|
+
return style.curved == 1 ? "curved" : "orthogonal";
|
|
21786
|
+
}
|
|
21787
|
+
|
|
21788
|
+
function pageWires(graph) {
|
|
21789
|
+
var model = graph.getModel();
|
|
21790
|
+
return Object.keys(model.cells).map(function (id) { return model.cells[id]; }).filter(function (cell) { return model.isEdge(cell); });
|
|
21791
|
+
}
|
|
21792
|
+
|
|
21793
|
+
// The wires a choice changes: the selected ones, else all of the page's
|
|
21794
|
+
function targetWires(graph) {
|
|
21795
|
+
var selected = graph.getSelectionCells().filter(function (cell) { return graph.getModel().isEdge(cell); });
|
|
21796
|
+
return selected.length > 0 ? selected : pageWires(graph);
|
|
21797
|
+
}
|
|
21798
|
+
|
|
21799
|
+
function targetWireStyle(graph) {
|
|
21800
|
+
var wires = targetWires(graph);
|
|
21801
|
+
if (wires.length === 0) return newWireStyle(graph);
|
|
21802
|
+
var first = wireStyleOf(graph, wires[0]);
|
|
21803
|
+
for (var i = 1; i < wires.length; i++) if (wireStyleOf(graph, wires[i]) !== first) return "mixed";
|
|
21804
|
+
return first;
|
|
21805
|
+
}
|
|
21806
|
+
|
|
21807
|
+
function newWireStyle(graph) {
|
|
21808
|
+
var current = graph.currentEdgeStyle || {};
|
|
21809
|
+
if (current.edgeStyle == null || current.edgeStyle === "none") return "straight";
|
|
21810
|
+
return current.curved == "1" ? "curved" : "orthogonal";
|
|
21811
|
+
}
|
|
21812
|
+
|
|
21813
|
+
// New wires take this style (Graph.createCurrentEdgeStyle reads currentEdgeStyle)
|
|
21814
|
+
function setNewWireStyle(graph, name) {
|
|
21815
|
+
var current = mxUtils.clone(graph.currentEdgeStyle || {});
|
|
21816
|
+
var keys = WIRE_STYLES[name];
|
|
21817
|
+
for (var key in keys) {
|
|
21818
|
+
if (keys[key] === null) delete current[key];
|
|
21819
|
+
else current[key] = keys[key];
|
|
21820
|
+
}
|
|
21821
|
+
graph.currentEdgeStyle = current;
|
|
21822
|
+
}
|
|
21823
|
+
|
|
21824
|
+
// One model update: one undo takes it back. Waypoints go, as draw.io resets them: laid out
|
|
21825
|
+
// for one style, they make no sense in another
|
|
21826
|
+
function applyWireStyle(name) {
|
|
21827
|
+
if (touch === null || viewer === null || !WIRE_STYLES[name]) return;
|
|
21828
|
+
var graph = viewer.graph;
|
|
21829
|
+
if (graph.isEditing()) graph.stopEditing(false);
|
|
21830
|
+
var wires = targetWires(graph);
|
|
21831
|
+
var model = graph.getModel();
|
|
21832
|
+
model.beginUpdate();
|
|
21833
|
+
try {
|
|
21834
|
+
for (var i = 0; i < wires.length; i++) {
|
|
21835
|
+
graph.resetEdge(wires[i]);
|
|
21836
|
+
var keys = WIRE_STYLES[name];
|
|
21837
|
+
for (var key in keys) graph.setCellStyles(key, keys[key], [wires[i]]);
|
|
21838
|
+
}
|
|
21839
|
+
} finally {
|
|
21840
|
+
model.endUpdate();
|
|
21841
|
+
}
|
|
21842
|
+
setNewWireStyle(graph, name);
|
|
21843
|
+
changed();
|
|
21770
21844
|
}
|
|
21771
21845
|
|
|
21772
21846
|
// The viewer holds back the editing core it bundles; this lets it go, for the page shown
|
|
@@ -21805,6 +21879,13 @@ div.mxRubberband { position: absolute; overflow: hidden; border: 1px solid #29b6
|
|
|
21805
21879
|
if (height > container.offsetHeight) shown.updateContainerHeight(container, height);
|
|
21806
21880
|
};
|
|
21807
21881
|
graph.getModel().addListener(mxEvent.CHANGE, grow);
|
|
21882
|
+
// New wires start in the style most of the page's wires have: an agent's diagonal wires
|
|
21883
|
+
// get diagonal neighbours, not draw.io's orthogonal default
|
|
21884
|
+
var counts = { straight: 0, orthogonal: 0, curved: 0 };
|
|
21885
|
+
pageWires(graph).forEach(function (cell) { counts[wireStyleOf(graph, cell)] += 1; });
|
|
21886
|
+
var most = counts.orthogonal >= counts.straight && counts.orthogonal >= counts.curved ? "orthogonal" : counts.straight >= counts.curved ? "straight" : "curved";
|
|
21887
|
+
setNewWireStyle(graph, most);
|
|
21888
|
+
graph.getSelectionModel().addListener(mxEvent.CHANGE, changed);
|
|
21808
21889
|
graph.addListener(mxEvent.EDITING_STARTED, changed);
|
|
21809
21890
|
graph.addListener(mxEvent.EDITING_STOPPED, changed);
|
|
21810
21891
|
// The keys are the graph's own, not the document's: mxKeyHandler only takes an event
|
|
@@ -21869,6 +21950,7 @@ div.mxRubberband { position: absolute; overflow: hidden; border: 1px solid #29b6
|
|
|
21869
21950
|
viewer.graph.getModel().removeListener(current.record);
|
|
21870
21951
|
viewer.graph.getModel().removeListener(current.grow);
|
|
21871
21952
|
viewer.graph.removeListener(changed);
|
|
21953
|
+
viewer.graph.getSelectionModel().removeListener(changed);
|
|
21872
21954
|
viewer.graph.getView().removeListener(current.record);
|
|
21873
21955
|
}
|
|
21874
21956
|
}
|
|
@@ -21933,7 +22015,7 @@ div.mxRubberband { position: absolute; overflow: hidden; border: 1px solid #29b6
|
|
|
21933
22015
|
if (event.source !== parent) return;
|
|
21934
22016
|
var data = event.data;
|
|
21935
22017
|
if (!data) return;
|
|
21936
|
-
if (data.type === M.RENDER && typeof data.xml === "string") render(data.xml, data.dark === true);
|
|
22018
|
+
if (data.type === M.RENDER && typeof data.xml === "string") render(data.xml, data.dark === true, data.page);
|
|
21937
22019
|
else if (data.type === M.EDIT) {
|
|
21938
22020
|
editing = data.on === true;
|
|
21939
22021
|
if (editing) startTouchUp();
|
|
@@ -21947,6 +22029,7 @@ div.mxRubberband { position: absolute; overflow: hidden; border: 1px solid #29b6
|
|
|
21947
22029
|
else if (data.type === M.UNDO) undoOrRedo(false);
|
|
21948
22030
|
else if (data.type === M.REDO) undoOrRedo(true);
|
|
21949
22031
|
else if (data.type === M.EXPORT_SVG) exportSvg();
|
|
22032
|
+
else if (data.type === M.WIRE_STYLE && typeof data.style === "string") applyWireStyle(data.style);
|
|
21950
22033
|
});
|
|
21951
22034
|
|
|
21952
22035
|
if (typeof GraphViewer === "undefined") {
|
|
@@ -21960,61 +22043,74 @@ div.mxRubberband { position: absolute; overflow: hidden; border: 1px solid #29b6
|
|
|
21960
22043
|
}
|
|
21961
22044
|
//#endregion
|
|
21962
22045
|
//#region ../ui/src/components/DrawioFrame.tsx
|
|
21963
|
-
var WT = "allow-scripts", GT = 1e4, KT = te(function({ xml: e, serverUrl: t, title: n, fallback: r, editing: i = !1, onTouchUpChange: a, onPageLocked: o, onEscape: s, onRendered: c, className: l = "flex h-full min-h-[24rem] flex-col" },
|
|
21964
|
-
let
|
|
22046
|
+
var WT = "allow-scripts", GT = 1e4, KT = te(function({ xml: e, serverUrl: t, title: n, fallback: r, editing: i = !1, onTouchUpChange: a, onPageLocked: o, onEscape: s, onRendered: c, className: l = "flex h-full min-h-[24rem] flex-col", page: u }, d) {
|
|
22047
|
+
let f = T(null), p = ue() === "dark", m = se(() => UT(BT(t)), [t]), [h, g] = E(0), [_, v] = E(null), y = T(/* @__PURE__ */ new Map()), b = T({
|
|
21965
22048
|
onTouchUpChange: a,
|
|
21966
22049
|
onPageLocked: o,
|
|
21967
22050
|
onEscape: s,
|
|
21968
22051
|
onRendered: c
|
|
21969
22052
|
});
|
|
21970
|
-
|
|
22053
|
+
b.current = {
|
|
21971
22054
|
onTouchUpChange: a,
|
|
21972
22055
|
onPageLocked: o,
|
|
21973
22056
|
onEscape: s,
|
|
21974
22057
|
onRendered: c
|
|
21975
22058
|
};
|
|
21976
|
-
let
|
|
21977
|
-
function
|
|
21978
|
-
|
|
22059
|
+
let ee = T(null), x = T(i);
|
|
22060
|
+
function S(e) {
|
|
22061
|
+
f.current?.contentWindow?.postMessage(e, "*");
|
|
21979
22062
|
}
|
|
21980
|
-
function
|
|
22063
|
+
function C(e, t) {
|
|
21981
22064
|
return new Promise((n, r) => {
|
|
21982
|
-
|
|
22065
|
+
y.current.get(t)?.reject(/* @__PURE__ */ Error("superseded"));
|
|
21983
22066
|
let i = setTimeout(() => {
|
|
21984
|
-
|
|
22067
|
+
y.current.delete(t), r(/* @__PURE__ */ Error("the diagram did not answer"));
|
|
21985
22068
|
}, GT);
|
|
21986
|
-
|
|
22069
|
+
y.current.set(t, {
|
|
21987
22070
|
resolve: ((e) => {
|
|
21988
22071
|
clearTimeout(i), n(e);
|
|
21989
22072
|
}),
|
|
21990
22073
|
reject: (e) => {
|
|
21991
22074
|
clearTimeout(i), r(e);
|
|
21992
22075
|
}
|
|
21993
|
-
}),
|
|
22076
|
+
}), S({ type: e });
|
|
21994
22077
|
});
|
|
21995
22078
|
}
|
|
21996
|
-
return ae(
|
|
21997
|
-
save: () =>
|
|
21998
|
-
markClean: () =>
|
|
21999
|
-
undo: () =>
|
|
22000
|
-
redo: () =>
|
|
22001
|
-
|
|
22079
|
+
return ae(d, () => ({
|
|
22080
|
+
save: () => C(zT.SAVE, zT.SAVED),
|
|
22081
|
+
markClean: () => S({ type: zT.CLEAN }),
|
|
22082
|
+
undo: () => S({ type: zT.UNDO }),
|
|
22083
|
+
redo: () => S({ type: zT.REDO }),
|
|
22084
|
+
setWireStyle: (e) => S({
|
|
22085
|
+
type: zT.WIRE_STYLE,
|
|
22086
|
+
style: e
|
|
22087
|
+
}),
|
|
22088
|
+
exportSvg: () => C(zT.EXPORT_SVG, zT.SVG)
|
|
22002
22089
|
})), w(() => {
|
|
22003
|
-
let e =
|
|
22090
|
+
let e = y.current;
|
|
22004
22091
|
function t(t) {
|
|
22005
|
-
if (
|
|
22092
|
+
if (f.current === null || t.source !== f.current.contentWindow) return;
|
|
22006
22093
|
let n = t.data;
|
|
22007
22094
|
if (typeof n == "object" && n) {
|
|
22008
|
-
if (n.type === zT.READY)
|
|
22009
|
-
else if (n.type === zT.RENDERED)
|
|
22095
|
+
if (n.type === zT.READY) ee.current = null, x.current = !1, g((e) => e + 1);
|
|
22096
|
+
else if (n.type === zT.RENDERED) v(null), b.current.onRendered?.(null);
|
|
22010
22097
|
else if (n.type === zT.FAILED) {
|
|
22011
22098
|
let e = typeof n.message == "string" ? n.message : "The diagram could not be drawn.";
|
|
22012
|
-
|
|
22013
|
-
} else n.type === zT.CHANGED
|
|
22014
|
-
|
|
22015
|
-
|
|
22016
|
-
|
|
22017
|
-
|
|
22099
|
+
v(e), b.current.onRendered?.(e);
|
|
22100
|
+
} else if (n.type === zT.CHANGED) {
|
|
22101
|
+
let e = [
|
|
22102
|
+
"straight",
|
|
22103
|
+
"orthogonal",
|
|
22104
|
+
"curved",
|
|
22105
|
+
"mixed"
|
|
22106
|
+
].includes(n.wireStyle) ? n.wireStyle : void 0;
|
|
22107
|
+
b.current.onTouchUpChange?.({
|
|
22108
|
+
dirty: n.dirty === !0,
|
|
22109
|
+
canUndo: n.canUndo === !0,
|
|
22110
|
+
canRedo: n.canRedo === !0,
|
|
22111
|
+
...e ? { wireStyle: e } : {}
|
|
22112
|
+
});
|
|
22113
|
+
} else n.type === zT.FOCUS ? f.current !== null && document.activeElement !== f.current && f.current.focus({ preventScroll: !0 }) : n.type === zT.ESCAPE ? b.current.onEscape?.() : n.type === zT.PAGE_LOCKED ? b.current.onPageLocked?.() : n.type === zT.SAVED && typeof n.xml == "string" && typeof n.page == "number" ? (e.get(zT.SAVED)?.resolve({
|
|
22018
22114
|
page: n.page,
|
|
22019
22115
|
xml: n.xml
|
|
22020
22116
|
}), e.delete(zT.SAVED)) : n.type === zT.SVG && typeof n.svg == "string" && typeof n.page == "number" && (e.get(zT.SVG)?.resolve({
|
|
@@ -22030,56 +22126,58 @@ var WT = "allow-scripts", GT = 1e4, KT = te(function({ xml: e, serverUrl: t, tit
|
|
|
22030
22126
|
e.clear();
|
|
22031
22127
|
};
|
|
22032
22128
|
}, []), w(() => {
|
|
22033
|
-
|
|
22129
|
+
h !== 0 && (i ? (!x.current && (ee.current === null || ee.current.xml !== e || ee.current.dark !== p) && (ee.current = {
|
|
22034
22130
|
xml: e,
|
|
22035
|
-
dark:
|
|
22036
|
-
},
|
|
22131
|
+
dark: p
|
|
22132
|
+
}, S({
|
|
22037
22133
|
type: zT.RENDER,
|
|
22038
22134
|
xml: e,
|
|
22039
|
-
dark:
|
|
22040
|
-
|
|
22135
|
+
dark: p,
|
|
22136
|
+
...u === void 0 ? {} : { page: u }
|
|
22137
|
+
})), x.current || S({
|
|
22041
22138
|
type: zT.EDIT,
|
|
22042
22139
|
on: !0
|
|
22043
|
-
}),
|
|
22140
|
+
}), x.current = !0) : x.current ? (x.current = !1, ee.current = {
|
|
22044
22141
|
xml: e,
|
|
22045
|
-
dark:
|
|
22046
|
-
},
|
|
22142
|
+
dark: p
|
|
22143
|
+
}, S({
|
|
22047
22144
|
type: zT.EDIT,
|
|
22048
22145
|
on: !1,
|
|
22049
22146
|
xml: e,
|
|
22050
|
-
dark:
|
|
22051
|
-
})) : (
|
|
22147
|
+
dark: p
|
|
22148
|
+
})) : (ee.current === null || ee.current.xml !== e || ee.current.dark !== p) && (ee.current = {
|
|
22052
22149
|
xml: e,
|
|
22053
|
-
dark:
|
|
22054
|
-
},
|
|
22150
|
+
dark: p
|
|
22151
|
+
}, S({
|
|
22055
22152
|
type: zT.RENDER,
|
|
22056
22153
|
xml: e,
|
|
22057
|
-
dark:
|
|
22154
|
+
dark: p,
|
|
22155
|
+
...u === void 0 ? {} : { page: u }
|
|
22058
22156
|
})));
|
|
22059
22157
|
}, [
|
|
22060
|
-
|
|
22158
|
+
h,
|
|
22061
22159
|
e,
|
|
22062
|
-
|
|
22160
|
+
p,
|
|
22063
22161
|
i
|
|
22064
22162
|
]), /* @__PURE__ */ k("div", {
|
|
22065
22163
|
className: l,
|
|
22066
22164
|
"data-testid": "drawio-view",
|
|
22067
22165
|
children: [
|
|
22068
|
-
|
|
22166
|
+
_ !== null && /* @__PURE__ */ O("div", {
|
|
22069
22167
|
role: "alert",
|
|
22070
22168
|
"data-testid": "drawio-failure",
|
|
22071
22169
|
className: "border-b border-amber-300 bg-amber-50 px-3 py-1.5 text-xs text-amber-900 dark:border-amber-700 dark:bg-amber-950/40 dark:text-amber-200",
|
|
22072
|
-
children:
|
|
22170
|
+
children: _
|
|
22073
22171
|
}),
|
|
22074
22172
|
/* @__PURE__ */ O("iframe", {
|
|
22075
|
-
ref:
|
|
22173
|
+
ref: f,
|
|
22076
22174
|
title: n,
|
|
22077
22175
|
"data-testid": "drawio-frame",
|
|
22078
22176
|
sandbox: WT,
|
|
22079
|
-
srcDoc:
|
|
22080
|
-
className:
|
|
22177
|
+
srcDoc: m,
|
|
22178
|
+
className: _ === null ? "min-h-0 w-full flex-1 border-0" : "h-0 w-full border-0"
|
|
22081
22179
|
}),
|
|
22082
|
-
|
|
22180
|
+
_ !== null && /* @__PURE__ */ O("div", {
|
|
22083
22181
|
className: "min-h-0 flex-1 overflow-auto",
|
|
22084
22182
|
children: r
|
|
22085
22183
|
})
|
|
@@ -22143,16 +22241,51 @@ function eE(e, t, n) {
|
|
|
22143
22241
|
return e.slice(0, a.start) + c + r + s + r + o + "</diagram>" + e.slice(a.end);
|
|
22144
22242
|
}
|
|
22145
22243
|
//#endregion
|
|
22244
|
+
//#region ../ui/src/util/drawioPages.ts
|
|
22245
|
+
function tE(e) {
|
|
22246
|
+
let t = new DOMParser().parseFromString(e, "application/xml").documentElement;
|
|
22247
|
+
if (t.nodeName === "parsererror" || t.getElementsByTagName("parsererror").length > 0) throw Error("it is not a draw.io diagram (not XML)");
|
|
22248
|
+
if (t.nodeName !== "mxfile" && t.nodeName !== "mxGraphModel") throw Error(`it is not a draw.io diagram (its root is <${t.nodeName}>)`);
|
|
22249
|
+
return t;
|
|
22250
|
+
}
|
|
22251
|
+
function nE(e) {
|
|
22252
|
+
return [...e.children].filter((e) => e.nodeName === "diagram");
|
|
22253
|
+
}
|
|
22254
|
+
function rE(e) {
|
|
22255
|
+
let t = tE(e);
|
|
22256
|
+
if (t.nodeName === "mxGraphModel") return ["Page 1"];
|
|
22257
|
+
let n = nE(t);
|
|
22258
|
+
if (n.length === 0) throw Error("it holds no page");
|
|
22259
|
+
return n.map((e, t) => e.getAttribute("name")?.trim() || `Page ${t + 1}`);
|
|
22260
|
+
}
|
|
22261
|
+
function iE(e, t) {
|
|
22262
|
+
if (t === void 0 || t.trim() === "") return 0;
|
|
22263
|
+
let n = rE(e), r = t.trim(), i = n.indexOf(r), a = i >= 0 ? i : /^\d+$/.test(r) ? Number(r) - 1 : -1;
|
|
22264
|
+
if (a < 0 || a >= n.length) throw Error(`it has no page "${r}"; its pages are ${n.map((e) => `"${e}"`).join(", ")}`);
|
|
22265
|
+
return a;
|
|
22266
|
+
}
|
|
22267
|
+
function aE(e, t) {
|
|
22268
|
+
let n = tE(e), r = iE(e, t);
|
|
22269
|
+
if (n.nodeName === "mxGraphModel") return e;
|
|
22270
|
+
let i = n.cloneNode(!1);
|
|
22271
|
+
return i.appendChild(nE(n)[r].cloneNode(!0)), new XMLSerializer().serializeToString(i);
|
|
22272
|
+
}
|
|
22273
|
+
function oE(e, t) {
|
|
22274
|
+
let n = e.split("/").slice(0, -1), r = t.split("/"), i = 0;
|
|
22275
|
+
for (; i < n.length && i < r.length - 1 && n[i] === r[i];) i += 1;
|
|
22276
|
+
return [...n.slice(i).map(() => ".."), ...r.slice(i)].join("/");
|
|
22277
|
+
}
|
|
22278
|
+
//#endregion
|
|
22146
22279
|
//#region ../ui/src/components/DrawioBlock.tsx
|
|
22147
|
-
var
|
|
22280
|
+
var sE = {
|
|
22148
22281
|
dirty: !1,
|
|
22149
22282
|
canUndo: !1,
|
|
22150
22283
|
canRedo: !1
|
|
22151
|
-
},
|
|
22152
|
-
function
|
|
22284
|
+
}, cE = "Discard the unsaved touch-ups to this diagram?";
|
|
22285
|
+
function lE(e) {
|
|
22153
22286
|
return e.slice(e.lastIndexOf("/") + 1).replace(/\.(drawio|dio)$/i, "") || "diagram";
|
|
22154
22287
|
}
|
|
22155
|
-
function
|
|
22288
|
+
function uE(e, t, n) {
|
|
22156
22289
|
let r = URL.createObjectURL(new Blob([t], { type: n }));
|
|
22157
22290
|
try {
|
|
22158
22291
|
let t = document.createElement("a");
|
|
@@ -22161,11 +22294,11 @@ function iE(e, t, n) {
|
|
|
22161
22294
|
URL.revokeObjectURL(r);
|
|
22162
22295
|
}
|
|
22163
22296
|
}
|
|
22164
|
-
function
|
|
22297
|
+
function dE(e, t) {
|
|
22165
22298
|
let n = t?.trim().replace(/[^\p{L}\p{N}._-]+/gu, "-").replace(/^-+|-+$/g, "");
|
|
22166
|
-
return `${
|
|
22299
|
+
return `${lE(e)}${n ? `-${n}` : ""}.svg`;
|
|
22167
22300
|
}
|
|
22168
|
-
function
|
|
22301
|
+
function fE(e, t, n) {
|
|
22169
22302
|
let { fileIo: r } = JT(), [i, a] = E({ status: "loading" }), o = T(0), s = ne(() => {
|
|
22170
22303
|
if (!t) return;
|
|
22171
22304
|
if (r === void 0) {
|
|
@@ -22204,7 +22337,7 @@ function oE(e, t, n) {
|
|
|
22204
22337
|
s
|
|
22205
22338
|
]), i;
|
|
22206
22339
|
}
|
|
22207
|
-
function
|
|
22340
|
+
function pE(e, t) {
|
|
22208
22341
|
let [n, r] = E(!t || typeof IntersectionObserver > "u");
|
|
22209
22342
|
return w(() => {
|
|
22210
22343
|
if (n || e.current === null) return;
|
|
@@ -22214,168 +22347,232 @@ function sE(e, t) {
|
|
|
22214
22347
|
return t.observe(e.current), () => t.disconnect();
|
|
22215
22348
|
}, [n, e]), n;
|
|
22216
22349
|
}
|
|
22217
|
-
function
|
|
22218
|
-
let { serverUrl:
|
|
22350
|
+
function mE({ path: e, xml: t, variant: n, fallback: r, onTouchUpDirtyChange: i, page: a, startTouchUp: o = !1, onEscape: s }) {
|
|
22351
|
+
let { serverUrl: c, fileIo: l, onOpenFile: u } = JT(), d = T(null), f = pE(d, n === "reply"), p = fE(e, t === void 0, f), m = t ?? (p.status === "loaded" ? p.content : null), h = T(null), g = T(null), [_, v] = E(!1), [y, b] = E(null), [ee, x] = E(null), [S, C] = E(null), te = T(null), [re, ie] = E(sE), [ae, oe] = E(!1), ce = T(!1), [le, ue] = E(null), [de, fe] = E(null), me = (e) => e === "inline" ? h : g, he = (e) => S === e && te.current !== null ? te.current.content : m, ge = l !== void 0, A = S !== null && re.dirty, _e = se(() => {
|
|
22352
|
+
if (a === void 0 || m === null) return {
|
|
22353
|
+
index: 0,
|
|
22354
|
+
problem: null
|
|
22355
|
+
};
|
|
22356
|
+
try {
|
|
22357
|
+
return {
|
|
22358
|
+
index: iE(m, a),
|
|
22359
|
+
problem: null
|
|
22360
|
+
};
|
|
22361
|
+
} catch (e) {
|
|
22362
|
+
return {
|
|
22363
|
+
index: 0,
|
|
22364
|
+
problem: e instanceof Error ? e.message : String(e)
|
|
22365
|
+
};
|
|
22366
|
+
}
|
|
22367
|
+
}, [a, m]), ve = T(!1);
|
|
22219
22368
|
w(() => {
|
|
22220
|
-
|
|
22221
|
-
}
|
|
22222
|
-
|
|
22223
|
-
|
|
22224
|
-
|
|
22369
|
+
o && !ve.current && m !== null && _e.problem === null && (ve.current = !0, be("inline"));
|
|
22370
|
+
});
|
|
22371
|
+
let ye = T(null);
|
|
22372
|
+
w(() => {
|
|
22373
|
+
S === null || re.dirty || te.current === null || m === null || m === te.current.content || (ye.current = S, te.current = null, ie(sE), C(null));
|
|
22374
|
+
}, [
|
|
22375
|
+
m,
|
|
22376
|
+
S,
|
|
22377
|
+
re.dirty
|
|
22378
|
+
]), w(() => {
|
|
22379
|
+
if (S !== null || ye.current === null) return;
|
|
22380
|
+
let e = ye.current;
|
|
22381
|
+
ye.current = null, be(e);
|
|
22382
|
+
}), w(() => {
|
|
22383
|
+
i?.(A);
|
|
22384
|
+
}, [A, i]), w(() => () => i?.(!1), [i]);
|
|
22385
|
+
async function be(t) {
|
|
22386
|
+
if (l !== void 0 && S === null) {
|
|
22387
|
+
ue(null), fe(null);
|
|
22225
22388
|
try {
|
|
22226
|
-
|
|
22389
|
+
te.current = await l.read(e), ie(sE), C(t);
|
|
22227
22390
|
} catch (e) {
|
|
22228
|
-
|
|
22391
|
+
ue({
|
|
22229
22392
|
message: e instanceof Error ? e.message : String(e),
|
|
22230
22393
|
conflict: !1
|
|
22231
22394
|
});
|
|
22232
22395
|
}
|
|
22233
22396
|
}
|
|
22234
22397
|
}
|
|
22235
|
-
function
|
|
22236
|
-
return
|
|
22398
|
+
function xe() {
|
|
22399
|
+
return A && !window.confirm(cE) ? !1 : (C(null), ie(sE), ue(null), fe(null), te.current = null, !0);
|
|
22237
22400
|
}
|
|
22238
|
-
async function
|
|
22239
|
-
let t =
|
|
22240
|
-
if (!(t === null || n === null ||
|
|
22241
|
-
|
|
22401
|
+
async function Se() {
|
|
22402
|
+
let t = S, n = te.current;
|
|
22403
|
+
if (!(t === null || n === null || l === void 0 || ce.current)) {
|
|
22404
|
+
ce.current = !0, oe(!0), ue(null);
|
|
22242
22405
|
try {
|
|
22243
|
-
let r = await
|
|
22244
|
-
|
|
22406
|
+
let r = await me(t).current.save(), i = eE(n.content, r.page, r.xml), { mtimeMs: a } = await l.write(e, i, n.mtimeMs);
|
|
22407
|
+
te.current = {
|
|
22245
22408
|
content: i,
|
|
22246
22409
|
mtimeMs: a
|
|
22247
|
-
},
|
|
22410
|
+
}, me(t).current?.markClean();
|
|
22248
22411
|
} catch (e) {
|
|
22249
22412
|
let t = e instanceof YT && e.reason === "conflict";
|
|
22250
|
-
|
|
22413
|
+
ue({
|
|
22251
22414
|
message: t ? "The file changed on disk, or was removed, since this touch-up began, so it was not saved. Leave without saving to see what is there now." : `Could not save: ${e instanceof Error ? e.message : String(e)}`,
|
|
22252
22415
|
conflict: t
|
|
22253
22416
|
});
|
|
22254
22417
|
} finally {
|
|
22255
|
-
|
|
22418
|
+
ce.current = !1, oe(!1);
|
|
22256
22419
|
}
|
|
22257
22420
|
}
|
|
22258
22421
|
}
|
|
22259
|
-
async function
|
|
22260
|
-
|
|
22422
|
+
async function Te(t) {
|
|
22423
|
+
x(null);
|
|
22261
22424
|
try {
|
|
22262
|
-
let n = await
|
|
22263
|
-
|
|
22425
|
+
let n = await me(t).current.exportSvg();
|
|
22426
|
+
uE(dE(e, n.name), n.svg, "image/svg+xml;charset=utf-8");
|
|
22264
22427
|
} catch (e) {
|
|
22265
|
-
|
|
22266
|
-
}
|
|
22267
|
-
}
|
|
22268
|
-
function
|
|
22269
|
-
(
|
|
22270
|
-
}
|
|
22271
|
-
let
|
|
22272
|
-
|
|
22273
|
-
let
|
|
22274
|
-
|
|
22275
|
-
let
|
|
22276
|
-
|
|
22277
|
-
let
|
|
22278
|
-
|
|
22279
|
-
let
|
|
22280
|
-
|
|
22428
|
+
x(e instanceof Error ? e.message : String(e));
|
|
22429
|
+
}
|
|
22430
|
+
}
|
|
22431
|
+
function Ee() {
|
|
22432
|
+
(S !== "enlarged" || xe()) && v(!1);
|
|
22433
|
+
}
|
|
22434
|
+
let De = ne(() => fe("Save or undo the touch-ups on this page before turning to another."), []), Oe = T(xe);
|
|
22435
|
+
Oe.current = xe;
|
|
22436
|
+
let ke = T(Ee);
|
|
22437
|
+
ke.current = Ee;
|
|
22438
|
+
let Ae = T(S);
|
|
22439
|
+
Ae.current = S;
|
|
22440
|
+
let je = T(_);
|
|
22441
|
+
je.current = _;
|
|
22442
|
+
let Me = T(s);
|
|
22443
|
+
Me.current = s;
|
|
22444
|
+
let Ne = ne(() => {
|
|
22445
|
+
Me.current ? Me.current() : Ae.current === null ? je.current && ke.current() : Oe.current();
|
|
22281
22446
|
}, []);
|
|
22282
22447
|
w(() => {
|
|
22283
|
-
if (
|
|
22448
|
+
if (S === null) return;
|
|
22284
22449
|
function e(e) {
|
|
22285
|
-
e.key === "Escape" && (e.preventDefault(), e.stopImmediatePropagation(),
|
|
22450
|
+
e.key === "Escape" && (e.preventDefault(), e.stopImmediatePropagation(), Me.current ? Me.current() : Oe.current());
|
|
22286
22451
|
}
|
|
22287
22452
|
return window.addEventListener("keydown", e, !0), () => window.removeEventListener("keydown", e, !0);
|
|
22288
|
-
}, [
|
|
22289
|
-
function
|
|
22453
|
+
}, [S]);
|
|
22454
|
+
function Pe(t) {
|
|
22290
22455
|
return /* @__PURE__ */ k(D, { children: [/* @__PURE__ */ O("button", {
|
|
22291
22456
|
type: "button",
|
|
22292
22457
|
className: Ce,
|
|
22293
|
-
disabled:
|
|
22294
|
-
onClick: () => void
|
|
22458
|
+
disabled: m === null || y !== null,
|
|
22459
|
+
onClick: () => void Te(t),
|
|
22295
22460
|
title: "Save the page shown as .svg — insert it as a picture in a document",
|
|
22296
22461
|
children: "⤓ download SVG"
|
|
22297
22462
|
}), /* @__PURE__ */ O("button", {
|
|
22298
22463
|
type: "button",
|
|
22299
22464
|
className: Ce,
|
|
22300
|
-
disabled:
|
|
22301
|
-
onClick: () =>
|
|
22465
|
+
disabled: m === null,
|
|
22466
|
+
onClick: () => m !== null && uE(e.slice(e.lastIndexOf("/") + 1), m, "application/xml;charset=utf-8"),
|
|
22302
22467
|
title: "Save the .drawio file, to open or share it",
|
|
22303
22468
|
children: "⤓ download .drawio"
|
|
22304
22469
|
})] });
|
|
22305
22470
|
}
|
|
22306
|
-
function
|
|
22307
|
-
return
|
|
22471
|
+
function Fe(e) {
|
|
22472
|
+
return S === e ? /* @__PURE__ */ k(D, { children: [
|
|
22308
22473
|
/* @__PURE__ */ O("button", {
|
|
22309
22474
|
type: "button",
|
|
22310
22475
|
className: Ce,
|
|
22311
|
-
disabled: !
|
|
22312
|
-
onClick: () => void
|
|
22313
|
-
children:
|
|
22476
|
+
disabled: !re.dirty || ae,
|
|
22477
|
+
onClick: () => void Se(),
|
|
22478
|
+
children: ae ? "saving…" : "✓ save"
|
|
22314
22479
|
}),
|
|
22315
22480
|
/* @__PURE__ */ O("button", {
|
|
22316
22481
|
type: "button",
|
|
22317
22482
|
className: Ce,
|
|
22318
|
-
disabled: !
|
|
22319
|
-
onClick: () =>
|
|
22483
|
+
disabled: !re.canUndo,
|
|
22484
|
+
onClick: () => me(e).current?.undo(),
|
|
22320
22485
|
title: "Undo (⌘Z / Ctrl+Z)",
|
|
22321
22486
|
children: "↶ undo"
|
|
22322
22487
|
}),
|
|
22323
22488
|
/* @__PURE__ */ O("button", {
|
|
22324
22489
|
type: "button",
|
|
22325
22490
|
className: Ce,
|
|
22326
|
-
disabled: !
|
|
22327
|
-
onClick: () =>
|
|
22491
|
+
disabled: !re.canRedo,
|
|
22492
|
+
onClick: () => me(e).current?.redo(),
|
|
22328
22493
|
title: "Redo (⇧⌘Z / Ctrl+Y)",
|
|
22329
22494
|
children: "↷ redo"
|
|
22330
22495
|
}),
|
|
22496
|
+
/* @__PURE__ */ k("label", {
|
|
22497
|
+
className: "inline-flex items-center gap-1 text-xs text-zinc-500 dark:text-zinc-400",
|
|
22498
|
+
title: "How the selected wires are drawn — or every wire of the page when none is selected — and new wires too",
|
|
22499
|
+
children: ["wires", /* @__PURE__ */ k("select", {
|
|
22500
|
+
className: Ce,
|
|
22501
|
+
"aria-label": "Wire style",
|
|
22502
|
+
value: re.wireStyle ?? "orthogonal",
|
|
22503
|
+
onChange: (t) => {
|
|
22504
|
+
let n = t.target.value;
|
|
22505
|
+
n !== "mixed" && me(e).current?.setWireStyle(n);
|
|
22506
|
+
},
|
|
22507
|
+
children: [
|
|
22508
|
+
/* @__PURE__ */ O("option", {
|
|
22509
|
+
value: "straight",
|
|
22510
|
+
children: "straight"
|
|
22511
|
+
}),
|
|
22512
|
+
/* @__PURE__ */ O("option", {
|
|
22513
|
+
value: "orthogonal",
|
|
22514
|
+
children: "orthogonal"
|
|
22515
|
+
}),
|
|
22516
|
+
/* @__PURE__ */ O("option", {
|
|
22517
|
+
value: "curved",
|
|
22518
|
+
children: "curved"
|
|
22519
|
+
}),
|
|
22520
|
+
re.wireStyle === "mixed" && /* @__PURE__ */ O("option", {
|
|
22521
|
+
value: "mixed",
|
|
22522
|
+
disabled: !0,
|
|
22523
|
+
children: "mixed"
|
|
22524
|
+
})
|
|
22525
|
+
]
|
|
22526
|
+
})]
|
|
22527
|
+
}),
|
|
22331
22528
|
/* @__PURE__ */ O("button", {
|
|
22332
22529
|
type: "button",
|
|
22333
22530
|
className: Ce,
|
|
22334
|
-
onClick: () =>
|
|
22531
|
+
onClick: () => xe(),
|
|
22335
22532
|
title: "Leave touch-up (Escape); unsaved touch-ups are asked about first",
|
|
22336
22533
|
children: "done"
|
|
22337
22534
|
}),
|
|
22338
22535
|
/* @__PURE__ */ O("span", {
|
|
22339
22536
|
className: "text-xs text-zinc-400",
|
|
22340
22537
|
"data-testid": "drawio-touchup-status",
|
|
22341
|
-
children:
|
|
22538
|
+
children: re.dirty ? "● unsaved" : "touching up — drag boxes and wire ends, double-click a label"
|
|
22342
22539
|
})
|
|
22343
|
-
] }) :
|
|
22540
|
+
] }) : ge && S === null && y === null ? /* @__PURE__ */ O("button", {
|
|
22344
22541
|
type: "button",
|
|
22345
22542
|
className: Ce,
|
|
22346
|
-
disabled:
|
|
22347
|
-
onClick: () => void
|
|
22543
|
+
disabled: m === null,
|
|
22544
|
+
onClick: () => void be(e),
|
|
22348
22545
|
title: "Move boxes, re-attach wires and fix labels here; anything more in draw.io",
|
|
22349
22546
|
children: "✎ touch up"
|
|
22350
22547
|
}) : null;
|
|
22351
22548
|
}
|
|
22352
|
-
function
|
|
22549
|
+
function Ie(e) {
|
|
22353
22550
|
return /* @__PURE__ */ k(D, { children: [
|
|
22354
|
-
|
|
22551
|
+
S === e && le && /* @__PURE__ */ O("span", {
|
|
22355
22552
|
role: "alert",
|
|
22356
22553
|
"data-testid": "drawio-touchup-problem",
|
|
22357
22554
|
className: "text-red-600 dark:text-red-400",
|
|
22358
|
-
children:
|
|
22555
|
+
children: le.message
|
|
22359
22556
|
}),
|
|
22360
|
-
|
|
22557
|
+
S === e && de && /* @__PURE__ */ O("span", {
|
|
22361
22558
|
role: "status",
|
|
22362
22559
|
className: "text-amber-700 dark:text-amber-300",
|
|
22363
|
-
children:
|
|
22560
|
+
children: de
|
|
22364
22561
|
}),
|
|
22365
|
-
|
|
22562
|
+
S === null && le && /* @__PURE__ */ k("span", {
|
|
22366
22563
|
role: "alert",
|
|
22367
22564
|
className: "text-red-600 dark:text-red-400",
|
|
22368
|
-
children: ["Could not start touch-up: ",
|
|
22565
|
+
children: ["Could not start touch-up: ", le.message]
|
|
22369
22566
|
}),
|
|
22370
|
-
|
|
22567
|
+
ee && /* @__PURE__ */ k("span", {
|
|
22371
22568
|
role: "alert",
|
|
22372
22569
|
className: "text-red-600 dark:text-red-400",
|
|
22373
|
-
children: ["Could not download SVG: ",
|
|
22570
|
+
children: ["Could not download SVG: ", ee]
|
|
22374
22571
|
})
|
|
22375
22572
|
] });
|
|
22376
22573
|
}
|
|
22377
|
-
if (n === "reply" &&
|
|
22378
|
-
ref:
|
|
22574
|
+
if (n === "reply" && p.status === "failed") return /* @__PURE__ */ k("div", {
|
|
22575
|
+
ref: d,
|
|
22379
22576
|
role: "alert",
|
|
22380
22577
|
"data-testid": "drawio-block-missing",
|
|
22381
22578
|
className: "my-2 rounded-lg border border-amber-300 bg-amber-50 px-3 py-2 text-xs text-amber-900 dark:border-amber-700 dark:bg-amber-950/40 dark:text-amber-200",
|
|
@@ -22383,89 +22580,102 @@ function cE({ path: e, xml: t, variant: n, fallback: r, onTouchUpDirtyChange: i
|
|
|
22383
22580
|
"The diagram ",
|
|
22384
22581
|
/* @__PURE__ */ O("code", { children: e }),
|
|
22385
22582
|
" could not be shown: ",
|
|
22386
|
-
|
|
22583
|
+
p.message
|
|
22387
22584
|
]
|
|
22388
22585
|
});
|
|
22389
|
-
let
|
|
22586
|
+
let Le = r ?? /* @__PURE__ */ k("p", {
|
|
22390
22587
|
className: "px-3 py-2 text-xs text-zinc-500",
|
|
22391
22588
|
children: [
|
|
22392
22589
|
"The diagram ",
|
|
22393
22590
|
/* @__PURE__ */ O("code", { children: e }),
|
|
22394
22591
|
" could not be drawn."
|
|
22395
22592
|
]
|
|
22396
|
-
}),
|
|
22593
|
+
}), Re = /* @__PURE__ */ k("div", {
|
|
22397
22594
|
className: `${we} ${n === "reply" ? "order-3" : "shrink-0 px-3 py-1.5"}`,
|
|
22398
22595
|
children: [
|
|
22399
|
-
|
|
22596
|
+
S !== "inline" && /* @__PURE__ */ O("button", {
|
|
22400
22597
|
type: "button",
|
|
22401
22598
|
className: "text-xs text-zinc-500 underline hover:text-zinc-800 dark:hover:text-zinc-200 disabled:opacity-50",
|
|
22402
|
-
disabled:
|
|
22403
|
-
onClick: () =>
|
|
22599
|
+
disabled: m === null || S !== null,
|
|
22600
|
+
onClick: () => v(!0),
|
|
22404
22601
|
"aria-label": "Show diagram at full size",
|
|
22405
22602
|
children: "⤢ enlarge"
|
|
22406
22603
|
}),
|
|
22407
|
-
|
|
22408
|
-
n === "reply" &&
|
|
22604
|
+
S !== "inline" && Pe("inline"),
|
|
22605
|
+
n === "reply" && u && /* @__PURE__ */ O("button", {
|
|
22409
22606
|
type: "button",
|
|
22410
22607
|
className: "text-xs text-zinc-500 underline hover:text-zinc-800 dark:hover:text-zinc-200 disabled:opacity-50",
|
|
22411
|
-
onClick: () =>
|
|
22608
|
+
onClick: () => u(e),
|
|
22412
22609
|
title: "Open the file in the file viewer",
|
|
22413
22610
|
children: "↗ open"
|
|
22414
22611
|
}),
|
|
22415
|
-
n === "viewer" &&
|
|
22416
|
-
|
|
22612
|
+
n === "viewer" && Fe("inline"),
|
|
22613
|
+
Ie("inline")
|
|
22417
22614
|
]
|
|
22418
22615
|
});
|
|
22419
22616
|
return /* @__PURE__ */ k("div", {
|
|
22420
|
-
ref:
|
|
22617
|
+
ref: d,
|
|
22421
22618
|
"data-testid": n === "reply" ? "drawio-block-reply" : "drawio-block-viewer",
|
|
22422
22619
|
className: n === "reply" ? "my-2 flex flex-col gap-2 rounded-lg border border-zinc-200 bg-zinc-50 p-3 dark:border-zinc-800 dark:bg-zinc-900" : "flex h-full flex-col",
|
|
22423
22620
|
children: [
|
|
22424
|
-
n === "viewer" &&
|
|
22425
|
-
|
|
22621
|
+
n === "viewer" && Re,
|
|
22622
|
+
_e.problem !== null && /* @__PURE__ */ k("p", {
|
|
22623
|
+
role: "alert",
|
|
22624
|
+
"data-testid": "drawio-block-page-problem",
|
|
22625
|
+
className: "px-3 py-1.5 text-xs text-amber-800 dark:text-amber-200",
|
|
22626
|
+
children: [
|
|
22627
|
+
"The diagram ",
|
|
22628
|
+
/* @__PURE__ */ O("code", { children: e }),
|
|
22629
|
+
" ",
|
|
22630
|
+
_e.problem,
|
|
22631
|
+
"; its first page is shown."
|
|
22632
|
+
]
|
|
22633
|
+
}),
|
|
22634
|
+
m === null || !f ? /* @__PURE__ */ O("div", {
|
|
22426
22635
|
className: "h-80 animate-pulse rounded bg-zinc-100 dark:bg-zinc-800/60",
|
|
22427
22636
|
"data-testid": "drawio-block-loading",
|
|
22428
22637
|
"aria-label": `Loading ${e}`
|
|
22429
22638
|
}) : /* @__PURE__ */ O(KT, {
|
|
22430
|
-
ref:
|
|
22431
|
-
xml:
|
|
22432
|
-
serverUrl:
|
|
22639
|
+
ref: h,
|
|
22640
|
+
xml: he("inline"),
|
|
22641
|
+
serverUrl: c,
|
|
22433
22642
|
title: e,
|
|
22434
|
-
fallback:
|
|
22435
|
-
editing:
|
|
22436
|
-
onTouchUpChange:
|
|
22437
|
-
onPageLocked:
|
|
22438
|
-
onEscape:
|
|
22439
|
-
onRendered:
|
|
22440
|
-
className: n === "reply" ? "flex h-80 flex-col" : "flex min-h-[24rem] flex-1 flex-col"
|
|
22643
|
+
fallback: Le,
|
|
22644
|
+
editing: S === "inline",
|
|
22645
|
+
onTouchUpChange: ie,
|
|
22646
|
+
onPageLocked: De,
|
|
22647
|
+
onEscape: Ne,
|
|
22648
|
+
onRendered: b,
|
|
22649
|
+
className: n === "reply" ? "flex h-80 flex-col" : "flex min-h-[24rem] flex-1 flex-col",
|
|
22650
|
+
page: a === void 0 ? void 0 : _e.index
|
|
22441
22651
|
}),
|
|
22442
|
-
n === "reply" &&
|
|
22652
|
+
n === "reply" && Re,
|
|
22443
22653
|
/* @__PURE__ */ O(pe, {
|
|
22444
22654
|
label: e,
|
|
22445
22655
|
testId: "drawio-enlarged",
|
|
22446
|
-
open:
|
|
22447
|
-
onClose:
|
|
22448
|
-
anchorRef:
|
|
22656
|
+
open: _,
|
|
22657
|
+
onClose: Ee,
|
|
22658
|
+
anchorRef: d,
|
|
22449
22659
|
actions: /* @__PURE__ */ k(D, { children: [
|
|
22450
|
-
|
|
22451
|
-
|
|
22452
|
-
|
|
22660
|
+
Pe("enlarged"),
|
|
22661
|
+
Fe("enlarged"),
|
|
22662
|
+
Ie("enlarged")
|
|
22453
22663
|
] }),
|
|
22454
|
-
children:
|
|
22664
|
+
children: m !== null && /* @__PURE__ */ O("div", {
|
|
22455
22665
|
style: {
|
|
22456
22666
|
width: "90vw",
|
|
22457
22667
|
height: "75vh"
|
|
22458
22668
|
},
|
|
22459
22669
|
children: /* @__PURE__ */ O(KT, {
|
|
22460
|
-
ref:
|
|
22461
|
-
xml:
|
|
22462
|
-
serverUrl:
|
|
22670
|
+
ref: g,
|
|
22671
|
+
xml: he("enlarged"),
|
|
22672
|
+
serverUrl: c,
|
|
22463
22673
|
title: `${e}, full size`,
|
|
22464
|
-
fallback:
|
|
22465
|
-
editing:
|
|
22466
|
-
onTouchUpChange:
|
|
22467
|
-
onPageLocked:
|
|
22468
|
-
onEscape:
|
|
22674
|
+
fallback: Le,
|
|
22675
|
+
editing: S === "enlarged",
|
|
22676
|
+
onTouchUpChange: ie,
|
|
22677
|
+
onPageLocked: De,
|
|
22678
|
+
onEscape: Ne,
|
|
22469
22679
|
className: "flex h-full flex-col"
|
|
22470
22680
|
})
|
|
22471
22681
|
})
|
|
@@ -22475,28 +22685,28 @@ function cE({ path: e, xml: t, variant: n, fallback: r, onTouchUpDirtyChange: i
|
|
|
22475
22685
|
}
|
|
22476
22686
|
//#endregion
|
|
22477
22687
|
//#region ../ui/src/components/AssistantMessage.tsx
|
|
22478
|
-
function
|
|
22688
|
+
function hE(e) {
|
|
22479
22689
|
return e === "className" || Array.isArray(e) && e[0] === "className";
|
|
22480
22690
|
}
|
|
22481
|
-
function
|
|
22691
|
+
function gE(e) {
|
|
22482
22692
|
let t = {};
|
|
22483
|
-
for (let [n, r] of Object.entries(e)) t[n] = r.filter((e) => !
|
|
22693
|
+
for (let [n, r] of Object.entries(e)) t[n] = r.filter((e) => !hE(e));
|
|
22484
22694
|
return t["*"] = [...t["*"] ?? [], "className"], t;
|
|
22485
22695
|
}
|
|
22486
|
-
var
|
|
22696
|
+
var _E = {
|
|
22487
22697
|
...xT,
|
|
22488
22698
|
tagNames: [.../* @__PURE__ */ new Set([
|
|
22489
22699
|
...xT.tagNames ?? [],
|
|
22490
22700
|
"details",
|
|
22491
22701
|
"summary"
|
|
22492
22702
|
])],
|
|
22493
|
-
attributes:
|
|
22494
|
-
},
|
|
22703
|
+
attributes: gE(xT.attributes ?? {})
|
|
22704
|
+
}, vE = [
|
|
22495
22705
|
yT,
|
|
22496
|
-
[RT,
|
|
22706
|
+
[RT, _E],
|
|
22497
22707
|
Mb
|
|
22498
|
-
],
|
|
22499
|
-
function
|
|
22708
|
+
], yE = [d, m];
|
|
22709
|
+
function bE(e) {
|
|
22500
22710
|
let t = g("", e);
|
|
22501
22711
|
try {
|
|
22502
22712
|
return decodeURIComponent(t);
|
|
@@ -22504,10 +22714,10 @@ function mE(e) {
|
|
|
22504
22714
|
return t;
|
|
22505
22715
|
}
|
|
22506
22716
|
}
|
|
22507
|
-
function
|
|
22717
|
+
function xE(e) {
|
|
22508
22718
|
return typeof e == "string" && e !== "" && !y(e) && _(e.split(/[?#]/)[0]);
|
|
22509
22719
|
}
|
|
22510
|
-
function
|
|
22720
|
+
function SE({ text: e }) {
|
|
22511
22721
|
let [t, n] = E(!1);
|
|
22512
22722
|
return /* @__PURE__ */ k("div", {
|
|
22513
22723
|
className: "my-1 rounded-lg border border-zinc-200 bg-zinc-50 text-sm dark:border-zinc-800/80 dark:bg-zinc-900/40",
|
|
@@ -22528,13 +22738,13 @@ function gE({ text: e }) {
|
|
|
22528
22738
|
})]
|
|
22529
22739
|
});
|
|
22530
22740
|
}
|
|
22531
|
-
function
|
|
22741
|
+
function CE({ item: e, serverUrl: t = "", token: n = null, workspace: r, onOpenFile: i, hideReasoning: a = !1 }) {
|
|
22532
22742
|
let o = a ? e.blocks.filter((e) => e.type !== "thinking") : e.blocks, c = e.blocks.filter((e) => e.type === "text").map((e) => e.text).join("\n\n").trim(), l = T(i);
|
|
22533
22743
|
l.current = i;
|
|
22534
22744
|
let u = se(() => {
|
|
22535
22745
|
function e({ src: e, alt: i, ...a }) {
|
|
22536
|
-
if (
|
|
22537
|
-
path:
|
|
22746
|
+
if (xE(e)) return /* @__PURE__ */ O(mE, {
|
|
22747
|
+
path: bE(e),
|
|
22538
22748
|
variant: "reply"
|
|
22539
22749
|
});
|
|
22540
22750
|
let o = typeof e == "string" && e !== "" && !y(e) ? v(t, g("", e), n, void 0, r) : e;
|
|
@@ -22568,7 +22778,7 @@ function _E({ item: e, serverUrl: t = "", token: n = null, workspace: r, onOpenF
|
|
|
22568
22778
|
}
|
|
22569
22779
|
function a({ node: e, children: t, ...n }) {
|
|
22570
22780
|
let r = (e?.children ?? []).filter((e) => e.type !== "text" || (e.value ?? "").trim() !== "");
|
|
22571
|
-
return r.length > 0 && r.every((e) => e.type === "element" && e.tagName === "img" &&
|
|
22781
|
+
return r.length > 0 && r.every((e) => e.type === "element" && e.tagName === "img" && xE(e.properties?.src)) ? /* @__PURE__ */ O("div", {
|
|
22572
22782
|
className: "my-2",
|
|
22573
22783
|
children: t
|
|
22574
22784
|
}) : /* @__PURE__ */ O("p", {
|
|
@@ -22594,11 +22804,11 @@ function _E({ item: e, serverUrl: t = "", token: n = null, workspace: r, onOpenF
|
|
|
22594
22804
|
className: "flex justify-end opacity-0 transition-opacity group-hover:opacity-100",
|
|
22595
22805
|
children: /* @__PURE__ */ O(de, { text: c })
|
|
22596
22806
|
}),
|
|
22597
|
-
o.map((e, t) => e.type === "thinking" ? /* @__PURE__ */ O(
|
|
22807
|
+
o.map((e, t) => e.type === "thinking" ? /* @__PURE__ */ O(SE, { text: e.text }, e.contentIndex ?? t) : /* @__PURE__ */ O("div", {
|
|
22598
22808
|
className: "prose-chat",
|
|
22599
22809
|
children: /* @__PURE__ */ O(lh, {
|
|
22600
|
-
remarkPlugins:
|
|
22601
|
-
rehypePlugins:
|
|
22810
|
+
remarkPlugins: yE,
|
|
22811
|
+
rehypePlugins: vE,
|
|
22602
22812
|
components: u,
|
|
22603
22813
|
children: s(e.text)
|
|
22604
22814
|
})
|
|
@@ -22612,20 +22822,20 @@ function _E({ item: e, serverUrl: t = "", token: n = null, workspace: r, onOpenF
|
|
|
22612
22822
|
}
|
|
22613
22823
|
//#endregion
|
|
22614
22824
|
//#region ../shared/src/protocol.ts
|
|
22615
|
-
var
|
|
22825
|
+
var wE = [
|
|
22616
22826
|
"off",
|
|
22617
22827
|
"minimal",
|
|
22618
22828
|
"low",
|
|
22619
22829
|
"medium",
|
|
22620
22830
|
"high",
|
|
22621
22831
|
"xhigh"
|
|
22622
|
-
],
|
|
22832
|
+
], TE = "worktree", EE = class extends Error {
|
|
22623
22833
|
kind;
|
|
22624
22834
|
constructor(e, t) {
|
|
22625
22835
|
super(e), this.name = "HistoryError", this.kind = t;
|
|
22626
22836
|
}
|
|
22627
22837
|
};
|
|
22628
|
-
async function
|
|
22838
|
+
async function DE(e, t) {
|
|
22629
22839
|
let n = [];
|
|
22630
22840
|
for (;;) {
|
|
22631
22841
|
let r = await e(n.length, 50);
|
|
@@ -22633,4 +22843,4 @@ async function xE(e, t) {
|
|
|
22633
22843
|
}
|
|
22634
22844
|
}
|
|
22635
22845
|
//#endregion
|
|
22636
|
-
export {
|
|
22846
|
+
export { _f as A, dp as C, Ef as D, Mf as E, Ce as F, fe as I, de as L, Jd as M, Zl as N, xf as O, Ae as P, le as R, mp as S, cp as T, Jb as _, CE as a, lh as b, aE as c, YT as d, qT as f, yT as g, RT as h, TE as i, yf as j, bf as k, rE as l, KT as m, DE as n, _E as o, JT as p, wE as r, mE as s, EE as t, oE as u, Pb as v, fp as w, ih as x, Mb as y, ue as z };
|