@medplum/agent 2.2.3 → 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 +897 -826
  2. package/package.json +1 -2
@@ -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;
@@ -5062,15 +5062,15 @@ var require_dcmjs = __commonJS({
5062
5062
  return Array.from(iter);
5063
5063
  }
5064
5064
  function _iterableToArrayLimit(arr, i2) {
5065
- var _i2 = arr == null ? null : typeof Symbol !== "undefined" && arr[Symbol.iterator] || arr["@@iterator"];
5066
- if (_i2 == null)
5065
+ var _i = arr == null ? null : typeof Symbol !== "undefined" && arr[Symbol.iterator] || arr["@@iterator"];
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 (_i2 = _i2.call(arr); !(_n = (_s = _i2.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,8 +5080,8 @@ var require_dcmjs = __commonJS({
5080
5080
  _e2 = err2;
5081
5081
  } finally {
5082
5082
  try {
5083
- if (!_n && _i2["return"] != null)
5084
- _i2["return"]();
5083
+ if (!_n2 && _i["return"] != null)
5084
+ _i["return"]();
5085
5085
  } finally {
5086
5086
  if (_d)
5087
5087
  throw _e2;
@@ -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;
@@ -9455,9 +9455,9 @@ var require_dcmjs = __commonJS({
9455
9455
  }, {
9456
9456
  key: "readVR",
9457
9457
  value: function readVR() {
9458
- var vr = String.fromCharCode(this.view.getUint8(this.offset)) + String.fromCharCode(this.view.getUint8(this.offset + 1));
9458
+ var vr2 = String.fromCharCode(this.view.getUint8(this.offset)) + String.fromCharCode(this.view.getUint8(this.offset + 1));
9459
9459
  this.increment(2);
9460
- return vr;
9460
+ return vr2;
9461
9461
  }
9462
9462
  }, {
9463
9463
  key: "readEncodedString",
@@ -9807,7 +9807,7 @@ var require_dcmjs = __commonJS({
9807
9807
  }, {
9808
9808
  key: "write",
9809
9809
  value: function write(stream, vrType, values, syntax, writeOptions) {
9810
- var vr = ValueRepresentation.createByTypeString(vrType), useSyntax = DicomMessage._normalizeSyntax(syntax);
9810
+ var vr2 = ValueRepresentation.createByTypeString(vrType), useSyntax = DicomMessage._normalizeSyntax(syntax);
9811
9811
  var implicit = useSyntax == IMPLICIT_LITTLE_ENDIAN ? true : false, isLittleEndian = useSyntax == IMPLICIT_LITTLE_ENDIAN || useSyntax == EXPLICIT_LITTLE_ENDIAN$1 ? true : false, isEncapsulated = this.isPixelDataTag() && DicomMessage.isEncapsulated(syntax);
9812
9812
  var oldEndian = stream.isLittleEndian;
9813
9813
  stream.setEndian(isLittleEndian);
@@ -9816,11 +9816,11 @@ var require_dcmjs = __commonJS({
9816
9816
  var tagStream = new WriteBufferStream(256), valueLength;
9817
9817
  tagStream.setEndian(isLittleEndian);
9818
9818
  if (vrType == "OW" || vrType == "OB" || vrType == "UN") {
9819
- valueLength = vr.writeBytes(tagStream, values, useSyntax, isEncapsulated, writeOptions);
9819
+ valueLength = vr2.writeBytes(tagStream, values, useSyntax, isEncapsulated, writeOptions);
9820
9820
  } else if (vrType == "SQ") {
9821
- valueLength = vr.writeBytes(tagStream, values, useSyntax, writeOptions);
9821
+ valueLength = vr2.writeBytes(tagStream, values, useSyntax, writeOptions);
9822
9822
  } else {
9823
- valueLength = vr.writeBytes(tagStream, values, writeOptions);
9823
+ valueLength = vr2.writeBytes(tagStream, values, writeOptions);
9824
9824
  }
9825
9825
  if (vrType == "SQ") {
9826
9826
  valueLength = 4294967295;
@@ -9830,13 +9830,13 @@ var require_dcmjs = __commonJS({
9830
9830
  stream.writeUint32(valueLength);
9831
9831
  written += 4;
9832
9832
  } else {
9833
- if (vr.isExplicit()) {
9834
- stream.writeAsciiString(vr.type);
9833
+ if (vr2.isExplicit()) {
9834
+ stream.writeAsciiString(vr2.type);
9835
9835
  stream.writeUint16(0);
9836
9836
  stream.writeUint32(valueLength);
9837
9837
  written += 8;
9838
9838
  } else {
9839
- stream.writeAsciiString(vr.type);
9839
+ stream.writeAsciiString(vr2.type);
9840
9840
  stream.writeUint16(valueLength);
9841
9841
  written += 4;
9842
9842
  }
@@ -10141,20 +10141,20 @@ var require_dcmjs = __commonJS({
10141
10141
  }, {
10142
10142
  key: "createByTypeString",
10143
10143
  value: function createByTypeString(type) {
10144
- var vr = VRinstances[type];
10145
- if (vr === void 0) {
10144
+ var vr2 = VRinstances[type];
10145
+ if (vr2 === void 0) {
10146
10146
  if (type == "ox") {
10147
10147
  validationLog.error("Invalid vr type", type, "- using OW");
10148
- vr = VRinstances["OW"];
10148
+ vr2 = VRinstances["OW"];
10149
10149
  } else if (type == "xs") {
10150
10150
  validationLog.error("Invalid vr type", type, "- using US");
10151
- vr = VRinstances["US"];
10151
+ vr2 = VRinstances["US"];
10152
10152
  } else {
10153
10153
  validationLog.error("Invalid vr type", type, "- using UN");
10154
- vr = VRinstances["UN"];
10154
+ vr2 = VRinstances["UN"];
10155
10155
  }
10156
10156
  }
10157
- return vr;
10157
+ return vr2;
10158
10158
  }
10159
10159
  }]);
10160
10160
  return ValueRepresentation2;
@@ -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);
@@ -11432,7 +11432,7 @@ var require_dcmjs = __commonJS({
11432
11432
  log.error("No value representation given for", naturalName);
11433
11433
  }
11434
11434
  }
11435
- var vr = ValueRepresentation.createByTypeString(dataItem.vr);
11435
+ var vr2 = ValueRepresentation.createByTypeString(dataItem.vr);
11436
11436
  dataItem.Value = DicomMetaDictionary2.denaturalizeValue(dataItem.Value);
11437
11437
  if (entry.vr == "SQ") {
11438
11438
  var unnaturalValues = [];
@@ -11442,11 +11442,11 @@ var require_dcmjs = __commonJS({
11442
11442
  }
11443
11443
  dataItem.Value = unnaturalValues;
11444
11444
  }
11445
- if (!vr.isBinary() && vr.maxLength) {
11445
+ if (!vr2.isBinary() && vr2.maxLength) {
11446
11446
  dataItem.Value = dataItem.Value.map(function(value) {
11447
- if (value.length > vr.maxLength) {
11448
- log.warn("Truncating value ".concat(value, " of ").concat(naturalName, " because it is longer than ").concat(vr.maxLength));
11449
- return value.slice(0, vr.maxLength);
11447
+ if (value.length > vr2.maxLength) {
11448
+ log.warn("Truncating value ".concat(value, " of ").concat(naturalName, " because it is longer than ").concat(vr2.maxLength));
11449
+ return value.slice(0, vr2.maxLength);
11450
11450
  } else {
11451
11451
  return value;
11452
11452
  }
@@ -11727,9 +11727,9 @@ var require_dcmjs = __commonJS({
11727
11727
  }
11728
11728
  }, {
11729
11729
  key: "writeTagObject",
11730
- value: function writeTagObject(stream, tagString, vr, values, syntax, writeOptions) {
11730
+ value: function writeTagObject(stream, tagString, vr2, values, syntax, writeOptions) {
11731
11731
  var tag = Tag.fromString(tagString);
11732
- tag.write(stream, vr, values, syntax, writeOptions);
11732
+ tag.write(stream, vr2, values, syntax, writeOptions);
11733
11733
  }
11734
11734
  }, {
11735
11735
  key: "write",
@@ -11763,7 +11763,7 @@ var require_dcmjs = __commonJS({
11763
11763
  };
11764
11764
  }
11765
11765
  }
11766
- var length2 = null, vr = null, vrType;
11766
+ var length2 = null, vr2 = null, vrType;
11767
11767
  if (implicit) {
11768
11768
  length2 = stream.readUint32();
11769
11769
  var elementData = DicomMessage2.lookupTag(tag);
@@ -11782,11 +11782,11 @@ var require_dcmjs = __commonJS({
11782
11782
  vrType = "UN";
11783
11783
  }
11784
11784
  }
11785
- vr = ValueRepresentation.createByTypeString(vrType);
11785
+ vr2 = ValueRepresentation.createByTypeString(vrType);
11786
11786
  } else {
11787
11787
  vrType = stream.readVR();
11788
- vr = ValueRepresentation.createByTypeString(vrType);
11789
- if (vr.isExplicit()) {
11788
+ vr2 = ValueRepresentation.createByTypeString(vrType);
11789
+ if (vr2.isExplicit()) {
11790
11790
  stream.increment(2);
11791
11791
  length2 = stream.readUint32();
11792
11792
  } else {
@@ -11794,21 +11794,21 @@ var require_dcmjs = __commonJS({
11794
11794
  }
11795
11795
  }
11796
11796
  var values = [];
11797
- if (vr.isBinary() && length2 > vr.maxLength && !vr.noMultiple) {
11798
- var times = length2 / vr.maxLength, i2 = 0;
11797
+ if (vr2.isBinary() && length2 > vr2.maxLength && !vr2.noMultiple) {
11798
+ var times = length2 / vr2.maxLength, i2 = 0;
11799
11799
  while (i2++ < times) {
11800
- values.push(vr.read(stream, vr.maxLength, syntax));
11800
+ values.push(vr2.read(stream, vr2.maxLength, syntax));
11801
11801
  }
11802
11802
  } else {
11803
- var val = vr.read(stream, length2, syntax);
11804
- if (!vr.isBinary() && singleVRs.indexOf(vr.type) == -1) {
11803
+ var val = vr2.read(stream, length2, syntax);
11804
+ if (!vr2.isBinary() && singleVRs.indexOf(vr2.type) == -1) {
11805
11805
  values = val;
11806
11806
  if (typeof val === "string") {
11807
11807
  values = val.split(String.fromCharCode(VM_DELIMITER));
11808
11808
  }
11809
- } else if (vr.type == "SQ") {
11809
+ } else if (vr2.type == "SQ") {
11810
11810
  values = val;
11811
- } else if (vr.type == "OW" || vr.type == "OB") {
11811
+ } else if (vr2.type == "OW" || vr2.type == "OB") {
11812
11812
  values = val;
11813
11813
  } else {
11814
11814
  Array.isArray(val) ? values = val : values.push(val);
@@ -11817,7 +11817,7 @@ var require_dcmjs = __commonJS({
11817
11817
  stream.setEndian(oldEndian);
11818
11818
  var retObj = ValueRepresentation.addTagAccessors({
11819
11819
  tag,
11820
- vr
11820
+ vr: vr2
11821
11821
  });
11822
11822
  retObj.values = values;
11823
11823
  return retObj;
@@ -11839,12 +11839,12 @@ var require_dcmjs = __commonJS({
11839
11839
  }
11840
11840
  _createClass(DicomDict2, [{
11841
11841
  key: "upsertTag",
11842
- value: function upsertTag(tag, vr, values) {
11842
+ value: function upsertTag(tag, vr2, values) {
11843
11843
  if (this.dict[tag]) {
11844
11844
  this.dict[tag].Value = values;
11845
11845
  } else {
11846
11846
  this.dict[tag] = ValueRepresentation.addTagAccessors({
11847
- vr
11847
+ vr: vr2
11848
11848
  });
11849
11849
  this.dict[tag].Value = values;
11850
11850
  }
@@ -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",
@@ -15031,9 +15031,9 @@ var require_dcmjs = __commonJS({
15031
15031
  NumberOfFrames += referencedFramesPerSegment[i2].length;
15032
15032
  }
15033
15033
  seg.setNumberOfFrames(NumberOfFrames);
15034
- for (var _i2 = 0; _i2 < segmentIndicies.length; _i2++) {
15035
- var segmentIndex = segmentIndicies[_i2];
15036
- var referencedFrameIndicies = referencedFramesPerSegment[_i2];
15034
+ for (var _i = 0; _i < segmentIndicies.length; _i++) {
15035
+ var segmentIndex = segmentIndicies[_i];
15036
+ var referencedFrameIndicies = referencedFramesPerSegment[_i];
15037
15037
  var referencedFrameNumbers = referencedFrameIndicies.map(function(element) {
15038
15038
  return element + 1;
15039
15039
  });
@@ -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];
@@ -15714,11 +15714,11 @@ var require_dcmjs = __commonJS({
15714
15714
  var bodyLength = rleArray.length % 2 === 0 ? rleArray.length : rleArray.length + 1;
15715
15715
  var encodedFrameBuffer = new ArrayBuffer(headerLength + bodyLength);
15716
15716
  var headerView = new Uint32Array(encodedFrameBuffer, 0, 16);
15717
- for (var _i2 = 0; _i2 < headerView.length; _i2++) {
15718
- headerView[_i2] = header[_i2];
15717
+ for (var _i = 0; _i < headerView.length; _i++) {
15718
+ headerView[_i] = header[_i];
15719
15719
  }
15720
- for (var _i22 = 0; _i22 < headerView.length; _i22++) {
15721
- rleArray.push(headerView[_i22]);
15720
+ for (var _i2 = 0; _i2 < headerView.length; _i2++) {
15721
+ rleArray.push(headerView[_i2]);
15722
15722
  }
15723
15723
  var bodyView = new Uint8Array(encodedFrameBuffer, 64);
15724
15724
  for (var _i3 = 0; _i3 < rleArray.length; _i3++) {
@@ -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;
@@ -16419,20 +16419,20 @@ var require_dcmjs = __commonJS({
16419
16419
  referencedFramesPerSegment2[i2] = [];
16420
16420
  }
16421
16421
  }
16422
- var _loop22 = function _loop23(_i3) {
16423
- var labelmap2D = labelmaps2D[_i3];
16424
- if (labelmaps2D[_i3]) {
16422
+ var _loop22 = function _loop23(_i2) {
16423
+ var labelmap2D = labelmaps2D[_i2];
16424
+ if (labelmaps2D[_i2]) {
16425
16425
  var segmentsOnLabelmap = labelmap2D.segmentsOnLabelmap;
16426
16426
  segmentsOnLabelmap.forEach(function(segmentIndex2) {
16427
16427
  if (segmentIndex2 !== 0) {
16428
- referencedFramesPerSegment2[segmentIndex2].push(_i3);
16428
+ referencedFramesPerSegment2[segmentIndex2].push(_i2);
16429
16429
  numberOfFrames++;
16430
16430
  }
16431
16431
  });
16432
16432
  }
16433
16433
  };
16434
- for (var _i2 = 0; _i2 < labelmaps2D.length; _i2++) {
16435
- _loop22(_i2);
16434
+ for (var _i = 0; _i < labelmaps2D.length; _i++) {
16435
+ _loop22(_i);
16436
16436
  }
16437
16437
  referencedFramesPerLabelmap[labelmapIndex2] = referencedFramesPerSegment2;
16438
16438
  };
@@ -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]);
@@ -25768,8 +25768,8 @@ var require_fecha_umd = __commonJS({
25768
25768
  };
25769
25769
  function assign(origObj) {
25770
25770
  var args = [];
25771
- for (var _i2 = 1; _i2 < arguments.length; _i2++) {
25772
- args[_i2 - 1] = arguments[_i2];
25771
+ for (var _i = 1; _i < arguments.length; _i++) {
25772
+ args[_i - 1] = arguments[_i];
25773
25773
  }
25774
25774
  for (var _a = 0, args_1 = args; _a < args_1.length; _a++) {
25775
25775
  var obj = args_1[_a];
@@ -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,14 +33097,14 @@ 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 z2 = r4 * 0.0193 + g2 * 0.1192 + b2 * 0.9505;
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
33108
  return [x * 100, y * 100, z2 * 100];
33109
33109
  };
33110
33110
  convert.rgb.lab = function(rgb) {
@@ -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,30 +33288,30 @@ 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
33301
  var z2 = xyz[2] / 100;
33302
33302
  var r4;
33303
- var g2;
33303
+ var g3;
33304
33304
  var b2;
33305
33305
  r4 = x * 3.2406 + y * -1.5372 + z2 * -0.4986;
33306
- g2 = x * -0.9689 + y * 1.8758 + z2 * 0.0415;
33306
+ g3 = x * -0.9689 + y * 1.8758 + z2 * 0.0415;
33307
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];
@@ -33356,11 +33356,11 @@ var require_conversions = __commonJS({
33356
33356
  var l2 = lab[0];
33357
33357
  var a = lab[1];
33358
33358
  var b2 = lab[2];
33359
- var hr;
33359
+ var hr2;
33360
33360
  var h3;
33361
33361
  var c3;
33362
- hr = Math.atan2(b2, a);
33363
- h3 = hr * 360 / 2 / Math.PI;
33362
+ hr2 = Math.atan2(b2, a);
33363
+ h3 = hr2 * 360 / 2 / Math.PI;
33364
33364
  if (h3 < 0) {
33365
33365
  h3 += 360;
33366
33366
  }
@@ -33373,22 +33373,22 @@ var require_conversions = __commonJS({
33373
33373
  var h3 = lch[2];
33374
33374
  var a;
33375
33375
  var b2;
33376
- var hr;
33377
- hr = h3 / 360 * 2 * Math.PI;
33378
- a = c3 * Math.cos(hr);
33379
- b2 = c3 * Math.sin(hr);
33376
+ var hr2;
33377
+ hr2 = h3 / 360 * 2 * Math.PI;
33378
+ a = c3 * Math.cos(hr2);
33379
+ b2 = c3 * Math.sin(hr2);
33380
33380
  return [l2, a, b2];
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: z2 } = s2(677), { EOL: Q } = s2(37), W = s2(425);
37921
- class J extends W {
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
  }
@@ -37955,9 +37955,9 @@ var require_dcmjs_dimse_min = __commonJS({
37955
37955
  }
37956
37956
  }
37957
37957
  }
37958
- e2.exports = class extends W {
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;
@@ -38116,73 +38116,73 @@ var require_dcmjs_dimse_min = __commonJS({
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,35 +38205,35 @@ 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", () => {
@@ -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,7 +38858,7 @@ 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), z2 = s2(347), Q = s2(719), W = s2(266), J = { 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: 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: g2, CMoveResponse: p3, CStoreResponse: f, NActionResponse: S2, NCreateResponse: C2, NDeleteResponse: v3, NEventReportResponse: w2, NGetResponse: U2, NSetResponse: D2 }, Scp: r5, Server: o2, Statistics: W, version: s2(972) };
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
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()] });
@@ -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;
@@ -38931,7 +38931,7 @@ var j = 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();
@@ -39010,43 +39010,43 @@ var it = class {
39010
39010
  }
39011
39011
  };
39012
39012
  function z(r4) {
39013
- let e = ce(r4), t = hn(r4);
39013
+ let e = de(r4), t = On(r4);
39014
39014
  return t === e ? { reference: e } : { reference: e, display: t };
39015
39015
  }
39016
- function ce(r4) {
39017
- return ue(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 Gt(r4) {
39019
+ function tr(r4) {
39020
39020
  if (r4)
39021
- return ue(r4) ? r4.reference.split("/")[1] : r4.id;
39021
+ return pe(r4) ? r4.reference.split("/")[1] : r4.id;
39022
39022
  }
39023
- function mn(r4) {
39023
+ function kn(r4) {
39024
39024
  return r4.resourceType === "Patient" || r4.resourceType === "Practitioner" || r4.resourceType === "RelatedPerson";
39025
39025
  }
39026
- function hn(r4) {
39027
- if (mn(r4)) {
39028
- let e = yn(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 = gn(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 : ce(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 yn(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 gn(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 Se(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,116 +39055,134 @@ function Se(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 Yt(r4, e) {
39062
- return JSON.stringify(r4, xn, e ? 2 : void 0);
39061
+ function ir(r4, ...e) {
39062
+ let t = r4;
39063
+ for (let n = 0; n < e.length && t; n++)
39064
+ t = t?.extension?.find((i2) => i2.url === e[n]);
39065
+ return t;
39063
39066
  }
39064
- function xn(r4, e) {
39065
- return !Tn(r4) && E(e) ? void 0 : e;
39067
+ function or(r4, e) {
39068
+ return JSON.stringify(r4, Nn, e ? 2 : void 0);
39066
39069
  }
39067
- function Tn(r4) {
39070
+ function Nn(r4, e) {
39071
+ return !Fn(r4) && E(e) ? void 0 : e;
39072
+ }
39073
+ function Fn(r4) {
39068
39074
  return !!/\d+$/.exec(r4);
39069
39075
  }
39070
39076
  function E(r4) {
39071
39077
  if (r4 == null)
39072
39078
  return true;
39073
39079
  let e = typeof r4;
39074
- return e === "string" && r4 === "" || e === "object" && Object.keys(r4).length === 0;
39080
+ return e === "string" || e === "object" ? !_n(r4) : false;
39075
39081
  }
39076
- function Xt(r4) {
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);
39087
+ }
39088
+ function sr(r4) {
39077
39089
  return r4.every((e) => typeof e == "string");
39078
39090
  }
39079
- var Zt = [];
39091
+ var ar = [];
39080
39092
  for (let r4 = 0; r4 < 256; r4++)
39081
- Zt.push(r4.toString(16).padStart(2, "0"));
39082
- function er(r4) {
39093
+ ar.push(r4.toString(16).padStart(2, "0"));
39094
+ function cr(r4) {
39083
39095
  let e = new Uint8Array(r4), t = new Array(e.length);
39084
39096
  for (let n = 0; n < e.length; n++)
39085
- t[n] = Zt[e[n]];
39097
+ t[n] = ar[e[n]];
39086
39098
  return t.join("");
39087
39099
  }
39088
- function tr(r4) {
39100
+ function ur(r4) {
39089
39101
  let e = new Uint8Array(r4), t = [];
39090
39102
  for (let n = 0; n < e.length; n++)
39091
39103
  t[n] = String.fromCharCode(e[n]);
39092
39104
  return window.btoa(t.join(""));
39093
39105
  }
39094
- function A(r4) {
39106
+ function w(r4) {
39095
39107
  return r4 ? r4.charAt(0).toUpperCase() + r4.substring(1) : "";
39096
39108
  }
39097
- var at = (r4) => new Promise((e) => {
39109
+ var lt = (r4) => new Promise((e) => {
39098
39110
  setTimeout(e, r4);
39099
39111
  });
39100
- function Ae(r4, e) {
39112
+ function Ie(r4, e) {
39101
39113
  let t = [];
39102
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) {
39103
- let n = te(r4.text);
39115
+ let n = re(r4.text);
39104
39116
  if (n)
39105
39117
  return n;
39106
39118
  }
39107
39119
  return t.join(" ").trim();
39108
39120
  }
39109
- function te(r4) {
39121
+ function re(r4) {
39110
39122
  return typeof r4 == "string" ? r4 : void 0;
39111
39123
  }
39112
- function Bn(r4) {
39113
- let e = r4.max && r4.max === Number.MAX_SAFE_INTEGER ? Number.POSITIVE_INFINITY : r4.max;
39114
- return { path: "", description: "", type: r4.type ?? [], min: r4.min ?? 0, max: e ?? 1, isArray: !!e && e > 1, constraints: [] };
39124
+ function ni(r4, e) {
39125
+ let t = e.max && e.max === Number.MAX_SAFE_INTEGER ? Number.POSITIVE_INFINITY : e.max;
39126
+ return { path: r4, description: "", type: e.type ?? [], min: e.min ?? 0, max: t ?? 1, isArray: !!t && t > 1, constraints: [] };
39115
39127
  }
39116
- function or(r4) {
39128
+ function fr(r4) {
39117
39129
  let e = /* @__PURE__ */ Object.create(null);
39118
39130
  for (let [t, n] of Object.entries(r4))
39119
- e[t] = { name: t, elements: Object.fromEntries(Object.entries(n.elements).map(([i2, o]) => [i2, Bn(o)])), constraints: [], innerTypes: [] };
39131
+ e[t] = { name: t, elements: Object.fromEntries(Object.entries(n.elements).map(([i2, o]) => [i2, ni(i2, o)])), constraints: [], innerTypes: [] };
39120
39132
  return e;
39121
39133
  }
39122
- var sr = { 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" }] } } } };
39123
39135
  function d(r4) {
39124
39136
  return [{ type: c.boolean, value: r4 }];
39125
39137
  }
39126
- function T(r4) {
39127
- 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 };
39128
39140
  }
39129
- function B(r4) {
39141
+ function V(r4) {
39130
39142
  return r4.length === 0 ? false : !!r4[0].value;
39131
39143
  }
39132
- function F(r4, e) {
39144
+ function _(r4, e) {
39133
39145
  if (r4.length !== 0) {
39134
39146
  if (r4.length === 1 && (!e || r4[0].type === e))
39135
39147
  return r4[0];
39136
39148
  throw new Error(`Expected singleton of type ${e}, but found ${JSON.stringify(r4)}`);
39137
39149
  }
39138
39150
  }
39139
- function O(r4, e) {
39151
+ function A(r4, e) {
39140
39152
  if (!r4.value)
39141
39153
  return;
39142
- let t = Ie(r4.type, e);
39143
- return t ? $n(r4, e, t) : jn(r4, e);
39154
+ let t = Ve(r4.type, e);
39155
+ return t ? oi(r4.value, e, t) : si(r4, e);
39144
39156
  }
39145
- function $n(r4, e, t) {
39157
+ function oi(r4, e, t) {
39146
39158
  let n = t.type;
39147
39159
  if (!n || n.length === 0)
39148
39160
  return;
39149
- let i2, o = "undefined";
39150
- if (n.length === 1)
39151
- i2 = r4.value[e], o = n[0].code;
39152
- else
39153
- for (let a of n) {
39154
- let u2 = e.replace("[x]", "") + A(a.code);
39155
- if (u2 in r4.value) {
39156
- i2 = r4.value[u2], o = a.code;
39161
+ let i2, o = "undefined", s;
39162
+ if (t.path.endsWith("[x]")) {
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;
39157
39168
  break;
39158
39169
  }
39159
39170
  }
39160
- let s = r4.value["_" + e];
39161
- if (s && (Array.isArray(i2) ? i2 = i2.map((a, u2) => s[u2] ? lr(a ?? {}, s[u2]) : a) : i2 = lr(i2 ?? {}, s)), !E(i2))
39162
- return (o === "Element" || o === "BackboneElement") && (o = t.type[0].code), Array.isArray(i2) ? i2.map((a) => ar(a, o)) : ar(i2, o);
39171
+ } else
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);
39163
39181
  }
39164
- function ar(r4, e) {
39165
- 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 };
39166
39184
  }
39167
- function jn(r4, e) {
39185
+ function si(r4, e) {
39168
39186
  let t = r4.value;
39169
39187
  if (!t || typeof t != "object")
39170
39188
  return;
@@ -39173,21 +39191,21 @@ function jn(r4, e) {
39173
39191
  n = t[e];
39174
39192
  else
39175
39193
  for (let i2 in c) {
39176
- let o = e + A(i2);
39194
+ let o = e + w(i2);
39177
39195
  if (o in t) {
39178
39196
  n = t[o];
39179
39197
  break;
39180
39198
  }
39181
39199
  }
39182
39200
  if (!E(n))
39183
- return Array.isArray(n) ? n.map(T) : T(n);
39201
+ return Array.isArray(n) ? n.map(g) : g(n);
39184
39202
  }
39185
- function Ce(r4) {
39203
+ function ke(r4) {
39186
39204
  let e = [];
39187
39205
  for (let t of r4) {
39188
39206
  let n = false;
39189
39207
  for (let i2 of e)
39190
- if (B(dr(t, i2))) {
39208
+ if (V(Tr(t, i2))) {
39191
39209
  n = true;
39192
39210
  break;
39193
39211
  }
@@ -39195,28 +39213,28 @@ function Ce(r4) {
39195
39213
  }
39196
39214
  return e;
39197
39215
  }
39198
- function lt(r4) {
39199
- return d(!B(r4));
39216
+ function ft(r4) {
39217
+ return d(!V(r4));
39200
39218
  }
39201
- function dt(r4, e) {
39202
- return r4.length === 0 || e.length === 0 ? [] : r4.length !== e.length ? d(false) : d(r4.every((t, n) => B(dr(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]))));
39203
39221
  }
39204
- function dr(r4, e) {
39222
+ function Tr(r4, e) {
39205
39223
  let t = r4.value?.valueOf(), n = e.value?.valueOf();
39206
- return typeof t == "number" && typeof n == "number" ? d(Math.abs(t - n) < 1e-8) : b(t) && b(n) ? d(pr(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);
39207
39225
  }
39208
- function pt(r4, e) {
39209
- return r4.length === 0 && e.length === 0 ? d(true) : r4.length !== e.length ? d(false) : (r4.sort(cr), e.sort(cr), d(r4.every((t, n) => B(Qn(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])))));
39210
39228
  }
39211
- function Qn(r4, e) {
39229
+ function ai(r4, e) {
39212
39230
  let { type: t, value: n } = r4, { type: i2, value: o } = e, s = n?.valueOf(), a = o?.valueOf();
39213
- return typeof s == "number" && typeof a == "number" ? d(Math.abs(s - a) < 0.01) : b(s) && b(a) ? d(pr(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);
39214
39232
  }
39215
- function cr(r4, e) {
39233
+ function yr(r4, e) {
39216
39234
  let t = r4.value?.valueOf(), n = e.value?.valueOf();
39217
39235
  return typeof t == "number" && typeof n == "number" ? t - n : typeof t == "string" && typeof n == "string" ? t.localeCompare(n) : 0;
39218
39236
  }
39219
- function we(r4, e) {
39237
+ function Oe(r4, e) {
39220
39238
  let { value: t } = r4;
39221
39239
  if (t == null)
39222
39240
  return false;
@@ -39233,110 +39251,127 @@ function we(r4, e) {
39233
39251
  case "Time":
39234
39252
  return typeof t == "string" && !!/^T\d/.exec(t);
39235
39253
  case "Period":
39236
- return Hn(t);
39254
+ return ci(t);
39237
39255
  case "Quantity":
39238
39256
  return b(t);
39239
39257
  default:
39240
39258
  return typeof t == "object" && t?.resourceType === e;
39241
39259
  }
39242
39260
  }
39243
- function Hn(r4) {
39261
+ function ci(r4) {
39244
39262
  return !!(r4 && typeof r4 == "object" && "start" in r4);
39245
39263
  }
39246
39264
  function b(r4) {
39247
39265
  return !!(r4 && typeof r4 == "object" && "value" in r4 && typeof r4.value == "number");
39248
39266
  }
39249
- function pr(r4, e) {
39267
+ function vr(r4, e) {
39250
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);
39251
39269
  }
39252
- function ft(r4, e) {
39270
+ function yt(r4, e) {
39253
39271
  let t = Object.keys(r4), n = Object.keys(e);
39254
39272
  if (t.length !== n.length)
39255
39273
  return false;
39256
39274
  for (let i2 of t) {
39257
39275
  let o = r4[i2], s = e[i2];
39258
- if (ur(o) && ur(s)) {
39259
- if (!ft(o, s))
39276
+ if (gr(o) && gr(s)) {
39277
+ if (!yt(o, s))
39260
39278
  return false;
39261
39279
  } else if (o !== s)
39262
39280
  return false;
39263
39281
  }
39264
39282
  return true;
39265
39283
  }
39266
- function ur(r4) {
39284
+ function gr(r4) {
39267
39285
  return r4 !== null && typeof r4 == "object";
39268
39286
  }
39269
- function lr(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) {
39270
39296
  return delete e.__proto__, delete e.constructor, Object.assign(r4, e);
39271
39297
  }
39272
- var mt = "ok";
39273
- var ke = "created";
39274
- var yt = "not-modified";
39275
- var gt = "not-found";
39276
- var Oe = "accepted";
39277
- var yr = { resourceType: "OperationOutcome", id: gt, issue: [{ severity: "error", code: "not-found", details: { text: "Not found" } }] };
39278
- function C(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) {
39279
39305
  return { resourceType: "OperationOutcome", issue: [{ severity: "error", code: "invalid", details: { text: r4 }, expression: e ? [e] : void 0 }] };
39280
39306
  }
39281
39307
  function h(r4) {
39282
39308
  return { resourceType: "OperationOutcome", issue: [{ severity: "error", code: "structure", details: { text: r4 } }] };
39283
39309
  }
39284
- function Ve(r4) {
39310
+ function Fe(r4) {
39285
39311
  return typeof r4 == "object" && r4 !== null && r4.resourceType === "OperationOutcome";
39286
39312
  }
39287
- function xt(r4) {
39288
- 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;
39289
39315
  }
39290
39316
  var p = class extends Error {
39291
39317
  constructor(t, n) {
39292
- super(gr(t));
39318
+ super(Pr(t));
39293
39319
  this.outcome = t, this.cause = n;
39294
39320
  }
39295
39321
  };
39296
- function De(r4) {
39297
- return r4 instanceof p ? r4.outcome : Ve(r4) ? r4 : C(Kn(r4));
39322
+ function _e(r4) {
39323
+ return r4 instanceof p ? r4.outcome : Fe(r4) ? r4 : I(li(r4));
39298
39324
  }
39299
- function Kn(r4) {
39300
- return r4 ? typeof r4 == "string" ? r4 : r4 instanceof Error ? r4.message : Ve(r4) ? gr(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";
39301
39327
  }
39302
- function gr(r4) {
39303
- let e = r4.issue?.map(Wn) ?? [];
39328
+ function Pr(r4) {
39329
+ let e = r4.issue?.map(di) ?? [];
39304
39330
  return e.length > 0 ? e.join("; ") : "Unknown error";
39305
39331
  }
39306
- function Wn(r4) {
39332
+ function di(r4) {
39307
39333
  let e;
39308
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;
39309
39335
  }
39310
- function bt(r4) {
39311
- return new St(r4).parse();
39336
+ function At(r4) {
39337
+ return new Rt(r4).parse();
39312
39338
  }
39313
- var H = or(sr);
39314
- function br(r4) {
39315
- let e = Array.isArray(r4) ? r4 : r4.entry?.map((t) => t.resource) ?? [];
39316
- for (let t of e)
39317
- Gn(t);
39339
+ var fe = fr(mr);
39340
+ var Ct = /* @__PURE__ */ Object.create(null);
39341
+ var wr = /* @__PURE__ */ Object.create(null);
39342
+ function wt(r4) {
39343
+ let e;
39344
+ return r4 ? (e = wr[r4], e || (e = wr[r4] = /* @__PURE__ */ Object.create(null))) : e = fe, e;
39318
39345
  }
39319
- function Gn(r4) {
39346
+ function It(r4, e) {
39347
+ let t = Array.isArray(r4) ? r4 : r4.entry?.map((n) => n.resource) ?? [];
39348
+ for (let n of t)
39349
+ pi(n, e);
39350
+ }
39351
+ function pi(r4, e) {
39320
39352
  if (!r4?.name)
39321
39353
  throw new Error("Failed loading StructureDefinition from bundle");
39322
39354
  if (r4.resourceType !== "StructureDefinition")
39323
39355
  return;
39324
- let e = bt(r4);
39325
- H[r4.name] = e;
39326
- for (let t of e.innerTypes)
39327
- t.parentType = e, H[t.name] = t;
39356
+ let t = At(r4), n = wt(e);
39357
+ n[r4.name] = t, e && r4.url === e && (Ct[e] = t);
39358
+ for (let i2 of t.innerTypes)
39359
+ i2.parentType = t, n[i2.name] = i2;
39328
39360
  }
39329
- function Pr(r4) {
39330
- return !!H[r4];
39361
+ function Dr(r4) {
39362
+ return !!fe[r4];
39331
39363
  }
39332
- function Ar(r4) {
39333
- return H[r4];
39364
+ function Nr(r4, e) {
39365
+ return wt(e)[r4];
39334
39366
  }
39335
- var St = class {
39367
+ function _r(r4) {
39368
+ return !!Ct[r4];
39369
+ }
39370
+ var Rt = class {
39336
39371
  constructor(e) {
39337
39372
  if (!e.snapshot?.element || e.snapshot.element.length === 0)
39338
39373
  throw new Error(`No snapshot defined for StructureDefinition '${e.name}'`);
39339
- 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, url: e.url, kind: e.kind, description: Xn(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 = [];
39340
39375
  }
39341
39376
  parse() {
39342
39377
  let e = this.next();
@@ -39345,7 +39380,7 @@ var St = class {
39345
39380
  this.parseSliceStart(e);
39346
39381
  else if (e.id?.includes(":")) {
39347
39382
  if (this.slicingContext?.current) {
39348
- let t = vt(e, this.slicingContext.path);
39383
+ let t = bt(e, this.slicingContext.path);
39349
39384
  this.slicingContext.current.elements[t] = this.parseElementDefinition(e);
39350
39385
  }
39351
39386
  } else {
@@ -39354,13 +39389,13 @@ var St = class {
39354
39389
  let n = this.backboneContext;
39355
39390
  for (; n; ) {
39356
39391
  if (e.path?.startsWith(n.path + ".")) {
39357
- n.type.elements[vt(e, n.path)] = t;
39392
+ n.type.elements[bt(e, n.path)] = t;
39358
39393
  break;
39359
39394
  }
39360
39395
  n = n.parent;
39361
39396
  }
39362
39397
  if (!n) {
39363
- let i2 = vt(e, this.root.path);
39398
+ let i2 = bt(e, this.root.path);
39364
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;
39365
39400
  }
39366
39401
  this.checkFieldExit(e);
@@ -39373,26 +39408,26 @@ var St = class {
39373
39408
  this.isInnerType(e) && this.enterInnerType(e), e.slicing && !this.slicingContext && this.enterSlice(e, t);
39374
39409
  }
39375
39410
  enterInnerType(e) {
39376
- for (; this.backboneContext && !re(this.backboneContext?.path, e.path); )
39411
+ for (; this.backboneContext && !ne(this.backboneContext?.path, e.path); )
39377
39412
  this.innerTypes.push(this.backboneContext.type), this.backboneContext = this.backboneContext.parent;
39378
- this.backboneContext = { type: { name: Et(e), description: e.definition, elements: {}, constraints: this.parseElementDefinition(e).constraints, innerTypes: [] }, path: e.path ?? "", parent: re(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 };
39379
39414
  }
39380
39415
  enterSlice(e, t) {
39381
- Yn(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) => {
39382
39417
  if (n.type !== "value" && n.type !== "pattern" && n.type !== "type")
39383
39418
  throw new Error(`Unsupported slicing discriminator type: ${n.type}`);
39384
39419
  return { path: n.path, type: n.type };
39385
39420
  }), slices: [], ordered: e.slicing?.ordered ?? false, rule: e.slicing?.rules }, this.slicingContext = { field: t.slicing, path: e.path ?? "" });
39386
39421
  }
39387
39422
  checkFieldExit(e = void 0) {
39388
- if (this.backboneContext && !re(this.backboneContext.path, e?.path))
39423
+ if (this.backboneContext && !ne(this.backboneContext.path, e?.path))
39389
39424
  if (this.backboneContext.parent)
39390
39425
  do
39391
39426
  this.innerTypes.push(this.backboneContext.type), this.backboneContext = this.backboneContext.parent;
39392
- while (this.backboneContext && !re(this.backboneContext.path, e?.path));
39427
+ while (this.backboneContext && !ne(this.backboneContext.path, e?.path));
39393
39428
  else
39394
39429
  this.innerTypes.push(this.backboneContext.type), delete this.backboneContext;
39395
- this.slicingContext && !re(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);
39396
39431
  }
39397
39432
  next() {
39398
39433
  let e = this.peek();
@@ -39411,68 +39446,87 @@ var St = class {
39411
39446
  }
39412
39447
  isInnerType(e) {
39413
39448
  let t = this.peek();
39414
- return !!(re(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)));
39415
39450
  }
39416
39451
  parseSliceStart(e) {
39417
39452
  if (!this.slicingContext)
39418
39453
  throw new Error("Invalid slice start before discriminator: " + e.sliceName);
39419
- this.slicingContext.current && this.slicingContext.field.slices.push(this.slicingContext.current), this.slicingContext.current = { name: e.sliceName ?? "", type: e.type?.map((t) => ({ code: t.code ?? "", targetProfile: t.targetProfile })), elements: {}, min: e.min ?? 0, max: e.max === "*" ? Number.POSITIVE_INFINITY : Number.parseInt(e.max, 10) };
39454
+ this.slicingContext.current && this.slicingContext.field.slices.push(this.slicingContext.current), this.slicingContext.current = { name: e.sliceName ?? "", path: e.path ?? "", definition: e.definition, type: this.parseElementDefinitionType(e), elements: {}, min: e.min ?? 0, max: e.max === "*" ? Number.POSITIVE_INFINITY : Number.parseInt(e.max, 10) };
39455
+ }
39456
+ parseElementDefinitionType(e) {
39457
+ return (e.type ?? []).map((t) => {
39458
+ let n;
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 };
39460
+ });
39420
39461
  }
39421
39462
  parseElementDefinition(e) {
39422
- let t = Sr(e.max), n = e.base?.max ? Sr(e.base.max) : t, i2 = { type: "ElementDefinition", value: e };
39423
- 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: (e.type ?? []).map((o) => ({ code: ["BackboneElement", "Element"].includes(o.code) ? Et(e) : o.code ?? "", targetProfile: o.targetProfile })), fixed: Er(O(i2, "fixed")), pattern: Er(O(i2, "pattern")), 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 };
39424
39465
  }
39425
39466
  };
39426
- function Sr(r4) {
39467
+ function kr(r4) {
39427
39468
  return r4 === "*" ? Number.POSITIVE_INFINITY : Number.parseInt(r4, 10);
39428
39469
  }
39429
- function vt(r4, e = "") {
39430
- return Jn(r4.path, e);
39470
+ function bt(r4, e = "") {
39471
+ return mi(r4.path, e);
39431
39472
  }
39432
- function Jn(r4, e) {
39473
+ function mi(r4, e) {
39433
39474
  return r4 ? e && r4.startsWith(e) ? r4.substring(e.length + 1) : r4 : "";
39434
39475
  }
39435
- function re(r4, e) {
39476
+ function ne(r4, e) {
39436
39477
  return !r4 || !e ? false : e.startsWith(r4 + ".") || e === r4;
39437
39478
  }
39438
- function Er(r4) {
39479
+ function Or(r4) {
39439
39480
  return Array.isArray(r4) && r4.length > 0 ? r4[0] : E(r4) ? void 0 : r4;
39440
39481
  }
39441
- function Yn(r4) {
39482
+ function hi(r4) {
39442
39483
  let e = r4.slicing?.discriminator;
39443
39484
  return !!(r4.type?.some((t) => t.code === "Extension") && e?.length === 1 && e[0].type === "value" && e[0].path === "url");
39444
39485
  }
39445
- function Xn(r4) {
39486
+ function yi(r4) {
39446
39487
  let e = r4.description;
39447
39488
  return e?.startsWith(`Base StructureDefinition for ${r4.name} Type: `) && (e = e.substring(`Base StructureDefinition for ${r4.name} Type: `.length)), e;
39448
39489
  }
39449
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" };
39450
- function Pt(r4) {
39491
+ function Ot(r4) {
39451
39492
  for (let e of r4.base ?? []) {
39452
- let t = V.types[e];
39453
- t || (t = { searchParamsDetails: {} }, V.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;
39493
+ let t = D.types[e];
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;
39454
39495
  }
39455
39496
  }
39456
- function Et(r4) {
39497
+ function Pt(r4) {
39457
39498
  let e = r4.type?.[0]?.code;
39458
- return e === "BackboneElement" || e === "Element" ? Zn((r4.base?.path ?? r4.path)?.split(".")) : e;
39499
+ return e === "BackboneElement" || e === "Element" ? gi((r4.base?.path ?? r4.path)?.split(".")) : e;
39459
39500
  }
39460
- function Zn(r4) {
39461
- return r4.length === 1 ? r4[0] : r4.map(A).join("");
39501
+ function gi(r4) {
39502
+ return r4.length === 1 ? r4[0] : r4.map(w).join("");
39462
39503
  }
39463
- function Ie(r4, e) {
39464
- let t = Ar(r4);
39504
+ function Ve(r4, e) {
39505
+ let t = Nr(r4);
39506
+ if (t)
39507
+ return Si(t.elements, e);
39508
+ }
39509
+ function Si(r4, e) {
39510
+ let t = r4[e] ?? r4[e + "[x]"];
39465
39511
  if (t)
39466
- return t.elements[e] ?? t.elements[e + "[x]"];
39512
+ return t;
39513
+ for (let n = 0; n < e.length; n++) {
39514
+ let i2 = e[n];
39515
+ if (i2 >= "A" && i2 <= "Z") {
39516
+ let o = e.slice(0, n) + "[x]", s = r4[o];
39517
+ if (s)
39518
+ return s;
39519
+ }
39520
+ }
39467
39521
  }
39468
- function _(r4) {
39522
+ function M(r4) {
39469
39523
  return !!(r4 && typeof r4 == "object" && "resourceType" in r4);
39470
39524
  }
39471
- function ue(r4) {
39525
+ function pe(r4) {
39472
39526
  return !!(r4 && typeof r4 == "object" && "reference" in r4);
39473
39527
  }
39474
- var V = { types: {} };
39475
- function ie(r4) {
39528
+ var D = { types: {} };
39529
+ function oe(r4) {
39476
39530
  if (r4.startsWith("T"))
39477
39531
  return r4 + "T00:00:00.000Z".substring(r4.length);
39478
39532
  if (r4.length <= 10)
@@ -39483,8 +39537,8 @@ function ie(r4) {
39483
39537
  return r4;
39484
39538
  }
39485
39539
  }
39486
- var le = () => [];
39487
- var S = { 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) => {
39488
39542
  for (let t of e)
39489
39543
  if (!t.value)
39490
39544
  return d(false);
@@ -39504,12 +39558,12 @@ var S = { empty: (r4, e) => d(e.length === 0), exists: (r4, e, t) => t ? d(e.fil
39504
39558
  if (!t.value)
39505
39559
  return d(true);
39506
39560
  return d(false);
39507
- }, 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) => {
39508
39562
  let t = [];
39509
39563
  for (let n of e)
39510
39564
  t.some((i2) => i2.value === n.value) || t.push(n);
39511
39565
  return t;
39512
- }, isDistinct: (r4, e) => d(e.length === S.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) => {
39513
39567
  if (e.length > 1)
39514
39568
  throw new Error("Expected input length one for single()");
39515
39569
  return e.length === 0 ? [] : e.slice(0, 1);
@@ -39541,21 +39595,21 @@ var S = { empty: (r4, e) => d(e.length === 0), exists: (r4, e, t) => t ? d(e.fil
39541
39595
  if (!t)
39542
39596
  return e;
39543
39597
  let n = t.eval(r4, e);
39544
- return Ce([...e, ...n]);
39598
+ return ke([...e, ...n]);
39545
39599
  }, combine: (r4, e, t) => {
39546
39600
  if (!t)
39547
39601
  return e;
39548
39602
  let n = t.eval(r4, e);
39549
39603
  return [...e, ...n];
39550
- }, 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) => {
39551
39605
  let o = t.eval(r4, e);
39552
39606
  if (o.length > 1 || o.length === 1 && typeof o[0].value != "boolean")
39553
39607
  throw new Error("Expected criterion to evaluate to a Boolean");
39554
- 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) : [];
39555
39609
  }, toBoolean: (r4, e) => {
39556
39610
  if (e.length === 0)
39557
39611
  return [];
39558
- let [{ value: t }] = L(e, 1);
39612
+ let [{ value: t }] = U(e, 1);
39559
39613
  if (typeof t == "boolean")
39560
39614
  return [{ type: c.boolean, value: t }];
39561
39615
  if (typeof t == "number" && (t === 0 || t === 1))
@@ -39571,47 +39625,47 @@ var S = { empty: (r4, e) => d(e.length === 0), exists: (r4, e, t) => t ? d(e.fil
39571
39625
  }, convertsToBoolean: (r4, e) => e.length === 0 ? [] : d(S.toBoolean(r4, e).length === 1), toInteger: (r4, e) => {
39572
39626
  if (e.length === 0)
39573
39627
  return [];
39574
- let [{ value: t }] = L(e, 1);
39628
+ let [{ value: t }] = U(e, 1);
39575
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 }] : [];
39576
39630
  }, convertsToInteger: (r4, e) => e.length === 0 ? [] : d(S.toInteger(r4, e).length === 1), toDate: (r4, e) => {
39577
39631
  if (e.length === 0)
39578
39632
  return [];
39579
- let [{ value: t }] = L(e, 1);
39580
- return typeof t == "string" && /^\d{4}(-\d{2}(-\d{2})?)?/.exec(t) ? [{ type: c.date, value: ie(t) }] : [];
39633
+ let [{ value: t }] = U(e, 1);
39634
+ return typeof t == "string" && /^\d{4}(-\d{2}(-\d{2})?)?/.exec(t) ? [{ type: c.date, value: oe(t) }] : [];
39581
39635
  }, convertsToDate: (r4, e) => e.length === 0 ? [] : d(S.toDate(r4, e).length === 1), toDateTime: (r4, e) => {
39582
39636
  if (e.length === 0)
39583
39637
  return [];
39584
- let [{ value: t }] = L(e, 1);
39585
- return typeof t == "string" && /^\d{4}(-\d{2}(-\d{2})?)?/.exec(t) ? [{ type: c.dateTime, value: ie(t) }] : [];
39638
+ let [{ value: t }] = U(e, 1);
39639
+ return typeof t == "string" && /^\d{4}(-\d{2}(-\d{2})?)?/.exec(t) ? [{ type: c.dateTime, value: oe(t) }] : [];
39586
39640
  }, convertsToDateTime: (r4, e) => e.length === 0 ? [] : d(S.toDateTime(r4, e).length === 1), toDecimal: (r4, e) => {
39587
39641
  if (e.length === 0)
39588
39642
  return [];
39589
- let [{ value: t }] = L(e, 1);
39643
+ let [{ value: t }] = U(e, 1);
39590
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 }] : [];
39591
39645
  }, convertsToDecimal: (r4, e) => e.length === 0 ? [] : d(S.toDecimal(r4, e).length === 1), toQuantity: (r4, e) => {
39592
39646
  if (e.length === 0)
39593
39647
  return [];
39594
- let [{ value: t }] = L(e, 1);
39648
+ let [{ value: t }] = U(e, 1);
39595
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" } }] : [];
39596
39650
  }, convertsToQuantity: (r4, e) => e.length === 0 ? [] : d(S.toQuantity(r4, e).length === 1), toString: (r4, e) => {
39597
39651
  if (e.length === 0)
39598
39652
  return [];
39599
- let [{ value: t }] = L(e, 1);
39653
+ let [{ value: t }] = U(e, 1);
39600
39654
  return t == null ? [] : b(t) ? [{ type: c.string, value: `${t.value} '${t.unit}'` }] : [{ type: c.string, value: t.toString() }];
39601
39655
  }, convertsToString: (r4, e) => e.length === 0 ? [] : d(S.toString(r4, e).length === 1), toTime: (r4, e) => {
39602
39656
  if (e.length === 0)
39603
39657
  return [];
39604
- let [{ value: t }] = L(e, 1);
39658
+ let [{ value: t }] = U(e, 1);
39605
39659
  if (typeof t == "string") {
39606
39660
  let n = /^T?(\d{2}(:\d{2}(:\d{2})?)?)/.exec(t);
39607
39661
  if (n)
39608
- return [{ type: c.time, value: ie("T" + n[1]) }];
39662
+ return [{ type: c.time, value: oe("T" + n[1]) }];
39609
39663
  }
39610
39664
  return [];
39611
- }, convertsToTime: (r4, e) => e.length === 0 ? [] : d(S.toTime(r4, e).length === 1), indexOf: (r4, e, t) => w((n, i2) => n.indexOf(i2), r4, e, t), substring: (r4, e, t, n) => w((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) => {
39612
39666
  let a = o, u2 = s ? a + s : i2.length;
39613
39667
  return a < 0 || a >= i2.length ? void 0 : i2.substring(a, u2);
39614
- }, r4, e, t, n), startsWith: (r4, e, t) => w((n, i2) => n.startsWith(i2), r4, e, t), endsWith: (r4, e, t) => w((n, i2) => n.endsWith(i2), r4, e, t), contains: (r4, e, t) => w((n, i2) => n.includes(i2), r4, e, t), upper: (r4, e) => w((t) => t.toUpperCase(), r4, e), lower: (r4, e) => w((t) => t.toLowerCase(), r4, e), replace: (r4, e, t, n) => w((i2, o, s) => i2.replaceAll(o, s), r4, e, t, n), matches: (r4, e, t) => w((n, i2) => !!new RegExp(i2).exec(n), r4, e, t), replaceMatches: (r4, e, t, n) => w((i2, o, s) => i2.replaceAll(o, s), r4, e, t, n), length: (r4, e) => w((t) => t.length, r4, e), toChars: (r4, e) => w((t) => t ? t.split("") : void 0, r4, e), abs: (r4, e) => U(Math.abs, r4, e), ceiling: (r4, e) => U(Math.ceil, r4, e), exp: (r4, e) => U(Math.exp, r4, e), floor: (r4, e) => U(Math.floor, r4, e), ln: (r4, e) => U(Math.log, r4, e), log: (r4, e, t) => U((n, i2) => Math.log(n) / Math.log(i2), r4, e, t), power: (r4, e, t) => U(Math.pow, r4, e, t), round: (r4, e) => U(Math.round, r4, e), sqrt: (r4, e) => U(Math.sqrt, r4, e), truncate: (r4, e) => U((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) => {
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) => {
39615
39669
  let o = S.toDateTime(r4, t.eval(r4, e));
39616
39670
  if (o.length === 0)
39617
39671
  throw new Error("Invalid start date");
@@ -39621,11 +39675,11 @@ var S = { empty: (r4, e) => d(e.length === 0), exists: (r4, e, t) => t ? d(e.fil
39621
39675
  let a = i2.eval(r4, e)[0]?.value;
39622
39676
  if (a !== "years" && a !== "months" && a !== "days")
39623
39677
  throw new Error("Invalid units");
39624
- let u2 = Se(o[0].value, s[0].value);
39678
+ let u2 = Re(o[0].value, s[0].value);
39625
39679
  return [{ type: c.Quantity, value: { value: u2[a], unit: a } }];
39626
39680
  }, is: (r4, e, t) => {
39627
39681
  let n = "";
39628
- return t instanceof q ? n = t.name : t instanceof K && (n = t.left.name + "." + t.right.name), n ? e.map((i2) => ({ type: c.boolean, value: we(i2, n) })) : [];
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) })) : [];
39629
39683
  }, not: (r4, e) => S.toBoolean(r4, e).map((t) => ({ type: c.boolean, value: !t.value })), resolve: (r4, e) => e.map((t) => {
39630
39684
  let n = t.value, i2;
39631
39685
  if (typeof n == "string")
@@ -39633,7 +39687,7 @@ var S = { empty: (r4, e) => d(e.length === 0), exists: (r4, e, t) => t ? d(e.fil
39633
39687
  else if (typeof n == "object") {
39634
39688
  let o = n;
39635
39689
  if (o.resource)
39636
- return T(o.resource);
39690
+ return g(o.resource);
39637
39691
  o.reference ? i2 = o.reference : o.type && o.identifier && (i2 = `${o.type}?identifier=${o.identifier.system}|${o.identifier.value}`);
39638
39692
  }
39639
39693
  if (i2?.includes("?")) {
@@ -39645,32 +39699,32 @@ var S = { empty: (r4, e) => d(e.length === 0), exists: (r4, e, t) => t ? d(e.fil
39645
39699
  return { type: o, value: { resourceType: o, id: s } };
39646
39700
  }
39647
39701
  return { type: c.BackboneElement, value: void 0 };
39648
- }).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) => {
39649
39703
  let n = t.eval(r4, e)[0].value;
39650
39704
  if (!n.startsWith("http://hl7.org/fhir/StructureDefinition/"))
39651
39705
  throw new Error("Expected a StructureDefinition URL");
39652
39706
  let i2 = n.replace("http://hl7.org/fhir/StructureDefinition/", "");
39653
39707
  return e.map((o) => ({ type: c.boolean, value: o.value?.resourceType === i2 }));
39654
39708
  } };
39655
- function w(r4, e, t, ...n) {
39709
+ function k(r4, e, t, ...n) {
39656
39710
  if (t.length === 0)
39657
39711
  return [];
39658
- let [{ value: i2 }] = L(t, 1);
39712
+ let [{ value: i2 }] = U(t, 1);
39659
39713
  if (typeof i2 != "string")
39660
39714
  throw new Error("String function cannot be called with non-string");
39661
39715
  let o = r4(i2, ...n.map((s) => s?.eval(e, t)[0]?.value));
39662
- 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)];
39663
39717
  }
39664
- function U(r4, e, t, ...n) {
39718
+ function L(r4, e, t, ...n) {
39665
39719
  if (t.length === 0)
39666
39720
  return [];
39667
- let [{ value: i2 }] = L(t, 1), o = b(i2), s = o ? i2.value : i2;
39721
+ let [{ value: i2 }] = U(t, 1), o = b(i2), s = o ? i2.value : i2;
39668
39722
  if (typeof s != "number")
39669
39723
  throw new Error("Math function cannot be called with non-number");
39670
39724
  let a = r4(s, ...n.map((f) => f.eval(e, t)[0]?.value)), u2 = o ? c.Quantity : t[0].type, l2 = o ? { ...i2, value: a } : a;
39671
39725
  return [{ type: u2, value: l2 }];
39672
39726
  }
39673
- function L(r4, e) {
39727
+ function U(r4, e) {
39674
39728
  if (r4.length !== e)
39675
39729
  throw new Error(`Expected ${e} arguments`);
39676
39730
  for (let t of r4)
@@ -39678,7 +39732,7 @@ function L(r4, e) {
39678
39732
  throw new Error("Expected non-null argument");
39679
39733
  return r4;
39680
39734
  }
39681
- var D = class {
39735
+ var N = class {
39682
39736
  constructor(e) {
39683
39737
  this.value = e;
39684
39738
  }
@@ -39708,13 +39762,13 @@ var q = class {
39708
39762
  evalValue(e) {
39709
39763
  let t = e.value;
39710
39764
  if (!(!t || typeof t != "object"))
39711
- return _(t) && t.resourceType === this.name ? e : O(e, this.name);
39765
+ return M(t) && t.resourceType === this.name ? e : A(e, this.name);
39712
39766
  }
39713
39767
  toString() {
39714
39768
  return this.name;
39715
39769
  }
39716
39770
  };
39717
- var Fe = class {
39771
+ var Le = class {
39718
39772
  eval() {
39719
39773
  return [];
39720
39774
  }
@@ -39722,7 +39776,7 @@ var Fe = class {
39722
39776
  return "{}";
39723
39777
  }
39724
39778
  };
39725
- var _e = class extends Te {
39779
+ var Ue = class extends Ee {
39726
39780
  constructor(t, n, i2) {
39727
39781
  super(t, n);
39728
39782
  this.impl = i2;
@@ -39757,10 +39811,10 @@ var R = class extends v {
39757
39811
  if (o.length !== 1)
39758
39812
  return [];
39759
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);
39760
- 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)];
39761
39815
  }
39762
39816
  };
39763
- var Ue = class extends j {
39817
+ var Be = class extends j {
39764
39818
  constructor(e, t) {
39765
39819
  super("&", e, t);
39766
39820
  }
@@ -39769,7 +39823,7 @@ var Ue = class extends j {
39769
39823
  return o.length > 0 && o.every((s) => typeof s.value == "string") ? [{ type: c.string, value: o.map((s) => s.value).join("") }] : o;
39770
39824
  }
39771
39825
  };
39772
- var Le = class extends v {
39826
+ var qe = class extends v {
39773
39827
  constructor(e, t) {
39774
39828
  super("contains", e, t);
39775
39829
  }
@@ -39778,16 +39832,16 @@ var Le = class extends v {
39778
39832
  return d(n.some((o) => o.value === i2[0].value));
39779
39833
  }
39780
39834
  };
39781
- var Me = class extends v {
39835
+ var $e = class extends v {
39782
39836
  constructor(e, t) {
39783
39837
  super("in", e, t);
39784
39838
  }
39785
39839
  eval(e, t) {
39786
- 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);
39787
39841
  return n ? d(i2.some((o) => o.value === n.value)) : [];
39788
39842
  }
39789
39843
  };
39790
- var K = class extends j {
39844
+ var H = class extends j {
39791
39845
  constructor(e, t) {
39792
39846
  super(".", e, t);
39793
39847
  }
@@ -39798,49 +39852,49 @@ var K = class extends j {
39798
39852
  return `${this.left.toString()}.${this.right.toString()}`;
39799
39853
  }
39800
39854
  };
39801
- var oe = class extends j {
39855
+ var se = class extends j {
39802
39856
  constructor(e, t) {
39803
39857
  super("|", e, t);
39804
39858
  }
39805
39859
  eval(e, t) {
39806
39860
  let n = this.left.eval(e, t), i2 = this.right.eval(e, t);
39807
- return Ce([...n, ...i2]);
39861
+ return ke([...n, ...i2]);
39808
39862
  }
39809
39863
  };
39810
- var Be = class extends v {
39864
+ var je = class extends v {
39811
39865
  constructor(e, t) {
39812
39866
  super("=", e, t);
39813
39867
  }
39814
39868
  eval(e, t) {
39815
39869
  let n = this.left.eval(e, t), i2 = this.right.eval(e, t);
39816
- return dt(n, i2);
39870
+ return mt(n, i2);
39817
39871
  }
39818
39872
  };
39819
- var qe = class extends v {
39873
+ var Qe = class extends v {
39820
39874
  constructor(e, t) {
39821
39875
  super("!=", e, t);
39822
39876
  }
39823
39877
  eval(e, t) {
39824
39878
  let n = this.left.eval(e, t), i2 = this.right.eval(e, t);
39825
- return lt(dt(n, i2));
39879
+ return ft(mt(n, i2));
39826
39880
  }
39827
39881
  };
39828
- var $e = class extends v {
39882
+ var He = class extends v {
39829
39883
  constructor(e, t) {
39830
39884
  super("~", e, t);
39831
39885
  }
39832
39886
  eval(e, t) {
39833
39887
  let n = this.left.eval(e, t), i2 = this.right.eval(e, t);
39834
- return pt(n, i2);
39888
+ return ht(n, i2);
39835
39889
  }
39836
39890
  };
39837
- var je = class extends v {
39891
+ var Ge = class extends v {
39838
39892
  constructor(e, t) {
39839
39893
  super("!~", e, t);
39840
39894
  }
39841
39895
  eval(e, t) {
39842
39896
  let n = this.left.eval(e, t), i2 = this.right.eval(e, t);
39843
- return lt(pt(n, i2));
39897
+ return ft(ht(n, i2));
39844
39898
  }
39845
39899
  };
39846
39900
  var X = class extends v {
@@ -39852,42 +39906,42 @@ var X = class extends v {
39852
39906
  if (n.length !== 1)
39853
39907
  return [];
39854
39908
  let i2 = this.right.name;
39855
- return d(we(n[0], i2));
39909
+ return d(Oe(n[0], i2));
39856
39910
  }
39857
39911
  };
39858
- var Qe = class extends v {
39912
+ var Ke = class extends v {
39859
39913
  constructor(e, t) {
39860
39914
  super("and", e, t);
39861
39915
  }
39862
39916
  eval(e, t) {
39863
- 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");
39864
39918
  return n?.value === true && i2?.value === true ? d(true) : n?.value === false || i2?.value === false ? d(false) : [];
39865
39919
  }
39866
39920
  };
39867
- var He = class extends v {
39921
+ var We = class extends v {
39868
39922
  constructor(e, t) {
39869
39923
  super("or", e, t);
39870
39924
  }
39871
39925
  eval(e, t) {
39872
- 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");
39873
39927
  return n?.value === false && i2?.value === false ? d(false) : n?.value || i2?.value ? d(true) : [];
39874
39928
  }
39875
39929
  };
39876
- var Ke = class extends v {
39930
+ var ze = class extends v {
39877
39931
  constructor(e, t) {
39878
39932
  super("xor", e, t);
39879
39933
  }
39880
39934
  eval(e, t) {
39881
- 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");
39882
39936
  return !n || !i2 ? [] : d(n.value !== i2.value);
39883
39937
  }
39884
39938
  };
39885
- var We = class extends v {
39939
+ var Je = class extends v {
39886
39940
  constructor(e, t) {
39887
39941
  super("implies", e, t);
39888
39942
  }
39889
39943
  eval(e, t) {
39890
- 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");
39891
39945
  return i2?.value === true || n?.value === false ? d(true) : !n || !i2 ? [] : d(false);
39892
39946
  }
39893
39947
  };
@@ -39925,21 +39979,21 @@ var Z = class {
39925
39979
  return `${this.left.toString()}[${this.expr.toString()}]`;
39926
39980
  }
39927
39981
  };
39928
- var pe = ["!=", "!~", "<=", ">=", "{}", "->"];
39982
+ var ye = ["!=", "!~", "<=", ">=", "{}", "->"];
39929
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 };
39930
- var ii = { parse(r4) {
39984
+ var Ri = { parse(r4) {
39931
39985
  let e = r4.consumeAndParse();
39932
39986
  if (!r4.match(")"))
39933
39987
  throw new Error("Parse error: expected `)` got `" + r4.peek()?.value + "`");
39934
39988
  return e;
39935
39989
  } };
39936
- var oi = { parse(r4, e) {
39990
+ var Pi = { parse(r4, e) {
39937
39991
  let t = r4.consumeAndParse();
39938
39992
  if (!r4.match("]"))
39939
39993
  throw new Error("Parse error: expected `]`");
39940
39994
  return new Z(e, t);
39941
39995
  }, precedence: m.Indexer };
39942
- var si = { parse(r4, e) {
39996
+ var Ai = { parse(r4, e) {
39943
39997
  if (!(e instanceof q))
39944
39998
  throw new Error("Unexpected parentheses");
39945
39999
  let t = [];
@@ -39947,45 +40001,45 @@ var si = { parse(r4, e) {
39947
40001
  t.push(r4.consumeAndParse()), r4.match(",");
39948
40002
  return new $(e.name, t);
39949
40003
  }, precedence: m.FunctionCall };
39950
- function ai(r4) {
40004
+ function Ci(r4) {
39951
40005
  let e = r4.split(" "), t = parseFloat(e[0]), n = e[1];
39952
40006
  return n?.startsWith("'") && n.endsWith("'") ? n = n.substring(1, n.length - 1) : n = "{" + n + "}", { value: t, unit: n };
39953
40007
  }
39954
- function fe() {
39955
- return new ve().registerPrefix("String", { parse: (r4, e) => new D({ type: c.string, value: e.value }) }).registerPrefix("DateTime", { parse: (r4, e) => new D({ type: c.dateTime, value: ie(e.value) }) }).registerPrefix("Quantity", { parse: (r4, e) => new D({ type: c.Quantity, value: ai(e.value) }) }).registerPrefix("Number", { parse: (r4, e) => new D({ type: c.decimal, value: parseFloat(e.value) }) }).registerPrefix("true", { parse: () => new D({ type: c.boolean, value: true }) }).registerPrefix("false", { parse: () => new D({ type: c.boolean, value: false }) }).registerPrefix("Symbol", { parse: (r4, e) => new q(e.value) }).registerPrefix("{}", { parse: () => new Fe() }).registerPrefix("(", ii).registerInfix("[", oi).registerInfix("(", si).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 K(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 oe(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 $e(r4, t)).infixLeft("!~", m.NotEquivalent, (r4, e, t) => new je(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 Ue(r4, t)).infixLeft("and", m.And, (r4, e, t) => new Qe(r4, t)).infixLeft("as", m.As, (r4, e, t) => new Y(r4, t)).infixLeft("contains", m.Contains, (r4, e, t) => new Le(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 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 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));
39956
40010
  }
39957
- var ci = fe();
39958
- var Or = ((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))(Or || {});
39959
- var hi = ((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))(hi || {});
39960
- 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 || {});
39961
- function jr(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) {
39962
40016
  if (typeof window < "u")
39963
40017
  return window.atob(r4);
39964
40018
  if (typeof Buffer < "u")
39965
40019
  return Buffer.from(r4, "base64").toString("binary");
39966
40020
  throw new Error("Unable to decode base64");
39967
40021
  }
39968
- function Qr(r4) {
40022
+ function Zr(r4) {
39969
40023
  if (typeof window < "u")
39970
40024
  return window.btoa(r4);
39971
40025
  if (typeof Buffer < "u")
39972
40026
  return Buffer.from(r4, "binary").toString("base64");
39973
40027
  throw new Error("Unable to encode base64");
39974
40028
  }
39975
- function Dt() {
40029
+ function Ut() {
39976
40030
  let r4 = new Uint32Array(28);
39977
- return crypto.getRandomValues(r4), er(r4.buffer);
40031
+ return crypto.getRandomValues(r4), cr(r4.buffer);
39978
40032
  }
39979
- async function Hr(r4) {
40033
+ async function en(r4) {
39980
40034
  return crypto.subtle.digest("SHA-256", new TextEncoder().encode(r4));
39981
40035
  }
39982
- function ye() {
40036
+ function ee() {
39983
40037
  return "xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g, (r4) => {
39984
40038
  let e = Math.random() * 16 | 0;
39985
40039
  return (r4 === "x" ? e : e & 3 | 8).toString(16);
39986
40040
  });
39987
40041
  }
39988
- var ze = class {
40042
+ var Xe = class {
39989
40043
  constructor(e = 10) {
39990
40044
  this.max = e, this.cache = /* @__PURE__ */ new Map();
39991
40045
  }
@@ -40009,8 +40063,8 @@ var ze = class {
40009
40063
  return this.cache.keys().next().value;
40010
40064
  }
40011
40065
  };
40012
- var I = { 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" };
40013
- 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 {
40014
40068
  constructor() {
40015
40069
  this.listeners = {};
40016
40070
  }
@@ -40035,9 +40089,9 @@ var ge = class {
40035
40089
  return !e.defaultPrevented;
40036
40090
  }
40037
40091
  };
40038
- var Je = class {
40092
+ var Ze = class {
40039
40093
  constructor() {
40040
- this.emitter = new ge();
40094
+ this.emitter = new Te();
40041
40095
  }
40042
40096
  dispatchEvent(e) {
40043
40097
  this.emitter.dispatchEvent(e);
@@ -40049,41 +40103,41 @@ var Je = class {
40049
40103
  this.emitter.removeEventListener(e, t);
40050
40104
  }
40051
40105
  };
40052
- var Nt = { "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" };
40053
- var Hi = ["Patient", "Encounter", "ImagingStudy", "DiagnosticReport", "OperationOutcome", "Bundle"];
40054
- var Ft = ["DiagnosticReport-update"];
40055
- function Gr(r4) {
40056
- return Ft.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);
40057
40111
  }
40058
- function zr(r4) {
40059
- if (Ft.includes(r4))
40112
+ function on(r4) {
40113
+ if (qt.includes(r4))
40060
40114
  throw new p(h(`'context.version' is required for '${r4}'.`));
40061
40115
  }
40062
- var Ki = { "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" } } };
40063
- function Wi(r4) {
40064
- return Hi.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);
40065
40119
  }
40066
- function Jr(r4) {
40120
+ function sn(r4) {
40067
40121
  return !!r4.endpoint;
40068
40122
  }
40069
- function _t(r4) {
40070
- if (!Xe(r4))
40123
+ function $t(r4) {
40124
+ if (!tt(r4))
40071
40125
  throw new p(h("subscriptionRequest must be an object conforming to SubscriptionRequest type."));
40072
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(",") };
40073
- return Jr(r4) && (o.endpoint = r4.endpoint), new URLSearchParams(o).toString();
40127
+ return sn(r4) && (o.endpoint = r4.endpoint), new URLSearchParams(o).toString();
40074
40128
  }
40075
- function Xe(r4) {
40129
+ function tt(r4) {
40076
40130
  if (typeof r4 != "object")
40077
40131
  return false;
40078
40132
  let { channelType: e, mode: t, topic: n, events: i2 } = r4;
40079
40133
  if (!(e && t && n && i2) || typeof n != "string" || typeof i2 != "object" || !Array.isArray(i2) || i2.length < 1 || e !== "websocket" || t !== "subscribe" && t !== "unsubscribe")
40080
40134
  return false;
40081
40135
  for (let o of i2)
40082
- if (!Nt[o])
40136
+ if (!Bt[o])
40083
40137
  return false;
40084
- return !(Jr(r4) && !(typeof r4.endpoint == "string" && r4.endpoint.startsWith("ws")));
40138
+ return !(sn(r4) && !(typeof r4.endpoint == "string" && r4.endpoint.startsWith("ws")));
40085
40139
  }
40086
- function Wr(r4, e, t, n) {
40140
+ function rn(r4, e, t, n) {
40087
40141
  if (typeof e != "object")
40088
40142
  throw new p(h(`context[${t}] is invalid. Context must contain a single valid FHIR resource! Resource is not an object.`));
40089
40143
  if (!(e.id && typeof e.id == "string"))
@@ -40092,30 +40146,30 @@ function Wr(r4, e, t, n) {
40092
40146
  throw new p(h(`context[${t}] is invalid. Resource must contain a resource type. No resource type found.`));
40093
40147
  let i2 = n.resourceType;
40094
40148
  if (i2 !== "*") {
40095
- if (!Wi(e.resourceType))
40149
+ if (!mo(e.resourceType))
40096
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.`));
40097
40151
  if (i2 && e.resourceType !== i2)
40098
40152
  throw new p(h(`context[${t}] is invalid. context[${t}] for the '${r4}' event should contain resource of type ${i2}.`));
40099
40153
  }
40100
40154
  }
40101
- function Gi(r4, e, t, n, i2) {
40155
+ function ho(r4, e, t, n, i2) {
40102
40156
  if (i2.set(e.key, (i2.get(e.key) ?? 0) + 1), !n.isArray)
40103
- Wr(r4, e.resource, t, n);
40157
+ rn(r4, e.resource, t, n);
40104
40158
  else {
40105
40159
  let { resources: o } = e;
40106
40160
  if (!o)
40107
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'.`));
40108
40162
  for (let s of o)
40109
- Wr(r4, s, t, n);
40163
+ rn(r4, s, t, n);
40110
40164
  }
40111
40165
  }
40112
- function zi(r4, e) {
40113
- let t = /* @__PURE__ */ new Map(), n = Ki[r4];
40166
+ function yo(r4, e) {
40167
+ let t = /* @__PURE__ */ new Map(), n = fo[r4];
40114
40168
  for (let i2 = 0; i2 < e.length; i2++) {
40115
40169
  let o = e[i2].key;
40116
40170
  if (!n[o])
40117
40171
  throw new p(h(`Key '${o}' not found for event '${r4}'. Make sure to add only valid keys.`));
40118
- Gi(r4, e[i2], i2, n[o], t);
40172
+ ho(r4, e[i2], i2, n[o], t);
40119
40173
  }
40120
40174
  for (let [i2, o] of Object.entries(n)) {
40121
40175
  if (!(o.optional || t.has(i2)))
@@ -40124,24 +40178,24 @@ function zi(r4, e) {
40124
40178
  throw new p(h(`${t.get(i2)} context entries with key '${i2}' found for the '${r4}' event when schema only allows for 1.`));
40125
40179
  }
40126
40180
  }
40127
- function Ut(r4, e, t, n) {
40181
+ function jt(r4, e, t, n) {
40128
40182
  if (!(r4 && typeof r4 == "string"))
40129
40183
  throw new p(h("Must provide a topic."));
40130
- if (!Nt[e])
40131
- throw new p(h(`Must provide a valid FHIRcast event name. Supported events: ${Object.keys(Nt).join(", ")}`));
40184
+ if (!Bt[e])
40185
+ throw new p(h(`Must provide a valid FHIRcast event name. Supported events: ${Object.keys(Bt).join(", ")}`));
40132
40186
  if (typeof t != "object")
40133
40187
  throw new p(h("context must be a context object or array of context objects."));
40134
- if (Ft.includes(e) && !n)
40188
+ if (qt.includes(e) && !n)
40135
40189
  throw new p(h(`The '${e}' event must contain a 'context.versionId'.`));
40136
40190
  let i2 = Array.isArray(t) ? t : [t];
40137
- return zi(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 } : {} } };
40138
40192
  }
40139
- var Ye = class extends Je {
40193
+ var et = class extends Ze {
40140
40194
  constructor(t) {
40141
40195
  super();
40142
40196
  if (this.subRequest = t, !t.endpoint)
40143
40197
  throw new p(h("Subscription request should contain an endpoint."));
40144
- if (!Xe(t))
40198
+ if (!tt(t))
40145
40199
  throw new p(h("Subscription request failed validation."));
40146
40200
  let n = new WebSocket(t.endpoint);
40147
40201
  n.addEventListener("open", () => {
@@ -40160,31 +40214,31 @@ var Ye = class extends Je {
40160
40214
  this.websocket.close();
40161
40215
  }
40162
40216
  };
40163
- function Ji(r4) {
40164
- let e = r4.replace(/-/g, "+").replace(/_/g, "/"), t = jr(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) => {
40165
40219
  let a = ("00" + s.charCodeAt(0).toString(16)).slice(-2);
40166
40220
  return `${o}%${a}`;
40167
40221
  }, ""), i2 = decodeURIComponent(n);
40168
40222
  return JSON.parse(i2);
40169
40223
  }
40170
- function Yr(r4) {
40224
+ function an(r4) {
40171
40225
  return r4.split(".").length === 3;
40172
40226
  }
40173
- function Lt(r4) {
40227
+ function Qt(r4) {
40174
40228
  let [e, t, n] = r4.split(".");
40175
- return Ji(t);
40229
+ return go(t);
40176
40230
  }
40177
- function Xr(r4) {
40231
+ function cn(r4) {
40178
40232
  try {
40179
- return typeof Lt(r4).login_id == "string";
40233
+ return typeof Qt(r4).login_id == "string";
40180
40234
  } catch {
40181
40235
  return false;
40182
40236
  }
40183
40237
  }
40184
- var Yi;
40185
- var k = class {
40238
+ var xo;
40239
+ var C = class {
40186
40240
  constructor(e) {
40187
- this[Yi] = "ReadablePromise";
40241
+ this[xo] = "ReadablePromise";
40188
40242
  this.status = "pending";
40189
40243
  this.suspender = e.then((t) => (this.status = "success", this.response = t, t), (t) => {
40190
40244
  throw this.status = "error", this.error = t, t;
@@ -40216,10 +40270,10 @@ var k = class {
40216
40270
  return this.suspender.finally(e);
40217
40271
  }
40218
40272
  };
40219
- Yi = Symbol.toStringTag;
40220
- var Ze = class {
40273
+ xo = Symbol.toStringTag;
40274
+ var ve = class {
40221
40275
  constructor(e) {
40222
- this.storage = e ?? (typeof localStorage < "u" ? localStorage : new Mt());
40276
+ this.storage = e ?? (typeof localStorage < "u" ? localStorage : new Ht());
40223
40277
  }
40224
40278
  clear() {
40225
40279
  this.storage.clear();
@@ -40235,10 +40289,10 @@ var Ze = class {
40235
40289
  return t ? JSON.parse(t) : void 0;
40236
40290
  }
40237
40291
  setObject(e, t) {
40238
- this.setString(e, t ? Yt(t) : void 0);
40292
+ this.setString(e, t ? or(t) : void 0);
40239
40293
  }
40240
40294
  };
40241
- var Mt = class {
40295
+ var Ht = class {
40242
40296
  constructor() {
40243
40297
  this.data = /* @__PURE__ */ new Map();
40244
40298
  }
@@ -40261,23 +40315,23 @@ var Mt = class {
40261
40315
  return Array.from(this.data.keys())[e];
40262
40316
  }
40263
40317
  };
40264
- var Xi = I.FHIR_JSON + ", */*; q=0.1";
40265
- var Zi = "https://api.medplum.com/";
40266
- var eo = 1e3;
40267
- var to = 6e4;
40268
- var Zr = "Binary/";
40269
- var en = { resourceType: "Device", id: "system", deviceName: [{ name: "System" }] };
40270
- var ro = ((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))(ro || {});
40271
- var no = ((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))(no || {});
40272
- var io = ((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))(io || {});
40273
- var oo = ((e) => (e.JwtBearer = "urn:ietf:params:oauth:client-assertion-type:jwt-bearer", e))(oo || {});
40274
- var tn = 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 {
40275
40329
  constructor(t) {
40276
40330
  super();
40277
40331
  this.initComplete = true;
40278
40332
  if (t?.baseUrl && !t.baseUrl.startsWith("http"))
40279
40333
  throw new Error("Base URL must start with http or https");
40280
- if (this.options = t ?? {}, this.fetch = t?.fetch ?? so(), this.storage = t?.storage ?? new Ze(), this.createPdfImpl = t?.createPdf, this.baseUrl = nn(t?.baseUrl ?? Zi), this.fhirBaseUrl = nn(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 ?? to, this.cacheTime > 0 ? this.requestCache = new ze(t?.resourceCacheSize ?? eo) : 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)
40281
40335
  this.setAccessToken(t.accessToken), this.initPromise = Promise.resolve();
40282
40336
  else if (this.storage.getInitPromise !== void 0) {
40283
40337
  let n = this.storage.getInitPromise(), i2 = new Promise((o) => {
@@ -40339,7 +40393,7 @@ var tn = class extends ge {
40339
40393
  t.startsWith(this.fhirBaseUrl) && this.autoBatchQueue ? o = new Promise((a, u2) => {
40340
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));
40341
40395
  }) : o = this.request("GET", t, n);
40342
- let s = new k(o);
40396
+ let s = new C(o);
40343
40397
  return this.setCacheEntry(t, s), s;
40344
40398
  }
40345
40399
  post(t, n, i2, o = {}) {
@@ -40349,7 +40403,7 @@ var tn = class extends ge {
40349
40403
  return t = t.toString(), this.setRequestBody(o, n), i2 && this.setRequestContentType(o, i2), this.invalidateUrl(t), this.request("PUT", t, o);
40350
40404
  }
40351
40405
  patch(t, n, i2 = {}) {
40352
- return t = t.toString(), this.setRequestBody(i2, n), this.setRequestContentType(i2, I.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);
40353
40407
  }
40354
40408
  delete(t, n) {
40355
40409
  return t = t.toString(), this.invalidateUrl(t), this.request("DELETE", t, n);
@@ -40418,7 +40472,7 @@ var tn = class extends ge {
40418
40472
  let o = this.fhirSearchUrl(t, n), s = o.toString() + "-search", a = this.getCacheEntry(s, i2);
40419
40473
  if (a)
40420
40474
  return a.value;
40421
- let u2 = new k((async () => {
40475
+ let u2 = new C((async () => {
40422
40476
  let l2 = await this.get(o, i2);
40423
40477
  if (l2.entry)
40424
40478
  for (let f of l2.entry)
@@ -40433,14 +40487,14 @@ var tn = class extends ge {
40433
40487
  let s = o.toString() + "-searchOne", a = this.getCacheEntry(s, i2);
40434
40488
  if (a)
40435
40489
  return a.value;
40436
- let u2 = new k(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));
40437
40491
  return this.setCacheEntry(s, u2), u2;
40438
40492
  }
40439
40493
  searchResources(t, n, i2) {
40440
40494
  let s = this.fhirSearchUrl(t, n).toString() + "-searchResources", a = this.getCacheEntry(s, i2);
40441
40495
  if (a)
40442
40496
  return a.value;
40443
- let u2 = new k(this.search(t, n, i2).then(sn));
40497
+ let u2 = new C(this.search(t, n, i2).then(yn));
40444
40498
  return this.setCacheEntry(s, u2), u2;
40445
40499
  }
40446
40500
  async *searchResourcePages(t, n, i2) {
@@ -40449,7 +40503,7 @@ var tn = class extends ge {
40449
40503
  let s = new URL(o).searchParams, a = await this.search(t, s, i2), u2 = a.link?.find((l2) => l2.relation === "next");
40450
40504
  if (!a.entry?.length && !u2)
40451
40505
  break;
40452
- yield sn(a), o = u2?.url ? new URL(u2.url) : void 0;
40506
+ yield yn(a), o = u2?.url ? new URL(u2.url) : void 0;
40453
40507
  }
40454
40508
  }
40455
40509
  searchValueSet(t, n, i2) {
@@ -40465,7 +40519,7 @@ var tn = class extends ge {
40465
40519
  if (!n)
40466
40520
  return;
40467
40521
  if (n === "system")
40468
- return en;
40522
+ return dn;
40469
40523
  let [i2, o] = n.split("/");
40470
40524
  if (!(!i2 || !o))
40471
40525
  return this.getCached(i2, o);
@@ -40476,25 +40530,26 @@ var tn = class extends ge {
40476
40530
  readReference(t, n) {
40477
40531
  let i2 = t.reference;
40478
40532
  if (!i2)
40479
- return new k(Promise.reject(new Error("Missing reference")));
40533
+ return new C(Promise.reject(new Error("Missing reference")));
40480
40534
  if (i2 === "system")
40481
- return new k(Promise.resolve(en));
40535
+ return new C(Promise.resolve(dn));
40482
40536
  let [o, s] = i2.split("/");
40483
- return !o || !s ? new k(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);
40484
40538
  }
40485
40539
  requestSchema(t) {
40486
- if (Pr(t))
40540
+ if (Dr(t))
40487
40541
  return Promise.resolve();
40488
40542
  let n = t + "-requestSchema", i2 = this.getCacheEntry(n, void 0);
40489
40543
  if (i2)
40490
40544
  return i2.value;
40491
- let o = new k((async () => {
40545
+ let o = new C((async () => {
40492
40546
  let s = `{
40493
40547
  StructureDefinitionList(name: "${t}") {
40494
40548
  resourceType,
40495
40549
  name,
40496
40550
  kind,
40497
40551
  description,
40552
+ type,
40498
40553
  snapshot {
40499
40554
  element {
40500
40555
  id,
@@ -40510,6 +40565,7 @@ var tn = class extends ge {
40510
40565
  contentReference,
40511
40566
  type {
40512
40567
  code,
40568
+ profile,
40513
40569
  targetProfile
40514
40570
  },
40515
40571
  binding {
@@ -40527,9 +40583,21 @@ var tn = class extends ge {
40527
40583
  target
40528
40584
  }
40529
40585
  }`.replace(/\s+/g, " "), a = await this.graphql(s);
40530
- br(a.data.StructureDefinitionList);
40586
+ It(a.data.StructureDefinitionList);
40531
40587
  for (let u2 of a.data.SearchParameterList)
40532
- Pt(u2);
40588
+ Ot(u2);
40589
+ })());
40590
+ return this.setCacheEntry(n, o), o;
40591
+ }
40592
+ requestProfileSchema(t) {
40593
+ if (_r(t))
40594
+ return Promise.resolve();
40595
+ let n = t + "-requestSchema", i2 = this.getCacheEntry(n, void 0);
40596
+ if (i2)
40597
+ return i2.value;
40598
+ let o = new C((async () => {
40599
+ let s = await this.searchOne("StructureDefinition", { url: t, _sort: "-_lastUpdated" });
40600
+ s ? It([s], t) : console.warn(`No StructureDefinition found for ${t}!`);
40533
40601
  })());
40534
40602
  return this.setCacheEntry(n, o), o;
40535
40603
  }
@@ -40562,11 +40630,11 @@ var tn = class extends ge {
40562
40630
  return new Promise((a, u2) => {
40563
40631
  let l2 = new XMLHttpRequest(), f = () => l2.abort();
40564
40632
  s?.signal?.addEventListener("abort", f);
40565
- let P = (M) => {
40566
- 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);
40567
40635
  };
40568
- 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 = () => {
40569
- l2.status >= 200 && l2.status < 300 ? P(l2.response) : P(new p(De(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)));
40570
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);
40571
40639
  });
40572
40640
  }
@@ -40612,28 +40680,28 @@ var tn = class extends ge {
40612
40680
  return this.post(this.fhirBaseUrl.slice(0, -1), t, void 0, n);
40613
40681
  }
40614
40682
  sendEmail(t, n) {
40615
- return this.post("email/v1/send", t, I.JSON, n);
40683
+ return this.post("email/v1/send", t, O.JSON, n);
40616
40684
  }
40617
40685
  graphql(t, n, i2, o) {
40618
- return this.post(this.fhirUrl("$graphql"), { query: t, operationName: n, variables: i2 }, I.JSON, o);
40686
+ return this.post(this.fhirUrl("$graphql"), { query: t, operationName: n, variables: i2 }, O.JSON, o);
40619
40687
  }
40620
40688
  readResourceGraph(t, n, i2, o) {
40621
40689
  return this.get(`${this.fhirUrl(t, n)}/$graph?graph=${i2}`, o);
40622
40690
  }
40623
40691
  pushToAgent(t, n, i2, o, s, a) {
40624
- return this.post(this.fhirUrl("Agent", Gt(t), "$push"), { destination: ce(n), body: i2, contentType: o, waitForResponse: s }, I.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);
40625
40693
  }
40626
40694
  getActiveLogin() {
40627
40695
  return this.storage.getObject("activeLogin");
40628
40696
  }
40629
40697
  async setActiveLogin(t) {
40630
- (!this.sessionDetails?.profile || ce(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();
40631
40699
  }
40632
40700
  getAccessToken() {
40633
40701
  return this.accessToken;
40634
40702
  }
40635
40703
  setAccessToken(t, n) {
40636
- this.accessToken = t, this.refreshToken = n, this.sessionDetails = void 0, this.medplumServer = Xr(t);
40704
+ this.accessToken = t, this.refreshToken = n, this.sessionDetails = void 0, this.medplumServer = cn(t);
40637
40705
  }
40638
40706
  getLogins() {
40639
40707
  return this.storage.getObject("logins") ?? [];
@@ -40681,11 +40749,11 @@ var tn = class extends ge {
40681
40749
  async download(t, n = {}) {
40682
40750
  this.refreshPromise && await this.refreshPromise;
40683
40751
  let i2 = t.toString();
40684
- return i2.startsWith(Zr) && (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();
40685
40753
  }
40686
40754
  async uploadMedia(t, n, i2, o, s) {
40687
40755
  let a = await this.createBinary(t, i2, n);
40688
- return this.createResource({ resourceType: "Media", status: "completed", content: { contentType: n, url: Zr + 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);
40689
40757
  }
40690
40758
  async bulkExport(t = "", n, i2, o) {
40691
40759
  let s = t && `${t}/`, a = this.fhirUrl(`${s}$export`);
@@ -40697,7 +40765,7 @@ var tn = class extends ge {
40697
40765
  i2.Prefer = "respond-async";
40698
40766
  let o = await this.fetchWithRetry(t, n);
40699
40767
  if (o.status === 202) {
40700
- let s = await on(o);
40768
+ let s = await hn(o);
40701
40769
  if (s)
40702
40770
  return this.pollStatus(s);
40703
40771
  }
@@ -40714,7 +40782,7 @@ var tn = class extends ge {
40714
40782
  this.requestCache && this.requestCache.set(t, { requestTime: Date.now(), value: n });
40715
40783
  }
40716
40784
  cacheResource(t) {
40717
- t?.id && !t.meta?.tag?.some((n) => n.code === "SUBSETTED") && this.setCacheEntry(this.fhirUrl(t.resourceType, t.id).toString(), new k(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)));
40718
40786
  }
40719
40787
  deleteCacheEntry(t) {
40720
40788
  this.requestCache && this.requestCache.delete(t);
@@ -40731,7 +40799,7 @@ var tn = class extends ge {
40731
40799
  return;
40732
40800
  let a = t.headers.get("content-type")?.includes("json");
40733
40801
  if (t.status === 404 && !a)
40734
- throw new p(yr);
40802
+ throw new p(Rr);
40735
40803
  let u2 = t.headers.get("content-location"), l2 = o.redirect ?? this.options.redirect;
40736
40804
  if (t.status === 201 && u2 && l2 === "follow")
40737
40805
  return this.request("GET", u2, { ...o, body: void 0 });
@@ -40745,7 +40813,7 @@ var tn = class extends ge {
40745
40813
  else
40746
40814
  f = await t.text();
40747
40815
  if (t.status >= 400)
40748
- throw new p(De(f));
40816
+ throw new p(_e(f));
40749
40817
  return f;
40750
40818
  }
40751
40819
  async fetchWithRetry(t, n) {
@@ -40758,7 +40826,7 @@ var tn = class extends ge {
40758
40826
  } catch (u2) {
40759
40827
  this.retryCatch(a, i2, u2);
40760
40828
  }
40761
- await at(o);
40829
+ await lt(o);
40762
40830
  }
40763
40831
  return s;
40764
40832
  }
@@ -40779,10 +40847,10 @@ var tn = class extends ge {
40779
40847
  this.addFetchOptionsDefaults(s);
40780
40848
  let a = await this.fetchWithRetry(t, s);
40781
40849
  if (a.status !== 202 && (n = false, i2 = a, a.status === 201)) {
40782
- let u2 = await on(a);
40850
+ let u2 = await hn(a);
40783
40851
  u2 && (i2 = await this.fetchWithRetry(u2, s));
40784
40852
  }
40785
- await at(o);
40853
+ await lt(o);
40786
40854
  }
40787
40855
  return this.parseResponse(i2, "POST", t);
40788
40856
  }
@@ -40793,19 +40861,19 @@ var tn = class extends ge {
40793
40861
  try {
40794
40862
  o.resolve(await this.request(o.method, this.fhirBaseUrl + o.url, o.options));
40795
40863
  } catch (s) {
40796
- o.reject(new p(De(s)));
40864
+ o.reject(new p(_e(s)));
40797
40865
  }
40798
40866
  return;
40799
40867
  }
40800
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);
40801
40869
  for (let o = 0; o < t.length; o++) {
40802
40870
  let s = t[o], a = i2.entry?.[o];
40803
- 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);
40804
40872
  }
40805
40873
  }
40806
40874
  addFetchOptionsDefaults(t) {
40807
40875
  let n = t.headers;
40808
- n || (n = {}, t.headers = n), n.Accept || (n.Accept = Xi), n["X-Medplum"] = "extended", t.body && !n["Content-Type"] && (n["Content-Type"] = I.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");
40809
40877
  }
40810
40878
  setRequestContentType(t, n) {
40811
40879
  t.headers || (t.headers = {});
@@ -40819,20 +40887,20 @@ var tn = class extends ge {
40819
40887
  return this.refresh() ? this.request(t, n, i2) : (this.clearActiveLogin(), this.onUnauthenticated && this.onUnauthenticated(), Promise.reject(new Error("Unauthenticated")));
40820
40888
  }
40821
40889
  async startPkce() {
40822
- let t = Dt();
40890
+ let t = Ut();
40823
40891
  sessionStorage.setItem("pkceState", t);
40824
- let n = Dt();
40892
+ let n = Ut();
40825
40893
  sessionStorage.setItem("codeVerifier", n);
40826
- let i2 = await Hr(n), o = tr(i2).replaceAll("+", "-").replaceAll("/", "_").replaceAll("=", "");
40894
+ let i2 = await en(n), o = ur(i2).replaceAll("+", "-").replaceAll("/", "_").replaceAll("=", "");
40827
40895
  return sessionStorage.setItem("codeChallenge", o), { codeChallengeMethod: "S256", codeChallenge: o };
40828
40896
  }
40829
40897
  async requestAuthorization(t) {
40830
40898
  let n = await this.ensureCodeChallenge(t ?? {}), i2 = new URL(this.authorizeUrl);
40831
- 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 ?? rn()), 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());
40832
40900
  }
40833
40901
  processCode(t, n) {
40834
40902
  let i2 = new URLSearchParams();
40835
- 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 ?? rn()), 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") {
40836
40904
  let o = sessionStorage.getItem("codeVerifier");
40837
40905
  o && i2.set("code_verifier", o);
40838
40906
  }
@@ -40863,30 +40931,30 @@ var tn = class extends ge {
40863
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);
40864
40932
  }
40865
40933
  setBasicAuth(t, n) {
40866
- this.clientId = t, this.clientSecret = n, this.basicAuth = Qr(t + ":" + n);
40934
+ this.clientId = t, this.clientSecret = n, this.basicAuth = Zr(t + ":" + n);
40867
40935
  }
40868
40936
  async fhircastSubscribe(t, n) {
40869
40937
  if (!(typeof t == "string" && t !== ""))
40870
40938
  throw new p(h("Invalid topic provided. Topic must be a valid string."));
40871
40939
  if (!(typeof n == "object" && Array.isArray(n) && n.length > 0))
40872
40940
  throw new p(h("Invalid events provided. Events must be an array of event names containing at least one event."));
40873
- let i2 = { channelType: "websocket", mode: "subscribe", topic: t, events: n }, s = (await this.post("/fhircast/STU3", _t(i2), I.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"];
40874
40942
  if (!s)
40875
40943
  throw new Error("Invalid response!");
40876
40944
  return i2.endpoint = s, i2;
40877
40945
  }
40878
40946
  async fhircastUnsubscribe(t) {
40879
- if (!Xe(t))
40947
+ if (!tt(t))
40880
40948
  throw new p(h("Invalid topic or subscriptionRequest. SubscriptionRequest must be an object."));
40881
40949
  if (!(t.endpoint && typeof t.endpoint == "string" && t.endpoint.startsWith("ws")))
40882
40950
  throw new p(h("Provided subscription request must have an endpoint in order to unsubscribe."));
40883
- t.mode = "unsubscribe", await this.post("/fhircast/STU3", _t(t), I.FORM_URL_ENCODED);
40951
+ t.mode = "unsubscribe", await this.post("/fhircast/STU3", $t(t), O.FORM_URL_ENCODED);
40884
40952
  }
40885
40953
  fhircastConnect(t) {
40886
- return new Ye(t);
40954
+ return new et(t);
40887
40955
  }
40888
40956
  async fhircastPublish(t, n, i2, o) {
40889
- return Gr(n) ? this.post(`/fhircast/STU3/${t}`, Ut(t, n, i2, o), I.JSON) : (zr(n), this.post(`/fhircast/STU3/${t}`, Ut(t, n, i2), I.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));
40890
40958
  }
40891
40959
  async fhircastGetContext(t) {
40892
40960
  return this.get(`/fhircast/STU3/${t}`);
@@ -40895,16 +40963,16 @@ var tn = class extends ge {
40895
40963
  return this.post("admin/projects/" + t + "/invite", n);
40896
40964
  }
40897
40965
  async fetchTokens(t) {
40898
- let n = { method: "POST", headers: { "Content-Type": I.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;
40899
40967
  this.basicAuth && (i2.Authorization = `Basic ${this.basicAuth}`);
40900
40968
  let o = await this.fetchWithRetry(this.tokenUrl, n);
40901
40969
  if (!o.ok) {
40902
40970
  this.clearActiveLogin();
40903
40971
  try {
40904
40972
  let a = await o.json();
40905
- throw new p(C(a.error_description));
40973
+ throw new p(I(a.error_description));
40906
40974
  } catch (a) {
40907
- throw new p(C("Failed to fetch tokens"), a);
40975
+ throw new p(I("Failed to fetch tokens"), a);
40908
40976
  }
40909
40977
  }
40910
40978
  let s = await o.json();
@@ -40912,8 +40980,8 @@ var tn = class extends ge {
40912
40980
  }
40913
40981
  async verifyTokens(t) {
40914
40982
  let n = t.access_token;
40915
- if (Yr(n)) {
40916
- let i2 = Lt(n);
40983
+ if (an(n)) {
40984
+ let i2 = Qt(n);
40917
40985
  if (Date.now() >= i2.exp * 1e3)
40918
40986
  throw this.clearActiveLogin(), new Error("Token expired");
40919
40987
  if (i2.cid) {
@@ -40937,21 +41005,21 @@ var tn = class extends ge {
40937
41005
  throw i2;
40938
41006
  }
40939
41007
  };
40940
- function so() {
41008
+ function Co() {
40941
41009
  if (!globalThis.fetch)
40942
41010
  throw new Error("Fetch not available in this environment");
40943
41011
  return globalThis.fetch.bind(globalThis);
40944
41012
  }
40945
- function rn() {
41013
+ function fn() {
40946
41014
  return typeof window > "u" ? "" : window.location.protocol + "//" + window.location.host + "/";
40947
41015
  }
40948
- function nn(r4) {
41016
+ function mn(r4) {
40949
41017
  return r4.endsWith("/") ? r4 : r4 + "/";
40950
41018
  }
40951
- function et(r4, e) {
41019
+ function rt(r4, e) {
40952
41020
  return new URL(e, r4).toString();
40953
41021
  }
40954
- async function on(r4) {
41022
+ async function hn(r4) {
40955
41023
  let e = r4.headers.get("content-location");
40956
41024
  if (e)
40957
41025
  return e;
@@ -40959,18 +41027,18 @@ async function on(r4) {
40959
41027
  if (t)
40960
41028
  return t;
40961
41029
  let n = await r4.json();
40962
- if (Ve(n) && n.issue?.[0]?.diagnostics)
41030
+ if (Fe(n) && n.issue?.[0]?.diagnostics)
40963
41031
  return n.issue[0].diagnostics;
40964
41032
  }
40965
- function sn(r4) {
41033
+ function yn(r4) {
40966
41034
  let e = r4.entry?.map((t) => t.resource) ?? [];
40967
41035
  return Object.assign(e, { bundle: r4 });
40968
41036
  }
40969
- var ao = [...pe, "->", "<<", ">>"];
40970
- var co = fe().registerInfix("->", { precedence: m.Arrow }).registerInfix(";", { precedence: m.Semicolon });
40971
- var uo = [...pe, "eq", "ne", "co"];
40972
- var fo = fe();
40973
- var G = class {
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();
41041
+ var W = class {
40974
41042
  constructor(e = "\r", t = "|", n = "^", i2 = "~", o = "\\", s = "&") {
40975
41043
  this.segmentSeparator = e;
40976
41044
  this.fieldSeparator = t;
@@ -40986,8 +41054,8 @@ var G = class {
40986
41054
  return this.componentSeparator + this.repetitionSeparator + this.escapeCharacter + this.subcomponentSeparator;
40987
41055
  }
40988
41056
  };
40989
- var ln = class r {
40990
- constructor(e, t = new G()) {
41057
+ var An = class r {
41058
+ constructor(e, t = new W()) {
40991
41059
  this.context = t, this.segments = e;
40992
41060
  }
40993
41061
  get header() {
@@ -41010,7 +41078,7 @@ var ln = class r {
41010
41078
  }
41011
41079
  buildAck() {
41012
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";
41013
- return new r([new xe(["MSH", this.context.getMsh2(), o, s, n, i2, ho(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)]);
41014
41082
  }
41015
41083
  buildAckMessageType(e) {
41016
41084
  let t = e?.getField(9), n = t?.getComponent(2), i2 = t?.getComponent(3), o = "ACK";
@@ -41021,13 +41089,13 @@ var ln = class r {
41021
41089
  let n = new Error("Invalid HL7 message");
41022
41090
  throw n.type = "entity.parse.failed", n;
41023
41091
  }
41024
- let t = new G("\r", e.charAt(3), e.charAt(4), e.charAt(5), e.charAt(6), e.charAt(7));
41025
- return new r(e.split(/[\r\n]+/).map((n) => xe.parse(n, t)), t);
41092
+ let t = new W("\r", e.charAt(3), e.charAt(4), e.charAt(5), e.charAt(6), e.charAt(7));
41093
+ return new r(e.split(/[\r\n]+/).map((n) => Se.parse(n, t)), t);
41026
41094
  }
41027
41095
  };
41028
- var xe = class r2 {
41029
- constructor(e, t = new G()) {
41030
- this.context = t, Xt(e) ? this.fields = e.map((n) => ae.parse(n, t)) : this.fields = e, this.name = this.fields[0].components[0][0];
41096
+ var Se = class r2 {
41097
+ constructor(e, t = new W()) {
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];
41031
41099
  }
41032
41100
  get(e) {
41033
41101
  return this.fields[e];
@@ -41035,9 +41103,9 @@ var xe = class r2 {
41035
41103
  getField(e) {
41036
41104
  if (this.name === "MSH") {
41037
41105
  if (e === 1)
41038
- return new ae([[this.context.getMsh1()]], this.context);
41106
+ return new le([[this.context.getMsh1()]], this.context);
41039
41107
  if (e === 2)
41040
- return new ae([[this.context.getMsh2()]], this.context);
41108
+ return new le([[this.context.getMsh2()]], this.context);
41041
41109
  if (e > 2)
41042
41110
  return this.fields[e - 1];
41043
41111
  }
@@ -41049,12 +41117,12 @@ var xe = class r2 {
41049
41117
  toString() {
41050
41118
  return this.fields.map((e) => e.toString()).join(this.context.fieldSeparator);
41051
41119
  }
41052
- static parse(e, t = new G()) {
41053
- return new r2(e.split(t.fieldSeparator).map((n) => ae.parse(n, t)), t);
41120
+ static parse(e, t = new W()) {
41121
+ return new r2(e.split(t.fieldSeparator).map((n) => le.parse(n, t)), t);
41054
41122
  }
41055
41123
  };
41056
- var ae = class r3 {
41057
- constructor(e, t = new G()) {
41124
+ var le = class r3 {
41125
+ constructor(e, t = new W()) {
41058
41126
  this.context = t, this.components = e;
41059
41127
  }
41060
41128
  get(e, t, n = 0) {
@@ -41067,11 +41135,11 @@ var ae = class r3 {
41067
41135
  toString() {
41068
41136
  return this.components.map((e) => e.join(this.context.componentSeparator)).join(this.context.repetitionSeparator);
41069
41137
  }
41070
- static parse(e, t = new G()) {
41138
+ static parse(e, t = new W()) {
41071
41139
  return new r3(e.split(t.repetitionSeparator).map((n) => n.split(t.componentSeparator)), t);
41072
41140
  }
41073
41141
  };
41074
- function ho(r4) {
41142
+ function Qo(r4) {
41075
41143
  let e = r4 instanceof Date ? r4 : new Date(r4), n = e.toISOString().replace(/[-:T]/g, "").replace(/(\.\d+)?Z$/, ""), i2 = e.getUTCMilliseconds();
41076
41144
  return i2 > 0 && (n += "." + i2.toString()), n;
41077
41145
  }
@@ -41115,7 +41183,7 @@ var c2 = class extends i {
41115
41183
  e.on("data", (s) => {
41116
41184
  try {
41117
41185
  if (o += s.toString(), o.endsWith(p2 + v2)) {
41118
- let r4 = ln.parse(o.substring(1, o.length - 2));
41186
+ let r4 = An.parse(o.substring(1, o.length - 2));
41119
41187
  this.dispatchEvent(new d2(this, r4)), o = "";
41120
41188
  }
41121
41189
  } catch (r4) {
@@ -41255,11 +41323,11 @@ var DcmjsDimseScp = class extends dimse.Scp {
41255
41323
  accessToken: App.instance.medplum.getAccessToken(),
41256
41324
  channel: AgentDicomChannel.instance.definition.name,
41257
41325
  remote: "foo",
41258
- contentType: I.JSON,
41326
+ contentType: O.JSON,
41259
41327
  body: JSON.stringify(request.getDataset())
41260
41328
  });
41261
41329
  } catch (err) {
41262
- App.instance.log.error(`DICOM error: ${Kn(err)}`);
41330
+ App.instance.log.error(`DICOM error: ${li(err)}`);
41263
41331
  }
41264
41332
  const response = dimse.responses.CStoreResponse.fromRequest(request);
41265
41333
  response.setStatus(dimse.constants.Status.Success);
@@ -41291,7 +41359,7 @@ var AgentHl7Channel = class {
41291
41359
  sendToRemote(msg) {
41292
41360
  const connection = this.connections.get(msg.remote);
41293
41361
  if (connection) {
41294
- connection.hl7Connection.send(ln.parse(msg.body));
41362
+ connection.hl7Connection.send(An.parse(msg.body));
41295
41363
  }
41296
41364
  }
41297
41365
  handleNewConnection(connection) {
@@ -41316,11 +41384,11 @@ var AgentHl7ChannelConnection = class {
41316
41384
  accessToken: this.channel.app.medplum.getAccessToken(),
41317
41385
  channel: this.channel.definition.name,
41318
41386
  remote: this.remote,
41319
- contentType: I.HL7_V2,
41387
+ contentType: O.HL7_V2,
41320
41388
  body: event.message.toString()
41321
41389
  });
41322
41390
  } catch (err) {
41323
- this.channel.app.log.error(`HL7 error: ${Kn(err)}`);
41391
+ this.channel.app.log.error(`HL7 error: ${li(err)}`);
41324
41392
  }
41325
41393
  }
41326
41394
  close() {
@@ -41369,6 +41437,9 @@ var App = class _App {
41369
41437
  this.live = true;
41370
41438
  this.trySendToWebSocket();
41371
41439
  break;
41440
+ case "agent:heartbeat:request":
41441
+ this.sendToWebSocket({ type: "agent:heartbeat:response" });
41442
+ break;
41372
41443
  case "transmit":
41373
41444
  case "agent:transmit:response":
41374
41445
  this.addToHl7Queue(command);
@@ -41381,14 +41452,14 @@ var App = class _App {
41381
41452
  this.log.error(`Unknown message type: ${command.type}`);
41382
41453
  }
41383
41454
  } catch (err) {
41384
- this.log.error(`WebSocket error: ${Kn(err)}`);
41455
+ this.log.error(`WebSocket error: ${li(err)}`);
41385
41456
  }
41386
41457
  });
41387
41458
  }
41388
41459
  async start() {
41389
41460
  this.log.info("Medplum service starting...");
41390
41461
  const agent = await this.medplum.readResource("Agent", this.agentId);
41391
- for (const definition of agent.channel) {
41462
+ for (const definition of agent.channel ?? []) {
41392
41463
  const endpoint = await this.medplum.readReference(definition.endpoint);
41393
41464
  let channel = void 0;
41394
41465
  if (!endpoint.address) {
@@ -41454,18 +41525,18 @@ var App = class _App {
41454
41525
  host: address.hostname,
41455
41526
  port: parseInt(address.port, 10)
41456
41527
  });
41457
- client.sendAndWait(ln.parse(message.body)).then((response) => {
41528
+ client.sendAndWait(An.parse(message.body)).then((response) => {
41458
41529
  this.log.info(`Response: ${response.toString().replaceAll("\r", "\n")}`);
41459
41530
  this.addToWebSocketQueue({
41460
41531
  type: "agent:transmit:response",
41461
41532
  channel: message.channel,
41462
41533
  remote: message.remote,
41463
41534
  callback: message.callback,
41464
- contentType: I.HL7_V2,
41535
+ contentType: O.HL7_V2,
41465
41536
  body: response.toString()
41466
41537
  });
41467
41538
  }).catch((err) => {
41468
- this.log.error(`HL7 error: ${Kn(err)}`);
41539
+ this.log.error(`HL7 error: ${li(err)}`);
41469
41540
  }).finally(() => {
41470
41541
  client.close();
41471
41542
  });
@@ -41498,7 +41569,7 @@ async function main(argv) {
41498
41569
  process.exit(1);
41499
41570
  }
41500
41571
  const { baseUrl, clientId, clientSecret, agentId } = args;
41501
- const medplum = new tn({ baseUrl, clientId });
41572
+ const medplum = new pn({ baseUrl, clientId });
41502
41573
  await medplum.startClientLogin(clientId, clientSecret);
41503
41574
  const app = new App(medplum, agentId);
41504
41575
  await app.start();