@camunda8/cli 4.2.0-alpha.2 → 4.2.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -2034,21 +2034,7 @@ var require_semver2 = __commonJS({
2034
2034
  }
2035
2035
  });
2036
2036
 
2037
- // node_modules/bpmn-moddle/node_modules/min-dash/dist/index.esm.js
2038
- function isString(obj) {
2039
- return nativeToString.call(obj) === "[object String]";
2040
- }
2041
- function assign(target, ...others) {
2042
- return Object.assign(target, ...others);
2043
- }
2044
- var nativeToString;
2045
- var init_index_esm = __esm({
2046
- "node_modules/bpmn-moddle/node_modules/min-dash/dist/index.esm.js"() {
2047
- nativeToString = Object.prototype.toString;
2048
- }
2049
- });
2050
-
2051
- // node_modules/moddle/node_modules/min-dash/dist/index.esm.js
2037
+ // node_modules/min-dash/dist/index.js
2052
2038
  function isUndefined(obj) {
2053
2039
  return obj === void 0;
2054
2040
  }
@@ -2059,17 +2045,53 @@ function isNil(obj) {
2059
2045
  return obj == null;
2060
2046
  }
2061
2047
  function isArray(obj) {
2062
- return nativeToString2.call(obj) === "[object Array]";
2048
+ return nativeToString.call(obj) === "[object Array]";
2063
2049
  }
2064
2050
  function isObject(obj) {
2065
- return nativeToString2.call(obj) === "[object Object]";
2051
+ return nativeToString.call(obj) === "[object Object]";
2066
2052
  }
2067
- function isString2(obj) {
2068
- return nativeToString2.call(obj) === "[object String]";
2053
+ function isFunction(obj) {
2054
+ const tag = nativeToString.call(obj);
2055
+ return tag === "[object Function]" || tag === "[object AsyncFunction]" || tag === "[object GeneratorFunction]" || tag === "[object AsyncGeneratorFunction]" || tag === "[object Proxy]";
2056
+ }
2057
+ function isString(obj) {
2058
+ return nativeToString.call(obj) === "[object String]";
2069
2059
  }
2070
2060
  function has(target, key) {
2071
2061
  return !isNil(target) && nativeHasOwnProperty.call(target, key);
2072
2062
  }
2063
+ function find(collection, matcher) {
2064
+ const matchFn = toMatcher(matcher);
2065
+ let match;
2066
+ forEach(collection, function(val, key) {
2067
+ if (matchFn(val, key)) {
2068
+ match = val;
2069
+ return false;
2070
+ }
2071
+ });
2072
+ return match;
2073
+ }
2074
+ function findIndex(collection, matcher) {
2075
+ const matchFn = toMatcher(matcher);
2076
+ let idx = isArray(collection) ? -1 : void 0;
2077
+ forEach(collection, function(val, key) {
2078
+ if (matchFn(val, key)) {
2079
+ idx = key;
2080
+ return false;
2081
+ }
2082
+ });
2083
+ return idx;
2084
+ }
2085
+ function filter(collection, matcher) {
2086
+ const matchFn = toMatcher(matcher);
2087
+ let result = [];
2088
+ forEach(collection, function(val, key) {
2089
+ if (matchFn(val, key)) {
2090
+ result.push(val);
2091
+ }
2092
+ });
2093
+ return result;
2094
+ }
2073
2095
  function forEach(collection, iterator) {
2074
2096
  let val, result;
2075
2097
  if (isUndefined(collection)) {
@@ -2086,6 +2108,11 @@ function forEach(collection, iterator) {
2086
2108
  }
2087
2109
  }
2088
2110
  }
2111
+ function toMatcher(matcher) {
2112
+ return isFunction(matcher) ? matcher : (e) => {
2113
+ return e === matcher;
2114
+ };
2115
+ }
2089
2116
  function identity(arg) {
2090
2117
  return arg;
2091
2118
  }
@@ -2095,7 +2122,7 @@ function toNum(arg) {
2095
2122
  function bind(fn, target) {
2096
2123
  return fn.bind(target);
2097
2124
  }
2098
- function assign2(target, ...others) {
2125
+ function assign(target, ...others) {
2099
2126
  return Object.assign(target, ...others);
2100
2127
  }
2101
2128
  function set(target, path, value) {
@@ -2137,10 +2164,10 @@ function pick(target, properties) {
2137
2164
  });
2138
2165
  return result;
2139
2166
  }
2140
- var nativeToString2, nativeHasOwnProperty;
2141
- var init_index_esm2 = __esm({
2142
- "node_modules/moddle/node_modules/min-dash/dist/index.esm.js"() {
2143
- nativeToString2 = Object.prototype.toString;
2167
+ var nativeToString, nativeHasOwnProperty;
2168
+ var init_dist = __esm({
2169
+ "node_modules/min-dash/dist/index.js"() {
2170
+ nativeToString = Object.prototype.toString;
2144
2171
  nativeHasOwnProperty = Object.prototype.hasOwnProperty;
2145
2172
  }
2146
2173
  });
@@ -2188,13 +2215,13 @@ function DescriptorBuilder(nameNs) {
2188
2215
  this.ns = nameNs;
2189
2216
  this.name = nameNs.name;
2190
2217
  this.allTypes = [];
2191
- this.allTypesByName = {};
2218
+ this.allTypesByName = /* @__PURE__ */ Object.create(null);
2192
2219
  this.properties = [];
2193
- this.propertiesByName = {};
2220
+ this.propertiesByName = /* @__PURE__ */ Object.create(null);
2194
2221
  }
2195
2222
  function Registry(packages2, properties) {
2196
- this.packageMap = {};
2197
- this.typeMap = {};
2223
+ this.packageMap = /* @__PURE__ */ Object.create(null);
2224
+ this.typeMap = /* @__PURE__ */ Object.create(null);
2198
2225
  this.packages = [];
2199
2226
  this.properties = properties;
2200
2227
  forEach(packages2, bind(this.registerPackage, this));
@@ -2226,13 +2253,13 @@ function Moddle(packages2, config = {}) {
2226
2253
  this.properties = new Properties(this);
2227
2254
  this.factory = new Factory(this, this.properties);
2228
2255
  this.registry = new Registry(packages2, this.properties);
2229
- this.typeCache = {};
2256
+ this.typeCache = /* @__PURE__ */ Object.create(null);
2230
2257
  this.config = config;
2231
2258
  }
2232
2259
  var BUILTINS, TYPE_CONVERTERS;
2233
- var init_dist = __esm({
2260
+ var init_dist2 = __esm({
2234
2261
  "node_modules/moddle/dist/index.js"() {
2235
- init_index_esm2();
2262
+ init_dist();
2236
2263
  Base.prototype.get = function(name2) {
2237
2264
  return this.$model.properties.get(this, name2);
2238
2265
  };
@@ -2264,14 +2291,14 @@ var init_dist = __esm({
2264
2291
  props.defineDescriptor(ModdleElement, descriptor);
2265
2292
  return ModdleElement;
2266
2293
  };
2267
- BUILTINS = {
2294
+ BUILTINS = assign(/* @__PURE__ */ Object.create(null), {
2268
2295
  String: true,
2269
2296
  Boolean: true,
2270
2297
  Integer: true,
2271
2298
  Real: true,
2272
2299
  Element: true
2273
- };
2274
- TYPE_CONVERTERS = {
2300
+ });
2301
+ TYPE_CONVERTERS = assign(/* @__PURE__ */ Object.create(null), {
2275
2302
  String: function(s) {
2276
2303
  return s;
2277
2304
  },
@@ -2284,7 +2311,7 @@ var init_dist = __esm({
2284
2311
  Real: function(s) {
2285
2312
  return parseFloat(s);
2286
2313
  }
2287
- };
2314
+ });
2288
2315
  DescriptorBuilder.prototype.build = function() {
2289
2316
  return pick(this, [
2290
2317
  "ns",
@@ -2408,7 +2435,7 @@ var init_dist = __esm({
2408
2435
  return;
2409
2436
  }
2410
2437
  forEach(t.properties, bind(function(p) {
2411
- p = assign2({}, p, {
2438
+ p = assign({}, p, {
2412
2439
  name: p.ns.localName,
2413
2440
  inherited
2414
2441
  });
@@ -2438,7 +2465,7 @@ var init_dist = __esm({
2438
2465
  return this.packages;
2439
2466
  };
2440
2467
  Registry.prototype.registerPackage = function(pkg) {
2441
- pkg = assign2({}, pkg);
2468
+ pkg = assign({}, pkg);
2442
2469
  var pkgMap = this.packageMap;
2443
2470
  ensureAvailable(pkgMap, pkg, "prefix");
2444
2471
  ensureAvailable(pkgMap, pkg, "uri");
@@ -2449,25 +2476,25 @@ var init_dist = __esm({
2449
2476
  this.packages.push(pkg);
2450
2477
  };
2451
2478
  Registry.prototype.registerType = function(type, pkg) {
2452
- type = assign2({}, type, {
2479
+ type = assign({}, type, {
2453
2480
  superClass: (type.superClass || []).slice(),
2454
2481
  extends: (type.extends || []).slice(),
2455
2482
  properties: (type.properties || []).slice(),
2456
- meta: assign2(type.meta || {})
2483
+ meta: assign({}, type.meta || {})
2457
2484
  });
2458
- var ns = parseName(type.name, pkg.prefix), name2 = ns.name, propertiesByName = {};
2485
+ var ns = parseName(type.name, pkg.prefix), name2 = ns.name, propertiesByName = /* @__PURE__ */ Object.create(null);
2459
2486
  forEach(type.properties, bind(function(p) {
2460
2487
  var propertyNs = parseName(p.name, ns.prefix), propertyName = propertyNs.name;
2461
2488
  if (!isBuiltIn(p.type)) {
2462
2489
  p.type = parseName(p.type, propertyNs.prefix).name;
2463
2490
  }
2464
- assign2(p, {
2491
+ assign(p, {
2465
2492
  ns: propertyNs,
2466
2493
  name: propertyName
2467
2494
  });
2468
2495
  propertiesByName[propertyName] = p;
2469
2496
  }, this));
2470
- assign2(type, {
2497
+ assign(type, {
2471
2498
  ns,
2472
2499
  name: name2,
2473
2500
  propertiesByName
@@ -2515,7 +2542,7 @@ var init_dist = __esm({
2515
2542
  this.properties.define(target, "$pkg", { value: pkg });
2516
2543
  };
2517
2544
  Properties.prototype.set = function(target, name2, value) {
2518
- if (!isString2(name2) || !name2.length) {
2545
+ if (!isString(name2) || !name2.length) {
2519
2546
  throw new TypeError("property name must be a non-empty string");
2520
2547
  }
2521
2548
  var property = this.getProperty(target, name2);
@@ -2552,7 +2579,7 @@ var init_dist = __esm({
2552
2579
  Properties.prototype.define = function(target, name2, options) {
2553
2580
  if (!options.writable) {
2554
2581
  var value = options.value;
2555
- options = assign2({}, options, {
2582
+ options = assign({}, options, {
2556
2583
  get: function() {
2557
2584
  return value;
2558
2585
  }
@@ -2596,7 +2623,7 @@ var init_dist = __esm({
2596
2623
  };
2597
2624
  Moddle.prototype.getType = function(descriptor) {
2598
2625
  var cache = this.typeCache;
2599
- var name2 = isString2(descriptor) ? descriptor : descriptor.ns.name;
2626
+ var name2 = isString(descriptor) ? descriptor : descriptor.ns.name;
2600
2627
  var type = cache[name2];
2601
2628
  if (!type) {
2602
2629
  descriptor = this.registry.getEffectiveDescriptor(name2);
@@ -2668,96 +2695,6 @@ var init_dist = __esm({
2668
2695
  }
2669
2696
  });
2670
2697
 
2671
- // node_modules/moddle-xml/node_modules/min-dash/dist/index.esm.js
2672
- function isUndefined3(obj) {
2673
- return obj === void 0;
2674
- }
2675
- function isNil2(obj) {
2676
- return obj == null;
2677
- }
2678
- function isArray2(obj) {
2679
- return nativeToString3.call(obj) === "[object Array]";
2680
- }
2681
- function isFunction(obj) {
2682
- const tag = nativeToString3.call(obj);
2683
- return tag === "[object Function]" || tag === "[object AsyncFunction]" || tag === "[object GeneratorFunction]" || tag === "[object AsyncGeneratorFunction]" || tag === "[object Proxy]";
2684
- }
2685
- function isString3(obj) {
2686
- return nativeToString3.call(obj) === "[object String]";
2687
- }
2688
- function has2(target, key) {
2689
- return !isNil2(target) && nativeHasOwnProperty2.call(target, key);
2690
- }
2691
- function find(collection, matcher) {
2692
- const matchFn = toMatcher(matcher);
2693
- let match;
2694
- forEach2(collection, function(val, key) {
2695
- if (matchFn(val, key)) {
2696
- match = val;
2697
- return false;
2698
- }
2699
- });
2700
- return match;
2701
- }
2702
- function findIndex(collection, matcher) {
2703
- const matchFn = toMatcher(matcher);
2704
- let idx = isArray2(collection) ? -1 : void 0;
2705
- forEach2(collection, function(val, key) {
2706
- if (matchFn(val, key)) {
2707
- idx = key;
2708
- return false;
2709
- }
2710
- });
2711
- return idx;
2712
- }
2713
- function filter(collection, matcher) {
2714
- const matchFn = toMatcher(matcher);
2715
- let result = [];
2716
- forEach2(collection, function(val, key) {
2717
- if (matchFn(val, key)) {
2718
- result.push(val);
2719
- }
2720
- });
2721
- return result;
2722
- }
2723
- function forEach2(collection, iterator) {
2724
- let val, result;
2725
- if (isUndefined3(collection)) {
2726
- return;
2727
- }
2728
- const convertKey = isArray2(collection) ? toNum2 : identity2;
2729
- for (let key in collection) {
2730
- if (has2(collection, key)) {
2731
- val = collection[key];
2732
- result = iterator(val, convertKey(key));
2733
- if (result === false) {
2734
- return val;
2735
- }
2736
- }
2737
- }
2738
- }
2739
- function toMatcher(matcher) {
2740
- return isFunction(matcher) ? matcher : (e) => {
2741
- return e === matcher;
2742
- };
2743
- }
2744
- function identity2(arg) {
2745
- return arg;
2746
- }
2747
- function toNum2(arg) {
2748
- return Number(arg);
2749
- }
2750
- function assign3(target, ...others) {
2751
- return Object.assign(target, ...others);
2752
- }
2753
- var nativeToString3, nativeHasOwnProperty2;
2754
- var init_index_esm3 = __esm({
2755
- "node_modules/moddle-xml/node_modules/min-dash/dist/index.esm.js"() {
2756
- nativeToString3 = Object.prototype.toString;
2757
- nativeHasOwnProperty2 = Object.prototype.hasOwnProperty;
2758
- }
2759
- });
2760
-
2761
2698
  // node_modules/saxen/dist/index.js
2762
2699
  function replaceEntities(_, d, x, z) {
2763
2700
  if (z) {
@@ -2791,7 +2728,7 @@ function getter(getFn) {
2791
2728
  };
2792
2729
  }
2793
2730
  function cloneNsMatrix(nsMatrix) {
2794
- var clone = {}, key;
2731
+ var clone = /* @__PURE__ */ Object.create(null), key;
2795
2732
  for (key in nsMatrix) {
2796
2733
  clone[key] = nsMatrix[key];
2797
2734
  }
@@ -2801,7 +2738,7 @@ function uriPrefix(prefix2) {
2801
2738
  return prefix2 + "$uri";
2802
2739
  }
2803
2740
  function buildNsMatrix(nsUriToPrefix) {
2804
- var nsMatrix = {}, uri2, prefix2;
2741
+ var nsMatrix = /* @__PURE__ */ Object.create(null), uri2, prefix2;
2805
2742
  for (uri2 in nsUriToPrefix) {
2806
2743
  prefix2 = nsUriToPrefix[uri2];
2807
2744
  nsMatrix[prefix2] = prefix2;
@@ -2822,10 +2759,14 @@ function Parser(options) {
2822
2759
  var proxy = options && options["proxy"];
2823
2760
  var onText, onOpenTag, onCloseTag, onCDATA, onError = throwFunc, onWarning, onComment, onQuestion, onAttention;
2824
2761
  var getContext = noopGetContext;
2762
+ var streaming = false;
2763
+ var rootTagFound = false;
2764
+ var leftoverXml = "";
2825
2765
  var maybeNS = false;
2826
2766
  var isNamespace = false;
2827
2767
  var returnError = null;
2828
2768
  var parseStop = false;
2769
+ var nsMatrixStack, nsMatrix, nodeStack;
2829
2770
  var nsUriToPrefix;
2830
2771
  function handleError(err) {
2831
2772
  if (!(err instanceof Error)) {
@@ -2889,7 +2830,7 @@ function Parser(options) {
2889
2830
  if (typeof nsMap !== "object") {
2890
2831
  throw error("required args <nsMap={}>");
2891
2832
  }
2892
- var _nsUriToPrefix = {}, k;
2833
+ var _nsUriToPrefix = /* @__PURE__ */ Object.create(null), k;
2893
2834
  for (k in nsMap) {
2894
2835
  _nsUriToPrefix[k] = nsMap[k];
2895
2836
  }
@@ -2897,27 +2838,79 @@ function Parser(options) {
2897
2838
  nsUriToPrefix = _nsUriToPrefix;
2898
2839
  return this;
2899
2840
  };
2841
+ function resetState() {
2842
+ nsMatrixStack = isNamespace ? [] : null;
2843
+ nsMatrix = isNamespace ? buildNsMatrix(nsUriToPrefix) : null;
2844
+ nodeStack = [];
2845
+ getContext = noopGetContext;
2846
+ parseStop = false;
2847
+ returnError = null;
2848
+ rootTagFound = false;
2849
+ leftoverXml = "";
2850
+ }
2900
2851
  this["parse"] = function(xml2) {
2901
2852
  if (typeof xml2 !== "string") {
2902
2853
  throw error("required args <xml=string>");
2903
2854
  }
2904
- returnError = null;
2855
+ if (streaming) {
2856
+ throw error("parse during stream; call end() first");
2857
+ }
2858
+ resetState();
2905
2859
  parse(xml2);
2906
2860
  getContext = noopGetContext;
2907
2861
  parseStop = false;
2908
2862
  return returnError;
2909
2863
  };
2864
+ this["write"] = function(xml2) {
2865
+ if (typeof xml2 !== "string") {
2866
+ throw error("required args <xml=string>");
2867
+ }
2868
+ if (!streaming) {
2869
+ resetState();
2870
+ streaming = true;
2871
+ }
2872
+ if (!returnError) {
2873
+ leftoverXml = parse(leftoverXml + xml2, true) || "";
2874
+ }
2875
+ return this;
2876
+ };
2877
+ this["end"] = function() {
2878
+ if (!streaming) {
2879
+ resetState();
2880
+ }
2881
+ streaming = false;
2882
+ if (!returnError) {
2883
+ parse(leftoverXml);
2884
+ }
2885
+ leftoverXml = "";
2886
+ getContext = noopGetContext;
2887
+ parseStop = false;
2888
+ return returnError;
2889
+ };
2910
2890
  this["stop"] = function() {
2911
2891
  parseStop = true;
2912
2892
  };
2913
- function parse(xml2) {
2914
- var nsMatrixStack = isNamespace ? [] : null, nsMatrix = isNamespace ? buildNsMatrix(nsUriToPrefix) : null, _nsMatrix, nodeStack = [], anonymousNsCount = 0, tagStart = false, tagEnd = false, i = 0, j = 0, x, y, q, w, v, xmlns, elementName, _elementName, elementProxy;
2893
+ function parse(xml2, streaming2 = false) {
2894
+ var elNameCache = null, elNameCacheMatrix = null;
2895
+ var _nsMatrix, anonymousNsCount = 0, tagStart = false, tagEnd = false, i = 0, j = 0, x, y, q, w, v, xmlns, elementName, _elementName, elementProxy;
2915
2896
  var attrsString = "", attrsStart = 0, cachedAttrs;
2897
+ function normalizeAttrName(name2, defaultAlias) {
2898
+ var w2 = name2.indexOf(":");
2899
+ if (w2 === -1) {
2900
+ return name2;
2901
+ }
2902
+ var nsName2 = nsMatrix[name2.substring(0, w2)];
2903
+ if (!nsName2) {
2904
+ handleWarning(missingNamespaceForPrefix(name2.substring(0, w2)));
2905
+ return null;
2906
+ }
2907
+ return defaultAlias === nsName2 ? name2.substr(w2 + 1) : nsName2 + name2.substr(w2);
2908
+ }
2916
2909
  function getAttrs() {
2917
2910
  if (cachedAttrs !== null) {
2918
2911
  return cachedAttrs;
2919
2912
  }
2920
- var nsUri, nsUriPrefix, nsName2, defaultAlias = isNamespace && nsMatrix["xmlns"], attrList = isNamespace && maybeNS ? [] : null, i2 = attrsStart, s = attrsString, l = s.length, hasNewMatrix, newalias, value, alias, name2, attrs = {}, seenAttrs = {}, skipAttr, w2, j2;
2913
+ var nsUri, nsUriPrefix, defaultAlias = isNamespace && nsMatrix["xmlns"], attrList = isNamespace && maybeNS ? [] : null, i2 = attrsStart, s = attrsString, l = s.length, hasNewMatrix, newalias, value, alias, name2, attrs = {}, seenAttrs = /* @__PURE__ */ new Set(), skipAttr, w2, j2;
2921
2914
  parseAttr:
2922
2915
  for (; i2 < l; i2++) {
2923
2916
  skipAttr = false;
@@ -3006,11 +2999,11 @@ function Parser(options) {
3006
2999
  if (skipAttr) {
3007
3000
  continue parseAttr;
3008
3001
  }
3009
- if (name2 in seenAttrs) {
3002
+ if (seenAttrs.has(name2)) {
3010
3003
  handleWarning("attribute <" + name2 + "> already defined");
3011
3004
  continue;
3012
3005
  }
3013
- seenAttrs[name2] = true;
3006
+ seenAttrs.add(name2);
3014
3007
  if (!isNamespace) {
3015
3008
  attrs[name2] = value;
3016
3009
  continue;
@@ -3049,29 +3042,18 @@ function Parser(options) {
3049
3042
  attrList.push(name2, value);
3050
3043
  continue;
3051
3044
  }
3052
- w2 = name2.indexOf(":");
3053
- if (w2 === -1) {
3054
- attrs[name2] = value;
3055
- continue;
3056
- }
3057
- if (!(nsName2 = nsMatrix[name2.substring(0, w2)])) {
3058
- handleWarning(missingNamespaceForPrefix(name2.substring(0, w2)));
3045
+ name2 = normalizeAttrName(name2, defaultAlias);
3046
+ if (name2 === null) {
3059
3047
  continue;
3060
3048
  }
3061
- name2 = defaultAlias === nsName2 ? name2.substr(w2 + 1) : nsName2 + name2.substr(w2);
3062
3049
  attrs[name2] = value;
3063
3050
  }
3064
3051
  if (maybeNS) {
3065
3052
  for (i2 = 0, l = attrList.length; i2 < l; i2++) {
3066
- name2 = attrList[i2++];
3053
+ name2 = normalizeAttrName(attrList[i2++], defaultAlias);
3067
3054
  value = attrList[i2];
3068
- w2 = name2.indexOf(":");
3069
- if (w2 !== -1) {
3070
- if (!(nsName2 = nsMatrix[name2.substring(0, w2)])) {
3071
- handleWarning(missingNamespaceForPrefix(name2.substring(0, w2)));
3072
- continue;
3073
- }
3074
- name2 = defaultAlias === nsName2 ? name2.substr(w2 + 1) : nsName2 + name2.substr(w2);
3055
+ if (name2 === null) {
3056
+ continue;
3075
3057
  }
3076
3058
  attrs[name2] = value;
3077
3059
  }
@@ -3135,10 +3117,13 @@ function Parser(options) {
3135
3117
  i = xml2.indexOf("<", j);
3136
3118
  }
3137
3119
  if (i === -1) {
3120
+ if (streaming2) {
3121
+ return xml2.substring(j);
3122
+ }
3138
3123
  if (nodeStack.length) {
3139
3124
  return handleError("unexpected end of file");
3140
3125
  }
3141
- if (j === 0) {
3126
+ if (!rootTagFound) {
3142
3127
  return handleError("missing start tag");
3143
3128
  }
3144
3129
  if (j < xml2.length) {
@@ -3148,6 +3133,9 @@ function Parser(options) {
3148
3133
  }
3149
3134
  return;
3150
3135
  }
3136
+ if (!rootTagFound) {
3137
+ rootTagFound = true;
3138
+ }
3151
3139
  if (j !== i) {
3152
3140
  if (nodeStack.length) {
3153
3141
  if (onText) {
@@ -3171,6 +3159,9 @@ function Parser(options) {
3171
3159
  if (q === 91 && xml2.substr(i + 3, 6) === "CDATA[") {
3172
3160
  j = xml2.indexOf("]]>", i);
3173
3161
  if (j === -1) {
3162
+ if (streaming2) {
3163
+ return xml2.substring(i);
3164
+ }
3174
3165
  return handleError("unclosed cdata");
3175
3166
  }
3176
3167
  if (onCDATA) {
@@ -3185,6 +3176,9 @@ function Parser(options) {
3185
3176
  if (q === 45 && xml2.charCodeAt(i + 3) === 45) {
3186
3177
  j = xml2.indexOf("-->", i);
3187
3178
  if (j === -1) {
3179
+ if (streaming2) {
3180
+ return xml2.substring(i);
3181
+ }
3188
3182
  return handleError("unclosed comment");
3189
3183
  }
3190
3184
  if (onComment) {
@@ -3200,6 +3194,9 @@ function Parser(options) {
3200
3194
  if (w === 63) {
3201
3195
  j = xml2.indexOf("?>", i);
3202
3196
  if (j === -1) {
3197
+ if (streaming2) {
3198
+ return xml2.substring(i);
3199
+ }
3203
3200
  return handleError("unclosed question");
3204
3201
  }
3205
3202
  if (onQuestion) {
@@ -3214,6 +3211,9 @@ function Parser(options) {
3214
3211
  for (x = i + 1; ; x++) {
3215
3212
  v = xml2.charCodeAt(x);
3216
3213
  if (isNaN(v)) {
3214
+ if (streaming2) {
3215
+ return xml2.substring(i);
3216
+ }
3217
3217
  j = -1;
3218
3218
  return handleError("unclosed tag");
3219
3219
  }
@@ -3302,18 +3302,31 @@ function Parser(options) {
3302
3302
  }
3303
3303
  }
3304
3304
  _elementName = elementName;
3305
- w = elementName.indexOf(":");
3306
- if (w !== -1) {
3307
- xmlns = nsMatrix[elementName.substring(0, w)];
3308
- if (!xmlns) {
3309
- return handleError("missing namespace on <" + _elementName + ">");
3305
+ if (elNameCacheMatrix !== nsMatrix) {
3306
+ elNameCache = nsMatrix[NAME_CACHE];
3307
+ if (elNameCache === void 0) {
3308
+ elNameCache = nsMatrix[NAME_CACHE] = /* @__PURE__ */ Object.create(null);
3310
3309
  }
3311
- elementName = elementName.substr(w + 1);
3312
- } else {
3313
- xmlns = nsMatrix["xmlns"];
3310
+ elNameCacheMatrix = nsMatrix;
3314
3311
  }
3315
- if (xmlns) {
3316
- elementName = xmlns + ":" + elementName;
3312
+ var _cachedName = elNameCache[elementName];
3313
+ if (_cachedName !== void 0) {
3314
+ elementName = _cachedName;
3315
+ } else {
3316
+ w = elementName.indexOf(":");
3317
+ if (w !== -1) {
3318
+ xmlns = nsMatrix[elementName.substring(0, w)];
3319
+ if (!xmlns) {
3320
+ return handleError("missing namespace on <" + _elementName + ">");
3321
+ }
3322
+ elementName = elementName.substr(w + 1);
3323
+ } else {
3324
+ xmlns = nsMatrix["xmlns"];
3325
+ }
3326
+ if (xmlns) {
3327
+ elementName = xmlns + ":" + elementName;
3328
+ }
3329
+ elNameCache[_elementName] = elementName;
3317
3330
  }
3318
3331
  }
3319
3332
  if (tagStart) {
@@ -3349,8 +3362,8 @@ function Parser(options) {
3349
3362
  }
3350
3363
  }
3351
3364
  }
3352
- var fromCharCode, hasOwnProperty, ENTITY_PATTERN, ENTITY_MAPPING, NON_WHITESPACE_OUTSIDE_ROOT_NODE;
3353
- var init_dist2 = __esm({
3365
+ var fromCharCode, hasOwnProperty, ENTITY_PATTERN, ENTITY_MAPPING, NON_WHITESPACE_OUTSIDE_ROOT_NODE, NAME_CACHE;
3366
+ var init_dist3 = __esm({
3354
3367
  "node_modules/saxen/dist/index.js"() {
3355
3368
  fromCharCode = String.fromCharCode;
3356
3369
  hasOwnProperty = Object.prototype.hasOwnProperty;
@@ -3366,6 +3379,7 @@ var init_dist2 = __esm({
3366
3379
  ENTITY_MAPPING[k.toUpperCase()] = ENTITY_MAPPING[k];
3367
3380
  });
3368
3381
  NON_WHITESPACE_OUTSIDE_ROOT_NODE = "non-whitespace outside of root node";
3382
+ NAME_CACHE = /* @__PURE__ */ Symbol("nameCache");
3369
3383
  }
3370
3384
  });
3371
3385
 
@@ -3412,7 +3426,7 @@ function getModdleDescriptor(element) {
3412
3426
  return element.$descriptor;
3413
3427
  }
3414
3428
  function Context(options) {
3415
- assign3(this, options);
3429
+ assign(this, options);
3416
3430
  this.elementsById = {};
3417
3431
  this.references = [];
3418
3432
  this.warnings = [];
@@ -3477,7 +3491,7 @@ function Reader(options) {
3477
3491
  model: options
3478
3492
  };
3479
3493
  }
3480
- assign3(this, { lax: false }, options);
3494
+ assign(this, { lax: false }, options);
3481
3495
  }
3482
3496
  function createStack() {
3483
3497
  var stack = [];
@@ -3519,7 +3533,7 @@ function inherits(ctor, superCtor) {
3519
3533
  });
3520
3534
  }
3521
3535
  function nsName(ns) {
3522
- if (isString3(ns)) {
3536
+ if (isString(ns)) {
3523
3537
  return ns;
3524
3538
  } else {
3525
3539
  return (ns.prefix ? ns.prefix + ":" : "") + ns.localName;
@@ -3535,13 +3549,13 @@ function getNsAttrs(namespaces) {
3535
3549
  }
3536
3550
  function getElementNs(ns, descriptor) {
3537
3551
  if (descriptor.isGeneric) {
3538
- return assign3({ localName: descriptor.ns.localName }, ns);
3552
+ return assign({ localName: descriptor.ns.localName }, ns);
3539
3553
  } else {
3540
- return assign3({ localName: nameToAlias(descriptor.ns.localName, descriptor.$pkg) }, ns);
3554
+ return assign({ localName: nameToAlias(descriptor.ns.localName, descriptor.$pkg) }, ns);
3541
3555
  }
3542
3556
  }
3543
3557
  function getPropertyNs(ns, descriptor) {
3544
- return assign3({ localName: descriptor.ns.localName }, ns);
3558
+ return assign({ localName: descriptor.ns.localName }, ns);
3545
3559
  }
3546
3560
  function getSerializableProperties(element) {
3547
3561
  var descriptor = element.$descriptor;
@@ -3550,7 +3564,7 @@ function getSerializableProperties(element) {
3550
3564
  if (p.isVirtual) {
3551
3565
  return false;
3552
3566
  }
3553
- if (!has2(element, name2)) {
3567
+ if (!has(element, name2)) {
3554
3568
  return false;
3555
3569
  }
3556
3570
  var value = element[name2];
@@ -3564,7 +3578,7 @@ function getSerializableProperties(element) {
3564
3578
  });
3565
3579
  }
3566
3580
  function escape(str, charPattern, replaceMap) {
3567
- str = isString3(str) ? str : "" + str;
3581
+ str = isString(str) ? str : "" + str;
3568
3582
  return str.replace(charPattern, function(s) {
3569
3583
  return "&" + replaceMap[s] + ";";
3570
3584
  });
@@ -3599,6 +3613,42 @@ function ElementSerializer(parent, propertyDescriptor) {
3599
3613
  this.parent = parent;
3600
3614
  this.propertyDescriptor = propertyDescriptor;
3601
3615
  }
3616
+ function serializeTree(root, writer) {
3617
+ var stack = [{ serializer: root, index: 0, opened: false, indent: false }];
3618
+ while (stack.length) {
3619
+ var frame = stack[stack.length - 1], serializer = frame.serializer;
3620
+ if (!frame.opened) {
3621
+ var firstBody = serializer.body[0];
3622
+ frame.indent = firstBody && firstBody.constructor !== BodySerializer;
3623
+ writer.appendIndent().append("<" + serializer.tagName);
3624
+ serializer.serializeAttributes(writer);
3625
+ writer.append(firstBody ? ">" : " />");
3626
+ frame.opened = true;
3627
+ if (!firstBody) {
3628
+ writer.appendNewLine();
3629
+ stack.pop();
3630
+ continue;
3631
+ }
3632
+ if (frame.indent) {
3633
+ writer.appendNewLine().indent();
3634
+ }
3635
+ }
3636
+ if (frame.index < serializer.body.length) {
3637
+ var child = serializer.body[frame.index++];
3638
+ if (child instanceof ElementSerializer) {
3639
+ stack.push({ serializer: child, index: 0, opened: false, indent: false });
3640
+ } else {
3641
+ child.serializeTo(writer);
3642
+ }
3643
+ continue;
3644
+ }
3645
+ if (frame.indent) {
3646
+ writer.unindent().appendIndent();
3647
+ }
3648
+ writer.append("</" + serializer.tagName + ">").appendNewLine();
3649
+ stack.pop();
3650
+ }
3651
+ }
3602
3652
  function TypeSerializer(parent, propertyDescriptor, serialization) {
3603
3653
  ElementSerializer.call(this, parent, propertyDescriptor);
3604
3654
  this.serialization = serialization;
@@ -3637,7 +3687,7 @@ function FormatingWriter(out, format) {
3637
3687
  };
3638
3688
  }
3639
3689
  function Writer(options) {
3640
- options = assign3({ format: false, preamble: true }, options || {});
3690
+ options = assign({ format: false, preamble: true }, options || {});
3641
3691
  function toXML(tree, writer) {
3642
3692
  var internalWriter = writer || new SavingWriter();
3643
3693
  var formatingWriter = new FormatingWriter(internalWriter, options.format);
@@ -3656,6 +3706,31 @@ function Writer(options) {
3656
3706
  toXML
3657
3707
  };
3658
3708
  }
3709
+ function buildTree(rootSerializer, rootElement) {
3710
+ var stack = [{
3711
+ serializer: rootSerializer,
3712
+ children: rootSerializer.enter(rootElement),
3713
+ index: 0
3714
+ }];
3715
+ while (stack.length) {
3716
+ var frame = stack[stack.length - 1];
3717
+ if (frame.index >= frame.children.length) {
3718
+ frame.serializer.exit();
3719
+ stack.pop();
3720
+ continue;
3721
+ }
3722
+ var child = frame.children[frame.index++];
3723
+ var childSerializer = child.create();
3724
+ frame.serializer.body.push(childSerializer);
3725
+ if (child.element) {
3726
+ stack.push({
3727
+ serializer: childSerializer,
3728
+ children: childSerializer.enter(child.element),
3729
+ index: 0
3730
+ });
3731
+ }
3732
+ }
3733
+ }
3659
3734
  function getDefaultPrefixMappings(model) {
3660
3735
  const nsMap = model.config && model.config.nsMap || {};
3661
3736
  const prefixMap = {};
@@ -3672,11 +3747,11 @@ function getDefaultPrefixMappings(model) {
3672
3747
  return prefixMap;
3673
3748
  }
3674
3749
  var DEFAULT_NS_MAP, SERIALIZE_PROPERTY, XML_PREAMBLE, ESCAPE_ATTR_CHARS, ESCAPE_CHARS, ESCAPE_ATTR_MAP, ESCAPE_MAP;
3675
- var init_dist3 = __esm({
3750
+ var init_dist4 = __esm({
3676
3751
  "node_modules/moddle-xml/dist/index.js"() {
3677
- init_index_esm3();
3678
- init_dist2();
3679
3752
  init_dist();
3753
+ init_dist3();
3754
+ init_dist2();
3680
3755
  DEFAULT_NS_MAP = {
3681
3756
  "xsi": "http://www.w3.org/2001/XMLSchema-instance",
3682
3757
  "xml": "http://www.w3.org/XML/1998/namespace"
@@ -3755,7 +3830,7 @@ var init_dist3 = __esm({
3755
3830
  };
3756
3831
  ElementHandler.prototype.createElement = function(node) {
3757
3832
  var attributes = node.attributes, Type = this.type, descriptor = getModdleDescriptor(Type), context = this.context, instance = new Type({}), model = this.model, propNameNs;
3758
- forEach2(attributes, function(value, name2) {
3833
+ forEach(attributes, function(value, name2) {
3759
3834
  var prop = descriptor.propertiesByName[name2], values;
3760
3835
  if (prop && prop.isReference) {
3761
3836
  if (!prop.isMany) {
@@ -3766,7 +3841,7 @@ var init_dist3 = __esm({
3766
3841
  });
3767
3842
  } else {
3768
3843
  values = value.split(" ");
3769
- forEach2(values, function(v) {
3844
+ forEach(values, function(v) {
3770
3845
  context.addReference({
3771
3846
  element: instance,
3772
3847
  property: prop.ns.name,
@@ -3807,7 +3882,7 @@ var init_dist3 = __esm({
3807
3882
  if (elementTypeName) {
3808
3883
  const normalizedTypeName = normalizeTypeName(elementTypeName, node.ns, model);
3809
3884
  const elementType = model.getType(normalizedTypeName);
3810
- return assign3({}, property, {
3885
+ return assign({}, property, {
3811
3886
  effectiveType: getModdleDescriptor(elementType).name
3812
3887
  });
3813
3888
  }
@@ -3822,7 +3897,7 @@ var init_dist3 = __esm({
3822
3897
  return !p.isVirtual && !p.isReference && !p.isAttribute && elementType.hasType(p.type);
3823
3898
  });
3824
3899
  if (property) {
3825
- return assign3({}, property, {
3900
+ return assign({}, property, {
3826
3901
  effectiveType: getModdleDescriptor(elementType).name
3827
3902
  });
3828
3903
  }
@@ -3873,7 +3948,7 @@ var init_dist3 = __esm({
3873
3948
  element.set(propertyDesc.name, newElement);
3874
3949
  }
3875
3950
  if (propertyDesc.isReference) {
3876
- assign3(newElement, {
3951
+ assign(newElement, {
3877
3952
  element
3878
3953
  });
3879
3954
  this.context.addReference(newElement);
@@ -3925,7 +4000,7 @@ var init_dist3 = __esm({
3925
4000
  }
3926
4001
  }
3927
4002
  var model = this.model, lax = this.lax;
3928
- var context = new Context(assign3({}, options, { rootHandler })), parser = new Parser({ proxy: true }), stack = createStack();
4003
+ var context = new Context(assign({}, options, { rootHandler })), parser = new Parser({ proxy: true }), stack = createStack();
3929
4004
  rootHandler.context = context;
3930
4005
  stack.push(rootHandler);
3931
4006
  function handleError(err, getContext, lax2) {
@@ -4085,8 +4160,27 @@ var init_dist3 = __esm({
4085
4160
  Namespaces.prototype.defaultUriByPrefix = function(prefix2) {
4086
4161
  return this.defaultPrefixMap[prefix2];
4087
4162
  };
4163
+ Namespaces.prototype.resolve = function(fn) {
4164
+ var scope = this;
4165
+ while (scope) {
4166
+ var resolved = fn(scope);
4167
+ if (resolved) {
4168
+ return resolved;
4169
+ }
4170
+ scope = scope.parent;
4171
+ }
4172
+ };
4173
+ Namespaces.prototype.eachScope = function(fn) {
4174
+ var scope = this;
4175
+ while (scope) {
4176
+ fn(scope);
4177
+ scope = scope.parent;
4178
+ }
4179
+ };
4088
4180
  Namespaces.prototype.byUri = function(uri2) {
4089
- return this.uriMap[uri2] || this.parent && this.parent.byUri(uri2);
4181
+ return this.resolve(function(scope) {
4182
+ return scope.uriMap[uri2];
4183
+ });
4090
4184
  };
4091
4185
  Namespaces.prototype.add = function(ns, isWellknown) {
4092
4186
  this.uriMap[ns.uri] = ns;
@@ -4098,7 +4192,10 @@ var init_dist3 = __esm({
4098
4192
  this.mapPrefix(ns.prefix, ns.uri);
4099
4193
  };
4100
4194
  Namespaces.prototype.uriByPrefix = function(prefix2) {
4101
- return this.prefixMap[prefix2 || "xmlns"] || this.parent && this.parent.uriByPrefix(prefix2);
4195
+ var key = prefix2 || "xmlns";
4196
+ return this.resolve(function(scope) {
4197
+ return scope.prefixMap[key];
4198
+ });
4102
4199
  };
4103
4200
  Namespaces.prototype.mapPrefix = function(prefix2, uri2) {
4104
4201
  this.prefixMap[prefix2 || "xmlns"] = uri2;
@@ -4109,10 +4206,9 @@ var init_dist3 = __esm({
4109
4206
  Namespaces.prototype.logUsed = function(ns) {
4110
4207
  var uri2 = ns.uri;
4111
4208
  var nsKey = this.getNSKey(ns);
4112
- this.used[nsKey] = this.byUri(uri2);
4113
- if (this.parent) {
4114
- this.parent.logUsed(ns);
4115
- }
4209
+ this.eachScope(function(scope) {
4210
+ scope.used[nsKey] = scope.byUri(uri2);
4211
+ });
4116
4212
  };
4117
4213
  Namespaces.prototype.getUsed = function(ns) {
4118
4214
  var allNs = [].concat(this.wellknown, this.custom);
@@ -4161,14 +4257,17 @@ var init_dist3 = __esm({
4161
4257
  writer.append("</" + this.tagName + ">").appendNewLine();
4162
4258
  };
4163
4259
  ElementSerializer.prototype.build = function(element) {
4260
+ buildTree(this, element);
4261
+ return this;
4262
+ };
4263
+ ElementSerializer.prototype.enter = function(element) {
4164
4264
  this.element = element;
4165
4265
  var elementDescriptor = element.$descriptor, propertyDescriptor = this.propertyDescriptor;
4166
- var otherAttrs, properties;
4167
4266
  var isGeneric = elementDescriptor.isGeneric;
4168
4267
  if (isGeneric) {
4169
- otherAttrs = this.parseGenericNsAttributes(element);
4268
+ this.otherAttrs = this.parseGenericNsAttributes(element);
4170
4269
  } else {
4171
- otherAttrs = this.parseNsAttributes(element);
4270
+ this.otherAttrs = this.parseNsAttributes(element);
4172
4271
  }
4173
4272
  if (propertyDescriptor) {
4174
4273
  this.ns = this.nsPropertyTagName(propertyDescriptor);
@@ -4177,14 +4276,14 @@ var init_dist3 = __esm({
4177
4276
  }
4178
4277
  this.tagName = this.addTagName(this.ns);
4179
4278
  if (isGeneric) {
4180
- this.parseGenericContainments(element);
4181
- } else {
4182
- properties = getSerializableProperties(element);
4183
- this.parseAttributes(filterAttributes(properties));
4184
- this.parseContainments(filterContained(properties));
4279
+ return this.collectGenericContainments(element);
4185
4280
  }
4186
- this.parseGenericAttributes(element, otherAttrs);
4187
- return this;
4281
+ var properties = getSerializableProperties(element);
4282
+ this.parseAttributes(filterAttributes(properties));
4283
+ return this.collectContainments(filterContained(properties));
4284
+ };
4285
+ ElementSerializer.prototype.exit = function() {
4286
+ this.parseGenericAttributes(this.element, this.otherAttrs);
4188
4287
  };
4189
4288
  ElementSerializer.prototype.nsTagName = function(descriptor) {
4190
4289
  var effectiveNs = this.logNamespaceUsed(descriptor.ns);
@@ -4199,7 +4298,7 @@ var init_dist3 = __esm({
4199
4298
  };
4200
4299
  ElementSerializer.prototype.nsAttributeName = function(element) {
4201
4300
  var ns;
4202
- if (isString3(element)) {
4301
+ if (isString(element)) {
4203
4302
  ns = parseName(element);
4204
4303
  } else {
4205
4304
  ns = element.ns;
@@ -4212,7 +4311,7 @@ var init_dist3 = __esm({
4212
4311
  if (this.isLocalNs(effectiveNs)) {
4213
4312
  return { localName: ns.localName };
4214
4313
  } else {
4215
- return assign3({ localName: ns.localName }, effectiveNs);
4314
+ return assign({ localName: ns.localName }, effectiveNs);
4216
4315
  }
4217
4316
  };
4218
4317
  ElementSerializer.prototype.parseGenericNsAttributes = function(element) {
@@ -4222,17 +4321,28 @@ var init_dist3 = __esm({
4222
4321
  ([key, value]) => ({ name: key, value })
4223
4322
  );
4224
4323
  };
4225
- ElementSerializer.prototype.parseGenericContainments = function(element) {
4226
- var body = element.$body;
4227
- if (body) {
4228
- this.body.push(new BodySerializer().build({ type: "String" }, body));
4324
+ ElementSerializer.prototype.collectGenericContainments = function(element) {
4325
+ var self = this, children = [];
4326
+ var bodyText = element.$body;
4327
+ if (bodyText) {
4328
+ children.push({
4329
+ create: function() {
4330
+ return new BodySerializer().build({ type: "String" }, bodyText);
4331
+ }
4332
+ });
4229
4333
  }
4230
- var children = element.$children;
4231
- if (children) {
4232
- forEach2(children, (child) => {
4233
- this.body.push(new ElementSerializer(this).build(child));
4334
+ var genericChildren = element.$children;
4335
+ if (genericChildren) {
4336
+ forEach(genericChildren, function(child) {
4337
+ children.push({
4338
+ create: function() {
4339
+ return new ElementSerializer(self);
4340
+ },
4341
+ element: child
4342
+ });
4234
4343
  });
4235
4344
  }
4345
+ return children;
4236
4346
  };
4237
4347
  ElementSerializer.prototype.parseNsAttribute = function(element, name2, value) {
4238
4348
  var model = element.$model;
@@ -4261,7 +4371,7 @@ var init_dist3 = __esm({
4261
4371
  var self = this;
4262
4372
  var genericAttrs = element.$attrs;
4263
4373
  var attributes = [];
4264
- forEach2(genericAttrs, function(value, name2) {
4374
+ forEach(genericAttrs, function(value, name2) {
4265
4375
  var nonNsAttr = self.parseNsAttribute(element, name2, value);
4266
4376
  if (nonNsAttr) {
4267
4377
  attributes.push(nonNsAttr);
@@ -4271,7 +4381,7 @@ var init_dist3 = __esm({
4271
4381
  };
4272
4382
  ElementSerializer.prototype.parseGenericAttributes = function(element, attributes) {
4273
4383
  var self = this;
4274
- forEach2(attributes, function(attr) {
4384
+ forEach(attributes, function(attr) {
4275
4385
  try {
4276
4386
  self.addAttribute(self.nsAttributeName(attr.name), attr.value);
4277
4387
  } catch (e) {
@@ -4283,45 +4393,59 @@ var init_dist3 = __esm({
4283
4393
  }
4284
4394
  });
4285
4395
  };
4286
- ElementSerializer.prototype.parseContainments = function(properties) {
4287
- var self = this, body = this.body, element = this.element;
4288
- forEach2(properties, function(p) {
4396
+ ElementSerializer.prototype.collectContainments = function(properties) {
4397
+ var self = this, element = this.element, children = [];
4398
+ forEach(properties, function(p) {
4289
4399
  var value = element.get(p.name), isReference = p.isReference, isMany = p.isMany;
4290
4400
  if (!isMany) {
4291
4401
  value = [value];
4292
4402
  }
4293
4403
  if (p.isBody) {
4294
- body.push(new BodySerializer().build(p, value[0]));
4404
+ children.push({
4405
+ create: function() {
4406
+ return new BodySerializer().build(p, value[0]);
4407
+ }
4408
+ });
4295
4409
  } else if (isSimple(p.type)) {
4296
- forEach2(value, function(v) {
4297
- body.push(new ValueSerializer(self.addTagName(self.nsPropertyTagName(p))).build(p, v));
4410
+ forEach(value, function(v) {
4411
+ children.push({
4412
+ create: function() {
4413
+ return new ValueSerializer(self.addTagName(self.nsPropertyTagName(p))).build(p, v);
4414
+ }
4415
+ });
4298
4416
  });
4299
4417
  } else if (isReference) {
4300
- forEach2(value, function(v) {
4301
- body.push(new ReferenceSerializer(self.addTagName(self.nsPropertyTagName(p))).build(v));
4418
+ forEach(value, function(v) {
4419
+ children.push({
4420
+ create: function() {
4421
+ return new ReferenceSerializer(self.addTagName(self.nsPropertyTagName(p))).build(v);
4422
+ }
4423
+ });
4302
4424
  });
4303
4425
  } else {
4304
4426
  var serialization = getSerialization(p);
4305
- forEach2(value, function(v) {
4306
- var serializer;
4307
- if (serialization) {
4308
- if (serialization === SERIALIZE_PROPERTY) {
4309
- serializer = new ElementSerializer(self, p);
4310
- } else {
4311
- serializer = new TypeSerializer(self, p, serialization);
4312
- }
4313
- } else {
4314
- serializer = new ElementSerializer(self);
4315
- }
4316
- body.push(serializer.build(v));
4427
+ forEach(value, function(v) {
4428
+ children.push({
4429
+ create: function() {
4430
+ if (serialization) {
4431
+ if (serialization === SERIALIZE_PROPERTY) {
4432
+ return new ElementSerializer(self, p);
4433
+ }
4434
+ return new TypeSerializer(self, p, serialization);
4435
+ }
4436
+ return new ElementSerializer(self);
4437
+ },
4438
+ element: v
4439
+ });
4317
4440
  });
4318
4441
  }
4319
4442
  });
4443
+ return children;
4320
4444
  };
4321
4445
  ElementSerializer.prototype.getNamespaces = function(local) {
4322
- var namespaces = this.namespaces, parent = this.parent, parentNamespaces;
4446
+ var namespaces = this.namespaces;
4323
4447
  if (!namespaces) {
4324
- parentNamespaces = parent && parent.getNamespaces();
4448
+ var parentNamespaces = this.getParentNamespaces();
4325
4449
  if (local || !parentNamespaces) {
4326
4450
  this.namespaces = namespaces = new Namespaces(parentNamespaces);
4327
4451
  } else {
@@ -4330,6 +4454,24 @@ var init_dist3 = __esm({
4330
4454
  }
4331
4455
  return namespaces;
4332
4456
  };
4457
+ ElementSerializer.prototype.getParentNamespaces = function() {
4458
+ if (this.parentNamespaces !== void 0) {
4459
+ return this.parentNamespaces;
4460
+ }
4461
+ var scope = null, ancestor = this.parent;
4462
+ while (ancestor) {
4463
+ if (ancestor.namespaces) {
4464
+ scope = ancestor.namespaces;
4465
+ break;
4466
+ }
4467
+ if (ancestor.parentNamespaces !== void 0) {
4468
+ scope = ancestor.parentNamespaces;
4469
+ break;
4470
+ }
4471
+ ancestor = ancestor.parent;
4472
+ }
4473
+ return this.parentNamespaces = scope;
4474
+ };
4333
4475
  ElementSerializer.prototype.logNamespace = function(ns, wellknown, local) {
4334
4476
  var namespaces = this.getNamespaces(local);
4335
4477
  var nsUri = ns.uri, nsPrefix = ns.prefix;
@@ -4370,14 +4512,14 @@ var init_dist3 = __esm({
4370
4512
  };
4371
4513
  ElementSerializer.prototype.parseAttributes = function(properties) {
4372
4514
  var self = this, element = this.element;
4373
- forEach2(properties, function(p) {
4515
+ forEach(properties, function(p) {
4374
4516
  var value = element.get(p.name);
4375
4517
  if (p.isReference) {
4376
4518
  if (!p.isMany) {
4377
4519
  value = value.id;
4378
4520
  } else {
4379
4521
  var values = [];
4380
- forEach2(value, function(v) {
4522
+ forEach(value, function(v) {
4381
4523
  values.push(v.id);
4382
4524
  });
4383
4525
  value = values.join(" ");
@@ -4393,7 +4535,7 @@ var init_dist3 = __esm({
4393
4535
  };
4394
4536
  ElementSerializer.prototype.addAttribute = function(name2, value) {
4395
4537
  var attrs = this.attrs;
4396
- if (isString3(value)) {
4538
+ if (isString(value)) {
4397
4539
  value = escapeAttr(value);
4398
4540
  }
4399
4541
  var idx = findIndex(attrs, function(element) {
@@ -4411,28 +4553,12 @@ var init_dist3 = __esm({
4411
4553
  if (namespaces) {
4412
4554
  attrs = getNsAttrs(namespaces).concat(attrs);
4413
4555
  }
4414
- forEach2(attrs, function(a) {
4556
+ forEach(attrs, function(a) {
4415
4557
  writer.append(" ").append(nsName(a.name)).append('="').append(a.value).append('"');
4416
4558
  });
4417
4559
  };
4418
4560
  ElementSerializer.prototype.serializeTo = function(writer) {
4419
- var firstBody = this.body[0], indent = firstBody && firstBody.constructor !== BodySerializer;
4420
- writer.appendIndent().append("<" + this.tagName);
4421
- this.serializeAttributes(writer);
4422
- writer.append(firstBody ? ">" : " />");
4423
- if (firstBody) {
4424
- if (indent) {
4425
- writer.appendNewLine().indent();
4426
- }
4427
- forEach2(this.body, function(b) {
4428
- b.serializeTo(writer);
4429
- });
4430
- if (indent) {
4431
- writer.unindent().appendIndent();
4432
- }
4433
- writer.append("</" + this.tagName + ">");
4434
- }
4435
- writer.appendNewLine();
4561
+ serializeTree(this, writer);
4436
4562
  };
4437
4563
  inherits(TypeSerializer, ElementSerializer);
4438
4564
  TypeSerializer.prototype.parseNsAttributes = function(element) {
@@ -4461,7 +4587,7 @@ var init_dist3 = __esm({
4461
4587
  // node_modules/bpmn-moddle/dist/index.js
4462
4588
  var dist_exports = {};
4463
4589
  __export(dist_exports, {
4464
- default: () => SimpleBpmnModdle
4590
+ BpmnModdle: () => SimpleBpmnModdle
4465
4591
  });
4466
4592
  function BpmnModdle(packages2, options) {
4467
4593
  Moddle.call(this, packages2, options);
@@ -4471,11 +4597,11 @@ function SimpleBpmnModdle(additionalPackages, options) {
4471
4597
  return new BpmnModdle(pks, options);
4472
4598
  }
4473
4599
  var name$5, uri$5, prefix$5, associations$5, types$5, enumerations$3, xml$1, BpmnPackage, name$4, uri$4, prefix$4, types$4, enumerations$2, associations$4, BpmnDiPackage, name$3, uri$3, prefix$3, types$3, associations$3, DcPackage, name$2, uri$2, prefix$2, types$2, associations$2, xml, DiPackage, name$1, uri$1, prefix$1, types$1, enumerations$1, associations$1, BiocPackage, name, uri, prefix, types, enumerations, associations, BpmnInColorPackage, packages;
4474
- var init_dist4 = __esm({
4600
+ var init_dist5 = __esm({
4475
4601
  "node_modules/bpmn-moddle/dist/index.js"() {
4476
- init_index_esm();
4477
4602
  init_dist();
4478
- init_dist3();
4603
+ init_dist2();
4604
+ init_dist4();
4479
4605
  BpmnModdle.prototype = Object.create(Moddle.prototype);
4480
4606
  BpmnModdle.prototype.fromXML = function(xmlStr, typeName, options) {
4481
4607
  if (!isString(typeName)) {
@@ -9247,7 +9373,7 @@ Template URLs must use HTTPS to protect credentials and content integrity.`
9247
9373
  };
9248
9374
  }
9249
9375
  async function getExecutionPlatformVersion(xml2) {
9250
- const BpmnModdle2 = (await Promise.resolve().then(() => (init_dist4(), dist_exports))).default;
9376
+ const { BpmnModdle: BpmnModdle2 } = await Promise.resolve().then(() => (init_dist5(), dist_exports));
9251
9377
  const moddle = new BpmnModdle2();
9252
9378
  try {
9253
9379
  const { rootElement } = await moddle.fromXML(xml2);
@@ -9280,7 +9406,7 @@ function containsId(node, id, seen) {
9280
9406
  return false;
9281
9407
  }
9282
9408
  async function elementExistsInBpmn(xml2, elementId) {
9283
- const BpmnModdle2 = (await Promise.resolve().then(() => (init_dist4(), dist_exports))).default;
9409
+ const { BpmnModdle: BpmnModdle2 } = await Promise.resolve().then(() => (init_dist5(), dist_exports));
9284
9410
  const moddle = new BpmnModdle2();
9285
9411
  const { rootElement } = await moddle.fromXML(xml2);
9286
9412
  return containsId(rootElement, elementId, /* @__PURE__ */ new Set());