@medplum/agent 2.2.4 → 2.2.5

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.
Files changed (2) hide show
  1. package/dist/cjs/index.cjs +854 -830
  2. package/package.json +1 -1
@@ -12,13 +12,13 @@ var __export = (target, all) => {
12
12
  for (var name in all)
13
13
  __defProp(target, name, { get: all[name], enumerable: true });
14
14
  };
15
- var __copyProps = (to2, from, except, desc) => {
15
+ var __copyProps = (to, from, except, desc) => {
16
16
  if (from && typeof from === "object" || typeof from === "function") {
17
17
  for (let key of __getOwnPropNames(from))
18
- if (!__hasOwnProp.call(to2, key) && key !== except)
19
- __defProp(to2, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
18
+ if (!__hasOwnProp.call(to, key) && key !== except)
19
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
20
20
  }
21
- return to2;
21
+ return to;
22
22
  };
23
23
  var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
24
24
  // If the importer is in node compatibility mode or this is not an ESM
@@ -1295,9 +1295,9 @@ var require_receiver = __commonJS({
1295
1295
  }
1296
1296
  this._fragments.push(buf);
1297
1297
  }
1298
- const er2 = this.dataMessage();
1299
- if (er2)
1300
- return cb(er2);
1298
+ const er = this.dataMessage();
1299
+ if (er)
1300
+ return cb(er);
1301
1301
  this.startLoop(cb);
1302
1302
  });
1303
1303
  }
@@ -3556,12 +3556,12 @@ var require_once = __commonJS({
3556
3556
  value: true
3557
3557
  });
3558
3558
  exports.default = once;
3559
- function once(fn) {
3559
+ function once(fn2) {
3560
3560
  return function() {
3561
- if (fn === null)
3561
+ if (fn2 === null)
3562
3562
  return;
3563
- var callFn = fn;
3564
- fn = null;
3563
+ var callFn = fn2;
3564
+ fn2 = null;
3565
3565
  callFn.apply(this, arguments);
3566
3566
  };
3567
3567
  }
@@ -4102,12 +4102,12 @@ var require_onlyOnce = __commonJS({
4102
4102
  value: true
4103
4103
  });
4104
4104
  exports.default = onlyOnce;
4105
- function onlyOnce(fn) {
4105
+ function onlyOnce(fn2) {
4106
4106
  return function() {
4107
- if (fn === null)
4107
+ if (fn2 === null)
4108
4108
  throw new Error("Callback was already called.");
4109
- var callFn = fn;
4110
- fn = null;
4109
+ var callFn = fn2;
4110
+ fn2 = null;
4111
4111
  callFn.apply(this, arguments);
4112
4112
  };
4113
4113
  }
@@ -4238,11 +4238,11 @@ var require_initialParams = __commonJS({
4238
4238
  Object.defineProperty(exports, "__esModule", {
4239
4239
  value: true
4240
4240
  });
4241
- exports.default = function(fn) {
4241
+ exports.default = function(fn2) {
4242
4242
  return function() {
4243
4243
  var args = (0, _slice2.default)(arguments);
4244
4244
  var callback = args.pop();
4245
- fn.call(this, args, callback);
4245
+ fn2.call(this, args, callback);
4246
4246
  };
4247
4247
  };
4248
4248
  var _slice = require_slice();
@@ -4271,14 +4271,14 @@ var require_setImmediate = __commonJS({
4271
4271
  }
4272
4272
  var hasSetImmediate = exports.hasSetImmediate = typeof setImmediate === "function" && setImmediate;
4273
4273
  var hasNextTick = exports.hasNextTick = typeof process === "object" && typeof process.nextTick === "function";
4274
- function fallback(fn) {
4275
- setTimeout(fn, 0);
4274
+ function fallback(fn2) {
4275
+ setTimeout(fn2, 0);
4276
4276
  }
4277
4277
  function wrap(defer) {
4278
- return function(fn) {
4278
+ return function(fn2) {
4279
4279
  var args = (0, _slice2.default)(arguments, 1);
4280
4280
  defer(function() {
4281
- fn.apply(null, args);
4281
+ fn2.apply(null, args);
4282
4282
  });
4283
4283
  };
4284
4284
  }
@@ -4358,8 +4358,8 @@ var require_wrapAsync = __commonJS({
4358
4358
  return obj && obj.__esModule ? obj : { default: obj };
4359
4359
  }
4360
4360
  var supportsSymbol = typeof Symbol === "function";
4361
- function isAsync(fn) {
4362
- return supportsSymbol && fn[Symbol.toStringTag] === "AsyncFunction";
4361
+ function isAsync(fn2) {
4362
+ return supportsSymbol && fn2[Symbol.toStringTag] === "AsyncFunction";
4363
4363
  }
4364
4364
  function wrapAsync(asyncFn) {
4365
4365
  return isAsync(asyncFn) ? (0, _asyncify2.default)(asyncFn) : asyncFn;
@@ -4401,9 +4401,9 @@ var require_doLimit = __commonJS({
4401
4401
  value: true
4402
4402
  });
4403
4403
  exports.default = doLimit;
4404
- function doLimit(fn, limit) {
4404
+ function doLimit(fn2, limit) {
4405
4405
  return function(iterable, iteratee, callback) {
4406
- return fn(iterable, limit, iteratee, callback);
4406
+ return fn2(iterable, limit, iteratee, callback);
4407
4407
  };
4408
4408
  }
4409
4409
  module2.exports = exports["default"];
@@ -4455,38 +4455,38 @@ var require_AsyncEventEmitter = __commonJS({
4455
4455
  callback = void 0;
4456
4456
  }
4457
4457
  listeners = Array.isArray(listeners) ? listeners : [listeners];
4458
- eachSeries(listeners.slice(), function(fn, next) {
4458
+ eachSeries(listeners.slice(), function(fn2, next) {
4459
4459
  var err;
4460
- if (fn.length < 2) {
4460
+ if (fn2.length < 2) {
4461
4461
  try {
4462
- fn.call(self2, data);
4462
+ fn2.call(self2, data);
4463
4463
  } catch (e) {
4464
4464
  err = e;
4465
4465
  }
4466
4466
  return next(err);
4467
4467
  }
4468
- fn.call(self2, data, next);
4468
+ fn2.call(self2, data, next);
4469
4469
  }, callback);
4470
4470
  return self2;
4471
4471
  };
4472
4472
  AsyncEventEmitter.prototype.once = function(type, listener) {
4473
- var self2 = this, g2;
4473
+ var self2 = this, g3;
4474
4474
  if (typeof listener !== "function") {
4475
4475
  throw new TypeError("listener must be a function");
4476
4476
  }
4477
4477
  if (listener.length >= 2) {
4478
- g2 = function(e, next) {
4479
- self2.removeListener(type, g2);
4478
+ g3 = function(e, next) {
4479
+ self2.removeListener(type, g3);
4480
4480
  listener(e, next);
4481
4481
  };
4482
4482
  } else {
4483
- g2 = function(e) {
4484
- self2.removeListener(type, g2);
4483
+ g3 = function(e) {
4484
+ self2.removeListener(type, g3);
4485
4485
  listener(e);
4486
4486
  };
4487
4487
  }
4488
- g2.listener = listener;
4489
- self2.on(type, g2);
4488
+ g3.listener = listener;
4489
+ self2.on(type, g3);
4490
4490
  return self2;
4491
4491
  };
4492
4492
  AsyncEventEmitter.prototype.first = function(event, listener) {
@@ -4672,9 +4672,9 @@ var require_dcmjs = __commonJS({
4672
4672
  }
4673
4673
  interpolate(level) {
4674
4674
  return this.options.template.replace(/{{([^{}]*)}}/g, (stache, prop) => {
4675
- const fn = this.options[prop];
4676
- if (fn) {
4677
- return fn({ level, logger: this.logger });
4675
+ const fn2 = this.options[prop];
4676
+ if (fn2) {
4677
+ return fn2({ level, logger: this.logger });
4678
4678
  }
4679
4679
  return stache;
4680
4680
  });
@@ -4960,8 +4960,8 @@ var require_dcmjs = __commonJS({
4960
4960
  }
4961
4961
  return _construct.apply(null, arguments);
4962
4962
  }
4963
- function _isNativeFunction(fn) {
4964
- return Function.toString.call(fn).indexOf("[native code]") !== -1;
4963
+ function _isNativeFunction(fn2) {
4964
+ return Function.toString.call(fn2).indexOf("[native code]") !== -1;
4965
4965
  }
4966
4966
  function _wrapNativeSuper(Class) {
4967
4967
  var _cache = typeof Map === "function" ? /* @__PURE__ */ new Map() : void 0;
@@ -5066,11 +5066,11 @@ var require_dcmjs = __commonJS({
5066
5066
  if (_i == null)
5067
5067
  return;
5068
5068
  var _arr = [];
5069
- var _n = true;
5069
+ var _n2 = true;
5070
5070
  var _d = false;
5071
5071
  var _s, _e2;
5072
5072
  try {
5073
- for (_i = _i.call(arr); !(_n = (_s = _i.next()).done); _n = true) {
5073
+ for (_i = _i.call(arr); !(_n2 = (_s = _i.next()).done); _n2 = true) {
5074
5074
  _arr.push(_s.value);
5075
5075
  if (i2 && _arr.length === i2)
5076
5076
  break;
@@ -5080,7 +5080,7 @@ var require_dcmjs = __commonJS({
5080
5080
  _e2 = err2;
5081
5081
  } finally {
5082
5082
  try {
5083
- if (!_n && _i["return"] != null)
5083
+ if (!_n2 && _i["return"] != null)
5084
5084
  _i["return"]();
5085
5085
  } finally {
5086
5086
  if (_d)
@@ -5116,16 +5116,16 @@ var require_dcmjs = __commonJS({
5116
5116
  throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
5117
5117
  }
5118
5118
  function _createForOfIteratorHelper(o, allowArrayLike) {
5119
- var it2 = typeof Symbol !== "undefined" && o[Symbol.iterator] || o["@@iterator"];
5120
- if (!it2) {
5121
- if (Array.isArray(o) || (it2 = _unsupportedIterableToArray(o)) || allowArrayLike && o && typeof o.length === "number") {
5122
- if (it2)
5123
- o = it2;
5119
+ var it = typeof Symbol !== "undefined" && o[Symbol.iterator] || o["@@iterator"];
5120
+ if (!it) {
5121
+ if (Array.isArray(o) || (it = _unsupportedIterableToArray(o)) || allowArrayLike && o && typeof o.length === "number") {
5122
+ if (it)
5123
+ o = it;
5124
5124
  var i2 = 0;
5125
- var F2 = function() {
5125
+ var F = function() {
5126
5126
  };
5127
5127
  return {
5128
- s: F2,
5128
+ s: F,
5129
5129
  n: function() {
5130
5130
  if (i2 >= o.length)
5131
5131
  return {
@@ -5139,7 +5139,7 @@ var require_dcmjs = __commonJS({
5139
5139
  e: function(e) {
5140
5140
  throw e;
5141
5141
  },
5142
- f: F2
5142
+ f: F
5143
5143
  };
5144
5144
  }
5145
5145
  throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
@@ -5147,10 +5147,10 @@ var require_dcmjs = __commonJS({
5147
5147
  var normalCompletion = true, didErr = false, err2;
5148
5148
  return {
5149
5149
  s: function() {
5150
- it2 = it2.call(o);
5150
+ it = it.call(o);
5151
5151
  },
5152
5152
  n: function() {
5153
- var step = it2.next();
5153
+ var step = it.next();
5154
5154
  normalCompletion = step.done;
5155
5155
  return step;
5156
5156
  },
@@ -5160,8 +5160,8 @@ var require_dcmjs = __commonJS({
5160
5160
  },
5161
5161
  f: function() {
5162
5162
  try {
5163
- if (!normalCompletion && it2.return != null)
5164
- it2.return();
5163
+ if (!normalCompletion && it.return != null)
5164
+ it.return();
5165
5165
  } finally {
5166
5166
  if (didErr)
5167
5167
  throw err2;
@@ -10845,8 +10845,8 @@ var require_dcmjs = __commonJS({
10845
10845
  if (undef) {
10846
10846
  var stack = 0;
10847
10847
  while (1) {
10848
- var g2 = stream.readUint16();
10849
- if (g2 == 65534) {
10848
+ var g3 = stream.readUint16();
10849
+ if (g3 == 65534) {
10850
10850
  var ge2 = stream.readUint16();
10851
10851
  var itemLength = stream.readUint32();
10852
10852
  stream.increment(-4);
@@ -12064,9 +12064,9 @@ var require_dcmjs = __commonJS({
12064
12064
  key: "rgb2XYZ",
12065
12065
  value: function rgb2XYZ(rgb) {
12066
12066
  var R2 = Colors2.invGammaCorrection(rgb[0]);
12067
- var G2 = Colors2.invGammaCorrection(rgb[1]);
12068
- var B2 = Colors2.invGammaCorrection(rgb[2]);
12069
- return [0.41239558896741424 * R2 + 0.3575834307637148 * G2 + 0.18049264738170157 * B2, 0.21258623078559555 * R2 + 0.7151703037034108 * G2 + 0.07220049864333623 * B2, 0.019297215491746945 * R2 + 0.11918386458084854 * G2 + 0.9504971251315798 * B2];
12067
+ var G = Colors2.invGammaCorrection(rgb[1]);
12068
+ var B = Colors2.invGammaCorrection(rgb[2]);
12069
+ return [0.41239558896741424 * R2 + 0.3575834307637148 * G + 0.18049264738170157 * B, 0.21258623078559555 * R2 + 0.7151703037034108 * G + 0.07220049864333623 * B, 0.019297215491746945 * R2 + 0.11918386458084854 * G + 0.9504971251315798 * B];
12070
12070
  }
12071
12071
  }, {
12072
12072
  key: "xyz2LAB",
@@ -12074,11 +12074,11 @@ var require_dcmjs = __commonJS({
12074
12074
  var whitePoint = Colors2.d65WhitePointXYZ();
12075
12075
  var X2 = xyz[0] / whitePoint[0];
12076
12076
  var Y2 = xyz[1] / whitePoint[1];
12077
- var Z = xyz[2] / whitePoint[2];
12077
+ var Z2 = xyz[2] / whitePoint[2];
12078
12078
  X2 = Colors2.labf(X2);
12079
12079
  Y2 = Colors2.labf(Y2);
12080
- Z = Colors2.labf(Z);
12081
- return [116 * Y2 - 16, 500 * (X2 - Y2), 200 * (Y2 - Z)];
12080
+ Z2 = Colors2.labf(Z2);
12081
+ return [116 * Y2 - 16, 500 * (X2 - Y2), 200 * (Y2 - Z2)];
12082
12082
  }
12083
12083
  }, {
12084
12084
  key: "lab2RGB",
@@ -15068,13 +15068,13 @@ var require_dcmjs = __commonJS({
15068
15068
  referencedFramesPerSegment.push([]);
15069
15069
  }
15070
15070
  }
15071
- for (var z = 0; z < images.length; z++) {
15072
- var imageId = images[z].imageId;
15071
+ for (var z2 = 0; z2 < images.length; z2++) {
15072
+ var imageId = images[z2].imageId;
15073
15073
  var imageIdSpecificToolState = toolState[imageId];
15074
15074
  for (var _i2 = 0; _i2 < segmentIndicies.length; _i2++) {
15075
15075
  var segIdx = segmentIndicies[_i2];
15076
15076
  if (imageIdSpecificToolState && imageIdSpecificToolState.brush && imageIdSpecificToolState.brush.data && imageIdSpecificToolState.brush.data[segIdx] && imageIdSpecificToolState.brush.data[segIdx].pixelData) {
15077
- referencedFramesPerSegment[_i2].push(z);
15077
+ referencedFramesPerSegment[_i2].push(z2);
15078
15078
  }
15079
15079
  }
15080
15080
  }
@@ -15312,14 +15312,14 @@ var require_dcmjs = __commonJS({
15312
15312
  function length(a) {
15313
15313
  var x = a[0];
15314
15314
  var y = a[1];
15315
- var z = a[2];
15316
- return Math.hypot(x, y, z);
15315
+ var z2 = a[2];
15316
+ return Math.hypot(x, y, z2);
15317
15317
  }
15318
- function fromValues(x, y, z) {
15318
+ function fromValues(x, y, z2) {
15319
15319
  var out = new ARRAY_TYPE(3);
15320
15320
  out[0] = x;
15321
15321
  out[1] = y;
15322
- out[2] = z;
15322
+ out[2] = z2;
15323
15323
  return out;
15324
15324
  }
15325
15325
  function copy(out, a) {
@@ -15328,10 +15328,10 @@ var require_dcmjs = __commonJS({
15328
15328
  out[2] = a[2];
15329
15329
  return out;
15330
15330
  }
15331
- function set(out, x, y, z) {
15331
+ function set(out, x, y, z2) {
15332
15332
  out[0] = x;
15333
15333
  out[1] = y;
15334
- out[2] = z;
15334
+ out[2] = z2;
15335
15335
  return out;
15336
15336
  }
15337
15337
  function add(out, a, b2) {
@@ -15403,20 +15403,20 @@ var require_dcmjs = __commonJS({
15403
15403
  function distance(a, b2) {
15404
15404
  var x = b2[0] - a[0];
15405
15405
  var y = b2[1] - a[1];
15406
- var z = b2[2] - a[2];
15407
- return Math.hypot(x, y, z);
15406
+ var z2 = b2[2] - a[2];
15407
+ return Math.hypot(x, y, z2);
15408
15408
  }
15409
15409
  function squaredDistance(a, b2) {
15410
15410
  var x = b2[0] - a[0];
15411
15411
  var y = b2[1] - a[1];
15412
- var z = b2[2] - a[2];
15413
- return x * x + y * y + z * z;
15412
+ var z2 = b2[2] - a[2];
15413
+ return x * x + y * y + z2 * z2;
15414
15414
  }
15415
15415
  function squaredLength(a) {
15416
15416
  var x = a[0];
15417
15417
  var y = a[1];
15418
- var z = a[2];
15419
- return x * x + y * y + z * z;
15418
+ var z2 = a[2];
15419
+ return x * x + y * y + z2 * z2;
15420
15420
  }
15421
15421
  function negate(out, a) {
15422
15422
  out[0] = -a[0];
@@ -15433,8 +15433,8 @@ var require_dcmjs = __commonJS({
15433
15433
  function normalize$1(out, a) {
15434
15434
  var x = a[0];
15435
15435
  var y = a[1];
15436
- var z = a[2];
15437
- var len2 = x * x + y * y + z * z;
15436
+ var z2 = a[2];
15437
+ var len2 = x * x + y * y + z2 * z2;
15438
15438
  if (len2 > 0) {
15439
15439
  len2 = 1 / Math.sqrt(len2);
15440
15440
  }
@@ -15490,33 +15490,33 @@ var require_dcmjs = __commonJS({
15490
15490
  function random(out, scale2) {
15491
15491
  scale2 = scale2 || 1;
15492
15492
  var r4 = RANDOM() * 2 * Math.PI;
15493
- var z = RANDOM() * 2 - 1;
15494
- var zScale = Math.sqrt(1 - z * z) * scale2;
15493
+ var z2 = RANDOM() * 2 - 1;
15494
+ var zScale = Math.sqrt(1 - z2 * z2) * scale2;
15495
15495
  out[0] = Math.cos(r4) * zScale;
15496
15496
  out[1] = Math.sin(r4) * zScale;
15497
- out[2] = z * scale2;
15497
+ out[2] = z2 * scale2;
15498
15498
  return out;
15499
15499
  }
15500
15500
  function transformMat4(out, a, m3) {
15501
- var x = a[0], y = a[1], z = a[2];
15502
- var w2 = m3[3] * x + m3[7] * y + m3[11] * z + m3[15];
15501
+ var x = a[0], y = a[1], z2 = a[2];
15502
+ var w2 = m3[3] * x + m3[7] * y + m3[11] * z2 + m3[15];
15503
15503
  w2 = w2 || 1;
15504
- out[0] = (m3[0] * x + m3[4] * y + m3[8] * z + m3[12]) / w2;
15505
- out[1] = (m3[1] * x + m3[5] * y + m3[9] * z + m3[13]) / w2;
15506
- out[2] = (m3[2] * x + m3[6] * y + m3[10] * z + m3[14]) / w2;
15504
+ out[0] = (m3[0] * x + m3[4] * y + m3[8] * z2 + m3[12]) / w2;
15505
+ out[1] = (m3[1] * x + m3[5] * y + m3[9] * z2 + m3[13]) / w2;
15506
+ out[2] = (m3[2] * x + m3[6] * y + m3[10] * z2 + m3[14]) / w2;
15507
15507
  return out;
15508
15508
  }
15509
15509
  function transformMat3(out, a, m3) {
15510
- var x = a[0], y = a[1], z = a[2];
15511
- out[0] = x * m3[0] + y * m3[3] + z * m3[6];
15512
- out[1] = x * m3[1] + y * m3[4] + z * m3[7];
15513
- out[2] = x * m3[2] + y * m3[5] + z * m3[8];
15510
+ var x = a[0], y = a[1], z2 = a[2];
15511
+ out[0] = x * m3[0] + y * m3[3] + z2 * m3[6];
15512
+ out[1] = x * m3[1] + y * m3[4] + z2 * m3[7];
15513
+ out[2] = x * m3[2] + y * m3[5] + z2 * m3[8];
15514
15514
  return out;
15515
15515
  }
15516
15516
  function transformQuat(out, a, q2) {
15517
15517
  var qx = q2[0], qy = q2[1], qz = q2[2], qw = q2[3];
15518
- var x = a[0], y = a[1], z = a[2];
15519
- var uvx = qy * z - qz * y, uvy = qz * x - qx * z, uvz = qx * y - qy * x;
15518
+ var x = a[0], y = a[1], z2 = a[2];
15519
+ var uvx = qy * z2 - qz * y, uvy = qz * x - qx * z2, uvz = qx * y - qy * x;
15520
15520
  var uuvx = qy * uvz - qz * uvy, uuvy = qz * uvx - qx * uvz, uuvz = qx * uvy - qy * uvx;
15521
15521
  var w2 = qw * 2;
15522
15522
  uvx *= w2;
@@ -15527,7 +15527,7 @@ var require_dcmjs = __commonJS({
15527
15527
  uuvz *= 2;
15528
15528
  out[0] = x + uvx + uuvx;
15529
15529
  out[1] = y + uvy + uuvy;
15530
- out[2] = z + uvz + uuvz;
15530
+ out[2] = z2 + uvz + uuvz;
15531
15531
  return out;
15532
15532
  }
15533
15533
  function rotateX(out, a, b2, rad) {
@@ -15599,7 +15599,7 @@ var require_dcmjs = __commonJS({
15599
15599
  var sqrLen = squaredLength;
15600
15600
  var forEach = function() {
15601
15601
  var vec = create();
15602
- return function(a, stride, offset, count, fn, arg) {
15602
+ return function(a, stride, offset, count, fn2, arg) {
15603
15603
  var i2, l2;
15604
15604
  if (!stride) {
15605
15605
  stride = 3;
@@ -15616,7 +15616,7 @@ var require_dcmjs = __commonJS({
15616
15616
  vec[0] = a[i2];
15617
15617
  vec[1] = a[i2 + 1];
15618
15618
  vec[2] = a[i2 + 2];
15619
- fn(vec, vec, arg);
15619
+ fn2(vec, vec, arg);
15620
15620
  a[i2] = vec[0];
15621
15621
  a[i2 + 1] = vec[1];
15622
15622
  a[i2 + 2] = vec[2];
@@ -15785,13 +15785,13 @@ var require_dcmjs = __commonJS({
15785
15785
  break;
15786
15786
  }
15787
15787
  if (byteValue <= 127) {
15788
- var N = byteValue + 1;
15788
+ var N2 = byteValue + 1;
15789
15789
  var next = i2 + 1;
15790
- for (var p3 = next; p3 < next + N; p3++) {
15790
+ for (var p3 = next; p3 < next + N2; p3++) {
15791
15791
  pixelData[pixelDataIndex] = uInt8Frame[p3];
15792
15792
  pixelDataIndex++;
15793
15793
  }
15794
- i2 += N + 1;
15794
+ i2 += N2 + 1;
15795
15795
  }
15796
15796
  if (byteValue >= 129) {
15797
15797
  var _N = 257 - byteValue;
@@ -16697,7 +16697,7 @@ var require_dcmjs = __commonJS({
16697
16697
  var sharedImageOrientationPatient = SharedFunctionalGroupsSequence.PlaneOrientationSequence ? SharedFunctionalGroupsSequence.PlaneOrientationSequence.ImageOrientationPatient : void 0;
16698
16698
  var sliceLength = Columns * Rows;
16699
16699
  var arrayBufferLength = sliceLength * imageIds.length * 2;
16700
- var M = 1;
16700
+ var M2 = 1;
16701
16701
  var m3 = 0;
16702
16702
  var tempBuffer = labelmapBufferArray[m3].slice(0);
16703
16703
  var tempSegmentsOnFrame = cloneDeep(segmentsOnFrameArray[m3]);
@@ -16740,10 +16740,10 @@ var require_dcmjs = __commonJS({
16740
16740
  if (data2[j2]) {
16741
16741
  if (labelmap2DView[j2] !== 0) {
16742
16742
  m3++;
16743
- if (m3 >= M) {
16743
+ if (m3 >= M2) {
16744
16744
  labelmapBufferArray[m3] = new ArrayBuffer(arrayBufferLength);
16745
16745
  segmentsOnFrameArray[m3] = [];
16746
- M++;
16746
+ M2++;
16747
16747
  }
16748
16748
  tempBuffer = labelmapBufferArray[m3].slice(0);
16749
16749
  tempSegmentsOnFrame = cloneDeep(segmentsOnFrameArray[m3]);
@@ -21714,7 +21714,7 @@ var require_dcmjs = __commonJS({
21714
21714
  __proto__: null,
21715
21715
  Comprehensive3DSR
21716
21716
  });
21717
- var sr = {
21717
+ var sr2 = {
21718
21718
  coding,
21719
21719
  contentItems,
21720
21720
  documents,
@@ -22026,7 +22026,7 @@ var require_dcmjs = __commonJS({
22026
22026
  data,
22027
22027
  derivations,
22028
22028
  normalizers,
22029
- sr,
22029
+ sr: sr2,
22030
22030
  utilities,
22031
22031
  log,
22032
22032
  anonymizer
@@ -22039,7 +22039,7 @@ var require_dcmjs = __commonJS({
22039
22039
  exports2.derivations = derivations;
22040
22040
  exports2.log = log;
22041
22041
  exports2.normalizers = normalizers;
22042
- exports2.sr = sr;
22042
+ exports2.sr = sr2;
22043
22043
  exports2.utilities = utilities;
22044
22044
  Object.defineProperty(exports2, "__esModule", { value: true });
22045
22045
  });
@@ -27542,11 +27542,11 @@ var require_from = __commonJS({
27542
27542
  Promise.resolve(value).then(_next, _throw);
27543
27543
  }
27544
27544
  }
27545
- function _asyncToGenerator(fn) {
27545
+ function _asyncToGenerator(fn2) {
27546
27546
  return function() {
27547
27547
  var self2 = this, args = arguments;
27548
27548
  return new Promise(function(resolve, reject) {
27549
- var gen = fn.apply(self2, args);
27549
+ var gen = fn2.apply(self2, args);
27550
27550
  function _next(value) {
27551
27551
  asyncGeneratorStep(gen, resolve, reject, _next, _throw, "next", value);
27552
27552
  }
@@ -27694,15 +27694,15 @@ var require_stream_readable = __commonJS({
27694
27694
  require_inherits()(Readable, Stream);
27695
27695
  var errorOrDestroy = destroyImpl.errorOrDestroy;
27696
27696
  var kProxyEvents = ["error", "close", "destroy", "pause", "resume"];
27697
- function prependListener(emitter, event, fn) {
27697
+ function prependListener(emitter, event, fn2) {
27698
27698
  if (typeof emitter.prependListener === "function")
27699
- return emitter.prependListener(event, fn);
27699
+ return emitter.prependListener(event, fn2);
27700
27700
  if (!emitter._events || !emitter._events[event])
27701
- emitter.on(event, fn);
27701
+ emitter.on(event, fn2);
27702
27702
  else if (Array.isArray(emitter._events[event]))
27703
- emitter._events[event].unshift(fn);
27703
+ emitter._events[event].unshift(fn2);
27704
27704
  else
27705
- emitter._events[event] = [fn, emitter._events[event]];
27705
+ emitter._events[event] = [fn2, emitter._events[event]];
27706
27706
  }
27707
27707
  function ReadableState(options, stream, isDuplex) {
27708
27708
  Duplex = Duplex || require_stream_duplex();
@@ -27807,11 +27807,11 @@ var require_stream_readable = __commonJS({
27807
27807
  state.reading = false;
27808
27808
  onEofChunk(stream, state);
27809
27809
  } else {
27810
- var er2;
27810
+ var er;
27811
27811
  if (!skipChunkCheck)
27812
- er2 = chunkInvalid(state, chunk);
27813
- if (er2) {
27814
- errorOrDestroy(stream, er2);
27812
+ er = chunkInvalid(state, chunk);
27813
+ if (er) {
27814
+ errorOrDestroy(stream, er);
27815
27815
  } else if (state.objectMode || chunk && chunk.length > 0) {
27816
27816
  if (typeof chunk !== "string" && !state.objectMode && Object.getPrototypeOf(chunk) !== Buffer2.prototype) {
27817
27817
  chunk = _uint8ArrayToBuffer(chunk);
@@ -27860,11 +27860,11 @@ var require_stream_readable = __commonJS({
27860
27860
  maybeReadMore(stream, state);
27861
27861
  }
27862
27862
  function chunkInvalid(state, chunk) {
27863
- var er2;
27863
+ var er;
27864
27864
  if (!_isUint8Array(chunk) && typeof chunk !== "string" && chunk !== void 0 && !state.objectMode) {
27865
- er2 = new ERR_INVALID_ARG_TYPE("chunk", ["string", "Buffer", "Uint8Array"], chunk);
27865
+ er = new ERR_INVALID_ARG_TYPE("chunk", ["string", "Buffer", "Uint8Array"], chunk);
27866
27866
  }
27867
- return er2;
27867
+ return er;
27868
27868
  }
27869
27869
  Readable.prototype.isPaused = function() {
27870
27870
  return this._readableState.flowing === false;
@@ -28113,12 +28113,12 @@ var require_stream_readable = __commonJS({
28113
28113
  src.pause();
28114
28114
  }
28115
28115
  }
28116
- function onerror(er2) {
28117
- debug("onerror", er2);
28116
+ function onerror(er) {
28117
+ debug("onerror", er);
28118
28118
  unpipe();
28119
28119
  dest.removeListener("error", onerror);
28120
28120
  if (EElistenerCount(dest, "error") === 0)
28121
- errorOrDestroy(dest, er2);
28121
+ errorOrDestroy(dest, er);
28122
28122
  }
28123
28123
  prependListener(dest, "error", onerror);
28124
28124
  function onclose() {
@@ -28196,8 +28196,8 @@ var require_stream_readable = __commonJS({
28196
28196
  dest.emit("unpipe", this, unpipeInfo);
28197
28197
  return this;
28198
28198
  };
28199
- Readable.prototype.on = function(ev, fn) {
28200
- var res = Stream.prototype.on.call(this, ev, fn);
28199
+ Readable.prototype.on = function(ev, fn2) {
28200
+ var res = Stream.prototype.on.call(this, ev, fn2);
28201
28201
  var state = this._readableState;
28202
28202
  if (ev === "data") {
28203
28203
  state.readableListening = this.listenerCount("readable") > 0;
@@ -28219,8 +28219,8 @@ var require_stream_readable = __commonJS({
28219
28219
  return res;
28220
28220
  };
28221
28221
  Readable.prototype.addListener = Readable.prototype.on;
28222
- Readable.prototype.removeListener = function(ev, fn) {
28223
- var res = Stream.prototype.removeListener.call(this, ev, fn);
28222
+ Readable.prototype.removeListener = function(ev, fn2) {
28223
+ var res = Stream.prototype.removeListener.call(this, ev, fn2);
28224
28224
  if (ev === "readable") {
28225
28225
  process.nextTick(updateReadableListening, this);
28226
28226
  }
@@ -28612,8 +28612,8 @@ var require_stream_writable = __commonJS({
28612
28612
  this.corked = 0;
28613
28613
  this.sync = true;
28614
28614
  this.bufferProcessing = false;
28615
- this.onwrite = function(er2) {
28616
- onwrite(stream, er2);
28615
+ this.onwrite = function(er) {
28616
+ onwrite(stream, er);
28617
28617
  };
28618
28618
  this.writecb = null;
28619
28619
  this.writelen = 0;
@@ -28686,20 +28686,20 @@ var require_stream_writable = __commonJS({
28686
28686
  errorOrDestroy(this, new ERR_STREAM_CANNOT_PIPE());
28687
28687
  };
28688
28688
  function writeAfterEnd(stream, cb) {
28689
- var er2 = new ERR_STREAM_WRITE_AFTER_END();
28690
- errorOrDestroy(stream, er2);
28691
- process.nextTick(cb, er2);
28689
+ var er = new ERR_STREAM_WRITE_AFTER_END();
28690
+ errorOrDestroy(stream, er);
28691
+ process.nextTick(cb, er);
28692
28692
  }
28693
28693
  function validChunk(stream, state, chunk, cb) {
28694
- var er2;
28694
+ var er;
28695
28695
  if (chunk === null) {
28696
- er2 = new ERR_STREAM_NULL_VALUES();
28696
+ er = new ERR_STREAM_NULL_VALUES();
28697
28697
  } else if (typeof chunk !== "string" && !state.objectMode) {
28698
- er2 = new ERR_INVALID_ARG_TYPE("chunk", ["string", "Buffer"], chunk);
28698
+ er = new ERR_INVALID_ARG_TYPE("chunk", ["string", "Buffer"], chunk);
28699
28699
  }
28700
- if (er2) {
28701
- errorOrDestroy(stream, er2);
28702
- process.nextTick(cb, er2);
28700
+ if (er) {
28701
+ errorOrDestroy(stream, er);
28702
+ process.nextTick(cb, er);
28703
28703
  return false;
28704
28704
  }
28705
28705
  return true;
@@ -28819,17 +28819,17 @@ var require_stream_writable = __commonJS({
28819
28819
  stream._write(chunk, encoding, state.onwrite);
28820
28820
  state.sync = false;
28821
28821
  }
28822
- function onwriteError(stream, state, sync, er2, cb) {
28822
+ function onwriteError(stream, state, sync, er, cb) {
28823
28823
  --state.pendingcb;
28824
28824
  if (sync) {
28825
- process.nextTick(cb, er2);
28825
+ process.nextTick(cb, er);
28826
28826
  process.nextTick(finishMaybe, stream, state);
28827
28827
  stream._writableState.errorEmitted = true;
28828
- errorOrDestroy(stream, er2);
28828
+ errorOrDestroy(stream, er);
28829
28829
  } else {
28830
- cb(er2);
28830
+ cb(er);
28831
28831
  stream._writableState.errorEmitted = true;
28832
- errorOrDestroy(stream, er2);
28832
+ errorOrDestroy(stream, er);
28833
28833
  finishMaybe(stream, state);
28834
28834
  }
28835
28835
  }
@@ -28839,15 +28839,15 @@ var require_stream_writable = __commonJS({
28839
28839
  state.length -= state.writelen;
28840
28840
  state.writelen = 0;
28841
28841
  }
28842
- function onwrite(stream, er2) {
28842
+ function onwrite(stream, er) {
28843
28843
  var state = stream._writableState;
28844
28844
  var sync = state.sync;
28845
28845
  var cb = state.writecb;
28846
28846
  if (typeof cb !== "function")
28847
28847
  throw new ERR_MULTIPLE_CALLBACK();
28848
28848
  onwriteStateUpdate(state);
28849
- if (er2)
28850
- onwriteError(stream, state, sync, er2, cb);
28849
+ if (er)
28850
+ onwriteError(stream, state, sync, er, cb);
28851
28851
  else {
28852
28852
  var finished = needFinish(state) || stream.destroyed;
28853
28853
  if (!finished && !state.corked && !state.bufferProcessing && state.bufferedRequest) {
@@ -29337,10 +29337,10 @@ var require_initialParams2 = __commonJS({
29337
29337
  Object.defineProperty(exports, "__esModule", {
29338
29338
  value: true
29339
29339
  });
29340
- exports.default = function(fn) {
29340
+ exports.default = function(fn2) {
29341
29341
  return function(...args) {
29342
29342
  var callback = args.pop();
29343
- return fn.call(this, args, callback);
29343
+ return fn2.call(this, args, callback);
29344
29344
  };
29345
29345
  };
29346
29346
  module2.exports = exports.default;
@@ -29359,11 +29359,11 @@ var require_setImmediate2 = __commonJS({
29359
29359
  var hasQueueMicrotask = exports.hasQueueMicrotask = typeof queueMicrotask === "function" && queueMicrotask;
29360
29360
  var hasSetImmediate = exports.hasSetImmediate = typeof setImmediate === "function" && setImmediate;
29361
29361
  var hasNextTick = exports.hasNextTick = typeof process === "object" && typeof process.nextTick === "function";
29362
- function fallback(fn) {
29363
- setTimeout(fn, 0);
29362
+ function fallback(fn2) {
29363
+ setTimeout(fn2, 0);
29364
29364
  }
29365
29365
  function wrap(defer) {
29366
- return (fn, ...args) => defer(() => fn(...args));
29366
+ return (fn2, ...args) => defer(() => fn2(...args));
29367
29367
  }
29368
29368
  var _defer;
29369
29369
  if (hasQueueMicrotask) {
@@ -29450,11 +29450,11 @@ var require_wrapAsync2 = __commonJS({
29450
29450
  function _interopRequireDefault(obj) {
29451
29451
  return obj && obj.__esModule ? obj : { default: obj };
29452
29452
  }
29453
- function isAsync(fn) {
29454
- return fn[Symbol.toStringTag] === "AsyncFunction";
29453
+ function isAsync(fn2) {
29454
+ return fn2[Symbol.toStringTag] === "AsyncFunction";
29455
29455
  }
29456
- function isAsyncGenerator(fn) {
29457
- return fn[Symbol.toStringTag] === "AsyncGenerator";
29456
+ function isAsyncGenerator(fn2) {
29457
+ return fn2[Symbol.toStringTag] === "AsyncGenerator";
29458
29458
  }
29459
29459
  function isAsyncIterable(obj) {
29460
29460
  return typeof obj[Symbol.asyncIterator] === "function";
@@ -29543,15 +29543,15 @@ var require_once2 = __commonJS({
29543
29543
  value: true
29544
29544
  });
29545
29545
  exports.default = once;
29546
- function once(fn) {
29546
+ function once(fn2) {
29547
29547
  function wrapper(...args) {
29548
- if (fn === null)
29548
+ if (fn2 === null)
29549
29549
  return;
29550
- var callFn = fn;
29551
- fn = null;
29550
+ var callFn = fn2;
29551
+ fn2 = null;
29552
29552
  callFn.apply(this, args);
29553
29553
  }
29554
- Object.assign(wrapper, fn);
29554
+ Object.assign(wrapper, fn2);
29555
29555
  return wrapper;
29556
29556
  }
29557
29557
  module2.exports = exports.default;
@@ -29635,12 +29635,12 @@ var require_onlyOnce2 = __commonJS({
29635
29635
  value: true
29636
29636
  });
29637
29637
  exports.default = onlyOnce;
29638
- function onlyOnce(fn) {
29638
+ function onlyOnce(fn2) {
29639
29639
  return function(...args) {
29640
- if (fn === null)
29640
+ if (fn2 === null)
29641
29641
  throw new Error("Callback was already called.");
29642
- var callFn = fn;
29643
- fn = null;
29642
+ var callFn = fn2;
29643
+ fn2 = null;
29644
29644
  callFn.apply(this, args);
29645
29645
  };
29646
29646
  }
@@ -30435,8 +30435,8 @@ var require_stream_writable2 = __commonJS({
30435
30435
  this.corked = 0;
30436
30436
  this.sync = true;
30437
30437
  this.bufferProcessing = false;
30438
- this.onwrite = function(er2) {
30439
- onwrite(stream, er2);
30438
+ this.onwrite = function(er) {
30439
+ onwrite(stream, er);
30440
30440
  };
30441
30441
  this.writecb = null;
30442
30442
  this.writelen = 0;
@@ -30509,20 +30509,20 @@ var require_stream_writable2 = __commonJS({
30509
30509
  errorOrDestroy(this, new ERR_STREAM_CANNOT_PIPE());
30510
30510
  };
30511
30511
  function writeAfterEnd(stream, cb) {
30512
- var er2 = new ERR_STREAM_WRITE_AFTER_END();
30513
- errorOrDestroy(stream, er2);
30514
- process.nextTick(cb, er2);
30512
+ var er = new ERR_STREAM_WRITE_AFTER_END();
30513
+ errorOrDestroy(stream, er);
30514
+ process.nextTick(cb, er);
30515
30515
  }
30516
30516
  function validChunk(stream, state, chunk, cb) {
30517
- var er2;
30517
+ var er;
30518
30518
  if (chunk === null) {
30519
- er2 = new ERR_STREAM_NULL_VALUES();
30519
+ er = new ERR_STREAM_NULL_VALUES();
30520
30520
  } else if (typeof chunk !== "string" && !state.objectMode) {
30521
- er2 = new ERR_INVALID_ARG_TYPE("chunk", ["string", "Buffer"], chunk);
30521
+ er = new ERR_INVALID_ARG_TYPE("chunk", ["string", "Buffer"], chunk);
30522
30522
  }
30523
- if (er2) {
30524
- errorOrDestroy(stream, er2);
30525
- process.nextTick(cb, er2);
30523
+ if (er) {
30524
+ errorOrDestroy(stream, er);
30525
+ process.nextTick(cb, er);
30526
30526
  return false;
30527
30527
  }
30528
30528
  return true;
@@ -30642,17 +30642,17 @@ var require_stream_writable2 = __commonJS({
30642
30642
  stream._write(chunk, encoding, state.onwrite);
30643
30643
  state.sync = false;
30644
30644
  }
30645
- function onwriteError(stream, state, sync, er2, cb) {
30645
+ function onwriteError(stream, state, sync, er, cb) {
30646
30646
  --state.pendingcb;
30647
30647
  if (sync) {
30648
- process.nextTick(cb, er2);
30648
+ process.nextTick(cb, er);
30649
30649
  process.nextTick(finishMaybe, stream, state);
30650
30650
  stream._writableState.errorEmitted = true;
30651
- errorOrDestroy(stream, er2);
30651
+ errorOrDestroy(stream, er);
30652
30652
  } else {
30653
- cb(er2);
30653
+ cb(er);
30654
30654
  stream._writableState.errorEmitted = true;
30655
- errorOrDestroy(stream, er2);
30655
+ errorOrDestroy(stream, er);
30656
30656
  finishMaybe(stream, state);
30657
30657
  }
30658
30658
  }
@@ -30662,15 +30662,15 @@ var require_stream_writable2 = __commonJS({
30662
30662
  state.length -= state.writelen;
30663
30663
  state.writelen = 0;
30664
30664
  }
30665
- function onwrite(stream, er2) {
30665
+ function onwrite(stream, er) {
30666
30666
  var state = stream._writableState;
30667
30667
  var sync = state.sync;
30668
30668
  var cb = state.writecb;
30669
30669
  if (typeof cb !== "function")
30670
30670
  throw new ERR_MULTIPLE_CALLBACK();
30671
30671
  onwriteStateUpdate(state);
30672
- if (er2)
30673
- onwriteError(stream, state, sync, er2, cb);
30672
+ if (er)
30673
+ onwriteError(stream, state, sync, er, cb);
30674
30674
  else {
30675
30675
  var finished = needFinish(state) || stream.destroyed;
30676
30676
  if (!finished && !state.corked && !state.bufferProcessing && state.bufferedRequest) {
@@ -31271,11 +31271,11 @@ var require_from2 = __commonJS({
31271
31271
  Promise.resolve(value).then(_next, _throw);
31272
31272
  }
31273
31273
  }
31274
- function _asyncToGenerator(fn) {
31274
+ function _asyncToGenerator(fn2) {
31275
31275
  return function() {
31276
31276
  var self2 = this, args = arguments;
31277
31277
  return new Promise(function(resolve, reject) {
31278
- var gen = fn.apply(self2, args);
31278
+ var gen = fn2.apply(self2, args);
31279
31279
  function _next(value) {
31280
31280
  asyncGeneratorStep(gen, resolve, reject, _next, _throw, "next", value);
31281
31281
  }
@@ -31423,15 +31423,15 @@ var require_stream_readable2 = __commonJS({
31423
31423
  require_inherits()(Readable, Stream);
31424
31424
  var errorOrDestroy = destroyImpl.errorOrDestroy;
31425
31425
  var kProxyEvents = ["error", "close", "destroy", "pause", "resume"];
31426
- function prependListener(emitter, event, fn) {
31426
+ function prependListener(emitter, event, fn2) {
31427
31427
  if (typeof emitter.prependListener === "function")
31428
- return emitter.prependListener(event, fn);
31428
+ return emitter.prependListener(event, fn2);
31429
31429
  if (!emitter._events || !emitter._events[event])
31430
- emitter.on(event, fn);
31430
+ emitter.on(event, fn2);
31431
31431
  else if (Array.isArray(emitter._events[event]))
31432
- emitter._events[event].unshift(fn);
31432
+ emitter._events[event].unshift(fn2);
31433
31433
  else
31434
- emitter._events[event] = [fn, emitter._events[event]];
31434
+ emitter._events[event] = [fn2, emitter._events[event]];
31435
31435
  }
31436
31436
  function ReadableState(options, stream, isDuplex) {
31437
31437
  Duplex = Duplex || require_stream_duplex2();
@@ -31536,11 +31536,11 @@ var require_stream_readable2 = __commonJS({
31536
31536
  state.reading = false;
31537
31537
  onEofChunk(stream, state);
31538
31538
  } else {
31539
- var er2;
31539
+ var er;
31540
31540
  if (!skipChunkCheck)
31541
- er2 = chunkInvalid(state, chunk);
31542
- if (er2) {
31543
- errorOrDestroy(stream, er2);
31541
+ er = chunkInvalid(state, chunk);
31542
+ if (er) {
31543
+ errorOrDestroy(stream, er);
31544
31544
  } else if (state.objectMode || chunk && chunk.length > 0) {
31545
31545
  if (typeof chunk !== "string" && !state.objectMode && Object.getPrototypeOf(chunk) !== Buffer2.prototype) {
31546
31546
  chunk = _uint8ArrayToBuffer(chunk);
@@ -31589,11 +31589,11 @@ var require_stream_readable2 = __commonJS({
31589
31589
  maybeReadMore(stream, state);
31590
31590
  }
31591
31591
  function chunkInvalid(state, chunk) {
31592
- var er2;
31592
+ var er;
31593
31593
  if (!_isUint8Array(chunk) && typeof chunk !== "string" && chunk !== void 0 && !state.objectMode) {
31594
- er2 = new ERR_INVALID_ARG_TYPE("chunk", ["string", "Buffer", "Uint8Array"], chunk);
31594
+ er = new ERR_INVALID_ARG_TYPE("chunk", ["string", "Buffer", "Uint8Array"], chunk);
31595
31595
  }
31596
- return er2;
31596
+ return er;
31597
31597
  }
31598
31598
  Readable.prototype.isPaused = function() {
31599
31599
  return this._readableState.flowing === false;
@@ -31842,12 +31842,12 @@ var require_stream_readable2 = __commonJS({
31842
31842
  src.pause();
31843
31843
  }
31844
31844
  }
31845
- function onerror(er2) {
31846
- debug("onerror", er2);
31845
+ function onerror(er) {
31846
+ debug("onerror", er);
31847
31847
  unpipe();
31848
31848
  dest.removeListener("error", onerror);
31849
31849
  if (EElistenerCount(dest, "error") === 0)
31850
- errorOrDestroy(dest, er2);
31850
+ errorOrDestroy(dest, er);
31851
31851
  }
31852
31852
  prependListener(dest, "error", onerror);
31853
31853
  function onclose() {
@@ -31925,8 +31925,8 @@ var require_stream_readable2 = __commonJS({
31925
31925
  dest.emit("unpipe", this, unpipeInfo);
31926
31926
  return this;
31927
31927
  };
31928
- Readable.prototype.on = function(ev, fn) {
31929
- var res = Stream.prototype.on.call(this, ev, fn);
31928
+ Readable.prototype.on = function(ev, fn2) {
31929
+ var res = Stream.prototype.on.call(this, ev, fn2);
31930
31930
  var state = this._readableState;
31931
31931
  if (ev === "data") {
31932
31932
  state.readableListening = this.listenerCount("readable") > 0;
@@ -31948,8 +31948,8 @@ var require_stream_readable2 = __commonJS({
31948
31948
  return res;
31949
31949
  };
31950
31950
  Readable.prototype.addListener = Readable.prototype.on;
31951
- Readable.prototype.removeListener = function(ev, fn) {
31952
- var res = Stream.prototype.removeListener.call(this, ev, fn);
31951
+ Readable.prototype.removeListener = function(ev, fn2) {
31952
+ var res = Stream.prototype.removeListener.call(this, ev, fn2);
31953
31953
  if (ev === "readable") {
31954
31954
  process.nextTick(updateReadableListening, this);
31955
31955
  }
@@ -32187,7 +32187,7 @@ var require_stream_transform = __commonJS({
32187
32187
  var ERR_TRANSFORM_WITH_LENGTH_0 = _require$codes.ERR_TRANSFORM_WITH_LENGTH_0;
32188
32188
  var Duplex = require_stream_duplex2();
32189
32189
  require_inherits()(Transform, Duplex);
32190
- function afterTransform(er2, data) {
32190
+ function afterTransform(er, data) {
32191
32191
  var ts = this._transformState;
32192
32192
  ts.transforming = false;
32193
32193
  var cb = ts.writecb;
@@ -32198,7 +32198,7 @@ var require_stream_transform = __commonJS({
32198
32198
  ts.writecb = null;
32199
32199
  if (data != null)
32200
32200
  this.push(data);
32201
- cb(er2);
32201
+ cb(er);
32202
32202
  var rs = this._readableState;
32203
32203
  rs.reading = false;
32204
32204
  if (rs.needReadable || rs.length < rs.highWaterMark) {
@@ -32230,8 +32230,8 @@ var require_stream_transform = __commonJS({
32230
32230
  function prefinish() {
32231
32231
  var _this = this;
32232
32232
  if (typeof this._flush === "function" && !this._readableState.destroyed) {
32233
- this._flush(function(er2, data) {
32234
- done(_this, er2, data);
32233
+ this._flush(function(er, data) {
32234
+ done(_this, er, data);
32235
32235
  });
32236
32236
  } else {
32237
32237
  done(this, null, null);
@@ -32269,9 +32269,9 @@ var require_stream_transform = __commonJS({
32269
32269
  cb(err2);
32270
32270
  });
32271
32271
  };
32272
- function done(stream, er2, data) {
32273
- if (er2)
32274
- return stream.emit("error", er2);
32272
+ function done(stream, er, data) {
32273
+ if (er)
32274
+ return stream.emit("error", er);
32275
32275
  if (data != null)
32276
32276
  stream.push(data);
32277
32277
  if (stream._writableState.length)
@@ -32356,11 +32356,11 @@ var require_pipeline = __commonJS({
32356
32356
  callback(err || new ERR_STREAM_DESTROYED("pipe"));
32357
32357
  };
32358
32358
  }
32359
- function call(fn) {
32360
- fn();
32359
+ function call(fn2) {
32360
+ fn2();
32361
32361
  }
32362
- function pipe(from, to2) {
32363
- return from.pipe(to2);
32362
+ function pipe(from, to) {
32363
+ return from.pipe(to);
32364
32364
  }
32365
32365
  function popCallback(streams) {
32366
32366
  if (!streams.length)
@@ -32454,18 +32454,18 @@ var require_diagnostics = __commonJS({
32454
32454
  return false;
32455
32455
  return new Promise(function pinky(resolve) {
32456
32456
  Promise.all(
32457
- async.map(function prebind(fn) {
32458
- return fn(namespace);
32457
+ async.map(function prebind(fn2) {
32458
+ return fn2(namespace);
32459
32459
  })
32460
32460
  ).then(function resolved(values) {
32461
32461
  resolve(values.some(Boolean));
32462
32462
  });
32463
32463
  });
32464
32464
  }
32465
- function modify(fn) {
32466
- if (~modifiers.indexOf(fn))
32465
+ function modify(fn2) {
32466
+ if (~modifiers.indexOf(fn2))
32467
32467
  return false;
32468
- modifiers.push(fn);
32468
+ modifiers.push(fn2);
32469
32469
  return true;
32470
32470
  }
32471
32471
  function write() {
@@ -32477,14 +32477,14 @@ var require_diagnostics = __commonJS({
32477
32477
  }
32478
32478
  return message;
32479
32479
  }
32480
- function introduce(fn, options) {
32480
+ function introduce(fn2, options) {
32481
32481
  var has = Object.prototype.hasOwnProperty;
32482
32482
  for (var key in options) {
32483
32483
  if (has.call(options, key)) {
32484
- fn[key] = options[key];
32484
+ fn2[key] = options[key];
32485
32485
  }
32486
32486
  }
32487
- return fn;
32487
+ return fn2;
32488
32488
  }
32489
32489
  function nope(options) {
32490
32490
  options.enabled = false;
@@ -32729,9 +32729,9 @@ var require_simple_swizzle = __commonJS({
32729
32729
  }
32730
32730
  return results;
32731
32731
  };
32732
- swizzle.wrap = function(fn) {
32732
+ swizzle.wrap = function(fn2) {
32733
32733
  return function() {
32734
- return fn(swizzle(arguments));
32734
+ return fn2(swizzle(arguments));
32735
32735
  };
32736
32736
  };
32737
32737
  }
@@ -32894,9 +32894,9 @@ var require_color_string = __commonJS({
32894
32894
  cs.to.rgb.percent = function() {
32895
32895
  var rgba = swizzle(arguments);
32896
32896
  var r4 = Math.round(rgba[0] / 255 * 100);
32897
- var g2 = Math.round(rgba[1] / 255 * 100);
32897
+ var g3 = Math.round(rgba[1] / 255 * 100);
32898
32898
  var b2 = Math.round(rgba[2] / 255 * 100);
32899
- return rgba.length < 4 || rgba[3] === 1 ? "rgb(" + r4 + "%, " + g2 + "%, " + b2 + "%)" : "rgba(" + r4 + "%, " + g2 + "%, " + b2 + "%, " + rgba[3] + ")";
32899
+ return rgba.length < 4 || rgba[3] === 1 ? "rgb(" + r4 + "%, " + g3 + "%, " + b2 + "%)" : "rgba(" + r4 + "%, " + g3 + "%, " + b2 + "%, " + rgba[3] + ")";
32900
32900
  };
32901
32901
  cs.to.hsl = function() {
32902
32902
  var hsla = swizzle(arguments);
@@ -32976,10 +32976,10 @@ var require_conversions = __commonJS({
32976
32976
  var model;
32977
32977
  convert.rgb.hsl = function(rgb) {
32978
32978
  var r4 = rgb[0] / 255;
32979
- var g2 = rgb[1] / 255;
32979
+ var g3 = rgb[1] / 255;
32980
32980
  var b2 = rgb[2] / 255;
32981
- var min = Math.min(r4, g2, b2);
32982
- var max = Math.max(r4, g2, b2);
32981
+ var min = Math.min(r4, g3, b2);
32982
+ var max = Math.max(r4, g3, b2);
32983
32983
  var delta = max - min;
32984
32984
  var h3;
32985
32985
  var s;
@@ -32987,11 +32987,11 @@ var require_conversions = __commonJS({
32987
32987
  if (max === min) {
32988
32988
  h3 = 0;
32989
32989
  } else if (r4 === max) {
32990
- h3 = (g2 - b2) / delta;
32991
- } else if (g2 === max) {
32990
+ h3 = (g3 - b2) / delta;
32991
+ } else if (g3 === max) {
32992
32992
  h3 = 2 + (b2 - r4) / delta;
32993
32993
  } else if (b2 === max) {
32994
- h3 = 4 + (r4 - g2) / delta;
32994
+ h3 = 4 + (r4 - g3) / delta;
32995
32995
  }
32996
32996
  h3 = Math.min(h3 * 60, 360);
32997
32997
  if (h3 < 0) {
@@ -33014,10 +33014,10 @@ var require_conversions = __commonJS({
33014
33014
  var h3;
33015
33015
  var s;
33016
33016
  var r4 = rgb[0] / 255;
33017
- var g2 = rgb[1] / 255;
33017
+ var g3 = rgb[1] / 255;
33018
33018
  var b2 = rgb[2] / 255;
33019
- var v3 = Math.max(r4, g2, b2);
33020
- var diff = v3 - Math.min(r4, g2, b2);
33019
+ var v3 = Math.max(r4, g3, b2);
33020
+ var diff = v3 - Math.min(r4, g3, b2);
33021
33021
  var diffc = function(c3) {
33022
33022
  return (v3 - c3) / 6 / diff + 1 / 2;
33023
33023
  };
@@ -33026,11 +33026,11 @@ var require_conversions = __commonJS({
33026
33026
  } else {
33027
33027
  s = diff / v3;
33028
33028
  rdif = diffc(r4);
33029
- gdif = diffc(g2);
33029
+ gdif = diffc(g3);
33030
33030
  bdif = diffc(b2);
33031
33031
  if (r4 === v3) {
33032
33032
  h3 = bdif - gdif;
33033
- } else if (g2 === v3) {
33033
+ } else if (g3 === v3) {
33034
33034
  h3 = 1 / 3 + rdif - bdif;
33035
33035
  } else if (b2 === v3) {
33036
33036
  h3 = 2 / 3 + gdif - rdif;
@@ -33049,24 +33049,24 @@ var require_conversions = __commonJS({
33049
33049
  };
33050
33050
  convert.rgb.hwb = function(rgb) {
33051
33051
  var r4 = rgb[0];
33052
- var g2 = rgb[1];
33052
+ var g3 = rgb[1];
33053
33053
  var b2 = rgb[2];
33054
33054
  var h3 = convert.rgb.hsl(rgb)[0];
33055
- var w2 = 1 / 255 * Math.min(r4, Math.min(g2, b2));
33056
- b2 = 1 - 1 / 255 * Math.max(r4, Math.max(g2, b2));
33055
+ var w2 = 1 / 255 * Math.min(r4, Math.min(g3, b2));
33056
+ b2 = 1 - 1 / 255 * Math.max(r4, Math.max(g3, b2));
33057
33057
  return [h3, w2 * 100, b2 * 100];
33058
33058
  };
33059
33059
  convert.rgb.cmyk = function(rgb) {
33060
33060
  var r4 = rgb[0] / 255;
33061
- var g2 = rgb[1] / 255;
33061
+ var g3 = rgb[1] / 255;
33062
33062
  var b2 = rgb[2] / 255;
33063
33063
  var c3;
33064
33064
  var m3;
33065
33065
  var y;
33066
33066
  var k2;
33067
- k2 = Math.min(1 - r4, 1 - g2, 1 - b2);
33067
+ k2 = Math.min(1 - r4, 1 - g3, 1 - b2);
33068
33068
  c3 = (1 - r4 - k2) / (1 - k2) || 0;
33069
- m3 = (1 - g2 - k2) / (1 - k2) || 0;
33069
+ m3 = (1 - g3 - k2) / (1 - k2) || 0;
33070
33070
  y = (1 - b2 - k2) / (1 - k2) || 0;
33071
33071
  return [c3 * 100, m3 * 100, y * 100, k2 * 100];
33072
33072
  };
@@ -33097,33 +33097,33 @@ var require_conversions = __commonJS({
33097
33097
  };
33098
33098
  convert.rgb.xyz = function(rgb) {
33099
33099
  var r4 = rgb[0] / 255;
33100
- var g2 = rgb[1] / 255;
33100
+ var g3 = rgb[1] / 255;
33101
33101
  var b2 = rgb[2] / 255;
33102
33102
  r4 = r4 > 0.04045 ? Math.pow((r4 + 0.055) / 1.055, 2.4) : r4 / 12.92;
33103
- g2 = g2 > 0.04045 ? Math.pow((g2 + 0.055) / 1.055, 2.4) : g2 / 12.92;
33103
+ g3 = g3 > 0.04045 ? Math.pow((g3 + 0.055) / 1.055, 2.4) : g3 / 12.92;
33104
33104
  b2 = b2 > 0.04045 ? Math.pow((b2 + 0.055) / 1.055, 2.4) : b2 / 12.92;
33105
- var x = r4 * 0.4124 + g2 * 0.3576 + b2 * 0.1805;
33106
- var y = r4 * 0.2126 + g2 * 0.7152 + b2 * 0.0722;
33107
- var z = r4 * 0.0193 + g2 * 0.1192 + b2 * 0.9505;
33108
- return [x * 100, y * 100, z * 100];
33105
+ var x = r4 * 0.4124 + g3 * 0.3576 + b2 * 0.1805;
33106
+ var y = r4 * 0.2126 + g3 * 0.7152 + b2 * 0.0722;
33107
+ var z2 = r4 * 0.0193 + g3 * 0.1192 + b2 * 0.9505;
33108
+ return [x * 100, y * 100, z2 * 100];
33109
33109
  };
33110
33110
  convert.rgb.lab = function(rgb) {
33111
33111
  var xyz = convert.rgb.xyz(rgb);
33112
33112
  var x = xyz[0];
33113
33113
  var y = xyz[1];
33114
- var z = xyz[2];
33114
+ var z2 = xyz[2];
33115
33115
  var l2;
33116
33116
  var a;
33117
33117
  var b2;
33118
33118
  x /= 95.047;
33119
33119
  y /= 100;
33120
- z /= 108.883;
33120
+ z2 /= 108.883;
33121
33121
  x = x > 8856e-6 ? Math.pow(x, 1 / 3) : 7.787 * x + 16 / 116;
33122
33122
  y = y > 8856e-6 ? Math.pow(y, 1 / 3) : 7.787 * y + 16 / 116;
33123
- z = z > 8856e-6 ? Math.pow(z, 1 / 3) : 7.787 * z + 16 / 116;
33123
+ z2 = z2 > 8856e-6 ? Math.pow(z2, 1 / 3) : 7.787 * z2 + 16 / 116;
33124
33124
  l2 = 116 * y - 16;
33125
33125
  a = 500 * (x - y);
33126
- b2 = 200 * (y - z);
33126
+ b2 = 200 * (y - z2);
33127
33127
  return [l2, a, b2];
33128
33128
  };
33129
33129
  convert.hsl.rgb = function(hsl) {
@@ -33244,43 +33244,43 @@ var require_conversions = __commonJS({
33244
33244
  }
33245
33245
  n = wh + f * (v3 - wh);
33246
33246
  var r4;
33247
- var g2;
33247
+ var g3;
33248
33248
  var b2;
33249
33249
  switch (i2) {
33250
33250
  default:
33251
33251
  case 6:
33252
33252
  case 0:
33253
33253
  r4 = v3;
33254
- g2 = n;
33254
+ g3 = n;
33255
33255
  b2 = wh;
33256
33256
  break;
33257
33257
  case 1:
33258
33258
  r4 = n;
33259
- g2 = v3;
33259
+ g3 = v3;
33260
33260
  b2 = wh;
33261
33261
  break;
33262
33262
  case 2:
33263
33263
  r4 = wh;
33264
- g2 = v3;
33264
+ g3 = v3;
33265
33265
  b2 = n;
33266
33266
  break;
33267
33267
  case 3:
33268
33268
  r4 = wh;
33269
- g2 = n;
33269
+ g3 = n;
33270
33270
  b2 = v3;
33271
33271
  break;
33272
33272
  case 4:
33273
33273
  r4 = n;
33274
- g2 = wh;
33274
+ g3 = wh;
33275
33275
  b2 = v3;
33276
33276
  break;
33277
33277
  case 5:
33278
33278
  r4 = v3;
33279
- g2 = wh;
33279
+ g3 = wh;
33280
33280
  b2 = n;
33281
33281
  break;
33282
33282
  }
33283
- return [r4 * 255, g2 * 255, b2 * 255];
33283
+ return [r4 * 255, g3 * 255, b2 * 255];
33284
33284
  };
33285
33285
  convert.cmyk.rgb = function(cmyk) {
33286
33286
  var c3 = cmyk[0] / 100;
@@ -33288,47 +33288,47 @@ var require_conversions = __commonJS({
33288
33288
  var y = cmyk[2] / 100;
33289
33289
  var k2 = cmyk[3] / 100;
33290
33290
  var r4;
33291
- var g2;
33291
+ var g3;
33292
33292
  var b2;
33293
33293
  r4 = 1 - Math.min(1, c3 * (1 - k2) + k2);
33294
- g2 = 1 - Math.min(1, m3 * (1 - k2) + k2);
33294
+ g3 = 1 - Math.min(1, m3 * (1 - k2) + k2);
33295
33295
  b2 = 1 - Math.min(1, y * (1 - k2) + k2);
33296
- return [r4 * 255, g2 * 255, b2 * 255];
33296
+ return [r4 * 255, g3 * 255, b2 * 255];
33297
33297
  };
33298
33298
  convert.xyz.rgb = function(xyz) {
33299
33299
  var x = xyz[0] / 100;
33300
33300
  var y = xyz[1] / 100;
33301
- var z = xyz[2] / 100;
33301
+ var z2 = xyz[2] / 100;
33302
33302
  var r4;
33303
- var g2;
33303
+ var g3;
33304
33304
  var b2;
33305
- r4 = x * 3.2406 + y * -1.5372 + z * -0.4986;
33306
- g2 = x * -0.9689 + y * 1.8758 + z * 0.0415;
33307
- b2 = x * 0.0557 + y * -0.204 + z * 1.057;
33305
+ r4 = x * 3.2406 + y * -1.5372 + z2 * -0.4986;
33306
+ g3 = x * -0.9689 + y * 1.8758 + z2 * 0.0415;
33307
+ b2 = x * 0.0557 + y * -0.204 + z2 * 1.057;
33308
33308
  r4 = r4 > 31308e-7 ? 1.055 * Math.pow(r4, 1 / 2.4) - 0.055 : r4 * 12.92;
33309
- g2 = g2 > 31308e-7 ? 1.055 * Math.pow(g2, 1 / 2.4) - 0.055 : g2 * 12.92;
33309
+ g3 = g3 > 31308e-7 ? 1.055 * Math.pow(g3, 1 / 2.4) - 0.055 : g3 * 12.92;
33310
33310
  b2 = b2 > 31308e-7 ? 1.055 * Math.pow(b2, 1 / 2.4) - 0.055 : b2 * 12.92;
33311
33311
  r4 = Math.min(Math.max(0, r4), 1);
33312
- g2 = Math.min(Math.max(0, g2), 1);
33312
+ g3 = Math.min(Math.max(0, g3), 1);
33313
33313
  b2 = Math.min(Math.max(0, b2), 1);
33314
- return [r4 * 255, g2 * 255, b2 * 255];
33314
+ return [r4 * 255, g3 * 255, b2 * 255];
33315
33315
  };
33316
33316
  convert.xyz.lab = function(xyz) {
33317
33317
  var x = xyz[0];
33318
33318
  var y = xyz[1];
33319
- var z = xyz[2];
33319
+ var z2 = xyz[2];
33320
33320
  var l2;
33321
33321
  var a;
33322
33322
  var b2;
33323
33323
  x /= 95.047;
33324
33324
  y /= 100;
33325
- z /= 108.883;
33325
+ z2 /= 108.883;
33326
33326
  x = x > 8856e-6 ? Math.pow(x, 1 / 3) : 7.787 * x + 16 / 116;
33327
33327
  y = y > 8856e-6 ? Math.pow(y, 1 / 3) : 7.787 * y + 16 / 116;
33328
- z = z > 8856e-6 ? Math.pow(z, 1 / 3) : 7.787 * z + 16 / 116;
33328
+ z2 = z2 > 8856e-6 ? Math.pow(z2, 1 / 3) : 7.787 * z2 + 16 / 116;
33329
33329
  l2 = 116 * y - 16;
33330
33330
  a = 500 * (x - y);
33331
- b2 = 200 * (y - z);
33331
+ b2 = 200 * (y - z2);
33332
33332
  return [l2, a, b2];
33333
33333
  };
33334
33334
  convert.lab.xyz = function(lab) {
@@ -33337,20 +33337,20 @@ var require_conversions = __commonJS({
33337
33337
  var b2 = lab[2];
33338
33338
  var x;
33339
33339
  var y;
33340
- var z;
33340
+ var z2;
33341
33341
  y = (l2 + 16) / 116;
33342
33342
  x = a / 500 + y;
33343
- z = y - b2 / 200;
33343
+ z2 = y - b2 / 200;
33344
33344
  var y2 = Math.pow(y, 3);
33345
33345
  var x2 = Math.pow(x, 3);
33346
- var z2 = Math.pow(z, 3);
33346
+ var z22 = Math.pow(z2, 3);
33347
33347
  y = y2 > 8856e-6 ? y2 : (y - 16 / 116) / 7.787;
33348
33348
  x = x2 > 8856e-6 ? x2 : (x - 16 / 116) / 7.787;
33349
- z = z2 > 8856e-6 ? z2 : (z - 16 / 116) / 7.787;
33349
+ z2 = z22 > 8856e-6 ? z22 : (z2 - 16 / 116) / 7.787;
33350
33350
  x *= 95.047;
33351
33351
  y *= 100;
33352
- z *= 108.883;
33353
- return [x, y, z];
33352
+ z2 *= 108.883;
33353
+ return [x, y, z2];
33354
33354
  };
33355
33355
  convert.lab.lch = function(lab) {
33356
33356
  var l2 = lab[0];
@@ -33381,14 +33381,14 @@ var require_conversions = __commonJS({
33381
33381
  };
33382
33382
  convert.rgb.ansi16 = function(args) {
33383
33383
  var r4 = args[0];
33384
- var g2 = args[1];
33384
+ var g3 = args[1];
33385
33385
  var b2 = args[2];
33386
33386
  var value = 1 in arguments ? arguments[1] : convert.rgb.hsv(args)[2];
33387
33387
  value = Math.round(value / 50);
33388
33388
  if (value === 0) {
33389
33389
  return 30;
33390
33390
  }
33391
- var ansi = 30 + (Math.round(b2 / 255) << 2 | Math.round(g2 / 255) << 1 | Math.round(r4 / 255));
33391
+ var ansi = 30 + (Math.round(b2 / 255) << 2 | Math.round(g3 / 255) << 1 | Math.round(r4 / 255));
33392
33392
  if (value === 2) {
33393
33393
  ansi += 60;
33394
33394
  }
@@ -33399,9 +33399,9 @@ var require_conversions = __commonJS({
33399
33399
  };
33400
33400
  convert.rgb.ansi256 = function(args) {
33401
33401
  var r4 = args[0];
33402
- var g2 = args[1];
33402
+ var g3 = args[1];
33403
33403
  var b2 = args[2];
33404
- if (r4 === g2 && g2 === b2) {
33404
+ if (r4 === g3 && g3 === b2) {
33405
33405
  if (r4 < 8) {
33406
33406
  return 16;
33407
33407
  }
@@ -33410,7 +33410,7 @@ var require_conversions = __commonJS({
33410
33410
  }
33411
33411
  return Math.round((r4 - 8) / 247 * 24) + 232;
33412
33412
  }
33413
- var ansi = 16 + 36 * Math.round(r4 / 255 * 5) + 6 * Math.round(g2 / 255 * 5) + Math.round(b2 / 255 * 5);
33413
+ var ansi = 16 + 36 * Math.round(r4 / 255 * 5) + 6 * Math.round(g3 / 255 * 5) + Math.round(b2 / 255 * 5);
33414
33414
  return ansi;
33415
33415
  };
33416
33416
  convert.ansi16.rgb = function(args) {
@@ -33424,9 +33424,9 @@ var require_conversions = __commonJS({
33424
33424
  }
33425
33425
  var mult = (~~(args > 50) + 1) * 0.5;
33426
33426
  var r4 = (color & 1) * mult * 255;
33427
- var g2 = (color >> 1 & 1) * mult * 255;
33427
+ var g3 = (color >> 1 & 1) * mult * 255;
33428
33428
  var b2 = (color >> 2 & 1) * mult * 255;
33429
- return [r4, g2, b2];
33429
+ return [r4, g3, b2];
33430
33430
  };
33431
33431
  convert.ansi256.rgb = function(args) {
33432
33432
  if (args >= 232) {
@@ -33436,9 +33436,9 @@ var require_conversions = __commonJS({
33436
33436
  args -= 16;
33437
33437
  var rem;
33438
33438
  var r4 = Math.floor(args / 36) / 5 * 255;
33439
- var g2 = Math.floor((rem = args % 36) / 6) / 5 * 255;
33439
+ var g3 = Math.floor((rem = args % 36) / 6) / 5 * 255;
33440
33440
  var b2 = rem % 6 / 5 * 255;
33441
- return [r4, g2, b2];
33441
+ return [r4, g3, b2];
33442
33442
  };
33443
33443
  convert.rgb.hex = function(args) {
33444
33444
  var integer = ((Math.round(args[0]) & 255) << 16) + ((Math.round(args[1]) & 255) << 8) + (Math.round(args[2]) & 255);
@@ -33458,16 +33458,16 @@ var require_conversions = __commonJS({
33458
33458
  }
33459
33459
  var integer = parseInt(colorString, 16);
33460
33460
  var r4 = integer >> 16 & 255;
33461
- var g2 = integer >> 8 & 255;
33461
+ var g3 = integer >> 8 & 255;
33462
33462
  var b2 = integer & 255;
33463
- return [r4, g2, b2];
33463
+ return [r4, g3, b2];
33464
33464
  };
33465
33465
  convert.rgb.hcg = function(rgb) {
33466
33466
  var r4 = rgb[0] / 255;
33467
- var g2 = rgb[1] / 255;
33467
+ var g3 = rgb[1] / 255;
33468
33468
  var b2 = rgb[2] / 255;
33469
- var max = Math.max(Math.max(r4, g2), b2);
33470
- var min = Math.min(Math.min(r4, g2), b2);
33469
+ var max = Math.max(Math.max(r4, g3), b2);
33470
+ var min = Math.min(Math.min(r4, g3), b2);
33471
33471
  var chroma = max - min;
33472
33472
  var grayscale;
33473
33473
  var hue;
@@ -33479,11 +33479,11 @@ var require_conversions = __commonJS({
33479
33479
  if (chroma <= 0) {
33480
33480
  hue = 0;
33481
33481
  } else if (max === r4) {
33482
- hue = (g2 - b2) / chroma % 6;
33483
- } else if (max === g2) {
33482
+ hue = (g3 - b2) / chroma % 6;
33483
+ } else if (max === g3) {
33484
33484
  hue = 2 + (b2 - r4) / chroma;
33485
33485
  } else {
33486
- hue = 4 + (r4 - g2) / chroma + 4;
33486
+ hue = 4 + (r4 - g3) / chroma + 4;
33487
33487
  }
33488
33488
  hue /= 6;
33489
33489
  hue %= 1;
@@ -33517,9 +33517,9 @@ var require_conversions = __commonJS({
33517
33517
  convert.hcg.rgb = function(hcg) {
33518
33518
  var h3 = hcg[0] / 360;
33519
33519
  var c3 = hcg[1] / 100;
33520
- var g2 = hcg[2] / 100;
33520
+ var g3 = hcg[2] / 100;
33521
33521
  if (c3 === 0) {
33522
- return [g2 * 255, g2 * 255, g2 * 255];
33522
+ return [g3 * 255, g3 * 255, g3 * 255];
33523
33523
  }
33524
33524
  var pure = [0, 0, 0];
33525
33525
  var hi2 = h3 % 1 * 6;
@@ -33557,7 +33557,7 @@ var require_conversions = __commonJS({
33557
33557
  pure[1] = 0;
33558
33558
  pure[2] = w2;
33559
33559
  }
33560
- mg = (1 - c3) * g2;
33560
+ mg = (1 - c3) * g3;
33561
33561
  return [
33562
33562
  (c3 * pure[0] + mg) * 255,
33563
33563
  (c3 * pure[1] + mg) * 255,
@@ -33566,8 +33566,8 @@ var require_conversions = __commonJS({
33566
33566
  };
33567
33567
  convert.hcg.hsv = function(hcg) {
33568
33568
  var c3 = hcg[1] / 100;
33569
- var g2 = hcg[2] / 100;
33570
- var v3 = c3 + g2 * (1 - c3);
33569
+ var g3 = hcg[2] / 100;
33570
+ var v3 = c3 + g3 * (1 - c3);
33571
33571
  var f = 0;
33572
33572
  if (v3 > 0) {
33573
33573
  f = c3 / v3;
@@ -33576,8 +33576,8 @@ var require_conversions = __commonJS({
33576
33576
  };
33577
33577
  convert.hcg.hsl = function(hcg) {
33578
33578
  var c3 = hcg[1] / 100;
33579
- var g2 = hcg[2] / 100;
33580
- var l2 = g2 * (1 - c3) + 0.5 * c3;
33579
+ var g3 = hcg[2] / 100;
33580
+ var l2 = g3 * (1 - c3) + 0.5 * c3;
33581
33581
  var s = 0;
33582
33582
  if (l2 > 0 && l2 < 0.5) {
33583
33583
  s = c3 / (2 * l2);
@@ -33588,8 +33588,8 @@ var require_conversions = __commonJS({
33588
33588
  };
33589
33589
  convert.hcg.hwb = function(hcg) {
33590
33590
  var c3 = hcg[1] / 100;
33591
- var g2 = hcg[2] / 100;
33592
- var v3 = c3 + g2 * (1 - c3);
33591
+ var g3 = hcg[2] / 100;
33592
+ var v3 = c3 + g3 * (1 - c3);
33593
33593
  return [hcg[0], (v3 - c3) * 100, (1 - v3) * 100];
33594
33594
  };
33595
33595
  convert.hwb.hcg = function(hwb) {
@@ -33597,11 +33597,11 @@ var require_conversions = __commonJS({
33597
33597
  var b2 = hwb[2] / 100;
33598
33598
  var v3 = 1 - b2;
33599
33599
  var c3 = v3 - w2;
33600
- var g2 = 0;
33600
+ var g3 = 0;
33601
33601
  if (c3 < 1) {
33602
- g2 = (v3 - c3) / (1 - c3);
33602
+ g3 = (v3 - c3) / (1 - c3);
33603
33603
  }
33604
- return [hwb[0], c3 * 100, g2 * 100];
33604
+ return [hwb[0], c3 * 100, g3 * 100];
33605
33605
  };
33606
33606
  convert.apple.rgb = function(apple) {
33607
33607
  return [apple[0] / 65535 * 255, apple[1] / 65535 * 255, apple[2] / 65535 * 255];
@@ -33674,22 +33674,22 @@ var require_route = __commonJS({
33674
33674
  }
33675
33675
  return graph;
33676
33676
  }
33677
- function link(from, to2) {
33677
+ function link(from, to) {
33678
33678
  return function(args) {
33679
- return to2(from(args));
33679
+ return to(from(args));
33680
33680
  };
33681
33681
  }
33682
33682
  function wrapConversion(toModel, graph) {
33683
33683
  var path = [graph[toModel].parent, toModel];
33684
- var fn = conversions[graph[toModel].parent][toModel];
33684
+ var fn2 = conversions[graph[toModel].parent][toModel];
33685
33685
  var cur = graph[toModel].parent;
33686
33686
  while (graph[cur].parent) {
33687
33687
  path.unshift(graph[cur].parent);
33688
- fn = link(conversions[graph[cur].parent][cur], fn);
33688
+ fn2 = link(conversions[graph[cur].parent][cur], fn2);
33689
33689
  cur = graph[cur].parent;
33690
33690
  }
33691
- fn.conversion = path;
33692
- return fn;
33691
+ fn2.conversion = path;
33692
+ return fn2;
33693
33693
  }
33694
33694
  module2.exports = function(fromModel) {
33695
33695
  var graph = deriveBFS(fromModel);
@@ -33716,7 +33716,7 @@ var require_color_convert = __commonJS({
33716
33716
  var route = require_route();
33717
33717
  var convert = {};
33718
33718
  var models = Object.keys(conversions);
33719
- function wrapRaw(fn) {
33719
+ function wrapRaw(fn2) {
33720
33720
  var wrappedFn = function(args) {
33721
33721
  if (args === void 0 || args === null) {
33722
33722
  return args;
@@ -33724,14 +33724,14 @@ var require_color_convert = __commonJS({
33724
33724
  if (arguments.length > 1) {
33725
33725
  args = Array.prototype.slice.call(arguments);
33726
33726
  }
33727
- return fn(args);
33727
+ return fn2(args);
33728
33728
  };
33729
- if ("conversion" in fn) {
33730
- wrappedFn.conversion = fn.conversion;
33729
+ if ("conversion" in fn2) {
33730
+ wrappedFn.conversion = fn2.conversion;
33731
33731
  }
33732
33732
  return wrappedFn;
33733
33733
  }
33734
- function wrapRounded(fn) {
33734
+ function wrapRounded(fn2) {
33735
33735
  var wrappedFn = function(args) {
33736
33736
  if (args === void 0 || args === null) {
33737
33737
  return args;
@@ -33739,7 +33739,7 @@ var require_color_convert = __commonJS({
33739
33739
  if (arguments.length > 1) {
33740
33740
  args = Array.prototype.slice.call(arguments);
33741
33741
  }
33742
- var result = fn(args);
33742
+ var result = fn2(args);
33743
33743
  if (typeof result === "object") {
33744
33744
  for (var len = result.length, i2 = 0; i2 < len; i2++) {
33745
33745
  result[i2] = Math.round(result[i2]);
@@ -33747,8 +33747,8 @@ var require_color_convert = __commonJS({
33747
33747
  }
33748
33748
  return result;
33749
33749
  };
33750
- if ("conversion" in fn) {
33751
- wrappedFn.conversion = fn.conversion;
33750
+ if ("conversion" in fn2) {
33751
+ wrappedFn.conversion = fn2.conversion;
33752
33752
  }
33753
33753
  return wrappedFn;
33754
33754
  }
@@ -33759,9 +33759,9 @@ var require_color_convert = __commonJS({
33759
33759
  var routes = route(fromModel);
33760
33760
  var routeModels = Object.keys(routes);
33761
33761
  routeModels.forEach(function(toModel) {
33762
- var fn = routes[toModel];
33763
- convert[fromModel][toModel] = wrapRounded(fn);
33764
- convert[fromModel][toModel].raw = wrapRaw(fn);
33762
+ var fn2 = routes[toModel];
33763
+ convert[fromModel][toModel] = wrapRounded(fn2);
33764
+ convert[fromModel][toModel].raw = wrapRaw(fn2);
33765
33765
  });
33766
33766
  });
33767
33767
  module2.exports = convert;
@@ -34210,15 +34210,15 @@ var require_kuler = __commonJS({
34210
34210
  color[1] = color[0];
34211
34211
  color = color.join("");
34212
34212
  }
34213
- var r4 = color.substring(0, 2), g2 = color.substring(2, 4), b2 = color.substring(4, 6);
34214
- return [parseInt(r4, 16), parseInt(g2, 16), parseInt(b2, 16)];
34213
+ var r4 = color.substring(0, 2), g3 = color.substring(2, 4), b2 = color.substring(4, 6);
34214
+ return [parseInt(r4, 16), parseInt(g3, 16), parseInt(b2, 16)];
34215
34215
  };
34216
- Kuler.prototype.rgb = function rgb(r4, g2, b2) {
34217
- var red = r4 / 255 * 5, green = g2 / 255 * 5, blue = b2 / 255 * 5;
34216
+ Kuler.prototype.rgb = function rgb(r4, g3, b2) {
34217
+ var red = r4 / 255 * 5, green = g3 / 255 * 5, blue = b2 / 255 * 5;
34218
34218
  return this.ansi(red, green, blue);
34219
34219
  };
34220
- Kuler.prototype.ansi = function ansi(r4, g2, b2) {
34221
- var red = Math.round(r4), green = Math.round(g2), blue = Math.round(b2);
34220
+ Kuler.prototype.ansi = function ansi(r4, g3, b2) {
34221
+ var red = Math.round(r4), green = Math.round(g3), blue = Math.round(b2);
34222
34222
  return 16 + red * 36 + green * 6 + blue;
34223
34223
  };
34224
34224
  Kuler.prototype.reset = function reset() {
@@ -34276,10 +34276,10 @@ var require_adapters = __commonJS({
34276
34276
  "../../node_modules/@dabh/diagnostics/adapters/index.js"(exports, module2) {
34277
34277
  "use strict";
34278
34278
  var enabled = require_enabled();
34279
- module2.exports = function create(fn) {
34279
+ module2.exports = function create(fn2) {
34280
34280
  return function adapter(namespace) {
34281
34281
  try {
34282
- return enabled(namespace, fn());
34282
+ return enabled(namespace, fn2());
34283
34283
  } catch (e) {
34284
34284
  }
34285
34285
  return false;
@@ -35167,11 +35167,11 @@ var require_http = __commonJS({
35167
35167
  _doBatch(options, callback, auth, path) {
35168
35168
  this.batchOptions.push(options);
35169
35169
  if (this.batchOptions.length === 1) {
35170
- const me = this;
35170
+ const me2 = this;
35171
35171
  this.batchCallback = callback;
35172
35172
  this.batchTimeoutID = setTimeout(function() {
35173
- me.batchTimeoutID = -1;
35174
- me._doBatchRequest(me.batchCallback, auth, path);
35173
+ me2.batchTimeoutID = -1;
35174
+ me2._doBatchRequest(me2.batchCallback, auth, path);
35175
35175
  }, this.batchInterval);
35176
35176
  }
35177
35177
  if (this.batchOptions.length === this.batchCount) {
@@ -35438,15 +35438,15 @@ var require_fn = __commonJS({
35438
35438
  "../../node_modules/fn.name/index.js"(exports, module2) {
35439
35439
  "use strict";
35440
35440
  var toString = Object.prototype.toString;
35441
- module2.exports = function name(fn) {
35442
- if ("string" === typeof fn.displayName && fn.constructor.name) {
35443
- return fn.displayName;
35444
- } else if ("string" === typeof fn.name && fn.name) {
35445
- return fn.name;
35446
- }
35447
- if ("object" === typeof fn && fn.constructor && "string" === typeof fn.constructor.name)
35448
- return fn.constructor.name;
35449
- var named = fn.toString(), type = toString.call(fn).slice(8, -1);
35441
+ module2.exports = function name(fn2) {
35442
+ if ("string" === typeof fn2.displayName && fn2.constructor.name) {
35443
+ return fn2.displayName;
35444
+ } else if ("string" === typeof fn2.name && fn2.name) {
35445
+ return fn2.name;
35446
+ }
35447
+ if ("object" === typeof fn2 && fn2.constructor && "string" === typeof fn2.constructor.name)
35448
+ return fn2.constructor.name;
35449
+ var named = fn2.toString(), type = toString.call(fn2).slice(8, -1);
35450
35450
  if ("Function" === type) {
35451
35451
  named = named.substring(named.indexOf("(") + 1, named.indexOf(")"));
35452
35452
  } else {
@@ -35462,17 +35462,17 @@ var require_one_time = __commonJS({
35462
35462
  "../../node_modules/one-time/index.js"(exports, module2) {
35463
35463
  "use strict";
35464
35464
  var name = require_fn();
35465
- module2.exports = function one(fn) {
35465
+ module2.exports = function one(fn2) {
35466
35466
  var called = 0, value;
35467
35467
  function onetime() {
35468
35468
  if (called)
35469
35469
  return value;
35470
35470
  called = 1;
35471
- value = fn.apply(this, arguments);
35472
- fn = null;
35471
+ value = fn2.apply(this, arguments);
35472
+ fn2 = null;
35473
35473
  return value;
35474
35474
  }
35475
- onetime.displayName = name(fn);
35475
+ onetime.displayName = name(fn2);
35476
35476
  return onetime;
35477
35477
  };
35478
35478
  }
@@ -36851,7 +36851,7 @@ var require_dcmjs_dimse_min = __commonJS({
36851
36851
  "object" == typeof exports && "object" == typeof module2 ? module2.exports = t(require_async_eventemitter(), require_dcmjs(), require_smartbuffer(), require_cjs(), require_winston()) : "function" == typeof define && define.amd ? define("dcmjs-dimse", ["async-eventemitter", "dcmjs", "smart-buffer", "ts-mixer", "winston"], t) : "object" == typeof exports ? exports["dcmjs-dimse"] = t(require_async_eventemitter(), require_dcmjs(), require_smartbuffer(), require_cjs(), require_winston()) : e["dcmjs-dimse"] = t(e["async-eventemitter"], e.dcmjs, e["smart-buffer"], e["ts-mixer"], e.winston);
36852
36852
  }(global, (e, t, s, n, i2) => {
36853
36853
  return r4 = { 201: (e2, t2, s2) => {
36854
- const { CGetRequest: n2, CStoreRequest: i3 } = s2(406), { CommandFieldType: r5, PresentationContextResult: o2, SopClass: a, StorageClass: c3, TransferSyntax: d3, Uid: u2, UserIdentityType: h3 } = s2(855), m3 = s2(719), { EOL: g2 } = s2(37);
36854
+ const { CGetRequest: n2, CStoreRequest: i3 } = s2(406), { CommandFieldType: r5, PresentationContextResult: o2, SopClass: a, StorageClass: c3, TransferSyntax: d3, Uid: u2, UserIdentityType: h3 } = s2(855), m3 = s2(719), { EOL: g3 } = s2(37);
36855
36855
  class l2 {
36856
36856
  constructor(e3, t3, s3, n3) {
36857
36857
  this.pcId = e3, this.abstractSyntaxUid = t3, this.transferSyntaxes = [], s3 && this.transferSyntaxes.push(s3), this.result = n3 || o2.Proposed;
@@ -36910,7 +36910,7 @@ var require_dcmjs_dimse_min = __commonJS({
36910
36910
  const e3 = [];
36911
36911
  return e3.push(`Presentation Context: ${this.getPresentationContextId()} [${this.getResultDescription()}]`), e3.push(` Abstract: ${this.getAbstractSyntaxUid()}`), this.getTransferSyntaxUids().forEach((t3) => {
36912
36912
  e3.push(` Transfer: ${t3}`);
36913
- }), e3.join(g2);
36913
+ }), e3.join(g3);
36914
36914
  }
36915
36915
  }
36916
36916
  e2.exports = { Association: class {
@@ -37091,7 +37091,7 @@ var require_dcmjs_dimse_min = __commonJS({
37091
37091
  e3.push(` Presentation Context: ${t3.id} [${s3.getResultDescription()}]`), e3.push(` Abstract: ${this._uidNameFromValue([a, c3], s3.getAbstractSyntaxUid()) || s3.getAbstractSyntaxUid()}`), s3.getTransferSyntaxUids().forEach((t4) => {
37092
37092
  e3.push(` Transfer: ${this._uidNameFromValue(d3, t4) || t4}`);
37093
37093
  });
37094
- }), e3.push(""), e3.join(g2);
37094
+ }), e3.push(""), e3.join(g3);
37095
37095
  }
37096
37096
  _uidNameFromValue(e3, t3) {
37097
37097
  const s3 = Array.isArray(e3) ? Object.assign({}, ...e3) : e3;
@@ -37133,7 +37133,7 @@ var require_dcmjs_dimse_min = __commonJS({
37133
37133
  }
37134
37134
  }, PresentationContext: l2 };
37135
37135
  }, 185: (e2, t2, s2) => {
37136
- const { Association: n2, PresentationContext: i3 } = s2(201), { TransferSyntax: r5, UserIdentityType: o2 } = s2(855), { Request: a } = s2(406), c3 = s2(988), d3 = s2(266), u2 = s2(437), h3 = s2(425), m3 = s2(808), g2 = s2(404);
37136
+ const { Association: n2, PresentationContext: i3 } = s2(201), { TransferSyntax: r5, UserIdentityType: o2 } = s2(855), { Request: a } = s2(406), c3 = s2(988), d3 = s2(266), u2 = s2(437), h3 = s2(425), m3 = s2(808), g3 = s2(404);
37137
37137
  e2.exports = class extends h3 {
37138
37138
  constructor() {
37139
37139
  super(), this.requests = [], this.additionalPresentationContexts = [], this.network = void 0, this.statistics = new d3();
@@ -37165,7 +37165,7 @@ var require_dcmjs_dimse_min = __commonJS({
37165
37165
  });
37166
37166
  let h4 = {};
37167
37167
  a2.securityOptions && (h4 = { key: a2.securityOptions.key, cert: a2.securityOptions.cert, ca: a2.securityOptions.ca, requestCert: a2.securityOptions.requestCert, rejectUnauthorized: a2.securityOptions.rejectUnauthorized, minVersion: a2.securityOptions.minVersion, maxVersion: a2.securityOptions.maxVersion, ciphers: a2.securityOptions.ciphers }), u2.info(`Connecting to ${e3}:${t3} ${a2.securityOptions ? "(TLS)" : ""}`);
37168
- const l2 = (a2.securityOptions ? g2 : m3).connect({ host: e3, port: t3, ...h4 }), p3 = new c3(l2, a2);
37168
+ const l2 = (a2.securityOptions ? g3 : m3).connect({ host: e3, port: t3, ...h4 }), p3 = new c3(l2, a2);
37169
37169
  p3.on("connect", () => {
37170
37170
  this.emit("connected"), p3.sendAssociationRequest(d4);
37171
37171
  }), p3.on("associationAccepted", (e4) => {
@@ -37202,7 +37202,7 @@ var require_dcmjs_dimse_min = __commonJS({
37202
37202
  };
37203
37203
  }, 406: (e2, t2, s2) => {
37204
37204
  const { CommandFieldType: n2, Priority: i3, SopClass: r5, Status: o2 } = s2(855), a = s2(347), { Mixin: c3 } = s2(842), { EOL: d3 } = s2(37), u2 = s2(425), h3 = s2(836), { DicomMetaDictionary: m3 } = h3.data;
37205
- class g2 {
37205
+ class g3 {
37206
37206
  constructor(e3, t3) {
37207
37207
  this.commandDataset = e3 || new a(), this.dataset = t3;
37208
37208
  }
@@ -37281,7 +37281,7 @@ var require_dcmjs_dimse_min = __commonJS({
37281
37281
  }
37282
37282
  }
37283
37283
  }
37284
- class l2 extends c3(g2, u2) {
37284
+ class l2 extends c3(g3, u2) {
37285
37285
  constructor(e3, t3, s3) {
37286
37286
  switch (super(new a({ CommandField: e3, CommandDataSetType: s3 ? 514 : 257 })), e3) {
37287
37287
  case n2.NGetRequest:
@@ -37337,7 +37337,7 @@ var require_dcmjs_dimse_min = __commonJS({
37337
37337
  return `${super.toString(e3)} [id: ${this.getMessageId() || ""}]`;
37338
37338
  }
37339
37339
  }
37340
- class p3 extends g2 {
37340
+ class p3 extends g3 {
37341
37341
  constructor(e3, t3, s3, i4, r6) {
37342
37342
  switch (super(new a({ CommandField: e3, CommandDataSetType: s3 ? 514 : 257, Status: i4, ErrorComment: r6 })), e3) {
37343
37343
  case n2.NGetRequest:
@@ -37683,14 +37683,14 @@ var require_dcmjs_dimse_min = __commonJS({
37683
37683
  super(n2.NDeleteRequest, e3, false), this.setRequestedSopInstanceUid(t3);
37684
37684
  }
37685
37685
  }
37686
- class T2 extends p3 {
37686
+ class T extends p3 {
37687
37687
  constructor(e3, t3, s3, i4) {
37688
37688
  super(n2.NDeleteResponse, e3, false, s3, i4), this.setAffectedSopInstanceUid(t3);
37689
37689
  }
37690
37690
  static fromRequest(e3) {
37691
37691
  if (!(e3 instanceof E3))
37692
37692
  throw new Error("Request should be an instance of NDeleteRequest");
37693
- const t3 = new T2(e3.getRequestedSopClassUid(), e3.getRequestedSopInstanceUid(), o2.ProcessingFailure);
37693
+ const t3 = new T(e3.getRequestedSopClassUid(), e3.getRequestedSopInstanceUid(), o2.ProcessingFailure);
37694
37694
  return t3.setMessageIdBeingRespondedTo(e3.getMessageId()), t3;
37695
37695
  }
37696
37696
  }
@@ -37722,7 +37722,7 @@ var require_dcmjs_dimse_min = __commonJS({
37722
37722
  return t3.setMessageIdBeingRespondedTo(e3.getMessageId()), t3;
37723
37723
  }
37724
37724
  }
37725
- class N extends l2 {
37725
+ class N2 extends l2 {
37726
37726
  constructor(e3, t3, s3) {
37727
37727
  super(n2.NGetRequest, e3, false), this.setRequestedSopInstanceUid(t3), this.setAttributeIdentifierList(Array.isArray(s3) ? s3 : [s3]);
37728
37728
  }
@@ -37748,18 +37748,18 @@ var require_dcmjs_dimse_min = __commonJS({
37748
37748
  return "0".repeat(t3 - s3.length) + s3;
37749
37749
  }
37750
37750
  }
37751
- class B2 extends p3 {
37751
+ class B extends p3 {
37752
37752
  constructor(e3, t3, s3, i4) {
37753
37753
  super(n2.NGetResponse, e3, false, s3, i4), this.setAffectedSopInstanceUid(t3);
37754
37754
  }
37755
37755
  static fromRequest(e3) {
37756
- if (!(e3 instanceof N))
37756
+ if (!(e3 instanceof N2))
37757
37757
  throw new Error("Request should be an instance of NGetRequest");
37758
- const t3 = new B2(e3.getRequestedSopClassUid(), e3.getRequestedSopInstanceUid(), o2.ProcessingFailure);
37758
+ const t3 = new B(e3.getRequestedSopClassUid(), e3.getRequestedSopInstanceUid(), o2.ProcessingFailure);
37759
37759
  return t3.setMessageIdBeingRespondedTo(e3.getMessageId()), t3;
37760
37760
  }
37761
37761
  }
37762
- class M extends l2 {
37762
+ class M2 extends l2 {
37763
37763
  constructor(e3, t3) {
37764
37764
  super(n2.NSetRequest, e3, false), this.setRequestedSopInstanceUid(t3);
37765
37765
  }
@@ -37769,13 +37769,13 @@ var require_dcmjs_dimse_min = __commonJS({
37769
37769
  super(n2.NSetResponse, e3, false, s3, i4), this.setAffectedSopInstanceUid(t3);
37770
37770
  }
37771
37771
  static fromRequest(e3) {
37772
- if (!(e3 instanceof M))
37772
+ if (!(e3 instanceof M2))
37773
37773
  throw new Error("Request should be an instance of NSetRequest");
37774
37774
  const t3 = new L2(e3.getRequestedSopClassUid(), e3.getRequestedSopInstanceUid(), o2.ProcessingFailure);
37775
37775
  return t3.setMessageIdBeingRespondedTo(e3.getMessageId()), t3;
37776
37776
  }
37777
37777
  }
37778
- class F2 extends l2 {
37778
+ class F extends l2 {
37779
37779
  constructor(e3, t3) {
37780
37780
  super(n2.CCancelRequest, e3, false), this.setMessageIdBeingRespondedTo(t3);
37781
37781
  }
@@ -37788,10 +37788,10 @@ var require_dcmjs_dimse_min = __commonJS({
37788
37788
  static fromRequest(e3) {
37789
37789
  if (!(e3 instanceof y || e3 instanceof P || e3 instanceof x))
37790
37790
  throw new Error("Request should be an instance of CFindRequest, CMoveRequest or CGetRequest");
37791
- return new F2(e3.getAffectedSopClassUid(), e3.getMessageId());
37791
+ return new F(e3.getAffectedSopClassUid(), e3.getMessageId());
37792
37792
  }
37793
37793
  }
37794
- e2.exports = { CCancelRequest: F2, CEchoRequest: R2, CEchoResponse: f, CFindRequest: y, CFindResponse: S2, CGetRequest: x, CGetResponse: w2, CMoveRequest: P, CMoveResponse: v3, Command: g2, CStoreRequest: I2, CStoreResponse: C2, NActionRequest: q2, NActionResponse: D2, NCreateRequest: A2, NCreateResponse: U2, NDeleteRequest: E3, NDeleteResponse: T2, NEventReportRequest: O2, NEventReportResponse: b2, NGetRequest: N, NGetResponse: B2, NSetRequest: M, NSetResponse: L2, Request: l2, Response: p3 };
37794
+ e2.exports = { CCancelRequest: F, CEchoRequest: R2, CEchoResponse: f, CFindRequest: y, CFindResponse: S2, CGetRequest: x, CGetResponse: w2, CMoveRequest: P, CMoveResponse: v3, Command: g3, CStoreRequest: I2, CStoreResponse: C2, NActionRequest: q2, NActionResponse: D2, NCreateRequest: A2, NCreateResponse: U2, NDeleteRequest: E3, NDeleteResponse: T, NEventReportRequest: O2, NEventReportResponse: b2, NGetRequest: N2, NGetResponse: B, NSetRequest: M2, NSetResponse: L2, Request: l2, Response: p3 };
37795
37795
  }, 855: (e2) => {
37796
37796
  const t2 = { CStoreRequest: 1, CStoreResponse: 32769, CGetRequest: 16, CGetResponse: 32784, CFindRequest: 32, CFindResponse: 32800, CMoveRequest: 33, CMoveResponse: 32801, CEchoRequest: 48, CEchoResponse: 32816, NEventReportRequest: 256, NEventReportResponse: 33024, NGetRequest: 272, NGetResponse: 33040, NSetRequest: 288, NSetResponse: 33056, NActionRequest: 304, NActionResponse: 33072, NCreateRequest: 320, NCreateResponse: 33088, NDeleteRequest: 336, NDeleteResponse: 33104, CCancelRequest: 4095 };
37797
37797
  Object.freeze(t2);
@@ -37817,16 +37817,16 @@ var require_dcmjs_dimse_min = __commonJS({
37817
37817
  Object.freeze(h3);
37818
37818
  const m3 = { BasicTextSrStorage: "1.2.840.10008.5.1.4.1.1.88.11", BreastProjectionXRayImageStorageForPresentation: "1.2.840.10008.5.1.4.1.1.13.1.4", BreastProjectionXRayImageStorageForProcessing: "1.2.840.10008.5.1.4.1.1.13.1.5", BreastTomosynthesisImageStorage: "1.2.840.10008.5.1.4.1.1.13.1.3", ChestCadSrStorage: "1.2.840.10008.5.1.4.1.1.88.65", ComprehensiveSrStorage: "1.2.840.10008.5.1.4.1.1.88.33", ComputedRadiographyImageStorage: "1.2.840.10008.5.1.4.1.1.1", CtImageStorage: "1.2.840.10008.5.1.4.1.1.2", DigitalIntraOralXRayImageStorageForPresentation: "1.2.840.10008.5.1.4.1.1.1.3", DigitalIntraOralXRayImageStorageForProcessing: "1.2.840.10008.5.1.4.1.1.1.3.1", DigitalMammographyXRayImageStorageForPresentation: "1.2.840.10008.5.1.4.1.1.1.2", DigitalMammographyXRayImageStorageForProcessing: "1.2.840.10008.5.1.4.1.1.1.2.1", DigitalXRayImageStorageForPresentation: "1.2.840.10008.5.1.4.1.1.1.1", DigitalXRayImageStorageForProcessing: "1.2.840.10008.5.1.4.1.1.1.1.1", EncapsulatedCdaStorage: "1.2.840.10008.5.1.4.1.1.104.2", EncapsulatedPdfStorage: "1.2.840.10008.5.1.4.1.1.104.1", EnhancedCtImageStorage: "1.2.840.10008.5.1.4.1.1.2.1", EnhancedMrColorImageStorage: "1.2.840.10008.5.1.4.1.1.4.3", EnhancedMrImageStorage: "1.2.840.10008.5.1.4.1.1.4.1", EnhancedPetImageStorage: "1.2.840.10008.5.1.4.1.1.130", EnhancedSrStorage: "1.2.840.10008.5.1.4.1.1.88.22", EnhancedXaImageStorage: "1.2.840.10008.5.1.4.1.1.12.1.1", EnhancedXrfImageStorage: "1.2.840.10008.5.1.4.1.1.12.2.1", IntravascularOpticalCoherenceTomographyImageStorageForPresentation: "1.2.840.10008.5.1.4.1.1.14.1", IntravascularOpticalCoherenceTomographyImageStorageForProcessing: "1.2.840.10008.5.1.4.1.1.14.2", LegacyConvertedEnhancedCTImageStorage: "1.2.840.10008.5.1.4.1.1.2.2", LegacyConvertedEnhancedMRImageStorage: "1.2.840.10008.5.1.4.1.1.4.4", LegacyConvertedEnhancedPETImageStorage: "1.2.840.10008.5.1.4.1.1.128.1", MammographyCadSrStorage: "1.2.840.10008.5.1.4.1.1.88.50", MrImageStorage: "1.2.840.10008.5.1.4.1.1.4", MultiframeGrayscaleByteSecondaryCaptureImageStorage: "1.2.840.10008.5.1.4.1.1.7.2", MultiframeGrayscaleWordSecondaryCaptureImageStorage: "1.2.840.10008.5.1.4.1.1.7.3", MultiframeSingleBitSecondaryCaptureImageStorage: "1.2.840.10008.5.1.4.1.1.7.1", MultiframeTrueColorSecondaryCaptureImageStorage: "1.2.840.10008.5.1.4.1.1.7.4", NuclearMedicineImageStorage: "1.2.840.10008.5.1.4.1.1.20", OphthalmicOpticalCoherenceTomographyEnFaceImageStorage: "1.2.840.10008.5.1.4.1.1.77.1.5.7", OphthalmicPhotography16BitImageStorage: "1.2.840.10008.5.1.4.1.1.77.1.5.2", OphthalmicPhotography8BitImageStorage: "1.2.840.10008.5.1.4.1.1.77.1.5.1", OphthalmicTomographyImageStorage: "1.2.840.10008.5.1.4.1.1.77.1.5.4", PositronEmissionTomographyImageStorage: "1.2.840.10008.5.1.4.1.1.128", RtImageStorage: "1.2.840.10008.5.1.4.1.1.481.1", SecondaryCaptureImageStorage: "1.2.840.10008.5.1.4.1.1.7", UltrasoundImageStorage: "1.2.840.10008.5.1.4.1.1.6.1", UltrasoundMultiframeImageStorage: "1.2.840.10008.5.1.4.1.1.3.1", VideoEndoscopicImageStorage: "1.2.840.10008.5.1.4.1.1.77.1.1.1", VideoMicroscopicImageStorage: "1.2.840.10008.5.1.4.1.1.77.1.2.1", VideoPhotographicImageStorage: "1.2.840.10008.5.1.4.1.1.77.1.4.1", VlEndoscopicImageStorage: "1.2.840.10008.5.1.4.1.1.77.1.1", VlMicroscopicImageStorage: "1.2.840.10008.5.1.4.1.1.77.1.2", VlPhotographicImageStorage: "1.2.840.10008.5.1.4.1.1.77.1.4", VlSlideCoordinatesMicroscopicImageStorage: "1.2.840.10008.5.1.4.1.1.77.1.3", VlWholeSlideMicroscopyImageStorage: "1.2.840.10008.5.1.4.1.1.77.1.6", WideFieldOphthalmicPhotography3dCoordinatesImageStorage: "1.2.840.10008.5.1.4.1.1.77.1.5.6", WideFieldOphthalmicPhotographyStereographicProjectionImageStorage: "1.2.840.10008.5.1.4.1.1.77.1.5.5", XRay3dAngiographicImageStorage: "1.2.840.10008.5.1.4.1.1.13.1.1", XRay3dCraniofacialImageStorage: "1.2.840.10008.5.1.4.1.1.13.1.2", XRayAngiographicImageStorage: "1.2.840.10008.5.1.4.1.1.12.1", XRayRadiationDoseSRStorage: "1.2.840.10008.5.1.4.1.1.88.67", XRayRadiofluoroscopicImageStorage: "1.2.840.10008.5.1.4.1.1.12.2" };
37819
37819
  Object.freeze(m3);
37820
- const g2 = { Verification: "1.2.840.10008.1.1", StudyRootQueryRetrieveInformationModelFind: "1.2.840.10008.5.1.4.1.2.2.1", ModalityWorklistInformationModelFind: "1.2.840.10008.5.1.4.31", ModalityPerformedProcedureStep: "1.2.840.10008.3.1.2.3.3", StudyRootQueryRetrieveInformationModelMove: "1.2.840.10008.5.1.4.1.2.2.2", StudyRootQueryRetrieveInformationModelGet: "1.2.840.10008.5.1.4.1.2.2.3", StorageCommitmentPushModel: "1.2.840.10008.1.20.1", BasicFilmSession: "1.2.840.10008.5.1.1.1", PrintJob: "1.2.840.10008.5.1.1.14", BasicAnnotationBox: "1.2.840.10008.5.1.1.15", Printer: "1.2.840.10008.5.1.1.16", PrinterConfigurationRetrieval: "1.2.840.10008.5.1.1.16.376", BasicGrayscalePrintManagementMeta: "1.2.840.10008.5.1.1.9", BasicColorPrintManagementMeta: "1.2.840.10008.5.1.1.18", BasicFilmBox: "1.2.840.10008.5.1.1.2", PresentationLut: "1.2.840.10008.5.1.1.23", BasicGrayscaleImageBox: "1.2.840.10008.5.1.1.4", BasicColorImageBox: "1.2.840.10008.5.1.1.4.1", InstanceAvailabilityNotification: "1.2.840.10008.5.1.4.33" };
37821
- Object.freeze(g2);
37820
+ const g3 = { Verification: "1.2.840.10008.1.1", StudyRootQueryRetrieveInformationModelFind: "1.2.840.10008.5.1.4.1.2.2.1", ModalityWorklistInformationModelFind: "1.2.840.10008.5.1.4.31", ModalityPerformedProcedureStep: "1.2.840.10008.3.1.2.3.3", StudyRootQueryRetrieveInformationModelMove: "1.2.840.10008.5.1.4.1.2.2.2", StudyRootQueryRetrieveInformationModelGet: "1.2.840.10008.5.1.4.1.2.2.3", StorageCommitmentPushModel: "1.2.840.10008.1.20.1", BasicFilmSession: "1.2.840.10008.5.1.1.1", PrintJob: "1.2.840.10008.5.1.1.14", BasicAnnotationBox: "1.2.840.10008.5.1.1.15", Printer: "1.2.840.10008.5.1.1.16", PrinterConfigurationRetrieval: "1.2.840.10008.5.1.1.16.376", BasicGrayscalePrintManagementMeta: "1.2.840.10008.5.1.1.9", BasicColorPrintManagementMeta: "1.2.840.10008.5.1.1.18", BasicFilmBox: "1.2.840.10008.5.1.1.2", PresentationLut: "1.2.840.10008.5.1.1.23", BasicGrayscaleImageBox: "1.2.840.10008.5.1.1.4", BasicColorImageBox: "1.2.840.10008.5.1.1.4.1", InstanceAvailabilityNotification: "1.2.840.10008.5.1.4.33" };
37821
+ Object.freeze(g3);
37822
37822
  const l2 = { ImplicitVRLittleEndian: "1.2.840.10008.1.2", ExplicitVRLittleEndian: "1.2.840.10008.1.2.1", DeflatedExplicitVRLittleEndian: "1.2.840.10008.1.2.1.99", ExplicitVRBigEndian: "1.2.840.10008.1.2.2", RleLossless: "1.2.840.10008.1.2.5", JpegBaseline: "1.2.840.10008.1.2.4.50", JpegLossless: "1.2.840.10008.1.2.4.70", JpegLsLossless: "1.2.840.10008.1.2.4.80", JpegLsLossy: "1.2.840.10008.1.2.4.81", Jpeg2000Lossless: "1.2.840.10008.1.2.4.90", Jpeg2000Lossy: "1.2.840.10008.1.2.4.91" };
37823
37823
  Object.freeze(l2);
37824
37824
  const p3 = [l2.ImplicitVRLittleEndian, l2.ExplicitVRLittleEndian];
37825
37825
  Object.freeze(p3);
37826
37826
  const R2 = { ImplementationClassUid: "1.2.826.0.1.3680043.10.854", ImplementationVersion: "DCMJS-DIMSE-V0.1", MaxPduLength: 262144 };
37827
- Object.freeze(R2), e2.exports = { AbortReason: r5, AbortSource: i3, CommandFieldType: t2, DefaultImplementation: R2, PresentationContextResult: s2, Priority: d3, RejectReason: c3, RejectResult: o2, RejectSource: a, SopClass: g2, Status: u2, StorageClass: m3, TranscodableTransferSyntaxes: p3, TransferSyntax: l2, Uid: h3, UserIdentityType: n2 };
37827
+ Object.freeze(R2), e2.exports = { AbortReason: r5, AbortSource: i3, CommandFieldType: t2, DefaultImplementation: R2, PresentationContextResult: s2, Priority: d3, RejectReason: c3, RejectResult: o2, RejectSource: a, SopClass: g3, Status: u2, StorageClass: m3, TranscodableTransferSyntaxes: p3, TransferSyntax: l2, Uid: h3, UserIdentityType: n2 };
37828
37828
  }, 347: (e2, t2, s2) => {
37829
- const { StorageClass: n2, TransferSyntax: i3 } = s2(855), r5 = s2(719), { readFile: o2, readFileSync: a, writeFile: c3, writeFileSync: d3 } = s2(147), { EOL: u2 } = s2(37), h3 = s2(836), { DicomDict: m3, DicomMessage: g2, DicomMetaDictionary: l2, ReadBufferStream: p3, WriteBufferStream: R2 } = h3.data, f = h3.log;
37829
+ const { StorageClass: n2, TransferSyntax: i3 } = s2(855), r5 = s2(719), { readFile: o2, readFileSync: a, writeFile: c3, writeFileSync: d3 } = s2(147), { EOL: u2 } = s2(37), h3 = s2(836), { DicomDict: m3, DicomMessage: g3, DicomMetaDictionary: l2, ReadBufferStream: p3, WriteBufferStream: R2 } = h3.data, f = h3.log;
37830
37830
  class y {
37831
37831
  constructor(e3, t3, s3) {
37832
37832
  s3 = s3 || {}, s3 = { ignoreErrors: true, ...s3 }, f.level = "error", this.transferSyntaxUid = t3 || i3.ImplicitVRLittleEndian, Buffer.isBuffer(e3) ? this.elements = this._fromElementsBuffer(e3, this.transferSyntaxUid, s3) : this.elements = e3 || {};
@@ -37848,11 +37848,11 @@ var require_dcmjs_dimse_min = __commonJS({
37848
37848
  }
37849
37849
  getDenaturalizedDataset(e3, t3) {
37850
37850
  const s3 = t3 ? l2.denaturalizeDataset(this.getElements(), { ...l2.nameMap, ...t3 }) : l2.denaturalizeDataset(this.getElements()), n3 = new R2();
37851
- return g2.write(s3, n3, this.transferSyntaxUid, e3), Buffer.from(n3.getBuffer());
37851
+ return g3.write(s3, n3, this.transferSyntaxUid, e3), Buffer.from(n3.getBuffer());
37852
37852
  }
37853
37853
  getDenaturalizedCommandDataset() {
37854
37854
  const e3 = l2.denaturalizeDataset(this.getElements()), t3 = new R2(), s3 = new R2();
37855
- return g2.write(e3, s3, i3.ImplicitVRLittleEndian, {}), g2.writeTagObject(t3, "00000000", "UL", s3.size, i3.ImplicitVRLittleEndian, {}), t3.concat(s3), Buffer.from(t3.getBuffer());
37855
+ return g3.write(e3, s3, i3.ImplicitVRLittleEndian, {}), g3.writeTagObject(t3, "00000000", "UL", s3.size, i3.ImplicitVRLittleEndian, {}), t3.concat(s3), Buffer.from(t3.getBuffer());
37856
37856
  }
37857
37857
  static fromFile(e3, t3, s3) {
37858
37858
  if (!(void 0 !== t3 && t3 instanceof Function))
@@ -37883,13 +37883,13 @@ var require_dcmjs_dimse_min = __commonJS({
37883
37883
  }
37884
37884
  static _fromP10Buffer(e3, t3) {
37885
37885
  t3 = t3 || {}, t3 = { ignoreErrors: true, ...t3 };
37886
- const s3 = g2.readFile(e3.buffer.slice(e3.byteOffset, e3.byteOffset + e3.byteLength), t3), n3 = l2.naturalizeDataset(s3.meta).TransferSyntaxUID, i4 = l2.naturalizeDataset(s3.dict);
37886
+ const s3 = g3.readFile(e3.buffer.slice(e3.byteOffset, e3.byteOffset + e3.byteLength), t3), n3 = l2.naturalizeDataset(s3.meta).TransferSyntaxUID, i4 = l2.naturalizeDataset(s3.dict);
37887
37887
  return new y(i4, n3);
37888
37888
  }
37889
37889
  _fromElementsBuffer(e3, t3, s3) {
37890
37890
  const n3 = new p3(e3.buffer.slice(e3.byteOffset, e3.byteOffset + e3.byteLength));
37891
37891
  let r6 = t3 === i3.ImplicitVRLittleEndian ? i3.ImplicitVRLittleEndian : i3.ExplicitVRLittleEndian;
37892
- const o3 = g2._read(n3, r6, s3);
37892
+ const o3 = g3._read(n3, r6, s3);
37893
37893
  return l2.naturalizeDataset(o3);
37894
37894
  }
37895
37895
  }
@@ -37917,8 +37917,8 @@ var require_dcmjs_dimse_min = __commonJS({
37917
37917
  }
37918
37918
  };
37919
37919
  }, 988: (e2, t2, s2) => {
37920
- const { Association: n2 } = s2(201), { AAbort: i3, AAssociateAC: r5, AAssociateRJ: o2, AAssociateRQ: a, AReleaseRP: c3, AReleaseRQ: d3, PDataTF: u2, Pdv: h3, RawPdu: m3 } = s2(634), { CommandFieldType: g2, Status: l2, TranscodableTransferSyntaxes: p3 } = s2(855), { CCancelRequest: R2, CEchoRequest: f, CEchoResponse: y, CFindRequest: S2, CFindResponse: I2, CGetRequest: C2, CGetResponse: P, CMoveRequest: v3, CMoveResponse: x, Command: w2, CStoreRequest: A2, CStoreResponse: U2, NActionRequest: q2, NActionResponse: D2, NCreateRequest: E3, NCreateResponse: T2, NDeleteRequest: O2, NDeleteResponse: b2, NEventReportRequest: N, NEventReportResponse: B2, NGetRequest: M, NGetResponse: L2, NSetRequest: F2, NSetResponse: k2, Response: $2 } = s2(406), j2 = s2(347), V2 = s2(719), G2 = s2(266), _2 = s2(437), { SmartBuffer: z } = s2(677), { EOL: Q } = s2(37), W2 = s2(425);
37921
- class J2 extends W2 {
37920
+ const { Association: n2 } = s2(201), { AAbort: i3, AAssociateAC: r5, AAssociateRJ: o2, AAssociateRQ: a, AReleaseRP: c3, AReleaseRQ: d3, PDataTF: u2, Pdv: h3, RawPdu: m3 } = s2(634), { CommandFieldType: g3, Status: l2, TranscodableTransferSyntaxes: p3 } = s2(855), { CCancelRequest: R2, CEchoRequest: f, CEchoResponse: y, CFindRequest: S2, CFindResponse: I2, CGetRequest: C2, CGetResponse: P, CMoveRequest: v3, CMoveResponse: x, Command: w2, CStoreRequest: A2, CStoreResponse: U2, NActionRequest: q2, NActionResponse: D2, NCreateRequest: E3, NCreateResponse: T, NDeleteRequest: O2, NDeleteResponse: b2, NEventReportRequest: N2, NEventReportResponse: B, NGetRequest: M2, NGetResponse: L2, NSetRequest: F, NSetResponse: k2, Response: $2 } = s2(406), j2 = s2(347), V2 = s2(719), G = s2(266), _2 = s2(437), { SmartBuffer: z2 } = s2(677), { EOL: Q } = s2(37), W2 = s2(425);
37921
+ class J extends W2 {
37922
37922
  constructor() {
37923
37923
  super();
37924
37924
  }
@@ -37931,7 +37931,7 @@ var require_dcmjs_dimse_min = __commonJS({
37931
37931
  if (void 0 === this.receiving) {
37932
37932
  if (this.minimumReceived && (e3 = Buffer.concat([this.minimumReceived, e3], this.minimumReceived.length + e3.length), this.minimumReceived = void 0), e3.length < 6)
37933
37933
  return void (this.minimumReceived = e3);
37934
- const t3 = z.fromBuffer(e3, "ascii");
37934
+ const t3 = z2.fromBuffer(e3, "ascii");
37935
37935
  t3.readUInt8(), t3.readUInt8();
37936
37936
  const s3 = t3.readUInt32BE();
37937
37937
  let n3 = e3.length - 6;
@@ -37957,7 +37957,7 @@ var require_dcmjs_dimse_min = __commonJS({
37957
37957
  }
37958
37958
  e2.exports = class extends W2 {
37959
37959
  constructor(e3, t3) {
37960
- super(), this.messageId = 0, this.socket = e3, this.requests = [], this.pending = [], this.dimseBuffer = void 0, this.dimse = void 0, t3 = t3 || {}, this.connectTimeout = t3.connectTimeout || 18e4, this.associationTimeout = t3.associationTimeout || 6e4, this.pduTimeout = t3.pduTimeout || 6e4, this.logCommandDatasets = t3.logCommandDatasets || false, this.logDatasets = t3.logDatasets || false, this.datasetReadOptions = t3.datasetReadOptions || {}, this.datasetWriteOptions = t3.datasetWriteOptions || {}, this.datasetNameMap = t3.datasetNameMap || {}, this.logId = "", this.connected = false, this.connectedTime = void 0, this.lastPduTime = void 0, this.timeoutIntervalId = void 0, this.statistics = new G2(), this._wrapSocket();
37960
+ super(), this.messageId = 0, this.socket = e3, this.requests = [], this.pending = [], this.dimseBuffer = void 0, this.dimse = void 0, t3 = t3 || {}, this.connectTimeout = t3.connectTimeout || 18e4, this.associationTimeout = t3.associationTimeout || 6e4, this.pduTimeout = t3.pduTimeout || 6e4, this.logCommandDatasets = t3.logCommandDatasets || false, this.logDatasets = t3.logDatasets || false, this.datasetReadOptions = t3.datasetReadOptions || {}, this.datasetWriteOptions = t3.datasetWriteOptions || {}, this.datasetNameMap = t3.datasetNameMap || {}, this.logId = "", this.connected = false, this.connectedTime = void 0, this.lastPduTime = void 0, this.timeoutIntervalId = void 0, this.statistics = new G(), this._wrapSocket();
37961
37961
  }
37962
37962
  sendAssociationRequest(e3) {
37963
37963
  this.association = e3;
@@ -38110,79 +38110,79 @@ var require_dcmjs_dimse_min = __commonJS({
38110
38110
  _processPDataTf(e3) {
38111
38111
  try {
38112
38112
  e3.getPdvs().forEach((e4) => {
38113
- this.dimseBuffer || (this.dimseBuffer = z.fromOptions({ encoding: "ascii" })), this.dimseBuffer.writeBuffer(e4.getValue());
38113
+ this.dimseBuffer || (this.dimseBuffer = z2.fromOptions({ encoding: "ascii" })), this.dimseBuffer.writeBuffer(e4.getValue());
38114
38114
  const t3 = this.association.getPresentationContext(e4.getPresentationContextId());
38115
38115
  if (e4.isLastFragment())
38116
38116
  if (e4.isCommand()) {
38117
38117
  const s3 = new w2(new j2(this.dimseBuffer.toBuffer()));
38118
38118
  switch (s3.getCommandFieldType()) {
38119
- case g2.CEchoRequest:
38119
+ case g3.CEchoRequest:
38120
38120
  this.dimse = Object.assign(new f(), s3);
38121
38121
  break;
38122
- case g2.CEchoResponse:
38122
+ case g3.CEchoResponse:
38123
38123
  this.dimse = Object.assign(new y(), s3);
38124
38124
  break;
38125
- case g2.CFindRequest:
38125
+ case g3.CFindRequest:
38126
38126
  this.dimse = Object.assign(new S2(), s3);
38127
38127
  break;
38128
- case g2.CFindResponse:
38128
+ case g3.CFindResponse:
38129
38129
  this.dimse = Object.assign(new I2(), s3);
38130
38130
  break;
38131
- case g2.CStoreRequest:
38131
+ case g3.CStoreRequest:
38132
38132
  this.dimse = Object.assign(new A2(), s3);
38133
38133
  break;
38134
- case g2.CStoreResponse:
38134
+ case g3.CStoreResponse:
38135
38135
  this.dimse = Object.assign(new U2(), s3);
38136
38136
  break;
38137
- case g2.CMoveRequest:
38137
+ case g3.CMoveRequest:
38138
38138
  this.dimse = Object.assign(new v3(), s3);
38139
38139
  break;
38140
- case g2.CMoveResponse:
38140
+ case g3.CMoveResponse:
38141
38141
  this.dimse = Object.assign(new x(), s3);
38142
38142
  break;
38143
- case g2.CGetRequest:
38143
+ case g3.CGetRequest:
38144
38144
  this.dimse = Object.assign(new C2(), s3);
38145
38145
  break;
38146
- case g2.CGetResponse:
38146
+ case g3.CGetResponse:
38147
38147
  this.dimse = Object.assign(new P(), s3);
38148
38148
  break;
38149
- case g2.NCreateRequest:
38149
+ case g3.NCreateRequest:
38150
38150
  this.dimse = Object.assign(new E3(), s3);
38151
38151
  break;
38152
- case g2.NCreateResponse:
38153
- this.dimse = Object.assign(new T2(), s3);
38152
+ case g3.NCreateResponse:
38153
+ this.dimse = Object.assign(new T(), s3);
38154
38154
  break;
38155
- case g2.NActionRequest:
38155
+ case g3.NActionRequest:
38156
38156
  this.dimse = Object.assign(new q2(), s3);
38157
38157
  break;
38158
- case g2.NActionResponse:
38158
+ case g3.NActionResponse:
38159
38159
  this.dimse = Object.assign(new D2(), s3);
38160
38160
  break;
38161
- case g2.NDeleteRequest:
38161
+ case g3.NDeleteRequest:
38162
38162
  this.dimse = Object.assign(new O2(), s3);
38163
38163
  break;
38164
- case g2.NDeleteResponse:
38164
+ case g3.NDeleteResponse:
38165
38165
  this.dimse = Object.assign(new b2(), s3);
38166
38166
  break;
38167
- case g2.NEventReportRequest:
38168
- this.dimse = Object.assign(new N(), s3);
38167
+ case g3.NEventReportRequest:
38168
+ this.dimse = Object.assign(new N2(), s3);
38169
38169
  break;
38170
- case g2.NEventReportResponse:
38171
- this.dimse = Object.assign(new B2(), s3);
38170
+ case g3.NEventReportResponse:
38171
+ this.dimse = Object.assign(new B(), s3);
38172
38172
  break;
38173
- case g2.NGetRequest:
38174
- this.dimse = Object.assign(new M(), s3);
38173
+ case g3.NGetRequest:
38174
+ this.dimse = Object.assign(new M2(), s3);
38175
38175
  break;
38176
- case g2.NGetResponse:
38176
+ case g3.NGetResponse:
38177
38177
  this.dimse = Object.assign(new L2(), s3);
38178
38178
  break;
38179
- case g2.NSetRequest:
38180
- this.dimse = Object.assign(new F2(), s3);
38179
+ case g3.NSetRequest:
38180
+ this.dimse = Object.assign(new F(), s3);
38181
38181
  break;
38182
- case g2.NSetResponse:
38182
+ case g3.NSetResponse:
38183
38183
  this.dimse = Object.assign(new k2(), s3);
38184
38184
  break;
38185
- case g2.CCancelRequest:
38185
+ case g3.CCancelRequest:
38186
38186
  this.dimse = Object.assign(new R2(), s3);
38187
38187
  break;
38188
38188
  default:
@@ -38205,41 +38205,41 @@ var require_dcmjs_dimse_min = __commonJS({
38205
38205
  const e4 = Object.assign(Object.create(Object.getPrototypeOf(t3)), t3), s3 = this.pending.find((e5) => e5.getMessageId() === t3.getMessageIdBeingRespondedTo());
38206
38206
  s3 && (s3.raiseResponseEvent(e4), e4.getStatus() !== l2.Pending && s3.raiseDoneEvent());
38207
38207
  } else
38208
- t3.getCommandFieldType() === g2.CEchoRequest ? this.emit("cEchoRequest", t3, (t4) => {
38208
+ t3.getCommandFieldType() === g3.CEchoRequest ? this.emit("cEchoRequest", t3, (t4) => {
38209
38209
  this._sendDimse({ context: e3, command: t4 });
38210
- }) : t3.getCommandFieldType() === g2.CFindRequest ? this.emit("cFindRequest", t3, (t4) => {
38210
+ }) : t3.getCommandFieldType() === g3.CFindRequest ? this.emit("cFindRequest", t3, (t4) => {
38211
38211
  (Array.isArray(t4) ? t4 : [t4]).forEach((t5) => {
38212
38212
  this._sendDimse({ context: e3, command: t5 });
38213
38213
  });
38214
- }) : t3.getCommandFieldType() === g2.CStoreRequest ? this.emit("cStoreRequest", t3, (t4) => {
38214
+ }) : t3.getCommandFieldType() === g3.CStoreRequest ? this.emit("cStoreRequest", t3, (t4) => {
38215
38215
  this._sendDimse({ context: e3, command: t4 });
38216
- }) : t3.getCommandFieldType() === g2.CMoveRequest ? this.emit("cMoveRequest", t3, (t4) => {
38216
+ }) : t3.getCommandFieldType() === g3.CMoveRequest ? this.emit("cMoveRequest", t3, (t4) => {
38217
38217
  (Array.isArray(t4) ? t4 : [t4]).forEach((t5) => {
38218
38218
  this._sendDimse({ context: e3, command: t5 });
38219
38219
  });
38220
- }) : t3.getCommandFieldType() === g2.CGetRequest ? this.emit("cGetRequest", t3, (t4) => {
38220
+ }) : t3.getCommandFieldType() === g3.CGetRequest ? this.emit("cGetRequest", t3, (t4) => {
38221
38221
  (Array.isArray(t4) ? t4 : [t4]).forEach((t5) => {
38222
38222
  this._sendDimse({ context: e3, command: t5 });
38223
38223
  });
38224
- }) : t3.getCommandFieldType() === g2.NCreateRequest ? this.emit("nCreateRequest", t3, (t4) => {
38224
+ }) : t3.getCommandFieldType() === g3.NCreateRequest ? this.emit("nCreateRequest", t3, (t4) => {
38225
38225
  this._sendDimse({ context: e3, command: t4 });
38226
- }) : t3.getCommandFieldType() === g2.NActionRequest ? this.emit("nActionRequest", t3, (t4) => {
38226
+ }) : t3.getCommandFieldType() === g3.NActionRequest ? this.emit("nActionRequest", t3, (t4) => {
38227
38227
  this._sendDimse({ context: e3, command: t4 });
38228
- }) : t3.getCommandFieldType() === g2.NDeleteRequest ? this.emit("nDeleteRequest", t3, (t4) => {
38228
+ }) : t3.getCommandFieldType() === g3.NDeleteRequest ? this.emit("nDeleteRequest", t3, (t4) => {
38229
38229
  this._sendDimse({ context: e3, command: t4 });
38230
- }) : t3.getCommandFieldType() === g2.NEventReportRequest ? this.emit("nEventReportRequest", t3, (t4) => {
38230
+ }) : t3.getCommandFieldType() === g3.NEventReportRequest ? this.emit("nEventReportRequest", t3, (t4) => {
38231
38231
  this._sendDimse({ context: e3, command: t4 });
38232
- }) : t3.getCommandFieldType() === g2.NGetRequest ? this.emit("nGetRequest", t3, (t4) => {
38232
+ }) : t3.getCommandFieldType() === g3.NGetRequest ? this.emit("nGetRequest", t3, (t4) => {
38233
38233
  this._sendDimse({ context: e3, command: t4 });
38234
- }) : t3.getCommandFieldType() === g2.NSetRequest ? this.emit("nSetRequest", t3, (t4) => {
38234
+ }) : t3.getCommandFieldType() === g3.NSetRequest ? this.emit("nSetRequest", t3, (t4) => {
38235
38235
  this._sendDimse({ context: e3, command: t4 });
38236
- }) : t3.getCommandFieldType() === g2.CCancelRequest && this.emit("cCancelRequest", t3);
38236
+ }) : t3.getCommandFieldType() === g3.CCancelRequest && this.emit("cCancelRequest", t3);
38237
38237
  }
38238
38238
  _wrapSocket() {
38239
38239
  this.socket.setTimeout(this.connectTimeout), this.socket.on("connect", () => {
38240
38240
  this.connected = true, this.connectedTime = Date.now(), this.emit("connect");
38241
38241
  });
38242
- const e3 = new J2();
38242
+ const e3 = new J();
38243
38243
  e3.on("pdu", (e4) => {
38244
38244
  this.lastPduTime = Date.now(), this._processPdu(e4);
38245
38245
  }), this.socket.on("data", (t3) => {
@@ -38716,7 +38716,7 @@ var require_dcmjs_dimse_min = __commonJS({
38716
38716
  }
38717
38717
  }, Pdv: m3, RawPdu: h3 };
38718
38718
  }, 975: (e2, t2, s2) => {
38719
- const { CEchoResponse: n2, CFindResponse: i3, CGetResponse: r5, CMoveResponse: o2, CStoreResponse: a, NActionResponse: c3, NCreateResponse: d3, NDeleteResponse: u2, NEventReportResponse: h3, NGetResponse: m3, NSetResponse: g2 } = s2(406), l2 = s2(988), p3 = s2(266), R2 = s2(437), f = s2(425), y = s2(808), S2 = s2(404);
38719
+ const { CEchoResponse: n2, CFindResponse: i3, CGetResponse: r5, CMoveResponse: o2, CStoreResponse: a, NActionResponse: c3, NCreateResponse: d3, NDeleteResponse: u2, NEventReportResponse: h3, NGetResponse: m3, NSetResponse: g3 } = s2(406), l2 = s2(988), p3 = s2(266), R2 = s2(437), f = s2(425), y = s2(808), S2 = s2(404);
38720
38720
  e2.exports = { Scp: class extends l2 {
38721
38721
  constructor(e3, t3) {
38722
38722
  super(e3, t3), this.on("associationRequested", (e4) => {
@@ -38788,7 +38788,7 @@ var require_dcmjs_dimse_min = __commonJS({
38788
38788
  R2.error("nGetRequest method must be implemented"), t3(m3.fromRequest(e3));
38789
38789
  }
38790
38790
  nSetRequest(e3, t3) {
38791
- R2.error("nSetRequest method must be implemented"), t3(g2.fromRequest(e3));
38791
+ R2.error("nSetRequest method must be implemented"), t3(g3.fromRequest(e3));
38792
38792
  }
38793
38793
  cCancelRequest(e3) {
38794
38794
  R2.error("cCancelRequest method must be implemented");
@@ -38858,8 +38858,8 @@ var require_dcmjs_dimse_min = __commonJS({
38858
38858
  }
38859
38859
  };
38860
38860
  }, 10: (e2, t2, s2) => {
38861
- const { Association: n2, PresentationContext: i3 } = s2(201), { Scp: r5, Server: o2 } = s2(975), { CCancelRequest: a, CEchoRequest: c3, CEchoResponse: d3, CFindRequest: u2, CFindResponse: h3, CGetRequest: m3, CGetResponse: g2, CMoveRequest: l2, CMoveResponse: p3, CStoreRequest: R2, CStoreResponse: f, NActionRequest: y, NActionResponse: S2, NCreateRequest: I2, NCreateResponse: C2, NDeleteRequest: P, NDeleteResponse: v3, NEventReportRequest: x, NEventReportResponse: w2, NGetRequest: A2, NGetResponse: U2, NSetRequest: q2, NSetResponse: D2 } = s2(406), { AbortReason: E3, AbortSource: T2, CommandFieldType: O2, PresentationContextResult: b2, Priority: N, RejectReason: B2, RejectResult: M, RejectSource: L2, SopClass: F2, Status: k2, StorageClass: $2, TransferSyntax: j2, Uid: V2, UserIdentityType: G2 } = s2(855), _2 = s2(185), z = s2(347), Q = s2(719), W2 = s2(266), J2 = { association: { Association: n2, PresentationContext: i3 }, Client: _2, constants: { AbortReason: E3, AbortSource: T2, CommandFieldType: O2, PresentationContextResult: b2, Priority: N, RejectReason: B2, RejectResult: M, RejectSource: L2, SopClass: F2, Status: k2, StorageClass: $2, TransferSyntax: j2, Uid: V2, UserIdentityType: G2 }, Dataset: z, Implementation: Q, log: s2(437), requests: { CCancelRequest: a, CEchoRequest: c3, CFindRequest: u2, CGetRequest: m3, CMoveRequest: l2, CStoreRequest: R2, NActionRequest: y, NCreateRequest: I2, NDeleteRequest: P, NEventReportRequest: x, NGetRequest: A2, NSetRequest: q2 }, responses: { CEchoResponse: d3, CFindResponse: h3, CGetResponse: g2, CMoveResponse: p3, CStoreResponse: f, NActionResponse: S2, NCreateResponse: C2, NDeleteResponse: v3, NEventReportResponse: w2, NGetResponse: U2, NSetResponse: D2 }, Scp: r5, Server: o2, Statistics: W2, version: s2(972) };
38862
- e2.exports = J2;
38861
+ const { Association: n2, PresentationContext: i3 } = s2(201), { Scp: r5, Server: o2 } = s2(975), { CCancelRequest: a, CEchoRequest: c3, CEchoResponse: d3, CFindRequest: u2, CFindResponse: h3, CGetRequest: m3, CGetResponse: g3, CMoveRequest: l2, CMoveResponse: p3, CStoreRequest: R2, CStoreResponse: f, NActionRequest: y, NActionResponse: S2, NCreateRequest: I2, NCreateResponse: C2, NDeleteRequest: P, NDeleteResponse: v3, NEventReportRequest: x, NEventReportResponse: w2, NGetRequest: A2, NGetResponse: U2, NSetRequest: q2, NSetResponse: D2 } = s2(406), { AbortReason: E3, AbortSource: T, CommandFieldType: O2, PresentationContextResult: b2, Priority: N2, RejectReason: B, RejectResult: M2, RejectSource: L2, SopClass: F, Status: k2, StorageClass: $2, TransferSyntax: j2, Uid: V2, UserIdentityType: G } = s2(855), _2 = s2(185), z2 = s2(347), Q = s2(719), W2 = s2(266), J = { association: { Association: n2, PresentationContext: i3 }, Client: _2, constants: { AbortReason: E3, AbortSource: T, CommandFieldType: O2, PresentationContextResult: b2, Priority: N2, RejectReason: B, RejectResult: M2, RejectSource: L2, SopClass: F, Status: k2, StorageClass: $2, TransferSyntax: j2, Uid: V2, UserIdentityType: G }, Dataset: z2, Implementation: Q, log: s2(437), requests: { CCancelRequest: a, CEchoRequest: c3, CFindRequest: u2, CGetRequest: m3, CMoveRequest: l2, CStoreRequest: R2, NActionRequest: y, NCreateRequest: I2, NDeleteRequest: P, NEventReportRequest: x, NGetRequest: A2, NSetRequest: q2 }, responses: { CEchoResponse: d3, CFindResponse: h3, CGetResponse: g3, CMoveResponse: p3, CStoreResponse: f, NActionResponse: S2, NCreateResponse: C2, NDeleteResponse: v3, NEventReportResponse: w2, NGetResponse: U2, NSetResponse: D2 }, Scp: r5, Server: o2, Statistics: W2, version: s2(972) };
38862
+ e2.exports = J;
38863
38863
  }, 437: (e2, t2, s2) => {
38864
38864
  const { createLogger: n2, format: i3, transports: r5 } = s2(469), { combine: o2, printf: a, timestamp: c3 } = i3, d3 = n2({ format: o2(c3(), a(({ level: e3, message: t3, timestamp: s3 }) => `${s3} -- ${e3.toUpperCase()} -- ${t3}`)), transports: [new r5.Console()] });
38865
38865
  e2.exports = d3;
@@ -38912,7 +38912,7 @@ __export(main_exports, {
38912
38912
  module.exports = __toCommonJS(main_exports);
38913
38913
 
38914
38914
  // ../core/dist/esm/index.mjs
38915
- var Te = class {
38915
+ var Ee = class {
38916
38916
  constructor(e, t) {
38917
38917
  this.operator = e;
38918
38918
  this.child = t;
@@ -38921,7 +38921,7 @@ var Te = class {
38921
38921
  return `${this.operator}(${this.child.toString()})`;
38922
38922
  }
38923
38923
  };
38924
- var $ = class {
38924
+ var j = class {
38925
38925
  constructor(e, t, n) {
38926
38926
  this.operator = e;
38927
38927
  this.left = t;
@@ -38931,7 +38931,7 @@ var $ = class {
38931
38931
  return `${this.left.toString()} ${this.operator} ${this.right.toString()}`;
38932
38932
  }
38933
38933
  };
38934
- var ve = class {
38934
+ var be = class {
38935
38935
  constructor() {
38936
38936
  this.prefixParselets = {};
38937
38937
  this.infixParselets = {};
@@ -38955,10 +38955,10 @@ var ve = class {
38955
38955
  }, precedence: t });
38956
38956
  }
38957
38957
  construct(e) {
38958
- return new it(e, this.prefixParselets, this.infixParselets);
38958
+ return new at(e, this.prefixParselets, this.infixParselets);
38959
38959
  }
38960
38960
  };
38961
- var it = class {
38961
+ var at = class {
38962
38962
  constructor(e, t, n) {
38963
38963
  this.tokens = e, this.prefixParselets = t, this.infixParselets = n;
38964
38964
  }
@@ -38991,7 +38991,7 @@ var it = class {
38991
38991
  throw Error("Cant consume unknown more tokens.");
38992
38992
  if (e && this.peek()?.id !== e) {
38993
38993
  let n = this.peek();
38994
- throw Error(`Expected ${e} but got "${n.id}" at line ${n.line} column ${n.column}.`);
38994
+ throw Error(`Expected ${e} but got "${n.id}" (${n.value}) at line ${n.line} column ${n.column}.`);
38995
38995
  }
38996
38996
  if (t && this.peek()?.value !== t) {
38997
38997
  let n = this.peek();
@@ -39009,44 +39009,44 @@ var it = class {
39009
39009
  return this.infixParselets[e.id === "Symbol" ? e.value : e.id];
39010
39010
  }
39011
39011
  };
39012
- function G(r4) {
39013
- let e = ae(r4), t = vn(r4);
39012
+ function z(r4) {
39013
+ let e = de(r4), t = On(r4);
39014
39014
  return t === e ? { reference: e } : { reference: e, display: t };
39015
39015
  }
39016
- function ae(r4) {
39017
- return ce(r4) ? r4.reference : `${r4.resourceType}/${r4.id}`;
39016
+ function de(r4) {
39017
+ return pe(r4) ? r4.reference : `${r4.resourceType}/${r4.id}`;
39018
39018
  }
39019
- function Yt(r4) {
39019
+ function tr(r4) {
39020
39020
  if (r4)
39021
- return ce(r4) ? r4.reference.split("/")[1] : r4.id;
39021
+ return pe(r4) ? r4.reference.split("/")[1] : r4.id;
39022
39022
  }
39023
- function Tn(r4) {
39023
+ function kn(r4) {
39024
39024
  return r4.resourceType === "Patient" || r4.resourceType === "Practitioner" || r4.resourceType === "RelatedPerson";
39025
39025
  }
39026
- function vn(r4) {
39027
- if (Tn(r4)) {
39028
- let e = En(r4);
39026
+ function On(r4) {
39027
+ if (kn(r4)) {
39028
+ let e = Vn(r4);
39029
39029
  if (e)
39030
39030
  return e;
39031
39031
  }
39032
39032
  if (r4.resourceType === "Device") {
39033
- let e = Sn(r4);
39033
+ let e = Dn(r4);
39034
39034
  if (e)
39035
39035
  return e;
39036
39036
  }
39037
- return r4.resourceType === "Observation" && "code" in r4 && r4.code?.text ? r4.code.text : r4.resourceType === "User" && r4.email ? r4.email : "name" in r4 && r4.name && typeof r4.name == "string" ? r4.name : ae(r4);
39037
+ return r4.resourceType === "Observation" && "code" in r4 && r4.code?.text ? r4.code.text : r4.resourceType === "User" && r4.email ? r4.email : "name" in r4 && r4.name && typeof r4.name == "string" ? r4.name : de(r4);
39038
39038
  }
39039
- function En(r4) {
39039
+ function Vn(r4) {
39040
39040
  let e = r4.name;
39041
39041
  if (e && e.length > 0)
39042
- return Ae(e[0]);
39042
+ return Ie(e[0]);
39043
39043
  }
39044
- function Sn(r4) {
39044
+ function Dn(r4) {
39045
39045
  let e = r4.deviceName;
39046
39046
  if (e && e.length > 0)
39047
39047
  return e[0].name;
39048
39048
  }
39049
- function Ee(r4, e) {
39049
+ function Re(r4, e) {
39050
39050
  let t = new Date(r4);
39051
39051
  t.setUTCHours(0, 0, 0, 0);
39052
39052
  let n = e ? new Date(e) : /* @__PURE__ */ new Date();
@@ -39055,121 +39055,134 @@ function Ee(r4, e) {
39055
39055
  (u2 < o || u2 === o && l2 < s) && f--;
39056
39056
  let P = a * 12 + u2 - (i2 * 12 + o);
39057
39057
  l2 < s && P--;
39058
- let M = Math.floor((n.getTime() - t.getTime()) / (1e3 * 60 * 60 * 24));
39059
- return { years: f, months: P, days: M };
39058
+ let B = Math.floor((n.getTime() - t.getTime()) / (1e3 * 60 * 60 * 24));
39059
+ return { years: f, months: P, days: B };
39060
39060
  }
39061
- function er(r4, ...e) {
39061
+ function ir(r4, ...e) {
39062
39062
  let t = r4;
39063
39063
  for (let n = 0; n < e.length && t; n++)
39064
39064
  t = t?.extension?.find((i2) => i2.url === e[n]);
39065
39065
  return t;
39066
39066
  }
39067
- function tr(r4, e) {
39068
- return JSON.stringify(r4, bn, e ? 2 : void 0);
39067
+ function or(r4, e) {
39068
+ return JSON.stringify(r4, Nn, e ? 2 : void 0);
39069
39069
  }
39070
- function bn(r4, e) {
39071
- return !Rn(r4) && S(e) ? void 0 : e;
39070
+ function Nn(r4, e) {
39071
+ return !Fn(r4) && E(e) ? void 0 : e;
39072
39072
  }
39073
- function Rn(r4) {
39073
+ function Fn(r4) {
39074
39074
  return !!/\d+$/.exec(r4);
39075
39075
  }
39076
- function S(r4) {
39076
+ function E(r4) {
39077
39077
  if (r4 == null)
39078
39078
  return true;
39079
39079
  let e = typeof r4;
39080
- return e === "string" && r4 === "" || e === "object" && Object.keys(r4).length === 0;
39080
+ return e === "string" || e === "object" ? !_n(r4) : false;
39081
+ }
39082
+ function _n(r4) {
39083
+ if (r4 == null)
39084
+ return false;
39085
+ let e = typeof r4;
39086
+ return e === "string" && r4 !== "" || e === "object" && ("length" in r4 && r4.length > 0 || Object.keys(r4).length > 0);
39081
39087
  }
39082
- function rr(r4) {
39088
+ function sr(r4) {
39083
39089
  return r4.every((e) => typeof e == "string");
39084
39090
  }
39085
- var nr = [];
39091
+ var ar = [];
39086
39092
  for (let r4 = 0; r4 < 256; r4++)
39087
- nr.push(r4.toString(16).padStart(2, "0"));
39088
- function ir(r4) {
39093
+ ar.push(r4.toString(16).padStart(2, "0"));
39094
+ function cr(r4) {
39089
39095
  let e = new Uint8Array(r4), t = new Array(e.length);
39090
39096
  for (let n = 0; n < e.length; n++)
39091
- t[n] = nr[e[n]];
39097
+ t[n] = ar[e[n]];
39092
39098
  return t.join("");
39093
39099
  }
39094
- function or(r4) {
39100
+ function ur(r4) {
39095
39101
  let e = new Uint8Array(r4), t = [];
39096
39102
  for (let n = 0; n < e.length; n++)
39097
39103
  t[n] = String.fromCharCode(e[n]);
39098
39104
  return window.btoa(t.join(""));
39099
39105
  }
39100
- function C(r4) {
39106
+ function w(r4) {
39101
39107
  return r4 ? r4.charAt(0).toUpperCase() + r4.substring(1) : "";
39102
39108
  }
39103
- var at = (r4) => new Promise((e) => {
39109
+ var lt = (r4) => new Promise((e) => {
39104
39110
  setTimeout(e, r4);
39105
39111
  });
39106
- function Ae(r4, e) {
39112
+ function Ie(r4, e) {
39107
39113
  let t = [];
39108
39114
  if (r4.prefix && e?.prefix !== false && t.push(...r4.prefix), r4.given && t.push(...r4.given), r4.family && t.push(r4.family), r4.suffix && e?.suffix !== false && t.push(...r4.suffix), r4.use && (e?.all || e?.use) && t.push("[" + r4.use + "]"), t.length === 0) {
39109
- let n = ee(r4.text);
39115
+ let n = re(r4.text);
39110
39116
  if (n)
39111
39117
  return n;
39112
39118
  }
39113
39119
  return t.join(" ").trim();
39114
39120
  }
39115
- function ee(r4) {
39121
+ function re(r4) {
39116
39122
  return typeof r4 == "string" ? r4 : void 0;
39117
39123
  }
39118
- function Hn(r4, e) {
39124
+ function ni(r4, e) {
39119
39125
  let t = e.max && e.max === Number.MAX_SAFE_INTEGER ? Number.POSITIVE_INFINITY : e.max;
39120
39126
  return { path: r4, description: "", type: e.type ?? [], min: e.min ?? 0, max: t ?? 1, isArray: !!t && t > 1, constraints: [] };
39121
39127
  }
39122
- function ur(r4) {
39128
+ function fr(r4) {
39123
39129
  let e = /* @__PURE__ */ Object.create(null);
39124
39130
  for (let [t, n] of Object.entries(r4))
39125
- e[t] = { name: t, elements: Object.fromEntries(Object.entries(n.elements).map(([i2, o]) => [i2, Hn(i2, o)])), constraints: [], innerTypes: [] };
39131
+ e[t] = { name: t, elements: Object.fromEntries(Object.entries(n.elements).map(([i2, o]) => [i2, ni(i2, o)])), constraints: [], innerTypes: [] };
39126
39132
  return e;
39127
39133
  }
39128
- var lr = { Element: { elements: { id: { type: [{ code: "string" }] }, extension: { max: 9007199254740991, type: [{ code: "Extension" }] } } }, BackboneElement: { elements: { id: { type: [{ code: "string" }] }, extension: { max: 9007199254740991, type: [{ code: "Extension" }] }, modifierExtension: { max: 9007199254740991, type: [{ code: "Extension" }] } } }, Address: { elements: { id: { type: [{ code: "string" }] }, extension: { max: 9007199254740991, type: [{ code: "Extension" }] }, use: { type: [{ code: "code" }] }, type: { type: [{ code: "code" }] }, text: { type: [{ code: "string" }] }, line: { max: 9007199254740991, type: [{ code: "string" }] }, city: { type: [{ code: "string" }] }, district: { type: [{ code: "string" }] }, state: { type: [{ code: "string" }] }, postalCode: { type: [{ code: "string" }] }, country: { type: [{ code: "string" }] }, period: { type: [{ code: "Period" }] } } }, Age: { elements: { id: { type: [{ code: "string" }] }, extension: { max: 9007199254740991, type: [{ code: "Extension" }] }, value: { type: [{ code: "decimal" }] }, comparator: { type: [{ code: "code" }] }, unit: { type: [{ code: "string" }] }, system: { type: [{ code: "uri" }] }, code: { type: [{ code: "code" }] } } }, Annotation: { elements: { id: { type: [{ code: "string" }] }, extension: { max: 9007199254740991, type: [{ code: "Extension" }] }, "author[x]": { type: [{ code: "Reference", targetProfile: ["http://hl7.org/fhir/StructureDefinition/Practitioner", "http://hl7.org/fhir/StructureDefinition/Patient", "http://hl7.org/fhir/StructureDefinition/RelatedPerson", "http://hl7.org/fhir/StructureDefinition/Organization"] }, { code: "string" }] }, time: { type: [{ code: "dateTime" }] }, text: { min: 1, type: [{ code: "markdown" }] } } }, Attachment: { elements: { id: { type: [{ code: "string" }] }, extension: { max: 9007199254740991, type: [{ code: "Extension" }] }, contentType: { type: [{ code: "code" }] }, language: { type: [{ code: "code" }] }, data: { type: [{ code: "base64Binary" }] }, url: { type: [{ code: "url" }] }, size: { type: [{ code: "unsignedInt" }] }, hash: { type: [{ code: "base64Binary" }] }, title: { type: [{ code: "string" }] }, creation: { type: [{ code: "dateTime" }] } } }, CodeableConcept: { elements: { id: { type: [{ code: "string" }] }, extension: { max: 9007199254740991, type: [{ code: "Extension" }] }, coding: { max: 9007199254740991, type: [{ code: "Coding" }] }, text: { type: [{ code: "string" }] } } }, Coding: { elements: { id: { type: [{ code: "string" }] }, extension: { max: 9007199254740991, type: [{ code: "Extension" }] }, system: { type: [{ code: "uri" }] }, version: { type: [{ code: "string" }] }, code: { type: [{ code: "code" }] }, display: { type: [{ code: "string" }] }, userSelected: { type: [{ code: "boolean" }] } } }, ContactDetail: { elements: { id: { type: [{ code: "string" }] }, extension: { max: 9007199254740991, type: [{ code: "Extension" }] }, name: { type: [{ code: "string" }] }, telecom: { max: 9007199254740991, type: [{ code: "ContactPoint" }] } } }, ContactPoint: { elements: { id: { type: [{ code: "string" }] }, extension: { max: 9007199254740991, type: [{ code: "Extension" }] }, system: { type: [{ code: "code" }] }, value: { type: [{ code: "string" }] }, use: { type: [{ code: "code" }] }, rank: { type: [{ code: "positiveInt" }] }, period: { type: [{ code: "Period" }] } } }, Contributor: { elements: { id: { type: [{ code: "string" }] }, extension: { max: 9007199254740991, type: [{ code: "Extension" }] }, type: { min: 1, type: [{ code: "code" }] }, name: { min: 1, type: [{ code: "string" }] }, contact: { max: 9007199254740991, type: [{ code: "ContactDetail" }] } } }, Count: { elements: { id: { type: [{ code: "string" }] }, extension: { max: 9007199254740991, type: [{ code: "Extension" }] }, value: { type: [{ code: "decimal" }] }, comparator: { type: [{ code: "code" }] }, unit: { type: [{ code: "string" }] }, system: { type: [{ code: "uri" }] }, code: { type: [{ code: "code" }] } } }, DataRequirement: { elements: { id: { type: [{ code: "string" }] }, extension: { max: 9007199254740991, type: [{ code: "Extension" }] }, type: { min: 1, type: [{ code: "code" }] }, profile: { max: 9007199254740991, type: [{ code: "canonical", targetProfile: ["http://hl7.org/fhir/StructureDefinition/StructureDefinition"] }] }, "subject[x]": { type: [{ code: "CodeableConcept" }, { code: "Reference", targetProfile: ["http://hl7.org/fhir/StructureDefinition/Group"] }] }, mustSupport: { max: 9007199254740991, type: [{ code: "string" }] }, codeFilter: { max: 9007199254740991, type: [{ code: "DataRequirementCodeFilter" }] }, dateFilter: { max: 9007199254740991, type: [{ code: "DataRequirementDateFilter" }] }, limit: { type: [{ code: "positiveInt" }] }, sort: { max: 9007199254740991, type: [{ code: "DataRequirementSort" }] } } }, Distance: { elements: { id: { type: [{ code: "string" }] }, extension: { max: 9007199254740991, type: [{ code: "Extension" }] }, value: { type: [{ code: "decimal" }] }, comparator: { type: [{ code: "code" }] }, unit: { type: [{ code: "string" }] }, system: { type: [{ code: "uri" }] }, code: { type: [{ code: "code" }] } } }, Dosage: { elements: { id: { type: [{ code: "string" }] }, extension: { max: 9007199254740991, type: [{ code: "Extension" }] }, modifierExtension: { max: 9007199254740991, type: [{ code: "Extension" }] }, sequence: { type: [{ code: "integer" }] }, text: { type: [{ code: "string" }] }, additionalInstruction: { max: 9007199254740991, type: [{ code: "CodeableConcept" }] }, patientInstruction: { type: [{ code: "string" }] }, timing: { type: [{ code: "Timing" }] }, "asNeeded[x]": { type: [{ code: "boolean" }, { code: "CodeableConcept" }] }, site: { type: [{ code: "CodeableConcept" }] }, route: { type: [{ code: "CodeableConcept" }] }, method: { type: [{ code: "CodeableConcept" }] }, doseAndRate: { max: 9007199254740991, type: [{ code: "DosageDoseAndRate" }] }, maxDosePerPeriod: { type: [{ code: "Ratio" }] }, maxDosePerAdministration: { type: [{ code: "Quantity" }] }, maxDosePerLifetime: { type: [{ code: "Quantity" }] } } }, Duration: { elements: { id: { type: [{ code: "string" }] }, extension: { max: 9007199254740991, type: [{ code: "Extension" }] }, value: { type: [{ code: "decimal" }] }, comparator: { type: [{ code: "code" }] }, unit: { type: [{ code: "string" }] }, system: { type: [{ code: "uri" }] }, code: { type: [{ code: "code" }] } } }, ElementDefinition: { elements: { id: { type: [{ code: "string" }] }, extension: { max: 9007199254740991, type: [{ code: "Extension" }] }, modifierExtension: { max: 9007199254740991, type: [{ code: "Extension" }] }, path: { min: 1, type: [{ code: "string" }] }, representation: { max: 9007199254740991, type: [{ code: "code" }] }, sliceName: { type: [{ code: "string" }] }, sliceIsConstraining: { type: [{ code: "boolean" }] }, label: { type: [{ code: "string" }] }, code: { max: 9007199254740991, type: [{ code: "Coding" }] }, slicing: { type: [{ code: "ElementDefinitionSlicing" }] }, short: { type: [{ code: "string" }] }, definition: { type: [{ code: "markdown" }] }, comment: { type: [{ code: "markdown" }] }, requirements: { type: [{ code: "markdown" }] }, alias: { max: 9007199254740991, type: [{ code: "string" }] }, min: { type: [{ code: "unsignedInt" }] }, max: { type: [{ code: "string" }] }, base: { type: [{ code: "ElementDefinitionBase" }] }, contentReference: { type: [{ code: "uri" }] }, type: { max: 9007199254740991, type: [{ code: "ElementDefinitionType" }] }, "defaultValue[x]": { type: [{ code: "base64Binary" }, { code: "boolean" }, { code: "canonical" }, { code: "code" }, { code: "date" }, { code: "dateTime" }, { code: "decimal" }, { code: "id" }, { code: "instant" }, { code: "integer" }, { code: "markdown" }, { code: "oid" }, { code: "positiveInt" }, { code: "string" }, { code: "time" }, { code: "unsignedInt" }, { code: "uri" }, { code: "url" }, { code: "uuid" }, { code: "Address" }, { code: "Age" }, { code: "Annotation" }, { code: "Attachment" }, { code: "CodeableConcept" }, { code: "Coding" }, { code: "ContactPoint" }, { code: "Count" }, { code: "Distance" }, { code: "Duration" }, { code: "HumanName" }, { code: "Identifier" }, { code: "Money" }, { code: "Period" }, { code: "Quantity" }, { code: "Range" }, { code: "Ratio" }, { code: "Reference" }, { code: "SampledData" }, { code: "Signature" }, { code: "Timing" }, { code: "ContactDetail" }, { code: "Contributor" }, { code: "DataRequirement" }, { code: "Expression" }, { code: "ParameterDefinition" }, { code: "RelatedArtifact" }, { code: "TriggerDefinition" }, { code: "UsageContext" }, { code: "Dosage" }, { code: "Meta" }] }, meaningWhenMissing: { type: [{ code: "markdown" }] }, orderMeaning: { type: [{ code: "string" }] }, "fixed[x]": { type: [{ code: "base64Binary" }, { code: "boolean" }, { code: "canonical" }, { code: "code" }, { code: "date" }, { code: "dateTime" }, { code: "decimal" }, { code: "id" }, { code: "instant" }, { code: "integer" }, { code: "markdown" }, { code: "oid" }, { code: "positiveInt" }, { code: "string" }, { code: "time" }, { code: "unsignedInt" }, { code: "uri" }, { code: "url" }, { code: "uuid" }, { code: "Address" }, { code: "Age" }, { code: "Annotation" }, { code: "Attachment" }, { code: "CodeableConcept" }, { code: "Coding" }, { code: "ContactPoint" }, { code: "Count" }, { code: "Distance" }, { code: "Duration" }, { code: "HumanName" }, { code: "Identifier" }, { code: "Money" }, { code: "Period" }, { code: "Quantity" }, { code: "Range" }, { code: "Ratio" }, { code: "Reference" }, { code: "SampledData" }, { code: "Signature" }, { code: "Timing" }, { code: "ContactDetail" }, { code: "Contributor" }, { code: "DataRequirement" }, { code: "Expression" }, { code: "ParameterDefinition" }, { code: "RelatedArtifact" }, { code: "TriggerDefinition" }, { code: "UsageContext" }, { code: "Dosage" }, { code: "Meta" }] }, "pattern[x]": { type: [{ code: "base64Binary" }, { code: "boolean" }, { code: "canonical" }, { code: "code" }, { code: "date" }, { code: "dateTime" }, { code: "decimal" }, { code: "id" }, { code: "instant" }, { code: "integer" }, { code: "markdown" }, { code: "oid" }, { code: "positiveInt" }, { code: "string" }, { code: "time" }, { code: "unsignedInt" }, { code: "uri" }, { code: "url" }, { code: "uuid" }, { code: "Address" }, { code: "Age" }, { code: "Annotation" }, { code: "Attachment" }, { code: "CodeableConcept" }, { code: "Coding" }, { code: "ContactPoint" }, { code: "Count" }, { code: "Distance" }, { code: "Duration" }, { code: "HumanName" }, { code: "Identifier" }, { code: "Money" }, { code: "Period" }, { code: "Quantity" }, { code: "Range" }, { code: "Ratio" }, { code: "Reference" }, { code: "SampledData" }, { code: "Signature" }, { code: "Timing" }, { code: "ContactDetail" }, { code: "Contributor" }, { code: "DataRequirement" }, { code: "Expression" }, { code: "ParameterDefinition" }, { code: "RelatedArtifact" }, { code: "TriggerDefinition" }, { code: "UsageContext" }, { code: "Dosage" }, { code: "Meta" }] }, example: { max: 9007199254740991, type: [{ code: "ElementDefinitionExample" }] }, "minValue[x]": { type: [{ code: "date" }, { code: "dateTime" }, { code: "instant" }, { code: "time" }, { code: "decimal" }, { code: "integer" }, { code: "positiveInt" }, { code: "unsignedInt" }, { code: "Quantity" }] }, "maxValue[x]": { type: [{ code: "date" }, { code: "dateTime" }, { code: "instant" }, { code: "time" }, { code: "decimal" }, { code: "integer" }, { code: "positiveInt" }, { code: "unsignedInt" }, { code: "Quantity" }] }, maxLength: { type: [{ code: "integer" }] }, condition: { max: 9007199254740991, type: [{ code: "id" }] }, constraint: { max: 9007199254740991, type: [{ code: "ElementDefinitionConstraint" }] }, mustSupport: { type: [{ code: "boolean" }] }, isModifier: { type: [{ code: "boolean" }] }, isModifierReason: { type: [{ code: "string" }] }, isSummary: { type: [{ code: "boolean" }] }, binding: { type: [{ code: "ElementDefinitionBinding" }] }, mapping: { max: 9007199254740991, type: [{ code: "ElementDefinitionMapping" }] } } }, Expression: { elements: { id: { type: [{ code: "string" }] }, extension: { max: 9007199254740991, type: [{ code: "Extension" }] }, description: { type: [{ code: "string" }] }, name: { type: [{ code: "id" }] }, language: { min: 1, type: [{ code: "code" }] }, expression: { type: [{ code: "string" }] }, reference: { type: [{ code: "uri" }] } } }, Extension: { elements: { id: { type: [{ code: "string" }] }, extension: { max: 9007199254740991, type: [{ code: "Extension" }] }, url: { min: 1, type: [{ code: "string" }] }, "value[x]": { type: [{ code: "base64Binary" }, { code: "boolean" }, { code: "canonical" }, { code: "code" }, { code: "date" }, { code: "dateTime" }, { code: "decimal" }, { code: "id" }, { code: "instant" }, { code: "integer" }, { code: "markdown" }, { code: "oid" }, { code: "positiveInt" }, { code: "string" }, { code: "time" }, { code: "unsignedInt" }, { code: "uri" }, { code: "url" }, { code: "uuid" }, { code: "Address" }, { code: "Age" }, { code: "Annotation" }, { code: "Attachment" }, { code: "CodeableConcept" }, { code: "Coding" }, { code: "ContactPoint" }, { code: "Count" }, { code: "Distance" }, { code: "Duration" }, { code: "HumanName" }, { code: "Identifier" }, { code: "Money" }, { code: "Period" }, { code: "Quantity" }, { code: "Range" }, { code: "Ratio" }, { code: "Reference" }, { code: "SampledData" }, { code: "Signature" }, { code: "Timing" }, { code: "ContactDetail" }, { code: "Contributor" }, { code: "DataRequirement" }, { code: "Expression" }, { code: "ParameterDefinition" }, { code: "RelatedArtifact" }, { code: "TriggerDefinition" }, { code: "UsageContext" }, { code: "Dosage" }, { code: "Meta" }] } } }, HumanName: { elements: { id: { type: [{ code: "string" }] }, extension: { max: 9007199254740991, type: [{ code: "Extension" }] }, use: { type: [{ code: "code" }] }, text: { type: [{ code: "string" }] }, family: { type: [{ code: "string" }] }, given: { max: 9007199254740991, type: [{ code: "string" }] }, prefix: { max: 9007199254740991, type: [{ code: "string" }] }, suffix: { max: 9007199254740991, type: [{ code: "string" }] }, period: { type: [{ code: "Period" }] } } }, Identifier: { elements: { id: { type: [{ code: "string" }] }, extension: { max: 9007199254740991, type: [{ code: "Extension" }] }, use: { type: [{ code: "code" }] }, type: { type: [{ code: "CodeableConcept" }] }, system: { type: [{ code: "uri" }] }, value: { type: [{ code: "string" }] }, period: { type: [{ code: "Period" }] }, assigner: { type: [{ code: "Reference", targetProfile: ["http://hl7.org/fhir/StructureDefinition/Organization"] }] } } }, MarketingStatus: { elements: { id: { type: [{ code: "string" }] }, extension: { max: 9007199254740991, type: [{ code: "Extension" }] }, modifierExtension: { max: 9007199254740991, type: [{ code: "Extension" }] }, country: { min: 1, type: [{ code: "CodeableConcept" }] }, jurisdiction: { type: [{ code: "CodeableConcept" }] }, status: { min: 1, type: [{ code: "CodeableConcept" }] }, dateRange: { min: 1, type: [{ code: "Period" }] }, restoreDate: { type: [{ code: "dateTime" }] } } }, Meta: { elements: { id: { type: [{ code: "string" }] }, extension: { max: 9007199254740991, type: [{ code: "Extension" }] }, versionId: { type: [{ code: "id" }] }, lastUpdated: { type: [{ code: "instant" }] }, source: { type: [{ code: "uri" }] }, profile: { max: 9007199254740991, type: [{ code: "canonical", targetProfile: ["http://hl7.org/fhir/StructureDefinition/StructureDefinition"] }] }, security: { max: 9007199254740991, type: [{ code: "Coding" }] }, tag: { max: 9007199254740991, type: [{ code: "Coding" }] }, project: { type: [{ code: "uri" }] }, author: { type: [{ code: "Reference" }] }, account: { type: [{ code: "Reference" }] }, compartment: { max: 9007199254740991, type: [{ code: "Reference" }] } } }, Money: { elements: { id: { type: [{ code: "string" }] }, extension: { max: 9007199254740991, type: [{ code: "Extension" }] }, value: { type: [{ code: "decimal" }] }, currency: { type: [{ code: "code" }] } } }, Narrative: { elements: { id: { type: [{ code: "string" }] }, extension: { max: 9007199254740991, type: [{ code: "Extension" }] }, status: { min: 1, type: [{ code: "code" }] }, div: { min: 1, type: [{ code: "xhtml" }] } } }, ParameterDefinition: { elements: { id: { type: [{ code: "string" }] }, extension: { max: 9007199254740991, type: [{ code: "Extension" }] }, name: { type: [{ code: "code" }] }, use: { min: 1, type: [{ code: "code" }] }, min: { type: [{ code: "integer" }] }, max: { type: [{ code: "string" }] }, documentation: { type: [{ code: "string" }] }, type: { min: 1, type: [{ code: "code" }] }, profile: { type: [{ code: "canonical", targetProfile: ["http://hl7.org/fhir/StructureDefinition/StructureDefinition"] }] } } }, Period: { elements: { id: { type: [{ code: "string" }] }, extension: { max: 9007199254740991, type: [{ code: "Extension" }] }, start: { type: [{ code: "dateTime" }] }, end: { type: [{ code: "dateTime" }] } } }, Population: { elements: { id: { type: [{ code: "string" }] }, extension: { max: 9007199254740991, type: [{ code: "Extension" }] }, modifierExtension: { max: 9007199254740991, type: [{ code: "Extension" }] }, "age[x]": { type: [{ code: "Range" }, { code: "CodeableConcept" }] }, gender: { type: [{ code: "CodeableConcept" }] }, race: { type: [{ code: "CodeableConcept" }] }, physiologicalCondition: { type: [{ code: "CodeableConcept" }] } } }, ProdCharacteristic: { elements: { id: { type: [{ code: "string" }] }, extension: { max: 9007199254740991, type: [{ code: "Extension" }] }, modifierExtension: { max: 9007199254740991, type: [{ code: "Extension" }] }, height: { type: [{ code: "Quantity" }] }, width: { type: [{ code: "Quantity" }] }, depth: { type: [{ code: "Quantity" }] }, weight: { type: [{ code: "Quantity" }] }, nominalVolume: { type: [{ code: "Quantity" }] }, externalDiameter: { type: [{ code: "Quantity" }] }, shape: { type: [{ code: "string" }] }, color: { max: 9007199254740991, type: [{ code: "string" }] }, imprint: { max: 9007199254740991, type: [{ code: "string" }] }, image: { max: 9007199254740991, type: [{ code: "Attachment" }] }, scoring: { type: [{ code: "CodeableConcept" }] } } }, ProductShelfLife: { elements: { id: { type: [{ code: "string" }] }, extension: { max: 9007199254740991, type: [{ code: "Extension" }] }, modifierExtension: { max: 9007199254740991, type: [{ code: "Extension" }] }, identifier: { type: [{ code: "Identifier" }] }, type: { min: 1, type: [{ code: "CodeableConcept" }] }, period: { min: 1, type: [{ code: "Quantity" }] }, specialPrecautionsForStorage: { max: 9007199254740991, type: [{ code: "CodeableConcept" }] } } }, Quantity: { elements: { id: { type: [{ code: "string" }] }, extension: { max: 9007199254740991, type: [{ code: "Extension" }] }, value: { type: [{ code: "decimal" }] }, comparator: { type: [{ code: "code" }] }, unit: { type: [{ code: "string" }] }, system: { type: [{ code: "uri" }] }, code: { type: [{ code: "code" }] } } }, Range: { elements: { id: { type: [{ code: "string" }] }, extension: { max: 9007199254740991, type: [{ code: "Extension" }] }, low: { type: [{ code: "Quantity" }] }, high: { type: [{ code: "Quantity" }] } } }, Ratio: { elements: { id: { type: [{ code: "string" }] }, extension: { max: 9007199254740991, type: [{ code: "Extension" }] }, numerator: { type: [{ code: "Quantity" }] }, denominator: { type: [{ code: "Quantity" }] } } }, Reference: { elements: { id: { type: [{ code: "string" }] }, extension: { max: 9007199254740991, type: [{ code: "Extension" }] }, reference: { type: [{ code: "string" }] }, type: { type: [{ code: "uri" }] }, identifier: { type: [{ code: "Identifier" }] }, display: { type: [{ code: "string" }] } } }, RelatedArtifact: { elements: { id: { type: [{ code: "string" }] }, extension: { max: 9007199254740991, type: [{ code: "Extension" }] }, type: { min: 1, type: [{ code: "code" }] }, label: { type: [{ code: "string" }] }, display: { type: [{ code: "string" }] }, citation: { type: [{ code: "markdown" }] }, url: { type: [{ code: "url" }] }, document: { type: [{ code: "Attachment" }] }, resource: { type: [{ code: "canonical", targetProfile: ["http://hl7.org/fhir/StructureDefinition/Resource"] }] } } }, SampledData: { elements: { id: { type: [{ code: "string" }] }, extension: { max: 9007199254740991, type: [{ code: "Extension" }] }, origin: { min: 1, type: [{ code: "Quantity" }] }, period: { min: 1, type: [{ code: "decimal" }] }, factor: { type: [{ code: "decimal" }] }, lowerLimit: { type: [{ code: "decimal" }] }, upperLimit: { type: [{ code: "decimal" }] }, dimensions: { min: 1, type: [{ code: "positiveInt" }] }, data: { type: [{ code: "string" }] } } }, Signature: { elements: { id: { type: [{ code: "string" }] }, extension: { max: 9007199254740991, type: [{ code: "Extension" }] }, type: { min: 1, max: 9007199254740991, type: [{ code: "Coding" }] }, when: { min: 1, type: [{ code: "instant" }] }, who: { min: 1, type: [{ code: "Reference", targetProfile: ["http://hl7.org/fhir/StructureDefinition/Practitioner", "http://hl7.org/fhir/StructureDefinition/PractitionerRole", "http://hl7.org/fhir/StructureDefinition/RelatedPerson", "http://hl7.org/fhir/StructureDefinition/Patient", "http://hl7.org/fhir/StructureDefinition/Device", "http://hl7.org/fhir/StructureDefinition/Organization"] }] }, onBehalfOf: { type: [{ code: "Reference", targetProfile: ["http://hl7.org/fhir/StructureDefinition/Practitioner", "http://hl7.org/fhir/StructureDefinition/PractitionerRole", "http://hl7.org/fhir/StructureDefinition/RelatedPerson", "http://hl7.org/fhir/StructureDefinition/Patient", "http://hl7.org/fhir/StructureDefinition/Device", "http://hl7.org/fhir/StructureDefinition/Organization"] }] }, targetFormat: { type: [{ code: "code" }] }, sigFormat: { type: [{ code: "code" }] }, data: { type: [{ code: "base64Binary" }] } } }, SubstanceAmount: { elements: { id: { type: [{ code: "string" }] }, extension: { max: 9007199254740991, type: [{ code: "Extension" }] }, modifierExtension: { max: 9007199254740991, type: [{ code: "Extension" }] }, "amount[x]": { type: [{ code: "Quantity" }, { code: "Range" }, { code: "string" }] }, amountType: { type: [{ code: "CodeableConcept" }] }, amountText: { type: [{ code: "string" }] }, referenceRange: { type: [{ code: "SubstanceAmountReferenceRange" }] } } }, Timing: { elements: { id: { type: [{ code: "string" }] }, extension: { max: 9007199254740991, type: [{ code: "Extension" }] }, modifierExtension: { max: 9007199254740991, type: [{ code: "Extension" }] }, event: { max: 9007199254740991, type: [{ code: "dateTime" }] }, repeat: { type: [{ code: "TimingRepeat" }] }, code: { type: [{ code: "CodeableConcept" }] } } }, TriggerDefinition: { elements: { id: { type: [{ code: "string" }] }, extension: { max: 9007199254740991, type: [{ code: "Extension" }] }, type: { min: 1, type: [{ code: "code" }] }, name: { type: [{ code: "string" }] }, "timing[x]": { type: [{ code: "Timing" }, { code: "Reference", targetProfile: ["http://hl7.org/fhir/StructureDefinition/Schedule"] }, { code: "date" }, { code: "dateTime" }] }, data: { max: 9007199254740991, type: [{ code: "DataRequirement" }] }, condition: { type: [{ code: "Expression" }] } } }, UsageContext: { elements: { id: { type: [{ code: "string" }] }, extension: { max: 9007199254740991, type: [{ code: "Extension" }] }, code: { min: 1, type: [{ code: "Coding" }] }, "value[x]": { min: 1, type: [{ code: "CodeableConcept" }, { code: "Quantity" }, { code: "Range" }, { code: "Reference", targetProfile: ["http://hl7.org/fhir/StructureDefinition/PlanDefinition", "http://hl7.org/fhir/StructureDefinition/ResearchStudy", "http://hl7.org/fhir/StructureDefinition/InsurancePlan", "http://hl7.org/fhir/StructureDefinition/HealthcareService", "http://hl7.org/fhir/StructureDefinition/Group", "http://hl7.org/fhir/StructureDefinition/Location", "http://hl7.org/fhir/StructureDefinition/Organization"] }] } } }, MoneyQuantity: { elements: { id: { type: [{ code: "string" }] }, extension: { max: 9007199254740991, type: [{ code: "Extension" }] }, value: { type: [{ code: "decimal" }] }, comparator: { type: [{ code: "code" }] }, unit: { type: [{ code: "string" }] }, system: { type: [{ code: "uri" }] }, code: { type: [{ code: "code" }] } } }, SimpleQuantity: { elements: { id: { type: [{ code: "string" }] }, extension: { max: 9007199254740991, type: [{ code: "Extension" }] }, value: { type: [{ code: "decimal" }] }, comparator: { max: 0, type: [{ code: "code" }] }, unit: { type: [{ code: "string" }] }, system: { type: [{ code: "uri" }] }, code: { type: [{ code: "code" }] } } }, MetadataResource: { elements: { id: { type: [{ code: "string" }] }, meta: { type: [{ code: "Meta" }] }, implicitRules: { type: [{ code: "uri" }] }, language: { type: [{ code: "code" }] }, text: { type: [{ code: "Narrative" }] }, contained: { max: 9007199254740991, type: [{ code: "Resource" }] }, extension: { max: 9007199254740991, type: [{ code: "Extension" }] }, modifierExtension: { max: 9007199254740991, type: [{ code: "Extension" }] }, url: { type: [{ code: "uri" }] }, version: { type: [{ code: "string" }] }, name: { type: [{ code: "string" }] }, title: { type: [{ code: "string" }] }, status: { min: 1, type: [{ code: "code" }] }, experimental: { type: [{ code: "boolean" }] }, date: { type: [{ code: "dateTime" }] }, publisher: { type: [{ code: "string" }] }, contact: { max: 9007199254740991, type: [{ code: "ContactDetail" }] }, description: { type: [{ code: "markdown" }] }, useContext: { max: 9007199254740991, type: [{ code: "UsageContext" }] }, jurisdiction: { max: 9007199254740991, type: [{ code: "CodeableConcept" }] } } }, IdentityProvider: { elements: { authorizeUrl: { min: 1, type: [{ code: "string" }] }, tokenUrl: { min: 1, type: [{ code: "string" }] }, tokenAuthMethod: { type: [{ code: "code" }] }, userInfoUrl: { min: 1, type: [{ code: "string" }] }, clientId: { min: 1, type: [{ code: "string" }] }, clientSecret: { min: 1, type: [{ code: "string" }] }, usePkce: { type: [{ code: "boolean" }] }, useSubject: { type: [{ code: "boolean" }] } } } };
39134
+ var mr = { Element: { elements: { id: { type: [{ code: "string" }] }, extension: { max: 9007199254740991, type: [{ code: "Extension" }] } } }, BackboneElement: { elements: { id: { type: [{ code: "string" }] }, extension: { max: 9007199254740991, type: [{ code: "Extension" }] }, modifierExtension: { max: 9007199254740991, type: [{ code: "Extension" }] } } }, Address: { elements: { id: { type: [{ code: "string" }] }, extension: { max: 9007199254740991, type: [{ code: "Extension" }] }, use: { type: [{ code: "code" }] }, type: { type: [{ code: "code" }] }, text: { type: [{ code: "string" }] }, line: { max: 9007199254740991, type: [{ code: "string" }] }, city: { type: [{ code: "string" }] }, district: { type: [{ code: "string" }] }, state: { type: [{ code: "string" }] }, postalCode: { type: [{ code: "string" }] }, country: { type: [{ code: "string" }] }, period: { type: [{ code: "Period" }] } } }, Age: { elements: { id: { type: [{ code: "string" }] }, extension: { max: 9007199254740991, type: [{ code: "Extension" }] }, value: { type: [{ code: "decimal" }] }, comparator: { type: [{ code: "code" }] }, unit: { type: [{ code: "string" }] }, system: { type: [{ code: "uri" }] }, code: { type: [{ code: "code" }] } } }, Annotation: { elements: { id: { type: [{ code: "string" }] }, extension: { max: 9007199254740991, type: [{ code: "Extension" }] }, "author[x]": { type: [{ code: "Reference", targetProfile: ["http://hl7.org/fhir/StructureDefinition/Practitioner", "http://hl7.org/fhir/StructureDefinition/Patient", "http://hl7.org/fhir/StructureDefinition/RelatedPerson", "http://hl7.org/fhir/StructureDefinition/Organization"] }, { code: "string" }] }, time: { type: [{ code: "dateTime" }] }, text: { min: 1, type: [{ code: "markdown" }] } } }, Attachment: { elements: { id: { type: [{ code: "string" }] }, extension: { max: 9007199254740991, type: [{ code: "Extension" }] }, contentType: { type: [{ code: "code" }] }, language: { type: [{ code: "code" }] }, data: { type: [{ code: "base64Binary" }] }, url: { type: [{ code: "url" }] }, size: { type: [{ code: "unsignedInt" }] }, hash: { type: [{ code: "base64Binary" }] }, title: { type: [{ code: "string" }] }, creation: { type: [{ code: "dateTime" }] } } }, CodeableConcept: { elements: { id: { type: [{ code: "string" }] }, extension: { max: 9007199254740991, type: [{ code: "Extension" }] }, coding: { max: 9007199254740991, type: [{ code: "Coding" }] }, text: { type: [{ code: "string" }] } } }, Coding: { elements: { id: { type: [{ code: "string" }] }, extension: { max: 9007199254740991, type: [{ code: "Extension" }] }, system: { type: [{ code: "uri" }] }, version: { type: [{ code: "string" }] }, code: { type: [{ code: "code" }] }, display: { type: [{ code: "string" }] }, userSelected: { type: [{ code: "boolean" }] } } }, ContactDetail: { elements: { id: { type: [{ code: "string" }] }, extension: { max: 9007199254740991, type: [{ code: "Extension" }] }, name: { type: [{ code: "string" }] }, telecom: { max: 9007199254740991, type: [{ code: "ContactPoint" }] } } }, ContactPoint: { elements: { id: { type: [{ code: "string" }] }, extension: { max: 9007199254740991, type: [{ code: "Extension" }] }, system: { type: [{ code: "code" }] }, value: { type: [{ code: "string" }] }, use: { type: [{ code: "code" }] }, rank: { type: [{ code: "positiveInt" }] }, period: { type: [{ code: "Period" }] } } }, Contributor: { elements: { id: { type: [{ code: "string" }] }, extension: { max: 9007199254740991, type: [{ code: "Extension" }] }, type: { min: 1, type: [{ code: "code" }] }, name: { min: 1, type: [{ code: "string" }] }, contact: { max: 9007199254740991, type: [{ code: "ContactDetail" }] } } }, Count: { elements: { id: { type: [{ code: "string" }] }, extension: { max: 9007199254740991, type: [{ code: "Extension" }] }, value: { type: [{ code: "decimal" }] }, comparator: { type: [{ code: "code" }] }, unit: { type: [{ code: "string" }] }, system: { type: [{ code: "uri" }] }, code: { type: [{ code: "code" }] } } }, DataRequirement: { elements: { id: { type: [{ code: "string" }] }, extension: { max: 9007199254740991, type: [{ code: "Extension" }] }, type: { min: 1, type: [{ code: "code" }] }, profile: { max: 9007199254740991, type: [{ code: "canonical", targetProfile: ["http://hl7.org/fhir/StructureDefinition/StructureDefinition"] }] }, "subject[x]": { type: [{ code: "CodeableConcept" }, { code: "Reference", targetProfile: ["http://hl7.org/fhir/StructureDefinition/Group"] }] }, mustSupport: { max: 9007199254740991, type: [{ code: "string" }] }, codeFilter: { max: 9007199254740991, type: [{ code: "DataRequirementCodeFilter" }] }, dateFilter: { max: 9007199254740991, type: [{ code: "DataRequirementDateFilter" }] }, limit: { type: [{ code: "positiveInt" }] }, sort: { max: 9007199254740991, type: [{ code: "DataRequirementSort" }] } } }, Distance: { elements: { id: { type: [{ code: "string" }] }, extension: { max: 9007199254740991, type: [{ code: "Extension" }] }, value: { type: [{ code: "decimal" }] }, comparator: { type: [{ code: "code" }] }, unit: { type: [{ code: "string" }] }, system: { type: [{ code: "uri" }] }, code: { type: [{ code: "code" }] } } }, Dosage: { elements: { id: { type: [{ code: "string" }] }, extension: { max: 9007199254740991, type: [{ code: "Extension" }] }, modifierExtension: { max: 9007199254740991, type: [{ code: "Extension" }] }, sequence: { type: [{ code: "integer" }] }, text: { type: [{ code: "string" }] }, additionalInstruction: { max: 9007199254740991, type: [{ code: "CodeableConcept" }] }, patientInstruction: { type: [{ code: "string" }] }, timing: { type: [{ code: "Timing" }] }, "asNeeded[x]": { type: [{ code: "boolean" }, { code: "CodeableConcept" }] }, site: { type: [{ code: "CodeableConcept" }] }, route: { type: [{ code: "CodeableConcept" }] }, method: { type: [{ code: "CodeableConcept" }] }, doseAndRate: { max: 9007199254740991, type: [{ code: "DosageDoseAndRate" }] }, maxDosePerPeriod: { type: [{ code: "Ratio" }] }, maxDosePerAdministration: { type: [{ code: "Quantity" }] }, maxDosePerLifetime: { type: [{ code: "Quantity" }] } } }, Duration: { elements: { id: { type: [{ code: "string" }] }, extension: { max: 9007199254740991, type: [{ code: "Extension" }] }, value: { type: [{ code: "decimal" }] }, comparator: { type: [{ code: "code" }] }, unit: { type: [{ code: "string" }] }, system: { type: [{ code: "uri" }] }, code: { type: [{ code: "code" }] } } }, ElementDefinition: { elements: { id: { type: [{ code: "string" }] }, extension: { max: 9007199254740991, type: [{ code: "Extension" }] }, modifierExtension: { max: 9007199254740991, type: [{ code: "Extension" }] }, path: { min: 1, type: [{ code: "string" }] }, representation: { max: 9007199254740991, type: [{ code: "code" }] }, sliceName: { type: [{ code: "string" }] }, sliceIsConstraining: { type: [{ code: "boolean" }] }, label: { type: [{ code: "string" }] }, code: { max: 9007199254740991, type: [{ code: "Coding" }] }, slicing: { type: [{ code: "ElementDefinitionSlicing" }] }, short: { type: [{ code: "string" }] }, definition: { type: [{ code: "markdown" }] }, comment: { type: [{ code: "markdown" }] }, requirements: { type: [{ code: "markdown" }] }, alias: { max: 9007199254740991, type: [{ code: "string" }] }, min: { type: [{ code: "unsignedInt" }] }, max: { type: [{ code: "string" }] }, base: { type: [{ code: "ElementDefinitionBase" }] }, contentReference: { type: [{ code: "uri" }] }, type: { max: 9007199254740991, type: [{ code: "ElementDefinitionType" }] }, "defaultValue[x]": { type: [{ code: "base64Binary" }, { code: "boolean" }, { code: "canonical" }, { code: "code" }, { code: "date" }, { code: "dateTime" }, { code: "decimal" }, { code: "id" }, { code: "instant" }, { code: "integer" }, { code: "markdown" }, { code: "oid" }, { code: "positiveInt" }, { code: "string" }, { code: "time" }, { code: "unsignedInt" }, { code: "uri" }, { code: "url" }, { code: "uuid" }, { code: "Address" }, { code: "Age" }, { code: "Annotation" }, { code: "Attachment" }, { code: "CodeableConcept" }, { code: "Coding" }, { code: "ContactPoint" }, { code: "Count" }, { code: "Distance" }, { code: "Duration" }, { code: "HumanName" }, { code: "Identifier" }, { code: "Money" }, { code: "Period" }, { code: "Quantity" }, { code: "Range" }, { code: "Ratio" }, { code: "Reference" }, { code: "SampledData" }, { code: "Signature" }, { code: "Timing" }, { code: "ContactDetail" }, { code: "Contributor" }, { code: "DataRequirement" }, { code: "Expression" }, { code: "ParameterDefinition" }, { code: "RelatedArtifact" }, { code: "TriggerDefinition" }, { code: "UsageContext" }, { code: "Dosage" }, { code: "Meta" }] }, meaningWhenMissing: { type: [{ code: "markdown" }] }, orderMeaning: { type: [{ code: "string" }] }, "fixed[x]": { type: [{ code: "base64Binary" }, { code: "boolean" }, { code: "canonical" }, { code: "code" }, { code: "date" }, { code: "dateTime" }, { code: "decimal" }, { code: "id" }, { code: "instant" }, { code: "integer" }, { code: "markdown" }, { code: "oid" }, { code: "positiveInt" }, { code: "string" }, { code: "time" }, { code: "unsignedInt" }, { code: "uri" }, { code: "url" }, { code: "uuid" }, { code: "Address" }, { code: "Age" }, { code: "Annotation" }, { code: "Attachment" }, { code: "CodeableConcept" }, { code: "Coding" }, { code: "ContactPoint" }, { code: "Count" }, { code: "Distance" }, { code: "Duration" }, { code: "HumanName" }, { code: "Identifier" }, { code: "Money" }, { code: "Period" }, { code: "Quantity" }, { code: "Range" }, { code: "Ratio" }, { code: "Reference" }, { code: "SampledData" }, { code: "Signature" }, { code: "Timing" }, { code: "ContactDetail" }, { code: "Contributor" }, { code: "DataRequirement" }, { code: "Expression" }, { code: "ParameterDefinition" }, { code: "RelatedArtifact" }, { code: "TriggerDefinition" }, { code: "UsageContext" }, { code: "Dosage" }, { code: "Meta" }] }, "pattern[x]": { type: [{ code: "base64Binary" }, { code: "boolean" }, { code: "canonical" }, { code: "code" }, { code: "date" }, { code: "dateTime" }, { code: "decimal" }, { code: "id" }, { code: "instant" }, { code: "integer" }, { code: "markdown" }, { code: "oid" }, { code: "positiveInt" }, { code: "string" }, { code: "time" }, { code: "unsignedInt" }, { code: "uri" }, { code: "url" }, { code: "uuid" }, { code: "Address" }, { code: "Age" }, { code: "Annotation" }, { code: "Attachment" }, { code: "CodeableConcept" }, { code: "Coding" }, { code: "ContactPoint" }, { code: "Count" }, { code: "Distance" }, { code: "Duration" }, { code: "HumanName" }, { code: "Identifier" }, { code: "Money" }, { code: "Period" }, { code: "Quantity" }, { code: "Range" }, { code: "Ratio" }, { code: "Reference" }, { code: "SampledData" }, { code: "Signature" }, { code: "Timing" }, { code: "ContactDetail" }, { code: "Contributor" }, { code: "DataRequirement" }, { code: "Expression" }, { code: "ParameterDefinition" }, { code: "RelatedArtifact" }, { code: "TriggerDefinition" }, { code: "UsageContext" }, { code: "Dosage" }, { code: "Meta" }] }, example: { max: 9007199254740991, type: [{ code: "ElementDefinitionExample" }] }, "minValue[x]": { type: [{ code: "date" }, { code: "dateTime" }, { code: "instant" }, { code: "time" }, { code: "decimal" }, { code: "integer" }, { code: "positiveInt" }, { code: "unsignedInt" }, { code: "Quantity" }] }, "maxValue[x]": { type: [{ code: "date" }, { code: "dateTime" }, { code: "instant" }, { code: "time" }, { code: "decimal" }, { code: "integer" }, { code: "positiveInt" }, { code: "unsignedInt" }, { code: "Quantity" }] }, maxLength: { type: [{ code: "integer" }] }, condition: { max: 9007199254740991, type: [{ code: "id" }] }, constraint: { max: 9007199254740991, type: [{ code: "ElementDefinitionConstraint" }] }, mustSupport: { type: [{ code: "boolean" }] }, isModifier: { type: [{ code: "boolean" }] }, isModifierReason: { type: [{ code: "string" }] }, isSummary: { type: [{ code: "boolean" }] }, binding: { type: [{ code: "ElementDefinitionBinding" }] }, mapping: { max: 9007199254740991, type: [{ code: "ElementDefinitionMapping" }] } } }, Expression: { elements: { id: { type: [{ code: "string" }] }, extension: { max: 9007199254740991, type: [{ code: "Extension" }] }, description: { type: [{ code: "string" }] }, name: { type: [{ code: "id" }] }, language: { min: 1, type: [{ code: "code" }] }, expression: { type: [{ code: "string" }] }, reference: { type: [{ code: "uri" }] } } }, Extension: { elements: { id: { type: [{ code: "string" }] }, extension: { max: 9007199254740991, type: [{ code: "Extension" }] }, url: { min: 1, type: [{ code: "string" }] }, "value[x]": { type: [{ code: "base64Binary" }, { code: "boolean" }, { code: "canonical" }, { code: "code" }, { code: "date" }, { code: "dateTime" }, { code: "decimal" }, { code: "id" }, { code: "instant" }, { code: "integer" }, { code: "markdown" }, { code: "oid" }, { code: "positiveInt" }, { code: "string" }, { code: "time" }, { code: "unsignedInt" }, { code: "uri" }, { code: "url" }, { code: "uuid" }, { code: "Address" }, { code: "Age" }, { code: "Annotation" }, { code: "Attachment" }, { code: "CodeableConcept" }, { code: "Coding" }, { code: "ContactPoint" }, { code: "Count" }, { code: "Distance" }, { code: "Duration" }, { code: "HumanName" }, { code: "Identifier" }, { code: "Money" }, { code: "Period" }, { code: "Quantity" }, { code: "Range" }, { code: "Ratio" }, { code: "Reference" }, { code: "SampledData" }, { code: "Signature" }, { code: "Timing" }, { code: "ContactDetail" }, { code: "Contributor" }, { code: "DataRequirement" }, { code: "Expression" }, { code: "ParameterDefinition" }, { code: "RelatedArtifact" }, { code: "TriggerDefinition" }, { code: "UsageContext" }, { code: "Dosage" }, { code: "Meta" }] } } }, HumanName: { elements: { id: { type: [{ code: "string" }] }, extension: { max: 9007199254740991, type: [{ code: "Extension" }] }, use: { type: [{ code: "code" }] }, text: { type: [{ code: "string" }] }, family: { type: [{ code: "string" }] }, given: { max: 9007199254740991, type: [{ code: "string" }] }, prefix: { max: 9007199254740991, type: [{ code: "string" }] }, suffix: { max: 9007199254740991, type: [{ code: "string" }] }, period: { type: [{ code: "Period" }] } } }, Identifier: { elements: { id: { type: [{ code: "string" }] }, extension: { max: 9007199254740991, type: [{ code: "Extension" }] }, use: { type: [{ code: "code" }] }, type: { type: [{ code: "CodeableConcept" }] }, system: { type: [{ code: "uri" }] }, value: { type: [{ code: "string" }] }, period: { type: [{ code: "Period" }] }, assigner: { type: [{ code: "Reference", targetProfile: ["http://hl7.org/fhir/StructureDefinition/Organization"] }] } } }, MarketingStatus: { elements: { id: { type: [{ code: "string" }] }, extension: { max: 9007199254740991, type: [{ code: "Extension" }] }, modifierExtension: { max: 9007199254740991, type: [{ code: "Extension" }] }, country: { min: 1, type: [{ code: "CodeableConcept" }] }, jurisdiction: { type: [{ code: "CodeableConcept" }] }, status: { min: 1, type: [{ code: "CodeableConcept" }] }, dateRange: { min: 1, type: [{ code: "Period" }] }, restoreDate: { type: [{ code: "dateTime" }] } } }, Meta: { elements: { id: { type: [{ code: "string" }] }, extension: { max: 9007199254740991, type: [{ code: "Extension" }] }, versionId: { type: [{ code: "id" }] }, lastUpdated: { type: [{ code: "instant" }] }, source: { type: [{ code: "uri" }] }, profile: { max: 9007199254740991, type: [{ code: "canonical", targetProfile: ["http://hl7.org/fhir/StructureDefinition/StructureDefinition"] }] }, security: { max: 9007199254740991, type: [{ code: "Coding" }] }, tag: { max: 9007199254740991, type: [{ code: "Coding" }] }, project: { type: [{ code: "uri" }] }, author: { type: [{ code: "Reference" }] }, account: { type: [{ code: "Reference" }] }, compartment: { max: 9007199254740991, type: [{ code: "Reference" }] } } }, Money: { elements: { id: { type: [{ code: "string" }] }, extension: { max: 9007199254740991, type: [{ code: "Extension" }] }, value: { type: [{ code: "decimal" }] }, currency: { type: [{ code: "code" }] } } }, Narrative: { elements: { id: { type: [{ code: "string" }] }, extension: { max: 9007199254740991, type: [{ code: "Extension" }] }, status: { min: 1, type: [{ code: "code" }] }, div: { min: 1, type: [{ code: "xhtml" }] } } }, ParameterDefinition: { elements: { id: { type: [{ code: "string" }] }, extension: { max: 9007199254740991, type: [{ code: "Extension" }] }, name: { type: [{ code: "code" }] }, use: { min: 1, type: [{ code: "code" }] }, min: { type: [{ code: "integer" }] }, max: { type: [{ code: "string" }] }, documentation: { type: [{ code: "string" }] }, type: { min: 1, type: [{ code: "code" }] }, profile: { type: [{ code: "canonical", targetProfile: ["http://hl7.org/fhir/StructureDefinition/StructureDefinition"] }] } } }, Period: { elements: { id: { type: [{ code: "string" }] }, extension: { max: 9007199254740991, type: [{ code: "Extension" }] }, start: { type: [{ code: "dateTime" }] }, end: { type: [{ code: "dateTime" }] } } }, Population: { elements: { id: { type: [{ code: "string" }] }, extension: { max: 9007199254740991, type: [{ code: "Extension" }] }, modifierExtension: { max: 9007199254740991, type: [{ code: "Extension" }] }, "age[x]": { type: [{ code: "Range" }, { code: "CodeableConcept" }] }, gender: { type: [{ code: "CodeableConcept" }] }, race: { type: [{ code: "CodeableConcept" }] }, physiologicalCondition: { type: [{ code: "CodeableConcept" }] } } }, ProdCharacteristic: { elements: { id: { type: [{ code: "string" }] }, extension: { max: 9007199254740991, type: [{ code: "Extension" }] }, modifierExtension: { max: 9007199254740991, type: [{ code: "Extension" }] }, height: { type: [{ code: "Quantity" }] }, width: { type: [{ code: "Quantity" }] }, depth: { type: [{ code: "Quantity" }] }, weight: { type: [{ code: "Quantity" }] }, nominalVolume: { type: [{ code: "Quantity" }] }, externalDiameter: { type: [{ code: "Quantity" }] }, shape: { type: [{ code: "string" }] }, color: { max: 9007199254740991, type: [{ code: "string" }] }, imprint: { max: 9007199254740991, type: [{ code: "string" }] }, image: { max: 9007199254740991, type: [{ code: "Attachment" }] }, scoring: { type: [{ code: "CodeableConcept" }] } } }, ProductShelfLife: { elements: { id: { type: [{ code: "string" }] }, extension: { max: 9007199254740991, type: [{ code: "Extension" }] }, modifierExtension: { max: 9007199254740991, type: [{ code: "Extension" }] }, identifier: { type: [{ code: "Identifier" }] }, type: { min: 1, type: [{ code: "CodeableConcept" }] }, period: { min: 1, type: [{ code: "Quantity" }] }, specialPrecautionsForStorage: { max: 9007199254740991, type: [{ code: "CodeableConcept" }] } } }, Quantity: { elements: { id: { type: [{ code: "string" }] }, extension: { max: 9007199254740991, type: [{ code: "Extension" }] }, value: { type: [{ code: "decimal" }] }, comparator: { type: [{ code: "code" }] }, unit: { type: [{ code: "string" }] }, system: { type: [{ code: "uri" }] }, code: { type: [{ code: "code" }] } } }, Range: { elements: { id: { type: [{ code: "string" }] }, extension: { max: 9007199254740991, type: [{ code: "Extension" }] }, low: { type: [{ code: "Quantity" }] }, high: { type: [{ code: "Quantity" }] } } }, Ratio: { elements: { id: { type: [{ code: "string" }] }, extension: { max: 9007199254740991, type: [{ code: "Extension" }] }, numerator: { type: [{ code: "Quantity" }] }, denominator: { type: [{ code: "Quantity" }] } } }, Reference: { elements: { id: { type: [{ code: "string" }] }, extension: { max: 9007199254740991, type: [{ code: "Extension" }] }, reference: { type: [{ code: "string" }] }, type: { type: [{ code: "uri" }] }, identifier: { type: [{ code: "Identifier" }] }, display: { type: [{ code: "string" }] } } }, RelatedArtifact: { elements: { id: { type: [{ code: "string" }] }, extension: { max: 9007199254740991, type: [{ code: "Extension" }] }, type: { min: 1, type: [{ code: "code" }] }, label: { type: [{ code: "string" }] }, display: { type: [{ code: "string" }] }, citation: { type: [{ code: "markdown" }] }, url: { type: [{ code: "url" }] }, document: { type: [{ code: "Attachment" }] }, resource: { type: [{ code: "canonical", targetProfile: ["http://hl7.org/fhir/StructureDefinition/Resource"] }] } } }, SampledData: { elements: { id: { type: [{ code: "string" }] }, extension: { max: 9007199254740991, type: [{ code: "Extension" }] }, origin: { min: 1, type: [{ code: "Quantity" }] }, period: { min: 1, type: [{ code: "decimal" }] }, factor: { type: [{ code: "decimal" }] }, lowerLimit: { type: [{ code: "decimal" }] }, upperLimit: { type: [{ code: "decimal" }] }, dimensions: { min: 1, type: [{ code: "positiveInt" }] }, data: { type: [{ code: "string" }] } } }, Signature: { elements: { id: { type: [{ code: "string" }] }, extension: { max: 9007199254740991, type: [{ code: "Extension" }] }, type: { min: 1, max: 9007199254740991, type: [{ code: "Coding" }] }, when: { min: 1, type: [{ code: "instant" }] }, who: { min: 1, type: [{ code: "Reference", targetProfile: ["http://hl7.org/fhir/StructureDefinition/Practitioner", "http://hl7.org/fhir/StructureDefinition/PractitionerRole", "http://hl7.org/fhir/StructureDefinition/RelatedPerson", "http://hl7.org/fhir/StructureDefinition/Patient", "http://hl7.org/fhir/StructureDefinition/Device", "http://hl7.org/fhir/StructureDefinition/Organization"] }] }, onBehalfOf: { type: [{ code: "Reference", targetProfile: ["http://hl7.org/fhir/StructureDefinition/Practitioner", "http://hl7.org/fhir/StructureDefinition/PractitionerRole", "http://hl7.org/fhir/StructureDefinition/RelatedPerson", "http://hl7.org/fhir/StructureDefinition/Patient", "http://hl7.org/fhir/StructureDefinition/Device", "http://hl7.org/fhir/StructureDefinition/Organization"] }] }, targetFormat: { type: [{ code: "code" }] }, sigFormat: { type: [{ code: "code" }] }, data: { type: [{ code: "base64Binary" }] } } }, SubstanceAmount: { elements: { id: { type: [{ code: "string" }] }, extension: { max: 9007199254740991, type: [{ code: "Extension" }] }, modifierExtension: { max: 9007199254740991, type: [{ code: "Extension" }] }, "amount[x]": { type: [{ code: "Quantity" }, { code: "Range" }, { code: "string" }] }, amountType: { type: [{ code: "CodeableConcept" }] }, amountText: { type: [{ code: "string" }] }, referenceRange: { type: [{ code: "SubstanceAmountReferenceRange" }] } } }, Timing: { elements: { id: { type: [{ code: "string" }] }, extension: { max: 9007199254740991, type: [{ code: "Extension" }] }, modifierExtension: { max: 9007199254740991, type: [{ code: "Extension" }] }, event: { max: 9007199254740991, type: [{ code: "dateTime" }] }, repeat: { type: [{ code: "TimingRepeat" }] }, code: { type: [{ code: "CodeableConcept" }] } } }, TriggerDefinition: { elements: { id: { type: [{ code: "string" }] }, extension: { max: 9007199254740991, type: [{ code: "Extension" }] }, type: { min: 1, type: [{ code: "code" }] }, name: { type: [{ code: "string" }] }, "timing[x]": { type: [{ code: "Timing" }, { code: "Reference", targetProfile: ["http://hl7.org/fhir/StructureDefinition/Schedule"] }, { code: "date" }, { code: "dateTime" }] }, data: { max: 9007199254740991, type: [{ code: "DataRequirement" }] }, condition: { type: [{ code: "Expression" }] } } }, UsageContext: { elements: { id: { type: [{ code: "string" }] }, extension: { max: 9007199254740991, type: [{ code: "Extension" }] }, code: { min: 1, type: [{ code: "Coding" }] }, "value[x]": { min: 1, type: [{ code: "CodeableConcept" }, { code: "Quantity" }, { code: "Range" }, { code: "Reference", targetProfile: ["http://hl7.org/fhir/StructureDefinition/PlanDefinition", "http://hl7.org/fhir/StructureDefinition/ResearchStudy", "http://hl7.org/fhir/StructureDefinition/InsurancePlan", "http://hl7.org/fhir/StructureDefinition/HealthcareService", "http://hl7.org/fhir/StructureDefinition/Group", "http://hl7.org/fhir/StructureDefinition/Location", "http://hl7.org/fhir/StructureDefinition/Organization"] }] } } }, MoneyQuantity: { elements: { id: { type: [{ code: "string" }] }, extension: { max: 9007199254740991, type: [{ code: "Extension" }] }, value: { type: [{ code: "decimal" }] }, comparator: { type: [{ code: "code" }] }, unit: { type: [{ code: "string" }] }, system: { type: [{ code: "uri" }] }, code: { type: [{ code: "code" }] } } }, SimpleQuantity: { elements: { id: { type: [{ code: "string" }] }, extension: { max: 9007199254740991, type: [{ code: "Extension" }] }, value: { type: [{ code: "decimal" }] }, comparator: { max: 0, type: [{ code: "code" }] }, unit: { type: [{ code: "string" }] }, system: { type: [{ code: "uri" }] }, code: { type: [{ code: "code" }] } } }, MetadataResource: { elements: { id: { type: [{ code: "string" }] }, meta: { type: [{ code: "Meta" }] }, implicitRules: { type: [{ code: "uri" }] }, language: { type: [{ code: "code" }] }, text: { type: [{ code: "Narrative" }] }, contained: { max: 9007199254740991, type: [{ code: "Resource" }] }, extension: { max: 9007199254740991, type: [{ code: "Extension" }] }, modifierExtension: { max: 9007199254740991, type: [{ code: "Extension" }] }, url: { type: [{ code: "uri" }] }, version: { type: [{ code: "string" }] }, name: { type: [{ code: "string" }] }, title: { type: [{ code: "string" }] }, status: { min: 1, type: [{ code: "code" }] }, experimental: { type: [{ code: "boolean" }] }, date: { type: [{ code: "dateTime" }] }, publisher: { type: [{ code: "string" }] }, contact: { max: 9007199254740991, type: [{ code: "ContactDetail" }] }, description: { type: [{ code: "markdown" }] }, useContext: { max: 9007199254740991, type: [{ code: "UsageContext" }] }, jurisdiction: { max: 9007199254740991, type: [{ code: "CodeableConcept" }] } } }, IdentityProvider: { elements: { authorizeUrl: { min: 1, type: [{ code: "string" }] }, tokenUrl: { min: 1, type: [{ code: "string" }] }, tokenAuthMethod: { type: [{ code: "code" }] }, userInfoUrl: { min: 1, type: [{ code: "string" }] }, clientId: { min: 1, type: [{ code: "string" }] }, clientSecret: { min: 1, type: [{ code: "string" }] }, usePkce: { type: [{ code: "boolean" }] }, useSubject: { type: [{ code: "boolean" }] } } } };
39129
39135
  function d(r4) {
39130
39136
  return [{ type: c.boolean, value: r4 }];
39131
39137
  }
39132
- function T(r4) {
39133
- return r4 == null ? { type: "undefined", value: void 0 } : Number.isSafeInteger(r4) ? { type: c.integer, value: r4 } : typeof r4 == "number" ? { type: c.decimal, value: r4 } : typeof r4 == "boolean" ? { type: c.boolean, value: r4 } : typeof r4 == "string" ? { type: c.string, value: r4 } : b(r4) ? { type: c.Quantity, value: r4 } : _(r4) ? { type: r4.resourceType, value: r4 } : { type: c.BackboneElement, value: r4 };
39138
+ function g(r4) {
39139
+ return r4 == null ? { type: "undefined", value: void 0 } : Number.isSafeInteger(r4) ? { type: c.integer, value: r4 } : typeof r4 == "number" ? { type: c.decimal, value: r4 } : typeof r4 == "boolean" ? { type: c.boolean, value: r4 } : typeof r4 == "string" ? { type: c.string, value: r4 } : b(r4) ? { type: c.Quantity, value: r4 } : M(r4) ? { type: r4.resourceType, value: r4 } : { type: c.BackboneElement, value: r4 };
39134
39140
  }
39135
- function B(r4) {
39141
+ function V(r4) {
39136
39142
  return r4.length === 0 ? false : !!r4[0].value;
39137
39143
  }
39138
- function F(r4, e) {
39144
+ function _(r4, e) {
39139
39145
  if (r4.length !== 0) {
39140
39146
  if (r4.length === 1 && (!e || r4[0].type === e))
39141
39147
  return r4[0];
39142
39148
  throw new Error(`Expected singleton of type ${e}, but found ${JSON.stringify(r4)}`);
39143
39149
  }
39144
39150
  }
39145
- function O(r4, e) {
39151
+ function A(r4, e) {
39146
39152
  if (!r4.value)
39147
39153
  return;
39148
- let t = Ie(r4.type, e);
39149
- return t ? Wn(r4.value, e, t) : Gn(r4, e);
39154
+ let t = Ve(r4.type, e);
39155
+ return t ? oi(r4.value, e, t) : si(r4, e);
39150
39156
  }
39151
- function Wn(r4, e, t) {
39157
+ function oi(r4, e, t) {
39152
39158
  let n = t.type;
39153
39159
  if (!n || n.length === 0)
39154
39160
  return;
39155
- let i2 = e, o, s = "undefined";
39161
+ let i2, o = "undefined", s;
39156
39162
  if (t.path.endsWith("[x]")) {
39157
- let u2 = t.path.split(".").pop().replace("[x]", "");
39158
- for (let l2 of n)
39159
- if (i2 = u2 + C(l2.code), o = r4[i2], o !== void 0) {
39160
- s = l2.code;
39163
+ let a = t.path.split(".").pop().replace("[x]", "");
39164
+ for (let u2 of n) {
39165
+ let l2 = a + w(u2.code);
39166
+ if (i2 = r4[l2], s = r4["_" + l2], i2 !== void 0 || s !== void 0) {
39167
+ o = u2.code;
39161
39168
  break;
39162
39169
  }
39170
+ }
39163
39171
  } else
39164
- console.assert(n.length === 1, "Expected single type", t.path), o = r4[e], s = n[0].code;
39165
- let a = r4["_" + i2];
39166
- if (a && (Array.isArray(o) ? o = o.map((u2, l2) => a[l2] ? mr(u2 ?? {}, a[l2]) : u2) : o = mr(o ?? {}, a)), !S(o))
39167
- return (s === "Element" || s === "BackboneElement") && (s = t.type[0].code), Array.isArray(o) ? o.map((u2) => dr(u2, s)) : dr(o, s);
39172
+ console.assert(n.length === 1, "Expected single type", t.path), i2 = r4[e], o = n[0].code, s = r4["_" + e];
39173
+ if (s)
39174
+ if (Array.isArray(i2))
39175
+ for (let a = 0; a < Math.max(i2.length, s.length); a++)
39176
+ i2[a] = xr(i2[a], s[a]);
39177
+ else
39178
+ i2 = xr(i2, s);
39179
+ if (!E(i2))
39180
+ return (o === "Element" || o === "BackboneElement") && (o = t.type[0].code), Array.isArray(i2) ? i2.map((a) => hr(a, o)) : hr(i2, o);
39168
39181
  }
39169
- function dr(r4, e) {
39170
- return e === "Resource" && _(r4) && (e = r4.resourceType), { type: e, value: r4 };
39182
+ function hr(r4, e) {
39183
+ return e === "Resource" && M(r4) && (e = r4.resourceType), { type: e, value: r4 };
39171
39184
  }
39172
- function Gn(r4, e) {
39185
+ function si(r4, e) {
39173
39186
  let t = r4.value;
39174
39187
  if (!t || typeof t != "object")
39175
39188
  return;
@@ -39178,21 +39191,21 @@ function Gn(r4, e) {
39178
39191
  n = t[e];
39179
39192
  else
39180
39193
  for (let i2 in c) {
39181
- let o = e + C(i2);
39194
+ let o = e + w(i2);
39182
39195
  if (o in t) {
39183
39196
  n = t[o];
39184
39197
  break;
39185
39198
  }
39186
39199
  }
39187
- if (!S(n))
39188
- return Array.isArray(n) ? n.map(T) : T(n);
39200
+ if (!E(n))
39201
+ return Array.isArray(n) ? n.map(g) : g(n);
39189
39202
  }
39190
- function Ce(r4) {
39203
+ function ke(r4) {
39191
39204
  let e = [];
39192
39205
  for (let t of r4) {
39193
39206
  let n = false;
39194
39207
  for (let i2 of e)
39195
- if (B(hr(t, i2))) {
39208
+ if (V(Tr(t, i2))) {
39196
39209
  n = true;
39197
39210
  break;
39198
39211
  }
@@ -39200,28 +39213,28 @@ function Ce(r4) {
39200
39213
  }
39201
39214
  return e;
39202
39215
  }
39203
- function lt(r4) {
39204
- return d(!B(r4));
39216
+ function ft(r4) {
39217
+ return d(!V(r4));
39205
39218
  }
39206
- function dt(r4, e) {
39207
- return r4.length === 0 || e.length === 0 ? [] : r4.length !== e.length ? d(false) : d(r4.every((t, n) => B(hr(t, e[n]))));
39219
+ function mt(r4, e) {
39220
+ return r4.length === 0 || e.length === 0 ? [] : r4.length !== e.length ? d(false) : d(r4.every((t, n) => V(Tr(t, e[n]))));
39208
39221
  }
39209
- function hr(r4, e) {
39222
+ function Tr(r4, e) {
39210
39223
  let t = r4.value?.valueOf(), n = e.value?.valueOf();
39211
- return typeof t == "number" && typeof n == "number" ? d(Math.abs(t - n) < 1e-8) : b(t) && b(n) ? d(yr(t, n)) : d(typeof t == "object" && typeof n == "object" ? ft(r4, e) : t === n);
39224
+ return typeof t == "number" && typeof n == "number" ? d(Math.abs(t - n) < 1e-8) : b(t) && b(n) ? d(vr(t, n)) : d(typeof t == "object" && typeof n == "object" ? yt(r4, e) : t === n);
39212
39225
  }
39213
- function pt(r4, e) {
39214
- return r4.length === 0 && e.length === 0 ? d(true) : r4.length !== e.length ? d(false) : (r4.sort(pr), e.sort(pr), d(r4.every((t, n) => B(zn(t, e[n])))));
39226
+ function ht(r4, e) {
39227
+ return r4.length === 0 && e.length === 0 ? d(true) : r4.length !== e.length ? d(false) : (r4.sort(yr), e.sort(yr), d(r4.every((t, n) => V(ai(t, e[n])))));
39215
39228
  }
39216
- function zn(r4, e) {
39229
+ function ai(r4, e) {
39217
39230
  let { type: t, value: n } = r4, { type: i2, value: o } = e, s = n?.valueOf(), a = o?.valueOf();
39218
- return typeof s == "number" && typeof a == "number" ? d(Math.abs(s - a) < 0.01) : b(s) && b(a) ? d(yr(s, a)) : d(t === "Coding" && i2 === "Coding" ? typeof s != "object" || typeof a != "object" ? false : s.code === a.code && s.system === a.system : typeof s == "object" && typeof a == "object" ? ft({ ...s, id: void 0 }, { ...a, id: void 0 }) : typeof s == "string" && typeof a == "string" ? s.toLowerCase() === a.toLowerCase() : s === a);
39231
+ return typeof s == "number" && typeof a == "number" ? d(Math.abs(s - a) < 0.01) : b(s) && b(a) ? d(vr(s, a)) : d(t === "Coding" && i2 === "Coding" ? typeof s != "object" || typeof a != "object" ? false : s.code === a.code && s.system === a.system : typeof s == "object" && typeof a == "object" ? yt({ ...s, id: void 0 }, { ...a, id: void 0 }) : typeof s == "string" && typeof a == "string" ? s.toLowerCase() === a.toLowerCase() : s === a);
39219
39232
  }
39220
- function pr(r4, e) {
39233
+ function yr(r4, e) {
39221
39234
  let t = r4.value?.valueOf(), n = e.value?.valueOf();
39222
39235
  return typeof t == "number" && typeof n == "number" ? t - n : typeof t == "string" && typeof n == "string" ? t.localeCompare(n) : 0;
39223
39236
  }
39224
- function we(r4, e) {
39237
+ function Oe(r4, e) {
39225
39238
  let { value: t } = r4;
39226
39239
  if (t == null)
39227
39240
  return false;
@@ -39238,119 +39251,127 @@ function we(r4, e) {
39238
39251
  case "Time":
39239
39252
  return typeof t == "string" && !!/^T\d/.exec(t);
39240
39253
  case "Period":
39241
- return Jn(t);
39254
+ return ci(t);
39242
39255
  case "Quantity":
39243
39256
  return b(t);
39244
39257
  default:
39245
39258
  return typeof t == "object" && t?.resourceType === e;
39246
39259
  }
39247
39260
  }
39248
- function Jn(r4) {
39261
+ function ci(r4) {
39249
39262
  return !!(r4 && typeof r4 == "object" && "start" in r4);
39250
39263
  }
39251
39264
  function b(r4) {
39252
39265
  return !!(r4 && typeof r4 == "object" && "value" in r4 && typeof r4.value == "number");
39253
39266
  }
39254
- function yr(r4, e) {
39267
+ function vr(r4, e) {
39255
39268
  return Math.abs(r4.value - e.value) < 0.01 && (r4.unit === e.unit || r4.code === e.code || r4.unit === e.code || r4.code === e.unit);
39256
39269
  }
39257
- function ft(r4, e) {
39270
+ function yt(r4, e) {
39258
39271
  let t = Object.keys(r4), n = Object.keys(e);
39259
39272
  if (t.length !== n.length)
39260
39273
  return false;
39261
39274
  for (let i2 of t) {
39262
39275
  let o = r4[i2], s = e[i2];
39263
- if (fr(o) && fr(s)) {
39264
- if (!ft(o, s))
39276
+ if (gr(o) && gr(s)) {
39277
+ if (!yt(o, s))
39265
39278
  return false;
39266
39279
  } else if (o !== s)
39267
39280
  return false;
39268
39281
  }
39269
39282
  return true;
39270
39283
  }
39271
- function fr(r4) {
39284
+ function gr(r4) {
39272
39285
  return r4 !== null && typeof r4 == "object";
39273
39286
  }
39274
- function mr(r4, e) {
39287
+ function xr(r4, e) {
39288
+ if (e) {
39289
+ if (typeof e != "object")
39290
+ throw new Error("Primitive extension must be an object");
39291
+ return ui(r4 ?? {}, e);
39292
+ }
39293
+ return r4;
39294
+ }
39295
+ function ui(r4, e) {
39275
39296
  return delete e.__proto__, delete e.constructor, Object.assign(r4, e);
39276
39297
  }
39277
- var mt = "ok";
39278
- var ke = "created";
39279
- var yt = "not-modified";
39280
- var gt = "not-found";
39281
- var Oe = "accepted";
39282
- var vr = { resourceType: "OperationOutcome", id: gt, issue: [{ severity: "error", code: "not-found", details: { text: "Not found" } }] };
39283
- function w(r4, e) {
39298
+ var gt = "ok";
39299
+ var De = "created";
39300
+ var Tt = "not-modified";
39301
+ var vt = "not-found";
39302
+ var Ne = "accepted";
39303
+ var Rr = { resourceType: "OperationOutcome", id: vt, issue: [{ severity: "error", code: "not-found", details: { text: "Not found" } }] };
39304
+ function I(r4, e) {
39284
39305
  return { resourceType: "OperationOutcome", issue: [{ severity: "error", code: "invalid", details: { text: r4 }, expression: e ? [e] : void 0 }] };
39285
39306
  }
39286
39307
  function h(r4) {
39287
39308
  return { resourceType: "OperationOutcome", issue: [{ severity: "error", code: "structure", details: { text: r4 } }] };
39288
39309
  }
39289
- function De(r4) {
39310
+ function Fe(r4) {
39290
39311
  return typeof r4 == "object" && r4 !== null && r4.resourceType === "OperationOutcome";
39291
39312
  }
39292
- function xt(r4) {
39293
- return r4.id === mt || r4.id === ke || r4.id === yt || r4.id === Oe;
39313
+ function St(r4) {
39314
+ return r4.id === gt || r4.id === De || r4.id === Tt || r4.id === Ne;
39294
39315
  }
39295
39316
  var p = class extends Error {
39296
39317
  constructor(t, n) {
39297
- super(Er(t));
39318
+ super(Pr(t));
39298
39319
  this.outcome = t, this.cause = n;
39299
39320
  }
39300
39321
  };
39301
- function Ve(r4) {
39302
- return r4 instanceof p ? r4.outcome : De(r4) ? r4 : w(Yn(r4));
39322
+ function _e(r4) {
39323
+ return r4 instanceof p ? r4.outcome : Fe(r4) ? r4 : I(li(r4));
39303
39324
  }
39304
- function Yn(r4) {
39305
- return r4 ? typeof r4 == "string" ? r4 : r4 instanceof Error ? r4.message : De(r4) ? Er(r4) : typeof r4 == "object" && "code" in r4 && typeof r4.code == "string" ? r4.code : JSON.stringify(r4) : "Unknown error";
39325
+ function li(r4) {
39326
+ return r4 ? typeof r4 == "string" ? r4 : r4 instanceof Error ? r4.message : Fe(r4) ? Pr(r4) : typeof r4 == "object" && "code" in r4 && typeof r4.code == "string" ? r4.code : JSON.stringify(r4) : "Unknown error";
39306
39327
  }
39307
- function Er(r4) {
39308
- let e = r4.issue?.map(Xn) ?? [];
39328
+ function Pr(r4) {
39329
+ let e = r4.issue?.map(di) ?? [];
39309
39330
  return e.length > 0 ? e.join("; ") : "Unknown error";
39310
39331
  }
39311
- function Xn(r4) {
39332
+ function di(r4) {
39312
39333
  let e;
39313
39334
  return r4.details?.text ? r4.diagnostics ? e = `${r4.details.text} (${r4.diagnostics})` : e = r4.details.text : r4.diagnostics ? e = r4.diagnostics : e = "Unknown error", r4.expression?.length && (e += ` (${r4.expression.join(", ")})`), e;
39314
39335
  }
39315
- function bt(r4) {
39316
- return new Et(r4).parse();
39336
+ function At(r4) {
39337
+ return new Rt(r4).parse();
39317
39338
  }
39318
- var ue = ur(lr);
39319
- var Rt = /* @__PURE__ */ Object.create(null);
39320
- var Rr = /* @__PURE__ */ Object.create(null);
39321
- function Pt(r4) {
39339
+ var fe = fr(mr);
39340
+ var Ct = /* @__PURE__ */ Object.create(null);
39341
+ var wr = /* @__PURE__ */ Object.create(null);
39342
+ function wt(r4) {
39322
39343
  let e;
39323
- return r4 ? (e = Rr[r4], e || (e = Rr[r4] = /* @__PURE__ */ Object.create(null))) : e = ue, e;
39344
+ return r4 ? (e = wr[r4], e || (e = wr[r4] = /* @__PURE__ */ Object.create(null))) : e = fe, e;
39324
39345
  }
39325
- function At(r4, e) {
39346
+ function It(r4, e) {
39326
39347
  let t = Array.isArray(r4) ? r4 : r4.entry?.map((n) => n.resource) ?? [];
39327
39348
  for (let n of t)
39328
- Zn(n, e);
39349
+ pi(n, e);
39329
39350
  }
39330
- function Zn(r4, e) {
39351
+ function pi(r4, e) {
39331
39352
  if (!r4?.name)
39332
39353
  throw new Error("Failed loading StructureDefinition from bundle");
39333
39354
  if (r4.resourceType !== "StructureDefinition")
39334
39355
  return;
39335
- let t = bt(r4), n = Pt(e);
39336
- n[r4.name] = t, e && r4.url === e && (Rt[e] = t);
39356
+ let t = At(r4), n = wt(e);
39357
+ n[r4.name] = t, e && r4.url === e && (Ct[e] = t);
39337
39358
  for (let i2 of t.innerTypes)
39338
39359
  i2.parentType = t, n[i2.name] = i2;
39339
39360
  }
39340
- function Ir(r4) {
39341
- return !!ue[r4];
39361
+ function Dr(r4) {
39362
+ return !!fe[r4];
39342
39363
  }
39343
- function kr(r4, e) {
39344
- return Pt(e)[r4];
39364
+ function Nr(r4, e) {
39365
+ return wt(e)[r4];
39345
39366
  }
39346
- function Dr(r4) {
39347
- return !!Rt[r4];
39367
+ function _r(r4) {
39368
+ return !!Ct[r4];
39348
39369
  }
39349
- var Et = class {
39370
+ var Rt = class {
39350
39371
  constructor(e) {
39351
39372
  if (!e.snapshot?.element || e.snapshot.element.length === 0)
39352
39373
  throw new Error(`No snapshot defined for StructureDefinition '${e.name}'`);
39353
- this.root = e.snapshot.element[0], this.elements = e.snapshot.element.slice(1), this.elementIndex = /* @__PURE__ */ Object.create(null), this.index = 0, this.resourceSchema = { name: e.name, title: e.title, type: e.type, url: e.url, kind: e.kind, description: ni(e), elements: {}, constraints: this.parseElementDefinition(this.root).constraints, innerTypes: [], summaryProperties: /* @__PURE__ */ new Set(), mandatoryProperties: /* @__PURE__ */ new Set() }, this.innerTypes = [];
39374
+ this.root = e.snapshot.element[0], this.elements = e.snapshot.element.slice(1), this.elementIndex = /* @__PURE__ */ Object.create(null), this.index = 0, this.resourceSchema = { name: e.name, title: e.title, type: e.type, url: e.url, kind: e.kind, description: yi(e), elements: {}, constraints: this.parseElementDefinition(this.root).constraints, innerTypes: [], summaryProperties: /* @__PURE__ */ new Set(), mandatoryProperties: /* @__PURE__ */ new Set() }, this.innerTypes = [];
39354
39375
  }
39355
39376
  parse() {
39356
39377
  let e = this.next();
@@ -39359,7 +39380,7 @@ var Et = class {
39359
39380
  this.parseSliceStart(e);
39360
39381
  else if (e.id?.includes(":")) {
39361
39382
  if (this.slicingContext?.current) {
39362
- let t = vt(e, this.slicingContext.path);
39383
+ let t = bt(e, this.slicingContext.path);
39363
39384
  this.slicingContext.current.elements[t] = this.parseElementDefinition(e);
39364
39385
  }
39365
39386
  } else {
@@ -39368,13 +39389,13 @@ var Et = class {
39368
39389
  let n = this.backboneContext;
39369
39390
  for (; n; ) {
39370
39391
  if (e.path?.startsWith(n.path + ".")) {
39371
- n.type.elements[vt(e, n.path)] = t;
39392
+ n.type.elements[bt(e, n.path)] = t;
39372
39393
  break;
39373
39394
  }
39374
39395
  n = n.parent;
39375
39396
  }
39376
39397
  if (!n) {
39377
- let i2 = vt(e, this.root.path);
39398
+ let i2 = bt(e, this.root.path);
39378
39399
  e.isSummary && this.resourceSchema.summaryProperties?.add(i2.replace("[x]", "")), t.min > 0 && this.resourceSchema.mandatoryProperties?.add(i2.replace("[x]", "")), this.resourceSchema.elements[i2] = t;
39379
39400
  }
39380
39401
  this.checkFieldExit(e);
@@ -39387,26 +39408,26 @@ var Et = class {
39387
39408
  this.isInnerType(e) && this.enterInnerType(e), e.slicing && !this.slicingContext && this.enterSlice(e, t);
39388
39409
  }
39389
39410
  enterInnerType(e) {
39390
- for (; this.backboneContext && !te(this.backboneContext?.path, e.path); )
39411
+ for (; this.backboneContext && !ne(this.backboneContext?.path, e.path); )
39391
39412
  this.innerTypes.push(this.backboneContext.type), this.backboneContext = this.backboneContext.parent;
39392
- this.backboneContext = { type: { name: St(e), title: e.label, description: e.definition, elements: {}, constraints: this.parseElementDefinition(e).constraints, innerTypes: [] }, path: e.path ?? "", parent: te(this.backboneContext?.path, e.path) ? this.backboneContext : this.backboneContext?.parent };
39413
+ this.backboneContext = { type: { name: Pt(e), title: e.label, description: e.definition, elements: {}, constraints: this.parseElementDefinition(e).constraints, innerTypes: [] }, path: e.path ?? "", parent: ne(this.backboneContext?.path, e.path) ? this.backboneContext : this.backboneContext?.parent };
39393
39414
  }
39394
39415
  enterSlice(e, t) {
39395
- ri(e) && !this.peek()?.sliceName || (t.slicing = { discriminator: (e.slicing?.discriminator ?? []).map((n) => {
39416
+ hi(e) && !this.peek()?.sliceName || (t.slicing = { discriminator: (e.slicing?.discriminator ?? []).map((n) => {
39396
39417
  if (n.type !== "value" && n.type !== "pattern" && n.type !== "type")
39397
39418
  throw new Error(`Unsupported slicing discriminator type: ${n.type}`);
39398
39419
  return { path: n.path, type: n.type };
39399
39420
  }), slices: [], ordered: e.slicing?.ordered ?? false, rule: e.slicing?.rules }, this.slicingContext = { field: t.slicing, path: e.path ?? "" });
39400
39421
  }
39401
39422
  checkFieldExit(e = void 0) {
39402
- if (this.backboneContext && !te(this.backboneContext.path, e?.path))
39423
+ if (this.backboneContext && !ne(this.backboneContext.path, e?.path))
39403
39424
  if (this.backboneContext.parent)
39404
39425
  do
39405
39426
  this.innerTypes.push(this.backboneContext.type), this.backboneContext = this.backboneContext.parent;
39406
- while (this.backboneContext && !te(this.backboneContext.path, e?.path));
39427
+ while (this.backboneContext && !ne(this.backboneContext.path, e?.path));
39407
39428
  else
39408
39429
  this.innerTypes.push(this.backboneContext.type), delete this.backboneContext;
39409
- this.slicingContext && !te(this.slicingContext.path, e?.path) && (this.slicingContext?.current && this.slicingContext.field.slices.push(this.slicingContext.current), delete this.slicingContext);
39430
+ this.slicingContext && !ne(this.slicingContext.path, e?.path) && (this.slicingContext?.current && this.slicingContext.field.slices.push(this.slicingContext.current), delete this.slicingContext);
39410
39431
  }
39411
39432
  next() {
39412
39433
  let e = this.peek();
@@ -39425,7 +39446,7 @@ var Et = class {
39425
39446
  }
39426
39447
  isInnerType(e) {
39427
39448
  let t = this.peek();
39428
- return !!(te(e?.path, t?.path) && e.type?.some((n) => ["BackboneElement", "Element"].includes(n.code)));
39449
+ return !!(ne(e?.path, t?.path) && e.type?.some((n) => ["BackboneElement", "Element"].includes(n.code)));
39429
39450
  }
39430
39451
  parseSliceStart(e) {
39431
39452
  if (!this.slicingContext)
@@ -39435,57 +39456,57 @@ var Et = class {
39435
39456
  parseElementDefinitionType(e) {
39436
39457
  return (e.type ?? []).map((t) => {
39437
39458
  let n;
39438
- return (t.code === "BackboneElement" || t.code === "Element") && (n = St(e)), n || (n = er(t, "http://hl7.org/fhir/StructureDefinition/structuredefinition-fhir-type")?.valueUrl), n || (n = t.code ?? ""), { code: n, targetProfile: t.targetProfile, profile: t.profile };
39459
+ return (t.code === "BackboneElement" || t.code === "Element") && (n = Pt(e)), n || (n = ir(t, "http://hl7.org/fhir/StructureDefinition/structuredefinition-fhir-type")?.valueUrl), n || (n = t.code ?? ""), { code: n, targetProfile: t.targetProfile, profile: t.profile };
39439
39460
  });
39440
39461
  }
39441
39462
  parseElementDefinition(e) {
39442
- let t = Ar(e.max), n = e.base?.max ? Ar(e.base.max) : t, i2 = { type: "ElementDefinition", value: e };
39443
- return { description: e.definition || "", path: e.path || e.base?.path || "", min: e.min ?? 0, max: t, isArray: n > 1, constraints: (e.constraint ?? []).map((o) => ({ key: o.key ?? "", severity: o.severity ?? "error", expression: o.expression ?? "", description: o.human ?? "" })), type: this.parseElementDefinitionType(e), fixed: Cr(O(i2, "fixed[x]")), pattern: Cr(O(i2, "pattern[x]")), binding: e.binding };
39463
+ let t = kr(e.max), n = e.base?.max ? kr(e.base.max) : t, i2 = { type: "ElementDefinition", value: e };
39464
+ return { description: e.definition || "", path: e.path || e.base?.path || "", min: e.min ?? 0, max: t, isArray: n > 1, constraints: (e.constraint ?? []).map((o) => ({ key: o.key ?? "", severity: o.severity ?? "error", expression: o.expression ?? "", description: o.human ?? "" })), type: this.parseElementDefinitionType(e), fixed: Or(A(i2, "fixed[x]")), pattern: Or(A(i2, "pattern[x]")), binding: e.binding };
39444
39465
  }
39445
39466
  };
39446
- function Ar(r4) {
39467
+ function kr(r4) {
39447
39468
  return r4 === "*" ? Number.POSITIVE_INFINITY : Number.parseInt(r4, 10);
39448
39469
  }
39449
- function vt(r4, e = "") {
39450
- return ti(r4.path, e);
39470
+ function bt(r4, e = "") {
39471
+ return mi(r4.path, e);
39451
39472
  }
39452
- function ti(r4, e) {
39473
+ function mi(r4, e) {
39453
39474
  return r4 ? e && r4.startsWith(e) ? r4.substring(e.length + 1) : r4 : "";
39454
39475
  }
39455
- function te(r4, e) {
39476
+ function ne(r4, e) {
39456
39477
  return !r4 || !e ? false : e.startsWith(r4 + ".") || e === r4;
39457
39478
  }
39458
- function Cr(r4) {
39459
- return Array.isArray(r4) && r4.length > 0 ? r4[0] : S(r4) ? void 0 : r4;
39479
+ function Or(r4) {
39480
+ return Array.isArray(r4) && r4.length > 0 ? r4[0] : E(r4) ? void 0 : r4;
39460
39481
  }
39461
- function ri(r4) {
39482
+ function hi(r4) {
39462
39483
  let e = r4.slicing?.discriminator;
39463
39484
  return !!(r4.type?.some((t) => t.code === "Extension") && e?.length === 1 && e[0].type === "value" && e[0].path === "url");
39464
39485
  }
39465
- function ni(r4) {
39486
+ function yi(r4) {
39466
39487
  let e = r4.description;
39467
39488
  return e?.startsWith(`Base StructureDefinition for ${r4.name} Type: `) && (e = e.substring(`Base StructureDefinition for ${r4.name} Type: `.length)), e;
39468
39489
  }
39469
39490
  var c = { Address: "Address", Age: "Age", Annotation: "Annotation", Attachment: "Attachment", BackboneElement: "BackboneElement", CodeableConcept: "CodeableConcept", Coding: "Coding", ContactDetail: "ContactDetail", ContactPoint: "ContactPoint", Contributor: "Contributor", Count: "Count", DataRequirement: "DataRequirement", Distance: "Distance", Dosage: "Dosage", Duration: "Duration", Expression: "Expression", Extension: "Extension", HumanName: "HumanName", Identifier: "Identifier", MarketingStatus: "MarketingStatus", Meta: "Meta", Money: "Money", Narrative: "Narrative", ParameterDefinition: "ParameterDefinition", Period: "Period", Population: "Population", ProdCharacteristic: "ProdCharacteristic", ProductShelfLife: "ProductShelfLife", Quantity: "Quantity", Range: "Range", Ratio: "Ratio", Reference: "Reference", RelatedArtifact: "RelatedArtifact", SampledData: "SampledData", Signature: "Signature", SubstanceAmount: "SubstanceAmount", SystemString: "http://hl7.org/fhirpath/System.String", Timing: "Timing", TriggerDefinition: "TriggerDefinition", UsageContext: "UsageContext", base64Binary: "base64Binary", boolean: "boolean", canonical: "canonical", code: "code", date: "date", dateTime: "dateTime", decimal: "decimal", id: "id", instant: "instant", integer: "integer", markdown: "markdown", oid: "oid", positiveInt: "positiveInt", string: "string", time: "time", unsignedInt: "unsignedInt", uri: "uri", url: "url", uuid: "uuid" };
39470
- function wt(r4) {
39491
+ function Ot(r4) {
39471
39492
  for (let e of r4.base ?? []) {
39472
39493
  let t = D.types[e];
39473
39494
  t || (t = { searchParamsDetails: {} }, D.types[e] = t), t.searchParams || (t.searchParams = { _id: { base: [e], code: "_id", type: "token", expression: e + ".id" }, _lastUpdated: { base: [e], code: "_lastUpdated", type: "date", expression: e + ".meta.lastUpdated" }, _compartment: { base: [e], code: "_compartment", type: "reference", expression: e + ".meta.compartment" }, _profile: { base: [e], code: "_profile", type: "uri", expression: e + ".meta.profile" }, _security: { base: [e], code: "_security", type: "token", expression: e + ".meta.security" }, _source: { base: [e], code: "_source", type: "uri", expression: e + ".meta.source" }, _tag: { base: [e], code: "_tag", type: "token", expression: e + ".meta.tag" } }), t.searchParams[r4.code] = r4;
39474
39495
  }
39475
39496
  }
39476
- function St(r4) {
39497
+ function Pt(r4) {
39477
39498
  let e = r4.type?.[0]?.code;
39478
- return e === "BackboneElement" || e === "Element" ? ii((r4.base?.path ?? r4.path)?.split(".")) : e;
39499
+ return e === "BackboneElement" || e === "Element" ? gi((r4.base?.path ?? r4.path)?.split(".")) : e;
39479
39500
  }
39480
- function ii(r4) {
39481
- return r4.length === 1 ? r4[0] : r4.map(C).join("");
39501
+ function gi(r4) {
39502
+ return r4.length === 1 ? r4[0] : r4.map(w).join("");
39482
39503
  }
39483
- function Ie(r4, e) {
39484
- let t = kr(r4);
39504
+ function Ve(r4, e) {
39505
+ let t = Nr(r4);
39485
39506
  if (t)
39486
- return ci(t.elements, e);
39507
+ return Si(t.elements, e);
39487
39508
  }
39488
- function ci(r4, e) {
39509
+ function Si(r4, e) {
39489
39510
  let t = r4[e] ?? r4[e + "[x]"];
39490
39511
  if (t)
39491
39512
  return t;
@@ -39498,14 +39519,14 @@ function ci(r4, e) {
39498
39519
  }
39499
39520
  }
39500
39521
  }
39501
- function _(r4) {
39522
+ function M(r4) {
39502
39523
  return !!(r4 && typeof r4 == "object" && "resourceType" in r4);
39503
39524
  }
39504
- function ce(r4) {
39525
+ function pe(r4) {
39505
39526
  return !!(r4 && typeof r4 == "object" && "reference" in r4);
39506
39527
  }
39507
39528
  var D = { types: {} };
39508
- function ne(r4) {
39529
+ function oe(r4) {
39509
39530
  if (r4.startsWith("T"))
39510
39531
  return r4 + "T00:00:00.000Z".substring(r4.length);
39511
39532
  if (r4.length <= 10)
@@ -39516,8 +39537,8 @@ function ne(r4) {
39516
39537
  return r4;
39517
39538
  }
39518
39539
  }
39519
- var le = () => [];
39520
- var E = { empty: (r4, e) => d(e.length === 0), exists: (r4, e, t) => t ? d(e.filter((n) => B(t.eval(r4, [n]))).length > 0) : d(e.length > 0), all: (r4, e, t) => d(e.every((n) => B(t.eval(r4, [n])))), allTrue: (r4, e) => {
39540
+ var me = () => [];
39541
+ var S = { empty: (r4, e) => d(e.length === 0), exists: (r4, e, t) => t ? d(e.filter((n) => V(t.eval(r4, [n]))).length > 0) : d(e.length > 0), all: (r4, e, t) => d(e.every((n) => V(t.eval(r4, [n])))), allTrue: (r4, e) => {
39521
39542
  for (let t of e)
39522
39543
  if (!t.value)
39523
39544
  return d(false);
@@ -39537,12 +39558,12 @@ var E = { empty: (r4, e) => d(e.length === 0), exists: (r4, e, t) => t ? d(e.fil
39537
39558
  if (!t.value)
39538
39559
  return d(true);
39539
39560
  return d(false);
39540
- }, subsetOf: le, supersetOf: le, count: (r4, e) => [{ type: c.integer, value: e.length }], distinct: (r4, e) => {
39561
+ }, subsetOf: me, supersetOf: me, count: (r4, e) => [{ type: c.integer, value: e.length }], distinct: (r4, e) => {
39541
39562
  let t = [];
39542
39563
  for (let n of e)
39543
39564
  t.some((i2) => i2.value === n.value) || t.push(n);
39544
39565
  return t;
39545
- }, isDistinct: (r4, e) => d(e.length === E.distinct(r4, e).length), where: (r4, e, t) => e.filter((n) => B(t.eval(r4, [n]))), select: (r4, e, t) => e.map((n) => t.eval(r4, [n])).flat(), repeat: le, ofType: (r4, e, t) => e.filter((n) => n.type === t.name), single: (r4, e) => {
39566
+ }, isDistinct: (r4, e) => d(e.length === S.distinct(r4, e).length), where: (r4, e, t) => e.filter((n) => V(t.eval(r4, [n]))), select: (r4, e, t) => e.map((n) => t.eval(r4, [n])).flat(), repeat: me, ofType: (r4, e, t) => e.filter((n) => n.type === t.name), single: (r4, e) => {
39546
39567
  if (e.length > 1)
39547
39568
  throw new Error("Expected input length one for single()");
39548
39569
  return e.length === 0 ? [] : e.slice(0, 1);
@@ -39574,17 +39595,17 @@ var E = { empty: (r4, e) => d(e.length === 0), exists: (r4, e, t) => t ? d(e.fil
39574
39595
  if (!t)
39575
39596
  return e;
39576
39597
  let n = t.eval(r4, e);
39577
- return Ce([...e, ...n]);
39598
+ return ke([...e, ...n]);
39578
39599
  }, combine: (r4, e, t) => {
39579
39600
  if (!t)
39580
39601
  return e;
39581
39602
  let n = t.eval(r4, e);
39582
39603
  return [...e, ...n];
39583
- }, htmlChecks: (r4, e, t) => [T(true)], iif: (r4, e, t, n, i2) => {
39604
+ }, htmlChecks: (r4, e, t) => [g(true)], iif: (r4, e, t, n, i2) => {
39584
39605
  let o = t.eval(r4, e);
39585
39606
  if (o.length > 1 || o.length === 1 && typeof o[0].value != "boolean")
39586
39607
  throw new Error("Expected criterion to evaluate to a Boolean");
39587
- return B(o) ? n.eval(r4, e) : i2 ? i2.eval(r4, e) : [];
39608
+ return V(o) ? n.eval(r4, e) : i2 ? i2.eval(r4, e) : [];
39588
39609
  }, toBoolean: (r4, e) => {
39589
39610
  if (e.length === 0)
39590
39611
  return [];
@@ -39601,72 +39622,72 @@ var E = { empty: (r4, e) => d(e.length === 0), exists: (r4, e, t) => t ? d(e.fil
39601
39622
  return d(false);
39602
39623
  }
39603
39624
  return [];
39604
- }, convertsToBoolean: (r4, e) => e.length === 0 ? [] : d(E.toBoolean(r4, e).length === 1), toInteger: (r4, e) => {
39625
+ }, convertsToBoolean: (r4, e) => e.length === 0 ? [] : d(S.toBoolean(r4, e).length === 1), toInteger: (r4, e) => {
39605
39626
  if (e.length === 0)
39606
39627
  return [];
39607
39628
  let [{ value: t }] = U(e, 1);
39608
39629
  return typeof t == "number" ? [{ type: c.integer, value: t }] : typeof t == "string" && /^[+-]?\d+$/.exec(t) ? [{ type: c.integer, value: parseInt(t, 10) }] : typeof t == "boolean" ? [{ type: c.integer, value: t ? 1 : 0 }] : [];
39609
- }, convertsToInteger: (r4, e) => e.length === 0 ? [] : d(E.toInteger(r4, e).length === 1), toDate: (r4, e) => {
39630
+ }, convertsToInteger: (r4, e) => e.length === 0 ? [] : d(S.toInteger(r4, e).length === 1), toDate: (r4, e) => {
39610
39631
  if (e.length === 0)
39611
39632
  return [];
39612
39633
  let [{ value: t }] = U(e, 1);
39613
- return typeof t == "string" && /^\d{4}(-\d{2}(-\d{2})?)?/.exec(t) ? [{ type: c.date, value: ne(t) }] : [];
39614
- }, convertsToDate: (r4, e) => e.length === 0 ? [] : d(E.toDate(r4, e).length === 1), toDateTime: (r4, e) => {
39634
+ return typeof t == "string" && /^\d{4}(-\d{2}(-\d{2})?)?/.exec(t) ? [{ type: c.date, value: oe(t) }] : [];
39635
+ }, convertsToDate: (r4, e) => e.length === 0 ? [] : d(S.toDate(r4, e).length === 1), toDateTime: (r4, e) => {
39615
39636
  if (e.length === 0)
39616
39637
  return [];
39617
39638
  let [{ value: t }] = U(e, 1);
39618
- return typeof t == "string" && /^\d{4}(-\d{2}(-\d{2})?)?/.exec(t) ? [{ type: c.dateTime, value: ne(t) }] : [];
39619
- }, convertsToDateTime: (r4, e) => e.length === 0 ? [] : d(E.toDateTime(r4, e).length === 1), toDecimal: (r4, e) => {
39639
+ return typeof t == "string" && /^\d{4}(-\d{2}(-\d{2})?)?/.exec(t) ? [{ type: c.dateTime, value: oe(t) }] : [];
39640
+ }, convertsToDateTime: (r4, e) => e.length === 0 ? [] : d(S.toDateTime(r4, e).length === 1), toDecimal: (r4, e) => {
39620
39641
  if (e.length === 0)
39621
39642
  return [];
39622
39643
  let [{ value: t }] = U(e, 1);
39623
39644
  return typeof t == "number" ? [{ type: c.decimal, value: t }] : typeof t == "string" && /^-?\d{1,9}(\.\d{1,9})?$/.exec(t) ? [{ type: c.decimal, value: parseFloat(t) }] : typeof t == "boolean" ? [{ type: c.decimal, value: t ? 1 : 0 }] : [];
39624
- }, convertsToDecimal: (r4, e) => e.length === 0 ? [] : d(E.toDecimal(r4, e).length === 1), toQuantity: (r4, e) => {
39645
+ }, convertsToDecimal: (r4, e) => e.length === 0 ? [] : d(S.toDecimal(r4, e).length === 1), toQuantity: (r4, e) => {
39625
39646
  if (e.length === 0)
39626
39647
  return [];
39627
39648
  let [{ value: t }] = U(e, 1);
39628
39649
  return b(t) ? [{ type: c.Quantity, value: t }] : typeof t == "number" ? [{ type: c.Quantity, value: { value: t, unit: "1" } }] : typeof t == "string" && /^-?\d{1,9}(\.\d{1,9})?/.exec(t) ? [{ type: c.Quantity, value: { value: parseFloat(t), unit: "1" } }] : typeof t == "boolean" ? [{ type: c.Quantity, value: { value: t ? 1 : 0, unit: "1" } }] : [];
39629
- }, convertsToQuantity: (r4, e) => e.length === 0 ? [] : d(E.toQuantity(r4, e).length === 1), toString: (r4, e) => {
39650
+ }, convertsToQuantity: (r4, e) => e.length === 0 ? [] : d(S.toQuantity(r4, e).length === 1), toString: (r4, e) => {
39630
39651
  if (e.length === 0)
39631
39652
  return [];
39632
39653
  let [{ value: t }] = U(e, 1);
39633
39654
  return t == null ? [] : b(t) ? [{ type: c.string, value: `${t.value} '${t.unit}'` }] : [{ type: c.string, value: t.toString() }];
39634
- }, convertsToString: (r4, e) => e.length === 0 ? [] : d(E.toString(r4, e).length === 1), toTime: (r4, e) => {
39655
+ }, convertsToString: (r4, e) => e.length === 0 ? [] : d(S.toString(r4, e).length === 1), toTime: (r4, e) => {
39635
39656
  if (e.length === 0)
39636
39657
  return [];
39637
39658
  let [{ value: t }] = U(e, 1);
39638
39659
  if (typeof t == "string") {
39639
39660
  let n = /^T?(\d{2}(:\d{2}(:\d{2})?)?)/.exec(t);
39640
39661
  if (n)
39641
- return [{ type: c.time, value: ne("T" + n[1]) }];
39662
+ return [{ type: c.time, value: oe("T" + n[1]) }];
39642
39663
  }
39643
39664
  return [];
39644
- }, convertsToTime: (r4, e) => e.length === 0 ? [] : d(E.toTime(r4, e).length === 1), indexOf: (r4, e, t) => I((n, i2) => n.indexOf(i2), r4, e, t), substring: (r4, e, t, n) => I((i2, o, s) => {
39665
+ }, convertsToTime: (r4, e) => e.length === 0 ? [] : d(S.toTime(r4, e).length === 1), indexOf: (r4, e, t) => k((n, i2) => n.indexOf(i2), r4, e, t), substring: (r4, e, t, n) => k((i2, o, s) => {
39645
39666
  let a = o, u2 = s ? a + s : i2.length;
39646
39667
  return a < 0 || a >= i2.length ? void 0 : i2.substring(a, u2);
39647
- }, r4, e, t, n), startsWith: (r4, e, t) => I((n, i2) => n.startsWith(i2), r4, e, t), endsWith: (r4, e, t) => I((n, i2) => n.endsWith(i2), r4, e, t), contains: (r4, e, t) => I((n, i2) => n.includes(i2), r4, e, t), upper: (r4, e) => I((t) => t.toUpperCase(), r4, e), lower: (r4, e) => I((t) => t.toLowerCase(), r4, e), replace: (r4, e, t, n) => I((i2, o, s) => i2.replaceAll(o, s), r4, e, t, n), matches: (r4, e, t) => I((n, i2) => !!new RegExp(i2).exec(n), r4, e, t), replaceMatches: (r4, e, t, n) => I((i2, o, s) => i2.replaceAll(o, s), r4, e, t, n), length: (r4, e) => I((t) => t.length, r4, e), toChars: (r4, e) => I((t) => t ? t.split("") : void 0, r4, e), abs: (r4, e) => L(Math.abs, r4, e), ceiling: (r4, e) => L(Math.ceil, r4, e), exp: (r4, e) => L(Math.exp, r4, e), floor: (r4, e) => L(Math.floor, r4, e), ln: (r4, e) => L(Math.log, r4, e), log: (r4, e, t) => L((n, i2) => Math.log(n) / Math.log(i2), r4, e, t), power: (r4, e, t) => L(Math.pow, r4, e, t), round: (r4, e) => L(Math.round, r4, e), sqrt: (r4, e) => L(Math.sqrt, r4, e), truncate: (r4, e) => L((t) => t | 0, r4, e), children: le, descendants: le, trace: (r4, e, t) => (console.log("trace", e, t), e), now: () => [{ type: c.dateTime, value: (/* @__PURE__ */ new Date()).toISOString() }], timeOfDay: () => [{ type: c.time, value: (/* @__PURE__ */ new Date()).toISOString().substring(11) }], today: () => [{ type: c.date, value: (/* @__PURE__ */ new Date()).toISOString().substring(0, 10) }], between: (r4, e, t, n, i2) => {
39648
- let o = E.toDateTime(r4, t.eval(r4, e));
39668
+ }, r4, e, t, n), startsWith: (r4, e, t) => k((n, i2) => n.startsWith(i2), r4, e, t), endsWith: (r4, e, t) => k((n, i2) => n.endsWith(i2), r4, e, t), contains: (r4, e, t) => k((n, i2) => n.includes(i2), r4, e, t), upper: (r4, e) => k((t) => t.toUpperCase(), r4, e), lower: (r4, e) => k((t) => t.toLowerCase(), r4, e), replace: (r4, e, t, n) => k((i2, o, s) => i2.replaceAll(o, s), r4, e, t, n), matches: (r4, e, t) => k((n, i2) => !!new RegExp(i2).exec(n), r4, e, t), replaceMatches: (r4, e, t, n) => k((i2, o, s) => i2.replaceAll(o, s), r4, e, t, n), length: (r4, e) => k((t) => t.length, r4, e), toChars: (r4, e) => k((t) => t ? t.split("") : void 0, r4, e), abs: (r4, e) => L(Math.abs, r4, e), ceiling: (r4, e) => L(Math.ceil, r4, e), exp: (r4, e) => L(Math.exp, r4, e), floor: (r4, e) => L(Math.floor, r4, e), ln: (r4, e) => L(Math.log, r4, e), log: (r4, e, t) => L((n, i2) => Math.log(n) / Math.log(i2), r4, e, t), power: (r4, e, t) => L(Math.pow, r4, e, t), round: (r4, e) => L(Math.round, r4, e), sqrt: (r4, e) => L(Math.sqrt, r4, e), truncate: (r4, e) => L((t) => t | 0, r4, e), children: me, descendants: me, trace: (r4, e, t) => (console.log("trace", e, t), e), now: () => [{ type: c.dateTime, value: (/* @__PURE__ */ new Date()).toISOString() }], timeOfDay: () => [{ type: c.time, value: (/* @__PURE__ */ new Date()).toISOString().substring(11) }], today: () => [{ type: c.date, value: (/* @__PURE__ */ new Date()).toISOString().substring(0, 10) }], between: (r4, e, t, n, i2) => {
39669
+ let o = S.toDateTime(r4, t.eval(r4, e));
39649
39670
  if (o.length === 0)
39650
39671
  throw new Error("Invalid start date");
39651
- let s = E.toDateTime(r4, n.eval(r4, e));
39672
+ let s = S.toDateTime(r4, n.eval(r4, e));
39652
39673
  if (s.length === 0)
39653
39674
  throw new Error("Invalid end date");
39654
39675
  let a = i2.eval(r4, e)[0]?.value;
39655
39676
  if (a !== "years" && a !== "months" && a !== "days")
39656
39677
  throw new Error("Invalid units");
39657
- let u2 = Ee(o[0].value, s[0].value);
39678
+ let u2 = Re(o[0].value, s[0].value);
39658
39679
  return [{ type: c.Quantity, value: { value: u2[a], unit: a } }];
39659
39680
  }, is: (r4, e, t) => {
39660
39681
  let n = "";
39661
- return t instanceof q ? n = t.name : t instanceof H && (n = t.left.name + "." + t.right.name), n ? e.map((i2) => ({ type: c.boolean, value: we(i2, n) })) : [];
39662
- }, not: (r4, e) => E.toBoolean(r4, e).map((t) => ({ type: c.boolean, value: !t.value })), resolve: (r4, e) => e.map((t) => {
39682
+ return t instanceof q ? n = t.name : t instanceof H && (n = t.left.name + "." + t.right.name), n ? e.map((i2) => ({ type: c.boolean, value: Oe(i2, n) })) : [];
39683
+ }, not: (r4, e) => S.toBoolean(r4, e).map((t) => ({ type: c.boolean, value: !t.value })), resolve: (r4, e) => e.map((t) => {
39663
39684
  let n = t.value, i2;
39664
39685
  if (typeof n == "string")
39665
39686
  i2 = n;
39666
39687
  else if (typeof n == "object") {
39667
39688
  let o = n;
39668
39689
  if (o.resource)
39669
- return T(o.resource);
39690
+ return g(o.resource);
39670
39691
  o.reference ? i2 = o.reference : o.type && o.identifier && (i2 = `${o.type}?identifier=${o.identifier.system}|${o.identifier.value}`);
39671
39692
  }
39672
39693
  if (i2?.includes("?")) {
@@ -39678,21 +39699,21 @@ var E = { empty: (r4, e) => d(e.length === 0), exists: (r4, e, t) => t ? d(e.fil
39678
39699
  return { type: o, value: { resourceType: o, id: s } };
39679
39700
  }
39680
39701
  return { type: c.BackboneElement, value: void 0 };
39681
- }).filter((t) => !!t.value), as: (r4, e) => e, type: (r4, e) => e.map(({ value: t }) => typeof t == "boolean" ? { type: c.BackboneElement, value: { namespace: "System", name: "Boolean" } } : typeof t == "number" ? { type: c.BackboneElement, value: { namespace: "System", name: "Integer" } } : _(t) ? { type: c.BackboneElement, value: { namespace: "FHIR", name: t.resourceType } } : { type: c.BackboneElement, value: null }), conformsTo: (r4, e, t) => {
39702
+ }).filter((t) => !!t.value), as: (r4, e) => e, type: (r4, e) => e.map(({ value: t }) => typeof t == "boolean" ? { type: c.BackboneElement, value: { namespace: "System", name: "Boolean" } } : typeof t == "number" ? { type: c.BackboneElement, value: { namespace: "System", name: "Integer" } } : M(t) ? { type: c.BackboneElement, value: { namespace: "FHIR", name: t.resourceType } } : { type: c.BackboneElement, value: null }), conformsTo: (r4, e, t) => {
39682
39703
  let n = t.eval(r4, e)[0].value;
39683
39704
  if (!n.startsWith("http://hl7.org/fhir/StructureDefinition/"))
39684
39705
  throw new Error("Expected a StructureDefinition URL");
39685
39706
  let i2 = n.replace("http://hl7.org/fhir/StructureDefinition/", "");
39686
39707
  return e.map((o) => ({ type: c.boolean, value: o.value?.resourceType === i2 }));
39687
39708
  } };
39688
- function I(r4, e, t, ...n) {
39709
+ function k(r4, e, t, ...n) {
39689
39710
  if (t.length === 0)
39690
39711
  return [];
39691
39712
  let [{ value: i2 }] = U(t, 1);
39692
39713
  if (typeof i2 != "string")
39693
39714
  throw new Error("String function cannot be called with non-string");
39694
39715
  let o = r4(i2, ...n.map((s) => s?.eval(e, t)[0]?.value));
39695
- return o === void 0 ? [] : Array.isArray(o) ? o.map(T) : [T(o)];
39716
+ return o === void 0 ? [] : Array.isArray(o) ? o.map(g) : [g(o)];
39696
39717
  }
39697
39718
  function L(r4, e, t, ...n) {
39698
39719
  if (t.length === 0)
@@ -39711,7 +39732,7 @@ function U(r4, e) {
39711
39732
  throw new Error("Expected non-null argument");
39712
39733
  return r4;
39713
39734
  }
39714
- var V = class {
39735
+ var N = class {
39715
39736
  constructor(e) {
39716
39737
  this.value = e;
39717
39738
  }
@@ -39741,13 +39762,13 @@ var q = class {
39741
39762
  evalValue(e) {
39742
39763
  let t = e.value;
39743
39764
  if (!(!t || typeof t != "object"))
39744
- return _(t) && t.resourceType === this.name ? e : O(e, this.name);
39765
+ return M(t) && t.resourceType === this.name ? e : A(e, this.name);
39745
39766
  }
39746
39767
  toString() {
39747
39768
  return this.name;
39748
39769
  }
39749
39770
  };
39750
- var Fe = class {
39771
+ var Le = class {
39751
39772
  eval() {
39752
39773
  return [];
39753
39774
  }
@@ -39755,7 +39776,7 @@ var Fe = class {
39755
39776
  return "{}";
39756
39777
  }
39757
39778
  };
39758
- var _e = class extends Te {
39779
+ var Ue = class extends Ee {
39759
39780
  constructor(t, n, i2) {
39760
39781
  super(t, n);
39761
39782
  this.impl = i2;
@@ -39767,15 +39788,15 @@ var _e = class extends Te {
39767
39788
  return this.operator + this.child.toString();
39768
39789
  }
39769
39790
  };
39770
- var J = class extends $ {
39791
+ var Y = class extends j {
39771
39792
  constructor(e, t) {
39772
39793
  super("as", e, t);
39773
39794
  }
39774
39795
  eval(e, t) {
39775
- return E.ofType(e, this.left.eval(e, t), this.right);
39796
+ return S.ofType(e, this.left.eval(e, t), this.right);
39776
39797
  }
39777
39798
  };
39778
- var v = class extends $ {
39799
+ var v = class extends j {
39779
39800
  };
39780
39801
  var R = class extends v {
39781
39802
  constructor(t, n, i2, o) {
@@ -39790,10 +39811,10 @@ var R = class extends v {
39790
39811
  if (o.length !== 1)
39791
39812
  return [];
39792
39813
  let s = i2[0].value, a = o[0].value, u2 = b(s) ? s.value : s, l2 = b(a) ? a.value : a, f = this.impl(u2, l2);
39793
- return typeof f == "boolean" ? d(f) : b(s) ? [{ type: c.Quantity, value: { ...s, value: f } }] : [T(f)];
39814
+ return typeof f == "boolean" ? d(f) : b(s) ? [{ type: c.Quantity, value: { ...s, value: f } }] : [g(f)];
39794
39815
  }
39795
39816
  };
39796
- var Le = class extends $ {
39817
+ var Be = class extends j {
39797
39818
  constructor(e, t) {
39798
39819
  super("&", e, t);
39799
39820
  }
@@ -39802,7 +39823,7 @@ var Le = class extends $ {
39802
39823
  return o.length > 0 && o.every((s) => typeof s.value == "string") ? [{ type: c.string, value: o.map((s) => s.value).join("") }] : o;
39803
39824
  }
39804
39825
  };
39805
- var Ue = class extends v {
39826
+ var qe = class extends v {
39806
39827
  constructor(e, t) {
39807
39828
  super("contains", e, t);
39808
39829
  }
@@ -39811,16 +39832,16 @@ var Ue = class extends v {
39811
39832
  return d(n.some((o) => o.value === i2[0].value));
39812
39833
  }
39813
39834
  };
39814
- var Me = class extends v {
39835
+ var $e = class extends v {
39815
39836
  constructor(e, t) {
39816
39837
  super("in", e, t);
39817
39838
  }
39818
39839
  eval(e, t) {
39819
- let n = F(this.left.eval(e, t)), i2 = this.right.eval(e, t);
39840
+ let n = _(this.left.eval(e, t)), i2 = this.right.eval(e, t);
39820
39841
  return n ? d(i2.some((o) => o.value === n.value)) : [];
39821
39842
  }
39822
39843
  };
39823
- var H = class extends $ {
39844
+ var H = class extends j {
39824
39845
  constructor(e, t) {
39825
39846
  super(".", e, t);
39826
39847
  }
@@ -39831,52 +39852,52 @@ var H = class extends $ {
39831
39852
  return `${this.left.toString()}.${this.right.toString()}`;
39832
39853
  }
39833
39854
  };
39834
- var ie = class extends $ {
39855
+ var se = class extends j {
39835
39856
  constructor(e, t) {
39836
39857
  super("|", e, t);
39837
39858
  }
39838
39859
  eval(e, t) {
39839
39860
  let n = this.left.eval(e, t), i2 = this.right.eval(e, t);
39840
- return Ce([...n, ...i2]);
39861
+ return ke([...n, ...i2]);
39841
39862
  }
39842
39863
  };
39843
- var Be = class extends v {
39864
+ var je = class extends v {
39844
39865
  constructor(e, t) {
39845
39866
  super("=", e, t);
39846
39867
  }
39847
39868
  eval(e, t) {
39848
39869
  let n = this.left.eval(e, t), i2 = this.right.eval(e, t);
39849
- return dt(n, i2);
39870
+ return mt(n, i2);
39850
39871
  }
39851
39872
  };
39852
- var qe = class extends v {
39873
+ var Qe = class extends v {
39853
39874
  constructor(e, t) {
39854
39875
  super("!=", e, t);
39855
39876
  }
39856
39877
  eval(e, t) {
39857
39878
  let n = this.left.eval(e, t), i2 = this.right.eval(e, t);
39858
- return lt(dt(n, i2));
39879
+ return ft(mt(n, i2));
39859
39880
  }
39860
39881
  };
39861
- var je = class extends v {
39882
+ var He = class extends v {
39862
39883
  constructor(e, t) {
39863
39884
  super("~", e, t);
39864
39885
  }
39865
39886
  eval(e, t) {
39866
39887
  let n = this.left.eval(e, t), i2 = this.right.eval(e, t);
39867
- return pt(n, i2);
39888
+ return ht(n, i2);
39868
39889
  }
39869
39890
  };
39870
- var $e = class extends v {
39891
+ var Ge = class extends v {
39871
39892
  constructor(e, t) {
39872
39893
  super("!~", e, t);
39873
39894
  }
39874
39895
  eval(e, t) {
39875
39896
  let n = this.left.eval(e, t), i2 = this.right.eval(e, t);
39876
- return lt(pt(n, i2));
39897
+ return ft(ht(n, i2));
39877
39898
  }
39878
39899
  };
39879
- var Y = class extends v {
39900
+ var X = class extends v {
39880
39901
  constructor(e, t) {
39881
39902
  super("is", e, t);
39882
39903
  }
@@ -39885,52 +39906,52 @@ var Y = class extends v {
39885
39906
  if (n.length !== 1)
39886
39907
  return [];
39887
39908
  let i2 = this.right.name;
39888
- return d(we(n[0], i2));
39909
+ return d(Oe(n[0], i2));
39889
39910
  }
39890
39911
  };
39891
- var Qe = class extends v {
39912
+ var Ke = class extends v {
39892
39913
  constructor(e, t) {
39893
39914
  super("and", e, t);
39894
39915
  }
39895
39916
  eval(e, t) {
39896
- let n = F(this.left.eval(e, t), "boolean"), i2 = F(this.right.eval(e, t), "boolean");
39917
+ let n = _(this.left.eval(e, t), "boolean"), i2 = _(this.right.eval(e, t), "boolean");
39897
39918
  return n?.value === true && i2?.value === true ? d(true) : n?.value === false || i2?.value === false ? d(false) : [];
39898
39919
  }
39899
39920
  };
39900
- var He = class extends v {
39921
+ var We = class extends v {
39901
39922
  constructor(e, t) {
39902
39923
  super("or", e, t);
39903
39924
  }
39904
39925
  eval(e, t) {
39905
- let n = F(this.left.eval(e, t), "boolean"), i2 = F(this.right.eval(e, t), "boolean");
39926
+ let n = _(this.left.eval(e, t), "boolean"), i2 = _(this.right.eval(e, t), "boolean");
39906
39927
  return n?.value === false && i2?.value === false ? d(false) : n?.value || i2?.value ? d(true) : [];
39907
39928
  }
39908
39929
  };
39909
- var Ke = class extends v {
39930
+ var ze = class extends v {
39910
39931
  constructor(e, t) {
39911
39932
  super("xor", e, t);
39912
39933
  }
39913
39934
  eval(e, t) {
39914
- let n = F(this.left.eval(e, t), "boolean"), i2 = F(this.right.eval(e, t), "boolean");
39935
+ let n = _(this.left.eval(e, t), "boolean"), i2 = _(this.right.eval(e, t), "boolean");
39915
39936
  return !n || !i2 ? [] : d(n.value !== i2.value);
39916
39937
  }
39917
39938
  };
39918
- var We = class extends v {
39939
+ var Je = class extends v {
39919
39940
  constructor(e, t) {
39920
39941
  super("implies", e, t);
39921
39942
  }
39922
39943
  eval(e, t) {
39923
- let n = F(this.left.eval(e, t), "boolean"), i2 = F(this.right.eval(e, t), "boolean");
39944
+ let n = _(this.left.eval(e, t), "boolean"), i2 = _(this.right.eval(e, t), "boolean");
39924
39945
  return i2?.value === true || n?.value === false ? d(true) : !n || !i2 ? [] : d(false);
39925
39946
  }
39926
39947
  };
39927
- var j = class {
39948
+ var $ = class {
39928
39949
  constructor(e, t) {
39929
39950
  this.name = e;
39930
39951
  this.args = t;
39931
39952
  }
39932
39953
  eval(e, t) {
39933
- let n = E[this.name];
39954
+ let n = S[this.name];
39934
39955
  if (!n)
39935
39956
  throw new Error("Unrecognized function: " + this.name);
39936
39957
  return n(e, t, ...this.args);
@@ -39939,7 +39960,7 @@ var j = class {
39939
39960
  return `${this.name}(${this.args.map((e) => e.toString()).join(", ")})`;
39940
39961
  }
39941
39962
  };
39942
- var X = class {
39963
+ var Z = class {
39943
39964
  constructor(e, t) {
39944
39965
  this.left = e;
39945
39966
  this.expr = t;
@@ -39958,67 +39979,67 @@ var X = class {
39958
39979
  return `${this.left.toString()}[${this.expr.toString()}]`;
39959
39980
  }
39960
39981
  };
39961
- var pe = ["!=", "!~", "<=", ">=", "{}", "->"];
39982
+ var ye = ["!=", "!~", "<=", ">=", "{}", "->"];
39962
39983
  var m = { FunctionCall: 0, Dot: 1, Indexer: 2, UnaryAdd: 3, UnarySubtract: 3, Multiply: 4, Divide: 4, IntegerDivide: 4, Modulo: 4, Add: 5, Subtract: 5, Ampersand: 5, Is: 6, As: 6, Union: 7, GreaterThan: 8, GreaterThanOrEquals: 8, LessThan: 8, LessThanOrEquals: 8, Equals: 9, Equivalent: 9, NotEquals: 9, NotEquivalent: 9, In: 10, Contains: 10, And: 11, Xor: 12, Or: 12, Implies: 13, Arrow: 100, Semicolon: 200 };
39963
- var di = { parse(r4) {
39984
+ var Ri = { parse(r4) {
39964
39985
  let e = r4.consumeAndParse();
39965
39986
  if (!r4.match(")"))
39966
39987
  throw new Error("Parse error: expected `)` got `" + r4.peek()?.value + "`");
39967
39988
  return e;
39968
39989
  } };
39969
- var pi = { parse(r4, e) {
39990
+ var Pi = { parse(r4, e) {
39970
39991
  let t = r4.consumeAndParse();
39971
39992
  if (!r4.match("]"))
39972
39993
  throw new Error("Parse error: expected `]`");
39973
- return new X(e, t);
39994
+ return new Z(e, t);
39974
39995
  }, precedence: m.Indexer };
39975
- var fi = { parse(r4, e) {
39996
+ var Ai = { parse(r4, e) {
39976
39997
  if (!(e instanceof q))
39977
39998
  throw new Error("Unexpected parentheses");
39978
39999
  let t = [];
39979
40000
  for (; !r4.match(")"); )
39980
40001
  t.push(r4.consumeAndParse()), r4.match(",");
39981
- return new j(e.name, t);
40002
+ return new $(e.name, t);
39982
40003
  }, precedence: m.FunctionCall };
39983
- function mi(r4) {
40004
+ function Ci(r4) {
39984
40005
  let e = r4.split(" "), t = parseFloat(e[0]), n = e[1];
39985
40006
  return n?.startsWith("'") && n.endsWith("'") ? n = n.substring(1, n.length - 1) : n = "{" + n + "}", { value: t, unit: n };
39986
40007
  }
39987
- function fe() {
39988
- return new ve().registerPrefix("String", { parse: (r4, e) => new V({ type: c.string, value: e.value }) }).registerPrefix("DateTime", { parse: (r4, e) => new V({ type: c.dateTime, value: ne(e.value) }) }).registerPrefix("Quantity", { parse: (r4, e) => new V({ type: c.Quantity, value: mi(e.value) }) }).registerPrefix("Number", { parse: (r4, e) => new V({ type: c.decimal, value: parseFloat(e.value) }) }).registerPrefix("true", { parse: () => new V({ type: c.boolean, value: true }) }).registerPrefix("false", { parse: () => new V({ type: c.boolean, value: false }) }).registerPrefix("Symbol", { parse: (r4, e) => new q(e.value) }).registerPrefix("{}", { parse: () => new Fe() }).registerPrefix("(", di).registerInfix("[", pi).registerInfix("(", fi).prefix("+", m.UnaryAdd, (r4, e) => new _e("+", e, (t) => t)).prefix("-", m.UnarySubtract, (r4, e) => new R("-", e, e, (t, n) => -n)).infixLeft(".", m.Dot, (r4, e, t) => new H(r4, t)).infixLeft("/", m.Divide, (r4, e, t) => new R("/", r4, t, (n, i2) => n / i2)).infixLeft("*", m.Multiply, (r4, e, t) => new R("*", r4, t, (n, i2) => n * i2)).infixLeft("+", m.Add, (r4, e, t) => new R("+", r4, t, (n, i2) => n + i2)).infixLeft("-", m.Subtract, (r4, e, t) => new R("-", r4, t, (n, i2) => n - i2)).infixLeft("|", m.Union, (r4, e, t) => new ie(r4, t)).infixLeft("=", m.Equals, (r4, e, t) => new Be(r4, t)).infixLeft("!=", m.NotEquals, (r4, e, t) => new qe(r4, t)).infixLeft("~", m.Equivalent, (r4, e, t) => new je(r4, t)).infixLeft("!~", m.NotEquivalent, (r4, e, t) => new $e(r4, t)).infixLeft("<", m.LessThan, (r4, e, t) => new R("<", r4, t, (n, i2) => n < i2)).infixLeft("<=", m.LessThanOrEquals, (r4, e, t) => new R("<=", r4, t, (n, i2) => n <= i2)).infixLeft(">", m.GreaterThan, (r4, e, t) => new R(">", r4, t, (n, i2) => n > i2)).infixLeft(">=", m.GreaterThanOrEquals, (r4, e, t) => new R(">=", r4, t, (n, i2) => n >= i2)).infixLeft("&", m.Ampersand, (r4, e, t) => new Le(r4, t)).infixLeft("and", m.And, (r4, e, t) => new Qe(r4, t)).infixLeft("as", m.As, (r4, e, t) => new J(r4, t)).infixLeft("contains", m.Contains, (r4, e, t) => new Ue(r4, t)).infixLeft("div", m.Divide, (r4, e, t) => new R("div", r4, t, (n, i2) => n / i2 | 0)).infixLeft("in", m.In, (r4, e, t) => new Me(r4, t)).infixLeft("is", m.Is, (r4, e, t) => new Y(r4, t)).infixLeft("mod", m.Modulo, (r4, e, t) => new R("mod", r4, t, (n, i2) => n % i2)).infixLeft("or", m.Or, (r4, e, t) => new He(r4, t)).infixLeft("xor", m.Xor, (r4, e, t) => new Ke(r4, t)).infixLeft("implies", m.Implies, (r4, e, t) => new We(r4, t));
40008
+ function ge() {
40009
+ return new be().registerPrefix("String", { parse: (r4, e) => new N({ type: c.string, value: e.value }) }).registerPrefix("DateTime", { parse: (r4, e) => new N({ type: c.dateTime, value: oe(e.value) }) }).registerPrefix("Quantity", { parse: (r4, e) => new N({ type: c.Quantity, value: Ci(e.value) }) }).registerPrefix("Number", { parse: (r4, e) => new N({ type: e.value.includes(".") ? c.decimal : c.integer, value: parseFloat(e.value) }) }).registerPrefix("true", { parse: () => new N({ type: c.boolean, value: true }) }).registerPrefix("false", { parse: () => new N({ type: c.boolean, value: false }) }).registerPrefix("Symbol", { parse: (r4, e) => new q(e.value) }).registerPrefix("{}", { parse: () => new Le() }).registerPrefix("(", Ri).registerInfix("[", Pi).registerInfix("(", Ai).prefix("+", m.UnaryAdd, (r4, e) => new Ue("+", e, (t) => t)).prefix("-", m.UnarySubtract, (r4, e) => new R("-", e, e, (t, n) => -n)).infixLeft(".", m.Dot, (r4, e, t) => new H(r4, t)).infixLeft("/", m.Divide, (r4, e, t) => new R("/", r4, t, (n, i2) => n / i2)).infixLeft("*", m.Multiply, (r4, e, t) => new R("*", r4, t, (n, i2) => n * i2)).infixLeft("+", m.Add, (r4, e, t) => new R("+", r4, t, (n, i2) => n + i2)).infixLeft("-", m.Subtract, (r4, e, t) => new R("-", r4, t, (n, i2) => n - i2)).infixLeft("|", m.Union, (r4, e, t) => new se(r4, t)).infixLeft("=", m.Equals, (r4, e, t) => new je(r4, t)).infixLeft("!=", m.NotEquals, (r4, e, t) => new Qe(r4, t)).infixLeft("~", m.Equivalent, (r4, e, t) => new He(r4, t)).infixLeft("!~", m.NotEquivalent, (r4, e, t) => new Ge(r4, t)).infixLeft("<", m.LessThan, (r4, e, t) => new R("<", r4, t, (n, i2) => n < i2)).infixLeft("<=", m.LessThanOrEquals, (r4, e, t) => new R("<=", r4, t, (n, i2) => n <= i2)).infixLeft(">", m.GreaterThan, (r4, e, t) => new R(">", r4, t, (n, i2) => n > i2)).infixLeft(">=", m.GreaterThanOrEquals, (r4, e, t) => new R(">=", r4, t, (n, i2) => n >= i2)).infixLeft("&", m.Ampersand, (r4, e, t) => new Be(r4, t)).infixLeft("and", m.And, (r4, e, t) => new Ke(r4, t)).infixLeft("as", m.As, (r4, e, t) => new Y(r4, t)).infixLeft("contains", m.Contains, (r4, e, t) => new qe(r4, t)).infixLeft("div", m.Divide, (r4, e, t) => new R("div", r4, t, (n, i2) => n / i2 | 0)).infixLeft("in", m.In, (r4, e, t) => new $e(r4, t)).infixLeft("is", m.Is, (r4, e, t) => new X(r4, t)).infixLeft("mod", m.Modulo, (r4, e, t) => new R("mod", r4, t, (n, i2) => n % i2)).infixLeft("or", m.Or, (r4, e, t) => new We(r4, t)).infixLeft("xor", m.Xor, (r4, e, t) => new ze(r4, t)).infixLeft("implies", m.Implies, (r4, e, t) => new Je(r4, t));
39989
40010
  }
39990
- var hi = fe();
39991
- var _r = ((f) => (f.BOOLEAN = "BOOLEAN", f.NUMBER = "NUMBER", f.QUANTITY = "QUANTITY", f.TEXT = "TEXT", f.REFERENCE = "REFERENCE", f.CANONICAL = "CANONICAL", f.DATE = "DATE", f.DATETIME = "DATETIME", f.PERIOD = "PERIOD", f.UUID = "UUID", f))(_r || {});
39992
- var Si = ((g2) => (g2.EQUALS = "eq", g2.NOT_EQUALS = "ne", g2.GREATER_THAN = "gt", g2.LESS_THAN = "lt", g2.GREATER_THAN_OR_EQUALS = "ge", g2.LESS_THAN_OR_EQUALS = "le", g2.STARTS_AFTER = "sa", g2.ENDS_BEFORE = "eb", g2.APPROXIMATELY = "ap", g2.CONTAINS = "contains", g2.EXACT = "exact", g2.TEXT = "text", g2.NOT = "not", g2.ABOVE = "above", g2.BELOW = "below", g2.IN = "in", g2.NOT_IN = "not-in", g2.OF_TYPE = "of-type", g2.MISSING = "missing", g2.IDENTIFIER = "identifier", g2.ITERATE = "iterate", g2))(Si || {});
39993
- var $i = ((x) => (x.READ = "read", x.VREAD = "vread", x.UPDATE = "update", x.PATCH = "patch", x.DELETE = "delete", x.HISTORY = "history", x.HISTORY_INSTANCE = "history-instance", x.HISTORY_TYPE = "history-type", x.HISTORY_SYSTEM = "history-system", x.CREATE = "create", x.SEARCH = "search", x.SEARCH_TYPE = "search-type", x.SEARCH_SYSTEM = "search-system", x.SEARCH_COMPARTMENT = "search-compartment", x.CAPABILITIES = "capabilities", x.TRANSACTION = "transaction", x.BATCH = "batch", x.OPERATION = "operation", x))($i || {});
39994
- function Gr(r4) {
40011
+ var wi = ge();
40012
+ var Br = ((f) => (f.BOOLEAN = "BOOLEAN", f.NUMBER = "NUMBER", f.QUANTITY = "QUANTITY", f.TEXT = "TEXT", f.REFERENCE = "REFERENCE", f.CANONICAL = "CANONICAL", f.DATE = "DATE", f.DATETIME = "DATETIME", f.PERIOD = "PERIOD", f.UUID = "UUID", f))(Br || {});
40013
+ var Fi = ((x) => (x.EQUALS = "eq", x.NOT_EQUALS = "ne", x.GREATER_THAN = "gt", x.LESS_THAN = "lt", x.GREATER_THAN_OR_EQUALS = "ge", x.LESS_THAN_OR_EQUALS = "le", x.STARTS_AFTER = "sa", x.ENDS_BEFORE = "eb", x.APPROXIMATELY = "ap", x.CONTAINS = "contains", x.EXACT = "exact", x.TEXT = "text", x.NOT = "not", x.ABOVE = "above", x.BELOW = "below", x.IN = "in", x.NOT_IN = "not-in", x.OF_TYPE = "of-type", x.MISSING = "missing", x.IDENTIFIER = "identifier", x.ITERATE = "iterate", x))(Fi || {});
40014
+ var ro = ((T) => (T.READ = "read", T.VREAD = "vread", T.UPDATE = "update", T.PATCH = "patch", T.DELETE = "delete", T.HISTORY = "history", T.HISTORY_INSTANCE = "history-instance", T.HISTORY_TYPE = "history-type", T.HISTORY_SYSTEM = "history-system", T.CREATE = "create", T.SEARCH = "search", T.SEARCH_TYPE = "search-type", T.SEARCH_SYSTEM = "search-system", T.SEARCH_COMPARTMENT = "search-compartment", T.CAPABILITIES = "capabilities", T.TRANSACTION = "transaction", T.BATCH = "batch", T.OPERATION = "operation", T))(ro || {});
40015
+ function Xr(r4) {
39995
40016
  if (typeof window < "u")
39996
40017
  return window.atob(r4);
39997
40018
  if (typeof Buffer < "u")
39998
40019
  return Buffer.from(r4, "base64").toString("binary");
39999
40020
  throw new Error("Unable to decode base64");
40000
40021
  }
40001
- function zr(r4) {
40022
+ function Zr(r4) {
40002
40023
  if (typeof window < "u")
40003
40024
  return window.btoa(r4);
40004
40025
  if (typeof Buffer < "u")
40005
40026
  return Buffer.from(r4, "binary").toString("base64");
40006
40027
  throw new Error("Unable to encode base64");
40007
40028
  }
40008
- function _t() {
40029
+ function Ut() {
40009
40030
  let r4 = new Uint32Array(28);
40010
- return crypto.getRandomValues(r4), ir(r4.buffer);
40031
+ return crypto.getRandomValues(r4), cr(r4.buffer);
40011
40032
  }
40012
- async function Jr(r4) {
40033
+ async function en(r4) {
40013
40034
  return crypto.subtle.digest("SHA-256", new TextEncoder().encode(r4));
40014
40035
  }
40015
- function ye() {
40036
+ function ee() {
40016
40037
  return "xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g, (r4) => {
40017
40038
  let e = Math.random() * 16 | 0;
40018
40039
  return (r4 === "x" ? e : e & 3 | 8).toString(16);
40019
40040
  });
40020
40041
  }
40021
- var ze = class {
40042
+ var Xe = class {
40022
40043
  constructor(e = 10) {
40023
40044
  this.max = e, this.cache = /* @__PURE__ */ new Map();
40024
40045
  }
@@ -40042,8 +40063,8 @@ var ze = class {
40042
40063
  return this.cache.keys().next().value;
40043
40064
  }
40044
40065
  };
40045
- var k = { CSS: "text/css", DICOM: "application/dicom", FAVICON: "image/vnd.microsoft.icon", FHIR_JSON: "application/fhir+json", FORM_URL_ENCODED: "application/x-www-form-urlencoded", HL7_V2: "x-application/hl7-v2+er7", HTML: "text/html", JAVASCRIPT: "text/javascript", JSON: "application/json", JSON_PATCH: "application/json-patch+json", PNG: "image/png", SVG: "image/svg+xml", TEXT: "text/plain", TYPESCRIPT: "text/typescript" };
40046
- var ge = class {
40066
+ var O = { CSS: "text/css", DICOM: "application/dicom", FAVICON: "image/vnd.microsoft.icon", FHIR_JSON: "application/fhir+json", FORM_URL_ENCODED: "application/x-www-form-urlencoded", HL7_V2: "x-application/hl7-v2+er7", HTML: "text/html", JAVASCRIPT: "text/javascript", JSON: "application/json", JSON_PATCH: "application/json-patch+json", PNG: "image/png", SVG: "image/svg+xml", TEXT: "text/plain", TYPESCRIPT: "text/typescript" };
40067
+ var Te = class {
40047
40068
  constructor() {
40048
40069
  this.listeners = {};
40049
40070
  }
@@ -40068,9 +40089,9 @@ var ge = class {
40068
40089
  return !e.defaultPrevented;
40069
40090
  }
40070
40091
  };
40071
- var Je = class {
40092
+ var Ze = class {
40072
40093
  constructor() {
40073
- this.emitter = new ge();
40094
+ this.emitter = new Te();
40074
40095
  }
40075
40096
  dispatchEvent(e) {
40076
40097
  this.emitter.dispatchEvent(e);
@@ -40082,41 +40103,41 @@ var Je = class {
40082
40103
  this.emitter.removeEventListener(e, t);
40083
40104
  }
40084
40105
  };
40085
- var Lt = { "Patient-open": "Patient-open", "Patient-close": "Patient-close", "ImagingStudy-open": "ImagingStudy-open", "ImagingStudy-close": "ImagingStudy-close", "Encounter-open": "Encounter-open", "Encounter-close": "Encounter-close", "DiagnosticReport-open": "DiagnosticReport-open", "DiagnosticReport-close": "DiagnosticReport-close", "DiagnosticReport-select": "DiagnosticReport-select", "DiagnosticReport-update": "DiagnosticReport-update", syncerror: "syncerror" };
40086
- var Xi = ["Patient", "Encounter", "ImagingStudy", "DiagnosticReport", "OperationOutcome", "Bundle"];
40087
- var Ut = ["DiagnosticReport-update"];
40088
- function Zr(r4) {
40089
- return Ut.includes(r4);
40106
+ var Bt = { "Patient-open": "Patient-open", "Patient-close": "Patient-close", "ImagingStudy-open": "ImagingStudy-open", "ImagingStudy-close": "ImagingStudy-close", "Encounter-open": "Encounter-open", "Encounter-close": "Encounter-close", "DiagnosticReport-open": "DiagnosticReport-open", "DiagnosticReport-close": "DiagnosticReport-close", "DiagnosticReport-select": "DiagnosticReport-select", "DiagnosticReport-update": "DiagnosticReport-update", syncerror: "syncerror" };
40107
+ var po = ["Patient", "Encounter", "ImagingStudy", "DiagnosticReport", "OperationOutcome", "Bundle"];
40108
+ var qt = ["DiagnosticReport-update"];
40109
+ function nn(r4) {
40110
+ return qt.includes(r4);
40090
40111
  }
40091
- function en(r4) {
40092
- if (Ut.includes(r4))
40112
+ function on(r4) {
40113
+ if (qt.includes(r4))
40093
40114
  throw new p(h(`'context.version' is required for '${r4}'.`));
40094
40115
  }
40095
- var Zi = { "Patient-open": { patient: { resourceType: "Patient" }, encounter: { resourceType: "Encounter", optional: true } }, "Patient-close": { patient: { resourceType: "Patient" }, encounter: { resourceType: "Encounter", optional: true } }, "ImagingStudy-open": { study: { resourceType: "ImagingStudy" }, encounter: { resourceType: "Encounter", optional: true }, patient: { resourceType: "Patient", optional: true } }, "ImagingStudy-close": { study: { resourceType: "ImagingStudy" }, encounter: { resourceType: "Encounter", optional: true }, patient: { resourceType: "Patient", optional: true } }, "Encounter-open": { encounter: { resourceType: "Encounter" }, patient: { resourceType: "Patient" } }, "Encounter-close": { encounter: { resourceType: "Encounter" }, patient: { resourceType: "Patient" } }, "DiagnosticReport-open": { report: { resourceType: "DiagnosticReport" }, encounter: { resourceType: "Encounter", optional: true }, study: { resourceType: "ImagingStudy", optional: true, manyAllowed: true }, patient: { resourceType: "Patient" } }, "DiagnosticReport-close": { report: { resourceType: "DiagnosticReport" }, encounter: { resourceType: "Encounter", optional: true }, study: { resourceType: "ImagingStudy", optional: true, manyAllowed: true }, patient: { resourceType: "Patient" } }, "DiagnosticReport-select": { report: { resourceType: "DiagnosticReport" }, select: { resourceType: "*", isArray: true } }, "DiagnosticReport-update": { report: { resourceType: "DiagnosticReport" }, patient: { resourceType: "Patient", optional: true }, study: { resourceType: "ImagingStudy", optional: true }, updates: { resourceType: "Bundle" } }, syncerror: { operationoutcome: { resourceType: "OperationOutcome" } } };
40096
- function eo(r4) {
40097
- return Xi.includes(r4);
40116
+ var fo = { "Patient-open": { patient: { resourceType: "Patient" }, encounter: { resourceType: "Encounter", optional: true } }, "Patient-close": { patient: { resourceType: "Patient" }, encounter: { resourceType: "Encounter", optional: true } }, "ImagingStudy-open": { study: { resourceType: "ImagingStudy" }, encounter: { resourceType: "Encounter", optional: true }, patient: { resourceType: "Patient", optional: true } }, "ImagingStudy-close": { study: { resourceType: "ImagingStudy" }, encounter: { resourceType: "Encounter", optional: true }, patient: { resourceType: "Patient", optional: true } }, "Encounter-open": { encounter: { resourceType: "Encounter" }, patient: { resourceType: "Patient" } }, "Encounter-close": { encounter: { resourceType: "Encounter" }, patient: { resourceType: "Patient" } }, "DiagnosticReport-open": { report: { resourceType: "DiagnosticReport" }, encounter: { resourceType: "Encounter", optional: true }, study: { resourceType: "ImagingStudy", optional: true, manyAllowed: true }, patient: { resourceType: "Patient" } }, "DiagnosticReport-close": { report: { resourceType: "DiagnosticReport" }, encounter: { resourceType: "Encounter", optional: true }, study: { resourceType: "ImagingStudy", optional: true, manyAllowed: true }, patient: { resourceType: "Patient" } }, "DiagnosticReport-select": { report: { resourceType: "DiagnosticReport" }, select: { resourceType: "*", isArray: true } }, "DiagnosticReport-update": { report: { resourceType: "DiagnosticReport" }, patient: { resourceType: "Patient", optional: true }, study: { resourceType: "ImagingStudy", optional: true }, updates: { resourceType: "Bundle" } }, syncerror: { operationoutcome: { resourceType: "OperationOutcome" } } };
40117
+ function mo(r4) {
40118
+ return po.includes(r4);
40098
40119
  }
40099
- function tn(r4) {
40120
+ function sn(r4) {
40100
40121
  return !!r4.endpoint;
40101
40122
  }
40102
- function Mt(r4) {
40103
- if (!Xe(r4))
40123
+ function $t(r4) {
40124
+ if (!tt(r4))
40104
40125
  throw new p(h("subscriptionRequest must be an object conforming to SubscriptionRequest type."));
40105
40126
  let { channelType: e, mode: t, topic: n, events: i2 } = r4, o = { "hub.channel.type": e, "hub.mode": t, "hub.topic": n, "hub.events": i2.join(",") };
40106
- return tn(r4) && (o.endpoint = r4.endpoint), new URLSearchParams(o).toString();
40127
+ return sn(r4) && (o.endpoint = r4.endpoint), new URLSearchParams(o).toString();
40107
40128
  }
40108
- function Xe(r4) {
40129
+ function tt(r4) {
40109
40130
  if (typeof r4 != "object")
40110
40131
  return false;
40111
40132
  let { channelType: e, mode: t, topic: n, events: i2 } = r4;
40112
40133
  if (!(e && t && n && i2) || typeof n != "string" || typeof i2 != "object" || !Array.isArray(i2) || i2.length < 1 || e !== "websocket" || t !== "subscribe" && t !== "unsubscribe")
40113
40134
  return false;
40114
40135
  for (let o of i2)
40115
- if (!Lt[o])
40136
+ if (!Bt[o])
40116
40137
  return false;
40117
- return !(tn(r4) && !(typeof r4.endpoint == "string" && r4.endpoint.startsWith("ws")));
40138
+ return !(sn(r4) && !(typeof r4.endpoint == "string" && r4.endpoint.startsWith("ws")));
40118
40139
  }
40119
- function Xr(r4, e, t, n) {
40140
+ function rn(r4, e, t, n) {
40120
40141
  if (typeof e != "object")
40121
40142
  throw new p(h(`context[${t}] is invalid. Context must contain a single valid FHIR resource! Resource is not an object.`));
40122
40143
  if (!(e.id && typeof e.id == "string"))
@@ -40125,30 +40146,30 @@ function Xr(r4, e, t, n) {
40125
40146
  throw new p(h(`context[${t}] is invalid. Resource must contain a resource type. No resource type found.`));
40126
40147
  let i2 = n.resourceType;
40127
40148
  if (i2 !== "*") {
40128
- if (!eo(e.resourceType))
40149
+ if (!mo(e.resourceType))
40129
40150
  throw new p(h(`context[${t}] is invalid. Resource must contain a valid FHIRcast resource type. Resource type is not a known resource type.`));
40130
40151
  if (i2 && e.resourceType !== i2)
40131
40152
  throw new p(h(`context[${t}] is invalid. context[${t}] for the '${r4}' event should contain resource of type ${i2}.`));
40132
40153
  }
40133
40154
  }
40134
- function to(r4, e, t, n, i2) {
40155
+ function ho(r4, e, t, n, i2) {
40135
40156
  if (i2.set(e.key, (i2.get(e.key) ?? 0) + 1), !n.isArray)
40136
- Xr(r4, e.resource, t, n);
40157
+ rn(r4, e.resource, t, n);
40137
40158
  else {
40138
40159
  let { resources: o } = e;
40139
40160
  if (!o)
40140
40161
  throw new p(h(`context[${t}] is invalid. context[${t}] for the '${r4}' with key '${String(e.key)}' should contain an array of resources on the key 'resources'.`));
40141
40162
  for (let s of o)
40142
- Xr(r4, s, t, n);
40163
+ rn(r4, s, t, n);
40143
40164
  }
40144
40165
  }
40145
- function ro(r4, e) {
40146
- let t = /* @__PURE__ */ new Map(), n = Zi[r4];
40166
+ function yo(r4, e) {
40167
+ let t = /* @__PURE__ */ new Map(), n = fo[r4];
40147
40168
  for (let i2 = 0; i2 < e.length; i2++) {
40148
40169
  let o = e[i2].key;
40149
40170
  if (!n[o])
40150
40171
  throw new p(h(`Key '${o}' not found for event '${r4}'. Make sure to add only valid keys.`));
40151
- to(r4, e[i2], i2, n[o], t);
40172
+ ho(r4, e[i2], i2, n[o], t);
40152
40173
  }
40153
40174
  for (let [i2, o] of Object.entries(n)) {
40154
40175
  if (!(o.optional || t.has(i2)))
@@ -40157,24 +40178,24 @@ function ro(r4, e) {
40157
40178
  throw new p(h(`${t.get(i2)} context entries with key '${i2}' found for the '${r4}' event when schema only allows for 1.`));
40158
40179
  }
40159
40180
  }
40160
- function Bt(r4, e, t, n) {
40181
+ function jt(r4, e, t, n) {
40161
40182
  if (!(r4 && typeof r4 == "string"))
40162
40183
  throw new p(h("Must provide a topic."));
40163
- if (!Lt[e])
40164
- throw new p(h(`Must provide a valid FHIRcast event name. Supported events: ${Object.keys(Lt).join(", ")}`));
40184
+ if (!Bt[e])
40185
+ throw new p(h(`Must provide a valid FHIRcast event name. Supported events: ${Object.keys(Bt).join(", ")}`));
40165
40186
  if (typeof t != "object")
40166
40187
  throw new p(h("context must be a context object or array of context objects."));
40167
- if (Ut.includes(e) && !n)
40188
+ if (qt.includes(e) && !n)
40168
40189
  throw new p(h(`The '${e}' event must contain a 'context.versionId'.`));
40169
40190
  let i2 = Array.isArray(t) ? t : [t];
40170
- return ro(e, i2), { timestamp: (/* @__PURE__ */ new Date()).toISOString(), id: ye(), event: { "hub.topic": r4, "hub.event": e, context: i2, ...n ? { "context.versionId": n } : {} } };
40191
+ return yo(e, i2), { timestamp: (/* @__PURE__ */ new Date()).toISOString(), id: ee(), event: { "hub.topic": r4, "hub.event": e, context: i2, ...n ? { "context.versionId": n } : {} } };
40171
40192
  }
40172
- var Ye = class extends Je {
40193
+ var et = class extends Ze {
40173
40194
  constructor(t) {
40174
40195
  super();
40175
40196
  if (this.subRequest = t, !t.endpoint)
40176
40197
  throw new p(h("Subscription request should contain an endpoint."));
40177
- if (!Xe(t))
40198
+ if (!tt(t))
40178
40199
  throw new p(h("Subscription request failed validation."));
40179
40200
  let n = new WebSocket(t.endpoint);
40180
40201
  n.addEventListener("open", () => {
@@ -40193,31 +40214,31 @@ var Ye = class extends Je {
40193
40214
  this.websocket.close();
40194
40215
  }
40195
40216
  };
40196
- function no(r4) {
40197
- let e = r4.replace(/-/g, "+").replace(/_/g, "/"), t = Gr(e), n = Array.from(t).reduce((o, s) => {
40217
+ function go(r4) {
40218
+ let e = r4.replace(/-/g, "+").replace(/_/g, "/"), t = Xr(e), n = Array.from(t).reduce((o, s) => {
40198
40219
  let a = ("00" + s.charCodeAt(0).toString(16)).slice(-2);
40199
40220
  return `${o}%${a}`;
40200
40221
  }, ""), i2 = decodeURIComponent(n);
40201
40222
  return JSON.parse(i2);
40202
40223
  }
40203
- function rn(r4) {
40224
+ function an(r4) {
40204
40225
  return r4.split(".").length === 3;
40205
40226
  }
40206
- function qt(r4) {
40227
+ function Qt(r4) {
40207
40228
  let [e, t, n] = r4.split(".");
40208
- return no(t);
40229
+ return go(t);
40209
40230
  }
40210
- function nn(r4) {
40231
+ function cn(r4) {
40211
40232
  try {
40212
- return typeof qt(r4).login_id == "string";
40233
+ return typeof Qt(r4).login_id == "string";
40213
40234
  } catch {
40214
40235
  return false;
40215
40236
  }
40216
40237
  }
40217
- var io;
40218
- var A = class {
40238
+ var xo;
40239
+ var C = class {
40219
40240
  constructor(e) {
40220
- this[io] = "ReadablePromise";
40241
+ this[xo] = "ReadablePromise";
40221
40242
  this.status = "pending";
40222
40243
  this.suspender = e.then((t) => (this.status = "success", this.response = t, t), (t) => {
40223
40244
  throw this.status = "error", this.error = t, t;
@@ -40249,10 +40270,10 @@ var A = class {
40249
40270
  return this.suspender.finally(e);
40250
40271
  }
40251
40272
  };
40252
- io = Symbol.toStringTag;
40253
- var Ze = class {
40273
+ xo = Symbol.toStringTag;
40274
+ var ve = class {
40254
40275
  constructor(e) {
40255
- this.storage = e ?? (typeof localStorage < "u" ? localStorage : new jt());
40276
+ this.storage = e ?? (typeof localStorage < "u" ? localStorage : new Ht());
40256
40277
  }
40257
40278
  clear() {
40258
40279
  this.storage.clear();
@@ -40268,10 +40289,10 @@ var Ze = class {
40268
40289
  return t ? JSON.parse(t) : void 0;
40269
40290
  }
40270
40291
  setObject(e, t) {
40271
- this.setString(e, t ? tr(t) : void 0);
40292
+ this.setString(e, t ? or(t) : void 0);
40272
40293
  }
40273
40294
  };
40274
- var jt = class {
40295
+ var Ht = class {
40275
40296
  constructor() {
40276
40297
  this.data = /* @__PURE__ */ new Map();
40277
40298
  }
@@ -40294,23 +40315,23 @@ var jt = class {
40294
40315
  return Array.from(this.data.keys())[e];
40295
40316
  }
40296
40317
  };
40297
- var oo = k.FHIR_JSON + ", */*; q=0.1";
40298
- var so = "https://api.medplum.com/";
40299
- var ao = 1e3;
40300
- var co = 6e4;
40301
- var on = "Binary/";
40302
- var sn = { resourceType: "Device", id: "system", deviceName: [{ name: "System" }] };
40303
- var uo = ((o) => (o.ClientCredentials = "client_credentials", o.AuthorizationCode = "authorization_code", o.RefreshToken = "refresh_token", o.JwtBearer = "urn:ietf:params:oauth:grant-type:jwt-bearer", o.TokenExchange = "urn:ietf:params:oauth:grant-type:token-exchange", o))(uo || {});
40304
- var lo = ((o) => (o.AccessToken = "urn:ietf:params:oauth:token-type:access_token", o.RefreshToken = "urn:ietf:params:oauth:token-type:refresh_token", o.IdToken = "urn:ietf:params:oauth:token-type:id_token", o.Saml1Token = "urn:ietf:params:oauth:token-type:saml1", o.Saml2Token = "urn:ietf:params:oauth:token-type:saml2", o))(lo || {});
40305
- var po = ((o) => (o.ClientSecretBasic = "client_secret_basic", o.ClientSecretPost = "client_secret_post", o.ClientSecretJwt = "client_secret_jwt", o.PrivateKeyJwt = "private_key_jwt", o.None = "none", o))(po || {});
40306
- var fo = ((e) => (e.JwtBearer = "urn:ietf:params:oauth:client-assertion-type:jwt-bearer", e))(fo || {});
40307
- var an = class extends ge {
40318
+ var To = O.FHIR_JSON + ", */*; q=0.1";
40319
+ var vo = "https://api.medplum.com/";
40320
+ var So = 1e3;
40321
+ var Eo = 6e4;
40322
+ var ln = "Binary/";
40323
+ var dn = { resourceType: "Device", id: "system", deviceName: [{ name: "System" }] };
40324
+ var bo = ((o) => (o.ClientCredentials = "client_credentials", o.AuthorizationCode = "authorization_code", o.RefreshToken = "refresh_token", o.JwtBearer = "urn:ietf:params:oauth:grant-type:jwt-bearer", o.TokenExchange = "urn:ietf:params:oauth:grant-type:token-exchange", o))(bo || {});
40325
+ var Ro = ((o) => (o.AccessToken = "urn:ietf:params:oauth:token-type:access_token", o.RefreshToken = "urn:ietf:params:oauth:token-type:refresh_token", o.IdToken = "urn:ietf:params:oauth:token-type:id_token", o.Saml1Token = "urn:ietf:params:oauth:token-type:saml1", o.Saml2Token = "urn:ietf:params:oauth:token-type:saml2", o))(Ro || {});
40326
+ var Po = ((o) => (o.ClientSecretBasic = "client_secret_basic", o.ClientSecretPost = "client_secret_post", o.ClientSecretJwt = "client_secret_jwt", o.PrivateKeyJwt = "private_key_jwt", o.None = "none", o))(Po || {});
40327
+ var Ao = ((e) => (e.JwtBearer = "urn:ietf:params:oauth:client-assertion-type:jwt-bearer", e))(Ao || {});
40328
+ var pn = class extends Te {
40308
40329
  constructor(t) {
40309
40330
  super();
40310
40331
  this.initComplete = true;
40311
40332
  if (t?.baseUrl && !t.baseUrl.startsWith("http"))
40312
40333
  throw new Error("Base URL must start with http or https");
40313
- if (this.options = t ?? {}, this.fetch = t?.fetch ?? mo(), this.storage = t?.storage ?? new Ze(), this.createPdfImpl = t?.createPdf, this.baseUrl = un(t?.baseUrl ?? so), this.fhirBaseUrl = un(et(this.baseUrl, t?.fhirUrlPath ?? "fhir/R4/")), this.authorizeUrl = et(this.baseUrl, t?.authorizeUrl ?? "oauth2/authorize"), this.tokenUrl = et(this.baseUrl, t?.tokenUrl ?? "oauth2/token"), this.logoutUrl = et(this.baseUrl, t?.logoutUrl ?? "oauth2/logout"), this.clientId = t?.clientId ?? "", this.clientSecret = t?.clientSecret ?? "", this.onUnauthenticated = t?.onUnauthenticated, this.cacheTime = t?.cacheTime ?? co, this.cacheTime > 0 ? this.requestCache = new ze(t?.resourceCacheSize ?? ao) : this.requestCache = void 0, t?.autoBatchTime ? (this.autoBatchTime = t.autoBatchTime, this.autoBatchQueue = []) : (this.autoBatchTime = 0, this.autoBatchQueue = void 0), t?.accessToken)
40334
+ if (this.options = t ?? {}, this.fetch = t?.fetch ?? Co(), this.storage = t?.storage ?? new ve(), this.createPdfImpl = t?.createPdf, this.baseUrl = mn(t?.baseUrl ?? vo), this.fhirBaseUrl = mn(rt(this.baseUrl, t?.fhirUrlPath ?? "fhir/R4/")), this.authorizeUrl = rt(this.baseUrl, t?.authorizeUrl ?? "oauth2/authorize"), this.tokenUrl = rt(this.baseUrl, t?.tokenUrl ?? "oauth2/token"), this.logoutUrl = rt(this.baseUrl, t?.logoutUrl ?? "oauth2/logout"), this.clientId = t?.clientId ?? "", this.clientSecret = t?.clientSecret ?? "", this.onUnauthenticated = t?.onUnauthenticated, this.cacheTime = t?.cacheTime ?? Eo, this.cacheTime > 0 ? this.requestCache = new Xe(t?.resourceCacheSize ?? So) : this.requestCache = void 0, t?.autoBatchTime ? (this.autoBatchTime = t.autoBatchTime, this.autoBatchQueue = []) : (this.autoBatchTime = 0, this.autoBatchQueue = void 0), t?.accessToken)
40314
40335
  this.setAccessToken(t.accessToken), this.initPromise = Promise.resolve();
40315
40336
  else if (this.storage.getInitPromise !== void 0) {
40316
40337
  let n = this.storage.getInitPromise(), i2 = new Promise((o) => {
@@ -40372,7 +40393,7 @@ var an = class extends ge {
40372
40393
  t.startsWith(this.fhirBaseUrl) && this.autoBatchQueue ? o = new Promise((a, u2) => {
40373
40394
  this.autoBatchQueue.push({ method: "GET", url: t.replace(this.fhirBaseUrl, ""), options: n, resolve: a, reject: u2 }), this.autoBatchTimerId || (this.autoBatchTimerId = setTimeout(() => this.executeAutoBatch(), this.autoBatchTime));
40374
40395
  }) : o = this.request("GET", t, n);
40375
- let s = new A(o);
40396
+ let s = new C(o);
40376
40397
  return this.setCacheEntry(t, s), s;
40377
40398
  }
40378
40399
  post(t, n, i2, o = {}) {
@@ -40382,7 +40403,7 @@ var an = class extends ge {
40382
40403
  return t = t.toString(), this.setRequestBody(o, n), i2 && this.setRequestContentType(o, i2), this.invalidateUrl(t), this.request("PUT", t, o);
40383
40404
  }
40384
40405
  patch(t, n, i2 = {}) {
40385
- return t = t.toString(), this.setRequestBody(i2, n), this.setRequestContentType(i2, k.JSON_PATCH), this.invalidateUrl(t), this.request("PATCH", t, i2);
40406
+ return t = t.toString(), this.setRequestBody(i2, n), this.setRequestContentType(i2, O.JSON_PATCH), this.invalidateUrl(t), this.request("PATCH", t, i2);
40386
40407
  }
40387
40408
  delete(t, n) {
40388
40409
  return t = t.toString(), this.invalidateUrl(t), this.request("DELETE", t, n);
@@ -40451,7 +40472,7 @@ var an = class extends ge {
40451
40472
  let o = this.fhirSearchUrl(t, n), s = o.toString() + "-search", a = this.getCacheEntry(s, i2);
40452
40473
  if (a)
40453
40474
  return a.value;
40454
- let u2 = new A((async () => {
40475
+ let u2 = new C((async () => {
40455
40476
  let l2 = await this.get(o, i2);
40456
40477
  if (l2.entry)
40457
40478
  for (let f of l2.entry)
@@ -40466,14 +40487,14 @@ var an = class extends ge {
40466
40487
  let s = o.toString() + "-searchOne", a = this.getCacheEntry(s, i2);
40467
40488
  if (a)
40468
40489
  return a.value;
40469
- let u2 = new A(this.search(t, o.searchParams, i2).then((l2) => l2.entry?.[0]?.resource));
40490
+ let u2 = new C(this.search(t, o.searchParams, i2).then((l2) => l2.entry?.[0]?.resource));
40470
40491
  return this.setCacheEntry(s, u2), u2;
40471
40492
  }
40472
40493
  searchResources(t, n, i2) {
40473
40494
  let s = this.fhirSearchUrl(t, n).toString() + "-searchResources", a = this.getCacheEntry(s, i2);
40474
40495
  if (a)
40475
40496
  return a.value;
40476
- let u2 = new A(this.search(t, n, i2).then(dn));
40497
+ let u2 = new C(this.search(t, n, i2).then(yn));
40477
40498
  return this.setCacheEntry(s, u2), u2;
40478
40499
  }
40479
40500
  async *searchResourcePages(t, n, i2) {
@@ -40482,7 +40503,7 @@ var an = class extends ge {
40482
40503
  let s = new URL(o).searchParams, a = await this.search(t, s, i2), u2 = a.link?.find((l2) => l2.relation === "next");
40483
40504
  if (!a.entry?.length && !u2)
40484
40505
  break;
40485
- yield dn(a), o = u2?.url ? new URL(u2.url) : void 0;
40506
+ yield yn(a), o = u2?.url ? new URL(u2.url) : void 0;
40486
40507
  }
40487
40508
  }
40488
40509
  searchValueSet(t, n, i2) {
@@ -40498,7 +40519,7 @@ var an = class extends ge {
40498
40519
  if (!n)
40499
40520
  return;
40500
40521
  if (n === "system")
40501
- return sn;
40522
+ return dn;
40502
40523
  let [i2, o] = n.split("/");
40503
40524
  if (!(!i2 || !o))
40504
40525
  return this.getCached(i2, o);
@@ -40509,19 +40530,19 @@ var an = class extends ge {
40509
40530
  readReference(t, n) {
40510
40531
  let i2 = t.reference;
40511
40532
  if (!i2)
40512
- return new A(Promise.reject(new Error("Missing reference")));
40533
+ return new C(Promise.reject(new Error("Missing reference")));
40513
40534
  if (i2 === "system")
40514
- return new A(Promise.resolve(sn));
40535
+ return new C(Promise.resolve(dn));
40515
40536
  let [o, s] = i2.split("/");
40516
- return !o || !s ? new A(Promise.reject(new Error("Invalid reference"))) : this.readResource(o, s, n);
40537
+ return !o || !s ? new C(Promise.reject(new Error("Invalid reference"))) : this.readResource(o, s, n);
40517
40538
  }
40518
40539
  requestSchema(t) {
40519
- if (Ir(t))
40540
+ if (Dr(t))
40520
40541
  return Promise.resolve();
40521
40542
  let n = t + "-requestSchema", i2 = this.getCacheEntry(n, void 0);
40522
40543
  if (i2)
40523
40544
  return i2.value;
40524
- let o = new A((async () => {
40545
+ let o = new C((async () => {
40525
40546
  let s = `{
40526
40547
  StructureDefinitionList(name: "${t}") {
40527
40548
  resourceType,
@@ -40562,21 +40583,21 @@ var an = class extends ge {
40562
40583
  target
40563
40584
  }
40564
40585
  }`.replace(/\s+/g, " "), a = await this.graphql(s);
40565
- At(a.data.StructureDefinitionList);
40586
+ It(a.data.StructureDefinitionList);
40566
40587
  for (let u2 of a.data.SearchParameterList)
40567
- wt(u2);
40588
+ Ot(u2);
40568
40589
  })());
40569
40590
  return this.setCacheEntry(n, o), o;
40570
40591
  }
40571
40592
  requestProfileSchema(t) {
40572
- if (Dr(t))
40593
+ if (_r(t))
40573
40594
  return Promise.resolve();
40574
40595
  let n = t + "-requestSchema", i2 = this.getCacheEntry(n, void 0);
40575
40596
  if (i2)
40576
40597
  return i2.value;
40577
- let o = new A((async () => {
40598
+ let o = new C((async () => {
40578
40599
  let s = await this.searchOne("StructureDefinition", { url: t, _sort: "-_lastUpdated" });
40579
- s ? At([s], t) : console.warn(`No StructureDefinition found for ${t}!`);
40600
+ s ? It([s], t) : console.warn(`No StructureDefinition found for ${t}!`);
40580
40601
  })());
40581
40602
  return this.setCacheEntry(n, o), o;
40582
40603
  }
@@ -40609,11 +40630,11 @@ var an = class extends ge {
40609
40630
  return new Promise((a, u2) => {
40610
40631
  let l2 = new XMLHttpRequest(), f = () => l2.abort();
40611
40632
  s?.signal?.addEventListener("abort", f);
40612
- let P = (M) => {
40613
- s?.signal?.removeEventListener("abort", f), M instanceof Error ? u2(M) : a(M);
40633
+ let P = (B) => {
40634
+ s?.signal?.removeEventListener("abort", f), B instanceof Error ? u2(B) : a(B);
40614
40635
  };
40615
- l2.responseType = "json", l2.onabort = () => P(new Error("Request aborted")), l2.onerror = () => P(new Error("Request error")), o && (l2.upload.onprogress = (M) => o(M), l2.upload.onload = (M) => o(M)), l2.onload = () => {
40616
- l2.status >= 200 && l2.status < 300 ? P(l2.response) : P(new p(Ve(l2.response || l2.statusText)));
40636
+ l2.responseType = "json", l2.onabort = () => P(new Error("Request aborted")), l2.onerror = () => P(new Error("Request error")), o && (l2.upload.onprogress = (B) => o(B), l2.upload.onload = (B) => o(B)), l2.onload = () => {
40637
+ l2.status >= 200 && l2.status < 300 ? P(l2.response) : P(new p(_e(l2.response || l2.statusText)));
40617
40638
  }, l2.open("POST", t), l2.withCredentials = true, l2.setRequestHeader("Authorization", "Bearer " + this.accessToken), l2.setRequestHeader("Cache-Control", "no-cache, no-store, max-age=0"), l2.setRequestHeader("Content-Type", i2), l2.setRequestHeader("X-Medplum", "extended"), l2.send(n);
40618
40639
  });
40619
40640
  }
@@ -40625,7 +40646,7 @@ var an = class extends ge {
40625
40646
  }
40626
40647
  createComment(t, n, i2) {
40627
40648
  let o = this.getProfile(), s, a;
40628
- return t.resourceType === "Encounter" && (s = G(t), a = t.subject), t.resourceType === "ServiceRequest" && (s = t.encounter, a = t.subject), t.resourceType === "Patient" && (a = G(t)), this.createResource({ resourceType: "Communication", basedOn: [G(t)], encounter: s, subject: a, sender: o ? G(o) : void 0, sent: (/* @__PURE__ */ new Date()).toISOString(), payload: [{ contentString: n }] }, i2);
40649
+ return t.resourceType === "Encounter" && (s = z(t), a = t.subject), t.resourceType === "ServiceRequest" && (s = t.encounter, a = t.subject), t.resourceType === "Patient" && (a = z(t)), this.createResource({ resourceType: "Communication", basedOn: [z(t)], encounter: s, subject: a, sender: o ? z(o) : void 0, sent: (/* @__PURE__ */ new Date()).toISOString(), payload: [{ contentString: n }] }, i2);
40629
40650
  }
40630
40651
  async updateResource(t, n) {
40631
40652
  if (!t.resourceType)
@@ -40659,28 +40680,28 @@ var an = class extends ge {
40659
40680
  return this.post(this.fhirBaseUrl.slice(0, -1), t, void 0, n);
40660
40681
  }
40661
40682
  sendEmail(t, n) {
40662
- return this.post("email/v1/send", t, k.JSON, n);
40683
+ return this.post("email/v1/send", t, O.JSON, n);
40663
40684
  }
40664
40685
  graphql(t, n, i2, o) {
40665
- return this.post(this.fhirUrl("$graphql"), { query: t, operationName: n, variables: i2 }, k.JSON, o);
40686
+ return this.post(this.fhirUrl("$graphql"), { query: t, operationName: n, variables: i2 }, O.JSON, o);
40666
40687
  }
40667
40688
  readResourceGraph(t, n, i2, o) {
40668
40689
  return this.get(`${this.fhirUrl(t, n)}/$graph?graph=${i2}`, o);
40669
40690
  }
40670
40691
  pushToAgent(t, n, i2, o, s, a) {
40671
- return this.post(this.fhirUrl("Agent", Yt(t), "$push"), { destination: ae(n), body: i2, contentType: o, waitForResponse: s }, k.FHIR_JSON, a);
40692
+ return this.post(this.fhirUrl("Agent", tr(t), "$push"), { destination: de(n), body: i2, contentType: o, waitForResponse: s }, O.FHIR_JSON, a);
40672
40693
  }
40673
40694
  getActiveLogin() {
40674
40695
  return this.storage.getObject("activeLogin");
40675
40696
  }
40676
40697
  async setActiveLogin(t) {
40677
- (!this.sessionDetails?.profile || ae(this.sessionDetails.profile) !== t.profile?.reference) && this.clearActiveLogin(), this.setAccessToken(t.accessToken, t.refreshToken), this.storage.setObject("activeLogin", t), this.addLogin(t), this.refreshPromise = void 0, await this.refreshProfile();
40698
+ (!this.sessionDetails?.profile || de(this.sessionDetails.profile) !== t.profile?.reference) && this.clearActiveLogin(), this.setAccessToken(t.accessToken, t.refreshToken), this.storage.setObject("activeLogin", t), this.addLogin(t), this.refreshPromise = void 0, await this.refreshProfile();
40678
40699
  }
40679
40700
  getAccessToken() {
40680
40701
  return this.accessToken;
40681
40702
  }
40682
40703
  setAccessToken(t, n) {
40683
- this.accessToken = t, this.refreshToken = n, this.sessionDetails = void 0, this.medplumServer = nn(t);
40704
+ this.accessToken = t, this.refreshToken = n, this.sessionDetails = void 0, this.medplumServer = cn(t);
40684
40705
  }
40685
40706
  getLogins() {
40686
40707
  return this.storage.getObject("logins") ?? [];
@@ -40728,11 +40749,11 @@ var an = class extends ge {
40728
40749
  async download(t, n = {}) {
40729
40750
  this.refreshPromise && await this.refreshPromise;
40730
40751
  let i2 = t.toString();
40731
- return i2.startsWith(on) && (t = this.fhirUrl(i2)), this.addFetchOptionsDefaults(n), (await this.fetchWithRetry(t.toString(), n)).blob();
40752
+ return i2.startsWith(ln) && (t = this.fhirUrl(i2)), this.addFetchOptionsDefaults(n), (await this.fetchWithRetry(t.toString(), n)).blob();
40732
40753
  }
40733
40754
  async uploadMedia(t, n, i2, o, s) {
40734
40755
  let a = await this.createBinary(t, i2, n);
40735
- return this.createResource({ resourceType: "Media", status: "completed", content: { contentType: n, url: on + a.id, title: i2 }, ...o }, s);
40756
+ return this.createResource({ resourceType: "Media", status: "completed", content: { contentType: n, url: ln + a.id, title: i2 }, ...o }, s);
40736
40757
  }
40737
40758
  async bulkExport(t = "", n, i2, o) {
40738
40759
  let s = t && `${t}/`, a = this.fhirUrl(`${s}$export`);
@@ -40744,7 +40765,7 @@ var an = class extends ge {
40744
40765
  i2.Prefer = "respond-async";
40745
40766
  let o = await this.fetchWithRetry(t, n);
40746
40767
  if (o.status === 202) {
40747
- let s = await ln(o);
40768
+ let s = await hn(o);
40748
40769
  if (s)
40749
40770
  return this.pollStatus(s);
40750
40771
  }
@@ -40761,7 +40782,7 @@ var an = class extends ge {
40761
40782
  this.requestCache && this.requestCache.set(t, { requestTime: Date.now(), value: n });
40762
40783
  }
40763
40784
  cacheResource(t) {
40764
- t?.id && !t.meta?.tag?.some((n) => n.code === "SUBSETTED") && this.setCacheEntry(this.fhirUrl(t.resourceType, t.id).toString(), new A(Promise.resolve(t)));
40785
+ t?.id && !t.meta?.tag?.some((n) => n.code === "SUBSETTED") && this.setCacheEntry(this.fhirUrl(t.resourceType, t.id).toString(), new C(Promise.resolve(t)));
40765
40786
  }
40766
40787
  deleteCacheEntry(t) {
40767
40788
  this.requestCache && this.requestCache.delete(t);
@@ -40778,7 +40799,7 @@ var an = class extends ge {
40778
40799
  return;
40779
40800
  let a = t.headers.get("content-type")?.includes("json");
40780
40801
  if (t.status === 404 && !a)
40781
- throw new p(vr);
40802
+ throw new p(Rr);
40782
40803
  let u2 = t.headers.get("content-location"), l2 = o.redirect ?? this.options.redirect;
40783
40804
  if (t.status === 201 && u2 && l2 === "follow")
40784
40805
  return this.request("GET", u2, { ...o, body: void 0 });
@@ -40792,7 +40813,7 @@ var an = class extends ge {
40792
40813
  else
40793
40814
  f = await t.text();
40794
40815
  if (t.status >= 400)
40795
- throw new p(Ve(f));
40816
+ throw new p(_e(f));
40796
40817
  return f;
40797
40818
  }
40798
40819
  async fetchWithRetry(t, n) {
@@ -40805,7 +40826,7 @@ var an = class extends ge {
40805
40826
  } catch (u2) {
40806
40827
  this.retryCatch(a, i2, u2);
40807
40828
  }
40808
- await at(o);
40829
+ await lt(o);
40809
40830
  }
40810
40831
  return s;
40811
40832
  }
@@ -40826,10 +40847,10 @@ var an = class extends ge {
40826
40847
  this.addFetchOptionsDefaults(s);
40827
40848
  let a = await this.fetchWithRetry(t, s);
40828
40849
  if (a.status !== 202 && (n = false, i2 = a, a.status === 201)) {
40829
- let u2 = await ln(a);
40850
+ let u2 = await hn(a);
40830
40851
  u2 && (i2 = await this.fetchWithRetry(u2, s));
40831
40852
  }
40832
- await at(o);
40853
+ await lt(o);
40833
40854
  }
40834
40855
  return this.parseResponse(i2, "POST", t);
40835
40856
  }
@@ -40840,19 +40861,19 @@ var an = class extends ge {
40840
40861
  try {
40841
40862
  o.resolve(await this.request(o.method, this.fhirBaseUrl + o.url, o.options));
40842
40863
  } catch (s) {
40843
- o.reject(new p(Ve(s)));
40864
+ o.reject(new p(_e(s)));
40844
40865
  }
40845
40866
  return;
40846
40867
  }
40847
40868
  let n = { resourceType: "Bundle", type: "batch", entry: t.map((o) => ({ request: { method: o.method, url: o.url }, resource: o.options.body ? JSON.parse(o.options.body) : void 0 })) }, i2 = await this.post(this.fhirBaseUrl.slice(0, -1), n);
40848
40869
  for (let o = 0; o < t.length; o++) {
40849
40870
  let s = t[o], a = i2.entry?.[o];
40850
- a?.response?.outcome && !xt(a.response.outcome) ? s.reject(new p(a.response.outcome)) : s.resolve(a?.resource);
40871
+ a?.response?.outcome && !St(a.response.outcome) ? s.reject(new p(a.response.outcome)) : s.resolve(a?.resource);
40851
40872
  }
40852
40873
  }
40853
40874
  addFetchOptionsDefaults(t) {
40854
40875
  let n = t.headers;
40855
- n || (n = {}, t.headers = n), n.Accept || (n.Accept = oo), n["X-Medplum"] = "extended", t.body && !n["Content-Type"] && (n["Content-Type"] = k.FHIR_JSON), this.accessToken ? n.Authorization = "Bearer " + this.accessToken : this.basicAuth && (n.Authorization = "Basic " + this.basicAuth), t.cache || (t.cache = "no-cache"), t.credentials || (t.credentials = "include");
40876
+ n || (n = {}, t.headers = n), n.Accept || (n.Accept = To), n["X-Medplum"] = "extended", t.body && !n["Content-Type"] && (n["Content-Type"] = O.FHIR_JSON), this.accessToken ? n.Authorization = "Bearer " + this.accessToken : this.basicAuth && (n.Authorization = "Basic " + this.basicAuth), t.cache || (t.cache = "no-cache"), t.credentials || (t.credentials = "include");
40856
40877
  }
40857
40878
  setRequestContentType(t, n) {
40858
40879
  t.headers || (t.headers = {});
@@ -40866,20 +40887,20 @@ var an = class extends ge {
40866
40887
  return this.refresh() ? this.request(t, n, i2) : (this.clearActiveLogin(), this.onUnauthenticated && this.onUnauthenticated(), Promise.reject(new Error("Unauthenticated")));
40867
40888
  }
40868
40889
  async startPkce() {
40869
- let t = _t();
40890
+ let t = Ut();
40870
40891
  sessionStorage.setItem("pkceState", t);
40871
- let n = _t();
40892
+ let n = Ut();
40872
40893
  sessionStorage.setItem("codeVerifier", n);
40873
- let i2 = await Jr(n), o = or(i2).replaceAll("+", "-").replaceAll("/", "_").replaceAll("=", "");
40894
+ let i2 = await en(n), o = ur(i2).replaceAll("+", "-").replaceAll("/", "_").replaceAll("=", "");
40874
40895
  return sessionStorage.setItem("codeChallenge", o), { codeChallengeMethod: "S256", codeChallenge: o };
40875
40896
  }
40876
40897
  async requestAuthorization(t) {
40877
40898
  let n = await this.ensureCodeChallenge(t ?? {}), i2 = new URL(this.authorizeUrl);
40878
- i2.searchParams.set("response_type", "code"), i2.searchParams.set("state", sessionStorage.getItem("pkceState")), i2.searchParams.set("client_id", n.clientId ?? this.clientId), i2.searchParams.set("redirect_uri", n.redirectUri ?? cn()), i2.searchParams.set("code_challenge_method", n.codeChallengeMethod), i2.searchParams.set("code_challenge", n.codeChallenge), i2.searchParams.set("scope", n.scope ?? "openid profile"), window.location.assign(i2.toString());
40899
+ i2.searchParams.set("response_type", "code"), i2.searchParams.set("state", sessionStorage.getItem("pkceState")), i2.searchParams.set("client_id", n.clientId ?? this.clientId), i2.searchParams.set("redirect_uri", n.redirectUri ?? fn()), i2.searchParams.set("code_challenge_method", n.codeChallengeMethod), i2.searchParams.set("code_challenge", n.codeChallenge), i2.searchParams.set("scope", n.scope ?? "openid profile"), window.location.assign(i2.toString());
40879
40900
  }
40880
40901
  processCode(t, n) {
40881
40902
  let i2 = new URLSearchParams();
40882
- if (i2.set("grant_type", "authorization_code"), i2.set("code", t), i2.set("client_id", n?.clientId ?? this.clientId), i2.set("redirect_uri", n?.redirectUri ?? cn()), typeof sessionStorage < "u") {
40903
+ if (i2.set("grant_type", "authorization_code"), i2.set("code", t), i2.set("client_id", n?.clientId ?? this.clientId), i2.set("redirect_uri", n?.redirectUri ?? fn()), typeof sessionStorage < "u") {
40883
40904
  let o = sessionStorage.getItem("codeVerifier");
40884
40905
  o && i2.set("code_verifier", o);
40885
40906
  }
@@ -40910,30 +40931,30 @@ var an = class extends ge {
40910
40931
  return n.append("grant_type", "client_credentials"), n.append("client_assertion_type", "urn:ietf:params:oauth:client-assertion-type:jwt-bearer"), n.append("client_assertion", t), this.fetchTokens(n);
40911
40932
  }
40912
40933
  setBasicAuth(t, n) {
40913
- this.clientId = t, this.clientSecret = n, this.basicAuth = zr(t + ":" + n);
40934
+ this.clientId = t, this.clientSecret = n, this.basicAuth = Zr(t + ":" + n);
40914
40935
  }
40915
40936
  async fhircastSubscribe(t, n) {
40916
40937
  if (!(typeof t == "string" && t !== ""))
40917
40938
  throw new p(h("Invalid topic provided. Topic must be a valid string."));
40918
40939
  if (!(typeof n == "object" && Array.isArray(n) && n.length > 0))
40919
40940
  throw new p(h("Invalid events provided. Events must be an array of event names containing at least one event."));
40920
- let i2 = { channelType: "websocket", mode: "subscribe", topic: t, events: n }, s = (await this.post("/fhircast/STU3", Mt(i2), k.FORM_URL_ENCODED))["hub.channel.endpoint"];
40941
+ let i2 = { channelType: "websocket", mode: "subscribe", topic: t, events: n }, s = (await this.post("/fhircast/STU3", $t(i2), O.FORM_URL_ENCODED))["hub.channel.endpoint"];
40921
40942
  if (!s)
40922
40943
  throw new Error("Invalid response!");
40923
40944
  return i2.endpoint = s, i2;
40924
40945
  }
40925
40946
  async fhircastUnsubscribe(t) {
40926
- if (!Xe(t))
40947
+ if (!tt(t))
40927
40948
  throw new p(h("Invalid topic or subscriptionRequest. SubscriptionRequest must be an object."));
40928
40949
  if (!(t.endpoint && typeof t.endpoint == "string" && t.endpoint.startsWith("ws")))
40929
40950
  throw new p(h("Provided subscription request must have an endpoint in order to unsubscribe."));
40930
- t.mode = "unsubscribe", await this.post("/fhircast/STU3", Mt(t), k.FORM_URL_ENCODED);
40951
+ t.mode = "unsubscribe", await this.post("/fhircast/STU3", $t(t), O.FORM_URL_ENCODED);
40931
40952
  }
40932
40953
  fhircastConnect(t) {
40933
- return new Ye(t);
40954
+ return new et(t);
40934
40955
  }
40935
40956
  async fhircastPublish(t, n, i2, o) {
40936
- return Zr(n) ? this.post(`/fhircast/STU3/${t}`, Bt(t, n, i2, o), k.JSON) : (en(n), this.post(`/fhircast/STU3/${t}`, Bt(t, n, i2), k.JSON));
40957
+ return nn(n) ? this.post(`/fhircast/STU3/${t}`, jt(t, n, i2, o), O.JSON) : (on(n), this.post(`/fhircast/STU3/${t}`, jt(t, n, i2), O.JSON));
40937
40958
  }
40938
40959
  async fhircastGetContext(t) {
40939
40960
  return this.get(`/fhircast/STU3/${t}`);
@@ -40942,16 +40963,16 @@ var an = class extends ge {
40942
40963
  return this.post("admin/projects/" + t + "/invite", n);
40943
40964
  }
40944
40965
  async fetchTokens(t) {
40945
- let n = { method: "POST", headers: { "Content-Type": k.FORM_URL_ENCODED }, body: t.toString(), credentials: "include" }, i2 = n.headers;
40966
+ let n = { method: "POST", headers: { "Content-Type": O.FORM_URL_ENCODED }, body: t.toString(), credentials: "include" }, i2 = n.headers;
40946
40967
  this.basicAuth && (i2.Authorization = `Basic ${this.basicAuth}`);
40947
40968
  let o = await this.fetchWithRetry(this.tokenUrl, n);
40948
40969
  if (!o.ok) {
40949
40970
  this.clearActiveLogin();
40950
40971
  try {
40951
40972
  let a = await o.json();
40952
- throw new p(w(a.error_description));
40973
+ throw new p(I(a.error_description));
40953
40974
  } catch (a) {
40954
- throw new p(w("Failed to fetch tokens"), a);
40975
+ throw new p(I("Failed to fetch tokens"), a);
40955
40976
  }
40956
40977
  }
40957
40978
  let s = await o.json();
@@ -40959,8 +40980,8 @@ var an = class extends ge {
40959
40980
  }
40960
40981
  async verifyTokens(t) {
40961
40982
  let n = t.access_token;
40962
- if (rn(n)) {
40963
- let i2 = qt(n);
40983
+ if (an(n)) {
40984
+ let i2 = Qt(n);
40964
40985
  if (Date.now() >= i2.exp * 1e3)
40965
40986
  throw this.clearActiveLogin(), new Error("Token expired");
40966
40987
  if (i2.cid) {
@@ -40984,21 +41005,21 @@ var an = class extends ge {
40984
41005
  throw i2;
40985
41006
  }
40986
41007
  };
40987
- function mo() {
41008
+ function Co() {
40988
41009
  if (!globalThis.fetch)
40989
41010
  throw new Error("Fetch not available in this environment");
40990
41011
  return globalThis.fetch.bind(globalThis);
40991
41012
  }
40992
- function cn() {
41013
+ function fn() {
40993
41014
  return typeof window > "u" ? "" : window.location.protocol + "//" + window.location.host + "/";
40994
41015
  }
40995
- function un(r4) {
41016
+ function mn(r4) {
40996
41017
  return r4.endsWith("/") ? r4 : r4 + "/";
40997
41018
  }
40998
- function et(r4, e) {
41019
+ function rt(r4, e) {
40999
41020
  return new URL(e, r4).toString();
41000
41021
  }
41001
- async function ln(r4) {
41022
+ async function hn(r4) {
41002
41023
  let e = r4.headers.get("content-location");
41003
41024
  if (e)
41004
41025
  return e;
@@ -41006,17 +41027,17 @@ async function ln(r4) {
41006
41027
  if (t)
41007
41028
  return t;
41008
41029
  let n = await r4.json();
41009
- if (De(n) && n.issue?.[0]?.diagnostics)
41030
+ if (Fe(n) && n.issue?.[0]?.diagnostics)
41010
41031
  return n.issue[0].diagnostics;
41011
41032
  }
41012
- function dn(r4) {
41033
+ function yn(r4) {
41013
41034
  let e = r4.entry?.map((t) => t.resource) ?? [];
41014
41035
  return Object.assign(e, { bundle: r4 });
41015
41036
  }
41016
- var ho = [...pe, "->", "<<", ">>"];
41017
- var yo = fe().registerInfix("->", { precedence: m.Arrow }).registerInfix(";", { precedence: m.Semicolon });
41018
- var go = [...pe, "eq", "ne", "co"];
41019
- var vo = fe();
41037
+ var wo = [...ye, "->", "<<", ">>"];
41038
+ var ko = ge().registerInfix("->", { precedence: m.Arrow }).registerInfix(";", { precedence: m.Semicolon });
41039
+ var Uo = [...ye, "eq", "ne", "co"];
41040
+ var $o = ge();
41020
41041
  var W = class {
41021
41042
  constructor(e = "\r", t = "|", n = "^", i2 = "~", o = "\\", s = "&") {
41022
41043
  this.segmentSeparator = e;
@@ -41033,7 +41054,7 @@ var W = class {
41033
41054
  return this.componentSeparator + this.repetitionSeparator + this.escapeCharacter + this.subcomponentSeparator;
41034
41055
  }
41035
41056
  };
41036
- var hn = class r {
41057
+ var An = class r {
41037
41058
  constructor(e, t = new W()) {
41038
41059
  this.context = t, this.segments = e;
41039
41060
  }
@@ -41057,7 +41078,7 @@ var hn = class r {
41057
41078
  }
41058
41079
  buildAck() {
41059
41080
  let e = /* @__PURE__ */ new Date(), t = this.getSegment("MSH"), n = t?.getField(3)?.toString() ?? "", i2 = t?.getField(4)?.toString() ?? "", o = t?.getField(5)?.toString() ?? "", s = t?.getField(6)?.toString() ?? "", a = t?.getField(10)?.toString() ?? "", u2 = t?.getField(12)?.toString() ?? "2.5.1";
41060
- return new r([new xe(["MSH", this.context.getMsh2(), o, s, n, i2, So(e), "", this.buildAckMessageType(t), e.getTime().toString(), "P", u2], this.context), new xe(["MSA", "AA", a, "OK"], this.context)]);
41081
+ return new r([new Se(["MSH", this.context.getMsh2(), o, s, n, i2, Qo(e), "", this.buildAckMessageType(t), e.getTime().toString(), "P", u2], this.context), new Se(["MSA", "AA", a, "OK"], this.context)]);
41061
41082
  }
41062
41083
  buildAckMessageType(e) {
41063
41084
  let t = e?.getField(9), n = t?.getComponent(2), i2 = t?.getComponent(3), o = "ACK";
@@ -41069,12 +41090,12 @@ var hn = class r {
41069
41090
  throw n.type = "entity.parse.failed", n;
41070
41091
  }
41071
41092
  let t = new W("\r", e.charAt(3), e.charAt(4), e.charAt(5), e.charAt(6), e.charAt(7));
41072
- return new r(e.split(/[\r\n]+/).map((n) => xe.parse(n, t)), t);
41093
+ return new r(e.split(/[\r\n]+/).map((n) => Se.parse(n, t)), t);
41073
41094
  }
41074
41095
  };
41075
- var xe = class r2 {
41096
+ var Se = class r2 {
41076
41097
  constructor(e, t = new W()) {
41077
- this.context = t, rr(e) ? this.fields = e.map((n) => se.parse(n, t)) : this.fields = e, this.name = this.fields[0].components[0][0];
41098
+ this.context = t, sr(e) ? this.fields = e.map((n) => le.parse(n, t)) : this.fields = e, this.name = this.fields[0].components[0][0];
41078
41099
  }
41079
41100
  get(e) {
41080
41101
  return this.fields[e];
@@ -41082,9 +41103,9 @@ var xe = class r2 {
41082
41103
  getField(e) {
41083
41104
  if (this.name === "MSH") {
41084
41105
  if (e === 1)
41085
- return new se([[this.context.getMsh1()]], this.context);
41106
+ return new le([[this.context.getMsh1()]], this.context);
41086
41107
  if (e === 2)
41087
- return new se([[this.context.getMsh2()]], this.context);
41108
+ return new le([[this.context.getMsh2()]], this.context);
41088
41109
  if (e > 2)
41089
41110
  return this.fields[e - 1];
41090
41111
  }
@@ -41097,10 +41118,10 @@ var xe = class r2 {
41097
41118
  return this.fields.map((e) => e.toString()).join(this.context.fieldSeparator);
41098
41119
  }
41099
41120
  static parse(e, t = new W()) {
41100
- return new r2(e.split(t.fieldSeparator).map((n) => se.parse(n, t)), t);
41121
+ return new r2(e.split(t.fieldSeparator).map((n) => le.parse(n, t)), t);
41101
41122
  }
41102
41123
  };
41103
- var se = class r3 {
41124
+ var le = class r3 {
41104
41125
  constructor(e, t = new W()) {
41105
41126
  this.context = t, this.components = e;
41106
41127
  }
@@ -41118,7 +41139,7 @@ var se = class r3 {
41118
41139
  return new r3(e.split(t.repetitionSeparator).map((n) => n.split(t.componentSeparator)), t);
41119
41140
  }
41120
41141
  };
41121
- function So(r4) {
41142
+ function Qo(r4) {
41122
41143
  let e = r4 instanceof Date ? r4 : new Date(r4), n = e.toISOString().replace(/[-:T]/g, "").replace(/(\.\d+)?Z$/, ""), i2 = e.getUTCMilliseconds();
41123
41144
  return i2 > 0 && (n += "." + i2.toString()), n;
41124
41145
  }
@@ -41162,7 +41183,7 @@ var c2 = class extends i {
41162
41183
  e.on("data", (s) => {
41163
41184
  try {
41164
41185
  if (o += s.toString(), o.endsWith(p2 + v2)) {
41165
- let r4 = hn.parse(o.substring(1, o.length - 2));
41186
+ let r4 = An.parse(o.substring(1, o.length - 2));
41166
41187
  this.dispatchEvent(new d2(this, r4)), o = "";
41167
41188
  }
41168
41189
  } catch (r4) {
@@ -41302,11 +41323,11 @@ var DcmjsDimseScp = class extends dimse.Scp {
41302
41323
  accessToken: App.instance.medplum.getAccessToken(),
41303
41324
  channel: AgentDicomChannel.instance.definition.name,
41304
41325
  remote: "foo",
41305
- contentType: k.JSON,
41326
+ contentType: O.JSON,
41306
41327
  body: JSON.stringify(request.getDataset())
41307
41328
  });
41308
41329
  } catch (err) {
41309
- App.instance.log.error(`DICOM error: ${Yn(err)}`);
41330
+ App.instance.log.error(`DICOM error: ${li(err)}`);
41310
41331
  }
41311
41332
  const response = dimse.responses.CStoreResponse.fromRequest(request);
41312
41333
  response.setStatus(dimse.constants.Status.Success);
@@ -41338,7 +41359,7 @@ var AgentHl7Channel = class {
41338
41359
  sendToRemote(msg) {
41339
41360
  const connection = this.connections.get(msg.remote);
41340
41361
  if (connection) {
41341
- connection.hl7Connection.send(hn.parse(msg.body));
41362
+ connection.hl7Connection.send(An.parse(msg.body));
41342
41363
  }
41343
41364
  }
41344
41365
  handleNewConnection(connection) {
@@ -41363,11 +41384,11 @@ var AgentHl7ChannelConnection = class {
41363
41384
  accessToken: this.channel.app.medplum.getAccessToken(),
41364
41385
  channel: this.channel.definition.name,
41365
41386
  remote: this.remote,
41366
- contentType: k.HL7_V2,
41387
+ contentType: O.HL7_V2,
41367
41388
  body: event.message.toString()
41368
41389
  });
41369
41390
  } catch (err) {
41370
- this.channel.app.log.error(`HL7 error: ${Yn(err)}`);
41391
+ this.channel.app.log.error(`HL7 error: ${li(err)}`);
41371
41392
  }
41372
41393
  }
41373
41394
  close() {
@@ -41416,6 +41437,9 @@ var App = class _App {
41416
41437
  this.live = true;
41417
41438
  this.trySendToWebSocket();
41418
41439
  break;
41440
+ case "agent:heartbeat:request":
41441
+ this.sendToWebSocket({ type: "agent:heartbeat:response" });
41442
+ break;
41419
41443
  case "transmit":
41420
41444
  case "agent:transmit:response":
41421
41445
  this.addToHl7Queue(command);
@@ -41428,14 +41452,14 @@ var App = class _App {
41428
41452
  this.log.error(`Unknown message type: ${command.type}`);
41429
41453
  }
41430
41454
  } catch (err) {
41431
- this.log.error(`WebSocket error: ${Yn(err)}`);
41455
+ this.log.error(`WebSocket error: ${li(err)}`);
41432
41456
  }
41433
41457
  });
41434
41458
  }
41435
41459
  async start() {
41436
41460
  this.log.info("Medplum service starting...");
41437
41461
  const agent = await this.medplum.readResource("Agent", this.agentId);
41438
- for (const definition of agent.channel) {
41462
+ for (const definition of agent.channel ?? []) {
41439
41463
  const endpoint = await this.medplum.readReference(definition.endpoint);
41440
41464
  let channel = void 0;
41441
41465
  if (!endpoint.address) {
@@ -41501,18 +41525,18 @@ var App = class _App {
41501
41525
  host: address.hostname,
41502
41526
  port: parseInt(address.port, 10)
41503
41527
  });
41504
- client.sendAndWait(hn.parse(message.body)).then((response) => {
41528
+ client.sendAndWait(An.parse(message.body)).then((response) => {
41505
41529
  this.log.info(`Response: ${response.toString().replaceAll("\r", "\n")}`);
41506
41530
  this.addToWebSocketQueue({
41507
41531
  type: "agent:transmit:response",
41508
41532
  channel: message.channel,
41509
41533
  remote: message.remote,
41510
41534
  callback: message.callback,
41511
- contentType: k.HL7_V2,
41535
+ contentType: O.HL7_V2,
41512
41536
  body: response.toString()
41513
41537
  });
41514
41538
  }).catch((err) => {
41515
- this.log.error(`HL7 error: ${Yn(err)}`);
41539
+ this.log.error(`HL7 error: ${li(err)}`);
41516
41540
  }).finally(() => {
41517
41541
  client.close();
41518
41542
  });
@@ -41545,7 +41569,7 @@ async function main(argv) {
41545
41569
  process.exit(1);
41546
41570
  }
41547
41571
  const { baseUrl, clientId, clientSecret, agentId } = args;
41548
- const medplum = new an({ baseUrl, clientId });
41572
+ const medplum = new pn({ baseUrl, clientId });
41549
41573
  await medplum.startClientLogin(clientId, clientSecret);
41550
41574
  const app = new App(medplum, agentId);
41551
41575
  await app.start();