@rive-app/webgl2 2.26.6 → 2.26.8

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/rive.js CHANGED
@@ -205,8 +205,8 @@ k.onRuntimeInitialized = function() {
205
205
  A.call(this);
206
206
  var H = this.Ka;
207
207
  r === w[H] && (r = null);
208
- "object" == typeof JSEvents && JSEvents.Oc(w[H].D.canvas);
209
- w[H] && w[H].D.canvas && (w[H].D.canvas.zb = void 0);
208
+ "object" == typeof JSEvents && JSEvents.Oc(w[H].C.canvas);
209
+ w[H] && w[H].C.canvas && (w[H].C.canvas.zb = void 0);
210
210
  this.Ka = this.F = this.La = this.T = w[H] = null;
211
211
  };
212
212
  return z;
@@ -215,7 +215,7 @@ k.onRuntimeInitialized = function() {
215
215
  if (d) {
216
216
  var q = d.Cb, u = 0, y = 0, z = 0, A = Array(e.size), H = 0;
217
217
  for (var I of e) {
218
- I.fa = Math.min(I.F.width, q), I.ea = Math.min(I.F.height, q), I.Ia = I.ea * I.fa, u = Math.max(u, I.fa), y = Math.max(y, I.ea), z += I.Ia, A[H++] = I;
218
+ I.ga = Math.min(I.F.width, q), I.fa = Math.min(I.F.height, q), I.Ia = I.fa * I.ga, u = Math.max(u, I.ga), y = Math.max(y, I.fa), z += I.Ia, A[H++] = I;
219
219
  }
220
220
  e.clear();
221
221
  if (!(0 >= z)) {
@@ -225,12 +225,12 @@ k.onRuntimeInitialized = function() {
225
225
  }
226
226
  u = Math.min(u, q);
227
227
  u = Math.min(y, q);
228
- A.sort((ba, sb) => sb.Ia - ba.Ia);
228
+ A.sort((ba, tb) => tb.Ia - ba.Ia);
229
229
  z = new k.DynamicRectanizer(q);
230
230
  for (I = 0; I < A.length;) {
231
231
  z.reset(u, y);
232
232
  for (H = I; H < A.length; ++H) {
233
- var L = A[H], E = z.addRect(L.fa, L.ea);
233
+ var L = A[H], E = z.addRect(L.ga, L.fa);
234
234
  if (0 > E) {
235
235
  console.assert(H > I);
236
236
  break;
@@ -249,22 +249,22 @@ k.onRuntimeInitialized = function() {
249
249
  d.clear();
250
250
  for (L = I; L < H; ++L) {
251
251
  E = A[L];
252
- d.saveClipRect(E.ra, E.sa, E.ra + E.fa, E.sa + E.ea);
252
+ d.saveClipRect(E.ra, E.sa, E.ra + E.ga, E.sa + E.fa);
253
253
  let ba = new k.Mat2D();
254
- ba.xx = E.fa / E.F.width;
255
- ba.yy = E.ea / E.F.height;
254
+ ba.xx = E.ga / E.F.width;
255
+ ba.yy = E.fa / E.F.height;
256
256
  ba.xy = ba.yx = 0;
257
257
  ba.tx = E.ra;
258
258
  ba.ty = E.sa;
259
259
  d.transform(ba);
260
- for (const sb of E.S) {
261
- sb();
260
+ for (const tb of E.S) {
261
+ tb();
262
262
  }
263
263
  d.restoreClipRect();
264
264
  E.S = [];
265
265
  }
266
266
  for (d.flush(); I < H; ++I) {
267
- L = A[I], E = L.Ab, E.globalCompositeOperation = "copy", E.drawImage(d.F, L.ra, L.sa, L.fa, L.ea, 0, 0, L.F.width, L.F.height);
267
+ L = A[I], E = L.Ab, E.globalCompositeOperation = "copy", E.drawImage(d.F, L.ra, L.sa, L.ga, L.fa, 0, 0, L.F.width, L.F.height);
268
268
  }
269
269
  I = H;
270
270
  }
@@ -442,7 +442,7 @@ function Oa(a, b) {
442
442
  return Na(c, a, b);
443
443
  }));
444
444
  }
445
- var Pa, Qa, Ua = {510110:(a, b, c, d, e) => {
445
+ var Pa, Qa, Ua = {510895:(a, b, c, d, e) => {
446
446
  if ("undefined" === typeof window || void 0 === (window.AudioContext || window.webkitAudioContext)) {
447
447
  return 0;
448
448
  }
@@ -452,44 +452,44 @@ var Pa, Qa, Ua = {510110:(a, b, c, d, e) => {
452
452
  window.h.I.Ba = a;
453
453
  window.h.I.capture = b;
454
454
  window.h.I.Na = c;
455
- window.h.ia = {};
456
- window.h.ia.stopped = d;
457
- window.h.ia.tb = e;
455
+ window.h.ja = {};
456
+ window.h.ja.stopped = d;
457
+ window.h.ja.tb = e;
458
458
  let f = window.h;
459
- f.C = [];
459
+ f.D = [];
460
460
  f.oc = function(g) {
461
- for (var l = 0; l < f.C.length; ++l) {
462
- if (null == f.C[l]) {
463
- return f.C[l] = g, l;
461
+ for (var l = 0; l < f.D.length; ++l) {
462
+ if (null == f.D[l]) {
463
+ return f.D[l] = g, l;
464
464
  }
465
465
  }
466
- f.C.push(g);
467
- return f.C.length - 1;
466
+ f.D.push(g);
467
+ return f.D.length - 1;
468
468
  };
469
469
  f.yb = function(g) {
470
- for (f.C[g] = null; 0 < f.C.length;) {
471
- if (null == f.C[f.C.length - 1]) {
472
- f.C.pop();
470
+ for (f.D[g] = null; 0 < f.D.length;) {
471
+ if (null == f.D[f.D.length - 1]) {
472
+ f.D.pop();
473
473
  } else {
474
474
  break;
475
475
  }
476
476
  }
477
477
  };
478
478
  f.Qc = function(g) {
479
- for (var l = 0; l < f.C.length; ++l) {
480
- if (f.C[l] == g) {
479
+ for (var l = 0; l < f.D.length; ++l) {
480
+ if (f.D[l] == g) {
481
481
  return f.yb(l);
482
482
  }
483
483
  }
484
484
  };
485
485
  f.va = function(g) {
486
- return f.C[g];
486
+ return f.D[g];
487
487
  };
488
488
  f.xb = ["touchend", "click"];
489
489
  f.unlock = function() {
490
- for (var g = 0; g < f.C.length; ++g) {
491
- var l = f.C[g];
492
- null != l && null != l.J && l.state === f.ia.tb && l.J.resume().then(() => {
490
+ for (var g = 0; g < f.D.length; ++g) {
491
+ var l = f.D[g];
492
+ null != l && null != l.J && l.state === f.ja.tb && l.J.resume().then(() => {
493
493
  Ra(l.lb);
494
494
  }, p => {
495
495
  console.error("Failed to resume audiocontext", p);
@@ -505,9 +505,9 @@ var Pa, Qa, Ua = {510110:(a, b, c, d, e) => {
505
505
  }
506
506
  window.h.Da += 1;
507
507
  return 1;
508
- }, 512288:() => {
508
+ }, 513073:() => {
509
509
  "undefined" !== typeof window.h && (--window.h.Da, 0 === window.h.Da && delete window.h);
510
- }, 512452:() => void 0 !== navigator.mediaDevices && void 0 !== navigator.mediaDevices.getUserMedia, 512556:() => {
510
+ }, 513237:() => void 0 !== navigator.mediaDevices && void 0 !== navigator.mediaDevices.getUserMedia, 513341:() => {
511
511
  try {
512
512
  var a = new (window.AudioContext || window.webkitAudioContext)(), b = a.sampleRate;
513
513
  a.close();
@@ -515,7 +515,7 @@ var Pa, Qa, Ua = {510110:(a, b, c, d, e) => {
515
515
  } catch (c) {
516
516
  return 0;
517
517
  }
518
- }, 512727:(a, b, c, d, e, f) => {
518
+ }, 513512:(a, b, c, d, e, f) => {
519
519
  if ("undefined" === typeof window.h) {
520
520
  return -1;
521
521
  }
@@ -523,7 +523,7 @@ var Pa, Qa, Ua = {510110:(a, b, c, d, e) => {
523
523
  a == window.h.I.Ba && 0 != c && (l.sampleRate = c);
524
524
  g.J = new (window.AudioContext || window.webkitAudioContext)(l);
525
525
  g.J.suspend();
526
- g.state = window.h.ia.stopped;
526
+ g.state = window.h.ja.stopped;
527
527
  c = 0;
528
528
  a != window.h.I.Ba && (c = b);
529
529
  g.Z = g.J.createScriptProcessor(d, c, b);
@@ -561,7 +561,7 @@ var Pa, Qa, Ua = {510110:(a, b, c, d, e) => {
561
561
  a == window.h.I.Ba && g.Z.connect(g.J.destination);
562
562
  g.lb = f;
563
563
  return window.h.oc(g);
564
- }, 515604:a => window.h.va(a).J.sampleRate, 515677:a => {
564
+ }, 516389:a => window.h.va(a).J.sampleRate, 516462:a => {
565
565
  a = window.h.va(a);
566
566
  void 0 !== a.Z && (a.Z.onaudioprocess = function() {
567
567
  }, a.Z.disconnect(), a.Z = void 0);
@@ -569,16 +569,16 @@ var Pa, Qa, Ua = {510110:(a, b, c, d, e) => {
569
569
  a.J.close();
570
570
  a.J = void 0;
571
571
  a.lb = void 0;
572
- }, 516077:a => {
572
+ }, 516862:a => {
573
573
  window.h.yb(a);
574
- }, 516127:a => {
574
+ }, 516912:a => {
575
575
  a = window.h.va(a);
576
576
  a.J.resume();
577
- a.state = window.h.ia.tb;
578
- }, 516266:a => {
577
+ a.state = window.h.ja.tb;
578
+ }, 517051:a => {
579
579
  a = window.h.va(a);
580
580
  a.J.suspend();
581
- a.state = window.h.ia.stopped;
581
+ a.state = window.h.ja.stopped;
582
582
  }}, Va = a => {
583
583
  for (; 0 < a.length;) {
584
584
  a.shift()(k);
@@ -965,7 +965,7 @@ var O = {O:null, U() {
965
965
  O.m.write(a, b, 0, d, c, !1);
966
966
  return 0;
967
967
  },},};
968
- function tb(a, b) {
968
+ function sb(a, b) {
969
969
  var c = 0;
970
970
  a && (c |= 365);
971
971
  b && (c |= 146);
@@ -1244,7 +1244,7 @@ var ub = null, vb = {}, wb = [], xb = 1, yb = null, zb = !0, N = null, qb = {},
1244
1244
  }));
1245
1245
  }, Tb, Vb = (a, b, c) => {
1246
1246
  a = Xa("/dev/" + a);
1247
- var d = tb(!!b, !!c);
1247
+ var d = sb(!!b, !!c);
1248
1248
  Ub || (Ub = 64);
1249
1249
  var e = Ub++ << 8 | 0;
1250
1250
  jb(e, {open:f => {
@@ -1350,7 +1350,7 @@ var fc = [];
1350
1350
  function gc() {
1351
1351
  for (; fc.length;) {
1352
1352
  var a = fc.pop();
1353
- a.g.ha = !1;
1353
+ a.g.ia = !1;
1354
1354
  a["delete"]();
1355
1355
  }
1356
1356
  }
@@ -1500,7 +1500,7 @@ function Ic(a, b, c) {
1500
1500
  return a[b].B[arguments.length].apply(this, arguments);
1501
1501
  };
1502
1502
  a[b].B = [];
1503
- a[b].B[d.ga] = d;
1503
+ a[b].B[d.ha] = d;
1504
1504
  }
1505
1505
  }
1506
1506
  function Jc(a, b, c) {
@@ -1590,7 +1590,7 @@ function Qc(a, b, c, d) {
1590
1590
  }
1591
1591
  function Rc(a, b, c) {
1592
1592
  k.hasOwnProperty(a) || wc("Replacing nonexistant public symbol");
1593
- void 0 !== k[a].B && void 0 !== c ? k[a].B[c] = b : (k[a] = b, k[a].ga = c);
1593
+ void 0 !== k[a].B && void 0 !== c ? k[a].B[c] = b : (k[a] = b, k[a].ha = c);
1594
1594
  }
1595
1595
  var Sc = [], Tc = a => {
1596
1596
  var b = Sc[a];
@@ -1843,7 +1843,7 @@ function Ed(a) {
1843
1843
  return b;
1844
1844
  }
1845
1845
  function ia(a, b) {
1846
- var c = Ed(w), d = {handle:c, attributes:b, version:b.Ec, D:a};
1846
+ var c = Ed(w), d = {handle:c, attributes:b, version:b.Ec, C:a};
1847
1847
  a.canvas && (a.canvas.zb = d);
1848
1848
  w[c] = d;
1849
1849
  ("undefined" == typeof b.Kb || b.Kb) && Fd(d);
@@ -1851,14 +1851,14 @@ function ia(a, b) {
1851
1851
  }
1852
1852
  function ja(a) {
1853
1853
  r = w[a];
1854
- k.yc = Z = r && r.D;
1854
+ k.yc = Z = r && r.C;
1855
1855
  return !(a && !Z);
1856
1856
  }
1857
1857
  function Fd(a) {
1858
1858
  a || (a = r);
1859
1859
  if (!a.Vb) {
1860
1860
  a.Vb = !0;
1861
- var b = a.D;
1861
+ var b = a.C;
1862
1862
  sd(b);
1863
1863
  td(b);
1864
1864
  2 <= a.version && (b.$a = b.getExtension("EXT_disjoint_timer_query_webgl2"));
@@ -2039,8 +2039,8 @@ var Qd = a => 0 === a % 4 && (0 !== a % 100 || 0 === a % 400), Rd = [31, 29, 31,
2039
2039
  }
2040
2040
  }
2041
2041
  function p(n) {
2042
- var q = n.ca;
2043
- for (n = new Date((new Date(n.da + 1900, 0, 1)).getTime()); 0 < q;) {
2042
+ var q = n.da;
2043
+ for (n = new Date((new Date(n.ea + 1900, 0, 1)).getTime()); 0 < q;) {
2044
2044
  var u = n.getMonth(), y = (Qd(n.getFullYear()) ? Rd : Sd)[u];
2045
2045
  if (q > y - n.getDate()) {
2046
2046
  q -= y - n.getDate() + 1, n.setDate(1), 11 > u ? n.setMonth(u + 1) : (n.setMonth(0), n.setFullYear(n.getFullYear() + 1));
@@ -2055,33 +2055,33 @@ var Qd = a => 0 === a % 4 && (0 !== a % 100 || 0 === a % 400), Rd = [31, 29, 31,
2055
2055
  return 0 >= g(q, n) ? 0 >= g(u, n) ? n.getFullYear() + 1 : n.getFullYear() : n.getFullYear() - 1;
2056
2056
  }
2057
2057
  var m = J[d + 40 >> 2];
2058
- d = {mc:J[d >> 2], lc:J[d + 4 >> 2], Ga:J[d + 8 >> 2], Ta:J[d + 12 >> 2], Ha:J[d + 16 >> 2], da:J[d + 20 >> 2], R:J[d + 24 >> 2], ca:J[d + 28 >> 2], Pc:J[d + 32 >> 2], kc:J[d + 36 >> 2], nc:m ? m ? M(F, m) : "" : ""};
2058
+ d = {mc:J[d >> 2], lc:J[d + 4 >> 2], Ga:J[d + 8 >> 2], Ta:J[d + 12 >> 2], Ha:J[d + 16 >> 2], ea:J[d + 20 >> 2], R:J[d + 24 >> 2], da:J[d + 28 >> 2], Pc:J[d + 32 >> 2], kc:J[d + 36 >> 2], nc:m ? m ? M(F, m) : "" : ""};
2059
2059
  c = c ? M(F, c) : "";
2060
2060
  m = {"%c":"%a %b %d %H:%M:%S %Y", "%D":"%m/%d/%y", "%F":"%Y-%m-%d", "%h":"%b", "%r":"%I:%M:%S %p", "%R":"%H:%M", "%T":"%H:%M:%S", "%x":"%m/%d/%y", "%X":"%H:%M:%S", "%Ec":"%c", "%EC":"%C", "%Ex":"%m/%d/%y", "%EX":"%H:%M:%S", "%Ey":"%y", "%EY":"%Y", "%Od":"%d", "%Oe":"%e", "%OH":"%H", "%OI":"%I", "%Om":"%m", "%OM":"%M", "%OS":"%S", "%Ou":"%u", "%OU":"%U", "%OV":"%V", "%Ow":"%w", "%OW":"%W", "%Oy":"%y",};
2061
2061
  for (var t in m) {
2062
2062
  c = c.replace(new RegExp(t, "g"), m[t]);
2063
2063
  }
2064
2064
  var v = "Sunday Monday Tuesday Wednesday Thursday Friday Saturday".split(" "), x = "January February March April May June July August September October November December".split(" ");
2065
- m = {"%a":n => v[n.R].substring(0, 3), "%A":n => v[n.R], "%b":n => x[n.Ha].substring(0, 3), "%B":n => x[n.Ha], "%C":n => f((n.da + 1900) / 100 | 0, 2), "%d":n => f(n.Ta, 2), "%e":n => e(n.Ta, 2, " "), "%g":n => p(n).toString().substring(2), "%G":n => p(n), "%H":n => f(n.Ga, 2), "%I":n => {
2065
+ m = {"%a":n => v[n.R].substring(0, 3), "%A":n => v[n.R], "%b":n => x[n.Ha].substring(0, 3), "%B":n => x[n.Ha], "%C":n => f((n.ea + 1900) / 100 | 0, 2), "%d":n => f(n.Ta, 2), "%e":n => e(n.Ta, 2, " "), "%g":n => p(n).toString().substring(2), "%G":n => p(n), "%H":n => f(n.Ga, 2), "%I":n => {
2066
2066
  n = n.Ga;
2067
2067
  0 == n ? n = 12 : 12 < n && (n -= 12);
2068
2068
  return f(n, 2);
2069
2069
  }, "%j":n => {
2070
- for (var q = 0, u = 0; u <= n.Ha - 1; q += (Qd(n.da + 1900) ? Rd : Sd)[u++]) {
2070
+ for (var q = 0, u = 0; u <= n.Ha - 1; q += (Qd(n.ea + 1900) ? Rd : Sd)[u++]) {
2071
2071
  }
2072
2072
  return f(n.Ta + q, 3);
2073
- }, "%m":n => f(n.Ha + 1, 2), "%M":n => f(n.lc, 2), "%n":() => "\n", "%p":n => 0 <= n.Ga && 12 > n.Ga ? "AM" : "PM", "%S":n => f(n.mc, 2), "%t":() => "\t", "%u":n => n.R || 7, "%U":n => f(Math.floor((n.ca + 7 - n.R) / 7), 2), "%V":n => {
2074
- var q = Math.floor((n.ca + 7 - (n.R + 6) % 7) / 7);
2075
- 2 >= (n.R + 371 - n.ca - 2) % 7 && q++;
2073
+ }, "%m":n => f(n.Ha + 1, 2), "%M":n => f(n.lc, 2), "%n":() => "\n", "%p":n => 0 <= n.Ga && 12 > n.Ga ? "AM" : "PM", "%S":n => f(n.mc, 2), "%t":() => "\t", "%u":n => n.R || 7, "%U":n => f(Math.floor((n.da + 7 - n.R) / 7), 2), "%V":n => {
2074
+ var q = Math.floor((n.da + 7 - (n.R + 6) % 7) / 7);
2075
+ 2 >= (n.R + 371 - n.da - 2) % 7 && q++;
2076
2076
  if (q) {
2077
- 53 == q && (u = (n.R + 371 - n.ca) % 7, 4 == u || 3 == u && Qd(n.da) || (q = 1));
2077
+ 53 == q && (u = (n.R + 371 - n.da) % 7, 4 == u || 3 == u && Qd(n.ea) || (q = 1));
2078
2078
  } else {
2079
2079
  q = 52;
2080
- var u = (n.R + 7 - n.ca - 1) % 7;
2081
- (4 == u || 5 == u && Qd(n.da % 400 - 1)) && q++;
2080
+ var u = (n.R + 7 - n.da - 1) % 7;
2081
+ (4 == u || 5 == u && Qd(n.ea % 400 - 1)) && q++;
2082
2082
  }
2083
2083
  return f(q, 2);
2084
- }, "%w":n => n.R, "%W":n => f(Math.floor((n.ca + 7 - (n.R + 6) % 7) / 7), 2), "%y":n => (n.da + 1900).toString().substring(2), "%Y":n => n.da + 1900, "%z":n => {
2084
+ }, "%w":n => n.R, "%W":n => f(Math.floor((n.da + 7 - (n.R + 6) % 7) / 7), 2), "%y":n => (n.ea + 1900).toString().substring(2), "%Y":n => n.ea + 1900, "%z":n => {
2085
2085
  n = n.kc;
2086
2086
  var q = 0 <= n;
2087
2087
  n = Math.abs(n) / 60;
@@ -2228,14 +2228,14 @@ Hc.prototype.clone = function() {
2228
2228
  return this.g.count.value += 1, this;
2229
2229
  }
2230
2230
  var a = yc, b = Object, c = b.create, d = Object.getPrototypeOf(this), e = this.g;
2231
- a = a(c.call(b, d, {g:{value:{count:e.count, ha:e.ha, ka:e.ka, o:e.o, u:e.u, H:e.H, L:e.L,},}}));
2231
+ a = a(c.call(b, d, {g:{value:{count:e.count, ia:e.ia, ka:e.ka, o:e.o, u:e.u, H:e.H, L:e.L,},}}));
2232
2232
  a.g.count.value += 1;
2233
- a.g.ha = !1;
2233
+ a.g.ia = !1;
2234
2234
  return a;
2235
2235
  };
2236
2236
  Hc.prototype["delete"] = function() {
2237
2237
  this.g.o || Gc(this);
2238
- this.g.ha && !this.g.ka && R("Object already scheduled for deletion");
2238
+ this.g.ia && !this.g.ka && R("Object already scheduled for deletion");
2239
2239
  pc(this);
2240
2240
  rc(this.g);
2241
2241
  this.g.ka || (this.g.H = void 0, this.g.o = void 0);
@@ -2245,10 +2245,10 @@ Hc.prototype.isDeleted = function() {
2245
2245
  };
2246
2246
  Hc.prototype.deleteLater = function() {
2247
2247
  this.g.o || Gc(this);
2248
- this.g.ha && !this.g.ka && R("Object already scheduled for deletion");
2248
+ this.g.ia && !this.g.ka && R("Object already scheduled for deletion");
2249
2249
  fc.push(this);
2250
2250
  1 === fc.length && hc && hc(gc);
2251
- this.g.ha = !0;
2251
+ this.g.ia = !0;
2252
2252
  return this;
2253
2253
  };
2254
2254
  Qc.prototype.Pb = function(a) {
@@ -2571,10 +2571,10 @@ var Yd = {__syscall_fcntl64:function(a, b, c) {
2571
2571
  var t = `${p.name}.${b}`;
2572
2572
  b.startsWith("@@") && (b = Symbol[b.substring(2)]);
2573
2573
  var v = p.i.constructor;
2574
- void 0 === v[b] ? (m.ga = c - 1, v[b] = m) : (Ic(v, b, t), v[b].B[c - 1] = m);
2574
+ void 0 === v[b] ? (m.ha = c - 1, v[b] = m) : (Ic(v, b, t), v[b].B[c - 1] = m);
2575
2575
  V([], l, function(x) {
2576
2576
  x = Xc(t, [x[0], null].concat(x.slice(1)), null, f, g);
2577
- void 0 === v[b].B ? (x.ga = c - 1, v[b] = x) : v[b].B[c - 1] = x;
2577
+ void 0 === v[b].B ? (x.ha = c - 1, v[b] = x) : v[b].B[c - 1] = x;
2578
2578
  if (p.i.qa) {
2579
2579
  for (const n of p.i.qa) {
2580
2580
  n.constructor.hasOwnProperty(b) || (n.constructor[b] = x);
@@ -2646,10 +2646,10 @@ var Yd = {__syscall_fcntl64:function(a, b, c) {
2646
2646
  b.startsWith("@@") && (b = Symbol[b.substring(2)]);
2647
2647
  l && m.i.mb.push(b);
2648
2648
  var x = m.i.N, n = x[b];
2649
- void 0 === n || void 0 === n.B && n.className !== m.name && n.ga === c - 2 ? (t.ga = c - 2, t.className = m.name, x[b] = t) : (Ic(x, b, v), x[b].B[c - 2] = t);
2649
+ void 0 === n || void 0 === n.B && n.className !== m.name && n.ha === c - 2 ? (t.ha = c - 2, t.className = m.name, x[b] = t) : (Ic(x, b, v), x[b].B[c - 2] = t);
2650
2650
  V([], p, function(q) {
2651
2651
  q = Xc(v, q, m, f, g);
2652
- void 0 === x[b].B ? (q.ga = c - 2, x[b] = q) : x[b].B[c - 2] = q;
2652
+ void 0 === x[b].B ? (q.ha = c - 2, x[b] = q) : x[b].B[c - 2] = q;
2653
2653
  return [];
2654
2654
  });
2655
2655
  return [];
@@ -2921,7 +2921,7 @@ var Yd = {__syscall_fcntl64:function(a, b, c) {
2921
2921
  }, abort:() => {
2922
2922
  ta("");
2923
2923
  }, beginPixelLocalStorageWEBGL:function(a, b, c) {
2924
- (a = w[a].D.ja) && a.beginPixelLocalStorageWEBGL(k.HEAPU32.subarray(c, c + b));
2924
+ (a = w[a].C.ca) && a.beginPixelLocalStorageWEBGL(k.HEAPU32.subarray(c, c + b));
2925
2925
  }, decode_image:function(a, b, c) {
2926
2926
  var d = k.images;
2927
2927
  d || (d = new Map(), k.images = d);
@@ -2980,21 +2980,21 @@ var Yd = {__syscall_fcntl64:function(a, b, c) {
2980
2980
  "WEBGL_draw_instanced_base_vertex_base_instance" == b && sd(Z);
2981
2981
  "WEBGL_multi_draw_instanced_base_vertex_base_instance" == b && td(Z);
2982
2982
  "WEBGL_multi_draw" == b && Gd(Z);
2983
- return !!a.D.getExtension(b);
2983
+ return !!a.C.getExtension(b);
2984
2984
  }, emscripten_webgl_get_current_context:function() {
2985
2985
  return r ? r.handle : 0;
2986
2986
  }, emscripten_webgl_make_context_current:function(a) {
2987
2987
  return ja(a) ? 0 : -5;
2988
2988
  }, enable_WEBGL_provoking_vertex:function(a) {
2989
- a = w[a].D;
2989
+ a = w[a].C;
2990
2990
  a.nb = a.getExtension("WEBGL_provoking_vertex");
2991
2991
  return !!a.nb;
2992
2992
  }, enable_WEBGL_shader_pixel_local_storage_coherent:function(a) {
2993
- a = w[a].D;
2994
- a.ja = a.getExtension("WEBGL_shader_pixel_local_storage");
2995
- return !(!a.ja || !a.ja.isCoherent());
2993
+ a = w[a].C;
2994
+ a.ca = a.getExtension("WEBGL_shader_pixel_local_storage");
2995
+ return !(!a.ca || !a.ca.isCoherent());
2996
2996
  }, endPixelLocalStorageWEBGL:function(a, b, c) {
2997
- (a = w[a].D.ja) && a.endPixelLocalStorageWEBGL(k.HEAPU32.subarray(c, c + b));
2997
+ (a = w[a].C.ca) && a.endPixelLocalStorageWEBGL(k.HEAPU32.subarray(c, c + b));
2998
2998
  }, environ_get:(a, b) => {
2999
2999
  var c = 0;
3000
3000
  Jd().forEach(function(d, e) {
@@ -3162,9 +3162,11 @@ var Yd = {__syscall_fcntl64:function(a, b, c) {
3162
3162
  return A.aa;
3163
3163
  }
3164
3164
  }, framebufferPixelLocalClearValuefvWEBGL:function(a, b, c, d, e, f) {
3165
- (a = w[a].D.ja) && a.framebufferPixelLocalClearValuefvWEBGL(b, [c, d, e, f]);
3165
+ (a = w[a].C.ca) && a.framebufferPixelLocalClearValuefvWEBGL(b, [c, d, e, f]);
3166
3166
  }, framebufferTexturePixelLocalStorageWEBGL:function(a, b, c, d, e) {
3167
- (a = w[a].D.ja) && a.framebufferTexturePixelLocalStorageWEBGL(b, zd[c], d, e);
3167
+ (a = w[a].C.ca) && a.framebufferTexturePixelLocalStorageWEBGL(b, zd[c], d, e);
3168
+ }, getFramebufferPixelLocalStorageParameterivWEBGL:function(a, b, c) {
3169
+ return (a = w[a].C.ca) ? a.getFramebufferPixelLocalStorageParameterWEBGL(b, c) : 0;
3168
3170
  }, glActiveTexture:function(a) {
3169
3171
  Z.activeTexture(a);
3170
3172
  }, glAttachShader:function(a, b) {
@@ -3298,6 +3300,10 @@ var Yd = {__syscall_fcntl64:function(a, b, c) {
3298
3300
  Ld(a, b, "createVertexArray", Bd);
3299
3301
  }, glGenerateMipmap:function(a) {
3300
3302
  Z.generateMipmap(a);
3303
+ }, glGetError:function() {
3304
+ var a = Z.getError() || Dd;
3305
+ Dd = 0;
3306
+ return a;
3301
3307
  }, glGetIntegerv:function(a, b) {
3302
3308
  Md(a, b);
3303
3309
  }, glGetString:function(a) {
@@ -3440,10 +3446,10 @@ var Yd = {__syscall_fcntl64:function(a, b, c) {
3440
3446
  }, glViewport:function(a, b, c, d) {
3441
3447
  Z.viewport(a, b, c, d);
3442
3448
  }, provokingVertexWEBGL:function(a, b) {
3443
- (a = w[a].D.nb) && a.provokingVertexWEBGL(b);
3449
+ (a = w[a].C.nb) && a.provokingVertexWEBGL(b);
3444
3450
  }, strftime_l:(a, b, c, d) => Td(a, b, c, d), upload_image:function(a, b) {
3445
3451
  var c = k.images;
3446
- c && (b = c.get(b)) && (a = w[a].D, a.texImage2D(a.TEXTURE_2D, 0, a.RGBA, a.RGBA, a.UNSIGNED_BYTE, b));
3452
+ c && (b = c.get(b)) && (a = w[a].C, a.pixelStorei(a.UNPACK_PREMULTIPLY_ALPHA_WEBGL, !0), a.texImage2D(a.TEXTURE_2D, 0, a.RGBA, a.RGBA, a.UNSIGNED_BYTE, b), a.pixelStorei(a.UNPACK_PREMULTIPLY_ALPHA_WEBGL, !1));
3447
3453
  }};
3448
3454
  (function() {
3449
3455
  function a(c) {
@@ -3493,8 +3499,8 @@ k.dynCall_viijii = (a, b, c, d, e, f, g) => (k.dynCall_viijii = C.dynCall_viijii
3493
3499
  k.dynCall_iiiiij = (a, b, c, d, e, f, g) => (k.dynCall_iiiiij = C.dynCall_iiiiij)(a, b, c, d, e, f, g);
3494
3500
  k.dynCall_iiiiijj = (a, b, c, d, e, f, g, l, p) => (k.dynCall_iiiiijj = C.dynCall_iiiiijj)(a, b, c, d, e, f, g, l, p);
3495
3501
  k.dynCall_iiiiiijj = (a, b, c, d, e, f, g, l, p, m) => (k.dynCall_iiiiiijj = C.dynCall_iiiiiijj)(a, b, c, d, e, f, g, l, p, m);
3496
- k.___start_em_js = 507676;
3497
- k.___stop_em_js = 510110;
3502
+ k.___start_em_js = 508140;
3503
+ k.___stop_em_js = 510895;
3498
3504
  var Zd;
3499
3505
  Ha = function $d() {
3500
3506
  Zd || ae();
@@ -3554,7 +3560,7 @@ ae();
3554
3560
  /* 2 */
3555
3561
  /***/ ((module) => {
3556
3562
 
3557
- module.exports = /*#__PURE__*/JSON.parse('{"name":"@rive-app/webgl2","version":"2.26.6","description":"Rive\'s webgl2 based web api.","main":"rive.js","homepage":"https://rive.app","repository":{"type":"git","url":"https://github.com/rive-app/rive-wasm/tree/master/js"},"keywords":["rive","animation"],"author":"Rive","contributors":["Luigi Rosso <luigi@rive.app> (https://rive.app)","Maxwell Talbot <max@rive.app> (https://rive.app)","Arthur Vivian <arthur@rive.app> (https://rive.app)","Umberto Sonnino <umberto@rive.app> (https://rive.app)","Matthew Sullivan <matt.j.sullivan@gmail.com> (mailto:matt.j.sullivan@gmail.com)","Chris Dalton <chris@rive.app> (https://rive.app)"],"license":"MIT","files":["rive.js","rive.wasm","rive.js.map","rive.d.ts","rive_advanced.mjs.d.ts"],"typings":"rive.d.ts","dependencies":{},"browser":{"fs":false,"path":false}}');
3563
+ module.exports = /*#__PURE__*/JSON.parse('{"name":"@rive-app/webgl2","version":"2.26.8","description":"Rive\'s webgl2 based web api.","main":"rive.js","homepage":"https://rive.app","repository":{"type":"git","url":"https://github.com/rive-app/rive-wasm/tree/master/js"},"keywords":["rive","animation"],"author":"Rive","contributors":["Luigi Rosso <luigi@rive.app> (https://rive.app)","Maxwell Talbot <max@rive.app> (https://rive.app)","Arthur Vivian <arthur@rive.app> (https://rive.app)","Umberto Sonnino <umberto@rive.app> (https://rive.app)","Matthew Sullivan <matt.j.sullivan@gmail.com> (mailto:matt.j.sullivan@gmail.com)","Chris Dalton <chris@rive.app> (https://rive.app)"],"license":"MIT","files":["rive.js","rive.wasm","rive.js.map","rive.d.ts","rive_advanced.mjs.d.ts"],"typings":"rive.d.ts","dependencies":{},"browser":{"fs":false,"path":false}}');
3558
3564
 
3559
3565
  /***/ }),
3560
3566
  /* 3 */
@@ -4104,6 +4110,15 @@ var __generator = (undefined && undefined.__generator) || function (thisArg, bod
4104
4110
  if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
4105
4111
  }
4106
4112
  };
4113
+ var __spreadArray = (undefined && undefined.__spreadArray) || function (to, from, pack) {
4114
+ if (pack || arguments.length === 2) for (var i = 0, l = from.length, ar; i < l; i++) {
4115
+ if (ar || !(i in from)) {
4116
+ if (!ar) ar = Array.prototype.slice.call(from, 0, i);
4117
+ ar[i] = from[i];
4118
+ }
4119
+ }
4120
+ return to.concat(ar || Array.prototype.slice.call(from));
4121
+ };
4107
4122
 
4108
4123
 
4109
4124
 
@@ -5497,6 +5512,13 @@ var Rive = /** @class */ (function () {
5497
5512
  useOffscreenRenderer: params.useOffscreenRenderer,
5498
5513
  });
5499
5514
  }
5515
+ Object.defineProperty(Rive.prototype, "viewModelCount", {
5516
+ get: function () {
5517
+ return this.file.viewModelCount();
5518
+ },
5519
+ enumerable: false,
5520
+ configurable: true
5521
+ });
5500
5522
  // Alternative constructor to build a Rive instance from an interface/object
5501
5523
  Rive.new = function (params) {
5502
5524
  console.warn("This function is deprecated: please use `new Rive({})` instead");
@@ -6735,10 +6757,14 @@ var Rive = /** @class */ (function () {
6735
6757
  viewModelInstance.internalIncrementReferenceCount();
6736
6758
  (_a = this._viewModelInstance) === null || _a === void 0 ? void 0 : _a.cleanup();
6737
6759
  this._viewModelInstance = viewModelInstance;
6738
- this.artboard.bindViewModelInstance(viewModelInstance.runtimeInstance);
6739
- this.animator.stateMachines.forEach(function (stateMachine) {
6740
- return stateMachine.bindViewModelInstance(viewModelInstance);
6741
- });
6760
+ if (this.animator.stateMachines.length > 0) {
6761
+ this.animator.stateMachines.forEach(function (stateMachine) {
6762
+ return stateMachine.bindViewModelInstance(viewModelInstance);
6763
+ });
6764
+ }
6765
+ else {
6766
+ this.artboard.bindViewModelInstance(viewModelInstance.runtimeInstance);
6767
+ }
6742
6768
  }
6743
6769
  }
6744
6770
  };
@@ -6872,12 +6898,26 @@ var DataEnum = /** @class */ (function () {
6872
6898
  return DataEnum;
6873
6899
  }());
6874
6900
 
6901
+ var PropertyType;
6902
+ (function (PropertyType) {
6903
+ PropertyType["Number"] = "number";
6904
+ PropertyType["String"] = "string";
6905
+ PropertyType["Boolean"] = "boolean";
6906
+ PropertyType["Color"] = "color";
6907
+ PropertyType["Trigger"] = "trigger";
6908
+ PropertyType["Enum"] = "enum";
6909
+ })(PropertyType || (PropertyType = {}));
6875
6910
  var ViewModelInstance = /** @class */ (function () {
6876
- function ViewModelInstance(runtimeInstance, root) {
6911
+ function ViewModelInstance(runtimeInstance, parent) {
6912
+ this._parents = [];
6913
+ this._children = [];
6914
+ this._viewModelInstances = new Map();
6877
6915
  this._propertiesWithCallbacks = [];
6878
6916
  this._referenceCount = 0;
6879
6917
  this._runtimeInstance = runtimeInstance;
6880
- this._root = root || this;
6918
+ if (parent !== null) {
6919
+ this._parents.push(parent);
6920
+ }
6881
6921
  }
6882
6922
  Object.defineProperty(ViewModelInstance.prototype, "runtimeInstance", {
6883
6923
  get: function () {
@@ -6891,6 +6931,80 @@ var ViewModelInstance = /** @class */ (function () {
6891
6931
  this._propertiesWithCallbacks.forEach(function (property) {
6892
6932
  property.handleCallbacks();
6893
6933
  });
6934
+ this._propertiesWithCallbacks.forEach(function (property) {
6935
+ property.clearChanges();
6936
+ });
6937
+ }
6938
+ this._children.forEach(function (child) { return child.handleCallbacks(); });
6939
+ };
6940
+ ViewModelInstance.prototype.addParent = function (parent) {
6941
+ this._parents.push(parent);
6942
+ if (this._propertiesWithCallbacks.length > 0 || this._children.length > 0) {
6943
+ parent.addToViewModelCallbacks(this);
6944
+ }
6945
+ };
6946
+ ViewModelInstance.prototype.removeParent = function (parent) {
6947
+ var index = this._parents.indexOf(parent);
6948
+ if (index !== -1) {
6949
+ var parent_1 = this._parents[index];
6950
+ parent_1.removeFromViewModelCallbacks(this);
6951
+ this._parents.splice(index, 1);
6952
+ }
6953
+ };
6954
+ /*
6955
+ * method for internal use, it shouldn't be called externally
6956
+ */
6957
+ ViewModelInstance.prototype.addToPropertyCallbacks = function (property) {
6958
+ var _this = this;
6959
+ if (!this._propertiesWithCallbacks.includes(property)) {
6960
+ this._propertiesWithCallbacks.push(property);
6961
+ if (this._propertiesWithCallbacks.length > 0) {
6962
+ this._parents.forEach(function (parent) {
6963
+ parent.addToViewModelCallbacks(_this);
6964
+ });
6965
+ }
6966
+ }
6967
+ };
6968
+ /*
6969
+ * method for internal use, it shouldn't be called externally
6970
+ */
6971
+ ViewModelInstance.prototype.removeFromPropertyCallbacks = function (property) {
6972
+ var _this = this;
6973
+ if (this._propertiesWithCallbacks.includes(property)) {
6974
+ this._propertiesWithCallbacks = this._propertiesWithCallbacks.filter(function (prop) { return prop !== property; });
6975
+ if (this._children.length === 0 &&
6976
+ this._propertiesWithCallbacks.length === 0) {
6977
+ this._parents.forEach(function (parent) {
6978
+ parent.removeFromViewModelCallbacks(_this);
6979
+ });
6980
+ }
6981
+ }
6982
+ };
6983
+ /*
6984
+ * method for internal use, it shouldn't be called externally
6985
+ */
6986
+ ViewModelInstance.prototype.addToViewModelCallbacks = function (instance) {
6987
+ var _this = this;
6988
+ if (!this._children.includes(instance)) {
6989
+ this._children.push(instance);
6990
+ this._parents.forEach(function (parent) {
6991
+ parent.addToViewModelCallbacks(_this);
6992
+ });
6993
+ }
6994
+ };
6995
+ /*
6996
+ * method for internal use, it shouldn't be called externally
6997
+ */
6998
+ ViewModelInstance.prototype.removeFromViewModelCallbacks = function (instance) {
6999
+ var _this = this;
7000
+ if (this._children.includes(instance)) {
7001
+ this._children = this._children.filter(function (child) { return child !== instance; });
7002
+ if (this._children.length === 0 &&
7003
+ this._propertiesWithCallbacks.length === 0) {
7004
+ this._parents.forEach(function (parent) {
7005
+ parent.removeFromViewModelCallbacks(_this);
7006
+ });
7007
+ }
6894
7008
  }
6895
7009
  };
6896
7010
  ViewModelInstance.prototype.clearCallbacks = function () {
@@ -6898,97 +7012,179 @@ var ViewModelInstance = /** @class */ (function () {
6898
7012
  property.clearCallbacks();
6899
7013
  });
6900
7014
  };
7015
+ ViewModelInstance.prototype.propertyFromPath = function (path, type) {
7016
+ var pathSegments = path.split("/");
7017
+ return this.propertyFromPathSegments(pathSegments, 0, type);
7018
+ };
7019
+ ViewModelInstance.prototype.viewModelFromPathSegments = function (pathSegments, index) {
7020
+ var viewModelInstance = this.internalViewModelInstance(pathSegments[index]);
7021
+ if (viewModelInstance !== null) {
7022
+ if (index == pathSegments.length - 1) {
7023
+ return viewModelInstance;
7024
+ }
7025
+ else {
7026
+ return viewModelInstance.viewModelFromPathSegments(pathSegments, index++);
7027
+ }
7028
+ }
7029
+ return null;
7030
+ };
7031
+ ViewModelInstance.prototype.propertyFromPathSegments = function (pathSegments, index, type) {
7032
+ var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m;
7033
+ if (index < pathSegments.length - 1) {
7034
+ var viewModelInstance = this.internalViewModelInstance(pathSegments[index]);
7035
+ if (viewModelInstance !== null) {
7036
+ return viewModelInstance.propertyFromPathSegments(pathSegments, index + 1, type);
7037
+ }
7038
+ else {
7039
+ return null;
7040
+ }
7041
+ }
7042
+ var instance = null;
7043
+ switch (type) {
7044
+ case PropertyType.Number:
7045
+ instance = (_b = (_a = this._runtimeInstance) === null || _a === void 0 ? void 0 : _a.number(pathSegments[index])) !== null && _b !== void 0 ? _b : null;
7046
+ if (instance !== null) {
7047
+ return new ViewModelInstanceNumber(instance, this);
7048
+ }
7049
+ break;
7050
+ case PropertyType.String:
7051
+ instance = (_d = (_c = this._runtimeInstance) === null || _c === void 0 ? void 0 : _c.string(pathSegments[index])) !== null && _d !== void 0 ? _d : null;
7052
+ if (instance !== null) {
7053
+ return new ViewModelInstanceString(instance, this);
7054
+ }
7055
+ break;
7056
+ case PropertyType.Boolean:
7057
+ instance = (_f = (_e = this._runtimeInstance) === null || _e === void 0 ? void 0 : _e.boolean(pathSegments[index])) !== null && _f !== void 0 ? _f : null;
7058
+ if (instance !== null) {
7059
+ return new ViewModelInstanceBoolean(instance, this);
7060
+ }
7061
+ break;
7062
+ case PropertyType.Color:
7063
+ instance = (_h = (_g = this._runtimeInstance) === null || _g === void 0 ? void 0 : _g.color(pathSegments[index])) !== null && _h !== void 0 ? _h : null;
7064
+ if (instance !== null) {
7065
+ return new ViewModelInstanceColor(instance, this);
7066
+ }
7067
+ break;
7068
+ case PropertyType.Trigger:
7069
+ instance = (_k = (_j = this._runtimeInstance) === null || _j === void 0 ? void 0 : _j.trigger(pathSegments[index])) !== null && _k !== void 0 ? _k : null;
7070
+ if (instance !== null) {
7071
+ return new ViewModelInstanceTrigger(instance, this);
7072
+ }
7073
+ break;
7074
+ case PropertyType.Enum:
7075
+ instance = (_m = (_l = this._runtimeInstance) === null || _l === void 0 ? void 0 : _l.enum(pathSegments[index])) !== null && _m !== void 0 ? _m : null;
7076
+ if (instance !== null) {
7077
+ return new ViewModelInstanceEnum(instance, this);
7078
+ }
7079
+ break;
7080
+ }
7081
+ return null;
7082
+ };
7083
+ ViewModelInstance.prototype.internalViewModelInstance = function (name) {
7084
+ var _a;
7085
+ if (this._viewModelInstances.has(name)) {
7086
+ return this._viewModelInstances.get(name);
7087
+ }
7088
+ var viewModelRuntimeInstance = (_a = this._runtimeInstance) === null || _a === void 0 ? void 0 : _a.viewModel(name);
7089
+ if (viewModelRuntimeInstance !== null) {
7090
+ var viewModelInstance = new ViewModelInstance(viewModelRuntimeInstance, this);
7091
+ viewModelInstance.internalIncrementReferenceCount();
7092
+ this._viewModelInstances.set(name, viewModelInstance);
7093
+ return viewModelInstance;
7094
+ }
7095
+ return null;
7096
+ };
6901
7097
  /**
6902
7098
  * method to access a property instance of type number belonging
6903
7099
  * to the view model instance or to a nested view model instance
6904
7100
  * @param path - path to the number property
6905
7101
  */
6906
7102
  ViewModelInstance.prototype.number = function (path) {
6907
- var _a;
6908
- var instance = (_a = this._runtimeInstance) === null || _a === void 0 ? void 0 : _a.number(path);
6909
- if (instance) {
6910
- return new ViewModelInstanceNumber(instance, this._root);
6911
- }
6912
- return null;
7103
+ var viewmodelInstanceValue = this.propertyFromPath(path, PropertyType.Number);
7104
+ return viewmodelInstanceValue;
6913
7105
  };
6914
7106
  /**
6915
7107
  * method to access a property instance of type string belonging
6916
7108
  * to the view model instance or to a nested view model instance
6917
- * @param path - path to the number property
7109
+ * @param path - path to the string property
6918
7110
  */
6919
7111
  ViewModelInstance.prototype.string = function (path) {
6920
- var _a;
6921
- var instance = (_a = this._runtimeInstance) === null || _a === void 0 ? void 0 : _a.string(path);
6922
- if (instance) {
6923
- return new ViewModelInstanceString(instance, this._root);
6924
- }
6925
- return null;
7112
+ var viewmodelInstanceValue = this.propertyFromPath(path, PropertyType.String);
7113
+ return viewmodelInstanceValue;
6926
7114
  };
6927
7115
  /**
6928
7116
  * method to access a property instance of type boolean belonging
6929
7117
  * to the view model instance or to a nested view model instance
6930
- * @param path - path to the number property
7118
+ * @param path - path to the boolean property
6931
7119
  */
6932
7120
  ViewModelInstance.prototype.boolean = function (path) {
6933
- var _a;
6934
- var instance = (_a = this._runtimeInstance) === null || _a === void 0 ? void 0 : _a.boolean(path);
6935
- if (instance) {
6936
- return new ViewModelInstanceBoolean(instance, this._root);
6937
- }
6938
- return null;
7121
+ var viewmodelInstanceValue = this.propertyFromPath(path, PropertyType.Boolean);
7122
+ return viewmodelInstanceValue;
6939
7123
  };
6940
7124
  /**
6941
7125
  * method to access a property instance of type color belonging
6942
7126
  * to the view model instance or to a nested view model instance
6943
- * @param path - path to the number property
7127
+ * @param path - path to the ttrigger property
6944
7128
  */
6945
7129
  ViewModelInstance.prototype.color = function (path) {
6946
- var _a;
6947
- var instance = (_a = this._runtimeInstance) === null || _a === void 0 ? void 0 : _a.color(path);
6948
- if (instance) {
6949
- return new ViewModelInstanceColor(instance, this._root);
6950
- }
6951
- return null;
7130
+ var viewmodelInstanceValue = this.propertyFromPath(path, PropertyType.Color);
7131
+ return viewmodelInstanceValue;
6952
7132
  };
6953
7133
  /**
6954
7134
  * method to access a property instance of type trigger belonging
6955
7135
  * to the view model instance or to a nested view model instance
6956
- * @param path - path to the number property
7136
+ * @param path - path to the trigger property
6957
7137
  */
6958
7138
  ViewModelInstance.prototype.trigger = function (path) {
6959
- var _a;
6960
- var instance = (_a = this._runtimeInstance) === null || _a === void 0 ? void 0 : _a.trigger(path);
6961
- if (instance) {
6962
- return new ViewModelInstanceTrigger(instance, this._root);
6963
- }
6964
- return null;
7139
+ var viewmodelInstanceValue = this.propertyFromPath(path, PropertyType.Trigger);
7140
+ return viewmodelInstanceValue;
6965
7141
  };
6966
7142
  /**
6967
7143
  * method to access a property instance of type enum belonging
6968
7144
  * to the view model instance or to a nested view model instance
6969
- * @param path - path to the number property
7145
+ * @param path - path to the enum property
6970
7146
  */
6971
7147
  ViewModelInstance.prototype.enum = function (path) {
6972
- var _a;
6973
- var instance = (_a = this._runtimeInstance) === null || _a === void 0 ? void 0 : _a.enum(path);
6974
- if (instance) {
6975
- return new ViewModelInstanceEnum(instance, this._root);
6976
- }
6977
- return null;
7148
+ var viewmodelInstanceValue = this.propertyFromPath(path, PropertyType.Enum);
7149
+ return viewmodelInstanceValue;
6978
7150
  };
6979
7151
  /**
6980
7152
  * method to access a view model property instance belonging
6981
7153
  * to the view model instance or to a nested view model instance
6982
- * @param path - path to the number property
7154
+ * @param path - path to the view model property
6983
7155
  */
6984
7156
  ViewModelInstance.prototype.viewModel = function (path) {
6985
- var _a;
6986
- var viewModelInstance = (_a = this._runtimeInstance) === null || _a === void 0 ? void 0 : _a.viewModel(path);
6987
- if (viewModelInstance) {
6988
- return new ViewModelInstance(viewModelInstance, this._root);
7157
+ var pathSegments = path.split("/");
7158
+ var parentViewModelInstance = pathSegments.length > 1
7159
+ ? this.viewModelFromPathSegments(pathSegments.slice(0, pathSegments.length - 1), 0)
7160
+ : this;
7161
+ if (parentViewModelInstance != null) {
7162
+ return parentViewModelInstance.internalViewModelInstance(pathSegments[pathSegments.length - 1]);
6989
7163
  }
6990
7164
  return null;
6991
7165
  };
7166
+ ViewModelInstance.prototype.internalReplaceViewModel = function (name, value) {
7167
+ var _a;
7168
+ if (value.runtimeInstance !== null) {
7169
+ var result = ((_a = this._runtimeInstance) === null || _a === void 0 ? void 0 : _a.replaceViewModel(name, value.runtimeInstance)) ||
7170
+ false;
7171
+ if (result) {
7172
+ value.internalIncrementReferenceCount();
7173
+ var oldInstance_1 = this.internalViewModelInstance(name);
7174
+ if (oldInstance_1 !== null) {
7175
+ oldInstance_1.removeParent(this);
7176
+ if (this._children.includes(oldInstance_1)) {
7177
+ this._children = this._children.filter(function (child) { return child !== oldInstance_1; });
7178
+ }
7179
+ oldInstance_1.cleanup();
7180
+ }
7181
+ this._viewModelInstances.set(name, value);
7182
+ value.addParent(this);
7183
+ }
7184
+ return result;
7185
+ }
7186
+ return false;
7187
+ };
6992
7188
  /**
6993
7189
  * method to replace a view model property with another view model value
6994
7190
  * @param path - path to the view model property
@@ -6996,27 +7192,11 @@ var ViewModelInstance = /** @class */ (function () {
6996
7192
  */
6997
7193
  ViewModelInstance.prototype.replaceViewModel = function (path, value) {
6998
7194
  var _a;
6999
- if (value.runtimeInstance !== null) {
7000
- return (((_a = this._runtimeInstance) === null || _a === void 0 ? void 0 : _a.replaceViewModel(path, value.runtimeInstance)) ||
7001
- false);
7002
- }
7003
- return false;
7004
- };
7005
- /*
7006
- * method for internal use, it shouldn't be called externally
7007
- */
7008
- ViewModelInstance.prototype.addToCallbacks = function (property) {
7009
- if (!this._propertiesWithCallbacks.includes(property)) {
7010
- this._propertiesWithCallbacks.push(property);
7011
- }
7012
- };
7013
- /*
7014
- * method for internal use, it shouldn't be called externally
7015
- */
7016
- ViewModelInstance.prototype.removeFromCallbacks = function (property) {
7017
- if (this._propertiesWithCallbacks.includes(property)) {
7018
- this._propertiesWithCallbacks = this._propertiesWithCallbacks.filter(function (prop) { return prop !== property; });
7019
- }
7195
+ var pathSegments = path.split("/");
7196
+ var viewModelInstance = pathSegments.length > 1
7197
+ ? this.viewModelFromPathSegments(pathSegments.slice(0, pathSegments.length - 1), 0)
7198
+ : this;
7199
+ return ((_a = viewModelInstance === null || viewModelInstance === void 0 ? void 0 : viewModelInstance.internalReplaceViewModel(pathSegments[pathSegments.length - 1], value)) !== null && _a !== void 0 ? _a : false);
7020
7200
  };
7021
7201
  /*
7022
7202
  * method to add one to the reference counter of the instance.
@@ -7048,21 +7228,36 @@ var ViewModelInstance = /** @class */ (function () {
7048
7228
  this._referenceCount++;
7049
7229
  };
7050
7230
  ViewModelInstance.prototype.cleanup = function () {
7231
+ var _this = this;
7051
7232
  this._referenceCount--;
7052
7233
  if (this._referenceCount <= 0) {
7053
7234
  this._runtimeInstance = null;
7054
7235
  this.clearCallbacks();
7055
7236
  this._propertiesWithCallbacks = [];
7237
+ this._viewModelInstances.forEach(function (value) {
7238
+ value.cleanup();
7239
+ });
7240
+ this._viewModelInstances.clear();
7241
+ var children = __spreadArray([], this._children, true);
7242
+ this._children.length = 0;
7243
+ var parents = __spreadArray([], this._parents, true);
7244
+ this._parents.length = 0;
7245
+ children.forEach(function (child) {
7246
+ child.removeParent(_this);
7247
+ });
7248
+ parents.forEach(function (parent) {
7249
+ parent.removeFromViewModelCallbacks(_this);
7250
+ });
7056
7251
  }
7057
7252
  };
7058
7253
  return ViewModelInstance;
7059
7254
  }());
7060
7255
 
7061
7256
  var ViewModelInstanceValue = /** @class */ (function () {
7062
- function ViewModelInstanceValue(instance, root) {
7257
+ function ViewModelInstanceValue(instance, parent) {
7063
7258
  this.callbacks = [];
7064
7259
  this._viewModelInstanceValue = instance;
7065
- this._rootViewModel = root;
7260
+ this._parentViewModel = parent;
7066
7261
  }
7067
7262
  ViewModelInstanceValue.prototype.on = function (callback) {
7068
7263
  // Since we don't clean the changed flag for properties that don't have listeners,
@@ -7072,7 +7267,7 @@ var ViewModelInstanceValue = /** @class */ (function () {
7072
7267
  }
7073
7268
  if (!this.callbacks.includes(callback)) {
7074
7269
  this.callbacks.push(callback);
7075
- this._rootViewModel.addToCallbacks(this);
7270
+ this._parentViewModel.addToPropertyCallbacks(this);
7076
7271
  }
7077
7272
  };
7078
7273
  ViewModelInstanceValue.prototype.off = function (callback) {
@@ -7083,19 +7278,21 @@ var ViewModelInstanceValue = /** @class */ (function () {
7083
7278
  this.callbacks = this.callbacks.filter(function (cb) { return cb !== callback; });
7084
7279
  }
7085
7280
  if (this.callbacks.length === 0) {
7086
- this._rootViewModel.removeFromCallbacks(this);
7281
+ this._parentViewModel.removeFromPropertyCallbacks(this);
7087
7282
  }
7088
7283
  };
7089
7284
  ViewModelInstanceValue.prototype.internalHandleCallback = function (callback) { };
7090
7285
  ViewModelInstanceValue.prototype.handleCallbacks = function () {
7091
7286
  var _this = this;
7092
7287
  if (this._viewModelInstanceValue.hasChanged) {
7093
- this._viewModelInstanceValue.clearChanges();
7094
7288
  this.callbacks.forEach(function (callback) {
7095
7289
  _this.internalHandleCallback(callback);
7096
7290
  });
7097
7291
  }
7098
7292
  };
7293
+ ViewModelInstanceValue.prototype.clearChanges = function () {
7294
+ this._viewModelInstanceValue.clearChanges();
7295
+ };
7099
7296
  ViewModelInstanceValue.prototype.clearCallbacks = function () {
7100
7297
  this.callbacks.length = 0;
7101
7298
  };
@@ -7111,8 +7308,8 @@ var ViewModelInstanceValue = /** @class */ (function () {
7111
7308
 
7112
7309
  var ViewModelInstanceString = /** @class */ (function (_super) {
7113
7310
  __extends(ViewModelInstanceString, _super);
7114
- function ViewModelInstanceString(instance, root) {
7115
- return _super.call(this, instance, root) || this;
7311
+ function ViewModelInstanceString(instance, parent) {
7312
+ return _super.call(this, instance, parent) || this;
7116
7313
  }
7117
7314
  Object.defineProperty(ViewModelInstanceString.prototype, "value", {
7118
7315
  get: function () {
@@ -7132,8 +7329,8 @@ var ViewModelInstanceString = /** @class */ (function (_super) {
7132
7329
 
7133
7330
  var ViewModelInstanceNumber = /** @class */ (function (_super) {
7134
7331
  __extends(ViewModelInstanceNumber, _super);
7135
- function ViewModelInstanceNumber(instance, root) {
7136
- return _super.call(this, instance, root) || this;
7332
+ function ViewModelInstanceNumber(instance, parent) {
7333
+ return _super.call(this, instance, parent) || this;
7137
7334
  }
7138
7335
  Object.defineProperty(ViewModelInstanceNumber.prototype, "value", {
7139
7336
  get: function () {
@@ -7153,8 +7350,8 @@ var ViewModelInstanceNumber = /** @class */ (function (_super) {
7153
7350
 
7154
7351
  var ViewModelInstanceBoolean = /** @class */ (function (_super) {
7155
7352
  __extends(ViewModelInstanceBoolean, _super);
7156
- function ViewModelInstanceBoolean(instance, root) {
7157
- return _super.call(this, instance, root) || this;
7353
+ function ViewModelInstanceBoolean(instance, parent) {
7354
+ return _super.call(this, instance, parent) || this;
7158
7355
  }
7159
7356
  Object.defineProperty(ViewModelInstanceBoolean.prototype, "value", {
7160
7357
  get: function () {
@@ -7174,8 +7371,8 @@ var ViewModelInstanceBoolean = /** @class */ (function (_super) {
7174
7371
 
7175
7372
  var ViewModelInstanceTrigger = /** @class */ (function (_super) {
7176
7373
  __extends(ViewModelInstanceTrigger, _super);
7177
- function ViewModelInstanceTrigger(instance, root) {
7178
- return _super.call(this, instance, root) || this;
7374
+ function ViewModelInstanceTrigger(instance, parent) {
7375
+ return _super.call(this, instance, parent) || this;
7179
7376
  }
7180
7377
  ViewModelInstanceTrigger.prototype.trigger = function () {
7181
7378
  return this._viewModelInstanceValue.trigger();
@@ -7188,8 +7385,8 @@ var ViewModelInstanceTrigger = /** @class */ (function (_super) {
7188
7385
 
7189
7386
  var ViewModelInstanceEnum = /** @class */ (function (_super) {
7190
7387
  __extends(ViewModelInstanceEnum, _super);
7191
- function ViewModelInstanceEnum(instance, root) {
7192
- return _super.call(this, instance, root) || this;
7388
+ function ViewModelInstanceEnum(instance, parent) {
7389
+ return _super.call(this, instance, parent) || this;
7193
7390
  }
7194
7391
  Object.defineProperty(ViewModelInstanceEnum.prototype, "value", {
7195
7392
  get: function () {
@@ -7227,8 +7424,8 @@ var ViewModelInstanceEnum = /** @class */ (function (_super) {
7227
7424
 
7228
7425
  var ViewModelInstanceColor = /** @class */ (function (_super) {
7229
7426
  __extends(ViewModelInstanceColor, _super);
7230
- function ViewModelInstanceColor(instance, root) {
7231
- return _super.call(this, instance, root) || this;
7427
+ function ViewModelInstanceColor(instance, parent) {
7428
+ return _super.call(this, instance, parent) || this;
7232
7429
  }
7233
7430
  Object.defineProperty(ViewModelInstanceColor.prototype, "value", {
7234
7431
  get: function () {