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 = ``;
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(/