SourceTermAnalysisSystem_vue/node_modules/.vite/deps/chunk-JJ4XOBWH.js
2026-05-15 10:22:44 +08:00

10584 lines
322 KiB
JavaScript
Raw Blame History

This file contains invisible Unicode characters

This file contains invisible Unicode characters that are indistinguishable to humans but may be processed differently by a computer. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

import {
camelCase_default,
clamp_default,
cloneDeep_default,
clone_default,
debounce_default,
defaultsDeep_default,
defaults_default,
difference_default,
groupBy_default,
has_default,
init_lodash,
isEmpty_default,
isEqual_default,
isNumber_default,
isObject_default,
isPlainObject_default,
lowerCase_default,
lowerFirst_default,
max_default,
merge_default,
pick_default,
sortBy_default,
sortedIndexBy_default,
sortedIndex_default,
startCase_default,
throttle_default,
union_default,
uniq_default,
uniqueId_default,
upperCase_default,
upperFirst_default
} from "./chunk-EYP3PCDD.js";
import {
__esm,
__export
} from "./chunk-LK32TJAX.js";
// node_modules/@antv/x6-common/es/common/disposable.js
var Disposable, DisposableDelegate, DisposableSet;
var init_disposable = __esm({
"node_modules/@antv/x6-common/es/common/disposable.js"() {
Disposable = class {
get disposed() {
return this._disposed === true;
}
dispose() {
this._disposed = true;
}
};
(function(Disposable2) {
function dispose() {
return (target, methodName, descriptor) => {
const raw = descriptor.value;
const proto = target.__proto__;
descriptor.value = function(...args) {
if (this.disposed) {
return;
}
raw.call(this, ...args);
proto.dispose.call(this);
};
};
}
Disposable2.dispose = dispose;
})(Disposable || (Disposable = {}));
DisposableDelegate = class {
/**
* Construct a new disposable delegate.
*
* @param callback - The callback function to invoke on dispose.
*/
constructor(callback) {
this.callback = callback;
}
/**
* Test whether the delegate has been disposed.
*/
get disposed() {
return !this.callback;
}
/**
* Dispose of the delegate and invoke the callback function.
*/
dispose() {
if (!this.callback) {
return;
}
const callback = this.callback;
this.callback = null;
callback();
}
};
DisposableSet = class {
constructor() {
this.isDisposed = false;
this.items = /* @__PURE__ */ new Set();
}
/**
* Test whether the set has been disposed.
*/
get disposed() {
return this.isDisposed;
}
/**
* Dispose of the set and the items it contains.
*
* #### Notes
* Items are disposed in the order they are added to the set.
*/
dispose() {
if (this.isDisposed) {
return;
}
this.isDisposed = true;
this.items.forEach((item) => {
item.dispose();
});
this.items.clear();
}
/**
* Test whether the set contains a specific item.
*
* @param item - The item of interest.
*
* @returns `true` if the set contains the item, `false` otherwise.
*/
contains(item) {
return this.items.has(item);
}
/**
* Add a disposable item to the set.
*
* @param item - The item to add to the set.
*
* #### Notes
* If the item is already contained in the set, this is a no-op.
*/
add(item) {
this.items.add(item);
}
/**
* Remove a disposable item from the set.
*
* @param item - The item to remove from the set.
*
* #### Notes
* If the item is not contained in the set, this is a no-op.
*/
remove(item) {
this.items.delete(item);
}
/**
* Remove all items from the set.
*/
clear() {
this.items.clear();
}
};
(function(DisposableSet2) {
function from(items) {
const set = new DisposableSet2();
items.forEach((item) => {
set.add(item);
});
return set;
}
DisposableSet2.from = from;
})(DisposableSet || (DisposableSet = {}));
}
});
// node_modules/@antv/x6-common/es/function/function.js
function apply(fn, ctx, args) {
if (args) {
switch (args.length) {
case 0:
return fn.call(ctx);
case 1:
return fn.call(ctx, args[0]);
case 2:
return fn.call(ctx, args[0], args[1]);
case 3:
return fn.call(ctx, args[0], args[1], args[2]);
case 4:
return fn.call(ctx, args[0], args[1], args[2], args[3]);
case 5:
return fn.call(ctx, args[0], args[1], args[2], args[3], args[4]);
case 6:
return fn.call(ctx, args[0], args[1], args[2], args[3], args[4], args[5]);
default:
return fn.apply(ctx, args);
}
}
return fn.call(ctx);
}
function call(fn, ctx, ...args) {
return apply(fn, ctx, args);
}
var init_function = __esm({
"node_modules/@antv/x6-common/es/function/function.js"() {
init_lodash();
}
});
// node_modules/@antv/x6-common/es/function/async.js
function isAsyncLike(obj) {
return typeof obj === "object" && obj.then && typeof obj.then === "function";
}
function isAsync(obj) {
return obj != null && (obj instanceof Promise || isAsyncLike(obj));
}
function toAsyncBoolean(...inputs) {
const results = [];
inputs.forEach((arg) => {
if (Array.isArray(arg)) {
results.push(...arg);
} else {
results.push(arg);
}
});
const hasAsync = results.some((res) => isAsync(res));
if (hasAsync) {
const deferres = results.map((res) => isAsync(res) ? res : Promise.resolve(res !== false));
return Promise.all(deferres).then((arr) => arr.reduce((memo, item) => item !== false && memo, true));
}
return results.every((res) => res !== false);
}
function toDeferredBoolean(...inputs) {
const ret = toAsyncBoolean(inputs);
return typeof ret === "boolean" ? Promise.resolve(ret) : ret;
}
var init_async = __esm({
"node_modules/@antv/x6-common/es/function/async.js"() {
}
});
// node_modules/@antv/x6-common/es/function/main.js
var main_exports = {};
__export(main_exports, {
apply: () => apply,
call: () => call,
debounce: () => debounce_default,
isAsync: () => isAsync,
isAsyncLike: () => isAsyncLike,
throttle: () => throttle_default,
toAsyncBoolean: () => toAsyncBoolean,
toDeferredBoolean: () => toDeferredBoolean
});
var init_main = __esm({
"node_modules/@antv/x6-common/es/function/main.js"() {
init_function();
init_async();
}
});
// node_modules/@antv/x6-common/es/function/index.js
var init_function2 = __esm({
"node_modules/@antv/x6-common/es/function/index.js"() {
init_main();
}
});
// node_modules/@antv/x6-common/es/event/util.js
function call2(list, args) {
const results = [];
for (let i = 0; i < list.length; i += 2) {
const handler = list[i];
const context = list[i + 1];
const params = Array.isArray(args) ? args : [args];
const ret = main_exports.apply(handler, context, params);
results.push(ret);
}
return main_exports.toAsyncBoolean(results);
}
var init_util = __esm({
"node_modules/@antv/x6-common/es/event/util.js"() {
init_function2();
}
});
// node_modules/@antv/x6-common/es/event/events.js
var Events;
var init_events = __esm({
"node_modules/@antv/x6-common/es/event/events.js"() {
init_util();
init_function2();
Events = class {
constructor() {
this.listeners = {};
}
on(name, handler, context) {
if (handler == null) {
return this;
}
if (!this.listeners[name]) {
this.listeners[name] = [];
}
const cache = this.listeners[name];
cache.push(handler, context);
return this;
}
once(name, handler, context) {
const cb = (...args) => {
this.off(name, cb);
return call2([handler, context], args);
};
return this.on(name, cb, this);
}
off(name, handler, context) {
if (!(name || handler || context)) {
this.listeners = {};
return this;
}
const listeners = this.listeners;
const names = name ? [name] : Object.keys(listeners);
names.forEach((n) => {
const cache = listeners[n];
if (!cache) {
return;
}
if (!(handler || context)) {
delete listeners[n];
return;
}
for (let i = cache.length - 2; i >= 0; i -= 2) {
if (!(handler && cache[i] !== handler || context && cache[i + 1] !== context)) {
cache.splice(i, 2);
}
}
});
return this;
}
trigger(name, ...args) {
let returned = true;
if (name !== "*") {
const list2 = this.listeners[name];
if (list2 != null) {
returned = call2([...list2], args);
}
}
const list = this.listeners["*"];
if (list != null) {
return main_exports.toAsyncBoolean([
returned,
call2([...list], [name, ...args])
]);
}
return returned;
}
emit(name, ...args) {
return this.trigger(name, ...args);
}
};
}
});
// node_modules/@antv/x6-common/es/object/mixins.js
function applyMixins(derivedCtor, ...baseCtors) {
baseCtors.forEach((baseCtor) => {
Object.getOwnPropertyNames(baseCtor.prototype).forEach((name) => {
if (name !== "constructor") {
Object.defineProperty(derivedCtor.prototype, name, Object.getOwnPropertyDescriptor(baseCtor.prototype, name));
}
});
});
}
var init_mixins = __esm({
"node_modules/@antv/x6-common/es/object/mixins.js"() {
}
});
// node_modules/@antv/x6-common/es/object/inherit.js
function inherit(cls, base) {
extendStatics(cls, base);
function tmp() {
this.constructor = cls;
}
cls.prototype = base === null ? Object.create(base) : (tmp.prototype = base.prototype, new tmp());
}
function createClass(className, base) {
let cls;
if (isNativeClass) {
cls = class extends base {
};
} else {
cls = function() {
return base.apply(this, arguments);
};
inherit(cls, base);
}
Object.defineProperty(cls, "name", { value: className });
return cls;
}
var extendStatics, A, isNativeClass;
var init_inherit = __esm({
"node_modules/@antv/x6-common/es/object/inherit.js"() {
extendStatics = Object.setPrototypeOf || { __proto__: [] } instanceof Array && function(d, b) {
d.__proto__ = b;
} || function(d, b) {
for (const p in b) {
if (Object.prototype.hasOwnProperty.call(b, p)) {
d[p] = b[p];
}
}
};
A = class {
};
isNativeClass = /^\s*class\s+/.test(`${A}`) || /^\s*class\s*\{/.test(`${class {
}}`);
}
});
// node_modules/@antv/x6-common/es/object/object.js
var object_exports = {};
__export(object_exports, {
applyMixins: () => applyMixins,
clone: () => clone_default,
cloneDeep: () => cloneDeep_default,
createClass: () => createClass,
defaults: () => defaults_default,
defaultsDeep: () => defaultsDeep_default,
ensure: () => ensure,
flatten: () => flatten,
getBoolean: () => getBoolean,
getByPath: () => getByPath,
getNumber: () => getNumber,
getValue: () => getValue,
has: () => has_default,
inherit: () => inherit,
isEmpty: () => isEmpty_default,
isEqual: () => isEqual_default,
isMaliciousProp: () => isMaliciousProp,
isObject: () => isObject_default,
isPlainObject: () => isPlainObject_default,
merge: () => merge_default,
pick: () => pick_default,
setByPath: () => setByPath,
unsetByPath: () => unsetByPath
});
function ensure(value, defaultValue) {
return value != null ? value : defaultValue;
}
function getValue(obj, key, defaultValue) {
const value = obj != null ? obj[key] : null;
return defaultValue !== void 0 ? ensure(value, defaultValue) : value;
}
function getNumber(obj, key, defaultValue) {
let value = obj != null ? obj[key] : null;
if (value == null) {
return defaultValue;
}
value = +value;
if (Number.isNaN(value) || !Number.isFinite(value)) {
return defaultValue;
}
return value;
}
function getBoolean(obj, key, defaultValue) {
const value = obj != null ? obj[key] : null;
if (value == null) {
return defaultValue;
}
return !!value;
}
function isMaliciousProp(prop2) {
return prop2 === "__proto__";
}
function getByPath(obj, path, delimiter = "/") {
let ret;
const keys = Array.isArray(path) ? path : path.split(delimiter);
if (keys.length) {
ret = obj;
while (keys.length) {
const key = keys.shift();
if (Object(ret) === ret && key && key in ret) {
ret = ret[key];
} else {
return void 0;
}
}
}
return ret;
}
function setByPath(obj, path, value, delimiter = "/") {
const keys = Array.isArray(path) ? path : path.split(delimiter);
const lastKey = keys.pop();
if (lastKey && !isMaliciousProp(lastKey)) {
let diver = obj;
keys.forEach((key) => {
if (!isMaliciousProp(key)) {
if (diver[key] == null) {
diver[key] = {};
}
diver = diver[key];
}
});
diver[lastKey] = value;
}
return obj;
}
function unsetByPath(obj, path, delimiter = "/") {
const keys = Array.isArray(path) ? path.slice() : path.split(delimiter);
const propertyToRemove = keys.pop();
if (propertyToRemove) {
if (keys.length > 0) {
const parent = getByPath(obj, keys);
if (parent) {
delete parent[propertyToRemove];
}
} else {
delete obj[propertyToRemove];
}
}
return obj;
}
function flatten(obj, delim = "/", stop) {
const ret = {};
Object.keys(obj).forEach((key) => {
const val = obj[key];
let deep = typeof val === "object" || Array.isArray(val);
if (deep && stop && stop(val)) {
deep = false;
}
if (deep) {
const flatObject = flatten(val, delim, stop);
Object.keys(flatObject).forEach((flatKey) => {
ret[key + delim + flatKey] = flatObject[flatKey];
});
} else {
ret[key] = val;
}
});
for (const key in obj) {
if (!Object.prototype.hasOwnProperty.call(obj, key)) {
continue;
}
}
return ret;
}
var init_object = __esm({
"node_modules/@antv/x6-common/es/object/object.js"() {
init_lodash();
init_mixins();
init_inherit();
}
});
// node_modules/@antv/x6-common/es/object/index.js
var init_object2 = __esm({
"node_modules/@antv/x6-common/es/object/index.js"() {
init_object();
}
});
// node_modules/@antv/x6-common/es/event/index.js
var init_event = __esm({
"node_modules/@antv/x6-common/es/event/index.js"() {
init_events();
}
});
// node_modules/@antv/x6-common/es/common/basecoat.js
var __decorate, Basecoat;
var init_basecoat = __esm({
"node_modules/@antv/x6-common/es/common/basecoat.js"() {
init_event();
init_object2();
init_disposable();
__decorate = function(decorators, target, key, desc) {
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
return c > 3 && r && Object.defineProperty(target, key, r), r;
};
Basecoat = class extends Events {
dispose() {
this.off();
}
};
__decorate([
Disposable.dispose()
], Basecoat.prototype, "dispose", null);
(function(Basecoat2) {
Basecoat2.dispose = Disposable.dispose;
})(Basecoat || (Basecoat = {}));
object_exports.applyMixins(Basecoat, Disposable);
}
});
// node_modules/@antv/x6-common/es/common/disablable.js
var Disablable;
var init_disablable = __esm({
"node_modules/@antv/x6-common/es/common/disablable.js"() {
init_basecoat();
Disablable = class extends Basecoat {
get disabled() {
return this._disabled === true;
}
enable() {
delete this._disabled;
}
disable() {
this._disabled = true;
}
};
}
});
// node_modules/@antv/x6-common/es/array/array.js
var array_exports = {};
__export(array_exports, {
difference: () => difference_default,
groupBy: () => groupBy_default,
max: () => max_default,
sortBy: () => sortBy_default,
sortedIndex: () => sortedIndex_default,
sortedIndexBy: () => sortedIndexBy_default,
union: () => union_default,
uniq: () => uniq_default
});
var init_array = __esm({
"node_modules/@antv/x6-common/es/array/array.js"() {
init_lodash();
}
});
// node_modules/@antv/x6-common/es/array/index.js
var init_array2 = __esm({
"node_modules/@antv/x6-common/es/array/index.js"() {
init_array();
}
});
// node_modules/@antv/x6-common/es/string/format.js
var cacheStringFunction, kebabCase, pascalCase, constantCase, dotCase, pathCase, sentenceCase, titleCase;
var init_format = __esm({
"node_modules/@antv/x6-common/es/string/format.js"() {
init_lodash();
init_lodash();
cacheStringFunction = (fn) => {
const cache = /* @__PURE__ */ Object.create(null);
return ((str) => {
const hit = cache[str];
return hit || (cache[str] = fn(str));
});
};
kebabCase = cacheStringFunction((s) => s.replace(/\B([A-Z])/g, "-$1").toLowerCase());
pascalCase = cacheStringFunction((s) => startCase_default(camelCase_default(s)).replace(/ /g, ""));
constantCase = cacheStringFunction((s) => upperCase_default(s).replace(/ /g, "_"));
dotCase = cacheStringFunction((s) => lowerCase_default(s).replace(/ /g, "."));
pathCase = cacheStringFunction((s) => lowerCase_default(s).replace(/ /g, "/"));
sentenceCase = cacheStringFunction((s) => upperFirst_default(lowerCase_default(s)));
titleCase = cacheStringFunction((s) => startCase_default(camelCase_default(s)));
}
});
// node_modules/@antv/x6-common/es/string/hashcode.js
function hashcode(str) {
let hash = 2166136261;
let isUnicoded = false;
let string = str;
for (let i = 0, ii = string.length; i < ii; i += 1) {
let characterCode = string.charCodeAt(i);
if (characterCode > 127 && !isUnicoded) {
string = unescape(encodeURIComponent(string));
characterCode = string.charCodeAt(i);
isUnicoded = true;
}
hash ^= characterCode;
hash += (hash << 1) + (hash << 4) + (hash << 7) + (hash << 8) + (hash << 24);
}
return hash >>> 0;
}
var init_hashcode = __esm({
"node_modules/@antv/x6-common/es/string/hashcode.js"() {
}
});
// node_modules/@antv/x6-common/es/string/uuid.js
function uuid() {
let res = "";
const template = "xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx";
for (let i = 0, len = template.length; i < len; i += 1) {
const s = template[i];
const r = Math.random() * 16 | 0;
const v = s === "x" ? r : s === "y" ? r & 3 | 8 : s;
res += v.toString(16);
}
return res;
}
var init_uuid = __esm({
"node_modules/@antv/x6-common/es/string/uuid.js"() {
}
});
// node_modules/@antv/x6-common/es/string/suggestion.js
function getSpellingSuggestion(name, candidates, getName) {
const maximumLengthDifference = Math.min(2, Math.floor(name.length * 0.34));
let bestDistance = Math.floor(name.length * 0.4) + 1;
let bestCandidate;
let justCheckExactMatches = false;
const nameLowerCase = name.toLowerCase();
for (const candidate of candidates) {
const candidateName = getName(candidate);
if (candidateName !== void 0 && Math.abs(candidateName.length - nameLowerCase.length) <= maximumLengthDifference) {
const candidateNameLowerCase = candidateName.toLowerCase();
if (candidateNameLowerCase === nameLowerCase) {
if (candidateName === name) {
continue;
}
return candidate;
}
if (justCheckExactMatches) {
continue;
}
if (candidateName.length < 3) {
continue;
}
const distance = levenshteinWithMax(nameLowerCase, candidateNameLowerCase, bestDistance - 1);
if (distance === void 0) {
continue;
}
if (distance < 3) {
justCheckExactMatches = true;
bestCandidate = candidate;
} else {
bestDistance = distance;
bestCandidate = candidate;
}
}
}
return bestCandidate;
}
function levenshteinWithMax(s1, s2, max) {
let previous = new Array(s2.length + 1);
let current = new Array(s2.length + 1);
const big = max + 1;
for (let i = 0; i <= s2.length; i += 1) {
previous[i] = i;
}
for (let i = 1; i <= s1.length; i += 1) {
const c1 = s1.charCodeAt(i - 1);
const minJ = i > max ? i - max : 1;
const maxJ = s2.length > max + i ? max + i : s2.length;
current[0] = i;
let colMin = i;
for (let j = 1; j < minJ; j += 1) {
current[j] = big;
}
for (let j = minJ; j <= maxJ; j += 1) {
const dist = c1 === s2.charCodeAt(j - 1) ? previous[j - 1] : Math.min(
/* delete */
previous[j] + 1,
/* insert */
current[j - 1] + 1,
/* substitute */
previous[j - 1] + 2
);
current[j] = dist;
colMin = Math.min(colMin, dist);
}
for (let j = maxJ + 1; j <= s2.length; j += 1) {
current[j] = big;
}
if (colMin > max) {
return void 0;
}
const temp = previous;
previous = current;
current = temp;
}
const res = previous[s2.length];
return res > max ? void 0 : res;
}
var init_suggestion = __esm({
"node_modules/@antv/x6-common/es/string/suggestion.js"() {
}
});
// node_modules/@antv/x6-common/es/string/string.js
var string_exports = {};
__export(string_exports, {
camelCase: () => camelCase_default,
constantCase: () => constantCase,
dotCase: () => dotCase,
getSpellingSuggestion: () => getSpellingSuggestion,
hashcode: () => hashcode,
kebabCase: () => kebabCase,
lowerFirst: () => lowerFirst_default,
pascalCase: () => pascalCase,
pathCase: () => pathCase,
sentenceCase: () => sentenceCase,
titleCase: () => titleCase,
uniqueId: () => uniqueId_default,
upperFirst: () => upperFirst_default,
uuid: () => uuid
});
var init_string = __esm({
"node_modules/@antv/x6-common/es/string/string.js"() {
init_lodash();
init_format();
init_hashcode();
init_uuid();
init_suggestion();
}
});
// node_modules/@antv/x6-common/es/string/index.js
var init_string2 = __esm({
"node_modules/@antv/x6-common/es/string/index.js"() {
init_string();
}
});
// node_modules/@antv/x6-common/es/number/number.js
var number_exports = {};
__export(number_exports, {
clamp: () => clamp_default,
isNumber: () => isNumber_default,
isPercentage: () => isPercentage,
mod: () => mod,
normalizePercentage: () => normalizePercentage,
normalizeSides: () => normalizeSides,
parseCssNumeric: () => parseCssNumeric,
random: () => random
});
function mod(n, m) {
return (n % m + m) % m;
}
function random(lower, upper) {
if (upper == null) {
upper = lower == null ? 1 : lower;
lower = 0;
} else if (upper < lower) {
const tmp = lower;
lower = upper;
upper = tmp;
}
return Math.floor(Math.random() * (upper - lower + 1) + lower);
}
function isPercentage(val) {
return typeof val === "string" && val.slice(-1) === "%";
}
function normalizePercentage(num, ref) {
if (num == null) {
return 0;
}
let raw;
if (typeof num === "string") {
raw = parseFloat(num);
if (isPercentage(num)) {
raw /= 100;
if (Number.isFinite(raw)) {
return raw * ref;
}
}
} else {
raw = num;
}
if (!Number.isFinite(raw)) {
return 0;
}
if (raw > 0 && raw < 1) {
return raw * ref;
}
return raw;
}
function parseCssNumeric(val, units) {
function getUnit(regexp2) {
const matches = new RegExp(`(?:\\d+(?:\\.\\d+)*)(${regexp2})$`).exec(val);
if (!matches) {
return null;
}
return matches[1];
}
const number = parseFloat(val);
if (Number.isNaN(number)) {
return null;
}
let regexp;
if (units == null) {
regexp = "[A-Za-z]*";
} else if (Array.isArray(units)) {
if (units.length === 0) {
return null;
}
regexp = units.join("|");
} else if (typeof units === "string") {
regexp = units;
}
const unit = getUnit(regexp);
if (unit === null) {
return null;
}
return {
unit,
value: number
};
}
function normalizeSides(box) {
if (typeof box === "object") {
let left = 0;
let top = 0;
let right = 0;
let bottom = 0;
if (box.vertical != null && Number.isFinite(box.vertical)) {
top = bottom = box.vertical;
}
if (box.horizontal != null && Number.isFinite(box.horizontal)) {
right = left = box.horizontal;
}
if (box.left != null && Number.isFinite(box.left))
left = box.left;
if (box.top != null && Number.isFinite(box.top))
top = box.top;
if (box.right != null && Number.isFinite(box.right))
right = box.right;
if (box.bottom != null && Number.isFinite(box.bottom))
bottom = box.bottom;
return { top, right, bottom, left };
}
let val = 0;
if (box != null && Number.isFinite(box)) {
val = box;
}
return { top: val, right: val, bottom: val, left: val };
}
var init_number = __esm({
"node_modules/@antv/x6-common/es/number/number.js"() {
init_lodash();
}
});
// node_modules/@antv/x6-common/es/number/index.js
var init_number2 = __esm({
"node_modules/@antv/x6-common/es/number/index.js"() {
init_number();
}
});
// node_modules/@antv/x6-common/es/platform/index.js
var _IS_MAC, _IS_IOS, _IS_WINDOWS, _IS_IE, _IS_IE11, _IS_EDGE, _IS_NETSCAPE, _IS_CHROME_APP, _IS_CHROME, _IS_OPERA, _IS_FIREFOX, _IS_SAFARI, _SUPPORT_TOUCH, _SUPPORT_POINTER, _SUPPORT_PASSIVE, _NO_FOREIGNOBJECT, Platform;
var init_platform = __esm({
"node_modules/@antv/x6-common/es/platform/index.js"() {
_IS_MAC = false;
_IS_IOS = false;
_IS_WINDOWS = false;
_IS_IE = false;
_IS_IE11 = false;
_IS_EDGE = false;
_IS_NETSCAPE = false;
_IS_CHROME_APP = false;
_IS_CHROME = false;
_IS_OPERA = false;
_IS_FIREFOX = false;
_IS_SAFARI = false;
_SUPPORT_TOUCH = false;
_SUPPORT_POINTER = false;
_SUPPORT_PASSIVE = false;
_NO_FOREIGNOBJECT = false;
if (typeof navigator === "object") {
const ua = navigator.userAgent;
_IS_MAC = ua.indexOf("Macintosh") >= 0;
_IS_IOS = !!ua.match(/(iPad|iPhone|iPod)/g);
_IS_WINDOWS = ua.indexOf("Windows") >= 0;
_IS_IE = ua.indexOf("MSIE") >= 0;
_IS_IE11 = !!ua.match(/Trident\/7\./);
_IS_EDGE = !!ua.match(/Edge\//);
_IS_NETSCAPE = ua.indexOf("Mozilla/") >= 0 && ua.indexOf("MSIE") < 0 && ua.indexOf("Edge/") < 0;
_IS_CHROME = ua.indexOf("Chrome/") >= 0 && ua.indexOf("Edge/") < 0;
_IS_OPERA = ua.indexOf("Opera/") >= 0 || ua.indexOf("OPR/") >= 0;
_IS_FIREFOX = ua.indexOf("Firefox/") >= 0;
_IS_SAFARI = ua.indexOf("AppleWebKit/") >= 0 && ua.indexOf("Chrome/") < 0 && ua.indexOf("Edge/") < 0;
if (typeof document === "object") {
_NO_FOREIGNOBJECT = !document.createElementNS || `${document.createElementNS("http://www.w3.org/2000/svg", "foreignObject")}` !== "[object SVGForeignObjectElement]" || ua.indexOf("Opera/") >= 0;
}
}
if (typeof window === "object") {
_IS_CHROME_APP = window.chrome != null && window.chrome.app != null && window.chrome.app.runtime != null;
_SUPPORT_POINTER = window.PointerEvent != null && !_IS_MAC;
}
if (typeof document === "object") {
_SUPPORT_TOUCH = "ontouchstart" in document.documentElement;
try {
const options = Object.defineProperty({}, "passive", {
get() {
_SUPPORT_PASSIVE = true;
}
});
const div = document.createElement("div");
if (div.addEventListener) {
div.addEventListener("click", () => {
}, options);
}
} catch (err) {
}
}
(function(Platform2) {
Platform2.IS_MAC = _IS_MAC;
Platform2.IS_IOS = _IS_IOS;
Platform2.IS_WINDOWS = _IS_WINDOWS;
Platform2.IS_IE = _IS_IE;
Platform2.IS_IE11 = _IS_IE11;
Platform2.IS_EDGE = _IS_EDGE;
Platform2.IS_NETSCAPE = _IS_NETSCAPE;
Platform2.IS_CHROME_APP = _IS_CHROME_APP;
Platform2.IS_CHROME = _IS_CHROME;
Platform2.IS_OPERA = _IS_OPERA;
Platform2.IS_FIREFOX = _IS_FIREFOX;
Platform2.IS_SAFARI = _IS_SAFARI;
Platform2.SUPPORT_TOUCH = _SUPPORT_TOUCH;
Platform2.SUPPORT_POINTER = _SUPPORT_POINTER;
Platform2.SUPPORT_PASSIVE = _SUPPORT_PASSIVE;
Platform2.NO_FOREIGNOBJECT = _NO_FOREIGNOBJECT;
Platform2.SUPPORT_FOREIGNOBJECT = !Platform2.NO_FOREIGNOBJECT;
})(Platform || (Platform = {}));
(function(Platform2) {
function getHMRStatus() {
const mod3 = window.module;
if (mod3 != null && mod3.hot != null && mod3.hot.status != null) {
return mod3.hot.status();
}
return "unkonwn";
}
Platform2.getHMRStatus = getHMRStatus;
function isApplyingHMR() {
return getHMRStatus() === "apply";
}
Platform2.isApplyingHMR = isApplyingHMR;
const TAGNAMES = {
select: "input",
change: "input",
submit: "form",
reset: "form",
error: "img",
load: "img",
abort: "img"
};
function isEventSupported(event) {
const elem = document.createElement(TAGNAMES[event] || "div");
const eventName = `on${event}`;
let isSupported = eventName in elem;
if (!isSupported) {
elem.setAttribute(eventName, "return;");
isSupported = typeof elem[eventName] === "function";
}
return isSupported;
}
Platform2.isEventSupported = isEventSupported;
})(Platform || (Platform = {}));
}
});
// node_modules/@antv/x6-common/es/dom/class.js
function getClass(elem) {
return elem && elem.getAttribute && elem.getAttribute("class") || "";
}
function hasClass(elem, selector) {
if (elem == null || selector == null) {
return false;
}
const classNames = fillSpaces(getClass(elem));
const className = fillSpaces(selector);
return elem.nodeType === 1 ? classNames.replace(rclass, " ").includes(className) : false;
}
function addClass(elem, selector) {
if (elem == null || selector == null) {
return;
}
if (typeof selector === "function") {
return addClass(elem, selector(getClass(elem)));
}
if (typeof selector === "string" && elem.nodeType === 1) {
const classes = selector.match(rnotwhite) || [];
const oldValue = fillSpaces(getClass(elem)).replace(rclass, " ");
let newValue = classes.reduce((memo, cls) => {
if (memo.indexOf(fillSpaces(cls)) < 0) {
return `${memo}${cls} `;
}
return memo;
}, oldValue);
newValue = newValue.trim();
if (oldValue !== newValue) {
elem.setAttribute("class", newValue);
}
}
}
function removeClass(elem, selector) {
if (elem == null) {
return;
}
if (typeof selector === "function") {
return removeClass(elem, selector(getClass(elem)));
}
if ((!selector || typeof selector === "string") && elem.nodeType === 1) {
const classes = (selector || "").match(rnotwhite) || [];
const oldValue = fillSpaces(getClass(elem)).replace(rclass, " ");
let newValue = classes.reduce((memo, cls) => {
const className = fillSpaces(cls);
if (memo.indexOf(className) > -1) {
return memo.replace(className, " ");
}
return memo;
}, oldValue);
newValue = selector ? newValue.trim() : "";
if (oldValue !== newValue) {
elem.setAttribute("class", newValue);
}
}
}
function toggleClass(elem, selector, stateVal) {
if (elem == null || selector == null) {
return;
}
if (stateVal != null && typeof selector === "string") {
stateVal ? addClass(elem, selector) : removeClass(elem, selector);
return;
}
if (typeof selector === "function") {
return toggleClass(elem, selector(getClass(elem), stateVal), stateVal);
}
if (typeof selector === "string") {
const metches = selector.match(rnotwhite) || [];
metches.forEach((cls) => {
hasClass(elem, cls) ? removeClass(elem, cls) : addClass(elem, cls);
});
}
}
var rclass, rnotwhite, fillSpaces;
var init_class = __esm({
"node_modules/@antv/x6-common/es/dom/class.js"() {
rclass = /[\t\r\n\f]/g;
rnotwhite = /\S+/g;
fillSpaces = (str) => ` ${str} `;
}
});
// node_modules/@antv/x6-common/es/dom/elem.js
function uniqueId() {
idCounter += 1;
return `v${idCounter}`;
}
function ensureId(elem) {
if (elem.id == null || elem.id === "") {
elem.id = uniqueId();
}
return elem.id;
}
function isSVGGraphicsElement(elem) {
if (elem == null) {
return false;
}
return typeof elem.getScreenCTM === "function" && elem instanceof SVGElement;
}
function createElement(tagName2, doc = document) {
return doc.createElement(tagName2);
}
function createElementNS(tagName2, namespaceURI = ns.xhtml, doc = document) {
return doc.createElementNS(namespaceURI, tagName2);
}
function createSvgElement(tagName2, doc = document) {
return createElementNS(tagName2, ns.svg, doc);
}
function createSvgDocument(content) {
if (content) {
const xml = `<svg xmlns="${ns.svg}" xmlns:xlink="${ns.xlink}" version="${svgVersion}">${content}</svg>`;
const { documentElement } = parseXML(xml, { async: false });
return documentElement;
}
const svg = document.createElementNS(ns.svg, "svg");
svg.setAttributeNS(ns.xmlns, "xmlns:xlink", ns.xlink);
svg.setAttribute("version", svgVersion);
return svg;
}
function parseXML(data2, options = {}) {
let xml;
try {
const parser = new DOMParser();
if (options.async != null) {
const instance = parser;
instance.async = options.async;
}
xml = parser.parseFromString(data2, options.mimeType || "text/xml");
} catch (error) {
xml = void 0;
}
if (!xml || xml.getElementsByTagName("parsererror").length) {
throw new Error(`Invalid XML: ${data2}`);
}
return xml;
}
function tagName(node, lowercase = true) {
const nodeName = node.nodeName;
return lowercase ? nodeName.toLowerCase() : nodeName.toUpperCase();
}
function index(elem) {
let index2 = 0;
let node = elem.previousSibling;
while (node) {
if (node.nodeType === 1) {
index2 += 1;
}
node = node.previousSibling;
}
return index2;
}
function find(elem, selector) {
return elem.querySelectorAll(selector);
}
function findOne(elem, selector) {
return elem.querySelector(selector);
}
function findParentByClass(elem, className, terminator) {
const ownerSVGElement = elem.ownerSVGElement;
let node = elem.parentNode;
while (node && node !== terminator && node !== ownerSVGElement) {
if (hasClass(node, className)) {
return node;
}
node = node.parentNode;
}
return null;
}
function contains(parent, child) {
const bup = child && child.parentNode;
return parent === bup || !!(bup && bup.nodeType === 1 && parent.compareDocumentPosition(bup) & 16);
}
function remove(elem) {
if (elem) {
const elems = Array.isArray(elem) ? elem : [elem];
elems.forEach((item) => {
if (item.parentNode) {
item.parentNode.removeChild(item);
}
});
}
}
function empty(elem) {
while (elem.firstChild) {
elem.removeChild(elem.firstChild);
}
}
function append(elem, elems) {
const arr = Array.isArray(elems) ? elems : [elems];
arr.forEach((child) => {
if (child != null) {
elem.appendChild(child);
}
});
}
function prepend(elem, elems) {
const child = elem.firstChild;
return child ? before(child, elems) : append(elem, elems);
}
function before(elem, elems) {
const parent = elem.parentNode;
if (parent) {
const arr = Array.isArray(elems) ? elems : [elems];
arr.forEach((child) => {
if (child != null) {
parent.insertBefore(child, elem);
}
});
}
}
function after(elem, elems) {
const parent = elem.parentNode;
if (parent) {
const arr = Array.isArray(elems) ? elems : [elems];
arr.forEach((child) => {
if (child != null) {
parent.insertBefore(child, elem.nextSibling);
}
});
}
}
function appendTo(elem, target) {
if (target != null) {
target.appendChild(elem);
}
}
function isElement(x) {
return !!x && x.nodeType === 1;
}
function isHTMLElement(elem) {
try {
return elem instanceof HTMLElement;
} catch (e) {
return typeof elem === "object" && elem.nodeType === 1 && typeof elem.style === "object" && typeof elem.ownerDocument === "object";
}
}
function children(parent, className) {
const matched = [];
let elem = parent.firstChild;
for (; elem; elem = elem.nextSibling) {
if (elem.nodeType === 1) {
if (!className || hasClass(elem, className)) {
matched.push(elem);
}
}
}
return matched;
}
var idCounter, ns, svgVersion;
var init_elem = __esm({
"node_modules/@antv/x6-common/es/dom/elem.js"() {
init_class();
idCounter = 0;
ns = {
svg: "http://www.w3.org/2000/svg",
xmlns: "http://www.w3.org/2000/xmlns/",
xml: "http://www.w3.org/XML/1998/namespace",
xlink: "http://www.w3.org/1999/xlink",
xhtml: "http://www.w3.org/1999/xhtml"
};
svgVersion = "1.1";
}
});
// node_modules/@antv/x6-common/es/dom/attr.js
function getAttribute(elem, name) {
return elem.getAttribute(name);
}
function removeAttribute(elem, name) {
const qualified = qualifyAttr(name);
if (qualified.ns) {
if (elem.hasAttributeNS(qualified.ns, qualified.local)) {
elem.removeAttributeNS(qualified.ns, qualified.local);
}
} else if (elem.hasAttribute(name)) {
elem.removeAttribute(name);
}
}
function setAttribute(elem, name, value) {
if (value == null) {
return removeAttribute(elem, name);
}
const qualified = qualifyAttr(name);
if (qualified.ns && typeof value === "string") {
elem.setAttributeNS(qualified.ns, name, value);
} else if (name === "id") {
elem.id = `${value}`;
} else {
elem.setAttribute(name, `${value}`);
}
}
function setAttributes(elem, attrs) {
Object.keys(attrs).forEach((name) => {
setAttribute(elem, name, attrs[name]);
});
}
function attr(elem, name, value) {
if (name == null) {
const attrs = elem.attributes;
const ret = {};
for (let i = 0; i < attrs.length; i += 1) {
ret[attrs[i].name] = attrs[i].value;
}
return ret;
}
if (typeof name === "string" && value === void 0) {
return elem.getAttribute(name);
}
if (typeof name === "object") {
setAttributes(elem, name);
} else {
setAttribute(elem, name, value);
}
}
function qualifyAttr(name) {
if (name.indexOf(":") !== -1) {
const combinedKey = name.split(":");
return {
ns: ns[combinedKey[0]],
local: combinedKey[1]
};
}
return {
ns: null,
local: name
};
}
function kebablizeAttrs(attrs) {
const result = {};
Object.keys(attrs).forEach((key) => {
const name = CASE_SENSITIVE_ATTR.includes(key) ? key : kebabCase(key);
result[name] = attrs[key];
});
return result;
}
function styleToObject(styleString) {
const ret = {};
const styles = styleString.split(";");
styles.forEach((item) => {
const section = item.trim();
if (section) {
const pair = section.split("=");
if (pair.length) {
ret[pair[0].trim()] = pair[1] ? pair[1].trim() : "";
}
}
});
return ret;
}
function mergeAttrs(target, source) {
Object.keys(source).forEach((attr2) => {
if (attr2 === "class") {
target[attr2] = target[attr2] ? `${target[attr2]} ${source[attr2]}` : source[attr2];
} else if (attr2 === "style") {
const to = typeof target[attr2] === "object";
const so = typeof source[attr2] === "object";
let tt;
let ss;
if (to && so) {
tt = target[attr2];
ss = source[attr2];
} else if (to) {
tt = target[attr2];
ss = styleToObject(source[attr2]);
} else if (so) {
tt = styleToObject(target[attr2]);
ss = source[attr2];
} else {
tt = styleToObject(target[attr2]);
ss = styleToObject(source[attr2]);
}
target[attr2] = mergeAttrs(tt, ss);
} else {
target[attr2] = source[attr2];
}
});
return target;
}
var CASE_SENSITIVE_ATTR;
var init_attr = __esm({
"node_modules/@antv/x6-common/es/dom/attr.js"() {
init_elem();
init_format();
CASE_SENSITIVE_ATTR = [
"viewBox",
"attributeName",
"attributeType",
"repeatCount",
"textLength",
"lengthAdjust",
"gradientUnits"
];
}
});
// node_modules/@antv/x6-common/es/text/annotate.js
function annotate(t, annotations, opt = {}) {
const offset2 = opt.offset || 0;
const compacted = [];
const ret = [];
let curr;
let prev;
let batch = null;
for (let i = 0; i < t.length; i += 1) {
curr = ret[i] = t[i];
for (let j = 0, jj = annotations.length; j < jj; j += 1) {
const annotation = annotations[j];
const start = annotation.start + offset2;
const end = annotation.end + offset2;
if (i >= start && i < end) {
if (typeof curr === "string") {
curr = ret[i] = {
t: t[i],
attrs: annotation.attrs
};
} else {
curr.attrs = mergeAttrs(mergeAttrs({}, curr.attrs), annotation.attrs);
}
if (opt.includeAnnotationIndices) {
if (curr.annotations == null) {
curr.annotations = [];
}
curr.annotations.push(j);
}
}
}
prev = ret[i - 1];
if (!prev) {
batch = curr;
} else if (object_exports.isObject(curr) && object_exports.isObject(prev)) {
batch = batch;
if (JSON.stringify(curr.attrs) === JSON.stringify(prev.attrs)) {
batch.t += curr.t;
} else {
compacted.push(batch);
batch = curr;
}
} else if (object_exports.isObject(curr)) {
batch = batch;
compacted.push(batch);
batch = curr;
} else if (object_exports.isObject(prev)) {
batch = batch;
compacted.push(batch);
batch = curr;
} else {
batch = (batch || "") + curr;
}
}
if (batch != null) {
compacted.push(batch);
}
return compacted;
}
function findAnnotationsAtIndex(annotations, index2) {
return annotations ? annotations.filter((a) => a.start < index2 && index2 <= a.end) : [];
}
function findAnnotationsBetweenIndexes(annotations, start, end) {
return annotations ? annotations.filter((a) => start >= a.start && start < a.end || end > a.start && end <= a.end || a.start >= start && a.end < end) : [];
}
function shiftAnnotations(annotations, index2, offset2) {
if (annotations) {
annotations.forEach((a) => {
if (a.start < index2 && a.end >= index2) {
a.end += offset2;
} else if (a.start >= index2) {
a.start += offset2;
a.end += offset2;
}
});
}
return annotations;
}
var init_annotate = __esm({
"node_modules/@antv/x6-common/es/text/annotate.js"() {
init_object2();
init_attr();
}
});
// node_modules/@antv/x6-common/es/text/sanitize.js
function sanitize(text2) {
return text2.replace(/ /g, " ");
}
var init_sanitize = __esm({
"node_modules/@antv/x6-common/es/text/sanitize.js"() {
}
});
// node_modules/@antv/x6-common/es/text/main.js
var main_exports2 = {};
__export(main_exports2, {
annotate: () => annotate,
findAnnotationsAtIndex: () => findAnnotationsAtIndex,
findAnnotationsBetweenIndexes: () => findAnnotationsBetweenIndexes,
sanitize: () => sanitize,
shiftAnnotations: () => shiftAnnotations
});
var init_main2 = __esm({
"node_modules/@antv/x6-common/es/text/main.js"() {
init_annotate();
init_sanitize();
}
});
// node_modules/@antv/x6-common/es/text/index.js
var init_text = __esm({
"node_modules/@antv/x6-common/es/text/index.js"() {
init_main2();
}
});
// node_modules/@antv/x6-common/es/datauri/index.js
var DataUri;
var init_datauri = __esm({
"node_modules/@antv/x6-common/es/datauri/index.js"() {
(function(DataUri2) {
function isDataUrl(url) {
const prefix = "data:";
return url.substr(0, prefix.length) === prefix;
}
DataUri2.isDataUrl = isDataUrl;
function imageToDataUri(url, callback) {
if (!url || isDataUrl(url)) {
setTimeout(() => callback(null, url));
return;
}
const onError = () => {
callback(new Error(`Failed to load image: ${url}`));
};
const onLoad = window.FileReader ? (
// chrome, IE10+
(xhr2) => {
if (xhr2.status === 200) {
const reader = new FileReader();
reader.onload = (evt) => {
const dataUri = evt.target.result;
callback(null, dataUri);
};
reader.onerror = onError;
reader.readAsDataURL(xhr2.response);
} else {
onError();
}
}
) : (xhr2) => {
const toString = (u8a) => {
const CHUNK_SZ = 32768;
const c = [];
for (let i = 0; i < u8a.length; i += CHUNK_SZ) {
c.push(String.fromCharCode.apply(null, u8a.subarray(i, i + CHUNK_SZ)));
}
return c.join("");
};
if (xhr2.status === 200) {
let suffix = url.split(".").pop() || "png";
if (suffix === "svg") {
suffix = "svg+xml";
}
const meta = `data:image/${suffix};base64,`;
const bytes = new Uint8Array(xhr2.response);
const base64 = meta + btoa(toString(bytes));
callback(null, base64);
} else {
onError();
}
};
const xhr = new XMLHttpRequest();
xhr.responseType = window.FileReader ? "blob" : "arraybuffer";
xhr.open("GET", url, true);
xhr.addEventListener("error", onError);
xhr.addEventListener("load", () => onLoad(xhr));
xhr.send();
}
DataUri2.imageToDataUri = imageToDataUri;
function dataUriToBlob(dataUrl) {
let uri = dataUrl.replace(/\s/g, "");
uri = decodeURIComponent(uri);
const index2 = uri.indexOf(",");
const dataType = uri.slice(0, index2);
const mime = dataType.split(":")[1].split(";")[0];
const data2 = uri.slice(index2 + 1);
let decodedString;
if (dataType.indexOf("base64") >= 0) {
decodedString = atob(data2);
} else {
decodedString = unescape(encodeURIComponent(data2));
}
const ia = new Uint8Array(decodedString.length);
for (let i = 0; i < decodedString.length; i += 1) {
ia[i] = decodedString.charCodeAt(i);
}
return new Blob([ia], { type: mime });
}
DataUri2.dataUriToBlob = dataUriToBlob;
function downloadBlob(blob, fileName) {
const msSaveBlob = window.navigator.msSaveBlob;
if (msSaveBlob) {
msSaveBlob(blob, fileName);
} else {
const url = window.URL.createObjectURL(blob);
const link = document.createElement("a");
link.href = url;
link.download = fileName;
document.body.appendChild(link);
link.click();
document.body.removeChild(link);
window.URL.revokeObjectURL(url);
}
}
DataUri2.downloadBlob = downloadBlob;
function downloadDataUri(dataUrl, fileName) {
const blob = dataUriToBlob(dataUrl);
downloadBlob(blob, fileName);
}
DataUri2.downloadDataUri = downloadDataUri;
function parseViewBox(svg) {
const matches = svg.match(/<svg[^>]*viewBox\s*=\s*(["']?)(.+?)\1[^>]*>/i);
if (matches && matches[2]) {
return matches[2].replace(/\s+/, " ").split(" ");
}
return null;
}
function getNumber2(str) {
const ret = parseFloat(str);
return Number.isNaN(ret) ? null : ret;
}
function svgToDataUrl(svg, options = {}) {
let viewBox = null;
const getNumberFromViewBox = (index2) => {
if (viewBox == null) {
viewBox = parseViewBox(svg);
}
if (viewBox != null) {
return getNumber2(viewBox[index2]);
}
return null;
};
const getNumberFromMatches = (reg) => {
const matches = svg.match(reg);
if (matches && matches[2]) {
return getNumber2(matches[2]);
}
return null;
};
let w = options.width;
if (w == null) {
w = getNumberFromMatches(/<svg[^>]*width\s*=\s*(["']?)(.+?)\1[^>]*>/i);
}
if (w == null) {
w = getNumberFromViewBox(2);
}
if (w == null) {
throw new Error("Can not parse width from svg string");
}
let h = options.height;
if (h == null) {
h = getNumberFromMatches(/<svg[^>]*height\s*=\s*(["']?)(.+?)\1[^>]*>/i);
}
if (h == null) {
h = getNumberFromViewBox(3);
}
if (h == null) {
throw new Error("Can not parse height from svg string");
}
const decoded = encodeURIComponent(svg).replace(/'/g, "%27").replace(/"/g, "%22");
const header = "data:image/svg+xml";
const dataUrl = `${header},${decoded}`;
return dataUrl;
}
DataUri2.svgToDataUrl = svgToDataUrl;
})(DataUri || (DataUri = {}));
}
});
// node_modules/@antv/x6-common/es/unit/index.js
var millimeterSize, supportedUnits, Unit;
var init_unit = __esm({
"node_modules/@antv/x6-common/es/unit/index.js"() {
supportedUnits = {
px(val) {
return val;
},
mm(val) {
return millimeterSize * val;
},
cm(val) {
return millimeterSize * val * 10;
},
in(val) {
return millimeterSize * val * 25.4;
},
pt(val) {
return millimeterSize * (25.4 * val / 72);
},
pc(val) {
return millimeterSize * (25.4 * val / 6);
}
};
(function(Unit2) {
function measure(cssWidth, cssHeight, unit) {
const div = document.createElement("div");
const style = div.style;
style.display = "inline-block";
style.position = "absolute";
style.left = "-15000px";
style.top = "-15000px";
style.width = cssWidth + (unit || "px");
style.height = cssHeight + (unit || "px");
document.body.appendChild(div);
const rect = div.getBoundingClientRect();
const size = {
width: rect.width || 0,
height: rect.height || 0
};
document.body.removeChild(div);
return size;
}
Unit2.measure = measure;
function toPx(val, unit) {
if (millimeterSize == null) {
millimeterSize = measure("1", "1", "mm").width;
}
const convert = unit ? supportedUnits[unit] : null;
if (convert) {
return convert(val);
}
return val;
}
Unit2.toPx = toPx;
})(Unit || (Unit = {}));
}
});
// node_modules/@antv/x6-common/es/dom/prefix.js
function camelize(str) {
return str.replace(hyphenPattern, (_, char) => char.toUpperCase());
}
function getWithPrefix(name) {
for (let i = 0; i < prefixes.length; i += 1) {
const prefixedName = prefixes[i] + name;
if (prefixedName in testStyle) {
return prefixedName;
}
}
return null;
}
function getVendorPrefixedName(property) {
const name = camelize(property);
if (memoized[name] == null) {
const capitalizedName = name.charAt(0).toUpperCase() + name.slice(1);
memoized[name] = name in testStyle ? name : getWithPrefix(capitalizedName);
}
return memoized[name];
}
var hyphenPattern, memoized, prefixes, testStyle;
var init_prefix = __esm({
"node_modules/@antv/x6-common/es/dom/prefix.js"() {
hyphenPattern = /-(.)/g;
memoized = {};
prefixes = ["webkit", "ms", "moz", "o"];
testStyle = typeof document !== "undefined" ? document.createElement("div").style : {};
}
});
// node_modules/@antv/x6-common/es/dom/style.js
function setPrefixedStyle(style, name, value) {
const vendor = getVendorPrefixedName(name);
if (vendor != null) {
style[vendor] = value;
}
style[name] = value;
}
function getComputedStyle2(elem, name) {
const computed = elem.ownerDocument && elem.ownerDocument.defaultView && elem.ownerDocument.defaultView.opener ? elem.ownerDocument.defaultView.getComputedStyle(elem, null) : window.getComputedStyle(elem, null);
if (computed && name) {
return computed.getPropertyValue(name) || computed[name];
}
return computed;
}
function hasScrollbars(container) {
const style = getComputedStyle2(container);
return style != null && (style.overflow === "scroll" || style.overflow === "auto");
}
var init_style = __esm({
"node_modules/@antv/x6-common/es/dom/style.js"() {
init_prefix();
}
});
// node_modules/@antv/x6-common/es/dom/selection.js
var clearSelection;
var init_selection = __esm({
"node_modules/@antv/x6-common/es/dom/selection.js"() {
clearSelection = (function() {
if (typeof document == "undefined")
return function() {
};
const doc = document;
if (doc.selection) {
return function() {
doc.selection.empty();
};
}
if (window.getSelection) {
return function() {
const selection = window.getSelection();
if (selection) {
if (selection.empty) {
selection.empty();
} else if (selection.removeAllRanges) {
selection.removeAllRanges();
}
}
};
}
return function() {
};
})();
}
});
// node_modules/@antv/x6-common/es/dom/css.js
function isCSSVariable(prop2) {
return /^--/.test(prop2);
}
function computeStyle(elem, prop2, isVariable) {
const style = window.getComputedStyle(elem, null);
return isVariable ? style.getPropertyValue(prop2) || void 0 : style[prop2] || elem.style[prop2];
}
function computeStyleInt(elem, prop2) {
return parseInt(computeStyle(elem, prop2), 10) || 0;
}
function getSuffixedValue(prop2, value) {
return !numericProps[prop2] && typeof value === "number" ? `${value}px` : value;
}
function css(elem, prop2, value) {
if (typeof prop2 === "string") {
const isVariable = isCSSVariable(prop2);
if (!isVariable) {
prop2 = getVendorPrefixedName(prop2);
}
if (value === void 0) {
return computeStyle(elem, prop2, isVariable);
}
if (!isVariable) {
value = getSuffixedValue(prop2, value);
}
const style = elem.style;
if (isVariable) {
style.setProperty(prop2, value);
} else {
style[prop2] = value;
}
return;
}
for (const key in prop2) {
css(elem, key, prop2[key]);
}
}
var numericProps;
var init_css = __esm({
"node_modules/@antv/x6-common/es/dom/css.js"() {
init_prefix();
numericProps = {
animationIterationCount: true,
columnCount: true,
flexGrow: true,
flexShrink: true,
fontWeight: true,
gridArea: true,
gridColumn: true,
gridColumnEnd: true,
gridColumnStart: true,
gridRow: true,
gridRowEnd: true,
gridRowStart: true,
lineHeight: true,
opacity: true,
order: true,
orphans: true,
widows: true,
zIndex: true
};
}
});
// node_modules/@antv/x6-common/es/dom/data.js
function getData(elem, name) {
const key = string_exports.camelCase(name);
const cache = dataset.get(elem);
if (cache) {
return cache[key];
}
}
function setData(elem, name, value) {
const key = string_exports.camelCase(name);
const cache = dataset.get(elem);
if (cache) {
cache[key] = value;
} else {
dataset.set(elem, {
[key]: value
});
}
}
function data(elem, name, value) {
if (!name) {
const datas = {};
Object.keys(dataset).forEach((key) => {
datas[key] = getData(elem, key);
});
return datas;
}
if (typeof name === "string") {
if (value === void 0) {
return getData(elem, name);
}
setData(elem, name, value);
return;
}
for (const key in name) {
data(elem, key, name[key]);
}
}
var dataset;
var init_data = __esm({
"node_modules/@antv/x6-common/es/dom/data.js"() {
init_string2();
dataset = /* @__PURE__ */ new WeakMap();
}
});
// node_modules/@antv/x6-common/es/dom/prop.js
function prop(elem, props, value) {
if (!props) {
return;
}
if (typeof props === "string") {
props = propMap[props] || props;
if (arguments.length < 3) {
return elem[props];
}
;
elem[props] = value;
return;
}
for (const key in props) {
prop(elem, key, props[key]);
}
}
var propMap;
var init_prop = __esm({
"node_modules/@antv/x6-common/es/dom/prop.js"() {
propMap = {
/* GENERAL */
class: "className",
contenteditable: "contentEditable",
/* LABEL */
for: "htmlFor",
/* INPUT */
readonly: "readOnly",
maxlength: "maxLength",
tabindex: "tabIndex",
/* TABLE */
colspan: "colSpan",
rowspan: "rowSpan",
/* IMAGE */
usemap: "useMap"
};
}
});
// node_modules/@antv/x6-common/es/dom/text.js
function createTextPathNode(attrs, elem) {
const vel = Vector.create(elem);
const textPath = Vector.create("textPath");
const d = attrs.d;
if (d && attrs["xlink:href"] === void 0) {
const path = Vector.create("path").attr("d", d).appendTo(vel.defs());
textPath.attr("xlink:href", `#${path.id}`);
}
if (typeof attrs === "object") {
textPath.attr(attrs);
}
return textPath.node;
}
function annotateTextLine(lineNode, lineAnnotations, options) {
const eol = options.eol;
const baseSize = options.baseSize;
const lineHeight = options.lineHeight;
let maxFontSize = 0;
let tspanNode;
const fontMetrics = {};
const lastJ = lineAnnotations.length - 1;
for (let j = 0; j <= lastJ; j += 1) {
let annotation = lineAnnotations[j];
let fontSize = null;
if (typeof annotation === "object") {
const annotationAttrs = annotation.attrs;
const vTSpan = Vector.create("tspan", annotationAttrs);
tspanNode = vTSpan.node;
let t = annotation.t;
if (eol && j === lastJ) {
t += eol;
}
tspanNode.textContent = t;
const annotationClass = annotationAttrs.class;
if (annotationClass) {
vTSpan.addClass(annotationClass);
}
if (options.includeAnnotationIndices) {
vTSpan.attr("annotations", annotation.annotations.join(","));
}
fontSize = parseFloat(annotationAttrs["font-size"]);
if (fontSize === void 0)
fontSize = baseSize;
if (fontSize && fontSize > maxFontSize)
maxFontSize = fontSize;
} else {
if (eol && j === lastJ) {
annotation += eol;
}
tspanNode = document.createTextNode(annotation || " ");
if (baseSize && baseSize > maxFontSize) {
maxFontSize = baseSize;
}
}
lineNode.appendChild(tspanNode);
}
if (maxFontSize) {
fontMetrics.maxFontSize = maxFontSize;
}
if (lineHeight) {
fontMetrics.lineHeight = lineHeight;
} else if (maxFontSize) {
fontMetrics.lineHeight = maxFontSize * 1.2;
}
return fontMetrics;
}
function emToPx(em, fontSize) {
const numerical = parseFloat(em);
if (emRegex.test(em)) {
return numerical * fontSize;
}
return numerical;
}
function calculateDY(alignment, linesMetrics, baseSizePx, lineHeight) {
if (!Array.isArray(linesMetrics)) {
return 0;
}
const n = linesMetrics.length;
if (!n)
return 0;
let lineMetrics = linesMetrics[0];
const flMaxFont = emToPx(lineMetrics.maxFontSize, baseSizePx) || baseSizePx;
let rLineHeights = 0;
const lineHeightPx = emToPx(lineHeight, baseSizePx);
for (let i = 1; i < n; i += 1) {
lineMetrics = linesMetrics[i];
const iLineHeight = emToPx(lineMetrics.lineHeight, baseSizePx) || lineHeightPx;
rLineHeights += iLineHeight;
}
const llMaxFont = emToPx(lineMetrics.maxFontSize, baseSizePx) || baseSizePx;
let dy;
switch (alignment) {
case "middle":
dy = flMaxFont / 2 - 0.15 * llMaxFont - rLineHeights / 2;
break;
case "bottom":
dy = -(0.25 * llMaxFont) - rLineHeights;
break;
case "top":
default:
dy = 0.8 * flMaxFont;
break;
}
return dy;
}
function text(elem, content, options = {}) {
content = main_exports2.sanitize(content);
const eol = options.eol;
let textPath = options.textPath;
const verticalAnchor = options.textVerticalAnchor;
const namedVerticalAnchor = verticalAnchor === "middle" || verticalAnchor === "bottom" || verticalAnchor === "top";
let x = options.x;
if (x === void 0) {
x = elem.getAttribute("x") || 0;
}
const iai = options.includeAnnotationIndices;
let annotations = options.annotations;
if (annotations && !Array.isArray(annotations)) {
annotations = [annotations];
}
const defaultLineHeight = options.lineHeight;
const autoLineHeight = defaultLineHeight === "auto";
const lineHeight = autoLineHeight ? "1.5em" : defaultLineHeight || "1em";
let needEmpty = true;
const childNodes = elem.childNodes;
if (childNodes.length === 1) {
const node = childNodes[0];
if (node && node.tagName.toUpperCase() === "TITLE") {
needEmpty = false;
}
}
if (needEmpty) {
empty(elem);
}
attr(elem, {
// Preserve spaces, do not consecutive spaces to get collapsed to one.
"xml:space": "preserve",
// An empty text gets rendered into the DOM in webkit-based browsers.
// In order to unify this behaviour across all browsers
// we rather hide the text element when it's empty.
display: content || options.displayEmpty ? null : "none"
});
const strFontSize = attr(elem, "font-size");
let fontSize = parseFloat(strFontSize);
if (!fontSize) {
fontSize = 16;
if ((namedVerticalAnchor || annotations) && !strFontSize) {
attr(elem, "font-size", `${fontSize}`);
}
}
let containerNode;
if (textPath) {
if (typeof textPath === "string") {
textPath = { d: textPath };
}
containerNode = createTextPathNode(textPath, elem);
} else {
containerNode = document.createDocumentFragment();
}
let dy;
let offset2 = 0;
let annotatedY;
const lines = content.split("\n");
const linesMetrics = [];
const lastI = lines.length - 1;
for (let i = 0; i <= lastI; i += 1) {
dy = lineHeight;
let lineClassName = "v-line";
const lineNode = createSvgElement("tspan");
let lineMetrics;
let line = lines[i];
if (line) {
if (annotations) {
const lineAnnotations = main_exports2.annotate(line, annotations, {
offset: -offset2,
includeAnnotationIndices: iai
});
lineMetrics = annotateTextLine(lineNode, lineAnnotations, {
eol: i !== lastI && eol,
baseSize: fontSize,
lineHeight: autoLineHeight ? null : lineHeight,
includeAnnotationIndices: iai
});
const iLineHeight = lineMetrics.lineHeight;
if (iLineHeight && autoLineHeight && i !== 0) {
dy = iLineHeight;
}
if (i === 0) {
annotatedY = lineMetrics.maxFontSize * 0.8;
}
} else {
if (eol && i !== lastI) {
line += eol;
}
lineNode.textContent = line;
}
} else {
lineNode.textContent = "-";
lineClassName += " v-empty-line";
const lineNodeStyle = lineNode.style;
lineNodeStyle.fillOpacity = 0;
lineNodeStyle.strokeOpacity = 0;
if (annotations) {
lineMetrics = {};
}
}
if (lineMetrics) {
linesMetrics.push(lineMetrics);
}
if (i > 0) {
lineNode.setAttribute("dy", dy);
}
if (i > 0 || textPath) {
lineNode.setAttribute("x", x);
}
lineNode.className.baseVal = lineClassName;
containerNode.appendChild(lineNode);
offset2 += line.length + 1;
}
if (namedVerticalAnchor) {
if (annotations) {
dy = calculateDY(verticalAnchor, linesMetrics, fontSize, lineHeight);
} else if (verticalAnchor === "top") {
dy = "0.8em";
} else {
let rh;
if (lastI > 0) {
rh = parseFloat(lineHeight) || 1;
rh *= lastI;
if (!emRegex.test(lineHeight))
rh /= fontSize;
} else {
rh = 0;
}
switch (verticalAnchor) {
case "middle":
dy = `${0.3 - rh / 2}em`;
break;
case "bottom":
dy = `${-rh - 0.3}em`;
break;
default:
break;
}
}
} else if (verticalAnchor === 0) {
dy = "0em";
} else if (verticalAnchor) {
dy = verticalAnchor;
} else {
dy = 0;
if (elem.getAttribute("y") == null) {
elem.setAttribute("y", `${annotatedY || "0.8em"}`);
}
}
const firstLine = containerNode.firstChild;
firstLine.setAttribute("dy", dy);
elem.appendChild(containerNode);
}
function measureText(text2, styles = {}) {
const canvasContext = document.createElement("canvas").getContext("2d");
if (!text2) {
return { width: 0 };
}
const font = [];
const fontSize = styles["font-size"] ? `${parseFloat(styles["font-size"])}px` : "14px";
font.push(styles["font-style"] || "normal");
font.push(styles["font-variant"] || "normal");
font.push(styles["font-weight"] || 400);
font.push(fontSize);
font.push(styles["font-family"] || "sans-serif");
canvasContext.font = font.join(" ");
return canvasContext.measureText(text2);
}
function splitTextByLength(text2, splitWidth, totalWidth, style = {}) {
if (splitWidth >= totalWidth) {
return [text2, ""];
}
const length = text2.length;
const caches = {};
let index2 = Math.round(splitWidth / totalWidth * length - 1);
if (index2 < 0) {
index2 = 0;
}
while (index2 >= 0 && index2 < length) {
const frontText = text2.slice(0, index2);
const frontWidth = caches[frontText] || measureText(frontText, style).width;
const behindText = text2.slice(0, index2 + 1);
const behindWidth = caches[behindText] || measureText(behindText, style).width;
caches[frontText] = frontWidth;
caches[behindText] = behindWidth;
if (frontWidth > splitWidth) {
index2 -= 1;
} else if (behindWidth <= splitWidth) {
index2 += 1;
} else {
break;
}
}
return [text2.slice(0, index2), text2.slice(index2)];
}
function breakText(text2, size, styles = {}, options = {}) {
const width2 = size.width;
const height2 = size.height;
const eol = options.eol || "\n";
const fontSize = styles.fontSize || 14;
const lineHeight = styles.lineHeight ? parseFloat(styles.lineHeight) : Math.ceil(fontSize * 1.4);
const maxLines = Math.floor(height2 / lineHeight);
if (text2.indexOf(eol) > -1) {
const delimiter = string_exports.uuid();
const splitText = [];
text2.split(eol).map((line) => {
const part = breakText(line, Object.assign(Object.assign({}, size), { height: Number.MAX_SAFE_INTEGER }), styles, Object.assign(Object.assign({}, options), { eol: delimiter }));
if (part) {
splitText.push(...part.split(delimiter));
}
});
return splitText.slice(0, maxLines).join(eol);
}
const { width: textWidth } = measureText(text2, styles);
if (textWidth < width2) {
return text2;
}
const lines = [];
let remainText = text2;
let remainWidth = textWidth;
let ellipsis = options.ellipsis;
let ellipsisWidth = 0;
if (ellipsis) {
if (typeof ellipsis !== "string") {
ellipsis = "…";
}
ellipsisWidth = measureText(ellipsis, styles).width;
}
for (let i = 0; i < maxLines; i += 1) {
if (remainWidth > width2) {
const isLast = i === maxLines - 1;
if (isLast) {
const [front] = splitTextByLength(remainText, width2 - ellipsisWidth, remainWidth, styles);
lines.push(ellipsis ? `${front}${ellipsis}` : front);
} else {
const [front, behind] = splitTextByLength(remainText, width2, remainWidth, styles);
lines.push(front);
remainText = behind;
remainWidth = measureText(remainText, styles).width;
}
} else {
lines.push(remainText);
break;
}
}
return lines.join(eol);
}
var emRegex;
var init_text2 = __esm({
"node_modules/@antv/x6-common/es/dom/text.js"() {
init_string2();
init_text();
init_attr();
init_vector();
init_elem();
emRegex = /em$/;
}
});
// node_modules/@antv/x6-common/es/dom/path.js
function getNumbericAttribute(elem, attr2, defaultValue = NaN) {
const v = elem.getAttribute(attr2);
if (v == null) {
return defaultValue;
}
const n = parseFloat(v);
return Number.isNaN(n) ? defaultValue : n;
}
function sample(elem, interval = 1) {
const length = elem.getTotalLength();
const samples = [];
let distance = 0;
let sample2;
while (distance < length) {
sample2 = elem.getPointAtLength(distance);
samples.push({ distance, x: sample2.x, y: sample2.y });
distance += interval;
}
return samples;
}
function lineToPathData(line) {
return [
"M",
getNumbericAttribute(line, "x1"),
getNumbericAttribute(line, "y1"),
"L",
getNumbericAttribute(line, "x2"),
getNumbericAttribute(line, "y2")
].join(" ");
}
function polygonToPathData(polygon) {
const points = getPointsFromSvgElement(polygon);
if (points.length === 0) {
return null;
}
return `${svgPointsToPath(points)} Z`;
}
function polylineToPathData(polyline) {
const points = getPointsFromSvgElement(polyline);
if (points.length === 0) {
return null;
}
return svgPointsToPath(points);
}
function svgPointsToPath(points) {
const arr = points.map((p) => `${p.x} ${p.y}`);
return `M ${arr.join(" L")}`;
}
function getPointsFromSvgElement(elem) {
const points = [];
const nodePoints = elem.points;
if (nodePoints) {
for (let i = 0, ii = nodePoints.numberOfItems; i < ii; i += 1) {
points.push(nodePoints.getItem(i));
}
}
return points;
}
function circleToPathData(circle) {
const cx = getNumbericAttribute(circle, "cx", 0);
const cy = getNumbericAttribute(circle, "cy", 0);
const r = getNumbericAttribute(circle, "r");
const cd = r * KAPPA;
return [
"M",
cx,
cy - r,
"C",
cx + cd,
cy - r,
cx + r,
cy - cd,
cx + r,
cy,
"C",
cx + r,
cy + cd,
cx + cd,
cy + r,
cx,
cy + r,
"C",
cx - cd,
cy + r,
cx - r,
cy + cd,
cx - r,
cy,
"C",
cx - r,
cy - cd,
cx - cd,
cy - r,
cx,
cy - r,
"Z"
].join(" ");
}
function ellipseToPathData(ellipse) {
const cx = getNumbericAttribute(ellipse, "cx", 0);
const cy = getNumbericAttribute(ellipse, "cy", 0);
const rx = getNumbericAttribute(ellipse, "rx");
const ry = getNumbericAttribute(ellipse, "ry") || rx;
const cdx = rx * KAPPA;
const cdy = ry * KAPPA;
const d = [
"M",
cx,
cy - ry,
"C",
cx + cdx,
cy - ry,
cx + rx,
cy - cdy,
cx + rx,
cy,
"C",
cx + rx,
cy + cdy,
cx + cdx,
cy + ry,
cx,
cy + ry,
"C",
cx - cdx,
cy + ry,
cx - rx,
cy + cdy,
cx - rx,
cy,
"C",
cx - rx,
cy - cdy,
cx - cdx,
cy - ry,
cx,
cy - ry,
"Z"
].join(" ");
return d;
}
function rectangleToPathData(rect) {
return rectToPathData({
x: getNumbericAttribute(rect, "x", 0),
y: getNumbericAttribute(rect, "y", 0),
width: getNumbericAttribute(rect, "width", 0),
height: getNumbericAttribute(rect, "height", 0),
rx: getNumbericAttribute(rect, "rx", 0),
ry: getNumbericAttribute(rect, "ry", 0)
});
}
function rectToPathData(r) {
let d;
const x = r.x;
const y = r.y;
const width2 = r.width;
const height2 = r.height;
const topRx = Math.min(r.rx || r["top-rx"] || 0, width2 / 2);
const bottomRx = Math.min(r.rx || r["bottom-rx"] || 0, width2 / 2);
const topRy = Math.min(r.ry || r["top-ry"] || 0, height2 / 2);
const bottomRy = Math.min(r.ry || r["bottom-ry"] || 0, height2 / 2);
if (topRx || bottomRx || topRy || bottomRy) {
d = [
"M",
x,
y + topRy,
"v",
height2 - topRy - bottomRy,
"a",
bottomRx,
bottomRy,
0,
0,
0,
bottomRx,
bottomRy,
"h",
width2 - 2 * bottomRx,
"a",
bottomRx,
bottomRy,
0,
0,
0,
bottomRx,
-bottomRy,
"v",
-(height2 - bottomRy - topRy),
"a",
topRx,
topRy,
0,
0,
0,
-topRx,
-topRy,
"h",
-(width2 - 2 * topRx),
"a",
topRx,
topRy,
0,
0,
0,
-topRx,
topRy,
"Z"
];
} else {
d = ["M", x, y, "H", x + width2, "V", y + height2, "H", x, "V", y, "Z"];
}
return d.join(" ");
}
function toPath(elem) {
const path = createSvgElement("path");
attr(path, attr(elem));
const d = toPathData(elem);
if (d) {
path.setAttribute("d", d);
}
return path;
}
function toPathData(elem) {
const tagName2 = elem.tagName.toLowerCase();
switch (tagName2) {
case "path":
return elem.getAttribute("d");
case "line":
return lineToPathData(elem);
case "polygon":
return polygonToPathData(elem);
case "polyline":
return polylineToPathData(elem);
case "ellipse":
return ellipseToPathData(elem);
case "circle":
return circleToPathData(elem);
case "rect":
return rectangleToPathData(elem);
default:
break;
}
throw new Error(`"${tagName2}" cannot be converted to svg path element.`);
}
function createSlicePathData(innerRadius, outerRadius, startAngle, endAngle) {
const svgArcMax = 2 * Math.PI - 1e-6;
const r0 = innerRadius;
const r1 = outerRadius;
let a0 = startAngle;
let a1 = endAngle;
if (a1 < a0) {
const tmp = a0;
a0 = a1;
a1 = tmp;
}
const da = a1 - a0;
const df = da < Math.PI ? "0" : "1";
const c0 = Math.cos(a0);
const s0 = Math.sin(a0);
const c1 = Math.cos(a1);
const s1 = Math.sin(a1);
return da >= svgArcMax ? r0 ? (
// eslint-disable-next-line
`M0,${r1}A${r1},${r1} 0 1,1 0,${-r1}A${r1},${r1} 0 1,1 0,${r1}M0,${r0}A${r0},${r0} 0 1,0 0,${-r0}A${r0},${r0} 0 1,0 0,${r0}Z`
) : (
// eslint-disable-next-line
`M0,${r1}A${r1},${r1} 0 1,1 0,${-r1}A${r1},${r1} 0 1,1 0,${r1}Z`
) : r0 ? (
// eslint-disable-next-line
`M${r1 * c0},${r1 * s0}A${r1},${r1} 0 ${df},1 ${r1 * c1},${r1 * s1}L${r0 * c1},${r0 * s1}A${r0},${r0} 0 ${df},0 ${r0 * c0},${r0 * s0}Z`
) : (
// eslint-disable-next-line
`M${r1 * c0},${r1 * s0}A${r1},${r1} 0 ${df},1 ${r1 * c1},${r1 * s1}L0,0Z`
);
}
var KAPPA;
var init_path = __esm({
"node_modules/@antv/x6-common/es/dom/path.js"() {
init_attr();
init_elem();
KAPPA = 0.551784;
}
});
// node_modules/@antv/x6-common/es/dom/matrix.js
function createSVGPoint(x, y) {
const svgDocument = createSvgElement("svg");
const p = svgDocument.createSVGPoint();
p.x = x;
p.y = y;
return p;
}
function createSVGMatrix(matrix) {
const svgDocument = createSvgElement("svg");
const mat = svgDocument.createSVGMatrix();
if (matrix != null) {
const source = matrix;
const target = mat;
for (const key in source) {
target[key] = source[key];
}
}
return mat;
}
function createSVGTransform(matrix) {
const svgDocument = createSvgElement("svg");
if (matrix != null) {
if (!(matrix instanceof DOMMatrix)) {
matrix = createSVGMatrix(matrix);
}
return svgDocument.createSVGTransformFromMatrix(matrix);
}
return svgDocument.createSVGTransform();
}
function transformStringToMatrix(transform2) {
let mat = createSVGMatrix();
const matches = transform2 != null && transform2.match(transformRegex);
if (!matches) {
return mat;
}
for (let i = 0, n = matches.length; i < n; i += 1) {
const transformationString = matches[i];
const transformationMatch = transformationString.match(transformationListRegex);
if (transformationMatch) {
let sx;
let sy;
let tx;
let ty;
let angle;
let ctm = createSVGMatrix();
const args = transformationMatch[2].split(transformSeparatorRegex);
switch (transformationMatch[1].toLowerCase()) {
case "scale":
sx = parseFloat(args[0]);
sy = args[1] === void 0 ? sx : parseFloat(args[1]);
ctm = ctm.scaleNonUniform(sx, sy);
break;
case "translate":
tx = parseFloat(args[0]);
ty = parseFloat(args[1]);
ctm = ctm.translate(tx, ty);
break;
case "rotate":
angle = parseFloat(args[0]);
tx = parseFloat(args[1]) || 0;
ty = parseFloat(args[2]) || 0;
if (tx !== 0 || ty !== 0) {
ctm = ctm.translate(tx, ty).rotate(angle).translate(-tx, -ty);
} else {
ctm = ctm.rotate(angle);
}
break;
case "skewx":
angle = parseFloat(args[0]);
ctm = ctm.skewX(angle);
break;
case "skewy":
angle = parseFloat(args[0]);
ctm = ctm.skewY(angle);
break;
case "matrix":
ctm.a = parseFloat(args[0]);
ctm.b = parseFloat(args[1]);
ctm.c = parseFloat(args[2]);
ctm.d = parseFloat(args[3]);
ctm.e = parseFloat(args[4]);
ctm.f = parseFloat(args[5]);
break;
default:
continue;
}
mat = mat.multiply(ctm);
}
}
return mat;
}
function matrixToTransformString(matrix) {
const m = matrix || {};
const a = m.a != null ? m.a : 1;
const b = m.b != null ? m.b : 0;
const c = m.c != null ? m.c : 0;
const d = m.d != null ? m.d : 1;
const e = m.e != null ? m.e : 0;
const f = m.f != null ? m.f : 0;
return `matrix(${a},${b},${c},${d},${e},${f})`;
}
function parseTransformString(transform2) {
let translation;
let rotation;
let scale2;
if (transform2) {
const separator = transformSeparatorRegex;
if (transform2.trim().indexOf("matrix") >= 0) {
const matrix = transformStringToMatrix(transform2);
const decomposedMatrix = decomposeMatrix(matrix);
translation = [decomposedMatrix.translateX, decomposedMatrix.translateY];
rotation = [decomposedMatrix.rotation];
scale2 = [decomposedMatrix.scaleX, decomposedMatrix.scaleY];
const transformations = [];
if (translation[0] !== 0 || translation[1] !== 0) {
transformations.push(`translate(${translation.join(",")})`);
}
if (scale2[0] !== 1 || scale2[1] !== 1) {
transformations.push(`scale(${scale2.join(",")})`);
}
if (rotation[0] !== 0) {
transformations.push(`rotate(${rotation[0]})`);
}
transform2 = transformations.join(" ");
} else {
const translateMatch = transform2.match(/translate\((.*?)\)/);
if (translateMatch) {
translation = translateMatch[1].split(separator);
}
const rotateMatch = transform2.match(/rotate\((.*?)\)/);
if (rotateMatch) {
rotation = rotateMatch[1].split(separator);
}
const scaleMatch = transform2.match(/scale\((.*?)\)/);
if (scaleMatch) {
scale2 = scaleMatch[1].split(separator);
}
}
}
const sx = scale2 && scale2[0] ? parseFloat(scale2[0]) : 1;
return {
raw: transform2 || "",
translation: {
tx: translation && translation[0] ? parseInt(translation[0], 10) : 0,
ty: translation && translation[1] ? parseInt(translation[1], 10) : 0
},
rotation: {
angle: rotation && rotation[0] ? parseInt(rotation[0], 10) : 0,
cx: rotation && rotation[1] ? parseInt(rotation[1], 10) : void 0,
cy: rotation && rotation[2] ? parseInt(rotation[2], 10) : void 0
},
scale: {
sx,
sy: scale2 && scale2[1] ? parseFloat(scale2[1]) : sx
}
};
}
function deltaTransformPoint(matrix, point) {
const dx = point.x * matrix.a + point.y * matrix.c + 0;
const dy = point.x * matrix.b + point.y * matrix.d + 0;
return { x: dx, y: dy };
}
function decomposeMatrix(matrix) {
const px = deltaTransformPoint(matrix, { x: 0, y: 1 });
const py = deltaTransformPoint(matrix, { x: 1, y: 0 });
const skewX = 180 / Math.PI * Math.atan2(px.y, px.x) - 90;
const skewY = 180 / Math.PI * Math.atan2(py.y, py.x);
return {
skewX,
skewY,
translateX: matrix.e,
translateY: matrix.f,
scaleX: Math.sqrt(matrix.a * matrix.a + matrix.b * matrix.b),
scaleY: Math.sqrt(matrix.c * matrix.c + matrix.d * matrix.d),
rotation: skewX
};
}
function matrixToScale(matrix) {
let a;
let b;
let c;
let d;
if (matrix) {
a = matrix.a == null ? 1 : matrix.a;
d = matrix.d == null ? 1 : matrix.d;
b = matrix.b;
c = matrix.c;
} else {
a = d = 1;
}
return {
sx: b ? Math.sqrt(a * a + b * b) : a,
sy: c ? Math.sqrt(c * c + d * d) : d
};
}
function matrixToRotation(matrix) {
let p = { x: 0, y: 1 };
if (matrix) {
p = deltaTransformPoint(matrix, p);
}
const deg = 180 * Math.atan2(p.y, p.x) / Math.PI % 360 - 90;
const angle = deg % 360 + (deg < 0 ? 360 : 0);
return {
angle
};
}
function matrixToTranslation(matrix) {
return {
tx: matrix && matrix.e || 0,
ty: matrix && matrix.f || 0
};
}
var transformRegex, transformSeparatorRegex, transformationListRegex;
var init_matrix = __esm({
"node_modules/@antv/x6-common/es/dom/matrix.js"() {
init_elem();
transformRegex = /(\w+)\(([^,)]+),?([^)]+)?\)/gi;
transformSeparatorRegex = /[ ,]+/;
transformationListRegex = /^(\w+)\((.*)\)/;
}
});
// node_modules/@antv/x6-common/es/dom/transform.js
function transform(elem, matrix, options = {}) {
if (matrix == null) {
return transformStringToMatrix(attr(elem, "transform"));
}
if (options.absolute) {
elem.setAttribute("transform", matrixToTransformString(matrix));
return;
}
const transformList = elem.transform;
const svgTransform = createSVGTransform(matrix);
transformList.baseVal.appendItem(svgTransform);
}
function translate(elem, tx, ty = 0, options = {}) {
let transformAttr = attr(elem, "transform");
const transform2 = parseTransformString(transformAttr);
if (tx == null) {
return transform2.translation;
}
transformAttr = transform2.raw;
transformAttr = transformAttr.replace(/translate\([^)]*\)/g, "").trim();
const newTx = options.absolute ? tx : transform2.translation.tx + tx;
const newTy = options.absolute ? ty : transform2.translation.ty + ty;
const newTranslate = `translate(${newTx},${newTy})`;
elem.setAttribute("transform", `${newTranslate} ${transformAttr}`.trim());
}
function rotate(elem, angle, cx, cy, options = {}) {
let transformAttr = attr(elem, "transform");
const transform2 = parseTransformString(transformAttr);
if (angle == null) {
return transform2.rotation;
}
transformAttr = transform2.raw;
transformAttr = transformAttr.replace(/rotate\([^)]*\)/g, "").trim();
angle %= 360;
const newAngle = options.absolute ? angle : transform2.rotation.angle + angle;
const newOrigin = cx != null && cy != null ? `,${cx},${cy}` : "";
const newRotate = `rotate(${newAngle}${newOrigin})`;
elem.setAttribute("transform", `${transformAttr} ${newRotate}`.trim());
}
function scale(elem, sx, sy) {
let transformAttr = attr(elem, "transform");
const transform2 = parseTransformString(transformAttr);
if (sx == null) {
return transform2.scale;
}
sy = sy == null ? sx : sy;
transformAttr = transform2.raw;
transformAttr = transformAttr.replace(/scale\([^)]*\)/g, "").trim();
const newScale = `scale(${sx},${sy})`;
elem.setAttribute("transform", `${transformAttr} ${newScale}`.trim());
}
function getTransformToElement(elem, target) {
if (isSVGGraphicsElement(target) && isSVGGraphicsElement(elem)) {
const targetCTM = target.getScreenCTM();
const nodeCTM = elem.getScreenCTM();
if (targetCTM && nodeCTM) {
return targetCTM.inverse().multiply(nodeCTM);
}
}
return createSVGMatrix();
}
function getTransformToParentElement(elem, target) {
let matrix = createSVGMatrix();
if (isSVGGraphicsElement(target) && isSVGGraphicsElement(elem)) {
let node = elem;
const matrixList = [];
while (node && node !== target) {
const transform2 = node.getAttribute("transform") || null;
const nodeMatrix = transformStringToMatrix(transform2);
matrixList.push(nodeMatrix);
node = node.parentNode;
}
matrixList.reverse().forEach((m) => {
matrix = matrix.multiply(m);
});
}
return matrix;
}
function toLocalPoint(elem, x, y) {
const svg = elem instanceof SVGSVGElement ? elem : elem.ownerSVGElement;
const p = svg.createSVGPoint();
p.x = x;
p.y = y;
try {
const ctm = svg.getScreenCTM();
const globalPoint = p.matrixTransform(ctm.inverse());
const globalToLocalMatrix = getTransformToElement(elem, svg).inverse();
return globalPoint.matrixTransform(globalToLocalMatrix);
} catch (e) {
return p;
}
}
var init_transform = __esm({
"node_modules/@antv/x6-common/es/dom/transform.js"() {
init_attr();
init_elem();
init_matrix();
}
});
// node_modules/@antv/x6-common/es/dom/event/hook.js
var EventHook;
var init_hook = __esm({
"node_modules/@antv/x6-common/es/dom/event/hook.js"() {
(function(EventHook2) {
const cache = {};
function get(type) {
return cache[type] || {};
}
EventHook2.get = get;
function register(type, hook) {
cache[type] = hook;
}
EventHook2.register = register;
function unregister(type) {
delete cache[type];
}
EventHook2.unregister = unregister;
})(EventHook || (EventHook = {}));
}
});
// node_modules/@antv/x6-common/es/dom/event/store.js
var Store;
var init_store = __esm({
"node_modules/@antv/x6-common/es/dom/event/store.js"() {
(function(Store2) {
const cache = /* @__PURE__ */ new WeakMap();
function ensure3(target) {
if (!cache.has(target)) {
cache.set(target, { events: /* @__PURE__ */ Object.create(null) });
}
return cache.get(target);
}
Store2.ensure = ensure3;
function get(target) {
return cache.get(target);
}
Store2.get = get;
function remove2(target) {
return cache.delete(target);
}
Store2.remove = remove2;
})(Store || (Store = {}));
}
});
// node_modules/@antv/x6-common/es/dom/event/util.js
var Util;
var init_util2 = __esm({
"node_modules/@antv/x6-common/es/dom/event/util.js"() {
init_store();
(function(Util2) {
Util2.returnTrue = () => true;
Util2.returnFalse = () => false;
function stopPropagationCallback(e) {
e.stopPropagation();
}
Util2.stopPropagationCallback = stopPropagationCallback;
function addEventListener(elem, type, handler) {
if (elem.addEventListener != null) {
elem.addEventListener(type, handler);
}
}
Util2.addEventListener = addEventListener;
function removeEventListener(elem, type, handler) {
if (elem.removeEventListener != null) {
elem.removeEventListener(type, handler);
}
}
Util2.removeEventListener = removeEventListener;
})(Util || (Util = {}));
(function(Util2) {
const rNotHTMLWhite = /[^\x20\t\r\n\f]+/g;
const rNamespace = /^([^.]*)(?:\.(.+)|)/;
function splitType(types) {
return (types || "").match(rNotHTMLWhite) || [""];
}
Util2.splitType = splitType;
function normalizeType(type) {
const parts = rNamespace.exec(type) || [];
return {
originType: parts[1] ? parts[1].trim() : parts[1],
namespaces: parts[2] ? parts[2].split(".").map((ns2) => ns2.trim()).sort() : []
};
}
Util2.normalizeType = normalizeType;
function isValidTarget(target) {
return target.nodeType === 1 || target.nodeType === 9 || !+target.nodeType;
}
Util2.isValidTarget = isValidTarget;
function isValidSelector(elem, selector) {
if (selector) {
const node = elem;
return node.querySelector != null && node.querySelector(selector) != null;
}
return true;
}
Util2.isValidSelector = isValidSelector;
})(Util || (Util = {}));
(function(Util2) {
let seed = 0;
const cache = /* @__PURE__ */ new WeakMap();
function ensureHandlerId(handler) {
if (!cache.has(handler)) {
cache.set(handler, seed);
seed += 1;
}
return cache.get(handler);
}
Util2.ensureHandlerId = ensureHandlerId;
function getHandlerId(handler) {
return cache.get(handler);
}
Util2.getHandlerId = getHandlerId;
function removeHandlerId(handler) {
return cache.delete(handler);
}
Util2.removeHandlerId = removeHandlerId;
function setHandlerId(handler, id) {
return cache.set(handler, id);
}
Util2.setHandlerId = setHandlerId;
})(Util || (Util = {}));
(function(Util2) {
function getHandlerQueue(elem, event) {
const queue = [];
const store = Store.get(elem);
const bag = store && store.events && store.events[event.type];
const handlers = bag && bag.handlers || [];
const delegateCount = bag ? bag.delegateCount : 0;
if (delegateCount > 0 && // Support: Firefox <=42 - 66+
// Suppress spec-violating clicks indicating a non-primary pointer button (trac-3861)
// https://www.w3.org/TR/DOM-Level-3-Events/#event-type-click
// Support: IE 11+
// ...but not arrow key "clicks" of radio inputs, which can have `button` -1 (gh-2343)
!(event.type === "click" && typeof event.button === "number" && event.button >= 1)) {
for (let curr = event.target; curr !== elem; curr = curr.parentNode || elem) {
if (curr.nodeType === 1 && !(event.type === "click" && curr.disabled === true)) {
const matchedHandlers = [];
const matchedSelectors = {};
for (let i = 0; i < delegateCount; i += 1) {
const handleObj = handlers[i];
const selector = handleObj.selector;
if (selector != null && matchedSelectors[selector] == null) {
const node = elem;
const nodes = [];
node.querySelectorAll(selector).forEach((child) => {
nodes.push(child);
});
matchedSelectors[selector] = nodes.includes(curr);
}
if (matchedSelectors[selector]) {
matchedHandlers.push(handleObj);
}
}
if (matchedHandlers.length) {
queue.push({ elem: curr, handlers: matchedHandlers });
}
}
}
}
if (delegateCount < handlers.length) {
queue.push({ elem, handlers: handlers.slice(delegateCount) });
}
return queue;
}
Util2.getHandlerQueue = getHandlerQueue;
})(Util || (Util = {}));
(function(Util2) {
function isWindow(obj) {
return obj != null && obj === obj.window;
}
Util2.isWindow = isWindow;
})(Util || (Util = {}));
(function(Util2) {
function contains2(a, b) {
const adown = a.nodeType === 9 ? a.documentElement : a;
const bup = b && b.parentNode;
return a === bup || !!(bup && bup.nodeType === 1 && // Support: IE 9 - 11+
// IE doesn't have `contains` on SVG.
(adown.contains ? adown.contains(bup) : a.compareDocumentPosition && a.compareDocumentPosition(bup) & 16));
}
Util2.contains = contains2;
})(Util || (Util = {}));
}
});
// node_modules/@antv/x6-common/es/dom/event/object.js
var EventObject;
var init_object3 = __esm({
"node_modules/@antv/x6-common/es/dom/event/object.js"() {
init_util2();
EventObject = class {
constructor(e, props) {
this.isDefaultPrevented = Util.returnFalse;
this.isPropagationStopped = Util.returnFalse;
this.isImmediatePropagationStopped = Util.returnFalse;
this.isSimulated = false;
this.preventDefault = () => {
const e2 = this.originalEvent;
this.isDefaultPrevented = Util.returnTrue;
if (e2 && !this.isSimulated) {
e2.preventDefault();
}
};
this.stopPropagation = () => {
const e2 = this.originalEvent;
this.isPropagationStopped = Util.returnTrue;
if (e2 && !this.isSimulated) {
e2.stopPropagation();
}
};
this.stopImmediatePropagation = () => {
const e2 = this.originalEvent;
this.isImmediatePropagationStopped = Util.returnTrue;
if (e2 && !this.isSimulated) {
e2.stopImmediatePropagation();
}
this.stopPropagation();
};
if (typeof e === "string") {
this.type = e;
} else if (e.type) {
this.originalEvent = e;
this.type = e.type;
this.isDefaultPrevented = e.defaultPrevented ? Util.returnTrue : Util.returnFalse;
this.target = e.target;
this.currentTarget = e.currentTarget;
this.relatedTarget = e.relatedTarget;
this.timeStamp = e.timeStamp;
}
if (props) {
Object.assign(this, props);
}
if (!this.timeStamp) {
this.timeStamp = Date.now();
}
}
};
(function(EventObject2) {
function create(originalEvent) {
return originalEvent instanceof EventObject2 ? originalEvent : new EventObject2(originalEvent);
}
EventObject2.create = create;
})(EventObject || (EventObject = {}));
(function(EventObject2) {
function addProperty(name, hook) {
Object.defineProperty(EventObject2.prototype, name, {
enumerable: true,
configurable: true,
get: typeof hook === "function" ? (
// eslint-disable-next-line
function() {
if (this.originalEvent) {
return hook(this.originalEvent);
}
}
) : (
// eslint-disable-next-line
function() {
if (this.originalEvent) {
return this.originalEvent[name];
}
}
),
set(value) {
Object.defineProperty(this, name, {
enumerable: true,
configurable: true,
writable: true,
value
});
}
});
}
EventObject2.addProperty = addProperty;
})(EventObject || (EventObject = {}));
(function(EventObject2) {
const commonProps = {
bubbles: true,
cancelable: true,
eventPhase: true,
detail: true,
view: true,
button: true,
buttons: true,
clientX: true,
clientY: true,
offsetX: true,
offsetY: true,
pageX: true,
pageY: true,
screenX: true,
screenY: true,
toElement: true,
pointerId: true,
pointerType: true,
char: true,
code: true,
charCode: true,
key: true,
keyCode: true,
touches: true,
changedTouches: true,
targetTouches: true,
which: true,
altKey: true,
ctrlKey: true,
metaKey: true,
shiftKey: true
};
Object.keys(commonProps).forEach((name) => EventObject2.addProperty(name, commonProps[name]));
})(EventObject || (EventObject = {}));
}
});
// node_modules/@antv/x6-common/es/dom/event/special.js
var Special;
var init_special = __esm({
"node_modules/@antv/x6-common/es/dom/event/special.js"() {
init_hook();
init_util2();
(function(Special2) {
EventHook.register("load", {
noBubble: true
});
})(Special || (Special = {}));
(function(Special2) {
EventHook.register("beforeunload", {
postDispatch(elem, event) {
if (event.result !== void 0 && event.originalEvent) {
event.originalEvent.returnValue = event.result;
}
}
});
})(Special || (Special = {}));
(function(Special2) {
EventHook.register("mouseenter", {
delegateType: "mouseover",
bindType: "mouseover",
handle(target, event) {
let ret;
const related = event.relatedTarget;
const handleObj = event.handleObj;
if (!related || related !== target && !Util.contains(target, related)) {
event.type = handleObj.originType;
ret = handleObj.handler.call(target, event);
event.type = "mouseover";
}
return ret;
}
});
EventHook.register("mouseleave", {
delegateType: "mouseout",
bindType: "mouseout",
handle(target, event) {
let ret;
const related = event.relatedTarget;
const handleObj = event.handleObj;
if (!related || related !== target && !Util.contains(target, related)) {
event.type = handleObj.originType;
ret = handleObj.handler.call(target, event);
event.type = "mouseout";
}
return ret;
}
});
})(Special || (Special = {}));
}
});
// node_modules/@antv/x6-common/es/dom/event/core.js
var __rest, Core;
var init_core = __esm({
"node_modules/@antv/x6-common/es/dom/event/core.js"() {
init_util2();
init_hook();
init_store();
init_object3();
init_special();
__rest = function(s, e) {
var t = {};
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
t[p] = s[p];
if (s != null && typeof Object.getOwnPropertySymbols === "function")
for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
t[p[i]] = s[p[i]];
}
return t;
};
(function(Core2) {
let triggered;
function on(elem, types, handler, data2, selector) {
if (!Util.isValidTarget(elem)) {
return;
}
let handlerData;
if (typeof handler !== "function") {
const { handler: h, selector: s } = handler, others = __rest(handler, ["handler", "selector"]);
handler = h;
selector = s;
handlerData = others;
}
const store = Store.ensure(elem);
let mainHandler = store.handler;
if (mainHandler == null) {
mainHandler = store.handler = function(e, ...args) {
return triggered !== e.type ? dispatch(elem, e, ...args) : void 0;
};
}
const guid = Util.ensureHandlerId(handler);
Util.splitType(types).forEach((item) => {
const { originType, namespaces } = Util.normalizeType(item);
if (!originType) {
return;
}
let type = originType;
let hook = EventHook.get(type);
type = (selector ? hook.delegateType : hook.bindType) || type;
hook = EventHook.get(type);
const handleObj = Object.assign({
type,
originType,
data: data2,
selector,
guid,
handler,
namespace: namespaces.join(".")
}, handlerData);
const events = store.events;
let bag = events[type];
if (!bag) {
bag = events[type] = { handlers: [], delegateCount: 0 };
if (!hook.setup || hook.setup(elem, data2, namespaces, mainHandler) === false) {
Util.addEventListener(elem, type, mainHandler);
}
}
if (hook.add) {
Util.removeHandlerId(handleObj.handler);
hook.add(elem, handleObj);
Util.setHandlerId(handleObj.handler, guid);
}
if (selector) {
bag.handlers.splice(bag.delegateCount, 0, handleObj);
bag.delegateCount += 1;
} else {
bag.handlers.push(handleObj);
}
});
}
Core2.on = on;
function off(elem, types, handler, selector, mappedTypes) {
const store = Store.get(elem);
if (!store) {
return;
}
const events = store.events;
if (!events) {
return;
}
Util.splitType(types).forEach((item) => {
const { originType, namespaces } = Util.normalizeType(item);
if (!originType) {
Object.keys(events).forEach((key) => {
off(elem, key + item, handler, selector, true);
});
return;
}
let type = originType;
const hook = EventHook.get(type);
type = (selector ? hook.delegateType : hook.bindType) || type;
const bag = events[type];
if (!bag) {
return;
}
const rns = namespaces.length > 0 ? new RegExp(`(^|\\.)${namespaces.join("\\.(?:.*\\.|)")}(\\.|$)`) : null;
const originHandlerCount = bag.handlers.length;
for (let i = bag.handlers.length - 1; i >= 0; i -= 1) {
const handleObj = bag.handlers[i];
if ((mappedTypes || originType === handleObj.originType) && (!handler || Util.getHandlerId(handler) === handleObj.guid) && (rns == null || handleObj.namespace && rns.test(handleObj.namespace)) && (selector == null || selector === handleObj.selector || selector === "**" && handleObj.selector)) {
bag.handlers.splice(i, 1);
if (handleObj.selector) {
bag.delegateCount -= 1;
}
if (hook.remove) {
hook.remove(elem, handleObj);
}
}
}
if (originHandlerCount && bag.handlers.length === 0) {
if (!hook.teardown || hook.teardown(elem, namespaces, store.handler) === false) {
Util.removeEventListener(elem, type, store.handler);
}
delete events[type];
}
});
if (Object.keys(events).length === 0) {
Store.remove(elem);
}
}
Core2.off = off;
function dispatch(elem, evt, ...args) {
const event = EventObject.create(evt);
event.delegateTarget = elem;
const hook = EventHook.get(event.type);
if (hook.preDispatch && hook.preDispatch(elem, event) === false) {
return;
}
const handlerQueue = Util.getHandlerQueue(elem, event);
for (let i = 0, l = handlerQueue.length; i < l && !event.isPropagationStopped(); i += 1) {
const matched = handlerQueue[i];
event.currentTarget = matched.elem;
for (let j = 0, k = matched.handlers.length; j < k && !event.isImmediatePropagationStopped(); j += 1) {
const handleObj = matched.handlers[j];
if (event.rnamespace == null || handleObj.namespace && event.rnamespace.test(handleObj.namespace)) {
event.handleObj = handleObj;
event.data = handleObj.data;
const hookHandle = EventHook.get(handleObj.originType).handle;
const result = hookHandle ? hookHandle(matched.elem, event, ...args) : handleObj.handler.call(matched.elem, event, ...args);
if (result !== void 0) {
event.result = result;
if (result === false) {
event.preventDefault();
event.stopPropagation();
}
}
}
}
}
if (hook.postDispatch) {
hook.postDispatch(elem, event);
}
return event.result;
}
Core2.dispatch = dispatch;
function trigger(event, eventArgs, elem, onlyHandlers) {
let eventObj = event;
let type = typeof event === "string" ? event : event.type;
let namespaces = typeof event === "string" || eventObj.namespace == null ? [] : eventObj.namespace.split(".");
const node = elem;
if (node.nodeType === 3 || node.nodeType === 8) {
return;
}
if (type.indexOf(".") > -1) {
namespaces = type.split(".");
type = namespaces.shift();
namespaces.sort();
}
const ontype = type.indexOf(":") < 0 && `on${type}`;
eventObj = event instanceof EventObject ? event : new EventObject(type, typeof event === "object" ? event : null);
eventObj.namespace = namespaces.join(".");
eventObj.rnamespace = eventObj.namespace ? new RegExp(`(^|\\.)${namespaces.join("\\.(?:.*\\.|)")}(\\.|$)`) : null;
eventObj.result = void 0;
if (!eventObj.target) {
eventObj.target = node;
}
const args = [eventObj];
if (Array.isArray(eventArgs)) {
args.push(...eventArgs);
} else {
args.push(eventArgs);
}
const hook = EventHook.get(type);
if (!onlyHandlers && hook.trigger && hook.trigger(node, eventObj, eventArgs) === false) {
return;
}
let bubbleType;
const eventPath = [node];
if (!onlyHandlers && !hook.noBubble && !Util.isWindow(node)) {
bubbleType = hook.delegateType || type;
let last = node;
let curr = node.parentNode;
while (curr != null) {
eventPath.push(curr);
last = curr;
curr = curr.parentNode;
}
const doc = node.ownerDocument || document;
if (last === doc) {
const win = last.defaultView || last.parentWindow || window;
eventPath.push(win);
}
}
let lastElement = node;
for (let i = 0, l = eventPath.length; i < l && !eventObj.isPropagationStopped(); i += 1) {
const currElement = eventPath[i];
lastElement = currElement;
eventObj.type = i > 1 ? bubbleType : hook.bindType || type;
const store = Store.get(currElement);
if (store) {
if (store.events[eventObj.type] && store.handler) {
store.handler.call(currElement, ...args);
}
}
const handle = ontype && currElement[ontype] || null;
if (handle && Util.isValidTarget(currElement)) {
eventObj.result = handle.call(currElement, ...args);
if (eventObj.result === false) {
eventObj.preventDefault();
}
}
}
eventObj.type = type;
if (!onlyHandlers && !eventObj.isDefaultPrevented()) {
const preventDefault = hook.preventDefault;
if ((preventDefault == null || preventDefault(eventPath.pop(), eventObj, eventArgs) === false) && Util.isValidTarget(node)) {
if (ontype && typeof node[type] === "function" && !Util.isWindow(node)) {
const tmp = node[ontype];
if (tmp) {
node[ontype] = null;
}
triggered = type;
if (eventObj.isPropagationStopped()) {
lastElement.addEventListener(type, Util.stopPropagationCallback);
}
node[type]();
if (eventObj.isPropagationStopped()) {
lastElement.removeEventListener(type, Util.stopPropagationCallback);
}
triggered = void 0;
if (tmp) {
node[ontype] = tmp;
}
}
}
}
return eventObj.result;
}
Core2.trigger = trigger;
})(Core || (Core = {}));
}
});
// node_modules/@antv/x6-common/es/dom/event/main.js
var Event, Private;
var init_main3 = __esm({
"node_modules/@antv/x6-common/es/dom/event/main.js"() {
init_core();
init_util2();
(function(Event2) {
function on(elem, events, selector, data2, handler) {
Private.on(elem, events, selector, data2, handler);
return elem;
}
Event2.on = on;
function once(elem, events, selector, data2, handler) {
Private.on(elem, events, selector, data2, handler, true);
return elem;
}
Event2.once = once;
function off(elem, events, selector, handler) {
Private.off(elem, events, selector, handler);
return elem;
}
Event2.off = off;
function trigger(elem, event, args, onlyHandlers) {
Core.trigger(event, args, elem, onlyHandlers);
return elem;
}
Event2.trigger = trigger;
})(Event || (Event = {}));
(function(Private2) {
function on(elem, types, selector, data2, fn, once) {
if (typeof types === "object") {
if (typeof selector !== "string") {
data2 = data2 || selector;
selector = void 0;
}
Object.keys(types).forEach((type) => on(elem, type, selector, data2, types[type], once));
return;
}
if (data2 == null && fn == null) {
fn = selector;
data2 = selector = void 0;
} else if (fn == null) {
if (typeof selector === "string") {
fn = data2;
data2 = void 0;
} else {
fn = data2;
data2 = selector;
selector = void 0;
}
}
if (fn === false) {
fn = Util.returnFalse;
} else if (!fn) {
return;
}
if (once) {
const originHandler = fn;
fn = function(event, ...args) {
Private2.off(elem, event);
return originHandler.call(this, event, ...args);
};
Util.setHandlerId(fn, Util.ensureHandlerId(originHandler));
}
Core.on(elem, types, fn, data2, selector);
}
Private2.on = on;
function off(elem, events, selector, fn) {
const evt = events;
if (evt && evt.preventDefault != null && evt.handleObj != null) {
const obj = evt.handleObj;
off(evt.delegateTarget, obj.namespace ? `${obj.originType}.${obj.namespace}` : obj.originType, obj.selector, obj.handler);
return;
}
if (typeof events === "object") {
const types = events;
Object.keys(types).forEach((type) => off(elem, type, selector, types[type]));
return;
}
if (selector === false || typeof selector === "function") {
fn = selector;
selector = void 0;
}
if (fn === false) {
fn = Util.returnFalse;
}
Core.off(elem, events, fn, selector);
}
Private2.off = off;
})(Private || (Private = {}));
}
});
// node_modules/@antv/x6-common/es/dom/event/types.js
var init_types = __esm({
"node_modules/@antv/x6-common/es/dom/event/types.js"() {
}
});
// node_modules/@antv/x6-common/es/dom/event/index.js
var init_event2 = __esm({
"node_modules/@antv/x6-common/es/dom/event/index.js"() {
init_hook();
init_main3();
init_object3();
init_types();
}
});
// node_modules/@antv/x6-common/es/dom/mousewheel.js
var MouseWheelHandle;
var init_mousewheel = __esm({
"node_modules/@antv/x6-common/es/dom/mousewheel.js"() {
init_platform();
MouseWheelHandle = class {
constructor(target, onWheelCallback, onWheelGuard) {
this.animationFrameId = 0;
this.deltaX = 0;
this.deltaY = 0;
this.eventName = Platform.isEventSupported("wheel") ? "wheel" : "mousewheel";
this.target = target;
this.onWheelCallback = onWheelCallback;
this.onWheelGuard = onWheelGuard;
this.onWheel = this.onWheel.bind(this);
this.didWheel = this.didWheel.bind(this);
}
enable() {
this.target.addEventListener(this.eventName, this.onWheel, {
passive: false
});
}
disable() {
this.target.removeEventListener(this.eventName, this.onWheel);
}
onWheel(e) {
if (this.onWheelGuard != null && !this.onWheelGuard(e)) {
return;
}
this.deltaX += e.deltaX;
this.deltaY += e.deltaY;
e.preventDefault();
let changed;
if (this.deltaX !== 0 || this.deltaY !== 0) {
e.stopPropagation();
changed = true;
}
if (changed === true && this.animationFrameId === 0) {
this.animationFrameId = requestAnimationFrame(() => {
this.didWheel(e);
});
}
}
didWheel(e) {
this.animationFrameId = 0;
this.onWheelCallback(e, this.deltaX, this.deltaY);
this.deltaX = 0;
this.deltaY = 0;
}
};
}
});
// node_modules/@antv/x6-common/es/dom/position.js
function offset(elem) {
const rect = elem.getBoundingClientRect();
const win = elem.ownerDocument.defaultView;
return {
top: rect.top + win.pageYOffset,
left: rect.left + win.pageXOffset
};
}
function width(elem) {
const rect = elem.getBoundingClientRect();
return rect.width;
}
function height(elem) {
const rect = elem.getBoundingClientRect();
return rect.height;
}
function position(elem) {
const isFixed = computeStyle(elem, "position") === "fixed";
let offsetValue;
if (isFixed) {
const rect = elem.getBoundingClientRect();
offsetValue = { left: rect.left, top: rect.top };
} else {
offsetValue = offset(elem);
}
if (!isFixed) {
const doc = elem.ownerDocument;
let offsetParent = elem.offsetParent || doc.documentElement;
while ((offsetParent === doc.body || offsetParent === doc.documentElement) && computeStyle(offsetParent, "position") === "static") {
offsetParent = offsetParent.parentNode;
}
if (offsetParent !== elem && isElement(offsetParent)) {
const parentOffset = offset(offsetParent);
offsetValue.top -= parentOffset.top + computeStyleInt(offsetParent, "borderTopWidth");
offsetValue.left -= parentOffset.left + computeStyleInt(offsetParent, "borderLeftWidth");
}
}
return {
top: offsetValue.top - computeStyleInt(elem, "marginTop"),
left: offsetValue.left - computeStyleInt(elem, "marginLeft")
};
}
var init_position = __esm({
"node_modules/@antv/x6-common/es/dom/position.js"() {
init_css();
init_elem();
}
});
// node_modules/@antv/x6-common/es/dom/main.js
var main_exports3 = {};
__export(main_exports3, {
CASE_SENSITIVE_ATTR: () => CASE_SENSITIVE_ATTR,
Event: () => Event,
EventHook: () => EventHook,
EventObject: () => EventObject,
KAPPA: () => KAPPA,
MouseWheelHandle: () => MouseWheelHandle,
addClass: () => addClass,
after: () => after,
append: () => append,
appendTo: () => appendTo,
attr: () => attr,
before: () => before,
breakText: () => breakText,
children: () => children,
circleToPathData: () => circleToPathData,
clearSelection: () => clearSelection,
computeStyle: () => computeStyle,
computeStyleInt: () => computeStyleInt,
contains: () => contains,
createElement: () => createElement,
createElementNS: () => createElementNS,
createSVGMatrix: () => createSVGMatrix,
createSVGPoint: () => createSVGPoint,
createSVGTransform: () => createSVGTransform,
createSlicePathData: () => createSlicePathData,
createSvgDocument: () => createSvgDocument,
createSvgElement: () => createSvgElement,
css: () => css,
data: () => data,
decomposeMatrix: () => decomposeMatrix,
ellipseToPathData: () => ellipseToPathData,
empty: () => empty,
ensureId: () => ensureId,
find: () => find,
findOne: () => findOne,
findParentByClass: () => findParentByClass,
getAttribute: () => getAttribute,
getClass: () => getClass,
getComputedStyle: () => getComputedStyle2,
getData: () => getData,
getPointsFromSvgElement: () => getPointsFromSvgElement,
getTransformToElement: () => getTransformToElement,
getTransformToParentElement: () => getTransformToParentElement,
getVendorPrefixedName: () => getVendorPrefixedName,
hasClass: () => hasClass,
hasScrollbars: () => hasScrollbars,
height: () => height,
index: () => index,
isCSSVariable: () => isCSSVariable,
isElement: () => isElement,
isHTMLElement: () => isHTMLElement,
isSVGGraphicsElement: () => isSVGGraphicsElement,
kebablizeAttrs: () => kebablizeAttrs,
lineToPathData: () => lineToPathData,
matrixToRotation: () => matrixToRotation,
matrixToScale: () => matrixToScale,
matrixToTransformString: () => matrixToTransformString,
matrixToTranslation: () => matrixToTranslation,
measureText: () => measureText,
mergeAttrs: () => mergeAttrs,
ns: () => ns,
offset: () => offset,
parseTransformString: () => parseTransformString,
parseXML: () => parseXML,
polygonToPathData: () => polygonToPathData,
polylineToPathData: () => polylineToPathData,
position: () => position,
prepend: () => prepend,
prop: () => prop,
qualifyAttr: () => qualifyAttr,
rectToPathData: () => rectToPathData,
rectangleToPathData: () => rectangleToPathData,
remove: () => remove,
removeAttribute: () => removeAttribute,
removeClass: () => removeClass,
rotate: () => rotate,
sample: () => sample,
scale: () => scale,
setAttribute: () => setAttribute,
setAttributes: () => setAttributes,
setData: () => setData,
setPrefixedStyle: () => setPrefixedStyle,
splitTextByLength: () => splitTextByLength,
styleToObject: () => styleToObject,
svgVersion: () => svgVersion,
tagName: () => tagName,
text: () => text,
toLocalPoint: () => toLocalPoint,
toPath: () => toPath,
toPathData: () => toPathData,
toggleClass: () => toggleClass,
transform: () => transform,
transformStringToMatrix: () => transformStringToMatrix,
translate: () => translate,
uniqueId: () => uniqueId,
width: () => width
});
var init_main4 = __esm({
"node_modules/@antv/x6-common/es/dom/main.js"() {
init_attr();
init_elem();
init_class();
init_style();
init_prefix();
init_selection();
init_css();
init_data();
init_prop();
init_text2();
init_path();
init_matrix();
init_transform();
init_event2();
init_mousewheel();
init_position();
}
});
// node_modules/@antv/x6-common/es/vector/index.js
var Vector;
var init_vector = __esm({
"node_modules/@antv/x6-common/es/vector/index.js"() {
init_main4();
Vector = class _Vector {
get [Symbol.toStringTag]() {
return _Vector.toStringTag;
}
get type() {
return this.node.nodeName;
}
get id() {
return this.node.id;
}
set id(id) {
this.node.id = id;
}
constructor(elem, attrs, children2) {
if (!elem) {
throw new TypeError("Invalid element to create vector");
}
let node;
if (_Vector.isVector(elem)) {
node = elem.node;
} else if (typeof elem === "string") {
if (elem.toLowerCase() === "svg") {
node = createSvgDocument();
} else if (elem[0] === "<") {
const doc = createSvgDocument(elem);
node = document.importNode(doc.firstChild, true);
} else {
node = document.createElementNS(ns.svg, elem);
}
} else {
node = elem;
}
this.node = node;
if (attrs) {
this.setAttributes(attrs);
}
if (children2) {
this.append(children2);
}
}
transform(matrix, options) {
if (matrix == null) {
return transform(this.node);
}
transform(this.node, matrix, options);
return this;
}
translate(tx, ty = 0, options = {}) {
if (tx == null) {
return translate(this.node);
}
translate(this.node, tx, ty, options);
return this;
}
rotate(angle, cx, cy, options = {}) {
if (angle == null) {
return rotate(this.node);
}
rotate(this.node, angle, cx, cy, options);
return this;
}
scale(sx, sy) {
if (sx == null) {
return scale(this.node);
}
scale(this.node, sx, sy);
return this;
}
/**
* Returns an SVGMatrix that specifies the transformation necessary
* to convert this coordinate system into `target` coordinate system.
*/
getTransformToElement(target) {
const ref = _Vector.toNode(target);
return getTransformToElement(this.node, ref);
}
removeAttribute(name) {
removeAttribute(this.node, name);
return this;
}
getAttribute(name) {
return getAttribute(this.node, name);
}
setAttribute(name, value) {
setAttribute(this.node, name, value);
return this;
}
setAttributes(attrs) {
setAttributes(this.node, attrs);
return this;
}
attr(name, value) {
if (name == null) {
return attr(this.node);
}
if (typeof name === "string" && value === void 0) {
return attr(this.node, name);
}
if (typeof name === "object") {
attr(this.node, name);
} else {
attr(this.node, name, value);
}
return this;
}
svg() {
return this.node instanceof SVGSVGElement ? this : _Vector.create(this.node.ownerSVGElement);
}
defs() {
const context = this.svg() || this;
const defsNode = context.node.getElementsByTagName("defs")[0];
if (defsNode) {
return _Vector.create(defsNode);
}
return _Vector.create("defs").appendTo(context);
}
text(content, options = {}) {
text(this.node, content, options);
return this;
}
tagName() {
return tagName(this.node);
}
clone() {
return _Vector.create(this.node.cloneNode(true));
}
remove() {
remove(this.node);
return this;
}
empty() {
empty(this.node);
return this;
}
append(elems) {
append(this.node, _Vector.toNodes(elems));
return this;
}
appendTo(target) {
appendTo(this.node, _Vector.isVector(target) ? target.node : target);
return this;
}
prepend(elems) {
prepend(this.node, _Vector.toNodes(elems));
return this;
}
before(elems) {
before(this.node, _Vector.toNodes(elems));
return this;
}
replace(elem) {
if (this.node.parentNode) {
this.node.parentNode.replaceChild(_Vector.toNode(elem), this.node);
}
return _Vector.create(elem);
}
first() {
return this.node.firstChild ? _Vector.create(this.node.firstChild) : null;
}
last() {
return this.node.lastChild ? _Vector.create(this.node.lastChild) : null;
}
get(index2) {
const child = this.node.childNodes[index2];
return child ? _Vector.create(child) : null;
}
indexOf(elem) {
const children2 = Array.prototype.slice.call(this.node.childNodes);
return children2.indexOf(_Vector.toNode(elem));
}
find(selector) {
const vels = [];
const nodes = find(this.node, selector);
if (nodes) {
for (let i = 0, ii = nodes.length; i < ii; i += 1) {
vels.push(_Vector.create(nodes[i]));
}
}
return vels;
}
findOne(selector) {
const found = findOne(this.node, selector);
return found ? _Vector.create(found) : null;
}
findParentByClass(className, terminator) {
const node = findParentByClass(this.node, className, terminator);
return node ? _Vector.create(node) : null;
}
matches(selector) {
const node = this.node;
const matches = this.node.matches;
const matcher = node.matches || node.matchesSelector || node.msMatchesSelector || node.mozMatchesSelector || node.webkitMatchesSelector || node.oMatchesSelector || null;
return matcher && matcher.call(node, selector);
}
contains(child) {
return contains(this.node, _Vector.isVector(child) ? child.node : child);
}
wrap(node) {
const vel = _Vector.create(node);
const parentNode = this.node.parentNode;
if (parentNode != null) {
parentNode.insertBefore(vel.node, this.node);
}
return vel.append(this);
}
parent(type) {
let parent = this;
if (parent.node.parentNode == null) {
return null;
}
parent = _Vector.create(parent.node.parentNode);
if (type == null) {
return parent;
}
do {
if (typeof type === "string" ? parent.matches(type) : parent instanceof type) {
return parent;
}
} while (parent = _Vector.create(parent.node.parentNode));
return parent;
}
children() {
const children2 = this.node.childNodes;
const vels = [];
for (let i = 0; i < children2.length; i += 1) {
const currentChild = children2[i];
if (currentChild.nodeType === 1) {
vels.push(_Vector.create(children2[i]));
}
}
return vels;
}
eachChild(fn, deep) {
const children2 = this.children();
for (let i = 0, l = children2.length; i < l; i += 1) {
fn.call(children2[i], children2[i], i, children2);
if (deep) {
children2[i].eachChild(fn, deep);
}
}
return this;
}
index() {
return index(this.node);
}
hasClass(className) {
return hasClass(this.node, className);
}
addClass(className) {
addClass(this.node, className);
return this;
}
removeClass(className) {
removeClass(this.node, className);
return this;
}
toggleClass(className, stateVal) {
toggleClass(this.node, className, stateVal);
return this;
}
toLocalPoint(x, y) {
return toLocalPoint(this.node, x, y);
}
/**
* Samples the underlying SVG element (it currently works only on
* paths - where it is most useful anyway). Returns an array of objects
* of the form `{ x: Number, y: Number, distance: Number }`. Each of these
* objects represent a point on the path. This basically creates a discrete
* representation of the path (which is possible a curve). The sampling
* interval defines the accuracy of the sampling. In other words, we travel
* from the beginning of the path to the end by interval distance (on the
* path, not between the resulting points) and collect the discrete points
* on the path. This is very useful in many situations. For example, SVG
* does not provide a built-in mechanism to find intersections between two
* paths. Using sampling, we can just generate bunch of points for each of
* the path and find the closest ones from each set.
*/
sample(interval = 1) {
if (this.node instanceof SVGPathElement) {
return sample(this.node, interval);
}
return [];
}
toPath() {
return _Vector.create(toPath(this.node));
}
toPathData() {
return toPathData(this.node);
}
};
(function(Vector2) {
Vector2.toStringTag = `X6.${Vector2.name}`;
function isVector(instance) {
if (instance == null) {
return false;
}
if (instance instanceof Vector2) {
return true;
}
const tag = instance[Symbol.toStringTag];
const vector = instance;
if ((tag == null || tag === Vector2.toStringTag) && vector.node instanceof SVGElement && typeof vector.sample === "function" && typeof vector.toPath === "function") {
return true;
}
return false;
}
Vector2.isVector = isVector;
function create(elem, attrs, children2) {
return new Vector2(elem, attrs, children2);
}
Vector2.create = create;
function createVectors(markup) {
if (markup[0] === "<") {
const svgDoc = createSvgDocument(markup);
const vels = [];
for (let i = 0, ii = svgDoc.childNodes.length; i < ii; i += 1) {
const childNode = svgDoc.childNodes[i];
vels.push(create(document.importNode(childNode, true)));
}
return vels;
}
return [create(markup)];
}
Vector2.createVectors = createVectors;
function toNode(elem) {
if (isVector(elem)) {
return elem.node;
}
return elem;
}
Vector2.toNode = toNode;
function toNodes(elems) {
if (Array.isArray(elems)) {
return elems.map((elem) => toNode(elem));
}
return [toNode(elems)];
}
Vector2.toNodes = toNodes;
})(Vector || (Vector = {}));
}
});
// node_modules/@antv/x6-common/es/dom/index.js
var init_dom = __esm({
"node_modules/@antv/x6-common/es/dom/index.js"() {
init_main4();
}
});
// node_modules/@antv/x6-common/es/size-sensor/sensors/util.js
function debounce(fn, delay = 60) {
let timer = null;
return (...args) => {
if (timer) {
clearTimeout(timer);
}
timer = window.setTimeout(() => {
fn.apply(this, args);
}, delay);
};
}
var init_util3 = __esm({
"node_modules/@antv/x6-common/es/size-sensor/sensors/util.js"() {
}
});
// node_modules/@antv/x6-common/es/size-sensor/sensors/object.js
function createSensor(element) {
let sensor = null;
let listeners = [];
const create = () => {
if (getComputedStyle(element).position === "static") {
const style = element.style;
style.position = "relative";
}
const obj = document.createElement("object");
obj.onload = () => {
obj.contentDocument.defaultView.addEventListener("resize", trigger);
trigger();
};
obj.style.display = "block";
obj.style.position = "absolute";
obj.style.top = "0";
obj.style.left = "0";
obj.style.height = "100%";
obj.style.width = "100%";
obj.style.overflow = "hidden";
obj.style.pointerEvents = "none";
obj.style.zIndex = "-1";
obj.style.opacity = "0";
obj.setAttribute("tabindex", "-1");
obj.type = "text/html";
element.appendChild(obj);
obj.data = "about:blank";
return obj;
};
const trigger = debounce(() => {
listeners.forEach((listener) => listener(element));
});
const bind = (listener) => {
if (!sensor) {
sensor = create();
}
if (listeners.indexOf(listener) === -1) {
listeners.push(listener);
}
};
const destroy = () => {
if (sensor && sensor.parentNode) {
if (sensor.contentDocument) {
sensor.contentDocument.defaultView.removeEventListener("resize", trigger);
}
sensor.parentNode.removeChild(sensor);
sensor = null;
listeners = [];
}
};
const unbind = (listener) => {
const idx = listeners.indexOf(listener);
if (idx !== -1) {
listeners.splice(idx, 1);
}
if (listeners.length === 0 && sensor) {
destroy();
}
};
return {
element,
bind,
destroy,
unbind
};
}
var init_object4 = __esm({
"node_modules/@antv/x6-common/es/size-sensor/sensors/object.js"() {
init_util3();
}
});
// node_modules/@antv/x6-common/es/size-sensor/sensors/observer.js
function createSensor2(element) {
let sensor = null;
let listeners = [];
const trigger = debounce(() => {
listeners.forEach((listener) => {
listener(element);
});
});
const create = () => {
const s = new ResizeObserver(trigger);
s.observe(element);
trigger();
return s;
};
const bind = (listener) => {
if (!sensor) {
sensor = create();
}
if (listeners.indexOf(listener) === -1) {
listeners.push(listener);
}
};
const destroy = () => {
if (sensor) {
sensor.disconnect();
listeners = [];
sensor = null;
}
};
const unbind = (listener) => {
const idx = listeners.indexOf(listener);
if (idx !== -1) {
listeners.splice(idx, 1);
}
if (listeners.length === 0 && sensor) {
destroy();
}
};
return {
element,
bind,
destroy,
unbind
};
}
var init_observer = __esm({
"node_modules/@antv/x6-common/es/size-sensor/sensors/observer.js"() {
init_util3();
}
});
// node_modules/@antv/x6-common/es/size-sensor/sensors/index.js
var createSensor3;
var init_sensors = __esm({
"node_modules/@antv/x6-common/es/size-sensor/sensors/index.js"() {
init_object4();
init_observer();
createSensor3 = typeof ResizeObserver !== "undefined" ? createSensor2 : createSensor;
}
});
// node_modules/@antv/x6-common/es/size-sensor/index.js
var SizeSensor;
var init_size_sensor = __esm({
"node_modules/@antv/x6-common/es/size-sensor/index.js"() {
init_sensors();
(function(SizeSensor2) {
const cache = /* @__PURE__ */ new WeakMap();
function get(element) {
let sensor = cache.get(element);
if (sensor) {
return sensor;
}
sensor = createSensor3(element);
cache.set(element, sensor);
return sensor;
}
function remove2(sensor) {
sensor.destroy();
cache.delete(sensor.element);
}
SizeSensor2.bind = (element, cb) => {
const sensor = get(element);
sensor.bind(cb);
return () => sensor.unbind(cb);
};
SizeSensor2.clear = (element) => {
const sensor = get(element);
remove2(sensor);
};
})(SizeSensor || (SizeSensor = {}));
}
});
// node_modules/@antv/x6-common/es/algorithm/priorityqueue.js
var PriorityQueue;
var init_priorityqueue = __esm({
"node_modules/@antv/x6-common/es/algorithm/priorityqueue.js"() {
PriorityQueue = class _PriorityQueue {
constructor(options = {}) {
this.comparator = options.comparator || _PriorityQueue.defaultComparator;
this.index = {};
this.data = options.data || [];
this.heapify();
}
/**
* Returns `true` if the priority queue is empty, `false` otherwise.
*/
isEmpty() {
return this.data.length === 0;
}
/**
* Inserts a value with priority to the queue. Optionally pass a unique
* id of this item. Passing unique IDs for each item you insert allows
* you to use the `updatePriority()` operation.
* @param priority
* @param value
* @param id
*/
insert(priority, value, id) {
const item = { priority, value };
const index2 = this.data.length;
if (id) {
item.id = id;
this.index[id] = index2;
}
this.data.push(item);
this.bubbleUp(index2);
return this;
}
/**
* Returns the value of an item with the highest priority.
*/
peek() {
return this.data[0] ? this.data[0].value : null;
}
/**
* Returns the highest priority in the queue.
*/
peekPriority() {
return this.data[0] ? this.data[0].priority : null;
}
updatePriority(id, priority) {
const index2 = this.index[id];
if (typeof index2 === "undefined") {
throw new Error(`Node with id '${id}' was not found in the heap.`);
}
const data2 = this.data;
const oldPriority = data2[index2].priority;
const comp = this.comparator(priority, oldPriority);
if (comp < 0) {
data2[index2].priority = priority;
this.bubbleUp(index2);
} else if (comp > 0) {
data2[index2].priority = priority;
this.bubbleDown(index2);
}
}
/**
* Removes the item with the highest priority from the queue
*
* @returns The value of the removed item.
*/
remove() {
const data2 = this.data;
const peek = data2[0];
const last = data2.pop();
if (peek.id) {
delete this.index[peek.id];
}
if (data2.length > 0) {
data2[0] = last;
if (last.id) {
this.index[last.id] = 0;
}
this.bubbleDown(0);
}
return peek ? peek.value : null;
}
heapify() {
for (let i = 0; i < this.data.length; i += 1) {
this.bubbleUp(i);
}
}
bubbleUp(index2) {
const data2 = this.data;
let tmp;
let parent;
let current = index2;
while (current > 0) {
parent = current - 1 >>> 1;
if (this.comparator(data2[current].priority, data2[parent].priority) < 0) {
tmp = data2[parent];
data2[parent] = data2[current];
let id = data2[current].id;
if (id != null) {
this.index[id] = parent;
}
data2[current] = tmp;
id = data2[current].id;
if (id != null) {
this.index[id] = current;
}
current = parent;
} else {
break;
}
}
}
bubbleDown(index2) {
const data2 = this.data;
const last = data2.length - 1;
let current = index2;
while (true) {
const left = (current << 1) + 1;
const right = left + 1;
let minIndex = current;
if (left <= last && this.comparator(data2[left].priority, data2[minIndex].priority) < 0) {
minIndex = left;
}
if (right <= last && this.comparator(data2[right].priority, data2[minIndex].priority) < 0) {
minIndex = right;
}
if (minIndex !== current) {
const tmp = data2[minIndex];
data2[minIndex] = data2[current];
let id = data2[current].id;
if (id != null) {
this.index[id] = minIndex;
}
data2[current] = tmp;
id = data2[current].id;
if (id != null) {
this.index[id] = current;
}
current = minIndex;
} else {
break;
}
}
}
};
(function(PriorityQueue2) {
PriorityQueue2.defaultComparator = (a, b) => a - b;
})(PriorityQueue || (PriorityQueue = {}));
}
});
// node_modules/@antv/x6-common/es/algorithm/dijkstra.js
var Dijkstra;
var init_dijkstra = __esm({
"node_modules/@antv/x6-common/es/algorithm/dijkstra.js"() {
init_priorityqueue();
(function(Dijkstra2) {
function run(adjacencyList, source, weight = (u, v) => 1) {
const dist = {};
const previous = {};
const scanned = {};
const queue = new PriorityQueue();
dist[source] = 0;
Object.keys(adjacencyList).forEach((v) => {
if (v !== source) {
dist[v] = Infinity;
}
queue.insert(dist[v], v, v);
});
while (!queue.isEmpty()) {
const u = queue.remove();
scanned[u] = true;
const neighbours = adjacencyList[u] || [];
for (let i = 0; i < neighbours.length; i += 1) {
const v = neighbours[i];
if (!scanned[v]) {
const alt = dist[u] + weight(u, v);
if (alt < dist[v]) {
dist[v] = alt;
previous[v] = u;
queue.updatePriority(v, alt);
}
}
}
}
return previous;
}
Dijkstra2.run = run;
})(Dijkstra || (Dijkstra = {}));
}
});
// node_modules/@antv/x6-common/es/color/index.js
var Color;
var init_color = __esm({
"node_modules/@antv/x6-common/es/color/index.js"() {
init_number2();
Color = class _Color {
constructor(color, g, b, a) {
if (color == null) {
return this.set(255, 255, 255, 1);
}
if (typeof color === "number") {
return this.set(color, g, b, a);
}
if (typeof color === "string") {
return _Color.fromString(color) || this;
}
if (Array.isArray(color)) {
return this.set(color);
}
this.set(color.r, color.g, color.b, color.a == null ? 1 : color.a);
}
blend(start, end, weight) {
this.set(start.r + (end.r - start.r) * weight, start.g + (end.g - start.g) * weight, start.b + (end.b - start.b) * weight, start.a + (end.a - start.a) * weight);
}
lighten(amount) {
const rgba = _Color.lighten(this.toArray(), amount);
this.r = rgba[0];
this.g = rgba[1];
this.b = rgba[2];
this.a = rgba[3];
}
darken(amount) {
this.lighten(-amount);
}
set(arg0, arg1, arg2, arg3) {
const r = Array.isArray(arg0) ? arg0[0] : arg0;
const g = Array.isArray(arg0) ? arg0[1] : arg1;
const b = Array.isArray(arg0) ? arg0[2] : arg2;
const a = Array.isArray(arg0) ? arg0[3] : arg3;
this.r = Math.round(number_exports.clamp(r, 0, 255));
this.g = Math.round(number_exports.clamp(g, 0, 255));
this.b = Math.round(number_exports.clamp(b, 0, 255));
this.a = a == null ? 1 : number_exports.clamp(a, 0, 1);
return this;
}
toHex() {
const hex = ["r", "g", "b"].map((key) => {
const str = this[key].toString(16);
return str.length < 2 ? `0${str}` : str;
});
return `#${hex.join("")}`;
}
toRGBA() {
return this.toArray();
}
toHSLA() {
return _Color.rgba2hsla(this.r, this.g, this.b, this.a);
}
toCSS(ignoreAlpha) {
const rgb = `${this.r},${this.g},${this.b},`;
return ignoreAlpha ? `rgb(${rgb})` : `rgba(${rgb},${this.a})`;
}
toGrey() {
return _Color.makeGrey(Math.round((this.r + this.g + this.b) / 3), this.a);
}
toArray() {
return [this.r, this.g, this.b, this.a];
}
toString() {
return this.toCSS();
}
};
(function(Color2) {
function fromArray(arr) {
return new Color2(arr);
}
Color2.fromArray = fromArray;
function fromHex(color) {
return new Color2([...hex2rgb(color), 1]);
}
Color2.fromHex = fromHex;
function fromRGBA(color) {
const matches = color.toLowerCase().match(/^rgba?\(([\s.,0-9]+)\)/);
if (matches) {
const arr = matches[1].split(/\s*,\s*/).map((v) => parseInt(v, 10));
return new Color2(arr);
}
return null;
}
Color2.fromRGBA = fromRGBA;
function hue2rgb(m1, m2, h) {
if (h < 0) {
++h;
}
if (h > 1) {
--h;
}
const h6 = 6 * h;
if (h6 < 1) {
return m1 + (m2 - m1) * h6;
}
if (2 * h < 1) {
return m2;
}
if (3 * h < 2) {
return m1 + (m2 - m1) * (2 / 3 - h) * 6;
}
return m1;
}
function fromHSLA(color) {
const matches = color.toLowerCase().match(/^hsla?\(([\s.,0-9]+)\)/);
if (matches) {
const arr = matches[2].split(/\s*,\s*/);
const h = (parseFloat(arr[0]) % 360 + 360) % 360 / 360;
const s = parseFloat(arr[1]) / 100;
const l = parseFloat(arr[2]) / 100;
const a = arr[3] == null ? 1 : parseInt(arr[3], 10);
return new Color2(hsla2rgba(h, s, l, a));
}
return null;
}
Color2.fromHSLA = fromHSLA;
function fromString(color) {
if (color.startsWith("#")) {
return fromHex(color);
}
if (color.startsWith("rgb")) {
return fromRGBA(color);
}
const preset = Color2.named[color];
if (preset) {
return fromHex(preset);
}
return fromHSLA(color);
}
Color2.fromString = fromString;
function makeGrey(g, a) {
return Color2.fromArray([g, g, g, a]);
}
Color2.makeGrey = makeGrey;
function rgba2hsla(arg0, arg1, arg2, arg3) {
const r = Array.isArray(arg0) ? arg0[0] : arg0;
const g = Array.isArray(arg0) ? arg0[1] : arg1;
const b = Array.isArray(arg0) ? arg0[2] : arg2;
const a = Array.isArray(arg0) ? arg0[3] : arg3;
const max = Math.max(r, g, b);
const min = Math.min(r, g, b);
const l = (max + min) / 2;
let h = 0;
let s = 0;
if (min !== max) {
const d = max - min;
s = l > 0.5 ? d / (2 - max - min) : d / (max + min);
switch (max) {
case r:
h = (g - b) / d + (g < b ? 6 : 0);
break;
case g:
h = (b - r) / d + 2;
break;
case b:
h = (r - g) / d + 4;
break;
default:
break;
}
h /= 6;
}
return [h, s, l, a == null ? 1 : a];
}
Color2.rgba2hsla = rgba2hsla;
function hsla2rgba(arg0, arg1, arg2, arg3) {
const h = Array.isArray(arg0) ? arg0[0] : arg0;
const s = Array.isArray(arg0) ? arg0[1] : arg1;
const l = Array.isArray(arg0) ? arg0[2] : arg2;
const a = Array.isArray(arg0) ? arg0[3] : arg3;
const m2 = l <= 0.5 ? l * (s + 1) : l + s - l * s;
const m1 = 2 * l - m2;
return [
hue2rgb(m1, m2, h + 1 / 3) * 256,
hue2rgb(m1, m2, h) * 256,
hue2rgb(m1, m2, h - 1 / 3) * 256,
a == null ? 1 : a
];
}
Color2.hsla2rgba = hsla2rgba;
function random2(ignoreAlpha) {
return new Color2(Math.round(Math.random() * 256), Math.round(Math.random() * 256), Math.round(Math.random() * 256), ignoreAlpha ? void 0 : parseFloat(Math.random().toFixed(2)));
}
Color2.random = random2;
function randomHex() {
const letters = "0123456789ABCDEF";
let color = "#";
for (let i = 0; i < 6; i += 1) {
color += letters[Math.floor(Math.random() * 16)];
}
return color;
}
Color2.randomHex = randomHex;
function randomRGBA(ignoreAlpha) {
return random2(ignoreAlpha).toString();
}
Color2.randomRGBA = randomRGBA;
function invert(color, bw) {
if (typeof color === "string") {
const pound = color[0] === "#";
const [r2, g2, b2] = hex2rgb(color);
if (bw) {
return r2 * 0.299 + g2 * 0.587 + b2 * 0.114 > 186 ? "#000000" : "#ffffff";
}
return `${pound ? "#" : ""}${rgb2hex(255 - r2, 255 - g2, 255 - b2)}`;
}
const r = color[0];
const g = color[1];
const b = color[2];
const a = color[3];
if (bw) {
return r * 0.299 + g * 0.587 + b * 0.114 > 186 ? [0, 0, 0, a] : [255, 255, 255, a];
}
return [255 - r, 255 - g, 255 - b, a];
}
Color2.invert = invert;
function hex2rgb(hex) {
const color = hex.indexOf("#") === 0 ? hex : `#${hex}`;
let val = Number(`0x${color.substr(1)}`);
if (!(color.length === 4 || color.length === 7) || Number.isNaN(val)) {
throw new Error("Invalid hex color.");
}
const bits = color.length === 4 ? 4 : 8;
const mask = (1 << bits) - 1;
const bgr = ["b", "g", "r"].map(() => {
const c = val & mask;
val >>= bits;
return bits === 4 ? 17 * c : c;
});
return [bgr[2], bgr[1], bgr[0]];
}
function rgb2hex(r, g, b) {
const pad = (hex) => hex.length < 2 ? `0${hex}` : hex;
return `${pad(r.toString(16))}${pad(g.toString(16))}${pad(b.toString(16))}`;
}
function lighten(color, amt) {
return lum(color, amt);
}
Color2.lighten = lighten;
function darken(color, amt) {
return lum(color, -amt);
}
Color2.darken = darken;
function lum(color, amt) {
if (typeof color === "string") {
const pound = color[0] === "#";
const num = parseInt(pound ? color.substr(1) : color, 16);
const r = number_exports.clamp((num >> 16) + amt, 0, 255);
const g = number_exports.clamp((num >> 8 & 255) + amt, 0, 255);
const b = number_exports.clamp((num & 255) + amt, 0, 255);
return `${pound ? "#" : ""}${(b | g << 8 | r << 16).toString(16)}`;
}
const hex = rgb2hex(color[0], color[1], color[2]);
const arr = hex2rgb(lum(hex, amt));
return [arr[0], arr[1], arr[2], color[3]];
}
})(Color || (Color = {}));
(function(Color2) {
Color2.named = {
aliceblue: "#f0f8ff",
antiquewhite: "#faebd7",
aqua: "#00ffff",
aquamarine: "#7fffd4",
azure: "#f0ffff",
beige: "#f5f5dc",
bisque: "#ffe4c4",
black: "#000000",
blanchedalmond: "#ffebcd",
blue: "#0000ff",
blueviolet: "#8a2be2",
brown: "#a52a2a",
burlywood: "#deb887",
burntsienna: "#ea7e5d",
cadetblue: "#5f9ea0",
chartreuse: "#7fff00",
chocolate: "#d2691e",
coral: "#ff7f50",
cornflowerblue: "#6495ed",
cornsilk: "#fff8dc",
crimson: "#dc143c",
cyan: "#00ffff",
darkblue: "#00008b",
darkcyan: "#008b8b",
darkgoldenrod: "#b8860b",
darkgray: "#a9a9a9",
darkgreen: "#006400",
darkgrey: "#a9a9a9",
darkkhaki: "#bdb76b",
darkmagenta: "#8b008b",
darkolivegreen: "#556b2f",
darkorange: "#ff8c00",
darkorchid: "#9932cc",
darkred: "#8b0000",
darksalmon: "#e9967a",
darkseagreen: "#8fbc8f",
darkslateblue: "#483d8b",
darkslategray: "#2f4f4f",
darkslategrey: "#2f4f4f",
darkturquoise: "#00ced1",
darkviolet: "#9400d3",
deeppink: "#ff1493",
deepskyblue: "#00bfff",
dimgray: "#696969",
dimgrey: "#696969",
dodgerblue: "#1e90ff",
firebrick: "#b22222",
floralwhite: "#fffaf0",
forestgreen: "#228b22",
fuchsia: "#ff00ff",
gainsboro: "#dcdcdc",
ghostwhite: "#f8f8ff",
gold: "#ffd700",
goldenrod: "#daa520",
gray: "#808080",
green: "#008000",
greenyellow: "#adff2f",
grey: "#808080",
honeydew: "#f0fff0",
hotpink: "#ff69b4",
indianred: "#cd5c5c",
indigo: "#4b0082",
ivory: "#fffff0",
khaki: "#f0e68c",
lavender: "#e6e6fa",
lavenderblush: "#fff0f5",
lawngreen: "#7cfc00",
lemonchiffon: "#fffacd",
lightblue: "#add8e6",
lightcoral: "#f08080",
lightcyan: "#e0ffff",
lightgoldenrodyellow: "#fafad2",
lightgray: "#d3d3d3",
lightgreen: "#90ee90",
lightgrey: "#d3d3d3",
lightpink: "#ffb6c1",
lightsalmon: "#ffa07a",
lightseagreen: "#20b2aa",
lightskyblue: "#87cefa",
lightslategray: "#778899",
lightslategrey: "#778899",
lightsteelblue: "#b0c4de",
lightyellow: "#ffffe0",
lime: "#00ff00",
limegreen: "#32cd32",
linen: "#faf0e6",
magenta: "#ff00ff",
maroon: "#800000",
mediumaquamarine: "#66cdaa",
mediumblue: "#0000cd",
mediumorchid: "#ba55d3",
mediumpurple: "#9370db",
mediumseagreen: "#3cb371",
mediumslateblue: "#7b68ee",
mediumspringgreen: "#00fa9a",
mediumturquoise: "#48d1cc",
mediumvioletred: "#c71585",
midnightblue: "#191970",
mintcream: "#f5fffa",
mistyrose: "#ffe4e1",
moccasin: "#ffe4b5",
navajowhite: "#ffdead",
navy: "#000080",
oldlace: "#fdf5e6",
olive: "#808000",
olivedrab: "#6b8e23",
orange: "#ffa500",
orangered: "#ff4500",
orchid: "#da70d6",
palegoldenrod: "#eee8aa",
palegreen: "#98fb98",
paleturquoise: "#afeeee",
palevioletred: "#db7093",
papayawhip: "#ffefd5",
peachpuff: "#ffdab9",
peru: "#cd853f",
pink: "#ffc0cb",
plum: "#dda0dd",
powderblue: "#b0e0e6",
purple: "#800080",
rebeccapurple: "#663399",
red: "#ff0000",
rosybrown: "#bc8f8f",
royalblue: "#4169e1",
saddlebrown: "#8b4513",
salmon: "#fa8072",
sandybrown: "#f4a460",
seagreen: "#2e8b57",
seashell: "#fff5ee",
sienna: "#a0522d",
silver: "#c0c0c0",
skyblue: "#87ceeb",
slateblue: "#6a5acd",
slategray: "#708090",
slategrey: "#708090",
snow: "#fffafa",
springgreen: "#00ff7f",
steelblue: "#4682b4",
tan: "#d2b48c",
teal: "#008080",
thistle: "#d8bfd8",
tomato: "#ff6347",
turquoise: "#40e0d0",
violet: "#ee82ee",
wheat: "#f5deb3",
white: "#ffffff",
whitesmoke: "#f5f5f5",
yellow: "#ffff00",
yellowgreen: "#9acd32"
};
})(Color || (Color = {}));
}
});
// node_modules/@antv/x6-common/es/dictionary/dictionary.js
var Dictionary;
var init_dictionary = __esm({
"node_modules/@antv/x6-common/es/dictionary/dictionary.js"() {
Dictionary = class {
constructor() {
this.clear();
}
clear() {
this.map = /* @__PURE__ */ new WeakMap();
this.arr = [];
}
has(key) {
return this.map.has(key);
}
get(key) {
return this.map.get(key);
}
set(key, value) {
this.map.set(key, value);
this.arr.push(key);
}
delete(key) {
const index2 = this.arr.indexOf(key);
if (index2 >= 0) {
this.arr.splice(index2, 1);
}
const ret = this.map.get(key);
this.map.delete(key);
return ret;
}
each(iterator) {
this.arr.forEach((key) => {
const value = this.map.get(key);
iterator(value, key);
});
}
dispose() {
this.clear();
}
};
}
});
// node_modules/@antv/x6-common/es/modifier/index.js
var ModifierKey;
var init_modifier = __esm({
"node_modules/@antv/x6-common/es/modifier/index.js"() {
(function(ModifierKey2) {
function parse2(modifiers) {
const or = [];
const and = [];
if (Array.isArray(modifiers)) {
or.push(...modifiers);
} else {
modifiers.split("|").forEach((item) => {
if (item.indexOf("&") === -1) {
or.push(item);
} else {
and.push(...item.split("&"));
}
});
}
return { or, and };
}
ModifierKey2.parse = parse2;
function equals(modifiers1, modifiers2) {
if (modifiers1 != null && modifiers2 != null) {
const m1 = parse2(modifiers1);
const m2 = parse2(modifiers2);
const or1 = m1.or.sort();
const or2 = m2.or.sort();
const and1 = m1.and.sort();
const and2 = m2.and.sort();
const equal = (a1, a2) => {
return a1.length === a2.length && (a1.length === 0 || a1.every((a, i) => a === a2[i]));
};
return equal(or1, or2) && equal(and1, and2);
}
if (modifiers1 == null && modifiers2 == null) {
return true;
}
return false;
}
ModifierKey2.equals = equals;
function isMatch(e, modifiers, strict) {
if (modifiers == null || Array.isArray(modifiers) && modifiers.length === 0) {
return strict ? e.altKey !== true && e.ctrlKey !== true && e.metaKey !== true && e.shiftKey !== true : true;
}
const { or, and } = parse2(modifiers);
const match = (key) => {
const name = `${key.toLowerCase()}Key`;
return e[name] === true;
};
return or.some((key) => match(key)) && and.every((key) => match(key));
}
ModifierKey2.isMatch = isMatch;
})(ModifierKey || (ModifierKey = {}));
}
});
// node_modules/@antv/x6-common/es/animation/timing.js
var Timing;
var init_timing = __esm({
"node_modules/@antv/x6-common/es/animation/timing.js"() {
(function(Timing2) {
Timing2.linear = (t) => t;
Timing2.quad = (t) => t * t;
Timing2.cubic = (t) => t * t * t;
Timing2.inout = (t) => {
if (t <= 0) {
return 0;
}
if (t >= 1) {
return 1;
}
const t2 = t * t;
const t3 = t2 * t;
return 4 * (t < 0.5 ? t3 : 3 * (t - t2) + t3 - 0.75);
};
Timing2.exponential = (t) => {
return Math.pow(2, 10 * (t - 1));
};
Timing2.bounce = ((t) => {
for (let a = 0, b = 1; 1; a += b, b /= 2) {
if (t >= (7 - 4 * a) / 11) {
const q = (11 - 6 * a - 11 * t) / 4;
return -q * q + b * b;
}
}
});
})(Timing || (Timing = {}));
(function(Timing2) {
Timing2.decorators = {
reverse(f) {
return (t) => 1 - f(1 - t);
},
reflect(f) {
return (t) => 0.5 * (t < 0.5 ? f(2 * t) : 2 - f(2 - 2 * t));
},
clamp(f, n = 0, x = 1) {
return (t) => {
const r = f(t);
return r < n ? n : r > x ? x : r;
};
},
back(s = 1.70158) {
return (t) => t * t * ((s + 1) * t - s);
},
elastic(x = 1.5) {
return (t) => Math.pow(2, 10 * (t - 1)) * Math.cos(20 * Math.PI * x / 3 * t);
}
};
})(Timing || (Timing = {}));
(function(Timing2) {
function easeInSine(t) {
return -1 * Math.cos(t * (Math.PI / 2)) + 1;
}
Timing2.easeInSine = easeInSine;
function easeOutSine(t) {
return Math.sin(t * (Math.PI / 2));
}
Timing2.easeOutSine = easeOutSine;
function easeInOutSine(t) {
return -0.5 * (Math.cos(Math.PI * t) - 1);
}
Timing2.easeInOutSine = easeInOutSine;
function easeInQuad(t) {
return t * t;
}
Timing2.easeInQuad = easeInQuad;
function easeOutQuad(t) {
return t * (2 - t);
}
Timing2.easeOutQuad = easeOutQuad;
function easeInOutQuad(t) {
return t < 0.5 ? 2 * t * t : -1 + (4 - 2 * t) * t;
}
Timing2.easeInOutQuad = easeInOutQuad;
function easeInCubic(t) {
return t * t * t;
}
Timing2.easeInCubic = easeInCubic;
function easeOutCubic(t) {
const t1 = t - 1;
return t1 * t1 * t1 + 1;
}
Timing2.easeOutCubic = easeOutCubic;
function easeInOutCubic(t) {
return t < 0.5 ? 4 * t * t * t : (t - 1) * (2 * t - 2) * (2 * t - 2) + 1;
}
Timing2.easeInOutCubic = easeInOutCubic;
function easeInQuart(t) {
return t * t * t * t;
}
Timing2.easeInQuart = easeInQuart;
function easeOutQuart(t) {
const t1 = t - 1;
return 1 - t1 * t1 * t1 * t1;
}
Timing2.easeOutQuart = easeOutQuart;
function easeInOutQuart(t) {
const t1 = t - 1;
return t < 0.5 ? 8 * t * t * t * t : 1 - 8 * t1 * t1 * t1 * t1;
}
Timing2.easeInOutQuart = easeInOutQuart;
function easeInQuint(t) {
return t * t * t * t * t;
}
Timing2.easeInQuint = easeInQuint;
function easeOutQuint(t) {
const t1 = t - 1;
return 1 + t1 * t1 * t1 * t1 * t1;
}
Timing2.easeOutQuint = easeOutQuint;
function easeInOutQuint(t) {
const t1 = t - 1;
return t < 0.5 ? 16 * t * t * t * t * t : 1 + 16 * t1 * t1 * t1 * t1 * t1;
}
Timing2.easeInOutQuint = easeInOutQuint;
function easeInExpo(t) {
if (t === 0) {
return 0;
}
return Math.pow(2, 10 * (t - 1));
}
Timing2.easeInExpo = easeInExpo;
function easeOutExpo(t) {
if (t === 1) {
return 1;
}
return -Math.pow(2, -10 * t) + 1;
}
Timing2.easeOutExpo = easeOutExpo;
function easeInOutExpo(t) {
if (t === 0 || t === 1) {
return t;
}
const scaledTime = t * 2;
const scaledTime1 = scaledTime - 1;
if (scaledTime < 1) {
return 0.5 * Math.pow(2, 10 * scaledTime1);
}
return 0.5 * (-Math.pow(2, -10 * scaledTime1) + 2);
}
Timing2.easeInOutExpo = easeInOutExpo;
function easeInCirc(t) {
const scaledTime = t / 1;
return -1 * (Math.sqrt(1 - scaledTime * t) - 1);
}
Timing2.easeInCirc = easeInCirc;
function easeOutCirc(t) {
const t1 = t - 1;
return Math.sqrt(1 - t1 * t1);
}
Timing2.easeOutCirc = easeOutCirc;
function easeInOutCirc(t) {
const scaledTime = t * 2;
const scaledTime1 = scaledTime - 2;
if (scaledTime < 1) {
return -0.5 * (Math.sqrt(1 - scaledTime * scaledTime) - 1);
}
return 0.5 * (Math.sqrt(1 - scaledTime1 * scaledTime1) + 1);
}
Timing2.easeInOutCirc = easeInOutCirc;
function easeInBack(t, magnitude = 1.70158) {
return t * t * ((magnitude + 1) * t - magnitude);
}
Timing2.easeInBack = easeInBack;
function easeOutBack(t, magnitude = 1.70158) {
const scaledTime = t / 1 - 1;
return scaledTime * scaledTime * ((magnitude + 1) * scaledTime + magnitude) + 1;
}
Timing2.easeOutBack = easeOutBack;
function easeInOutBack(t, magnitude = 1.70158) {
const scaledTime = t * 2;
const scaledTime2 = scaledTime - 2;
const s = magnitude * 1.525;
if (scaledTime < 1) {
return 0.5 * scaledTime * scaledTime * ((s + 1) * scaledTime - s);
}
return 0.5 * (scaledTime2 * scaledTime2 * ((s + 1) * scaledTime2 + s) + 2);
}
Timing2.easeInOutBack = easeInOutBack;
function easeInElastic(t, magnitude = 0.7) {
if (t === 0 || t === 1) {
return t;
}
const scaledTime = t / 1;
const scaledTime1 = scaledTime - 1;
const p = 1 - magnitude;
const s = p / (2 * Math.PI) * Math.asin(1);
return -(Math.pow(2, 10 * scaledTime1) * // eslint-disable-line
Math.sin((scaledTime1 - s) * (2 * Math.PI) / p));
}
Timing2.easeInElastic = easeInElastic;
function easeOutElastic(t, magnitude = 0.7) {
const p = 1 - magnitude;
const scaledTime = t * 2;
if (t === 0 || t === 1) {
return t;
}
const s = p / (2 * Math.PI) * Math.asin(1);
return Math.pow(2, -10 * scaledTime) * // eslint-disable-line
Math.sin((scaledTime - s) * (2 * Math.PI) / p) + 1;
}
Timing2.easeOutElastic = easeOutElastic;
function easeInOutElastic(t, magnitude = 0.65) {
const p = 1 - magnitude;
if (t === 0 || t === 1) {
return t;
}
const scaledTime = t * 2;
const scaledTime1 = scaledTime - 1;
const s = p / (2 * Math.PI) * Math.asin(1);
if (scaledTime < 1) {
return -0.5 * (Math.pow(2, 10 * scaledTime1) * // eslint-disable-line
Math.sin((scaledTime1 - s) * (2 * Math.PI) / p));
}
return Math.pow(2, -10 * scaledTime1) * // eslint-disable-line
Math.sin((scaledTime1 - s) * (2 * Math.PI) / p) * 0.5 + 1;
}
Timing2.easeInOutElastic = easeInOutElastic;
function easeOutBounce(t) {
const scaledTime = t / 1;
if (scaledTime < 1 / 2.75) {
return 7.5625 * scaledTime * scaledTime;
}
if (scaledTime < 2 / 2.75) {
const scaledTime2 = scaledTime - 1.5 / 2.75;
return 7.5625 * scaledTime2 * scaledTime2 + 0.75;
}
if (scaledTime < 2.5 / 2.75) {
const scaledTime2 = scaledTime - 2.25 / 2.75;
return 7.5625 * scaledTime2 * scaledTime2 + 0.9375;
}
{
const scaledTime2 = scaledTime - 2.625 / 2.75;
return 7.5625 * scaledTime2 * scaledTime2 + 0.984375;
}
}
Timing2.easeOutBounce = easeOutBounce;
function easeInBounce(t) {
return 1 - easeOutBounce(1 - t);
}
Timing2.easeInBounce = easeInBounce;
function easeInOutBounce(t) {
if (t < 0.5) {
return easeInBounce(t * 2) * 0.5;
}
return easeOutBounce(t * 2 - 1) * 0.5 + 0.5;
}
Timing2.easeInOutBounce = easeInOutBounce;
})(Timing || (Timing = {}));
}
});
// node_modules/@antv/x6-common/es/animation/interp.js
var Interp;
var init_interp = __esm({
"node_modules/@antv/x6-common/es/animation/interp.js"() {
(function(Interp2) {
Interp2.number = (a, b) => {
const d = b - a;
return (t) => {
return a + d * t;
};
};
Interp2.object = (a, b) => {
const keys = Object.keys(a);
return (t) => {
const ret = {};
for (let i = keys.length - 1; i !== -1; i -= 1) {
const key = keys[i];
ret[key] = a[key] + (b[key] - a[key]) * t;
}
return ret;
};
};
Interp2.unit = (a, b) => {
const reg = /(-?[0-9]*.[0-9]*)(px|em|cm|mm|in|pt|pc|%)/;
const ma = reg.exec(a);
const mb = reg.exec(b);
const pb = mb ? mb[1] : "";
const aa = ma ? +ma[1] : 0;
const bb = mb ? +mb[1] : 0;
const index2 = pb.indexOf(".");
const precision = index2 > 0 ? pb[1].length - index2 - 1 : 0;
const d = bb - aa;
const u = ma ? ma[2] : "";
return (t) => {
return (aa + d * t).toFixed(precision) + u;
};
};
Interp2.color = (a, b) => {
const ca = parseInt(a.slice(1), 16);
const cb = parseInt(b.slice(1), 16);
const ra = ca & 255;
const rd = (cb & 255) - ra;
const ga = ca & 65280;
const gd = (cb & 65280) - ga;
const ba = ca & 16711680;
const bd = (cb & 16711680) - ba;
return (t) => {
const r = ra + rd * t & 255;
const g = ga + gd * t & 65280;
const b2 = ba + bd * t & 16711680;
return `#${(1 << 24 | r | g | b2).toString(16).slice(1)}`;
};
};
})(Interp || (Interp = {}));
}
});
// node_modules/@antv/x6-common/es/css-loader/loader.js
var loader_exports = {};
__export(loader_exports, {
clean: () => clean,
ensure: () => ensure2
});
function ensure2(name, content) {
const cssModule = cssModules.find((m) => m.name === name);
if (cssModule) {
cssModule.loadTimes += 1;
if (cssModule.loadTimes > 1) {
return;
}
}
if (!Platform.isApplyingHMR()) {
const styleElement = document.createElement("style");
styleElement.setAttribute("type", "text/css");
styleElement.textContent = content;
const head = document.querySelector("head");
if (head) {
head.insertBefore(styleElement, head.firstChild);
}
cssModules.push({
name,
loadTimes: 1,
styleElement
});
}
}
function clean(name) {
const index2 = cssModules.findIndex((m) => m.name === name);
if (index2 > -1) {
const cssModule = cssModules[index2];
cssModule.loadTimes -= 1;
if (cssModule.loadTimes > 0) {
return;
}
let styleElement = cssModule.styleElement;
if (styleElement && styleElement.parentNode) {
styleElement.parentNode.removeChild(styleElement);
}
styleElement = null;
cssModules.splice(index2, 1);
}
}
var cssModules;
var init_loader = __esm({
"node_modules/@antv/x6-common/es/css-loader/loader.js"() {
init_platform();
cssModules = [];
}
});
// node_modules/@antv/x6-common/es/css-loader/index.js
var init_css_loader = __esm({
"node_modules/@antv/x6-common/es/css-loader/index.js"() {
init_loader();
}
});
// node_modules/@antv/x6-common/es/polyfill/index.js
var init_polyfill = __esm({
"node_modules/@antv/x6-common/es/polyfill/index.js"() {
if (typeof window === "object" && window.NodeList && !NodeList.prototype.forEach) {
NodeList.prototype.forEach = Array.prototype.forEach;
}
if (typeof window !== "undefined") {
;
(function(arr) {
arr.forEach((item) => {
if (Object.prototype.hasOwnProperty.call(item, "append")) {
return;
}
Object.defineProperty(item, "append", {
configurable: true,
enumerable: true,
writable: true,
value(...args) {
const docFrag = document.createDocumentFragment();
args.forEach((arg) => {
const isNode = arg instanceof Node;
docFrag.appendChild(isNode ? arg : document.createTextNode(String(arg)));
});
this.appendChild(docFrag);
}
});
});
})([Element.prototype, Document.prototype, DocumentFragment.prototype]);
}
}
});
// node_modules/@antv/x6-common/es/common/index.js
var init_common = __esm({
"node_modules/@antv/x6-common/es/common/index.js"() {
init_disposable();
init_disablable();
init_basecoat();
}
});
// node_modules/@antv/x6-common/es/algorithm/index.js
var init_algorithm = __esm({
"node_modules/@antv/x6-common/es/algorithm/index.js"() {
init_priorityqueue();
init_dijkstra();
}
});
// node_modules/@antv/x6-common/es/dictionary/index.js
var init_dictionary2 = __esm({
"node_modules/@antv/x6-common/es/dictionary/index.js"() {
init_dictionary();
}
});
// node_modules/@antv/x6-common/es/animation/index.js
var init_animation = __esm({
"node_modules/@antv/x6-common/es/animation/index.js"() {
init_timing();
init_interp();
}
});
// node_modules/@antv/x6-common/es/types.js
var init_types2 = __esm({
"node_modules/@antv/x6-common/es/types.js"() {
}
});
// node_modules/@antv/x6-common/es/index.js
var es_exports = {};
__export(es_exports, {
ArrayExt: () => array_exports,
Basecoat: () => Basecoat,
Color: () => Color,
CssLoader: () => loader_exports,
DataUri: () => DataUri,
Dictionary: () => Dictionary,
Dijkstra: () => Dijkstra,
Disablable: () => Disablable,
Disposable: () => Disposable,
DisposableDelegate: () => DisposableDelegate,
DisposableSet: () => DisposableSet,
Dom: () => main_exports3,
Events: () => Events,
FunctionExt: () => main_exports,
Interp: () => Interp,
ModifierKey: () => ModifierKey,
NumberExt: () => number_exports,
ObjectExt: () => object_exports,
Platform: () => Platform,
PriorityQueue: () => PriorityQueue,
SizeSensor: () => SizeSensor,
StringExt: () => string_exports,
Text: () => main_exports2,
Timing: () => Timing,
Unit: () => Unit,
Vector: () => Vector
});
var init_es = __esm({
"node_modules/@antv/x6-common/es/index.js"() {
init_polyfill();
init_common();
init_array2();
init_object2();
init_string2();
init_number2();
init_function2();
init_platform();
init_text();
init_datauri();
init_unit();
init_dom();
init_vector();
init_size_sensor();
init_algorithm();
init_color();
init_event();
init_dictionary2();
init_modifier();
init_animation();
init_css_loader();
init_types2();
}
});
// node_modules/@antv/x6-geometry/es/angle.js
var Angle;
var init_angle = __esm({
"node_modules/@antv/x6-geometry/es/angle.js"() {
(function(Angle2) {
function toDeg(rad) {
return 180 * rad / Math.PI % 360;
}
Angle2.toDeg = toDeg;
Angle2.toRad = function(deg, over360 = false) {
const d = over360 ? deg : deg % 360;
return d * Math.PI / 180;
};
function normalize2(angle) {
return angle % 360 + (angle < 0 ? 360 : 0);
}
Angle2.normalize = normalize2;
})(Angle || (Angle = {}));
}
});
// node_modules/@antv/x6-geometry/es/util.js
var GeometryUtil;
var init_util4 = __esm({
"node_modules/@antv/x6-geometry/es/util.js"() {
(function(GeometryUtil2) {
function round(num, precision = 0) {
return Number.isInteger(num) ? num : +num.toFixed(precision);
}
GeometryUtil2.round = round;
function random2(min, max) {
let mmin;
let mmax;
if (max == null) {
mmax = min == null ? 1 : min;
mmin = 0;
} else {
mmax = max;
mmin = min == null ? 0 : min;
}
if (mmax < mmin) {
const temp = mmin;
mmin = mmax;
mmax = temp;
}
return Math.floor(Math.random() * (mmax - mmin + 1) + mmin);
}
GeometryUtil2.random = random2;
function clamp(value, min, max) {
if (Number.isNaN(value)) {
return NaN;
}
if (Number.isNaN(min) || Number.isNaN(max)) {
return 0;
}
return min < max ? value < min ? min : value > max ? max : value : value < max ? max : value > min ? min : value;
}
GeometryUtil2.clamp = clamp;
function snapToGrid(value, gridSize) {
return gridSize * Math.round(value / gridSize);
}
GeometryUtil2.snapToGrid = snapToGrid;
function containsPoint(rect, point) {
return point != null && rect != null && point.x >= rect.x && point.x <= rect.x + rect.width && point.y >= rect.y && point.y <= rect.y + rect.height;
}
GeometryUtil2.containsPoint = containsPoint;
function squaredLength(p1, p2) {
const dx = p1.x - p2.x;
const dy = p1.y - p2.y;
return dx * dx + dy * dy;
}
GeometryUtil2.squaredLength = squaredLength;
})(GeometryUtil || (GeometryUtil = {}));
}
});
// node_modules/@antv/x6-geometry/es/geometry.js
var Geometry;
var init_geometry = __esm({
"node_modules/@antv/x6-geometry/es/geometry.js"() {
Geometry = class {
valueOf() {
return this.toJSON();
}
toString() {
return JSON.stringify(this.toJSON());
}
};
}
});
// node_modules/@antv/x6-geometry/es/point.js
var Point;
var init_point = __esm({
"node_modules/@antv/x6-geometry/es/point.js"() {
init_util4();
init_angle();
init_geometry();
Point = class _Point extends Geometry {
constructor(x, y) {
super();
this.x = x == null ? 0 : x;
this.y = y == null ? 0 : y;
}
/**
* Rounds the point to the given precision.
*/
round(precision = 0) {
this.x = GeometryUtil.round(this.x, precision);
this.y = GeometryUtil.round(this.y, precision);
return this;
}
add(x, y) {
const p = _Point.create(x, y);
this.x += p.x;
this.y += p.y;
return this;
}
update(x, y) {
const p = _Point.create(x, y);
this.x = p.x;
this.y = p.y;
return this;
}
translate(dx, dy) {
const t = _Point.create(dx, dy);
this.x += t.x;
this.y += t.y;
return this;
}
/**
* Rotate the point by `degree` around `center`.
*/
rotate(degree, center) {
const p = _Point.rotate(this, degree, center);
this.x = p.x;
this.y = p.y;
return this;
}
/**
* Scale point by `sx` and `sy` around the given `origin`. If origin is
* not specified, the point is scaled around `0, 0`.
*/
scale(sx, sy, origin = new _Point()) {
const ref = _Point.create(origin);
this.x = ref.x + sx * (this.x - ref.x);
this.y = ref.y + sy * (this.y - ref.y);
return this;
}
/**
* Chooses the point closest to this point from among `points`. If `points`
* is an empty array, `null` is returned.
*/
closest(points) {
if (points.length === 1) {
return _Point.create(points[0]);
}
let ret = null;
let min = Infinity;
points.forEach((p) => {
const dist = this.squaredDistance(p);
if (dist < min) {
ret = p;
min = dist;
}
});
return ret ? _Point.create(ret) : null;
}
/**
* Returns the distance between the point and another point `p`.
*/
distance(p) {
return Math.sqrt(this.squaredDistance(p));
}
/**
* Returns the squared distance between the point and another point `p`.
*
* Useful for distance comparisons in which real distance is not necessary
* (saves one `Math.sqrt()` operation).
*/
squaredDistance(p) {
const ref = _Point.create(p);
const dx = this.x - ref.x;
const dy = this.y - ref.y;
return dx * dx + dy * dy;
}
manhattanDistance(p) {
const ref = _Point.create(p);
return Math.abs(ref.x - this.x) + Math.abs(ref.y - this.y);
}
/**
* Returns the magnitude of the point vector.
*
* @see http://en.wikipedia.org/wiki/Magnitude_(mathematics)
*/
magnitude() {
return Math.sqrt(this.x * this.x + this.y * this.y) || 0.01;
}
/**
* Returns the angle(in degrees) between vector from this point to `p` and
* the x-axis.
*/
theta(p = new _Point()) {
const ref = _Point.create(p);
const y = -(ref.y - this.y);
const x = ref.x - this.x;
let rad = Math.atan2(y, x);
if (rad < 0) {
rad = 2 * Math.PI + rad;
}
return 180 * rad / Math.PI;
}
/**
* Returns the angle(in degrees) between vector from this point to `p1` and
* the vector from this point to `p2`.
*
* The ordering of points `p1` and `p2` is important.
*
* The function returns a value between `0` and `180` when the angle (in the
* direction from `p1` to `p2`) is clockwise, and a value between `180` and
* `360` when the angle is counterclockwise.
*
* Returns `NaN` if either of the points `p1` and `p2` is equal with this point.
*/
angleBetween(p1, p2) {
if (this.equals(p1) || this.equals(p2)) {
return NaN;
}
let angle = this.theta(p2) - this.theta(p1);
if (angle < 0) {
angle += 360;
}
return angle;
}
/**
* Returns the angle(in degrees) between the line from `(0,0)` and this point
* and the line from `(0,0)` to `p`.
*
* The function returns a value between `0` and `180` when the angle (in the
* direction from this point to `p`) is clockwise, and a value between `180`
* and `360` when the angle is counterclockwise. Returns `NaN` if called from
* point `(0,0)` or if `p` is `(0,0)`.
*/
vectorAngle(p) {
const zero = new _Point(0, 0);
return zero.angleBetween(this, p);
}
/**
* Converts rectangular to polar coordinates.
*/
toPolar(origin) {
this.update(_Point.toPolar(this, origin));
return this;
}
/**
* Returns the change in angle(in degrees) that is the result of moving the
* point from its previous position to its current position.
*
* More specifically, this function computes the angle between the line from
* the ref point to the previous position of this point(i.e. current position
* `-dx`, `-dy`) and the line from the `ref` point to the current position of
* this point.
*
* The function returns a positive value between `0` and `180` when the angle
* (in the direction from previous position of this point to its current
* position) is clockwise, and a negative value between `0` and `-180` when
* the angle is counterclockwise.
*
* The function returns `0` if the previous and current positions of this
* point are the same (i.e. both `dx` and `dy` are `0`).
*/
changeInAngle(dx, dy, ref = new _Point()) {
return this.clone().translate(-dx, -dy).theta(ref) - this.theta(ref);
}
/**
* If the point lies outside the rectangle `rect`, adjust the point so that
* it becomes the nearest point on the boundary of `rect`.
*/
adhereToRect(rect) {
if (!GeometryUtil.containsPoint(rect, this)) {
this.x = Math.min(Math.max(this.x, rect.x), rect.x + rect.width);
this.y = Math.min(Math.max(this.y, rect.y), rect.y + rect.height);
}
return this;
}
/**
* Returns the bearing(cardinal direction) between me and the given point.
*
* @see https://en.wikipedia.org/wiki/Cardinal_direction
*/
bearing(p) {
const ref = _Point.create(p);
const lat1 = Angle.toRad(this.y);
const lat2 = Angle.toRad(ref.y);
const lon1 = this.x;
const lon2 = ref.x;
const dLon = Angle.toRad(lon2 - lon1);
const y = Math.sin(dLon) * Math.cos(lat2);
const x = Math.cos(lat1) * Math.sin(lat2) - Math.sin(lat1) * Math.cos(lat2) * Math.cos(dLon);
const brng = Angle.toDeg(Math.atan2(y, x));
const bearings = ["NE", "E", "SE", "S", "SW", "W", "NW", "N"];
let index2 = brng - 22.5;
if (index2 < 0) {
index2 += 360;
}
index2 = parseInt(index2 / 45, 10);
return bearings[index2];
}
/**
* Returns the cross product of the vector from me to `p1` and the vector
* from me to `p2`.
*
* The left-hand rule is used because the coordinate system is left-handed.
*/
cross(p1, p2) {
if (p1 != null && p2 != null) {
const a = _Point.create(p1);
const b = _Point.create(p2);
return (b.x - this.x) * (a.y - this.y) - (b.y - this.y) * (a.x - this.x);
}
return NaN;
}
/**
* Returns the dot product of this point with given other point.
*/
dot(p) {
const ref = _Point.create(p);
return this.x * ref.x + this.y * ref.y;
}
diff(dx, dy) {
if (typeof dx === "number") {
return new _Point(this.x - dx, this.y - dy);
}
const p = _Point.create(dx);
return new _Point(this.x - p.x, this.y - p.y);
}
/**
* Returns an interpolation between me and point `p` for a parametert in
* the closed interval `[0, 1]`.
*/
lerp(p, t) {
const ref = _Point.create(p);
return new _Point((1 - t) * this.x + t * ref.x, (1 - t) * this.y + t * ref.y);
}
/**
* Normalize the point vector, scale the line segment between `(0, 0)`
* and the point in order for it to have the given length. If length is
* not specified, it is considered to be `1`; in that case, a unit vector
* is computed.
*/
normalize(length = 1) {
const scale2 = length / this.magnitude();
return this.scale(scale2, scale2);
}
/**
* Moves this point along the line starting from `ref` to this point by a
* certain `distance`.
*/
move(ref, distance) {
const p = _Point.create(ref);
const rad = Angle.toRad(p.theta(this));
return this.translate(Math.cos(rad) * distance, -Math.sin(rad) * distance);
}
/**
* Returns a point that is the reflection of me with the center of inversion
* in `ref` point.
*/
reflection(ref) {
return _Point.create(ref).move(this, this.distance(ref));
}
snapToGrid(gx, gy) {
this.x = GeometryUtil.snapToGrid(this.x, gx);
this.y = GeometryUtil.snapToGrid(this.y, gy == null ? gx : gy);
return this;
}
equals(p) {
const ref = _Point.create(p);
return ref != null && ref.x === this.x && ref.y === this.y;
}
clone() {
return _Point.clone(this);
}
/**
* Returns the point as a simple JSON object. For example: `{ x: 0, y: 0 }`.
*/
toJSON() {
return _Point.toJSON(this);
}
serialize() {
return `${this.x} ${this.y}`;
}
};
(function(Point2) {
function isPoint(instance) {
return instance != null && instance instanceof Point2;
}
Point2.isPoint = isPoint;
})(Point || (Point = {}));
(function(Point2) {
function isPointLike(p) {
return p != null && typeof p === "object" && typeof p.x === "number" && typeof p.y === "number";
}
Point2.isPointLike = isPointLike;
function isPointData(p) {
return p != null && Array.isArray(p) && p.length === 2 && typeof p[0] === "number" && typeof p[1] === "number";
}
Point2.isPointData = isPointData;
})(Point || (Point = {}));
(function(Point2) {
function create(x, y) {
if (x == null || typeof x === "number") {
return new Point2(x, y);
}
return clone(x);
}
Point2.create = create;
function clone(p) {
if (Point2.isPoint(p)) {
return new Point2(p.x, p.y);
}
if (Array.isArray(p)) {
return new Point2(p[0], p[1]);
}
return new Point2(p.x, p.y);
}
Point2.clone = clone;
function toJSON(p) {
if (Point2.isPoint(p)) {
return { x: p.x, y: p.y };
}
if (Array.isArray(p)) {
return { x: p[0], y: p[1] };
}
return { x: p.x, y: p.y };
}
Point2.toJSON = toJSON;
function fromPolar(r, rad, origin = new Point2()) {
let x = Math.abs(r * Math.cos(rad));
let y = Math.abs(r * Math.sin(rad));
const org = clone(origin);
const deg = Angle.normalize(Angle.toDeg(rad));
if (deg < 90) {
y = -y;
} else if (deg < 180) {
x = -x;
y = -y;
} else if (deg < 270) {
x = -x;
}
return new Point2(org.x + x, org.y + y);
}
Point2.fromPolar = fromPolar;
function toPolar(point, origin = new Point2()) {
const p = clone(point);
const o = clone(origin);
const dx = p.x - o.x;
const dy = p.y - o.y;
return new Point2(
Math.sqrt(dx * dx + dy * dy),
// r
Angle.toRad(o.theta(p))
);
}
Point2.toPolar = toPolar;
function equals(p1, p2) {
if (p1 === p2) {
return true;
}
if (p1 != null && p2 != null) {
return p1.x === p2.x && p1.y === p2.y;
}
return false;
}
Point2.equals = equals;
function equalPoints(p1, p2) {
if (p1 == null && p2 != null || p1 != null && p2 == null || p1 != null && p2 != null && p1.length !== p2.length) {
return false;
}
if (p1 != null && p2 != null) {
for (let i = 0, ii = p1.length; i < ii; i += 1) {
if (!equals(p1[i], p2[i])) {
return false;
}
}
}
return true;
}
Point2.equalPoints = equalPoints;
function random2(x1, x2, y1, y2) {
return new Point2(GeometryUtil.random(x1, x2), GeometryUtil.random(y1, y2));
}
Point2.random = random2;
function rotate3(point, angle, center) {
const rad = Angle.toRad(Angle.normalize(-angle));
const sin = Math.sin(rad);
const cos = Math.cos(rad);
return rotateEx(point, cos, sin, center);
}
Point2.rotate = rotate3;
function rotateEx(point, cos, sin, center = new Point2()) {
const source = clone(point);
const origin = clone(center);
const dx = source.x - origin.x;
const dy = source.y - origin.y;
const x1 = dx * cos - dy * sin;
const y1 = dy * cos + dx * sin;
return new Point2(x1 + origin.x, y1 + origin.y);
}
Point2.rotateEx = rotateEx;
})(Point || (Point = {}));
}
});
// node_modules/@antv/x6-geometry/es/line.js
var Line;
var init_line = __esm({
"node_modules/@antv/x6-geometry/es/line.js"() {
init_point();
init_geometry();
init_rectangle();
Line = class _Line extends Geometry {
get center() {
return new Point((this.start.x + this.end.x) / 2, (this.start.y + this.end.y) / 2);
}
constructor(x1, y1, x2, y2) {
super();
if (typeof x1 === "number" && typeof y1 === "number") {
this.start = new Point(x1, y1);
this.end = new Point(x2, y2);
} else {
this.start = Point.create(x1);
this.end = Point.create(y1);
}
}
getCenter() {
return this.center;
}
/**
* Rounds the line to the given `precision`.
*/
round(precision = 0) {
this.start.round(precision);
this.end.round(precision);
return this;
}
translate(tx, ty) {
if (typeof tx === "number") {
this.start.translate(tx, ty);
this.end.translate(tx, ty);
} else {
this.start.translate(tx);
this.end.translate(tx);
}
return this;
}
/**
* Rotate the line by `angle` around `origin`.
*/
rotate(angle, origin) {
this.start.rotate(angle, origin);
this.end.rotate(angle, origin);
return this;
}
/**
* Scale the line by `sx` and `sy` about the given `origin`. If origin is not
* specified, the line is scaled around `0,0`.
*/
scale(sx, sy, origin) {
this.start.scale(sx, sy, origin);
this.end.scale(sx, sy, origin);
return this;
}
/**
* Returns the length of the line.
*/
length() {
return Math.sqrt(this.squaredLength());
}
/**
* Useful for distance comparisons in which real length is not necessary
* (saves one `Math.sqrt()` operation).
*/
squaredLength() {
const dx = this.start.x - this.end.x;
const dy = this.start.y - this.end.y;
return dx * dx + dy * dy;
}
/**
* Scale the line so that it has the requested length. The start point of
* the line is preserved.
*/
setLength(length) {
const total = this.length();
if (!total) {
return this;
}
const scale2 = length / total;
return this.scale(scale2, scale2, this.start);
}
parallel(distance) {
const line = this.clone();
if (!line.isDifferentiable()) {
return line;
}
const { start, end } = line;
const eRef = start.clone().rotate(270, end);
const sRef = end.clone().rotate(90, start);
start.move(sRef, distance);
end.move(eRef, distance);
return line;
}
/**
* Returns the vector of the line with length equal to length of the line.
*/
vector() {
return new Point(this.end.x - this.start.x, this.end.y - this.start.y);
}
/**
* Returns the angle of incline of the line.
*
* The function returns `NaN` if the start and end endpoints of the line
* both lie at the same coordinates(it is impossible to determine the angle
* of incline of a line that appears to be a point). The
* `line.isDifferentiable()` function may be used in advance to determine
* whether the angle of incline can be computed for a given line.
*/
angle() {
const ref = new Point(this.start.x + 1, this.start.y);
return this.start.angleBetween(this.end, ref);
}
/**
* Returns a rectangle that is the bounding box of the line.
*/
bbox() {
const left = Math.min(this.start.x, this.end.x);
const top = Math.min(this.start.y, this.end.y);
const right = Math.max(this.start.x, this.end.x);
const bottom = Math.max(this.start.y, this.end.y);
return new Rectangle(left, top, right - left, bottom - top);
}
/**
* Returns the bearing (cardinal direction) of the line.
*
* The return value is one of the following strings:
* 'NE', 'E', 'SE', 'S', 'SW', 'W', 'NW' and 'N'.
*
* The function returns 'N' if the two endpoints of the line are coincident.
*/
bearing() {
return this.start.bearing(this.end);
}
/**
* Returns the point on the line that lies closest to point `p`.
*/
closestPoint(p) {
return this.pointAt(this.closestPointNormalizedLength(p));
}
/**
* Returns the length of the line up to the point that lies closest to point `p`.
*/
closestPointLength(p) {
return this.closestPointNormalizedLength(p) * this.length();
}
/**
* Returns a line that is tangent to the line at the point that lies closest
* to point `p`.
*/
closestPointTangent(p) {
return this.tangentAt(this.closestPointNormalizedLength(p));
}
/**
* Returns the normalized length (distance from the start of the line / total
* line length) of the line up to the point that lies closest to point.
*/
closestPointNormalizedLength(p) {
const product = this.vector().dot(new _Line(this.start, p).vector());
const normalized = Math.min(1, Math.max(0, product / this.squaredLength()));
if (Number.isNaN(normalized)) {
return 0;
}
return normalized;
}
/**
* Returns a point on the line that lies `rate` (normalized length) away from
* the beginning of the line.
*/
pointAt(ratio) {
const start = this.start;
const end = this.end;
if (ratio <= 0) {
return start.clone();
}
if (ratio >= 1) {
return end.clone();
}
return start.lerp(end, ratio);
}
/**
* Returns a point on the line that lies length away from the beginning of
* the line.
*/
pointAtLength(length) {
const start = this.start;
const end = this.end;
let fromStart = true;
if (length < 0) {
fromStart = false;
length = -length;
}
const total = this.length();
if (length >= total) {
return fromStart ? end.clone() : start.clone();
}
const rate = (fromStart ? length : total - length) / total;
return this.pointAt(rate);
}
/**
* Divides the line into two lines at the point that lies `rate` (normalized
* length) away from the beginning of the line.
*/
divideAt(ratio) {
const dividerPoint = this.pointAt(ratio);
return [
new _Line(this.start, dividerPoint),
new _Line(dividerPoint, this.end)
];
}
/**
* Divides the line into two lines at the point that lies length away from
* the beginning of the line.
*/
divideAtLength(length) {
const dividerPoint = this.pointAtLength(length);
return [
new _Line(this.start, dividerPoint),
new _Line(dividerPoint, this.end)
];
}
/**
* Returns `true` if the point `p` lies on the line. Return `false` otherwise.
*/
containsPoint(p) {
const start = this.start;
const end = this.end;
if (start.cross(p, end) !== 0) {
return false;
}
const length = this.length();
if (new _Line(start, p).length() > length) {
return false;
}
if (new _Line(p, end).length() > length) {
return false;
}
return true;
}
intersect(shape, options) {
const ret = shape.intersectsWithLine(this, options);
if (ret) {
return Array.isArray(ret) ? ret : [ret];
}
return null;
}
/**
* Returns the intersection point of the line with another line. Returns
* `null` if no intersection exists.
*/
intersectsWithLine(line) {
const pt1Dir = new Point(this.end.x - this.start.x, this.end.y - this.start.y);
const pt2Dir = new Point(line.end.x - line.start.x, line.end.y - line.start.y);
const det = pt1Dir.x * pt2Dir.y - pt1Dir.y * pt2Dir.x;
const deltaPt = new Point(line.start.x - this.start.x, line.start.y - this.start.y);
const alpha = deltaPt.x * pt2Dir.y - deltaPt.y * pt2Dir.x;
const beta = deltaPt.x * pt1Dir.y - deltaPt.y * pt1Dir.x;
if (det === 0 || alpha * det < 0 || beta * det < 0) {
return null;
}
if (det > 0) {
if (alpha > det || beta > det) {
return null;
}
} else if (alpha < det || beta < det) {
return null;
}
return new Point(this.start.x + alpha * pt1Dir.x / det, this.start.y + alpha * pt1Dir.y / det);
}
/**
* Returns `true` if a tangent line can be found for the line.
*
* Tangents cannot be found if both of the line endpoints are coincident
* (the line appears to be a point).
*/
isDifferentiable() {
return !this.start.equals(this.end);
}
/**
* Returns the perpendicular distance between the line and point. The
* distance is positive if the point lies to the right of the line, negative
* if the point lies to the left of the line, and `0` if the point lies on
* the line.
*/
pointOffset(p) {
const ref = Point.clone(p);
const start = this.start;
const end = this.end;
const determinant = (end.x - start.x) * (ref.y - start.y) - (end.y - start.y) * (ref.x - start.x);
return determinant / this.length();
}
pointSquaredDistance(x, y) {
const p = Point.create(x, y);
return this.closestPoint(p).squaredDistance(p);
}
pointDistance(x, y) {
const p = Point.create(x, y);
return this.closestPoint(p).distance(p);
}
/**
* Returns a line tangent to the line at point that lies `rate` (normalized
* length) away from the beginning of the line.
*/
tangentAt(ratio) {
if (!this.isDifferentiable()) {
return null;
}
const start = this.start;
const end = this.end;
const tangentStart = this.pointAt(ratio);
const tangentLine = new _Line(start, end);
tangentLine.translate(tangentStart.x - start.x, tangentStart.y - start.y);
return tangentLine;
}
/**
* Returns a line tangent to the line at point that lies `length` away from
* the beginning of the line.
*/
tangentAtLength(length) {
if (!this.isDifferentiable()) {
return null;
}
const start = this.start;
const end = this.end;
const tangentStart = this.pointAtLength(length);
const tangentLine = new _Line(start, end);
tangentLine.translate(tangentStart.x - start.x, tangentStart.y - start.y);
return tangentLine;
}
relativeCcw(x, y) {
const ref = Point.create(x, y);
let dx1 = ref.x - this.start.x;
let dy1 = ref.y - this.start.y;
const dx2 = this.end.x - this.start.x;
const dy2 = this.end.y - this.start.y;
let ccw = dx1 * dy2 - dy1 * dx2;
if (ccw === 0) {
ccw = dx1 * dx2 + dy1 * dy2;
if (ccw > 0) {
dx1 -= dx2;
dy1 -= dy2;
ccw = dx1 * dx2 + dy1 * dy2;
if (ccw < 0) {
ccw = 0;
}
}
}
return ccw < 0 ? -1 : ccw > 0 ? 1 : 0;
}
/**
* Return `true` if the line equals the other line.
*/
equals(l) {
return l != null && this.start.x === l.start.x && this.start.y === l.start.y && this.end.x === l.end.x && this.end.y === l.end.y;
}
/**
* Returns another line which is a clone of the line.
*/
clone() {
return new _Line(this.start, this.end);
}
toJSON() {
return { start: this.start.toJSON(), end: this.end.toJSON() };
}
serialize() {
return [this.start.serialize(), this.end.serialize()].join(" ");
}
};
(function(Line2) {
function isLine(instance) {
return instance != null && instance instanceof Line2;
}
Line2.isLine = isLine;
})(Line || (Line = {}));
}
});
// node_modules/@antv/x6-geometry/es/rectangle.js
var Rectangle;
var init_rectangle = __esm({
"node_modules/@antv/x6-geometry/es/rectangle.js"() {
init_util4();
init_angle();
init_line();
init_point();
init_geometry();
Rectangle = class _Rectangle extends Geometry {
get left() {
return this.x;
}
get top() {
return this.y;
}
get right() {
return this.x + this.width;
}
get bottom() {
return this.y + this.height;
}
get origin() {
return new Point(this.x, this.y);
}
get topLeft() {
return new Point(this.x, this.y);
}
get topCenter() {
return new Point(this.x + this.width / 2, this.y);
}
get topRight() {
return new Point(this.x + this.width, this.y);
}
get center() {
return new Point(this.x + this.width / 2, this.y + this.height / 2);
}
get bottomLeft() {
return new Point(this.x, this.y + this.height);
}
get bottomCenter() {
return new Point(this.x + this.width / 2, this.y + this.height);
}
get bottomRight() {
return new Point(this.x + this.width, this.y + this.height);
}
get corner() {
return new Point(this.x + this.width, this.y + this.height);
}
get rightMiddle() {
return new Point(this.x + this.width, this.y + this.height / 2);
}
get leftMiddle() {
return new Point(this.x, this.y + this.height / 2);
}
get topLine() {
return new Line(this.topLeft, this.topRight);
}
get rightLine() {
return new Line(this.topRight, this.bottomRight);
}
get bottomLine() {
return new Line(this.bottomLeft, this.bottomRight);
}
get leftLine() {
return new Line(this.topLeft, this.bottomLeft);
}
constructor(x, y, width2, height2) {
super();
this.x = x == null ? 0 : x;
this.y = y == null ? 0 : y;
this.width = width2 == null ? 0 : width2;
this.height = height2 == null ? 0 : height2;
}
getOrigin() {
return this.origin;
}
getTopLeft() {
return this.topLeft;
}
getTopCenter() {
return this.topCenter;
}
getTopRight() {
return this.topRight;
}
getCenter() {
return this.center;
}
getCenterX() {
return this.x + this.width / 2;
}
getCenterY() {
return this.y + this.height / 2;
}
getBottomLeft() {
return this.bottomLeft;
}
getBottomCenter() {
return this.bottomCenter;
}
getBottomRight() {
return this.bottomRight;
}
getCorner() {
return this.corner;
}
getRightMiddle() {
return this.rightMiddle;
}
getLeftMiddle() {
return this.leftMiddle;
}
getTopLine() {
return this.topLine;
}
getRightLine() {
return this.rightLine;
}
getBottomLine() {
return this.bottomLine;
}
getLeftLine() {
return this.leftLine;
}
/**
* Returns a rectangle that is the bounding box of the rectangle.
*
* If `angle` is specified, the bounding box calculation will take into
* account the rotation of the rectangle by angle degrees around its center.
*/
bbox(angle) {
if (!angle) {
return this.clone();
}
const rad = Angle.toRad(angle);
const st = Math.abs(Math.sin(rad));
const ct = Math.abs(Math.cos(rad));
const w = this.width * ct + this.height * st;
const h = this.width * st + this.height * ct;
return new _Rectangle(this.x + (this.width - w) / 2, this.y + (this.height - h) / 2, w, h);
}
round(precision = 0) {
this.x = GeometryUtil.round(this.x, precision);
this.y = GeometryUtil.round(this.y, precision);
this.width = GeometryUtil.round(this.width, precision);
this.height = GeometryUtil.round(this.height, precision);
return this;
}
add(x, y, width2, height2) {
const rect = _Rectangle.create(x, y, width2, height2);
const minX = Math.min(this.x, rect.x);
const minY = Math.min(this.y, rect.y);
const maxX = Math.max(this.x + this.width, rect.x + rect.width);
const maxY = Math.max(this.y + this.height, rect.y + rect.height);
this.x = minX;
this.y = minY;
this.width = maxX - minX;
this.height = maxY - minY;
return this;
}
update(x, y, width2, height2) {
const rect = _Rectangle.create(x, y, width2, height2);
this.x = rect.x;
this.y = rect.y;
this.width = rect.width;
this.height = rect.height;
return this;
}
inflate(dx, dy) {
const w = dx;
const h = dy != null ? dy : dx;
this.x -= w;
this.y -= h;
this.width += 2 * w;
this.height += 2 * h;
return this;
}
snapToGrid(gx, gy) {
const origin = this.origin.snapToGrid(gx, gy);
const corner = this.corner.snapToGrid(gx, gy);
this.x = origin.x;
this.y = origin.y;
this.width = corner.x - origin.x;
this.height = corner.y - origin.y;
return this;
}
translate(tx, ty) {
const p = Point.create(tx, ty);
this.x += p.x;
this.y += p.y;
return this;
}
scale(sx, sy, origin = new Point()) {
const pos = this.origin.scale(sx, sy, origin);
this.x = pos.x;
this.y = pos.y;
this.width *= sx;
this.height *= sy;
return this;
}
rotate(degree, center = this.getCenter()) {
if (degree !== 0) {
const rad = Angle.toRad(degree);
const cos = Math.cos(rad);
const sin = Math.sin(rad);
let p1 = this.getOrigin();
let p2 = this.getTopRight();
let p3 = this.getBottomRight();
let p4 = this.getBottomLeft();
p1 = Point.rotateEx(p1, cos, sin, center);
p2 = Point.rotateEx(p2, cos, sin, center);
p3 = Point.rotateEx(p3, cos, sin, center);
p4 = Point.rotateEx(p4, cos, sin, center);
const rect = new _Rectangle(p1.x, p1.y, 0, 0);
rect.add(p2.x, p2.y, 0, 0);
rect.add(p3.x, p3.y, 0, 0);
rect.add(p4.x, p4.y, 0, 0);
this.update(rect);
}
return this;
}
rotate90() {
const t = (this.width - this.height) / 2;
this.x += t;
this.y -= t;
const tmp = this.width;
this.width = this.height;
this.height = tmp;
return this;
}
/**
* Translates the rectangle by `rect.x` and `rect.y` and expand it by
* `rect.width` and `rect.height`.
*/
moveAndExpand(rect) {
const ref = _Rectangle.clone(rect);
this.x += ref.x || 0;
this.y += ref.y || 0;
this.width += ref.width || 0;
this.height += ref.height || 0;
return this;
}
/**
* Returns an object where `sx` and `sy` give the maximum scaling that can be
* applied to the rectangle so that it would still fit into `limit`. If
* `origin` is specified, the rectangle is scaled around it; otherwise, it is
* scaled around its center.
*/
getMaxScaleToFit(limit, origin = this.center) {
const rect = _Rectangle.clone(limit);
const ox = origin.x;
const oy = origin.y;
let sx1 = Infinity;
let sx2 = Infinity;
let sx3 = Infinity;
let sx4 = Infinity;
let sy1 = Infinity;
let sy2 = Infinity;
let sy3 = Infinity;
let sy4 = Infinity;
const p1 = rect.topLeft;
if (p1.x < ox) {
sx1 = (this.x - ox) / (p1.x - ox);
}
if (p1.y < oy) {
sy1 = (this.y - oy) / (p1.y - oy);
}
const p2 = rect.bottomRight;
if (p2.x > ox) {
sx2 = (this.x + this.width - ox) / (p2.x - ox);
}
if (p2.y > oy) {
sy2 = (this.y + this.height - oy) / (p2.y - oy);
}
const p3 = rect.topRight;
if (p3.x > ox) {
sx3 = (this.x + this.width - ox) / (p3.x - ox);
}
if (p3.y < oy) {
sy3 = (this.y - oy) / (p3.y - oy);
}
const p4 = rect.bottomLeft;
if (p4.x < ox) {
sx4 = (this.x - ox) / (p4.x - ox);
}
if (p4.y > oy) {
sy4 = (this.y + this.height - oy) / (p4.y - oy);
}
return {
sx: Math.min(sx1, sx2, sx3, sx4),
sy: Math.min(sy1, sy2, sy3, sy4)
};
}
/**
* Returns a number that specifies the maximum scaling that can be applied to
* the rectangle along both axes so that it would still fit into `limit`. If
* `origin` is specified, the rectangle is scaled around it; otherwise, it is
* scaled around its center.
*/
getMaxUniformScaleToFit(limit, origin = this.center) {
const scale2 = this.getMaxScaleToFit(limit, origin);
return Math.min(scale2.sx, scale2.sy);
}
containsPoint(x, y) {
return GeometryUtil.containsPoint(this, Point.create(x, y));
}
containsRect(x, y, width2, height2) {
const b = _Rectangle.create(x, y, width2, height2);
const x1 = this.x;
const y1 = this.y;
const w1 = this.width;
const h1 = this.height;
const x2 = b.x;
const y2 = b.y;
const w2 = b.width;
const h2 = b.height;
if (w1 === 0 || h1 === 0 || w2 === 0 || h2 === 0) {
return false;
}
return x2 >= x1 && y2 >= y1 && x2 + w2 <= x1 + w1 && y2 + h2 <= y1 + h1;
}
/**
* Returns an array of the intersection points of the rectangle and the line.
* Return `null` if no intersection exists.
*/
intersectsWithLine(line) {
const rectLines = [
this.topLine,
this.rightLine,
this.bottomLine,
this.leftLine
];
const points = [];
const dedupeArr = [];
rectLines.forEach((l) => {
const p = line.intersectsWithLine(l);
if (p !== null && dedupeArr.indexOf(p.toString()) < 0) {
points.push(p);
dedupeArr.push(p.toString());
}
});
return points.length > 0 ? points : null;
}
/**
* Returns the point on the boundary of the rectangle that is the intersection
* of the rectangle with a line starting in the center the rectangle ending in
* the point `p`.
*
* If `angle` is specified, the intersection will take into account the
* rotation of the rectangle by `angle` degrees around its center.
*/
intersectsWithLineFromCenterToPoint(p, angle) {
const ref = Point.clone(p);
const center = this.center;
let result = null;
if (angle != null && angle !== 0) {
ref.rotate(angle, center);
}
const sides = [this.topLine, this.rightLine, this.bottomLine, this.leftLine];
const connector = new Line(center, ref);
for (let i = sides.length - 1; i >= 0; i -= 1) {
const intersection = sides[i].intersectsWithLine(connector);
if (intersection !== null) {
result = intersection;
break;
}
}
if (result && angle != null && angle !== 0) {
result.rotate(-angle, center);
}
return result;
}
intersectsWithRect(x, y, width2, height2) {
const ref = _Rectangle.create(x, y, width2, height2);
if (!this.isIntersectWithRect(ref)) {
return null;
}
const myOrigin = this.origin;
const myCorner = this.corner;
const rOrigin = ref.origin;
const rCorner = ref.corner;
const xx = Math.max(myOrigin.x, rOrigin.x);
const yy = Math.max(myOrigin.y, rOrigin.y);
return new _Rectangle(xx, yy, Math.min(myCorner.x, rCorner.x) - xx, Math.min(myCorner.y, rCorner.y) - yy);
}
isIntersectWithRect(x, y, width2, height2) {
const ref = _Rectangle.create(x, y, width2, height2);
const myOrigin = this.origin;
const myCorner = this.corner;
const rOrigin = ref.origin;
const rCorner = ref.corner;
if (rCorner.x <= myOrigin.x || rCorner.y <= myOrigin.y || rOrigin.x >= myCorner.x || rOrigin.y >= myCorner.y) {
return false;
}
return true;
}
/**
* Normalize the rectangle, i.e. make it so that it has non-negative
* width and height. If width is less than `0`, the function swaps left and
* right corners and if height is less than `0`, the top and bottom corners
* are swapped.
*/
normalize() {
let newx = this.x;
let newy = this.y;
let newwidth = this.width;
let newheight = this.height;
if (this.width < 0) {
newx = this.x + this.width;
newwidth = -this.width;
}
if (this.height < 0) {
newy = this.y + this.height;
newheight = -this.height;
}
this.x = newx;
this.y = newy;
this.width = newwidth;
this.height = newheight;
return this;
}
/**
* Returns a rectangle that is a union of this rectangle and rectangle `rect`.
*/
union(rect) {
const ref = _Rectangle.clone(rect);
const myOrigin = this.origin;
const myCorner = this.corner;
const rOrigin = ref.origin;
const rCorner = ref.corner;
const originX = Math.min(myOrigin.x, rOrigin.x);
const originY = Math.min(myOrigin.y, rOrigin.y);
const cornerX = Math.max(myCorner.x, rCorner.x);
const cornerY = Math.max(myCorner.y, rCorner.y);
return new _Rectangle(originX, originY, cornerX - originX, cornerY - originY);
}
/**
* Returns a string ("top", "left", "right" or "bottom") denoting the side of
* the rectangle which is nearest to the point `p`.
*/
getNearestSideToPoint(p) {
const ref = Point.clone(p);
const distLeft = ref.x - this.x;
const distRight = this.x + this.width - ref.x;
const distTop = ref.y - this.y;
const distBottom = this.y + this.height - ref.y;
let closest = distLeft;
let side = "left";
if (distRight < closest) {
closest = distRight;
side = "right";
}
if (distTop < closest) {
closest = distTop;
side = "top";
}
if (distBottom < closest) {
side = "bottom";
}
return side;
}
/**
* Returns a point on the boundary of the rectangle nearest to the point `p`.
*/
getNearestPointToPoint(p) {
const ref = Point.clone(p);
if (this.containsPoint(ref)) {
const side = this.getNearestSideToPoint(ref);
if (side === "left") {
return new Point(this.x, ref.y);
}
if (side === "top") {
return new Point(ref.x, this.y);
}
if (side === "right") {
return new Point(this.x + this.width, ref.y);
}
if (side === "bottom") {
return new Point(ref.x, this.y + this.height);
}
}
return ref.adhereToRect(this);
}
equals(rect) {
return rect != null && rect.x === this.x && rect.y === this.y && rect.width === this.width && rect.height === this.height;
}
clone() {
return new _Rectangle(this.x, this.y, this.width, this.height);
}
toJSON() {
return { x: this.x, y: this.y, width: this.width, height: this.height };
}
serialize() {
return `${this.x} ${this.y} ${this.width} ${this.height}`;
}
};
(function(Rectangle2) {
function isRectangle(instance) {
return instance != null && instance instanceof Rectangle2;
}
Rectangle2.isRectangle = isRectangle;
})(Rectangle || (Rectangle = {}));
(function(Rectangle2) {
function isRectangleLike(o) {
return o != null && typeof o === "object" && typeof o.x === "number" && typeof o.y === "number" && typeof o.width === "number" && typeof o.height === "number";
}
Rectangle2.isRectangleLike = isRectangleLike;
})(Rectangle || (Rectangle = {}));
(function(Rectangle2) {
function create(x, y, width2, height2) {
if (x == null || typeof x === "number") {
return new Rectangle2(x, y, width2, height2);
}
return clone(x);
}
Rectangle2.create = create;
function clone(rect) {
if (Rectangle2.isRectangle(rect)) {
return rect.clone();
}
if (Array.isArray(rect)) {
return new Rectangle2(rect[0], rect[1], rect[2], rect[3]);
}
return new Rectangle2(rect.x, rect.y, rect.width, rect.height);
}
Rectangle2.clone = clone;
function fromEllipse(ellipse) {
return new Rectangle2(ellipse.x - ellipse.a, ellipse.y - ellipse.b, 2 * ellipse.a, 2 * ellipse.b);
}
Rectangle2.fromEllipse = fromEllipse;
function fromSize(size) {
return new Rectangle2(0, 0, size.width, size.height);
}
Rectangle2.fromSize = fromSize;
function fromPositionAndSize(pos, size) {
return new Rectangle2(pos.x, pos.y, size.width, size.height);
}
Rectangle2.fromPositionAndSize = fromPositionAndSize;
})(Rectangle || (Rectangle = {}));
}
});
// node_modules/@antv/x6-geometry/es/ellipse.js
var Ellipse;
var init_ellipse = __esm({
"node_modules/@antv/x6-geometry/es/ellipse.js"() {
init_point();
init_rectangle();
init_geometry();
Ellipse = class _Ellipse extends Geometry {
get center() {
return new Point(this.x, this.y);
}
constructor(x, y, a, b) {
super();
this.x = x == null ? 0 : x;
this.y = y == null ? 0 : y;
this.a = a == null ? 0 : a;
this.b = b == null ? 0 : b;
}
/**
* Returns a rectangle that is the bounding box of the ellipse.
*/
bbox() {
return Rectangle.fromEllipse(this);
}
/**
* Returns a point that is the center of the ellipse.
*/
getCenter() {
return this.center;
}
inflate(dx, dy) {
const w = dx;
const h = dy != null ? dy : dx;
this.a += 2 * w;
this.b += 2 * h;
return this;
}
normalizedDistance(x, y) {
const ref = Point.create(x, y);
const dx = ref.x - this.x;
const dy = ref.y - this.y;
const a = this.a;
const b = this.b;
return dx * dx / (a * a) + dy * dy / (b * b);
}
containsPoint(x, y) {
return this.normalizedDistance(x, y) <= 1;
}
/**
* Returns an array of the intersection points of the ellipse and the line.
* Returns `null` if no intersection exists.
*/
intersectsWithLine(line) {
const intersections = [];
const rx = this.a;
const ry = this.b;
const a1 = line.start;
const a2 = line.end;
const dir = line.vector();
const diff = a1.diff(new Point(this.x, this.y));
const mDir = new Point(dir.x / (rx * rx), dir.y / (ry * ry));
const mDiff = new Point(diff.x / (rx * rx), diff.y / (ry * ry));
const a = dir.dot(mDir);
const b = dir.dot(mDiff);
const c = diff.dot(mDiff) - 1;
const d = b * b - a * c;
if (d < 0) {
return null;
}
if (d > 0) {
const root = Math.sqrt(d);
const ta = (-b - root) / a;
const tb = (-b + root) / a;
if ((ta < 0 || ta > 1) && (tb < 0 || tb > 1)) {
return null;
}
if (ta >= 0 && ta <= 1) {
intersections.push(a1.lerp(a2, ta));
}
if (tb >= 0 && tb <= 1) {
intersections.push(a1.lerp(a2, tb));
}
} else {
const t = -b / a;
if (t >= 0 && t <= 1) {
intersections.push(a1.lerp(a2, t));
} else {
return null;
}
}
return intersections;
}
/**
* Returns the point on the boundary of the ellipse that is the
* intersection of the ellipse with a line starting in the center
* of the ellipse ending in the point `p`.
*
* If angle is specified, the intersection will take into account
* the rotation of the ellipse by angle degrees around its center.
*/
intersectsWithLineFromCenterToPoint(p, angle = 0) {
const ref = Point.clone(p);
if (angle) {
ref.rotate(angle, this.getCenter());
}
const dx = ref.x - this.x;
const dy = ref.y - this.y;
let result;
if (dx === 0) {
result = this.bbox().getNearestPointToPoint(ref);
if (angle) {
return result.rotate(-angle, this.getCenter());
}
return result;
}
const m = dy / dx;
const mSquared = m * m;
const aSquared = this.a * this.a;
const bSquared = this.b * this.b;
let x = Math.sqrt(1 / (1 / aSquared + mSquared / bSquared));
x = dx < 0 ? -x : x;
const y = m * x;
result = new Point(this.x + x, this.y + y);
if (angle) {
return result.rotate(-angle, this.getCenter());
}
return result;
}
/**
* Returns the angle between the x-axis and the tangent from a point. It is
* valid for points lying on the ellipse boundary only.
*/
tangentTheta(p) {
const ref = Point.clone(p);
const x0 = ref.x;
const y0 = ref.y;
const a = this.a;
const b = this.b;
const center = this.bbox().center;
const cx = center.x;
const cy = center.y;
const refPointDelta = 30;
const q1 = x0 > center.x + a / 2;
const q3 = x0 < center.x - a / 2;
let x;
let y;
if (q1 || q3) {
y = x0 > center.x ? y0 - refPointDelta : y0 + refPointDelta;
x = a * a / (x0 - cx) - a * a * (y0 - cy) * (y - cy) / (b * b * (x0 - cx)) + cx;
} else {
x = y0 > center.y ? x0 + refPointDelta : x0 - refPointDelta;
y = b * b / (y0 - cy) - b * b * (x0 - cx) * (x - cx) / (a * a * (y0 - cy)) + cy;
}
return new Point(x, y).theta(ref);
}
scale(sx, sy) {
this.a *= sx;
this.b *= sy;
return this;
}
rotate(angle, origin) {
const rect = Rectangle.fromEllipse(this);
rect.rotate(angle, origin);
const ellipse = _Ellipse.fromRect(rect);
this.a = ellipse.a;
this.b = ellipse.b;
this.x = ellipse.x;
this.y = ellipse.y;
return this;
}
translate(dx, dy) {
const p = Point.create(dx, dy);
this.x += p.x;
this.y += p.y;
return this;
}
equals(ellipse) {
return ellipse != null && ellipse.x === this.x && ellipse.y === this.y && ellipse.a === this.a && ellipse.b === this.b;
}
clone() {
return new _Ellipse(this.x, this.y, this.a, this.b);
}
toJSON() {
return { x: this.x, y: this.y, a: this.a, b: this.b };
}
serialize() {
return `${this.x} ${this.y} ${this.a} ${this.b}`;
}
};
(function(Ellipse2) {
function isEllipse(instance) {
return instance != null && instance instanceof Ellipse2;
}
Ellipse2.isEllipse = isEllipse;
})(Ellipse || (Ellipse = {}));
(function(Ellipse2) {
function create(x, y, a, b) {
if (x == null || typeof x === "number") {
return new Ellipse2(x, y, a, b);
}
return parse2(x);
}
Ellipse2.create = create;
function parse2(e) {
if (Ellipse2.isEllipse(e)) {
return e.clone();
}
if (Array.isArray(e)) {
return new Ellipse2(e[0], e[1], e[2], e[3]);
}
return new Ellipse2(e.x, e.y, e.a, e.b);
}
Ellipse2.parse = parse2;
function fromRect(rect) {
const center = rect.center;
return new Ellipse2(center.x, center.y, rect.width / 2, rect.height / 2);
}
Ellipse2.fromRect = fromRect;
})(Ellipse || (Ellipse = {}));
}
});
// node_modules/@antv/x6-geometry/es/polyline.js
var Polyline;
var init_polyline = __esm({
"node_modules/@antv/x6-geometry/es/polyline.js"() {
init_line();
init_point();
init_rectangle();
init_geometry();
Polyline = class _Polyline extends Geometry {
get start() {
return this.points[0] || null;
}
get end() {
return this.points[this.points.length - 1] || null;
}
constructor(points) {
super();
if (points != null) {
if (typeof points === "string") {
return _Polyline.parse(points);
}
this.points = points.map((p) => Point.create(p));
} else {
this.points = [];
}
}
scale(sx, sy, origin = new Point()) {
this.points.forEach((p) => p.scale(sx, sy, origin));
return this;
}
rotate(angle, origin) {
this.points.forEach((p) => p.rotate(angle, origin));
return this;
}
translate(dx, dy) {
const t = Point.create(dx, dy);
this.points.forEach((p) => p.translate(t.x, t.y));
return this;
}
round(precision = 0) {
this.points.forEach((p) => p.round(precision));
return this;
}
bbox() {
if (this.points.length === 0) {
return new Rectangle();
}
let x1 = Infinity;
let x2 = -Infinity;
let y1 = Infinity;
let y2 = -Infinity;
const points = this.points;
for (let i = 0, ii = points.length; i < ii; i += 1) {
const point = points[i];
const x = point.x;
const y = point.y;
if (x < x1)
x1 = x;
if (x > x2)
x2 = x;
if (y < y1)
y1 = y;
if (y > y2)
y2 = y;
}
return new Rectangle(x1, y1, x2 - x1, y2 - y1);
}
closestPoint(p) {
const cpLength = this.closestPointLength(p);
return this.pointAtLength(cpLength);
}
closestPointLength(p) {
const points = this.points;
const count = points.length;
if (count === 0 || count === 1) {
return 0;
}
let length = 0;
let cpLength = 0;
let minSqrDistance = Infinity;
for (let i = 0, ii = count - 1; i < ii; i += 1) {
const line = new Line(points[i], points[i + 1]);
const lineLength = line.length();
const cpNormalizedLength = line.closestPointNormalizedLength(p);
const cp = line.pointAt(cpNormalizedLength);
const sqrDistance = cp.squaredDistance(p);
if (sqrDistance < minSqrDistance) {
minSqrDistance = sqrDistance;
cpLength = length + cpNormalizedLength * lineLength;
}
length += lineLength;
}
return cpLength;
}
closestPointNormalizedLength(p) {
const length = this.length();
if (length === 0) {
return 0;
}
const cpLength = this.closestPointLength(p);
return cpLength / length;
}
closestPointTangent(p) {
const cpLength = this.closestPointLength(p);
return this.tangentAtLength(cpLength);
}
containsPoint(p) {
if (this.points.length === 0) {
return false;
}
const ref = Point.clone(p);
const x = ref.x;
const y = ref.y;
const points = this.points;
const count = points.length;
let startIndex = count - 1;
let intersectionCount = 0;
for (let endIndex = 0; endIndex < count; endIndex += 1) {
const start = points[startIndex];
const end = points[endIndex];
if (ref.equals(start)) {
return true;
}
const segment = new Line(start, end);
if (segment.containsPoint(p)) {
return true;
}
if (y <= start.y && y > end.y || y > start.y && y <= end.y) {
const xDifference = start.x - x > end.x - x ? start.x - x : end.x - x;
if (xDifference >= 0) {
const rayEnd = new Point(x + xDifference, y);
const ray = new Line(p, rayEnd);
if (segment.intersectsWithLine(ray)) {
intersectionCount += 1;
}
}
}
startIndex = endIndex;
}
return intersectionCount % 2 === 1;
}
intersectsWithLine(line) {
const intersections = [];
for (let i = 0, n = this.points.length - 1; i < n; i += 1) {
const a = this.points[i];
const b = this.points[i + 1];
const int = line.intersectsWithLine(new Line(a, b));
if (int) {
intersections.push(int);
}
}
return intersections.length > 0 ? intersections : null;
}
isDifferentiable() {
for (let i = 0, ii = this.points.length - 1; i < ii; i += 1) {
const a = this.points[i];
const b = this.points[i + 1];
const line = new Line(a, b);
if (line.isDifferentiable()) {
return true;
}
}
return false;
}
length() {
let len = 0;
for (let i = 0, ii = this.points.length - 1; i < ii; i += 1) {
const a = this.points[i];
const b = this.points[i + 1];
len += a.distance(b);
}
return len;
}
pointAt(ratio) {
const points = this.points;
const count = points.length;
if (count === 0) {
return null;
}
if (count === 1) {
return points[0].clone();
}
if (ratio <= 0) {
return points[0].clone();
}
if (ratio >= 1) {
return points[count - 1].clone();
}
const total = this.length();
const length = total * ratio;
return this.pointAtLength(length);
}
pointAtLength(length) {
const points = this.points;
const count = points.length;
if (count === 0) {
return null;
}
if (count === 1) {
return points[0].clone();
}
let fromStart = true;
if (length < 0) {
fromStart = false;
length = -length;
}
let tmp = 0;
for (let i = 0, ii = count - 1; i < ii; i += 1) {
const index2 = fromStart ? i : ii - 1 - i;
const a = points[index2];
const b = points[index2 + 1];
const l = new Line(a, b);
const d = a.distance(b);
if (length <= tmp + d) {
return l.pointAtLength((fromStart ? 1 : -1) * (length - tmp));
}
tmp += d;
}
const lastPoint = fromStart ? points[count - 1] : points[0];
return lastPoint.clone();
}
tangentAt(ratio) {
const points = this.points;
const count = points.length;
if (count === 0 || count === 1) {
return null;
}
if (ratio < 0) {
ratio = 0;
}
if (ratio > 1) {
ratio = 1;
}
const total = this.length();
const length = total * ratio;
return this.tangentAtLength(length);
}
tangentAtLength(length) {
const points = this.points;
const count = points.length;
if (count === 0 || count === 1) {
return null;
}
let fromStart = true;
if (length < 0) {
fromStart = false;
length = -length;
}
let lastValidLine;
let tmp = 0;
for (let i = 0, ii = count - 1; i < ii; i += 1) {
const index2 = fromStart ? i : ii - 1 - i;
const a = points[index2];
const b = points[index2 + 1];
const l = new Line(a, b);
const d = a.distance(b);
if (l.isDifferentiable()) {
if (length <= tmp + d) {
return l.tangentAtLength((fromStart ? 1 : -1) * (length - tmp));
}
lastValidLine = l;
}
tmp += d;
}
if (lastValidLine) {
const ratio = fromStart ? 1 : 0;
return lastValidLine.tangentAt(ratio);
}
return null;
}
simplify(options = {}) {
const points = this.points;
if (points.length < 3) {
return this;
}
const threshold = options.threshold || 0;
let currentIndex = 0;
while (points[currentIndex + 2]) {
const firstIndex = currentIndex;
const middleIndex = currentIndex + 1;
const lastIndex = currentIndex + 2;
const firstPoint = points[firstIndex];
const middlePoint = points[middleIndex];
const lastPoint = points[lastIndex];
const chord = new Line(firstPoint, lastPoint);
const closestPoint = chord.closestPoint(middlePoint);
const closestPointDistance = closestPoint.distance(middlePoint);
if (closestPointDistance <= threshold) {
points.splice(middleIndex, 1);
} else {
currentIndex += 1;
}
}
return this;
}
toHull() {
const points = this.points;
const count = points.length;
if (count === 0) {
return new _Polyline();
}
let startPoint = points[0];
for (let i = 1; i < count; i += 1) {
if (points[i].y < startPoint.y) {
startPoint = points[i];
} else if (points[i].y === startPoint.y && points[i].x > startPoint.x) {
startPoint = points[i];
}
}
const sortedRecords = [];
for (let i = 0; i < count; i += 1) {
let angle = startPoint.theta(points[i]);
if (angle === 0) {
angle = 360;
}
sortedRecords.push([points[i], i, angle]);
}
sortedRecords.sort((record1, record2) => {
let ret = record1[2] - record2[2];
if (ret === 0) {
ret = record2[1] - record1[1];
}
return ret;
});
if (sortedRecords.length > 2) {
const startPoint2 = sortedRecords[sortedRecords.length - 1];
sortedRecords.unshift(startPoint2);
}
const insidePoints = {};
const hullRecords = [];
const getKey = (record) => `${record[0].toString()}@${record[1]}`;
while (sortedRecords.length !== 0) {
const currentRecord = sortedRecords.pop();
const currentPoint = currentRecord[0];
if (insidePoints[getKey(currentRecord)]) {
continue;
}
let correctTurnFound = false;
while (!correctTurnFound) {
if (hullRecords.length < 2) {
hullRecords.push(currentRecord);
correctTurnFound = true;
} else {
const lastHullRecord = hullRecords.pop();
const lastHullPoint = lastHullRecord[0];
const secondLastHullRecord = hullRecords.pop();
const secondLastHullPoint = secondLastHullRecord[0];
const crossProduct = secondLastHullPoint.cross(lastHullPoint, currentPoint);
if (crossProduct < 0) {
hullRecords.push(secondLastHullRecord);
hullRecords.push(lastHullRecord);
hullRecords.push(currentRecord);
correctTurnFound = true;
} else if (crossProduct === 0) {
const THRESHOLD = 1e-10;
const angleBetween = lastHullPoint.angleBetween(secondLastHullPoint, currentPoint);
if (Math.abs(angleBetween - 180) < THRESHOLD) {
insidePoints[getKey(lastHullRecord)] = lastHullPoint;
hullRecords.push(secondLastHullRecord);
} else if (lastHullPoint.equals(currentPoint) || secondLastHullPoint.equals(lastHullPoint)) {
insidePoints[getKey(lastHullRecord)] = lastHullPoint;
hullRecords.push(secondLastHullRecord);
} else if (Math.abs((angleBetween + 1) % 360 - 1) < THRESHOLD) {
hullRecords.push(secondLastHullRecord);
sortedRecords.push(lastHullRecord);
}
} else {
insidePoints[getKey(lastHullRecord)] = lastHullPoint;
hullRecords.push(secondLastHullRecord);
}
}
}
}
if (hullRecords.length > 2) {
hullRecords.pop();
}
let lowestHullIndex;
let indexOfLowestHullIndexRecord = -1;
for (let i = 0, n = hullRecords.length; i < n; i += 1) {
const currentHullIndex = hullRecords[i][1];
if (lowestHullIndex === void 0 || currentHullIndex < lowestHullIndex) {
lowestHullIndex = currentHullIndex;
indexOfLowestHullIndexRecord = i;
}
}
let hullPointRecordsReordered = [];
if (indexOfLowestHullIndexRecord > 0) {
const newFirstChunk = hullRecords.slice(indexOfLowestHullIndexRecord);
const newSecondChunk = hullRecords.slice(0, indexOfLowestHullIndexRecord);
hullPointRecordsReordered = newFirstChunk.concat(newSecondChunk);
} else {
hullPointRecordsReordered = hullRecords;
}
const hullPoints = [];
for (let i = 0, n = hullPointRecordsReordered.length; i < n; i += 1) {
hullPoints.push(hullPointRecordsReordered[i][0]);
}
return new _Polyline(hullPoints);
}
equals(p) {
if (p == null) {
return false;
}
if (p.points.length !== this.points.length) {
return false;
}
return p.points.every((a, i) => a.equals(this.points[i]));
}
clone() {
return new _Polyline(this.points.map((p) => p.clone()));
}
toJSON() {
return this.points.map((p) => p.toJSON());
}
serialize() {
return this.points.map((p) => `${p.serialize()}`).join(" ");
}
};
(function(Polyline2) {
function isPolyline(instance) {
return instance != null && instance instanceof Polyline2;
}
Polyline2.isPolyline = isPolyline;
})(Polyline || (Polyline = {}));
(function(Polyline2) {
function parse2(svgString) {
const str = svgString.trim();
if (str === "") {
return new Polyline2();
}
const points = [];
const coords = str.split(/\s*,\s*|\s+/);
for (let i = 0, ii = coords.length; i < ii; i += 2) {
points.push({ x: +coords[i], y: +coords[i + 1] });
}
return new Polyline2(points);
}
Polyline2.parse = parse2;
})(Polyline || (Polyline = {}));
}
});
// node_modules/@antv/x6-geometry/es/curve.js
var Curve;
var init_curve = __esm({
"node_modules/@antv/x6-geometry/es/curve.js"() {
init_line();
init_point();
init_polyline();
init_rectangle();
init_geometry();
Curve = class _Curve extends Geometry {
constructor(start, controlPoint1, controlPoint2, end) {
super();
this.PRECISION = 3;
this.start = Point.create(start);
this.controlPoint1 = Point.create(controlPoint1);
this.controlPoint2 = Point.create(controlPoint2);
this.end = Point.create(end);
}
bbox() {
const start = this.start;
const controlPoint1 = this.controlPoint1;
const controlPoint2 = this.controlPoint2;
const end = this.end;
const x0 = start.x;
const y0 = start.y;
const x1 = controlPoint1.x;
const y1 = controlPoint1.y;
const x2 = controlPoint2.x;
const y2 = controlPoint2.y;
const x3 = end.x;
const y3 = end.y;
const points = [];
const tvalues = [];
const bounds = [[], []];
let a;
let b;
let c;
let t;
let t1;
let t2;
let b2ac;
let sqrtb2ac;
for (let i = 0; i < 2; i += 1) {
if (i === 0) {
b = 6 * x0 - 12 * x1 + 6 * x2;
a = -3 * x0 + 9 * x1 - 9 * x2 + 3 * x3;
c = 3 * x1 - 3 * x0;
} else {
b = 6 * y0 - 12 * y1 + 6 * y2;
a = -3 * y0 + 9 * y1 - 9 * y2 + 3 * y3;
c = 3 * y1 - 3 * y0;
}
if (Math.abs(a) < 1e-12) {
if (Math.abs(b) < 1e-12) {
continue;
}
t = -c / b;
if (t > 0 && t < 1)
tvalues.push(t);
continue;
}
b2ac = b * b - 4 * c * a;
sqrtb2ac = Math.sqrt(b2ac);
if (b2ac < 0)
continue;
t1 = (-b + sqrtb2ac) / (2 * a);
if (t1 > 0 && t1 < 1)
tvalues.push(t1);
t2 = (-b - sqrtb2ac) / (2 * a);
if (t2 > 0 && t2 < 1)
tvalues.push(t2);
}
let x;
let y;
let mt;
let j = tvalues.length;
const jlen = j;
while (j) {
j -= 1;
t = tvalues[j];
mt = 1 - t;
x = mt * mt * mt * x0 + 3 * mt * mt * t * x1 + 3 * mt * t * t * x2 + t * t * t * x3;
bounds[0][j] = x;
y = mt * mt * mt * y0 + 3 * mt * mt * t * y1 + 3 * mt * t * t * y2 + t * t * t * y3;
bounds[1][j] = y;
points[j] = { X: x, Y: y };
}
tvalues[jlen] = 0;
tvalues[jlen + 1] = 1;
points[jlen] = { X: x0, Y: y0 };
points[jlen + 1] = { X: x3, Y: y3 };
bounds[0][jlen] = x0;
bounds[1][jlen] = y0;
bounds[0][jlen + 1] = x3;
bounds[1][jlen + 1] = y3;
tvalues.length = jlen + 2;
bounds[0].length = jlen + 2;
bounds[1].length = jlen + 2;
points.length = jlen + 2;
const left = Math.min.apply(null, bounds[0]);
const top = Math.min.apply(null, bounds[1]);
const right = Math.max.apply(null, bounds[0]);
const bottom = Math.max.apply(null, bounds[1]);
return new Rectangle(left, top, right - left, bottom - top);
}
closestPoint(p, options = {}) {
return this.pointAtT(this.closestPointT(p, options));
}
closestPointLength(p, options = {}) {
const opts = this.getOptions(options);
return this.lengthAtT(this.closestPointT(p, opts), opts);
}
closestPointNormalizedLength(p, options = {}) {
const opts = this.getOptions(options);
const cpLength = this.closestPointLength(p, opts);
if (!cpLength) {
return 0;
}
const length = this.length(opts);
if (length === 0) {
return 0;
}
return cpLength / length;
}
closestPointT(p, options = {}) {
const precision = this.getPrecision(options);
const subdivisions = this.getDivisions(options);
const precisionRatio = Math.pow(10, -precision);
let investigatedSubdivision = null;
let investigatedSubdivisionStartT = 0;
let investigatedSubdivisionEndT = 0;
let distFromStart = 0;
let distFromEnd = 0;
let chordLength = 0;
let minSumDist = null;
const count = subdivisions.length;
let piece = count > 0 ? 1 / count : 0;
subdivisions.forEach((division, i) => {
const startDist = division.start.distance(p);
const endDist = division.end.distance(p);
const sumDist = startDist + endDist;
if (minSumDist == null || sumDist < minSumDist) {
investigatedSubdivision = division;
investigatedSubdivisionStartT = i * piece;
investigatedSubdivisionEndT = (i + 1) * piece;
distFromStart = startDist;
distFromEnd = endDist;
minSumDist = sumDist;
chordLength = division.endpointDistance();
}
});
while (true) {
const startPrecisionRatio = distFromStart ? Math.abs(distFromStart - distFromEnd) / distFromStart : 0;
const endPrecisionRatio = distFromEnd != null ? Math.abs(distFromStart - distFromEnd) / distFromEnd : 0;
const hasRequiredPrecision = startPrecisionRatio < precisionRatio || endPrecisionRatio < precisionRatio;
const hasMiniStartDistance = distFromStart ? distFromStart < chordLength * precisionRatio : true;
const hasMiniEndDistance = distFromEnd ? distFromEnd < chordLength * precisionRatio : true;
const hasMiniDistance = hasMiniStartDistance || hasMiniEndDistance;
if (hasRequiredPrecision || hasMiniDistance) {
return distFromStart <= distFromEnd ? investigatedSubdivisionStartT : investigatedSubdivisionEndT;
}
const divided = investigatedSubdivision.divide(0.5);
piece /= 2;
const startDist1 = divided[0].start.distance(p);
const endDist1 = divided[0].end.distance(p);
const sumDist1 = startDist1 + endDist1;
const startDist2 = divided[1].start.distance(p);
const endDist2 = divided[1].end.distance(p);
const sumDist2 = startDist2 + endDist2;
if (sumDist1 <= sumDist2) {
investigatedSubdivision = divided[0];
investigatedSubdivisionEndT -= piece;
distFromStart = startDist1;
distFromEnd = endDist1;
} else {
investigatedSubdivision = divided[1];
investigatedSubdivisionStartT += piece;
distFromStart = startDist2;
distFromEnd = endDist2;
}
}
}
closestPointTangent(p, options = {}) {
return this.tangentAtT(this.closestPointT(p, options));
}
containsPoint(p, options = {}) {
const polyline = this.toPolyline(options);
return polyline.containsPoint(p);
}
divideAt(ratio, options = {}) {
if (ratio <= 0) {
return this.divideAtT(0);
}
if (ratio >= 1) {
return this.divideAtT(1);
}
const t = this.tAt(ratio, options);
return this.divideAtT(t);
}
divideAtLength(length, options = {}) {
const t = this.tAtLength(length, options);
return this.divideAtT(t);
}
divide(t) {
return this.divideAtT(t);
}
divideAtT(t) {
const start = this.start;
const controlPoint1 = this.controlPoint1;
const controlPoint2 = this.controlPoint2;
const end = this.end;
if (t <= 0) {
return [
new _Curve(start, start, start, start),
new _Curve(start, controlPoint1, controlPoint2, end)
];
}
if (t >= 1) {
return [
new _Curve(start, controlPoint1, controlPoint2, end),
new _Curve(end, end, end, end)
];
}
const dividerPoints = this.getSkeletonPoints(t);
const startControl1 = dividerPoints.startControlPoint1;
const startControl2 = dividerPoints.startControlPoint2;
const divider = dividerPoints.divider;
const dividerControl1 = dividerPoints.dividerControlPoint1;
const dividerControl2 = dividerPoints.dividerControlPoint2;
return [
new _Curve(start, startControl1, startControl2, divider),
new _Curve(divider, dividerControl1, dividerControl2, end)
];
}
endpointDistance() {
return this.start.distance(this.end);
}
getSkeletonPoints(t) {
const start = this.start;
const control1 = this.controlPoint1;
const control2 = this.controlPoint2;
const end = this.end;
if (t <= 0) {
return {
startControlPoint1: start.clone(),
startControlPoint2: start.clone(),
divider: start.clone(),
dividerControlPoint1: control1.clone(),
dividerControlPoint2: control2.clone()
};
}
if (t >= 1) {
return {
startControlPoint1: control1.clone(),
startControlPoint2: control2.clone(),
divider: end.clone(),
dividerControlPoint1: end.clone(),
dividerControlPoint2: end.clone()
};
}
const midpoint1 = new Line(start, control1).pointAt(t);
const midpoint2 = new Line(control1, control2).pointAt(t);
const midpoint3 = new Line(control2, end).pointAt(t);
const subControl1 = new Line(midpoint1, midpoint2).pointAt(t);
const subControl2 = new Line(midpoint2, midpoint3).pointAt(t);
const divideLine = new Line(subControl1, subControl2).pointAt(t);
return {
startControlPoint1: midpoint1,
startControlPoint2: subControl1,
divider: divideLine,
dividerControlPoint1: subControl2,
dividerControlPoint2: midpoint3
};
}
getSubdivisions(options = {}) {
const precision = this.getPrecision(options);
let subdivisions = [
new _Curve(this.start, this.controlPoint1, this.controlPoint2, this.end)
];
if (precision === 0) {
return subdivisions;
}
let previousLength = this.endpointDistance();
const precisionRatio = Math.pow(10, -precision);
let iteration = 0;
while (true) {
iteration += 1;
const divisions = [];
subdivisions.forEach((c) => {
const divided = c.divide(0.5);
divisions.push(divided[0], divided[1]);
});
const length = divisions.reduce((memo, c) => memo + c.endpointDistance(), 0);
const ratio = length !== 0 ? (length - previousLength) / length : 0;
if (iteration > 1 && ratio < precisionRatio) {
return divisions;
}
subdivisions = divisions;
previousLength = length;
}
}
length(options = {}) {
const divisions = this.getDivisions(options);
return divisions.reduce((memo, c) => {
return memo + c.endpointDistance();
}, 0);
}
lengthAtT(t, options = {}) {
if (t <= 0) {
return 0;
}
const precision = options.precision === void 0 ? this.PRECISION : options.precision;
const subCurve = this.divide(t)[0];
return subCurve.length({ precision });
}
pointAt(ratio, options = {}) {
if (ratio <= 0) {
return this.start.clone();
}
if (ratio >= 1) {
return this.end.clone();
}
const t = this.tAt(ratio, options);
return this.pointAtT(t);
}
pointAtLength(length, options = {}) {
const t = this.tAtLength(length, options);
return this.pointAtT(t);
}
pointAtT(t) {
if (t <= 0) {
return this.start.clone();
}
if (t >= 1) {
return this.end.clone();
}
return this.getSkeletonPoints(t).divider;
}
isDifferentiable() {
const start = this.start;
const control1 = this.controlPoint1;
const control2 = this.controlPoint2;
const end = this.end;
return !(start.equals(control1) && control1.equals(control2) && control2.equals(end));
}
tangentAt(ratio, options = {}) {
if (!this.isDifferentiable())
return null;
if (ratio < 0) {
ratio = 0;
} else if (ratio > 1) {
ratio = 1;
}
const t = this.tAt(ratio, options);
return this.tangentAtT(t);
}
tangentAtLength(length, options = {}) {
if (!this.isDifferentiable()) {
return null;
}
const t = this.tAtLength(length, options);
return this.tangentAtT(t);
}
tangentAtT(t) {
if (!this.isDifferentiable()) {
return null;
}
if (t < 0) {
t = 0;
}
if (t > 1) {
t = 1;
}
const skeletonPoints = this.getSkeletonPoints(t);
const p1 = skeletonPoints.startControlPoint2;
const p2 = skeletonPoints.dividerControlPoint1;
const tangentStart = skeletonPoints.divider;
const tangentLine = new Line(p1, p2);
tangentLine.translate(tangentStart.x - p1.x, tangentStart.y - p1.y);
return tangentLine;
}
getPrecision(options = {}) {
return options.precision == null ? this.PRECISION : options.precision;
}
getDivisions(options = {}) {
if (options.subdivisions != null) {
return options.subdivisions;
}
const precision = this.getPrecision(options);
return this.getSubdivisions({ precision });
}
getOptions(options = {}) {
const precision = this.getPrecision(options);
const subdivisions = this.getDivisions(options);
return { precision, subdivisions };
}
tAt(ratio, options = {}) {
if (ratio <= 0) {
return 0;
}
if (ratio >= 1) {
return 1;
}
const opts = this.getOptions(options);
const total = this.length(opts);
const length = total * ratio;
return this.tAtLength(length, opts);
}
tAtLength(length, options = {}) {
let fromStart = true;
if (length < 0) {
fromStart = false;
length = -length;
}
const precision = this.getPrecision(options);
const subdivisions = this.getDivisions(options);
const opts = { precision, subdivisions };
let investigatedSubdivision = null;
let investigatedSubdivisionStartT;
let investigatedSubdivisionEndT;
let baselinePointDistFromStart = 0;
let baselinePointDistFromEnd = 0;
let memo = 0;
const count = subdivisions.length;
let piece = count > 0 ? 1 / count : 0;
for (let i = 0; i < count; i += 1) {
const index2 = fromStart ? i : count - 1 - i;
const division = subdivisions[i];
const dist = division.endpointDistance();
if (length <= memo + dist) {
investigatedSubdivision = division;
investigatedSubdivisionStartT = index2 * piece;
investigatedSubdivisionEndT = (index2 + 1) * piece;
baselinePointDistFromStart = fromStart ? length - memo : dist + memo - length;
baselinePointDistFromEnd = fromStart ? dist + memo - length : length - memo;
break;
}
memo += dist;
}
if (investigatedSubdivision == null) {
return fromStart ? 1 : 0;
}
const total = this.length(opts);
const precisionRatio = Math.pow(10, -precision);
while (true) {
let ratio;
ratio = total !== 0 ? baselinePointDistFromStart / total : 0;
if (ratio < precisionRatio) {
return investigatedSubdivisionStartT;
}
ratio = total !== 0 ? baselinePointDistFromEnd / total : 0;
if (ratio < precisionRatio) {
return investigatedSubdivisionEndT;
}
let newBaselinePointDistFromStart;
let newBaselinePointDistFromEnd;
const divided = investigatedSubdivision.divide(0.5);
piece /= 2;
const baseline1Length = divided[0].endpointDistance();
const baseline2Length = divided[1].endpointDistance();
if (baselinePointDistFromStart <= baseline1Length) {
investigatedSubdivision = divided[0];
investigatedSubdivisionEndT -= piece;
newBaselinePointDistFromStart = baselinePointDistFromStart;
newBaselinePointDistFromEnd = baseline1Length - newBaselinePointDistFromStart;
} else {
investigatedSubdivision = divided[1];
investigatedSubdivisionStartT += piece;
newBaselinePointDistFromStart = baselinePointDistFromStart - baseline1Length;
newBaselinePointDistFromEnd = baseline2Length - newBaselinePointDistFromStart;
}
baselinePointDistFromStart = newBaselinePointDistFromStart;
baselinePointDistFromEnd = newBaselinePointDistFromEnd;
}
}
toPoints(options = {}) {
const subdivisions = this.getDivisions(options);
const points = [subdivisions[0].start.clone()];
subdivisions.forEach((c) => points.push(c.end.clone()));
return points;
}
toPolyline(options = {}) {
return new Polyline(this.toPoints(options));
}
scale(sx, sy, origin) {
this.start.scale(sx, sy, origin);
this.controlPoint1.scale(sx, sy, origin);
this.controlPoint2.scale(sx, sy, origin);
this.end.scale(sx, sy, origin);
return this;
}
rotate(angle, origin) {
this.start.rotate(angle, origin);
this.controlPoint1.rotate(angle, origin);
this.controlPoint2.rotate(angle, origin);
this.end.rotate(angle, origin);
return this;
}
translate(tx, ty) {
if (typeof tx === "number") {
this.start.translate(tx, ty);
this.controlPoint1.translate(tx, ty);
this.controlPoint2.translate(tx, ty);
this.end.translate(tx, ty);
} else {
this.start.translate(tx);
this.controlPoint1.translate(tx);
this.controlPoint2.translate(tx);
this.end.translate(tx);
}
return this;
}
equals(c) {
return c != null && this.start.equals(c.start) && this.controlPoint1.equals(c.controlPoint1) && this.controlPoint2.equals(c.controlPoint2) && this.end.equals(c.end);
}
clone() {
return new _Curve(this.start, this.controlPoint1, this.controlPoint2, this.end);
}
toJSON() {
return {
start: this.start.toJSON(),
controlPoint1: this.controlPoint1.toJSON(),
controlPoint2: this.controlPoint2.toJSON(),
end: this.end.toJSON()
};
}
serialize() {
return [
this.start.serialize(),
this.controlPoint1.serialize(),
this.controlPoint2.serialize(),
this.end.serialize()
].join(" ");
}
};
(function(Curve2) {
function isCurve(instance) {
return instance != null && instance instanceof Curve2;
}
Curve2.isCurve = isCurve;
})(Curve || (Curve = {}));
(function(Curve2) {
function getFirstControlPoints(rhs) {
const n = rhs.length;
const x = [];
const tmp = [];
let b = 2;
x[0] = rhs[0] / b;
for (let i = 1; i < n; i += 1) {
tmp[i] = 1 / b;
b = (i < n - 1 ? 4 : 3.5) - tmp[i];
x[i] = (rhs[i] - x[i - 1]) / b;
}
for (let i = 1; i < n; i += 1) {
x[n - i - 1] -= tmp[n - i] * x[n - i];
}
return x;
}
function getCurveControlPoints(points) {
const knots = points.map((p) => Point.clone(p));
const firstControlPoints = [];
const secondControlPoints = [];
const n = knots.length - 1;
if (n === 1) {
firstControlPoints[0] = new Point((2 * knots[0].x + knots[1].x) / 3, (2 * knots[0].y + knots[1].y) / 3);
secondControlPoints[0] = new Point(2 * firstControlPoints[0].x - knots[0].x, 2 * firstControlPoints[0].y - knots[0].y);
return [firstControlPoints, secondControlPoints];
}
const rhs = [];
for (let i = 1; i < n - 1; i += 1) {
rhs[i] = 4 * knots[i].x + 2 * knots[i + 1].x;
}
rhs[0] = knots[0].x + 2 * knots[1].x;
rhs[n - 1] = (8 * knots[n - 1].x + knots[n].x) / 2;
const x = getFirstControlPoints(rhs);
for (let i = 1; i < n - 1; i += 1) {
rhs[i] = 4 * knots[i].y + 2 * knots[i + 1].y;
}
rhs[0] = knots[0].y + 2 * knots[1].y;
rhs[n - 1] = (8 * knots[n - 1].y + knots[n].y) / 2;
const y = getFirstControlPoints(rhs);
for (let i = 0; i < n; i += 1) {
firstControlPoints.push(new Point(x[i], y[i]));
if (i < n - 1) {
secondControlPoints.push(new Point(2 * knots[i + 1].x - x[i + 1], 2 * knots[i + 1].y - y[i + 1]));
} else {
secondControlPoints.push(new Point((knots[n].x + x[n - 1]) / 2, (knots[n].y + y[n - 1]) / 2));
}
}
return [firstControlPoints, secondControlPoints];
}
function throughPoints(points) {
if (points == null || Array.isArray(points) && points.length < 2) {
throw new Error("At least 2 points are required");
}
const controlPoints = getCurveControlPoints(points);
const curves = [];
for (let i = 0, ii = controlPoints[0].length; i < ii; i += 1) {
const controlPoint1 = new Point(controlPoints[0][i].x, controlPoints[0][i].y);
const controlPoint2 = new Point(controlPoints[1][i].x, controlPoints[1][i].y);
curves.push(new Curve2(points[i], controlPoint1, controlPoint2, points[i + 1]));
}
return curves;
}
Curve2.throughPoints = throughPoints;
})(Curve || (Curve = {}));
}
});
// node_modules/@antv/x6-geometry/es/path/segment.js
var Segment;
var init_segment = __esm({
"node_modules/@antv/x6-geometry/es/path/segment.js"() {
init_geometry();
Segment = class extends Geometry {
constructor() {
super(...arguments);
this.isVisible = true;
this.isSegment = true;
this.isSubpathStart = false;
}
get end() {
return this.endPoint;
}
get start() {
if (this.previousSegment == null) {
throw new Error("Missing previous segment. (This segment cannot be the first segment of a path, or segment has not yet been added to a path.)");
}
return this.previousSegment.end;
}
closestPointT(p, options) {
if (this.closestPointNormalizedLength) {
return this.closestPointNormalizedLength(p);
}
throw new Error("Neither `closestPointT` nor `closestPointNormalizedLength` method is implemented.");
}
// eslint-disable-next-line
lengthAtT(t, options) {
if (t <= 0) {
return 0;
}
const length = this.length();
if (t >= 1) {
return length;
}
return length * t;
}
divideAtT(t) {
if (this.divideAt) {
return this.divideAt(t);
}
throw new Error("Neither `divideAtT` nor `divideAt` method is implemented.");
}
pointAtT(t) {
if (this.pointAt) {
return this.pointAt(t);
}
throw new Error("Neither `pointAtT` nor `pointAt` method is implemented.");
}
tangentAtT(t) {
if (this.tangentAt) {
return this.tangentAt(t);
}
throw new Error("Neither `tangentAtT` nor `tangentAt` method is implemented.");
}
};
}
});
// node_modules/@antv/x6-geometry/es/path/normalize.js
function rotate2(x, y, rad) {
return {
x: x * Math.cos(rad) - y * Math.sin(rad),
y: x * Math.sin(rad) + y * Math.cos(rad)
};
}
function q2c(x1, y1, ax, ay, x2, y2) {
const v13 = 1 / 3;
const v23 = 2 / 3;
return [
v13 * x1 + v23 * ax,
v13 * y1 + v23 * ay,
v13 * x2 + v23 * ax,
v13 * y2 + v23 * ay,
x2,
y2
];
}
function a2c(x1, y1, rx, ry, angle, largeArcFlag, sweepFlag, x2, y2, recursive) {
const v120 = Math.PI * 120 / 180;
const rad = Math.PI / 180 * (+angle || 0);
let res = [];
let xy;
let f1;
let f2;
let cx;
let cy;
if (!recursive) {
xy = rotate2(x1, y1, -rad);
x1 = xy.x;
y1 = xy.y;
xy = rotate2(x2, y2, -rad);
x2 = xy.x;
y2 = xy.y;
const x = (x1 - x2) / 2;
const y = (y1 - y2) / 2;
let h = x * x / (rx * rx) + y * y / (ry * ry);
if (h > 1) {
h = Math.sqrt(h);
rx = h * rx;
ry = h * ry;
}
const rx2 = rx * rx;
const ry2 = ry * ry;
const k = (largeArcFlag === sweepFlag ? -1 : 1) * Math.sqrt(Math.abs((rx2 * ry2 - rx2 * y * y - ry2 * x * x) / (rx2 * y * y + ry2 * x * x)));
cx = k * rx * y / ry + (x1 + x2) / 2;
cy = k * -ry * x / rx + (y1 + y2) / 2;
f1 = Math.asin((y1 - cy) / ry);
f2 = Math.asin((y2 - cy) / ry);
f1 = x1 < cx ? Math.PI - f1 : f1;
f2 = x2 < cx ? Math.PI - f2 : f2;
if (f1 < 0) {
f1 = Math.PI * 2 + f1;
}
if (f2 < 0) {
f2 = Math.PI * 2 + f2;
}
if (sweepFlag && f1 > f2) {
f1 -= Math.PI * 2;
}
if (!sweepFlag && f2 > f1) {
f2 -= Math.PI * 2;
}
} else {
f1 = recursive[0];
f2 = recursive[1];
cx = recursive[2];
cy = recursive[3];
}
let df = f2 - f1;
if (Math.abs(df) > v120) {
const f2old = f2;
const x2old = x2;
const y2old = y2;
f2 = f1 + v120 * (sweepFlag && f2 > f1 ? 1 : -1);
x2 = cx + rx * Math.cos(f2);
y2 = cy + ry * Math.sin(f2);
res = a2c(x2, y2, rx, ry, angle, 0, sweepFlag, x2old, y2old, [
f2,
f2old,
cx,
cy
]);
}
df = f2 - f1;
const c1 = Math.cos(f1);
const s1 = Math.sin(f1);
const c2 = Math.cos(f2);
const s2 = Math.sin(f2);
const t = Math.tan(df / 4);
const hx = 4 / 3 * (rx * t);
const hy = 4 / 3 * (ry * t);
const m1 = [x1, y1];
const m2 = [x1 + hx * s1, y1 - hy * c1];
const m3 = [x2 + hx * s2, y2 - hy * c2];
const m4 = [x2, y2];
m2[0] = 2 * m1[0] - m2[0];
m2[1] = 2 * m1[1] - m2[1];
if (recursive) {
return [m2, m3, m4].concat(res);
}
{
res = [m2, m3, m4].concat(res).join().split(",");
const newres = [];
const ii = res.length;
for (let i = 0; i < ii; i += 1) {
newres[i] = i % 2 ? rotate2(+res[i - 1], +res[i], rad).y : rotate2(+res[i], +res[i + 1], rad).x;
}
return newres;
}
}
function parse(pathData) {
if (!pathData) {
return null;
}
const spaces = " \n\v\f\r    \u2028\u2029";
const segmentReg = new RegExp(
`([a-z])[${spaces},]*((-?\\d*\\.?\\d*(?:e[\\-+]?\\d+)?[${spaces}]*,?[${spaces}]*)+)`,
// eslint-disable-line
"ig"
);
const commandParamReg = new RegExp(
// eslint-disable-next-line
`(-?\\d*\\.?\\d*(?:e[\\-+]?\\d+)?)[${spaces}]*,?[${spaces}]*`,
"ig"
);
const paramsCount = {
a: 7,
c: 6,
h: 1,
l: 2,
m: 2,
q: 4,
s: 4,
t: 2,
v: 1,
z: 0
};
const segmetns = [];
pathData.replace(segmentReg, (input, cmd, args) => {
const params = [];
let command = cmd.toLowerCase();
args.replace(commandParamReg, (a, b) => {
if (b) {
params.push(+b);
}
return a;
});
if (command === "m" && params.length > 2) {
segmetns.push([cmd, ...params.splice(0, 2)]);
command = "l";
cmd = cmd === "m" ? "l" : "L";
}
const count = paramsCount[command];
while (params.length >= count) {
segmetns.push([cmd, ...params.splice(0, count)]);
if (!count) {
break;
}
}
return input;
});
return segmetns;
}
function abs(pathString) {
const pathArray = parse(pathString);
if (!pathArray || !pathArray.length) {
return [["M", 0, 0]];
}
let x = 0;
let y = 0;
let mx = 0;
let my = 0;
const segments = [];
for (let i = 0, ii = pathArray.length; i < ii; i += 1) {
const r = [];
segments.push(r);
const segment = pathArray[i];
const command = segment[0];
if (command !== command.toUpperCase()) {
r[0] = command.toUpperCase();
switch (r[0]) {
case "A":
r[1] = segment[1];
r[2] = segment[2];
r[3] = segment[3];
r[4] = segment[4];
r[5] = segment[5];
r[6] = +segment[6] + x;
r[7] = +segment[7] + y;
break;
case "V":
r[1] = +segment[1] + y;
break;
case "H":
r[1] = +segment[1] + x;
break;
case "M":
mx = +segment[1] + x;
my = +segment[2] + y;
for (let j = 1, jj = segment.length; j < jj; j += 1) {
r[j] = +segment[j] + (j % 2 ? x : y);
}
break;
default:
for (let j = 1, jj = segment.length; j < jj; j += 1) {
r[j] = +segment[j] + (j % 2 ? x : y);
}
break;
}
} else {
for (let j = 0, jj = segment.length; j < jj; j += 1) {
r[j] = segment[j];
}
}
switch (r[0]) {
case "Z":
x = +mx;
y = +my;
break;
case "H":
x = r[1];
break;
case "V":
y = r[1];
break;
case "M":
mx = r[r.length - 2];
my = r[r.length - 1];
x = r[r.length - 2];
y = r[r.length - 1];
break;
default:
x = r[r.length - 2];
y = r[r.length - 1];
break;
}
}
return segments;
}
function normalize(path) {
const pathArray = abs(path);
const attrs = { x: 0, y: 0, bx: 0, by: 0, X: 0, Y: 0, qx: null, qy: null };
function processPath(path2, d, pcom) {
let nx;
let ny;
if (!path2) {
return ["C", d.x, d.y, d.x, d.y, d.x, d.y];
}
if (!(path2[0] in { T: 1, Q: 1 })) {
d.qx = null;
d.qy = null;
}
switch (path2[0]) {
case "M":
d.X = path2[1];
d.Y = path2[2];
break;
case "A":
if (parseFloat(path2[1]) === 0 || parseFloat(path2[2]) === 0) {
return ["L", path2[6], path2[7]];
}
return ["C"].concat(a2c.apply(0, [d.x, d.y].concat(path2.slice(1))));
case "S":
if (pcom === "C" || pcom === "S") {
nx = d.x * 2 - d.bx;
ny = d.y * 2 - d.by;
} else {
nx = d.x;
ny = d.y;
}
return ["C", nx, ny].concat(path2.slice(1));
case "T":
if (pcom === "Q" || pcom === "T") {
d.qx = d.x * 2 - d.qx;
d.qy = d.y * 2 - d.qy;
} else {
d.qx = d.x;
d.qy = d.y;
}
return ["C"].concat(q2c(d.x, d.y, d.qx, d.qy, path2[1], path2[2]));
case "Q":
d.qx = path2[1];
d.qy = path2[2];
return ["C"].concat(q2c(d.x, d.y, path2[1], path2[2], path2[3], path2[4]));
case "H":
return ["L"].concat(path2[1], d.y);
case "V":
return ["L"].concat(d.x, path2[1]);
case "L":
break;
case "Z":
break;
default:
break;
}
return path2;
}
function fixArc(pp, i) {
if (pp[i].length > 7) {
pp[i].shift();
const pi = pp[i];
while (pi.length) {
commands[i] = "A";
i += 1;
pp.splice(i, 0, ["C"].concat(pi.splice(0, 6)));
}
pp.splice(i, 1);
ii = pathArray.length;
}
}
const commands = [];
let prevCommand = "";
let ii = pathArray.length;
for (let i = 0; i < ii; i += 1) {
let command = "";
if (pathArray[i]) {
command = pathArray[i][0];
}
if (command !== "C") {
commands[i] = command;
if (i > 0) {
prevCommand = commands[i - 1];
}
}
pathArray[i] = processPath(pathArray[i], attrs, prevCommand);
if (commands[i] !== "A" && command === "C") {
commands[i] = "C";
}
fixArc(pathArray, i);
const seg = pathArray[i];
const seglen = seg.length;
attrs.x = seg[seglen - 2];
attrs.y = seg[seglen - 1];
attrs.bx = parseFloat(seg[seglen - 4]) || attrs.x;
attrs.by = parseFloat(seg[seglen - 3]) || attrs.y;
}
if (!pathArray[0][0] || pathArray[0][0] !== "M") {
pathArray.unshift(["M", 0, 0]);
}
return pathArray;
}
function normalizePathData(pathData) {
return normalize(pathData).map((segment) => segment.map((item) => typeof item === "string" ? item : GeometryUtil.round(item, 2))).join(",").split(",").join(" ");
}
var init_normalize = __esm({
"node_modules/@antv/x6-geometry/es/path/normalize.js"() {
init_util4();
}
});
// node_modules/@antv/x6-geometry/es/path/util.js
function isValid(data2) {
if (typeof data2 !== "string") {
return false;
}
return regexSupportedData.test(data2);
}
function mod2(n, m) {
return (n % m + m) % m;
}
function draw(points, round, initialMove, close, exclude) {
const data2 = [];
const end = points[points.length - 1];
const rounded = round != null && round > 0;
const arcSize = round || 0;
if (close && rounded) {
points = points.slice();
const p0 = points[0];
const wp = new Point(end.x + (p0.x - end.x) / 2, end.y + (p0.y - end.y) / 2);
points.splice(0, 0, wp);
}
let pt = points[0];
let i = 1;
if (initialMove) {
data2.push("M", pt.x, pt.y);
} else {
data2.push("L", pt.x, pt.y);
}
while (i < (close ? points.length : points.length - 1)) {
let tmp = points[mod2(i, points.length)];
let dx = pt.x - tmp.x;
let dy = pt.y - tmp.y;
if (rounded && (dx !== 0 || dy !== 0) && (exclude == null || exclude.indexOf(i - 1) < 0)) {
let dist = Math.sqrt(dx * dx + dy * dy);
const nx1 = dx * Math.min(arcSize, dist / 2) / dist;
const ny1 = dy * Math.min(arcSize, dist / 2) / dist;
const x1 = tmp.x + nx1;
const y1 = tmp.y + ny1;
data2.push("L", x1, y1);
let next = points[mod2(i + 1, points.length)];
while (i < points.length - 2 && Math.round(next.x - tmp.x) === 0 && Math.round(next.y - tmp.y) === 0) {
next = points[mod2(i + 2, points.length)];
i += 1;
}
dx = next.x - tmp.x;
dy = next.y - tmp.y;
dist = Math.max(1, Math.sqrt(dx * dx + dy * dy));
const nx2 = dx * Math.min(arcSize, dist / 2) / dist;
const ny2 = dy * Math.min(arcSize, dist / 2) / dist;
const x2 = tmp.x + nx2;
const y2 = tmp.y + ny2;
data2.push("Q", tmp.x, tmp.y, x2, y2);
tmp = new Point(x2, y2);
} else {
data2.push("L", tmp.x, tmp.y);
}
pt = tmp;
i += 1;
}
if (close) {
data2.push("Z");
} else {
data2.push("L", end.x, end.y);
}
return data2.map((v) => typeof v === "string" ? v : +v.toFixed(3)).join(" ");
}
function drawPoints(points, options = {}) {
const pts = [];
if (points && points.length) {
points.forEach((p) => {
if (Array.isArray(p)) {
pts.push({ x: p[0], y: p[1] });
} else {
pts.push({ x: p.x, y: p.y });
}
});
}
return draw(pts, options.round, options.initialMove == null || options.initialMove, options.close, options.exclude);
}
function arcToCurves(x0, y0, r1, r2, angle = 0, largeArcFlag = 0, sweepFlag = 0, x, y) {
if (r1 === 0 || r2 === 0) {
return [];
}
x -= x0;
y -= y0;
r1 = Math.abs(r1);
r2 = Math.abs(r2);
const ctx = -x / 2;
const cty = -y / 2;
const cpsi = Math.cos(angle * Math.PI / 180);
const spsi = Math.sin(angle * Math.PI / 180);
const rxd = cpsi * ctx + spsi * cty;
const ryd = -1 * spsi * ctx + cpsi * cty;
const rxdd = rxd * rxd;
const rydd = ryd * ryd;
const r1x = r1 * r1;
const r2y = r2 * r2;
const lamda = rxdd / r1x + rydd / r2y;
let sds;
if (lamda > 1) {
r1 = Math.sqrt(lamda) * r1;
r2 = Math.sqrt(lamda) * r2;
sds = 0;
} else {
let seif = 1;
if (largeArcFlag === sweepFlag) {
seif = -1;
}
sds = seif * Math.sqrt((r1x * r2y - r1x * rydd - r2y * rxdd) / (r1x * rydd + r2y * rxdd));
}
const txd = sds * r1 * ryd / r2;
const tyd = -1 * sds * r2 * rxd / r1;
const tx = cpsi * txd - spsi * tyd + x / 2;
const ty = spsi * txd + cpsi * tyd + y / 2;
let rad = Math.atan2((ryd - tyd) / r2, (rxd - txd) / r1) - Math.atan2(0, 1);
let s1 = rad >= 0 ? rad : 2 * Math.PI + rad;
rad = Math.atan2((-ryd - tyd) / r2, (-rxd - txd) / r1) - Math.atan2((ryd - tyd) / r2, (rxd - txd) / r1);
let dr = rad >= 0 ? rad : 2 * Math.PI + rad;
if (sweepFlag === 0 && dr > 0) {
dr -= 2 * Math.PI;
} else if (sweepFlag !== 0 && dr < 0) {
dr += 2 * Math.PI;
}
const sse = dr * 2 / Math.PI;
const seg = Math.ceil(sse < 0 ? -1 * sse : sse);
const segr = dr / seg;
const t = 8 / 3 * Math.sin(segr / 4) * Math.sin(segr / 4) / Math.sin(segr / 2);
const cpsir1 = cpsi * r1;
const cpsir2 = cpsi * r2;
const spsir1 = spsi * r1;
const spsir2 = spsi * r2;
let mc = Math.cos(s1);
let ms = Math.sin(s1);
let x2 = -t * (cpsir1 * ms + spsir2 * mc);
let y2 = -t * (spsir1 * ms - cpsir2 * mc);
let x3 = 0;
let y3 = 0;
const result = [];
for (let n = 0; n < seg; n += 1) {
s1 += segr;
mc = Math.cos(s1);
ms = Math.sin(s1);
x3 = cpsir1 * mc - spsir2 * ms + tx;
y3 = spsir1 * mc + cpsir2 * ms + ty;
const dx = -t * (cpsir1 * ms + spsir2 * mc);
const dy = -t * (spsir1 * ms - cpsir2 * mc);
const index2 = n * 6;
result[index2] = Number(x2 + x0);
result[index2 + 1] = Number(y2 + y0);
result[index2 + 2] = Number(x3 - dx + x0);
result[index2 + 3] = Number(y3 - dy + y0);
result[index2 + 4] = Number(x3 + x0);
result[index2 + 5] = Number(y3 + y0);
x2 = x3 + dx;
y2 = y3 + dy;
}
return result.map((num) => +num.toFixed(2));
}
function drawArc(startX, startY, rx, ry, xAxisRotation = 0, largeArcFlag = 0, sweepFlag = 0, stopX, stopY) {
const data2 = [];
const points = arcToCurves(startX, startY, rx, ry, xAxisRotation, largeArcFlag, sweepFlag, stopX, stopY);
if (points != null) {
for (let i = 0, ii = points.length; i < ii; i += 6) {
data2.push("C", points[i], points[i + 1], points[i + 2], points[i + 3], points[i + 4], points[i + 5]);
}
}
return data2.join(" ");
}
var regexSupportedData;
var init_util5 = __esm({
"node_modules/@antv/x6-geometry/es/path/util.js"() {
init_point();
regexSupportedData = new RegExp(`^[\\s\\dLMCZz,.]*$`);
}
});
// node_modules/@antv/x6-geometry/es/path/lineto.js
var LineTo;
var init_lineto = __esm({
"node_modules/@antv/x6-geometry/es/path/lineto.js"() {
init_line();
init_point();
init_segment();
LineTo = class _LineTo extends Segment {
constructor(x, y) {
super();
if (Line.isLine(x)) {
this.endPoint = x.end.clone().round(2);
} else {
this.endPoint = Point.create(x, y).round(2);
}
}
get type() {
return "L";
}
get line() {
return new Line(this.start, this.end);
}
bbox() {
return this.line.bbox();
}
closestPoint(p) {
return this.line.closestPoint(p);
}
closestPointLength(p) {
return this.line.closestPointLength(p);
}
closestPointNormalizedLength(p) {
return this.line.closestPointNormalizedLength(p);
}
closestPointTangent(p) {
return this.line.closestPointTangent(p);
}
length() {
return this.line.length();
}
divideAt(ratio) {
const divided = this.line.divideAt(ratio);
return [new _LineTo(divided[0]), new _LineTo(divided[1])];
}
divideAtLength(length) {
const divided = this.line.divideAtLength(length);
return [new _LineTo(divided[0]), new _LineTo(divided[1])];
}
getSubdivisions() {
return [];
}
pointAt(ratio) {
return this.line.pointAt(ratio);
}
pointAtLength(length) {
return this.line.pointAtLength(length);
}
tangentAt(ratio) {
return this.line.tangentAt(ratio);
}
tangentAtLength(length) {
return this.line.tangentAtLength(length);
}
isDifferentiable() {
if (this.previousSegment == null) {
return false;
}
return !this.start.equals(this.end);
}
clone() {
return new _LineTo(this.end);
}
scale(sx, sy, origin) {
this.end.scale(sx, sy, origin);
return this;
}
rotate(angle, origin) {
this.end.rotate(angle, origin);
return this;
}
translate(tx, ty) {
if (typeof tx === "number") {
this.end.translate(tx, ty);
} else {
this.end.translate(tx);
}
return this;
}
equals(s) {
return this.type === s.type && this.start.equals(s.start) && this.end.equals(s.end);
}
toJSON() {
return {
type: this.type,
start: this.start.toJSON(),
end: this.end.toJSON()
};
}
serialize() {
const end = this.end;
return `${this.type} ${end.x} ${end.y}`;
}
};
(function(LineTo2) {
function create(...args) {
const len = args.length;
const arg0 = args[0];
if (Line.isLine(arg0)) {
return new LineTo2(arg0);
}
if (Point.isPointLike(arg0)) {
if (len === 1) {
return new LineTo2(arg0);
}
return args.map((arg) => new LineTo2(arg));
}
if (len === 2) {
return new LineTo2(+args[0], +args[1]);
}
const segments = [];
for (let i = 0; i < len; i += 2) {
const x = +args[i];
const y = +args[i + 1];
segments.push(new LineTo2(x, y));
}
return segments;
}
LineTo2.create = create;
})(LineTo || (LineTo = {}));
}
});
// node_modules/@antv/x6-geometry/es/path/close.js
var Close;
var init_close = __esm({
"node_modules/@antv/x6-geometry/es/path/close.js"() {
init_line();
init_lineto();
init_segment();
Close = class _Close extends Segment {
get end() {
if (!this.subpathStartSegment) {
throw new Error("Missing subpath start segment. (This segment needs a subpath start segment (e.g. MoveTo), or segment has not yet been added to a path.)");
}
return this.subpathStartSegment.end;
}
get type() {
return "Z";
}
get line() {
return new Line(this.start, this.end);
}
bbox() {
return this.line.bbox();
}
closestPoint(p) {
return this.line.closestPoint(p);
}
closestPointLength(p) {
return this.line.closestPointLength(p);
}
closestPointNormalizedLength(p) {
return this.line.closestPointNormalizedLength(p);
}
closestPointTangent(p) {
return this.line.closestPointTangent(p);
}
length() {
return this.line.length();
}
divideAt(ratio) {
const divided = this.line.divideAt(ratio);
return [
// do not actually cut into the segment, first divided part can stay as Z
divided[1].isDifferentiable() ? new LineTo(divided[0]) : this.clone(),
new LineTo(divided[1])
];
}
divideAtLength(length) {
const divided = this.line.divideAtLength(length);
return [
divided[1].isDifferentiable() ? new LineTo(divided[0]) : this.clone(),
new LineTo(divided[1])
];
}
getSubdivisions() {
return [];
}
pointAt(ratio) {
return this.line.pointAt(ratio);
}
pointAtLength(length) {
return this.line.pointAtLength(length);
}
tangentAt(ratio) {
return this.line.tangentAt(ratio);
}
tangentAtLength(length) {
return this.line.tangentAtLength(length);
}
isDifferentiable() {
if (!this.previousSegment || !this.subpathStartSegment) {
return false;
}
return !this.start.equals(this.end);
}
scale() {
return this;
}
rotate() {
return this;
}
translate() {
return this;
}
equals(s) {
return this.type === s.type && this.start.equals(s.start) && this.end.equals(s.end);
}
clone() {
return new _Close();
}
toJSON() {
return {
type: this.type,
start: this.start.toJSON(),
end: this.end.toJSON()
};
}
serialize() {
return this.type;
}
};
(function(Close2) {
function create() {
return new Close2();
}
Close2.create = create;
})(Close || (Close = {}));
}
});
// node_modules/@antv/x6-geometry/es/path/moveto.js
var MoveTo;
var init_moveto = __esm({
"node_modules/@antv/x6-geometry/es/path/moveto.js"() {
init_line();
init_curve();
init_point();
init_lineto();
init_segment();
MoveTo = class _MoveTo extends Segment {
constructor(x, y) {
super();
this.isVisible = false;
this.isSubpathStart = true;
if (Line.isLine(x) || Curve.isCurve(x)) {
this.endPoint = x.end.clone().round(2);
} else {
this.endPoint = Point.create(x, y).round(2);
}
}
get start() {
throw new Error("Illegal access. Moveto segments should not need a start property.");
}
get type() {
return "M";
}
bbox() {
return null;
}
closestPoint() {
return this.end.clone();
}
closestPointLength() {
return 0;
}
closestPointNormalizedLength() {
return 0;
}
closestPointT() {
return 1;
}
closestPointTangent() {
return null;
}
length() {
return 0;
}
lengthAtT() {
return 0;
}
divideAt() {
return [this.clone(), this.clone()];
}
divideAtLength() {
return [this.clone(), this.clone()];
}
getSubdivisions() {
return [];
}
pointAt() {
return this.end.clone();
}
pointAtLength() {
return this.end.clone();
}
pointAtT() {
return this.end.clone();
}
tangentAt() {
return null;
}
tangentAtLength() {
return null;
}
tangentAtT() {
return null;
}
isDifferentiable() {
return false;
}
scale(sx, sy, origin) {
this.end.scale(sx, sy, origin);
return this;
}
rotate(angle, origin) {
this.end.rotate(angle, origin);
return this;
}
translate(tx, ty) {
if (typeof tx === "number") {
this.end.translate(tx, ty);
} else {
this.end.translate(tx);
}
return this;
}
clone() {
return new _MoveTo(this.end);
}
equals(s) {
return this.type === s.type && this.end.equals(s.end);
}
toJSON() {
return {
type: this.type,
end: this.end.toJSON()
};
}
serialize() {
const end = this.end;
return `${this.type} ${end.x} ${end.y}`;
}
};
(function(MoveTo2) {
function create(...args) {
const len = args.length;
const arg0 = args[0];
if (Line.isLine(arg0)) {
return new MoveTo2(arg0);
}
if (Curve.isCurve(arg0)) {
return new MoveTo2(arg0);
}
if (Point.isPointLike(arg0)) {
if (len === 1) {
return new MoveTo2(arg0);
}
const segments2 = [];
for (let i = 0; i < len; i += 1) {
if (i === 0) {
segments2.push(new MoveTo2(args[i]));
} else {
segments2.push(new LineTo(args[i]));
}
}
return segments2;
}
if (len === 2) {
return new MoveTo2(+args[0], +args[1]);
}
const segments = [];
for (let i = 0; i < len; i += 2) {
const x = +args[i];
const y = +args[i + 1];
if (i === 0) {
segments.push(new MoveTo2(x, y));
} else {
segments.push(new LineTo(x, y));
}
}
return segments;
}
MoveTo2.create = create;
})(MoveTo || (MoveTo = {}));
}
});
// node_modules/@antv/x6-geometry/es/path/curveto.js
var CurveTo;
var init_curveto = __esm({
"node_modules/@antv/x6-geometry/es/path/curveto.js"() {
init_curve();
init_point();
init_segment();
CurveTo = class _CurveTo extends Segment {
constructor(arg0, arg1, arg2, arg3, arg4, arg5) {
super();
if (Curve.isCurve(arg0)) {
this.controlPoint1 = arg0.controlPoint1.clone().round(2);
this.controlPoint2 = arg0.controlPoint2.clone().round(2);
this.endPoint = arg0.end.clone().round(2);
} else if (typeof arg0 === "number") {
this.controlPoint1 = new Point(arg0, arg1).round(2);
this.controlPoint2 = new Point(arg2, arg3).round(2);
this.endPoint = new Point(arg4, arg5).round(2);
} else {
this.controlPoint1 = Point.create(arg0).round(2);
this.controlPoint2 = Point.create(arg1).round(2);
this.endPoint = Point.create(arg2).round(2);
}
}
get type() {
return "C";
}
get curve() {
return new Curve(this.start, this.controlPoint1, this.controlPoint2, this.end);
}
bbox() {
return this.curve.bbox();
}
closestPoint(p) {
return this.curve.closestPoint(p);
}
closestPointLength(p) {
return this.curve.closestPointLength(p);
}
closestPointNormalizedLength(p) {
return this.curve.closestPointNormalizedLength(p);
}
closestPointTangent(p) {
return this.curve.closestPointTangent(p);
}
length() {
return this.curve.length();
}
divideAt(ratio, options = {}) {
const divided = this.curve.divideAt(ratio, options);
return [new _CurveTo(divided[0]), new _CurveTo(divided[1])];
}
divideAtLength(length, options = {}) {
const divided = this.curve.divideAtLength(length, options);
return [new _CurveTo(divided[0]), new _CurveTo(divided[1])];
}
divideAtT(t) {
const divided = this.curve.divideAtT(t);
return [new _CurveTo(divided[0]), new _CurveTo(divided[1])];
}
getSubdivisions() {
return [];
}
pointAt(ratio) {
return this.curve.pointAt(ratio);
}
pointAtLength(length) {
return this.curve.pointAtLength(length);
}
tangentAt(ratio) {
return this.curve.tangentAt(ratio);
}
tangentAtLength(length) {
return this.curve.tangentAtLength(length);
}
isDifferentiable() {
if (!this.previousSegment) {
return false;
}
const start = this.start;
const control1 = this.controlPoint1;
const control2 = this.controlPoint2;
const end = this.end;
return !(start.equals(control1) && control1.equals(control2) && control2.equals(end));
}
scale(sx, sy, origin) {
this.controlPoint1.scale(sx, sy, origin);
this.controlPoint2.scale(sx, sy, origin);
this.end.scale(sx, sy, origin);
return this;
}
rotate(angle, origin) {
this.controlPoint1.rotate(angle, origin);
this.controlPoint2.rotate(angle, origin);
this.end.rotate(angle, origin);
return this;
}
translate(tx, ty) {
if (typeof tx === "number") {
this.controlPoint1.translate(tx, ty);
this.controlPoint2.translate(tx, ty);
this.end.translate(tx, ty);
} else {
this.controlPoint1.translate(tx);
this.controlPoint2.translate(tx);
this.end.translate(tx);
}
return this;
}
equals(s) {
return this.start.equals(s.start) && this.end.equals(s.end) && this.controlPoint1.equals(s.controlPoint1) && this.controlPoint2.equals(s.controlPoint2);
}
clone() {
return new _CurveTo(this.controlPoint1, this.controlPoint2, this.end);
}
toJSON() {
return {
type: this.type,
start: this.start.toJSON(),
controlPoint1: this.controlPoint1.toJSON(),
controlPoint2: this.controlPoint2.toJSON(),
end: this.end.toJSON()
};
}
serialize() {
const c1 = this.controlPoint1;
const c2 = this.controlPoint2;
const end = this.end;
return [this.type, c1.x, c1.y, c2.x, c2.y, end.x, end.y].join(" ");
}
};
(function(CurveTo2) {
function create(...args) {
const len = args.length;
const arg0 = args[0];
if (Curve.isCurve(arg0)) {
return new CurveTo2(arg0);
}
if (Point.isPointLike(arg0)) {
if (len === 3) {
return new CurveTo2(args[0], args[1], args[2]);
}
const segments2 = [];
for (let i = 0; i < len; i += 3) {
segments2.push(new CurveTo2(args[i], args[i + 1], args[i + 2]));
}
return segments2;
}
if (len === 6) {
return new CurveTo2(args[0], args[1], args[2], args[3], args[4], args[5]);
}
const segments = [];
for (let i = 0; i < len; i += 6) {
segments.push(new CurveTo2(args[i], args[i + 1], args[i + 2], args[i + 3], args[i + 4], args[i + 5]));
}
return segments;
}
CurveTo2.create = create;
})(CurveTo || (CurveTo = {}));
}
});
// node_modules/@antv/x6-geometry/es/path/path.js
var Path;
var init_path2 = __esm({
"node_modules/@antv/x6-geometry/es/path/path.js"() {
init_util4();
init_util5();
init_line();
init_point();
init_curve();
init_polyline();
init_rectangle();
init_geometry();
init_close();
init_lineto();
init_moveto();
init_curveto();
init_normalize();
Path = class _Path extends Geometry {
constructor(args) {
super();
this.PRECISION = 3;
this.segments = [];
if (Array.isArray(args)) {
if (Line.isLine(args[0]) || Curve.isCurve(args[0])) {
let previousObj = null;
const arr = args;
arr.forEach((o, i) => {
if (i === 0) {
this.appendSegment(_Path.createSegment("M", o.start));
}
if (previousObj != null && !previousObj.end.equals(o.start)) {
this.appendSegment(_Path.createSegment("M", o.start));
}
if (Line.isLine(o)) {
this.appendSegment(_Path.createSegment("L", o.end));
} else if (Curve.isCurve(o)) {
this.appendSegment(_Path.createSegment("C", o.controlPoint1, o.controlPoint2, o.end));
}
previousObj = o;
});
} else {
const arr = args;
arr.forEach((s) => {
if (s.isSegment) {
this.appendSegment(s);
}
});
}
} else if (args != null) {
if (Line.isLine(args)) {
this.appendSegment(_Path.createSegment("M", args.start));
this.appendSegment(_Path.createSegment("L", args.end));
} else if (Curve.isCurve(args)) {
this.appendSegment(_Path.createSegment("M", args.start));
this.appendSegment(_Path.createSegment("C", args.controlPoint1, args.controlPoint2, args.end));
} else if (Polyline.isPolyline(args)) {
if (args.points && args.points.length) {
args.points.forEach((point, index2) => {
const segment = index2 === 0 ? _Path.createSegment("M", point) : _Path.createSegment("L", point);
this.appendSegment(segment);
});
}
} else if (args.isSegment) {
this.appendSegment(args);
}
}
}
get start() {
const segments = this.segments;
const count = segments.length;
if (count === 0) {
return null;
}
for (let i = 0; i < count; i += 1) {
const segment = segments[i];
if (segment.isVisible) {
return segment.start;
}
}
return segments[count - 1].end;
}
get end() {
const segments = this.segments;
const count = segments.length;
if (count === 0) {
return null;
}
for (let i = count - 1; i >= 0; i -= 1) {
const segment = segments[i];
if (segment.isVisible) {
return segment.end;
}
}
return segments[count - 1].end;
}
moveTo(...args) {
return this.appendSegment(MoveTo.create.call(null, ...args));
}
lineTo(...args) {
return this.appendSegment(LineTo.create.call(null, ...args));
}
curveTo(...args) {
return this.appendSegment(CurveTo.create.call(null, ...args));
}
arcTo(rx, ry, xAxisRotation, largeArcFlag, sweepFlag, endX, endY) {
const start = this.end || new Point();
const points = typeof endX === "number" ? arcToCurves(start.x, start.y, rx, ry, xAxisRotation, largeArcFlag, sweepFlag, endX, endY) : arcToCurves(start.x, start.y, rx, ry, xAxisRotation, largeArcFlag, sweepFlag, endX.x, endX.y);
if (points != null) {
for (let i = 0, ii = points.length; i < ii; i += 6) {
this.curveTo(points[i], points[i + 1], points[i + 2], points[i + 3], points[i + 4], points[i + 5]);
}
}
return this;
}
quadTo(x1, y1, x, y) {
const start = this.end || new Point();
const data2 = ["M", start.x, start.y];
if (typeof x1 === "number") {
data2.push("Q", x1, y1, x, y);
} else {
const p = y1;
data2.push(`Q`, x1.x, x1.y, p.x, p.y);
}
const path = _Path.parse(data2.join(" "));
this.appendSegment(path.segments.slice(1));
return this;
}
close() {
return this.appendSegment(Close.create());
}
drawPoints(points, options = {}) {
const raw = drawPoints(points, options);
const sub = _Path.parse(raw);
if (sub && sub.segments) {
this.appendSegment(sub.segments);
}
}
bbox() {
const segments = this.segments;
const count = segments.length;
if (count === 0) {
return null;
}
let bbox;
for (let i = 0; i < count; i += 1) {
const segment = segments[i];
if (segment.isVisible) {
const segmentBBox = segment.bbox();
if (segmentBBox != null) {
bbox = bbox ? bbox.union(segmentBBox) : segmentBBox;
}
}
}
if (bbox != null) {
return bbox;
}
const lastSegment = segments[count - 1];
return new Rectangle(lastSegment.end.x, lastSegment.end.y, 0, 0);
}
appendSegment(seg) {
const count = this.segments.length;
let previousSegment = count !== 0 ? this.segments[count - 1] : null;
let currentSegment;
const nextSegment = null;
if (Array.isArray(seg)) {
for (let i = 0, ii = seg.length; i < ii; i += 1) {
const segment = seg[i];
currentSegment = this.prepareSegment(segment, previousSegment, nextSegment);
this.segments.push(currentSegment);
previousSegment = currentSegment;
}
} else if (seg != null && seg.isSegment) {
currentSegment = this.prepareSegment(seg, previousSegment, nextSegment);
this.segments.push(currentSegment);
}
return this;
}
insertSegment(index2, seg) {
const count = this.segments.length;
if (index2 < 0) {
index2 = count + index2 + 1;
}
if (index2 > count || index2 < 0) {
throw new Error("Index out of range.");
}
let currentSegment;
let previousSegment = null;
let nextSegment = null;
if (count !== 0) {
if (index2 >= 1) {
previousSegment = this.segments[index2 - 1];
nextSegment = previousSegment.nextSegment;
} else {
previousSegment = null;
nextSegment = this.segments[0];
}
}
if (!Array.isArray(seg)) {
currentSegment = this.prepareSegment(seg, previousSegment, nextSegment);
this.segments.splice(index2, 0, currentSegment);
} else {
for (let i = 0, ii = seg.length; i < ii; i += 1) {
const segment = seg[i];
currentSegment = this.prepareSegment(segment, previousSegment, nextSegment);
this.segments.splice(index2 + i, 0, currentSegment);
previousSegment = currentSegment;
}
}
return this;
}
removeSegment(index2) {
const idx = this.fixIndex(index2);
const removedSegment = this.segments.splice(idx, 1)[0];
const previousSegment = removedSegment.previousSegment;
const nextSegment = removedSegment.nextSegment;
if (previousSegment) {
previousSegment.nextSegment = nextSegment;
}
if (nextSegment) {
nextSegment.previousSegment = previousSegment;
}
if (removedSegment.isSubpathStart && nextSegment) {
this.updateSubpathStartSegment(nextSegment);
}
return removedSegment;
}
replaceSegment(index2, seg) {
const idx = this.fixIndex(index2);
let currentSegment;
const replacedSegment = this.segments[idx];
let previousSegment = replacedSegment.previousSegment;
const nextSegment = replacedSegment.nextSegment;
let updateSubpathStart = replacedSegment.isSubpathStart;
if (!Array.isArray(seg)) {
currentSegment = this.prepareSegment(seg, previousSegment, nextSegment);
this.segments.splice(idx, 1, currentSegment);
if (updateSubpathStart && currentSegment.isSubpathStart) {
updateSubpathStart = false;
}
} else {
this.segments.splice(index2, 1);
for (let i = 0, ii = seg.length; i < ii; i += 1) {
const segment = seg[i];
currentSegment = this.prepareSegment(segment, previousSegment, nextSegment);
this.segments.splice(index2 + i, 0, currentSegment);
previousSegment = currentSegment;
if (updateSubpathStart && currentSegment.isSubpathStart) {
updateSubpathStart = false;
}
}
}
if (updateSubpathStart && nextSegment) {
this.updateSubpathStartSegment(nextSegment);
}
}
getSegment(index2) {
const idx = this.fixIndex(index2);
return this.segments[idx];
}
fixIndex(index2) {
const length = this.segments.length;
if (length === 0) {
throw new Error("Path has no segments.");
}
let i = index2;
while (i < 0) {
i = length + i;
}
if (i >= length || i < 0) {
throw new Error("Index out of range.");
}
return i;
}
segmentAt(ratio, options = {}) {
const index2 = this.segmentIndexAt(ratio, options);
if (!index2) {
return null;
}
return this.getSegment(index2);
}
segmentAtLength(length, options = {}) {
const index2 = this.segmentIndexAtLength(length, options);
if (!index2)
return null;
return this.getSegment(index2);
}
segmentIndexAt(ratio, options = {}) {
if (this.segments.length === 0) {
return null;
}
const rate = GeometryUtil.clamp(ratio, 0, 1);
const opt = this.getOptions(options);
const len = this.length(opt);
const length = len * rate;
return this.segmentIndexAtLength(length, opt);
}
segmentIndexAtLength(length, options = {}) {
const count = this.segments.length;
if (count === 0) {
return null;
}
let fromStart = true;
if (length < 0) {
fromStart = false;
length = -length;
}
const precision = this.getPrecision(options);
const segmentSubdivisions = this.getSubdivisions(options);
let memo = 0;
let lastVisibleIndex = null;
for (let i = 0; i < count; i += 1) {
const index2 = fromStart ? i : count - 1 - i;
const segment = this.segments[index2];
const subdivisions = segmentSubdivisions[index2];
const len = segment.length({ precision, subdivisions });
if (segment.isVisible) {
if (length <= memo + len) {
return index2;
}
lastVisibleIndex = index2;
}
memo += len;
}
return lastVisibleIndex;
}
getSegmentSubdivisions(options = {}) {
const precision = this.getPrecision(options);
const segmentSubdivisions = [];
for (let i = 0, ii = this.segments.length; i < ii; i += 1) {
const segment = this.segments[i];
const subdivisions = segment.getSubdivisions({ precision });
segmentSubdivisions.push(subdivisions);
}
return segmentSubdivisions;
}
updateSubpathStartSegment(segment) {
let previous = segment.previousSegment;
let current = segment;
while (current && !current.isSubpathStart) {
if (previous != null) {
current.subpathStartSegment = previous.subpathStartSegment;
} else {
current.subpathStartSegment = null;
}
previous = current;
current = current.nextSegment;
}
}
prepareSegment(segment, previousSegment, nextSegment) {
segment.previousSegment = previousSegment;
segment.nextSegment = nextSegment;
if (previousSegment != null) {
previousSegment.nextSegment = segment;
}
if (nextSegment != null) {
nextSegment.previousSegment = segment;
}
let updateSubpathStart = segment;
if (segment.isSubpathStart) {
segment.subpathStartSegment = segment;
updateSubpathStart = nextSegment;
}
if (updateSubpathStart != null) {
this.updateSubpathStartSegment(updateSubpathStart);
}
return segment;
}
closestPoint(p, options = {}) {
const t = this.closestPointT(p, options);
if (!t) {
return null;
}
return this.pointAtT(t);
}
closestPointLength(p, options = {}) {
const opts = this.getOptions(options);
const t = this.closestPointT(p, opts);
if (!t) {
return 0;
}
return this.lengthAtT(t, opts);
}
closestPointNormalizedLength(p, options = {}) {
const opts = this.getOptions(options);
const cpLength = this.closestPointLength(p, opts);
if (cpLength === 0) {
return 0;
}
const length = this.length(opts);
if (length === 0) {
return 0;
}
return cpLength / length;
}
closestPointT(p, options = {}) {
if (this.segments.length === 0) {
return null;
}
const precision = this.getPrecision(options);
const segmentSubdivisions = this.getSubdivisions(options);
let closestPointT;
let minSquaredDistance = Infinity;
for (let i = 0, ii = this.segments.length; i < ii; i += 1) {
const segment = this.segments[i];
const subdivisions = segmentSubdivisions[i];
if (segment.isVisible) {
const segmentClosestPointT = segment.closestPointT(p, {
precision,
subdivisions
});
const segmentClosestPoint = segment.pointAtT(segmentClosestPointT);
const squaredDistance = GeometryUtil.squaredLength(segmentClosestPoint, p);
if (squaredDistance < minSquaredDistance) {
closestPointT = { segmentIndex: i, value: segmentClosestPointT };
minSquaredDistance = squaredDistance;
}
}
}
if (closestPointT) {
return closestPointT;
}
return { segmentIndex: this.segments.length - 1, value: 1 };
}
closestPointTangent(p, options = {}) {
if (this.segments.length === 0) {
return null;
}
const precision = this.getPrecision(options);
const segmentSubdivisions = this.getSubdivisions(options);
let closestPointTangent;
let minSquaredDistance = Infinity;
for (let i = 0, ii = this.segments.length; i < ii; i += 1) {
const segment = this.segments[i];
const subdivisions = segmentSubdivisions[i];
if (segment.isDifferentiable()) {
const segmentClosestPointT = segment.closestPointT(p, {
precision,
subdivisions
});
const segmentClosestPoint = segment.pointAtT(segmentClosestPointT);
const squaredDistance = GeometryUtil.squaredLength(segmentClosestPoint, p);
if (squaredDistance < minSquaredDistance) {
closestPointTangent = segment.tangentAtT(segmentClosestPointT);
minSquaredDistance = squaredDistance;
}
}
}
if (closestPointTangent) {
return closestPointTangent;
}
return null;
}
containsPoint(p, options = {}) {
const polylines = this.toPolylines(options);
if (!polylines) {
return false;
}
let numIntersections = 0;
for (let i = 0, ii = polylines.length; i < ii; i += 1) {
const polyline = polylines[i];
if (polyline.containsPoint(p)) {
numIntersections += 1;
}
}
return numIntersections % 2 === 1;
}
pointAt(ratio, options = {}) {
if (this.segments.length === 0) {
return null;
}
if (ratio <= 0) {
return this.start.clone();
}
if (ratio >= 1) {
return this.end.clone();
}
const opts = this.getOptions(options);
const pathLength = this.length(opts);
const length = pathLength * ratio;
return this.pointAtLength(length, opts);
}
pointAtLength(length, options = {}) {
if (this.segments.length === 0) {
return null;
}
if (length === 0) {
return this.start.clone();
}
let fromStart = true;
if (length < 0) {
fromStart = false;
length = -length;
}
const precision = this.getPrecision(options);
const segmentSubdivisions = this.getSubdivisions(options);
let lastVisibleSegment;
let memo = 0;
for (let i = 0, ii = this.segments.length; i < ii; i += 1) {
const index2 = fromStart ? i : ii - 1 - i;
const segment = this.segments[index2];
const subdivisions = segmentSubdivisions[index2];
const d = segment.length({
precision,
subdivisions
});
if (segment.isVisible) {
if (length <= memo + d) {
return segment.pointAtLength((fromStart ? 1 : -1) * (length - memo), {
precision,
subdivisions
});
}
lastVisibleSegment = segment;
}
memo += d;
}
if (lastVisibleSegment) {
return fromStart ? lastVisibleSegment.end : lastVisibleSegment.start;
}
const lastSegment = this.segments[this.segments.length - 1];
return lastSegment.end.clone();
}
pointAtT(t) {
const segments = this.segments;
const numSegments = segments.length;
if (numSegments === 0)
return null;
const segmentIndex = t.segmentIndex;
if (segmentIndex < 0)
return segments[0].pointAtT(0);
if (segmentIndex >= numSegments) {
return segments[numSegments - 1].pointAtT(1);
}
const tValue = GeometryUtil.clamp(t.value, 0, 1);
return segments[segmentIndex].pointAtT(tValue);
}
divideAt(ratio, options = {}) {
if (this.segments.length === 0) {
return null;
}
const rate = GeometryUtil.clamp(ratio, 0, 1);
const opts = this.getOptions(options);
const len = this.length(opts);
const length = len * rate;
return this.divideAtLength(length, opts);
}
divideAtLength(length, options = {}) {
if (this.segments.length === 0) {
return null;
}
let fromStart = true;
if (length < 0) {
fromStart = false;
length = -length;
}
const precision = this.getPrecision(options);
const segmentSubdivisions = this.getSubdivisions(options);
let memo = 0;
let divided;
let dividedSegmentIndex;
let lastValidSegment;
let lastValidSegmentIndex;
let t;
for (let i = 0, ii = this.segments.length; i < ii; i += 1) {
const index3 = fromStart ? i : ii - 1 - i;
const segment = this.getSegment(index3);
const subdivisions = segmentSubdivisions[index3];
const opts = { precision, subdivisions };
const len = segment.length(opts);
if (segment.isDifferentiable()) {
lastValidSegment = segment;
lastValidSegmentIndex = index3;
if (length <= memo + len) {
dividedSegmentIndex = index3;
divided = segment.divideAtLength((fromStart ? 1 : -1) * (length - memo), opts);
break;
}
}
memo += len;
}
if (!lastValidSegment) {
return null;
}
if (!divided) {
dividedSegmentIndex = lastValidSegmentIndex;
t = fromStart ? 1 : 0;
divided = lastValidSegment.divideAtT(t);
}
const pathCopy = this.clone();
const index2 = dividedSegmentIndex;
pathCopy.replaceSegment(index2, divided);
const divisionStartIndex = index2;
let divisionMidIndex = index2 + 1;
let divisionEndIndex = index2 + 2;
if (!divided[0].isDifferentiable()) {
pathCopy.removeSegment(divisionStartIndex);
divisionMidIndex -= 1;
divisionEndIndex -= 1;
}
const movetoEnd = pathCopy.getSegment(divisionMidIndex).start;
pathCopy.insertSegment(divisionMidIndex, _Path.createSegment("M", movetoEnd));
divisionEndIndex += 1;
if (!divided[1].isDifferentiable()) {
pathCopy.removeSegment(divisionEndIndex - 1);
divisionEndIndex -= 1;
}
const secondPathSegmentIndexConversion = divisionEndIndex - divisionStartIndex - 1;
for (let i = divisionEndIndex, ii = pathCopy.segments.length; i < ii; i += 1) {
const originalSegment = this.getSegment(i - secondPathSegmentIndexConversion);
const segment = pathCopy.getSegment(i);
if (segment.type === "Z" && !originalSegment.subpathStartSegment.end.equals(segment.subpathStartSegment.end)) {
const convertedSegment = _Path.createSegment("L", originalSegment.end);
pathCopy.replaceSegment(i, convertedSegment);
}
}
const firstPath = new _Path(pathCopy.segments.slice(0, divisionMidIndex));
const secondPath = new _Path(pathCopy.segments.slice(divisionMidIndex));
return [firstPath, secondPath];
}
intersectsWithLine(line, options = {}) {
const polylines = this.toPolylines(options);
if (polylines == null) {
return null;
}
let intersections = null;
for (let i = 0, ii = polylines.length; i < ii; i += 1) {
const polyline = polylines[i];
const intersection = line.intersect(polyline);
if (intersection) {
if (intersections == null) {
intersections = [];
}
if (Array.isArray(intersection)) {
intersections.push(...intersection);
} else {
intersections.push(intersection);
}
}
}
return intersections;
}
isDifferentiable() {
for (let i = 0, ii = this.segments.length; i < ii; i += 1) {
const segment = this.segments[i];
if (segment.isDifferentiable()) {
return true;
}
}
return false;
}
isValid() {
const segments = this.segments;
const isValid2 = segments.length === 0 || segments[0].type === "M";
return isValid2;
}
length(options = {}) {
if (this.segments.length === 0) {
return 0;
}
const segmentSubdivisions = this.getSubdivisions(options);
let length = 0;
for (let i = 0, ii = this.segments.length; i < ii; i += 1) {
const segment = this.segments[i];
const subdivisions = segmentSubdivisions[i];
length += segment.length({ subdivisions });
}
return length;
}
lengthAtT(t, options = {}) {
const count = this.segments.length;
if (count === 0) {
return 0;
}
let segmentIndex = t.segmentIndex;
if (segmentIndex < 0) {
return 0;
}
let tValue = GeometryUtil.clamp(t.value, 0, 1);
if (segmentIndex >= count) {
segmentIndex = count - 1;
tValue = 1;
}
const precision = this.getPrecision(options);
const segmentSubdivisions = this.getSubdivisions(options);
let length = 0;
for (let i = 0; i < segmentIndex; i += 1) {
const segment2 = this.segments[i];
const subdivisions2 = segmentSubdivisions[i];
length += segment2.length({ precision, subdivisions: subdivisions2 });
}
const segment = this.segments[segmentIndex];
const subdivisions = segmentSubdivisions[segmentIndex];
length += segment.lengthAtT(tValue, { precision, subdivisions });
return length;
}
tangentAt(ratio, options = {}) {
if (this.segments.length === 0) {
return null;
}
const rate = GeometryUtil.clamp(ratio, 0, 1);
const opts = this.getOptions(options);
const len = this.length(opts);
const length = len * rate;
return this.tangentAtLength(length, opts);
}
tangentAtLength(length, options = {}) {
if (this.segments.length === 0) {
return null;
}
let fromStart = true;
if (length < 0) {
fromStart = false;
length = -length;
}
const precision = this.getPrecision(options);
const segmentSubdivisions = this.getSubdivisions(options);
let lastValidSegment;
let memo = 0;
for (let i = 0, ii = this.segments.length; i < ii; i += 1) {
const index2 = fromStart ? i : ii - 1 - i;
const segment = this.segments[index2];
const subdivisions = segmentSubdivisions[index2];
const len = segment.length({ precision, subdivisions });
if (segment.isDifferentiable()) {
if (length <= memo + len) {
return segment.tangentAtLength((fromStart ? 1 : -1) * (length - memo), {
precision,
subdivisions
});
}
lastValidSegment = segment;
}
memo += len;
}
if (lastValidSegment) {
const t = fromStart ? 1 : 0;
return lastValidSegment.tangentAtT(t);
}
return null;
}
tangentAtT(t) {
const count = this.segments.length;
if (count === 0) {
return null;
}
const segmentIndex = t.segmentIndex;
if (segmentIndex < 0) {
return this.segments[0].tangentAtT(0);
}
if (segmentIndex >= count) {
return this.segments[count - 1].tangentAtT(1);
}
const tValue = GeometryUtil.clamp(t.value, 0, 1);
return this.segments[segmentIndex].tangentAtT(tValue);
}
getPrecision(options = {}) {
return options.precision == null ? this.PRECISION : options.precision;
}
getSubdivisions(options = {}) {
if (options.segmentSubdivisions == null) {
const precision = this.getPrecision(options);
return this.getSegmentSubdivisions({ precision });
}
return options.segmentSubdivisions;
}
getOptions(options = {}) {
const precision = this.getPrecision(options);
const segmentSubdivisions = this.getSubdivisions(options);
return { precision, segmentSubdivisions };
}
toPoints(options = {}) {
const segments = this.segments;
const count = segments.length;
if (count === 0) {
return null;
}
const segmentSubdivisions = this.getSubdivisions(options);
const points = [];
let partialPoints = [];
for (let i = 0; i < count; i += 1) {
const segment = segments[i];
if (segment.isVisible) {
const divisions = segmentSubdivisions[i];
if (divisions.length > 0) {
divisions.forEach((c) => partialPoints.push(c.start));
} else {
partialPoints.push(segment.start);
}
} else if (partialPoints.length > 0) {
partialPoints.push(segments[i - 1].end);
points.push(partialPoints);
partialPoints = [];
}
}
if (partialPoints.length > 0) {
partialPoints.push(this.end);
points.push(partialPoints);
}
return points;
}
toPolylines(options = {}) {
const points = this.toPoints(options);
if (!points) {
return null;
}
return points.map((arr) => new Polyline(arr));
}
scale(sx, sy, origin) {
this.segments.forEach((s) => s.scale(sx, sy, origin));
return this;
}
rotate(angle, origin) {
this.segments.forEach((segment) => segment.rotate(angle, origin));
return this;
}
translate(tx, ty) {
if (typeof tx === "number") {
this.segments.forEach((s) => s.translate(tx, ty));
} else {
this.segments.forEach((s) => s.translate(tx));
}
return this;
}
clone() {
const path = new _Path();
this.segments.forEach((s) => path.appendSegment(s.clone()));
return path;
}
equals(p) {
if (p == null) {
return false;
}
const segments = this.segments;
const otherSegments = p.segments;
const count = segments.length;
if (otherSegments.length !== count) {
return false;
}
for (let i = 0; i < count; i += 1) {
const a = segments[i];
const b = otherSegments[i];
if (a.type !== b.type || !a.equals(b)) {
return false;
}
}
return true;
}
toJSON() {
return this.segments.map((s) => s.toJSON());
}
serialize() {
if (!this.isValid()) {
throw new Error("Invalid path segments.");
}
return this.segments.map((s) => s.serialize()).join(" ");
}
toString() {
return this.serialize();
}
};
(function(Path2) {
function isPath(instance) {
return instance != null && instance instanceof Path2;
}
Path2.isPath = isPath;
})(Path || (Path = {}));
(function(Path2) {
function parse2(pathData) {
if (!pathData) {
return new Path2();
}
const path = new Path2();
const commandRe = /(?:[a-zA-Z] *)(?:(?:-?\d+(?:\.\d+)?(?:e[-+]?\d+)? *,? *)|(?:-?\.\d+ *,? *))+|(?:[a-zA-Z] *)(?! |\d|-|\.)/g;
const commands = Path2.normalize(pathData).match(commandRe);
if (commands != null) {
for (let i = 0, ii = commands.length; i < ii; i += 1) {
const command = commands[i];
const argRe = /(?:[a-zA-Z])|(?:(?:-?\d+(?:\.\d+)?(?:e[-+]?\d+)?))|(?:(?:-?\.\d+))/g;
const args = command.match(argRe);
if (args != null) {
const type = args[0];
const coords = args.slice(1).map((a) => +a);
const segment = createSegment.call(null, type, ...coords);
path.appendSegment(segment);
}
}
}
return path;
}
Path2.parse = parse2;
function createSegment(type, ...args) {
if (type === "M") {
return MoveTo.create.call(null, ...args);
}
if (type === "L") {
return LineTo.create.call(null, ...args);
}
if (type === "C") {
return CurveTo.create.call(null, ...args);
}
if (type === "z" || type === "Z") {
return Close.create();
}
throw new Error(`Invalid path segment type "${type}"`);
}
Path2.createSegment = createSegment;
})(Path || (Path = {}));
(function(Path2) {
Path2.normalize = normalizePathData;
Path2.isValid = isValid;
Path2.drawArc = drawArc;
Path2.drawPoints = drawPoints;
Path2.arcToCurves = arcToCurves;
})(Path || (Path = {}));
}
});
// node_modules/@antv/x6-geometry/es/path/index.js
var init_path3 = __esm({
"node_modules/@antv/x6-geometry/es/path/index.js"() {
init_path2();
init_segment();
init_normalize();
}
});
// node_modules/@antv/x6-geometry/es/index.js
var es_exports2 = {};
__export(es_exports2, {
Angle: () => Angle,
Curve: () => Curve,
Ellipse: () => Ellipse,
GeometryUtil: () => GeometryUtil,
Line: () => Line,
Path: () => Path,
Point: () => Point,
Polyline: () => Polyline,
Rectangle: () => Rectangle,
Segment: () => Segment,
normalizePathData: () => normalizePathData
});
var init_es2 = __esm({
"node_modules/@antv/x6-geometry/es/index.js"() {
init_angle();
init_point();
init_line();
init_ellipse();
init_rectangle();
init_path3();
init_curve();
init_polyline();
init_util4();
}
});
export {
Disposable,
DisposableDelegate,
DisposableSet,
main_exports,
Events,
object_exports,
Basecoat,
Disablable,
array_exports,
string_exports,
number_exports,
Platform,
main_exports2,
DataUri,
Unit,
Vector,
main_exports3,
SizeSensor,
PriorityQueue,
Dijkstra,
Color,
Dictionary,
ModifierKey,
Timing,
Interp,
loader_exports,
es_exports,
init_es,
Angle,
GeometryUtil,
Point,
Rectangle,
Line,
Ellipse,
Polyline,
Curve,
Segment,
normalizePathData,
Path,
es_exports2,
init_es2
};
//# sourceMappingURL=chunk-JJ4XOBWH.js.map