253 lines
6.5 KiB
JavaScript
253 lines
6.5 KiB
JavaScript
/*
|
|
* Extracted from browser-delivered Turbopack chunk: 2a4e4dccbc3fdacb.bc4b655d5c.js
|
|
* Module id: 233038
|
|
* For reading/searching only; this factory depends on the original Turbopack runtime.
|
|
*/
|
|
|
|
const moduleFactory = (e) => {
|
|
"use strict";
|
|
var t = e.i(713118),
|
|
n = e.i(182004);
|
|
function r(e) {
|
|
return e === n.NodeType.GROUP || e === n.NodeType.VIDEO_GROUP;
|
|
}
|
|
function i(e, t) {
|
|
let n = new Map(t.map((e) => [e.id, e])),
|
|
r = Array.from(e.keys()),
|
|
i = new Set(r);
|
|
for (let t of r) {
|
|
let r = e.get(t),
|
|
o = n.get(t);
|
|
if (r && o && !(o.parentId && i.has(o.parentId)))
|
|
return { x: o.position.x - r.x, y: o.position.y - r.y };
|
|
}
|
|
return { x: 0, y: 0 };
|
|
}
|
|
function o(e, t) {
|
|
let n = c(t, e),
|
|
r = new Map(t.map((e) => [e.id, e])),
|
|
i = new Map();
|
|
for (let e of n) {
|
|
let t = r.get(e);
|
|
t && i.set(e, { ...t.position });
|
|
}
|
|
return i;
|
|
}
|
|
function s(e) {
|
|
let t =
|
|
e instanceof HTMLElement
|
|
? e
|
|
: e instanceof Node
|
|
? e.parentElement
|
|
: null;
|
|
if (
|
|
t &&
|
|
("INPUT" === t.tagName ||
|
|
"TEXTAREA" === t.tagName ||
|
|
t.closest('[contenteditable="true"]'))
|
|
)
|
|
return !0;
|
|
let n = document.activeElement;
|
|
return (
|
|
!!(
|
|
n instanceof HTMLElement &&
|
|
("INPUT" === n.tagName ||
|
|
"TEXTAREA" === n.tagName ||
|
|
n.closest('[contenteditable="true"]'))
|
|
) || !1
|
|
);
|
|
}
|
|
function l(e) {
|
|
return (
|
|
"object" == typeof e &&
|
|
null !== e &&
|
|
(!!e.altKey ||
|
|
("function" == typeof e.getModifierState &&
|
|
e.getModifierState("Alt")))
|
|
);
|
|
}
|
|
function a(e) {
|
|
return (
|
|
"object" == typeof e &&
|
|
null !== e &&
|
|
(!!e.metaKey ||
|
|
!!e.ctrlKey ||
|
|
("function" == typeof e.getModifierState &&
|
|
(e.getModifierState("Meta") || e.getModifierState("Control"))))
|
|
);
|
|
}
|
|
function d(e, t) {
|
|
let n = new Set(e),
|
|
i = new Set(t.filter((e) => n.has(e.id) && r(e.type)).map((e) => e.id));
|
|
for (let e of t) e.parentId && i.has(e.parentId) && n.add(e.id);
|
|
return Array.from(n);
|
|
}
|
|
function c(e, t) {
|
|
let n = new Set(t),
|
|
i = !0;
|
|
for (; i; )
|
|
for (let t of ((i = !1), [...n])) {
|
|
let o = e.find((e) => e.id === t);
|
|
if (!o?.parentId) continue;
|
|
let s = e.find((e) => e.id === o.parentId);
|
|
if (s && r(s.type) && !n.has(s.id)) {
|
|
for (let t of (n.add(s.id), e))
|
|
t.parentId === s.id && (n.has(t.id) || (i = !0), n.add(t.id));
|
|
i = !0;
|
|
}
|
|
}
|
|
for (let t of e.filter((e) => n.has(e.id) && r(e.type)).map((e) => e.id))
|
|
e.forEach((e) => {
|
|
e.parentId === t && n.add(e.id);
|
|
});
|
|
return n;
|
|
}
|
|
function h(e, t) {
|
|
if (!e.parentId) return { ...e.position };
|
|
let n = t.find((t) => t.id === e.parentId);
|
|
if (!n) return { ...e.position };
|
|
let r = h(n, t);
|
|
return { x: r.x + e.position.x, y: r.y + e.position.y };
|
|
}
|
|
function p(e) {
|
|
return {
|
|
width:
|
|
e.measured?.width ??
|
|
("number" == typeof e.width ? e.width : void 0) ??
|
|
t.NODE_WIDTH,
|
|
height:
|
|
e.measured?.height ??
|
|
("number" == typeof e.height ? e.height : void 0) ??
|
|
t.NODE_HEIGHT_EMPTY,
|
|
};
|
|
}
|
|
function u(e, t) {
|
|
let { width: n, height: i } = p(e),
|
|
o = e.position.x,
|
|
s = e.position.y,
|
|
l = o + n,
|
|
a = s + i;
|
|
if (r(e.type))
|
|
for (let n of t) {
|
|
if (n.parentId !== e.id) continue;
|
|
let r = h(n, t),
|
|
{ width: i, height: d } = p(n);
|
|
(o = Math.min(o, r.x)),
|
|
(s = Math.min(s, r.y)),
|
|
(l = Math.max(l, r.x + i)),
|
|
(a = Math.max(a, r.y + d));
|
|
}
|
|
return { left: o, right: l, top: s, bottom: a };
|
|
}
|
|
function f(e, t) {
|
|
let n = h(e, t),
|
|
{ width: i, height: o } = p(e),
|
|
s = n.x,
|
|
l = n.y,
|
|
a = n.x + i,
|
|
d = n.y + o;
|
|
if (r(e.type))
|
|
for (let n of t) {
|
|
if (n.parentId !== e.id) continue;
|
|
let r = h(n, t),
|
|
{ width: i, height: o } = p(n);
|
|
(s = Math.min(s, r.x)),
|
|
(l = Math.min(l, r.y)),
|
|
(a = Math.max(a, r.x + i)),
|
|
(d = Math.max(d, r.y + o));
|
|
}
|
|
return { left: s, right: a, top: l, bottom: d };
|
|
}
|
|
function m(e) {
|
|
let { width: t, height: n } = p(e);
|
|
return {
|
|
left: e.position.x,
|
|
top: e.position.y,
|
|
right: e.position.x + t,
|
|
bottom: e.position.y + n,
|
|
width: t,
|
|
height: n,
|
|
};
|
|
}
|
|
function g(e, t = 20) {
|
|
if (0 === e.length) return null;
|
|
let n = 1 / 0,
|
|
r = 1 / 0,
|
|
i = -1 / 0,
|
|
o = -1 / 0;
|
|
return (
|
|
e.forEach((e) => {
|
|
let t = m(e);
|
|
(n = Math.min(n, t.left)),
|
|
(r = Math.min(r, t.top)),
|
|
(i = Math.max(i, t.right)),
|
|
(o = Math.max(o, t.bottom));
|
|
}),
|
|
{ x: n - t, y: r - t, width: i - n + 2 * t, height: o - r + 2 * t }
|
|
);
|
|
}
|
|
function y(e, t = 20) {
|
|
return (t * (Math.sqrt(e) - e)) / e;
|
|
}
|
|
function b(e, t) {
|
|
let n = y(t);
|
|
return {
|
|
x: e.x - n,
|
|
y: e.y - n,
|
|
width: e.width + 2 * n,
|
|
height: e.height + 2 * n,
|
|
};
|
|
}
|
|
e.s([
|
|
"GROUP_LAYOUT_GAP",
|
|
0,
|
|
36,
|
|
"GROUP_LAYOUT_PADDING",
|
|
0,
|
|
36,
|
|
"GROUP_LAYOUT_TOP_PADDING",
|
|
0,
|
|
66,
|
|
"GROUP_MIN_PADDING",
|
|
0,
|
|
12,
|
|
"GROUP_PADDING",
|
|
0,
|
|
20,
|
|
"buildAltMultiStartPositionMap",
|
|
() => o,
|
|
"calculateBoundingBox",
|
|
() => g,
|
|
"compensateBounds",
|
|
() => b,
|
|
"computeMultiAltDragDeltaFlow",
|
|
() => i,
|
|
"expandNodeIdsForGroupCopy",
|
|
() => c,
|
|
"expandNodeIdsWithGroupChildren",
|
|
() => d,
|
|
"getAbsolutePosition",
|
|
() => h,
|
|
"getFlowBoundsForChatAtViewportHit",
|
|
() => f,
|
|
"getFlowBoundsUnionForBoxSelection",
|
|
() => u,
|
|
"getNodeBounds",
|
|
() => m,
|
|
"getNodeFlowSize",
|
|
() => p,
|
|
"getZoomPaddingCompensation",
|
|
() => y,
|
|
"isAltOrOptionActive",
|
|
() => l,
|
|
"isCanvasGroupLikeNodeType",
|
|
() => r,
|
|
"isInputElement",
|
|
() => s,
|
|
"isMetaOrCtrlActive",
|
|
() => a,
|
|
]);
|
|
};
|
|
|
|
export default moduleFactory;
|