@medplum/agent 2.2.5 → 2.2.7

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (2) hide show
  1. package/dist/cjs/index.cjs +854 -808
  2. package/package.json +1 -1
@@ -4470,23 +4470,23 @@ var require_AsyncEventEmitter = __commonJS({
4470
4470
  return self2;
4471
4471
  };
4472
4472
  AsyncEventEmitter.prototype.once = function(type, listener) {
4473
- var self2 = this, g3;
4473
+ var self2 = this, g2;
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
- g3 = function(e, next) {
4479
- self2.removeListener(type, g3);
4478
+ g2 = function(e, next) {
4479
+ self2.removeListener(type, g2);
4480
4480
  listener(e, next);
4481
4481
  };
4482
4482
  } else {
4483
- g3 = function(e) {
4484
- self2.removeListener(type, g3);
4483
+ g2 = function(e) {
4484
+ self2.removeListener(type, g2);
4485
4485
  listener(e);
4486
4486
  };
4487
4487
  }
4488
- g3.listener = listener;
4489
- self2.on(type, g3);
4488
+ g2.listener = listener;
4489
+ self2.on(type, g2);
4490
4490
  return self2;
4491
4491
  };
4492
4492
  AsyncEventEmitter.prototype.first = function(event, listener) {
@@ -5116,11 +5116,11 @@ 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 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;
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;
5124
5124
  var i2 = 0;
5125
5125
  var F = function() {
5126
5126
  };
@@ -5147,10 +5147,10 @@ var require_dcmjs = __commonJS({
5147
5147
  var normalCompletion = true, didErr = false, err2;
5148
5148
  return {
5149
5149
  s: function() {
5150
- it = it.call(o);
5150
+ it2 = it2.call(o);
5151
5151
  },
5152
5152
  n: function() {
5153
- var step = it.next();
5153
+ var step = it2.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 && it.return != null)
5164
- it.return();
5163
+ if (!normalCompletion && it2.return != null)
5164
+ it2.return();
5165
5165
  } finally {
5166
5166
  if (didErr)
5167
5167
  throw err2;
@@ -6994,8 +6994,8 @@ var require_dcmjs = __commonJS({
6994
6994
  STR_APPLY_UIA_OK = false;
6995
6995
  }
6996
6996
  const _utf8len = new Uint8Array(256);
6997
- for (let q2 = 0; q2 < 256; q2++) {
6998
- _utf8len[q2] = q2 >= 252 ? 6 : q2 >= 248 ? 5 : q2 >= 240 ? 4 : q2 >= 224 ? 3 : q2 >= 192 ? 2 : 1;
6997
+ for (let q = 0; q < 256; q++) {
6998
+ _utf8len[q] = q >= 252 ? 6 : q >= 248 ? 5 : q >= 240 ? 4 : q >= 224 ? 3 : q >= 192 ? 2 : 1;
6999
6999
  }
7000
7000
  _utf8len[254] = _utf8len[254] = 1;
7001
7001
  var string2buf = (str2) => {
@@ -7870,8 +7870,8 @@ var require_dcmjs = __commonJS({
7870
7870
  const ENOUGH_DISTS = 592;
7871
7871
  const MAX_WBITS = 15;
7872
7872
  const DEF_WBITS = MAX_WBITS;
7873
- const zswap32 = (q2) => {
7874
- return (q2 >>> 24 & 255) + (q2 >>> 8 & 65280) + ((q2 & 65280) << 8) + ((q2 & 255) << 24);
7873
+ const zswap32 = (q) => {
7874
+ return (q >>> 24 & 255) + (q >>> 8 & 65280) + ((q & 65280) << 8) + ((q & 255) << 24);
7875
7875
  };
7876
7876
  function InflateState() {
7877
7877
  this.mode = 0;
@@ -9455,9 +9455,9 @@ var require_dcmjs = __commonJS({
9455
9455
  }, {
9456
9456
  key: "readVR",
9457
9457
  value: function readVR() {
9458
- var vr2 = String.fromCharCode(this.view.getUint8(this.offset)) + String.fromCharCode(this.view.getUint8(this.offset + 1));
9458
+ var vr = String.fromCharCode(this.view.getUint8(this.offset)) + String.fromCharCode(this.view.getUint8(this.offset + 1));
9459
9459
  this.increment(2);
9460
- return vr2;
9460
+ return vr;
9461
9461
  }
9462
9462
  }, {
9463
9463
  key: "readEncodedString",
@@ -9779,7 +9779,7 @@ var require_dcmjs = __commonJS({
9779
9779
  }
9780
9780
  }, {
9781
9781
  key: "is",
9782
- value: function is(t) {
9782
+ value: function is2(t) {
9783
9783
  return this.value == t;
9784
9784
  }
9785
9785
  }, {
@@ -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 vr2 = ValueRepresentation.createByTypeString(vrType), useSyntax = DicomMessage._normalizeSyntax(syntax);
9810
+ var vr = 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 = vr2.writeBytes(tagStream, values, useSyntax, isEncapsulated, writeOptions);
9819
+ valueLength = vr.writeBytes(tagStream, values, useSyntax, isEncapsulated, writeOptions);
9820
9820
  } else if (vrType == "SQ") {
9821
- valueLength = vr2.writeBytes(tagStream, values, useSyntax, writeOptions);
9821
+ valueLength = vr.writeBytes(tagStream, values, useSyntax, writeOptions);
9822
9822
  } else {
9823
- valueLength = vr2.writeBytes(tagStream, values, writeOptions);
9823
+ valueLength = vr.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 (vr2.isExplicit()) {
9834
- stream.writeAsciiString(vr2.type);
9833
+ if (vr.isExplicit()) {
9834
+ stream.writeAsciiString(vr.type);
9835
9835
  stream.writeUint16(0);
9836
9836
  stream.writeUint32(valueLength);
9837
9837
  written += 8;
9838
9838
  } else {
9839
- stream.writeAsciiString(vr2.type);
9839
+ stream.writeAsciiString(vr.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 vr2 = VRinstances[type];
10145
- if (vr2 === void 0) {
10144
+ var vr = VRinstances[type];
10145
+ if (vr === void 0) {
10146
10146
  if (type == "ox") {
10147
10147
  validationLog.error("Invalid vr type", type, "- using OW");
10148
- vr2 = VRinstances["OW"];
10148
+ vr = VRinstances["OW"];
10149
10149
  } else if (type == "xs") {
10150
10150
  validationLog.error("Invalid vr type", type, "- using US");
10151
- vr2 = VRinstances["US"];
10151
+ vr = VRinstances["US"];
10152
10152
  } else {
10153
10153
  validationLog.error("Invalid vr type", type, "- using UN");
10154
- vr2 = VRinstances["UN"];
10154
+ vr = VRinstances["UN"];
10155
10155
  }
10156
10156
  }
10157
- return vr2;
10157
+ return vr;
10158
10158
  }
10159
10159
  }]);
10160
10160
  return ValueRepresentation2;
@@ -10606,17 +10606,17 @@ var require_dcmjs = __commonJS({
10606
10606
  key: "readBytes",
10607
10607
  value: function readBytes(stream, length2) {
10608
10608
  var BACKSLASH = String.fromCharCode(VM_DELIMITER);
10609
- var is = stream.readAsciiString(length2).trim();
10610
- is = is.replace(/[^0-9.\\\-+e]/gi, "");
10611
- if (is.indexOf(BACKSLASH) !== -1) {
10612
- var integerStringArray = is.split(BACKSLASH);
10613
- is = integerStringArray.map(function(is2) {
10614
- return is2 === "" ? null : Number(is2);
10609
+ var is2 = stream.readAsciiString(length2).trim();
10610
+ is2 = is2.replace(/[^0-9.\\\-+e]/gi, "");
10611
+ if (is2.indexOf(BACKSLASH) !== -1) {
10612
+ var integerStringArray = is2.split(BACKSLASH);
10613
+ is2 = integerStringArray.map(function(is3) {
10614
+ return is3 === "" ? null : Number(is3);
10615
10615
  });
10616
10616
  } else {
10617
- is = [is === "" ? null : Number(is)];
10617
+ is2 = [is2 === "" ? null : Number(is2)];
10618
10618
  }
10619
- return is;
10619
+ return is2;
10620
10620
  }
10621
10621
  }, {
10622
10622
  key: "formatValue",
@@ -10627,8 +10627,8 @@ var require_dcmjs = __commonJS({
10627
10627
  key: "writeBytes",
10628
10628
  value: function writeBytes(stream, value, writeOptions) {
10629
10629
  var _this12 = this;
10630
- var val = Array.isArray(value) ? value.map(function(is) {
10631
- return _this12.formatValue(is);
10630
+ var val = Array.isArray(value) ? value.map(function(is2) {
10631
+ return _this12.formatValue(is2);
10632
10632
  }) : [this.formatValue(value)];
10633
10633
  return _get(_getPrototypeOf(IntegerString2.prototype), "writeBytes", this).call(this, stream, val, writeOptions);
10634
10634
  }
@@ -10845,12 +10845,12 @@ var require_dcmjs = __commonJS({
10845
10845
  if (undef) {
10846
10846
  var stack = 0;
10847
10847
  while (1) {
10848
- var g3 = stream.readUint16();
10849
- if (g3 == 65534) {
10850
- var ge2 = stream.readUint16();
10848
+ var g2 = stream.readUint16();
10849
+ if (g2 == 65534) {
10850
+ var ge = stream.readUint16();
10851
10851
  var itemLength = stream.readUint32();
10852
10852
  stream.increment(-4);
10853
- if (ge2 == 57357) {
10853
+ if (ge == 57357) {
10854
10854
  if (itemLength === 0) {
10855
10855
  stack--;
10856
10856
  if (stack < 0) {
@@ -10863,7 +10863,7 @@ var require_dcmjs = __commonJS({
10863
10863
  } else {
10864
10864
  toRead += 2;
10865
10865
  }
10866
- } else if (ge2 == 57344) {
10866
+ } else if (ge == 57344) {
10867
10867
  toRead += 4;
10868
10868
  if (itemLength == 4294967295) {
10869
10869
  stack++;
@@ -11432,7 +11432,7 @@ var require_dcmjs = __commonJS({
11432
11432
  log.error("No value representation given for", naturalName);
11433
11433
  }
11434
11434
  }
11435
- var vr2 = ValueRepresentation.createByTypeString(dataItem.vr);
11435
+ var vr = 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 (!vr2.isBinary() && vr2.maxLength) {
11445
+ if (!vr.isBinary() && vr.maxLength) {
11446
11446
  dataItem.Value = dataItem.Value.map(function(value) {
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);
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);
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, vr2, values, syntax, writeOptions) {
11730
+ value: function writeTagObject(stream, tagString, vr, values, syntax, writeOptions) {
11731
11731
  var tag = Tag.fromString(tagString);
11732
- tag.write(stream, vr2, values, syntax, writeOptions);
11732
+ tag.write(stream, vr, 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, vr2 = null, vrType;
11766
+ var length2 = null, vr = 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
- vr2 = ValueRepresentation.createByTypeString(vrType);
11785
+ vr = ValueRepresentation.createByTypeString(vrType);
11786
11786
  } else {
11787
11787
  vrType = stream.readVR();
11788
- vr2 = ValueRepresentation.createByTypeString(vrType);
11789
- if (vr2.isExplicit()) {
11788
+ vr = ValueRepresentation.createByTypeString(vrType);
11789
+ if (vr.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 (vr2.isBinary() && length2 > vr2.maxLength && !vr2.noMultiple) {
11798
- var times = length2 / vr2.maxLength, i2 = 0;
11797
+ if (vr.isBinary() && length2 > vr.maxLength && !vr.noMultiple) {
11798
+ var times = length2 / vr.maxLength, i2 = 0;
11799
11799
  while (i2++ < times) {
11800
- values.push(vr2.read(stream, vr2.maxLength, syntax));
11800
+ values.push(vr.read(stream, vr.maxLength, syntax));
11801
11801
  }
11802
11802
  } else {
11803
- var val = vr2.read(stream, length2, syntax);
11804
- if (!vr2.isBinary() && singleVRs.indexOf(vr2.type) == -1) {
11803
+ var val = vr.read(stream, length2, syntax);
11804
+ if (!vr.isBinary() && singleVRs.indexOf(vr.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 (vr2.type == "SQ") {
11809
+ } else if (vr.type == "SQ") {
11810
11810
  values = val;
11811
- } else if (vr2.type == "OW" || vr2.type == "OB") {
11811
+ } else if (vr.type == "OW" || vr.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: vr2
11820
+ vr
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, vr2, values) {
11842
+ value: function upsertTag(tag, vr, 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: vr2
11847
+ vr
11848
11848
  });
11849
11849
  this.dict[tag].Value = values;
11850
11850
  }
@@ -12064,21 +12064,21 @@ var require_dcmjs = __commonJS({
12064
12064
  key: "rgb2XYZ",
12065
12065
  value: function rgb2XYZ(rgb) {
12066
12066
  var R2 = Colors2.invGammaCorrection(rgb[0]);
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];
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];
12070
12070
  }
12071
12071
  }, {
12072
12072
  key: "xyz2LAB",
12073
12073
  value: function xyz2LAB(xyz) {
12074
12074
  var whitePoint = Colors2.d65WhitePointXYZ();
12075
12075
  var X2 = xyz[0] / whitePoint[0];
12076
- var Y2 = xyz[1] / whitePoint[1];
12076
+ var Y = xyz[1] / whitePoint[1];
12077
12077
  var Z2 = xyz[2] / whitePoint[2];
12078
12078
  X2 = Colors2.labf(X2);
12079
- Y2 = Colors2.labf(Y2);
12079
+ Y = Colors2.labf(Y);
12080
12080
  Z2 = Colors2.labf(Z2);
12081
- return [116 * Y2 - 16, 500 * (X2 - Y2), 200 * (Y2 - Z2)];
12081
+ return [116 * Y - 16, 500 * (X2 - Y), 200 * (Y - Z2)];
12082
12082
  }
12083
12083
  }, {
12084
12084
  key: "lab2RGB",
@@ -15287,11 +15287,11 @@ var require_dcmjs = __commonJS({
15287
15287
  var RANDOM = Math.random;
15288
15288
  if (!Math.hypot)
15289
15289
  Math.hypot = function() {
15290
- var y = 0, i2 = arguments.length;
15290
+ var y2 = 0, i2 = arguments.length;
15291
15291
  while (i2--) {
15292
- y += arguments[i2] * arguments[i2];
15292
+ y2 += arguments[i2] * arguments[i2];
15293
15293
  }
15294
- return Math.sqrt(y);
15294
+ return Math.sqrt(y2);
15295
15295
  };
15296
15296
  function create() {
15297
15297
  var out = new ARRAY_TYPE(3);
@@ -15311,14 +15311,14 @@ var require_dcmjs = __commonJS({
15311
15311
  }
15312
15312
  function length(a) {
15313
15313
  var x = a[0];
15314
- var y = a[1];
15314
+ var y2 = a[1];
15315
15315
  var z2 = a[2];
15316
- return Math.hypot(x, y, z2);
15316
+ return Math.hypot(x, y2, z2);
15317
15317
  }
15318
- function fromValues(x, y, z2) {
15318
+ function fromValues(x, y2, z2) {
15319
15319
  var out = new ARRAY_TYPE(3);
15320
15320
  out[0] = x;
15321
- out[1] = y;
15321
+ out[1] = y2;
15322
15322
  out[2] = z2;
15323
15323
  return out;
15324
15324
  }
@@ -15328,9 +15328,9 @@ var require_dcmjs = __commonJS({
15328
15328
  out[2] = a[2];
15329
15329
  return out;
15330
15330
  }
15331
- function set(out, x, y, z2) {
15331
+ function set(out, x, y2, z2) {
15332
15332
  out[0] = x;
15333
- out[1] = y;
15333
+ out[1] = y2;
15334
15334
  out[2] = z2;
15335
15335
  return out;
15336
15336
  }
@@ -15402,21 +15402,21 @@ var require_dcmjs = __commonJS({
15402
15402
  }
15403
15403
  function distance(a, b2) {
15404
15404
  var x = b2[0] - a[0];
15405
- var y = b2[1] - a[1];
15405
+ var y2 = b2[1] - a[1];
15406
15406
  var z2 = b2[2] - a[2];
15407
- return Math.hypot(x, y, z2);
15407
+ return Math.hypot(x, y2, z2);
15408
15408
  }
15409
15409
  function squaredDistance(a, b2) {
15410
15410
  var x = b2[0] - a[0];
15411
- var y = b2[1] - a[1];
15411
+ var y2 = b2[1] - a[1];
15412
15412
  var z2 = b2[2] - a[2];
15413
- return x * x + y * y + z2 * z2;
15413
+ return x * x + y2 * y2 + z2 * z2;
15414
15414
  }
15415
15415
  function squaredLength(a) {
15416
15416
  var x = a[0];
15417
- var y = a[1];
15417
+ var y2 = a[1];
15418
15418
  var z2 = a[2];
15419
- return x * x + y * y + z2 * z2;
15419
+ return x * x + y2 * y2 + z2 * z2;
15420
15420
  }
15421
15421
  function negate(out, a) {
15422
15422
  out[0] = -a[0];
@@ -15432,9 +15432,9 @@ var require_dcmjs = __commonJS({
15432
15432
  }
15433
15433
  function normalize$1(out, a) {
15434
15434
  var x = a[0];
15435
- var y = a[1];
15435
+ var y2 = a[1];
15436
15436
  var z2 = a[2];
15437
- var len2 = x * x + y * y + z2 * z2;
15437
+ var len2 = x * x + y2 * y2 + z2 * z2;
15438
15438
  if (len2 > 0) {
15439
15439
  len2 = 1 / Math.sqrt(len2);
15440
15440
  }
@@ -15498,25 +15498,25 @@ var require_dcmjs = __commonJS({
15498
15498
  return out;
15499
15499
  }
15500
15500
  function transformMat4(out, a, m3) {
15501
- var x = a[0], y = a[1], z2 = a[2];
15502
- var w2 = m3[3] * x + m3[7] * y + m3[11] * z2 + m3[15];
15501
+ var x = a[0], y2 = a[1], z2 = a[2];
15502
+ var w2 = m3[3] * x + m3[7] * y2 + m3[11] * z2 + m3[15];
15503
15503
  w2 = w2 || 1;
15504
- out[0] = (m3[0] * x + m3[4] * y + m3[8] * z2 + m3[12]) / w2;
15505
- out[1] = (m3[1] * x + m3[5] * y + m3[9] * z2 + m3[13]) / w2;
15506
- out[2] = (m3[2] * x + m3[6] * y + m3[10] * z2 + m3[14]) / w2;
15504
+ out[0] = (m3[0] * x + m3[4] * y2 + m3[8] * z2 + m3[12]) / w2;
15505
+ out[1] = (m3[1] * x + m3[5] * y2 + m3[9] * z2 + m3[13]) / w2;
15506
+ out[2] = (m3[2] * x + m3[6] * y2 + m3[10] * z2 + m3[14]) / w2;
15507
15507
  return out;
15508
15508
  }
15509
15509
  function transformMat3(out, a, m3) {
15510
- var x = a[0], y = a[1], z2 = a[2];
15511
- out[0] = x * m3[0] + y * m3[3] + z2 * m3[6];
15512
- out[1] = x * m3[1] + y * m3[4] + z2 * m3[7];
15513
- out[2] = x * m3[2] + y * m3[5] + z2 * m3[8];
15510
+ var x = a[0], y2 = a[1], z2 = a[2];
15511
+ out[0] = x * m3[0] + y2 * m3[3] + z2 * m3[6];
15512
+ out[1] = x * m3[1] + y2 * m3[4] + z2 * m3[7];
15513
+ out[2] = x * m3[2] + y2 * m3[5] + z2 * m3[8];
15514
15514
  return out;
15515
15515
  }
15516
- function transformQuat(out, a, q2) {
15517
- var qx = q2[0], qy = q2[1], qz = q2[2], qw = q2[3];
15518
- var x = a[0], y = a[1], z2 = a[2];
15519
- var uvx = qy * z2 - qz * y, uvy = qz * x - qx * z2, uvz = qx * y - qy * x;
15516
+ function transformQuat(out, a, q) {
15517
+ var qx = q[0], qy = q[1], qz = q[2], qw = q[3];
15518
+ var x = a[0], y2 = a[1], z2 = a[2];
15519
+ var uvx = qy * z2 - qz * y2, uvy = qz * x - qx * z2, uvz = qx * y2 - qy * x;
15520
15520
  var uuvx = qy * uvz - qz * uvy, uuvy = qz * uvx - qx * uvz, uuvz = qx * uvy - qy * uvx;
15521
15521
  var w2 = qw * 2;
15522
15522
  uvx *= w2;
@@ -15526,7 +15526,7 @@ var require_dcmjs = __commonJS({
15526
15526
  uuvy *= 2;
15527
15527
  uuvz *= 2;
15528
15528
  out[0] = x + uvx + uuvx;
15529
- out[1] = y + uvy + uuvy;
15529
+ out[1] = y2 + uvy + uuvy;
15530
15530
  out[2] = z2 + uvz + uuvz;
15531
15531
  return out;
15532
15532
  }
@@ -18194,10 +18194,10 @@ var require_dcmjs = __commonJS({
18194
18194
  rgba.push(255);
18195
18195
  return rgba;
18196
18196
  }
18197
- function cross(x, y, out) {
18198
- var Zx = x[1] * y[2] - x[2] * y[1];
18199
- var Zy = x[2] * y[0] - x[0] * y[2];
18200
- var Zz = x[0] * y[1] - x[1] * y[0];
18197
+ function cross(x, y2, out) {
18198
+ var Zx = x[1] * y2[2] - x[2] * y2[1];
18199
+ var Zy = x[2] * y2[0] - x[0] * y2[2];
18200
+ var Zz = x[0] * y2[1] - x[1] * y2[0];
18201
18201
  out[0] = Zx;
18202
18202
  out[1] = Zy;
18203
18203
  out[2] = Zz;
@@ -21714,7 +21714,7 @@ var require_dcmjs = __commonJS({
21714
21714
  __proto__: null,
21715
21715
  Comprehensive3DSR
21716
21716
  });
21717
- var sr2 = {
21717
+ var sr = {
21718
21718
  coding,
21719
21719
  contentItems,
21720
21720
  documents,
@@ -22026,7 +22026,7 @@ var require_dcmjs = __commonJS({
22026
22026
  data,
22027
22027
  derivations,
22028
22028
  normalizers,
22029
- sr: sr2,
22029
+ sr,
22030
22030
  utilities,
22031
22031
  log,
22032
22032
  anonymizer
@@ -22039,7 +22039,7 @@ var require_dcmjs = __commonJS({
22039
22039
  exports2.derivations = derivations;
22040
22040
  exports2.log = log;
22041
22041
  exports2.normalizers = normalizers;
22042
- exports2.sr = sr2;
22042
+ exports2.sr = sr;
22043
22043
  exports2.utilities = utilities;
22044
22044
  Object.defineProperty(exports2, "__esModule", { value: true });
22045
22045
  });
@@ -25473,7 +25473,7 @@ var require_ms = __commonJS({
25473
25473
  var h3 = m3 * 60;
25474
25474
  var d3 = h3 * 24;
25475
25475
  var w2 = d3 * 7;
25476
- var y = d3 * 365.25;
25476
+ var y2 = d3 * 365.25;
25477
25477
  module2.exports = function(val, options) {
25478
25478
  options = options || {};
25479
25479
  var type = typeof val;
@@ -25505,7 +25505,7 @@ var require_ms = __commonJS({
25505
25505
  case "yrs":
25506
25506
  case "yr":
25507
25507
  case "y":
25508
- return n * y;
25508
+ return n * y2;
25509
25509
  case "weeks":
25510
25510
  case "week":
25511
25511
  case "w":
@@ -32199,10 +32199,10 @@ var require_stream_transform = __commonJS({
32199
32199
  if (data != null)
32200
32200
  this.push(data);
32201
32201
  cb(er);
32202
- var rs = this._readableState;
32203
- rs.reading = false;
32204
- if (rs.needReadable || rs.length < rs.highWaterMark) {
32205
- this._read(rs.highWaterMark);
32202
+ var rs2 = this._readableState;
32203
+ rs2.reading = false;
32204
+ if (rs2.needReadable || rs2.length < rs2.highWaterMark) {
32205
+ this._read(rs2.highWaterMark);
32206
32206
  }
32207
32207
  }
32208
32208
  function Transform(options) {
@@ -32250,9 +32250,9 @@ var require_stream_transform = __commonJS({
32250
32250
  ts.writechunk = chunk;
32251
32251
  ts.writeencoding = encoding;
32252
32252
  if (!ts.transforming) {
32253
- var rs = this._readableState;
32254
- if (ts.needTransform || rs.needReadable || rs.length < rs.highWaterMark)
32255
- this._read(rs.highWaterMark);
32253
+ var rs2 = this._readableState;
32254
+ if (ts.needTransform || rs2.needReadable || rs2.length < rs2.highWaterMark)
32255
+ this._read(rs2.highWaterMark);
32256
32256
  }
32257
32257
  };
32258
32258
  Transform.prototype._read = function(n) {
@@ -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 g3 = Math.round(rgba[1] / 255 * 100);
32897
+ var g2 = 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 + "%, " + g3 + "%, " + b2 + "%)" : "rgba(" + r4 + "%, " + g3 + "%, " + b2 + "%, " + rgba[3] + ")";
32899
+ return rgba.length < 4 || rgba[3] === 1 ? "rgb(" + r4 + "%, " + g2 + "%, " + b2 + "%)" : "rgba(" + r4 + "%, " + g2 + "%, " + 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 g3 = rgb[1] / 255;
32979
+ var g2 = rgb[1] / 255;
32980
32980
  var b2 = rgb[2] / 255;
32981
- var min = Math.min(r4, g3, b2);
32982
- var max = Math.max(r4, g3, b2);
32981
+ var min = Math.min(r4, g2, b2);
32982
+ var max = Math.max(r4, g2, 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 = (g3 - b2) / delta;
32991
- } else if (g3 === max) {
32990
+ h3 = (g2 - b2) / delta;
32991
+ } else if (g2 === max) {
32992
32992
  h3 = 2 + (b2 - r4) / delta;
32993
32993
  } else if (b2 === max) {
32994
- h3 = 4 + (r4 - g3) / delta;
32994
+ h3 = 4 + (r4 - g2) / 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 g3 = rgb[1] / 255;
33017
+ var g2 = rgb[1] / 255;
33018
33018
  var b2 = rgb[2] / 255;
33019
- var v3 = Math.max(r4, g3, b2);
33020
- var diff = v3 - Math.min(r4, g3, b2);
33019
+ var v3 = Math.max(r4, g2, b2);
33020
+ var diff = v3 - Math.min(r4, g2, 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(g3);
33029
+ gdif = diffc(g2);
33030
33030
  bdif = diffc(b2);
33031
33031
  if (r4 === v3) {
33032
33032
  h3 = bdif - gdif;
33033
- } else if (g3 === v3) {
33033
+ } else if (g2 === v3) {
33034
33034
  h3 = 1 / 3 + rdif - bdif;
33035
33035
  } else if (b2 === v3) {
33036
33036
  h3 = 2 / 3 + gdif - rdif;
@@ -33049,29 +33049,29 @@ var require_conversions = __commonJS({
33049
33049
  };
33050
33050
  convert.rgb.hwb = function(rgb) {
33051
33051
  var r4 = rgb[0];
33052
- var g3 = rgb[1];
33052
+ var g2 = 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(g3, b2));
33056
- b2 = 1 - 1 / 255 * Math.max(r4, Math.max(g3, b2));
33055
+ var w2 = 1 / 255 * Math.min(r4, Math.min(g2, b2));
33056
+ b2 = 1 - 1 / 255 * Math.max(r4, Math.max(g2, 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 g3 = rgb[1] / 255;
33061
+ var g2 = rgb[1] / 255;
33062
33062
  var b2 = rgb[2] / 255;
33063
33063
  var c3;
33064
33064
  var m3;
33065
- var y;
33065
+ var y2;
33066
33066
  var k2;
33067
- k2 = Math.min(1 - r4, 1 - g3, 1 - b2);
33067
+ k2 = Math.min(1 - r4, 1 - g2, 1 - b2);
33068
33068
  c3 = (1 - r4 - k2) / (1 - k2) || 0;
33069
- m3 = (1 - g3 - k2) / (1 - k2) || 0;
33070
- y = (1 - b2 - k2) / (1 - k2) || 0;
33071
- return [c3 * 100, m3 * 100, y * 100, k2 * 100];
33069
+ m3 = (1 - g2 - k2) / (1 - k2) || 0;
33070
+ y2 = (1 - b2 - k2) / (1 - k2) || 0;
33071
+ return [c3 * 100, m3 * 100, y2 * 100, k2 * 100];
33072
33072
  };
33073
- function comparativeDistance(x, y) {
33074
- return Math.pow(x[0] - y[0], 2) + Math.pow(x[1] - y[1], 2) + Math.pow(x[2] - y[2], 2);
33073
+ function comparativeDistance(x, y2) {
33074
+ return Math.pow(x[0] - y2[0], 2) + Math.pow(x[1] - y2[1], 2) + Math.pow(x[2] - y2[2], 2);
33075
33075
  }
33076
33076
  convert.rgb.keyword = function(rgb) {
33077
33077
  var reversed = reverseKeywords[rgb];
@@ -33097,33 +33097,33 @@ var require_conversions = __commonJS({
33097
33097
  };
33098
33098
  convert.rgb.xyz = function(rgb) {
33099
33099
  var r4 = rgb[0] / 255;
33100
- var g3 = rgb[1] / 255;
33100
+ var g2 = 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
- g3 = g3 > 0.04045 ? Math.pow((g3 + 0.055) / 1.055, 2.4) : g3 / 12.92;
33103
+ g2 = g2 > 0.04045 ? Math.pow((g2 + 0.055) / 1.055, 2.4) : g2 / 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 + g3 * 0.3576 + b2 * 0.1805;
33106
- var y = r4 * 0.2126 + g3 * 0.7152 + b2 * 0.0722;
33107
- var z2 = r4 * 0.0193 + g3 * 0.1192 + b2 * 0.9505;
33108
- return [x * 100, y * 100, z2 * 100];
33105
+ var x = r4 * 0.4124 + g2 * 0.3576 + b2 * 0.1805;
33106
+ var y2 = r4 * 0.2126 + g2 * 0.7152 + b2 * 0.0722;
33107
+ var z2 = r4 * 0.0193 + g2 * 0.1192 + b2 * 0.9505;
33108
+ return [x * 100, y2 * 100, z2 * 100];
33109
33109
  };
33110
33110
  convert.rgb.lab = function(rgb) {
33111
33111
  var xyz = convert.rgb.xyz(rgb);
33112
33112
  var x = xyz[0];
33113
- var y = xyz[1];
33113
+ var y2 = xyz[1];
33114
33114
  var z2 = xyz[2];
33115
33115
  var l2;
33116
33116
  var a;
33117
33117
  var b2;
33118
33118
  x /= 95.047;
33119
- y /= 100;
33119
+ y2 /= 100;
33120
33120
  z2 /= 108.883;
33121
33121
  x = x > 8856e-6 ? Math.pow(x, 1 / 3) : 7.787 * x + 16 / 116;
33122
- y = y > 8856e-6 ? Math.pow(y, 1 / 3) : 7.787 * y + 16 / 116;
33122
+ y2 = y2 > 8856e-6 ? Math.pow(y2, 1 / 3) : 7.787 * y2 + 16 / 116;
33123
33123
  z2 = z2 > 8856e-6 ? Math.pow(z2, 1 / 3) : 7.787 * z2 + 16 / 116;
33124
- l2 = 116 * y - 16;
33125
- a = 500 * (x - y);
33126
- b2 = 200 * (y - z2);
33124
+ l2 = 116 * y2 - 16;
33125
+ a = 500 * (x - y2);
33126
+ b2 = 200 * (y2 - z2);
33127
33127
  return [l2, a, b2];
33128
33128
  };
33129
33129
  convert.hsl.rgb = function(hsl) {
@@ -33189,22 +33189,22 @@ var require_conversions = __commonJS({
33189
33189
  var hi2 = Math.floor(h3) % 6;
33190
33190
  var f = h3 - Math.floor(h3);
33191
33191
  var p3 = 255 * v3 * (1 - s);
33192
- var q2 = 255 * v3 * (1 - s * f);
33192
+ var q = 255 * v3 * (1 - s * f);
33193
33193
  var t = 255 * v3 * (1 - s * (1 - f));
33194
33194
  v3 *= 255;
33195
33195
  switch (hi2) {
33196
33196
  case 0:
33197
33197
  return [v3, t, p3];
33198
33198
  case 1:
33199
- return [q2, v3, p3];
33199
+ return [q, v3, p3];
33200
33200
  case 2:
33201
33201
  return [p3, v3, t];
33202
33202
  case 3:
33203
- return [p3, q2, v3];
33203
+ return [p3, q, v3];
33204
33204
  case 4:
33205
33205
  return [t, p3, v3];
33206
33206
  case 5:
33207
- return [v3, p3, q2];
33207
+ return [v3, p3, q];
33208
33208
  }
33209
33209
  };
33210
33210
  convert.hsv.hsl = function(hsv) {
@@ -33244,91 +33244,91 @@ var require_conversions = __commonJS({
33244
33244
  }
33245
33245
  n = wh + f * (v3 - wh);
33246
33246
  var r4;
33247
- var g3;
33247
+ var g2;
33248
33248
  var b2;
33249
33249
  switch (i2) {
33250
33250
  default:
33251
33251
  case 6:
33252
33252
  case 0:
33253
33253
  r4 = v3;
33254
- g3 = n;
33254
+ g2 = n;
33255
33255
  b2 = wh;
33256
33256
  break;
33257
33257
  case 1:
33258
33258
  r4 = n;
33259
- g3 = v3;
33259
+ g2 = v3;
33260
33260
  b2 = wh;
33261
33261
  break;
33262
33262
  case 2:
33263
33263
  r4 = wh;
33264
- g3 = v3;
33264
+ g2 = v3;
33265
33265
  b2 = n;
33266
33266
  break;
33267
33267
  case 3:
33268
33268
  r4 = wh;
33269
- g3 = n;
33269
+ g2 = n;
33270
33270
  b2 = v3;
33271
33271
  break;
33272
33272
  case 4:
33273
33273
  r4 = n;
33274
- g3 = wh;
33274
+ g2 = wh;
33275
33275
  b2 = v3;
33276
33276
  break;
33277
33277
  case 5:
33278
33278
  r4 = v3;
33279
- g3 = wh;
33279
+ g2 = wh;
33280
33280
  b2 = n;
33281
33281
  break;
33282
33282
  }
33283
- return [r4 * 255, g3 * 255, b2 * 255];
33283
+ return [r4 * 255, g2 * 255, b2 * 255];
33284
33284
  };
33285
33285
  convert.cmyk.rgb = function(cmyk) {
33286
33286
  var c3 = cmyk[0] / 100;
33287
33287
  var m3 = cmyk[1] / 100;
33288
- var y = cmyk[2] / 100;
33288
+ var y2 = cmyk[2] / 100;
33289
33289
  var k2 = cmyk[3] / 100;
33290
33290
  var r4;
33291
- var g3;
33291
+ var g2;
33292
33292
  var b2;
33293
33293
  r4 = 1 - Math.min(1, c3 * (1 - k2) + k2);
33294
- g3 = 1 - Math.min(1, m3 * (1 - k2) + k2);
33295
- b2 = 1 - Math.min(1, y * (1 - k2) + k2);
33296
- return [r4 * 255, g3 * 255, b2 * 255];
33294
+ g2 = 1 - Math.min(1, m3 * (1 - k2) + k2);
33295
+ b2 = 1 - Math.min(1, y2 * (1 - k2) + k2);
33296
+ return [r4 * 255, g2 * 255, b2 * 255];
33297
33297
  };
33298
33298
  convert.xyz.rgb = function(xyz) {
33299
33299
  var x = xyz[0] / 100;
33300
- var y = xyz[1] / 100;
33300
+ var y2 = xyz[1] / 100;
33301
33301
  var z2 = xyz[2] / 100;
33302
33302
  var r4;
33303
- var g3;
33303
+ var g2;
33304
33304
  var b2;
33305
- r4 = x * 3.2406 + y * -1.5372 + z2 * -0.4986;
33306
- g3 = x * -0.9689 + y * 1.8758 + z2 * 0.0415;
33307
- b2 = x * 0.0557 + y * -0.204 + z2 * 1.057;
33305
+ r4 = x * 3.2406 + y2 * -1.5372 + z2 * -0.4986;
33306
+ g2 = x * -0.9689 + y2 * 1.8758 + z2 * 0.0415;
33307
+ b2 = x * 0.0557 + y2 * -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
- g3 = g3 > 31308e-7 ? 1.055 * Math.pow(g3, 1 / 2.4) - 0.055 : g3 * 12.92;
33309
+ g2 = g2 > 31308e-7 ? 1.055 * Math.pow(g2, 1 / 2.4) - 0.055 : g2 * 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
- g3 = Math.min(Math.max(0, g3), 1);
33312
+ g2 = Math.min(Math.max(0, g2), 1);
33313
33313
  b2 = Math.min(Math.max(0, b2), 1);
33314
- return [r4 * 255, g3 * 255, b2 * 255];
33314
+ return [r4 * 255, g2 * 255, b2 * 255];
33315
33315
  };
33316
33316
  convert.xyz.lab = function(xyz) {
33317
33317
  var x = xyz[0];
33318
- var y = xyz[1];
33318
+ var y2 = xyz[1];
33319
33319
  var z2 = xyz[2];
33320
33320
  var l2;
33321
33321
  var a;
33322
33322
  var b2;
33323
33323
  x /= 95.047;
33324
- y /= 100;
33324
+ y2 /= 100;
33325
33325
  z2 /= 108.883;
33326
33326
  x = x > 8856e-6 ? Math.pow(x, 1 / 3) : 7.787 * x + 16 / 116;
33327
- y = y > 8856e-6 ? Math.pow(y, 1 / 3) : 7.787 * y + 16 / 116;
33327
+ y2 = y2 > 8856e-6 ? Math.pow(y2, 1 / 3) : 7.787 * y2 + 16 / 116;
33328
33328
  z2 = z2 > 8856e-6 ? Math.pow(z2, 1 / 3) : 7.787 * z2 + 16 / 116;
33329
- l2 = 116 * y - 16;
33330
- a = 500 * (x - y);
33331
- b2 = 200 * (y - z2);
33329
+ l2 = 116 * y2 - 16;
33330
+ a = 500 * (x - y2);
33331
+ b2 = 200 * (y2 - z2);
33332
33332
  return [l2, a, b2];
33333
33333
  };
33334
33334
  convert.lab.xyz = function(lab) {
@@ -33336,21 +33336,21 @@ var require_conversions = __commonJS({
33336
33336
  var a = lab[1];
33337
33337
  var b2 = lab[2];
33338
33338
  var x;
33339
- var y;
33339
+ var y2;
33340
33340
  var z2;
33341
- y = (l2 + 16) / 116;
33342
- x = a / 500 + y;
33343
- z2 = y - b2 / 200;
33344
- var y2 = Math.pow(y, 3);
33341
+ y2 = (l2 + 16) / 116;
33342
+ x = a / 500 + y2;
33343
+ z2 = y2 - b2 / 200;
33344
+ var y22 = Math.pow(y2, 3);
33345
33345
  var x2 = Math.pow(x, 3);
33346
33346
  var z22 = Math.pow(z2, 3);
33347
- y = y2 > 8856e-6 ? y2 : (y - 16 / 116) / 7.787;
33347
+ y2 = y22 > 8856e-6 ? y22 : (y2 - 16 / 116) / 7.787;
33348
33348
  x = x2 > 8856e-6 ? x2 : (x - 16 / 116) / 7.787;
33349
33349
  z2 = z22 > 8856e-6 ? z22 : (z2 - 16 / 116) / 7.787;
33350
33350
  x *= 95.047;
33351
- y *= 100;
33351
+ y2 *= 100;
33352
33352
  z2 *= 108.883;
33353
- return [x, y, z2];
33353
+ return [x, y2, z2];
33354
33354
  };
33355
33355
  convert.lab.lch = function(lab) {
33356
33356
  var l2 = lab[0];
@@ -33381,14 +33381,14 @@ var require_conversions = __commonJS({
33381
33381
  };
33382
33382
  convert.rgb.ansi16 = function(args) {
33383
33383
  var r4 = args[0];
33384
- var g3 = args[1];
33384
+ var g2 = 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(g3 / 255) << 1 | Math.round(r4 / 255));
33391
+ var ansi = 30 + (Math.round(b2 / 255) << 2 | Math.round(g2 / 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 g3 = args[1];
33402
+ var g2 = args[1];
33403
33403
  var b2 = args[2];
33404
- if (r4 === g3 && g3 === b2) {
33404
+ if (r4 === g2 && g2 === 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(g3 / 255 * 5) + Math.round(b2 / 255 * 5);
33413
+ var ansi = 16 + 36 * Math.round(r4 / 255 * 5) + 6 * Math.round(g2 / 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 g3 = (color >> 1 & 1) * mult * 255;
33427
+ var g2 = (color >> 1 & 1) * mult * 255;
33428
33428
  var b2 = (color >> 2 & 1) * mult * 255;
33429
- return [r4, g3, b2];
33429
+ return [r4, g2, 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 g3 = Math.floor((rem = args % 36) / 6) / 5 * 255;
33439
+ var g2 = Math.floor((rem = args % 36) / 6) / 5 * 255;
33440
33440
  var b2 = rem % 6 / 5 * 255;
33441
- return [r4, g3, b2];
33441
+ return [r4, g2, 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 g3 = integer >> 8 & 255;
33461
+ var g2 = integer >> 8 & 255;
33462
33462
  var b2 = integer & 255;
33463
- return [r4, g3, b2];
33463
+ return [r4, g2, b2];
33464
33464
  };
33465
33465
  convert.rgb.hcg = function(rgb) {
33466
33466
  var r4 = rgb[0] / 255;
33467
- var g3 = rgb[1] / 255;
33467
+ var g2 = rgb[1] / 255;
33468
33468
  var b2 = rgb[2] / 255;
33469
- var max = Math.max(Math.max(r4, g3), b2);
33470
- var min = Math.min(Math.min(r4, g3), b2);
33469
+ var max = Math.max(Math.max(r4, g2), b2);
33470
+ var min = Math.min(Math.min(r4, g2), 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 = (g3 - b2) / chroma % 6;
33483
- } else if (max === g3) {
33482
+ hue = (g2 - b2) / chroma % 6;
33483
+ } else if (max === g2) {
33484
33484
  hue = 2 + (b2 - r4) / chroma;
33485
33485
  } else {
33486
- hue = 4 + (r4 - g3) / chroma + 4;
33486
+ hue = 4 + (r4 - g2) / 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 g3 = hcg[2] / 100;
33520
+ var g2 = hcg[2] / 100;
33521
33521
  if (c3 === 0) {
33522
- return [g3 * 255, g3 * 255, g3 * 255];
33522
+ return [g2 * 255, g2 * 255, g2 * 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) * g3;
33560
+ mg = (1 - c3) * g2;
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 g3 = hcg[2] / 100;
33570
- var v3 = c3 + g3 * (1 - c3);
33569
+ var g2 = hcg[2] / 100;
33570
+ var v3 = c3 + g2 * (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 g3 = hcg[2] / 100;
33580
- var l2 = g3 * (1 - c3) + 0.5 * c3;
33579
+ var g2 = hcg[2] / 100;
33580
+ var l2 = g2 * (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 g3 = hcg[2] / 100;
33592
- var v3 = c3 + g3 * (1 - c3);
33591
+ var g2 = hcg[2] / 100;
33592
+ var v3 = c3 + g2 * (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 g3 = 0;
33600
+ var g2 = 0;
33601
33601
  if (c3 < 1) {
33602
- g3 = (v3 - c3) / (1 - c3);
33602
+ g2 = (v3 - c3) / (1 - c3);
33603
33603
  }
33604
- return [hwb[0], c3 * 100, g3 * 100];
33604
+ return [hwb[0], c3 * 100, g2 * 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];
@@ -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), g3 = color.substring(2, 4), b2 = color.substring(4, 6);
34214
- return [parseInt(r4, 16), parseInt(g3, 16), parseInt(b2, 16)];
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)];
34215
34215
  };
34216
- Kuler.prototype.rgb = function rgb(r4, g3, b2) {
34217
- var red = r4 / 255 * 5, green = g3 / 255 * 5, blue = b2 / 255 * 5;
34216
+ Kuler.prototype.rgb = function rgb(r4, g2, b2) {
34217
+ var red = r4 / 255 * 5, green = g2 / 255 * 5, blue = b2 / 255 * 5;
34218
34218
  return this.ansi(red, green, blue);
34219
34219
  };
34220
- Kuler.prototype.ansi = function ansi(r4, g3, b2) {
34221
- var red = Math.round(r4), green = Math.round(g3), blue = Math.round(b2);
34220
+ Kuler.prototype.ansi = function ansi(r4, g2, b2) {
34221
+ var red = Math.round(r4), green = Math.round(g2), blue = Math.round(b2);
34222
34222
  return 16 + red * 36 + green * 6 + blue;
34223
34223
  };
34224
34224
  Kuler.prototype.reset = function reset() {
@@ -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: g3 } = 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: g2 } = 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(g3);
36913
+ }), e3.join(g2);
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(g3);
37094
+ }), e3.push(""), e3.join(g2);
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), g3 = 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), g2 = 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 ? g3 : m3).connect({ host: e3, port: t3, ...h4 }), p3 = new c3(l2, a2);
37168
+ const l2 = (a2.securityOptions ? g2 : 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 g3 {
37205
+ class g2 {
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(g3, u2) {
37284
+ class l2 extends c3(g2, 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 g3 {
37340
+ class p3 extends g2 {
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:
@@ -37460,7 +37460,7 @@ var require_dcmjs_dimse_min = __commonJS({
37460
37460
  return t3.setMessageIdBeingRespondedTo(e3.getMessageId()), t3;
37461
37461
  }
37462
37462
  }
37463
- class y extends l2 {
37463
+ class y2 extends l2 {
37464
37464
  constructor(e3) {
37465
37465
  super(n2.CFindRequest, r5.StudyRootQueryRetrieveInformationModelFind, false), this.setPriority(e3 || i3.Medium);
37466
37466
  }
@@ -37473,25 +37473,25 @@ var require_dcmjs_dimse_min = __commonJS({
37473
37473
  static createStudyFindRequest(e3, t3) {
37474
37474
  const s3 = { PatientID: "", PatientName: "", IssuerOfPatientID: "", PatientSex: "", PatientBirthDate: "", StudyInstanceUID: "", ModalitiesInStudy: "", StudyID: "", AccessionNumber: "", StudyDate: "", StudyTime: "", StudyDescription: "", NumberOfStudyRelatedSeries: "", NumberOfStudyRelatedInstances: "", ...e3 };
37475
37475
  s3.QueryRetrieveLevel = "STUDY";
37476
- const n3 = new y(t3);
37476
+ const n3 = new y2(t3);
37477
37477
  return n3.setDataset(new a(s3)), n3;
37478
37478
  }
37479
37479
  static createSeriesFindRequest(e3, t3) {
37480
37480
  const s3 = { StudyInstanceUID: "", SeriesInstanceUID: "", SeriesNumber: "", SeriesDescription: "", Modality: "", SeriesDate: "", SeriesTime: "", NumberOfSeriesRelatedInstances: "", ...e3 };
37481
37481
  s3.QueryRetrieveLevel = "SERIES";
37482
- const n3 = new y(t3);
37482
+ const n3 = new y2(t3);
37483
37483
  return n3.setDataset(new a(s3)), n3;
37484
37484
  }
37485
37485
  static createImageFindRequest(e3, t3) {
37486
37486
  const s3 = { StudyInstanceUID: "", SeriesInstanceUID: "", SOPInstanceUID: "", InstanceNumber: "", Modality: "", ...e3 };
37487
37487
  s3.QueryRetrieveLevel = "IMAGE";
37488
- const n3 = new y(t3);
37488
+ const n3 = new y2(t3);
37489
37489
  return n3.setDataset(new a(s3)), n3;
37490
37490
  }
37491
37491
  static createWorklistFindRequest(e3, t3) {
37492
37492
  const s3 = { PatientID: "", PatientName: "", IssuerOfPatientID: "", PatientSex: "", PatientWeight: "", PatientBirthDate: "", MedicalAlerts: "", PregnancyStatus: "", Allergies: "", PatientComments: "", SpecialNeeds: "", PatientState: "", CurrentPatientLocation: "", InstitutionName: "", AdmissionID: "", AccessionNumber: "", ReferringPhysicianName: "", AdmittingDiagnosesDescription: "", RequestingPhysician: "", StudyInstanceUID: "", StudyDescription: "", StudyID: "", ReasonForTheRequestedProcedure: "", StudyDate: "", StudyTime: "", RequestedProcedureID: "", RequestedProcedureDescription: "", RequestedProcedurePriority: "", RequestedProcedureCodeSequence: [], ReferencedStudySequence: [], ProcedureCodeSequence: [], ScheduledProcedureStepSequence: [{ ScheduledStationAETitle: "", ScheduledStationName: "", ScheduledProcedureStepStartDate: "", ScheduledProcedureStepStartTime: "", Modality: "", ScheduledPerformingPhysicianName: "", ScheduledProcedureStepDescription: "", ScheduledProtocolCodeSequence: [], ScheduledProcedureStepLocation: "", ScheduledProcedureStepID: "", RequestedContrastAgent: "", PreMedication: "", AnatomicalOrientationType: "" }], ...e3 };
37493
37493
  s3.QueryRetrieveLevel = "";
37494
- const n3 = new y(t3);
37494
+ const n3 = new y2(t3);
37495
37495
  return n3.setAffectedSopClassUid(r5.ModalityWorklistInformationModelFind), n3.setDataset(new a(s3)), n3;
37496
37496
  }
37497
37497
  }
@@ -37500,7 +37500,7 @@ var require_dcmjs_dimse_min = __commonJS({
37500
37500
  super(n2.CFindResponse, r5.StudyRootQueryRetrieveInformationModelFind, false, e3, t3);
37501
37501
  }
37502
37502
  static fromRequest(e3) {
37503
- if (!(e3 instanceof y))
37503
+ if (!(e3 instanceof y2))
37504
37504
  throw new Error("Request should be an instance of CFindRequest");
37505
37505
  const t3 = new S2(o2.ProcessingFailure);
37506
37506
  return t3.setMessageIdBeingRespondedTo(e3.getMessageId()), t3;
@@ -37536,7 +37536,7 @@ var require_dcmjs_dimse_min = __commonJS({
37536
37536
  return t3.setMessageIdBeingRespondedTo(e3.getMessageId()), t3.setAffectedSopClassUid(e3.getAffectedSopClassUid()), t3.setAffectedSopInstanceUid(e3.getAffectedSopInstanceUid()), t3;
37537
37537
  }
37538
37538
  }
37539
- class P extends l2 {
37539
+ class P2 extends l2 {
37540
37540
  constructor(e3) {
37541
37541
  super(n2.CMoveRequest, r5.StudyRootQueryRetrieveInformationModelMove, false), this.setPriority(e3 || i3.Medium);
37542
37542
  }
@@ -37547,15 +37547,15 @@ var require_dcmjs_dimse_min = __commonJS({
37547
37547
  this.getCommandDataset().setElement("Priority", e3);
37548
37548
  }
37549
37549
  static createStudyMoveRequest(e3, t3, s3) {
37550
- const n3 = { StudyInstanceUID: t3, QueryRetrieveLevel: "STUDY" }, i4 = new P(s3);
37550
+ const n3 = { StudyInstanceUID: t3, QueryRetrieveLevel: "STUDY" }, i4 = new P2(s3);
37551
37551
  return i4.setDataset(new a(n3)), i4.getCommandDataset().setElement("MoveDestination", e3), i4;
37552
37552
  }
37553
37553
  static createSeriesMoveRequest(e3, t3, s3, n3) {
37554
- const i4 = { StudyInstanceUID: t3, SeriesInstanceUID: s3, QueryRetrieveLevel: "SERIES" }, r6 = new P(n3);
37554
+ const i4 = { StudyInstanceUID: t3, SeriesInstanceUID: s3, QueryRetrieveLevel: "SERIES" }, r6 = new P2(n3);
37555
37555
  return r6.setDataset(new a(i4)), r6.getCommandDataset().setElement("MoveDestination", e3), r6;
37556
37556
  }
37557
37557
  static createImageMoveRequest(e3, t3, s3, n3, i4) {
37558
- const r6 = { StudyInstanceUID: t3, SeriesInstanceUID: s3, SOPInstanceUID: n3, QueryRetrieveLevel: "IMAGE" }, o3 = new P(i4);
37558
+ const r6 = { StudyInstanceUID: t3, SeriesInstanceUID: s3, SOPInstanceUID: n3, QueryRetrieveLevel: "IMAGE" }, o3 = new P2(i4);
37559
37559
  return o3.setDataset(new a(r6)), o3.getCommandDataset().setElement("MoveDestination", e3), o3;
37560
37560
  }
37561
37561
  }
@@ -37576,7 +37576,7 @@ var require_dcmjs_dimse_min = __commonJS({
37576
37576
  return this.getCommandDataset().getElement("NumberOfFailedSuboperations");
37577
37577
  }
37578
37578
  static fromRequest(e3) {
37579
- if (!(e3 instanceof P))
37579
+ if (!(e3 instanceof P2))
37580
37580
  throw new Error("Request should be an instance of CMoveRequest");
37581
37581
  const t3 = new v3(o2.ProcessingFailure);
37582
37582
  return t3.setMessageIdBeingRespondedTo(e3.getMessageId()), t3;
@@ -37650,7 +37650,7 @@ var require_dcmjs_dimse_min = __commonJS({
37650
37650
  return t3.setMessageIdBeingRespondedTo(e3.getMessageId()), t3;
37651
37651
  }
37652
37652
  }
37653
- class q2 extends l2 {
37653
+ class q extends l2 {
37654
37654
  constructor(e3, t3, s3) {
37655
37655
  super(n2.NActionRequest, e3, false), this.setRequestedSopInstanceUid(t3), this.setActionTypeId(s3);
37656
37656
  }
@@ -37672,13 +37672,13 @@ var require_dcmjs_dimse_min = __commonJS({
37672
37672
  this.getCommandDataset().setElement("ActionTypeID", e3);
37673
37673
  }
37674
37674
  static fromRequest(e3) {
37675
- if (!(e3 instanceof q2))
37675
+ if (!(e3 instanceof q))
37676
37676
  throw new Error("Request should be an instance of NActionRequest");
37677
37677
  const t3 = new D2(e3.getRequestedSopClassUid(), e3.getRequestedSopInstanceUid(), e3.getActionTypeId(), o2.ProcessingFailure);
37678
37678
  return t3.setMessageIdBeingRespondedTo(e3.getMessageId()), t3;
37679
37679
  }
37680
37680
  }
37681
- class E3 extends l2 {
37681
+ class E2 extends l2 {
37682
37682
  constructor(e3, t3) {
37683
37683
  super(n2.NDeleteRequest, e3, false), this.setRequestedSopInstanceUid(t3);
37684
37684
  }
@@ -37688,7 +37688,7 @@ var require_dcmjs_dimse_min = __commonJS({
37688
37688
  super(n2.NDeleteResponse, e3, false, s3, i4), this.setAffectedSopInstanceUid(t3);
37689
37689
  }
37690
37690
  static fromRequest(e3) {
37691
- if (!(e3 instanceof E3))
37691
+ if (!(e3 instanceof E2))
37692
37692
  throw new Error("Request should be an instance of NDeleteRequest");
37693
37693
  const t3 = new T(e3.getRequestedSopClassUid(), e3.getRequestedSopInstanceUid(), o2.ProcessingFailure);
37694
37694
  return t3.setMessageIdBeingRespondedTo(e3.getMessageId()), t3;
@@ -37748,14 +37748,14 @@ var require_dcmjs_dimse_min = __commonJS({
37748
37748
  return "0".repeat(t3 - s3.length) + s3;
37749
37749
  }
37750
37750
  }
37751
- class B extends p3 {
37751
+ class B2 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
37756
  if (!(e3 instanceof N2))
37757
37757
  throw new Error("Request should be an instance of NGetRequest");
37758
- const t3 = new B(e3.getRequestedSopClassUid(), e3.getRequestedSopInstanceUid(), o2.ProcessingFailure);
37758
+ const t3 = new B2(e3.getRequestedSopClassUid(), e3.getRequestedSopInstanceUid(), o2.ProcessingFailure);
37759
37759
  return t3.setMessageIdBeingRespondedTo(e3.getMessageId()), t3;
37760
37760
  }
37761
37761
  }
@@ -37786,12 +37786,12 @@ var require_dcmjs_dimse_min = __commonJS({
37786
37786
  this.getCommandDataset().setElement("MessageIDBeingRespondedTo", e3);
37787
37787
  }
37788
37788
  static fromRequest(e3) {
37789
- if (!(e3 instanceof y || e3 instanceof P || e3 instanceof x))
37789
+ if (!(e3 instanceof y2 || e3 instanceof P2 || e3 instanceof x))
37790
37790
  throw new Error("Request should be an instance of CFindRequest, CMoveRequest or CGetRequest");
37791
37791
  return new F(e3.getAffectedSopClassUid(), e3.getMessageId());
37792
37792
  }
37793
37793
  }
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 };
37794
+ e2.exports = { CCancelRequest: F, CEchoRequest: R2, CEchoResponse: f, CFindRequest: y2, CFindResponse: S2, CGetRequest: x, CGetResponse: w2, CMoveRequest: P2, CMoveResponse: v3, Command: g2, CStoreRequest: I2, CStoreResponse: C2, NActionRequest: q, NActionResponse: D2, NCreateRequest: A2, NCreateResponse: U2, NDeleteRequest: E2, NDeleteResponse: T, NEventReportRequest: O2, NEventReportResponse: b2, NGetRequest: N2, NGetResponse: B2, 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,17 +37817,17 @@ 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 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);
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);
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: g3, 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: g2, 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: g3, DicomMetaDictionary: l2, ReadBufferStream: p3, WriteBufferStream: R2 } = h3.data, f = h3.log;
37830
- class y {
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;
37830
+ class y2 {
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 || {};
37833
37833
  }
@@ -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 g3.write(s3, n3, this.transferSyntaxUid, e3), Buffer.from(n3.getBuffer());
37851
+ return g2.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 g3.write(e3, s3, i3.ImplicitVRLittleEndian, {}), g3.writeTagObject(t3, "00000000", "UL", s3.size, i3.ImplicitVRLittleEndian, {}), t3.concat(s3), Buffer.from(t3.getBuffer());
37855
+ return g2.write(e3, s3, i3.ImplicitVRLittleEndian, {}), g2.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))
@@ -37869,7 +37869,7 @@ var require_dcmjs_dimse_min = __commonJS({
37869
37869
  });
37870
37870
  }
37871
37871
  toFile(e3, t3, s3, i4) {
37872
- const o3 = { _meta: { FileMetaInformationVersion: new Uint8Array([0, 1]).buffer, MediaStorageSOPClassUID: this.getElement("SOPClassUID") || n2.SecondaryCaptureImageStorage, MediaStorageSOPInstanceUID: this.getElement("SOPInstanceUID") || y.generateDerivedUid(), TransferSyntaxUID: this.getTransferSyntaxUid(), ImplementationClassUID: r5.getImplementationClassUid(), ImplementationVersionName: r5.getImplementationVersion() }, ...this.getElements() }, a2 = l2.denaturalizeDataset(o3._meta), u3 = new m3(a2);
37872
+ const o3 = { _meta: { FileMetaInformationVersion: new Uint8Array([0, 1]).buffer, MediaStorageSOPClassUID: this.getElement("SOPClassUID") || n2.SecondaryCaptureImageStorage, MediaStorageSOPInstanceUID: this.getElement("SOPInstanceUID") || y2.generateDerivedUid(), TransferSyntaxUID: this.getTransferSyntaxUid(), ImplementationClassUID: r5.getImplementationClassUid(), ImplementationVersionName: r5.getImplementationVersion() }, ...this.getElements() }, a2 = l2.denaturalizeDataset(o3._meta), u3 = new m3(a2);
37873
37873
  u3.dict = s3 ? l2.denaturalizeDataset(o3, { ...l2.nameMap, ...s3 }) : l2.denaturalizeDataset(o3), t3 instanceof Function ? c3(e3, Buffer.from(u3.write(i4)), (e4) => {
37874
37874
  t3(e4 || void 0);
37875
37875
  }) : d3(e3, Buffer.from(u3.write(i4)));
@@ -37883,17 +37883,17 @@ 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 = g3.readFile(e3.buffer.slice(e3.byteOffset, e3.byteOffset + e3.byteLength), t3), n3 = l2.naturalizeDataset(s3.meta).TransferSyntaxUID, i4 = l2.naturalizeDataset(s3.dict);
37887
- return new y(i4, n3);
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);
37887
+ return new y2(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 = g3._read(n3, r6, s3);
37892
+ const o3 = g2._read(n3, r6, s3);
37893
37893
  return l2.naturalizeDataset(o3);
37894
37894
  }
37895
37895
  }
37896
- e2.exports = y;
37896
+ e2.exports = y2;
37897
37897
  }, 719: (e2, t2, s2) => {
37898
37898
  const { DefaultImplementation: n2 } = s2(855);
37899
37899
  e2.exports = class {
@@ -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: 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 {
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: y2, CFindRequest: S2, CFindResponse: I2, CGetRequest: C2, CGetResponse: P2, CMoveRequest: v3, CMoveResponse: x, Command: w2, CStoreRequest: A2, CStoreResponse: U2, NActionRequest: q, NActionResponse: D2, NCreateRequest: E2, NCreateResponse: T, NDeleteRequest: O2, NDeleteResponse: b2, NEventReportRequest: N2, NEventReportResponse: B2, NGetRequest: M2, NGetResponse: L2, NSetRequest: F, NSetResponse: k2, Response: $ } = s2(406), j2 = s2(347), V2 = s2(719), G2 = s2(266), _2 = s2(437), { SmartBuffer: z2 } = s2(677), { EOL: Q2 } = s2(37), W = s2(425);
37921
+ class J2 extends W {
37922
37922
  constructor() {
37923
37923
  super();
37924
37924
  }
@@ -37955,19 +37955,19 @@ var require_dcmjs_dimse_min = __commonJS({
37955
37955
  }
37956
37956
  }
37957
37957
  }
37958
- e2.exports = class extends W2 {
37958
+ e2.exports = class extends W {
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 G(), 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 G2(), this._wrapSocket();
37961
37961
  }
37962
37962
  sendAssociationRequest(e3) {
37963
37963
  this.association = e3;
37964
37964
  const t3 = new a(this.association).write();
37965
- this.logId = this.association.getCalledAeTitle(), _2.info(`${this.logId} -> Association request:${Q}${this.association.toString()}`), this._sendPdu(t3);
37965
+ this.logId = this.association.getCalledAeTitle(), _2.info(`${this.logId} -> Association request:${Q2}${this.association.toString()}`), this._sendPdu(t3);
37966
37966
  }
37967
37967
  sendAssociationAccept() {
37968
37968
  this.association.setImplementationClassUid(V2.getImplementationClassUid()), this.association.setImplementationVersion(V2.getImplementationVersion()), this.association.setMaxPduLength(Math.min(this.association.getMaxPduLength(), V2.getMaxPduLength()));
37969
37969
  const e3 = new r5(this.association).write();
37970
- _2.info(`${this.logId} -> Association accept:${Q}${this.association.toString()}`), this._sendPdu(e3);
37970
+ _2.info(`${this.logId} -> Association accept:${Q2}${this.association.toString()}`), this._sendPdu(e3);
37971
37971
  }
37972
37972
  sendAssociationReject(e3, t3, s3) {
37973
37973
  const n3 = new o2(e3, t3, s3), i4 = n3.write();
@@ -38072,10 +38072,10 @@ var require_dcmjs_dimse_min = __commonJS({
38072
38072
  try {
38073
38073
  switch (t3.readPdu(), t3.getType()) {
38074
38074
  case 1:
38075
- this.association = new n2(), new a(this.association).read(t3), this.logId = this.association.getCallingAeTitle(), _2.info(`${this.logId} <- Association request:${Q}${this.association.toString()}`), this.emit("associationRequested", this.association);
38075
+ this.association = new n2(), new a(this.association).read(t3), this.logId = this.association.getCallingAeTitle(), _2.info(`${this.logId} <- Association request:${Q2}${this.association.toString()}`), this.emit("associationRequested", this.association);
38076
38076
  break;
38077
38077
  case 2:
38078
- new r5(this.association).read(t3), this.logId = this.association.getCalledAeTitle(), _2.info(`${this.logId} <- Association accept:${Q}${this.association.toString()}`), this.emit("associationAccepted", this.association);
38078
+ new r5(this.association).read(t3), this.logId = this.association.getCalledAeTitle(), _2.info(`${this.logId} <- Association accept:${Q2}${this.association.toString()}`), this.emit("associationAccepted", this.association);
38079
38079
  break;
38080
38080
  case 3: {
38081
38081
  const e4 = new o2();
@@ -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 g3.CEchoRequest:
38119
+ case g2.CEchoRequest:
38120
38120
  this.dimse = Object.assign(new f(), s3);
38121
38121
  break;
38122
- case g3.CEchoResponse:
38123
- this.dimse = Object.assign(new y(), s3);
38122
+ case g2.CEchoResponse:
38123
+ this.dimse = Object.assign(new y2(), s3);
38124
38124
  break;
38125
- case g3.CFindRequest:
38125
+ case g2.CFindRequest:
38126
38126
  this.dimse = Object.assign(new S2(), s3);
38127
38127
  break;
38128
- case g3.CFindResponse:
38128
+ case g2.CFindResponse:
38129
38129
  this.dimse = Object.assign(new I2(), s3);
38130
38130
  break;
38131
- case g3.CStoreRequest:
38131
+ case g2.CStoreRequest:
38132
38132
  this.dimse = Object.assign(new A2(), s3);
38133
38133
  break;
38134
- case g3.CStoreResponse:
38134
+ case g2.CStoreResponse:
38135
38135
  this.dimse = Object.assign(new U2(), s3);
38136
38136
  break;
38137
- case g3.CMoveRequest:
38137
+ case g2.CMoveRequest:
38138
38138
  this.dimse = Object.assign(new v3(), s3);
38139
38139
  break;
38140
- case g3.CMoveResponse:
38140
+ case g2.CMoveResponse:
38141
38141
  this.dimse = Object.assign(new x(), s3);
38142
38142
  break;
38143
- case g3.CGetRequest:
38143
+ case g2.CGetRequest:
38144
38144
  this.dimse = Object.assign(new C2(), s3);
38145
38145
  break;
38146
- case g3.CGetResponse:
38147
- this.dimse = Object.assign(new P(), s3);
38146
+ case g2.CGetResponse:
38147
+ this.dimse = Object.assign(new P2(), s3);
38148
38148
  break;
38149
- case g3.NCreateRequest:
38150
- this.dimse = Object.assign(new E3(), s3);
38149
+ case g2.NCreateRequest:
38150
+ this.dimse = Object.assign(new E2(), s3);
38151
38151
  break;
38152
- case g3.NCreateResponse:
38152
+ case g2.NCreateResponse:
38153
38153
  this.dimse = Object.assign(new T(), s3);
38154
38154
  break;
38155
- case g3.NActionRequest:
38156
- this.dimse = Object.assign(new q2(), s3);
38155
+ case g2.NActionRequest:
38156
+ this.dimse = Object.assign(new q(), s3);
38157
38157
  break;
38158
- case g3.NActionResponse:
38158
+ case g2.NActionResponse:
38159
38159
  this.dimse = Object.assign(new D2(), s3);
38160
38160
  break;
38161
- case g3.NDeleteRequest:
38161
+ case g2.NDeleteRequest:
38162
38162
  this.dimse = Object.assign(new O2(), s3);
38163
38163
  break;
38164
- case g3.NDeleteResponse:
38164
+ case g2.NDeleteResponse:
38165
38165
  this.dimse = Object.assign(new b2(), s3);
38166
38166
  break;
38167
- case g3.NEventReportRequest:
38167
+ case g2.NEventReportRequest:
38168
38168
  this.dimse = Object.assign(new N2(), s3);
38169
38169
  break;
38170
- case g3.NEventReportResponse:
38171
- this.dimse = Object.assign(new B(), s3);
38170
+ case g2.NEventReportResponse:
38171
+ this.dimse = Object.assign(new B2(), s3);
38172
38172
  break;
38173
- case g3.NGetRequest:
38173
+ case g2.NGetRequest:
38174
38174
  this.dimse = Object.assign(new M2(), s3);
38175
38175
  break;
38176
- case g3.NGetResponse:
38176
+ case g2.NGetResponse:
38177
38177
  this.dimse = Object.assign(new L2(), s3);
38178
38178
  break;
38179
- case g3.NSetRequest:
38179
+ case g2.NSetRequest:
38180
38180
  this.dimse = Object.assign(new F(), s3);
38181
38181
  break;
38182
- case g3.NSetResponse:
38182
+ case g2.NSetResponse:
38183
38183
  this.dimse = Object.assign(new k2(), s3);
38184
38184
  break;
38185
- case g3.CCancelRequest:
38185
+ case g2.CCancelRequest:
38186
38186
  this.dimse = Object.assign(new R2(), s3);
38187
38187
  break;
38188
38188
  default:
@@ -38201,45 +38201,45 @@ var require_dcmjs_dimse_min = __commonJS({
38201
38201
  }
38202
38202
  }
38203
38203
  _performDimse(e3, t3) {
38204
- if (t3 instanceof $2) {
38204
+ if (t3 instanceof $) {
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() === g3.CEchoRequest ? this.emit("cEchoRequest", t3, (t4) => {
38208
+ t3.getCommandFieldType() === g2.CEchoRequest ? this.emit("cEchoRequest", t3, (t4) => {
38209
38209
  this._sendDimse({ context: e3, command: t4 });
38210
- }) : t3.getCommandFieldType() === g3.CFindRequest ? this.emit("cFindRequest", t3, (t4) => {
38210
+ }) : t3.getCommandFieldType() === g2.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() === g3.CStoreRequest ? this.emit("cStoreRequest", t3, (t4) => {
38214
+ }) : t3.getCommandFieldType() === g2.CStoreRequest ? this.emit("cStoreRequest", t3, (t4) => {
38215
38215
  this._sendDimse({ context: e3, command: t4 });
38216
- }) : t3.getCommandFieldType() === g3.CMoveRequest ? this.emit("cMoveRequest", t3, (t4) => {
38216
+ }) : t3.getCommandFieldType() === g2.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() === g3.CGetRequest ? this.emit("cGetRequest", t3, (t4) => {
38220
+ }) : t3.getCommandFieldType() === g2.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() === g3.NCreateRequest ? this.emit("nCreateRequest", t3, (t4) => {
38224
+ }) : t3.getCommandFieldType() === g2.NCreateRequest ? this.emit("nCreateRequest", t3, (t4) => {
38225
38225
  this._sendDimse({ context: e3, command: t4 });
38226
- }) : t3.getCommandFieldType() === g3.NActionRequest ? this.emit("nActionRequest", t3, (t4) => {
38226
+ }) : t3.getCommandFieldType() === g2.NActionRequest ? this.emit("nActionRequest", t3, (t4) => {
38227
38227
  this._sendDimse({ context: e3, command: t4 });
38228
- }) : t3.getCommandFieldType() === g3.NDeleteRequest ? this.emit("nDeleteRequest", t3, (t4) => {
38228
+ }) : t3.getCommandFieldType() === g2.NDeleteRequest ? this.emit("nDeleteRequest", t3, (t4) => {
38229
38229
  this._sendDimse({ context: e3, command: t4 });
38230
- }) : t3.getCommandFieldType() === g3.NEventReportRequest ? this.emit("nEventReportRequest", t3, (t4) => {
38230
+ }) : t3.getCommandFieldType() === g2.NEventReportRequest ? this.emit("nEventReportRequest", t3, (t4) => {
38231
38231
  this._sendDimse({ context: e3, command: t4 });
38232
- }) : t3.getCommandFieldType() === g3.NGetRequest ? this.emit("nGetRequest", t3, (t4) => {
38232
+ }) : t3.getCommandFieldType() === g2.NGetRequest ? this.emit("nGetRequest", t3, (t4) => {
38233
38233
  this._sendDimse({ context: e3, command: t4 });
38234
- }) : t3.getCommandFieldType() === g3.NSetRequest ? this.emit("nSetRequest", t3, (t4) => {
38234
+ }) : t3.getCommandFieldType() === g2.NSetRequest ? this.emit("nSetRequest", t3, (t4) => {
38235
38235
  this._sendDimse({ context: e3, command: t4 });
38236
- }) : t3.getCommandFieldType() === g3.CCancelRequest && this.emit("cCancelRequest", t3);
38236
+ }) : t3.getCommandFieldType() === g2.CCancelRequest && this.emit("cCancelRequest", t3);
38237
38237
  }
38238
38238
  _wrapSocket() {
38239
38239
  this.socket.setTimeout(this.connectTimeout), this.socket.on("connect", () => {
38240
38240
  this.connected = true, this.connectedTime = Date.now(), this.emit("connect");
38241
38241
  });
38242
- const e3 = new J();
38242
+ const e3 = new J2();
38243
38243
  e3.on("pdu", (e4) => {
38244
38244
  this.lastPduTime = Date.now(), this._processPdu(e4);
38245
38245
  }), this.socket.on("data", (t3) => {
@@ -38716,7 +38716,7 @@ var require_dcmjs_dimse_min = __commonJS({
38716
38716
  }
38717
38717
  }, Pdv: m3, RawPdu: h3 };
38718
38718
  }, 975: (e2, t2, s2) => {
38719
- const { CEchoResponse: n2, CFindResponse: i3, CGetResponse: r5, CMoveResponse: o2, CStoreResponse: a, NActionResponse: c3, NCreateResponse: d3, NDeleteResponse: u2, NEventReportResponse: h3, NGetResponse: m3, NSetResponse: g3 } = 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: g2 } = s2(406), l2 = s2(988), p3 = s2(266), R2 = s2(437), f = s2(425), y2 = 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(g3.fromRequest(e3));
38791
+ R2.error("nSetRequest method must be implemented"), t3(g2.fromRequest(e3));
38792
38792
  }
38793
38793
  cCancelRequest(e3) {
38794
38794
  R2.error("cCancelRequest method must be implemented");
@@ -38803,7 +38803,7 @@ var require_dcmjs_dimse_min = __commonJS({
38803
38803
  listen(e3, t3) {
38804
38804
  let s3 = {};
38805
38805
  (t3 = t3 || {}).securityOptions && (s3 = { key: t3.securityOptions.key, cert: t3.securityOptions.cert, ca: t3.securityOptions.ca, requestCert: t3.securityOptions.requestCert, rejectUnauthorized: t3.securityOptions.rejectUnauthorized, minVersion: t3.securityOptions.minVersion, maxVersion: t3.securityOptions.maxVersion, ciphers: t3.securityOptions.ciphers, SNICallback: t3.securityOptions.SNICallback });
38806
- const n3 = t3.securityOptions ? S2 : y;
38806
+ const n3 = t3.securityOptions ? S2 : y2;
38807
38807
  this.server = n3.createServer(s3, (e4) => {
38808
38808
  R2.info(`Client connecting from ${e4.remoteAddress}:${e4.remotePort} ${t3.securityOptions ? e4.authorized ? "(Authorized)" : "(Unauthorized)" : ""}`);
38809
38809
  const s4 = new this.scp.class(e4, t3);
@@ -38858,8 +38858,8 @@ var require_dcmjs_dimse_min = __commonJS({
38858
38858
  }
38859
38859
  };
38860
38860
  }, 10: (e2, t2, s2) => {
38861
- const { Association: n2, PresentationContext: i3 } = s2(201), { Scp: r5, Server: o2 } = s2(975), { CCancelRequest: a, CEchoRequest: c3, CEchoResponse: d3, CFindRequest: u2, CFindResponse: h3, CGetRequest: m3, CGetResponse: g3, CMoveRequest: l2, CMoveResponse: p3, CStoreRequest: R2, CStoreResponse: f, NActionRequest: y, NActionResponse: S2, NCreateRequest: I2, NCreateResponse: C2, NDeleteRequest: P, NDeleteResponse: v3, NEventReportRequest: x, NEventReportResponse: w2, NGetRequest: A2, NGetResponse: U2, NSetRequest: q2, NSetResponse: D2 } = s2(406), { AbortReason: E3, AbortSource: T, CommandFieldType: O2, PresentationContextResult: b2, Priority: N2, RejectReason: B, RejectResult: M2, RejectSource: L2, SopClass: F, Status: k2, StorageClass: $2, TransferSyntax: j2, Uid: V2, UserIdentityType: G } = s2(855), _2 = s2(185), z2 = s2(347), Q = s2(719), W2 = s2(266), J = { association: { Association: n2, PresentationContext: i3 }, Client: _2, constants: { AbortReason: E3, AbortSource: T, CommandFieldType: O2, PresentationContextResult: b2, Priority: N2, RejectReason: B, RejectResult: M2, RejectSource: L2, SopClass: F, Status: k2, StorageClass: $2, TransferSyntax: j2, Uid: V2, UserIdentityType: G }, Dataset: z2, Implementation: Q, log: s2(437), requests: { CCancelRequest: a, CEchoRequest: c3, CFindRequest: u2, CGetRequest: m3, CMoveRequest: l2, CStoreRequest: R2, NActionRequest: y, NCreateRequest: I2, NDeleteRequest: P, NEventReportRequest: x, NGetRequest: A2, NSetRequest: q2 }, responses: { CEchoResponse: d3, CFindResponse: h3, CGetResponse: g3, CMoveResponse: p3, CStoreResponse: f, NActionResponse: S2, NCreateResponse: C2, NDeleteResponse: v3, NEventReportResponse: w2, NGetResponse: U2, NSetResponse: D2 }, Scp: r5, Server: o2, Statistics: W2, version: s2(972) };
38862
- e2.exports = J;
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: y2, NActionResponse: S2, NCreateRequest: I2, NCreateResponse: C2, NDeleteRequest: P2, NDeleteResponse: v3, NEventReportRequest: x, NEventReportResponse: w2, NGetRequest: A2, NGetResponse: U2, NSetRequest: q, NSetResponse: D2 } = s2(406), { AbortReason: E2, AbortSource: T, CommandFieldType: O2, PresentationContextResult: b2, Priority: N2, RejectReason: B2, RejectResult: M2, RejectSource: L2, SopClass: F, Status: k2, StorageClass: $, TransferSyntax: j2, Uid: V2, UserIdentityType: G2 } = s2(855), _2 = s2(185), z2 = s2(347), Q2 = s2(719), W = s2(266), J2 = { association: { Association: n2, PresentationContext: i3 }, Client: _2, constants: { AbortReason: E2, AbortSource: T, CommandFieldType: O2, PresentationContextResult: b2, Priority: N2, RejectReason: B2, RejectResult: M2, RejectSource: L2, SopClass: F, Status: k2, StorageClass: $, TransferSyntax: j2, Uid: V2, UserIdentityType: G2 }, Dataset: z2, Implementation: Q2, log: s2(437), requests: { CCancelRequest: a, CEchoRequest: c3, CFindRequest: u2, CGetRequest: m3, CMoveRequest: l2, CStoreRequest: R2, NActionRequest: y2, NCreateRequest: I2, NDeleteRequest: P2, NEventReportRequest: x, NGetRequest: A2, NSetRequest: q }, 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) };
38862
+ e2.exports = J2;
38863
38863
  }, 437: (e2, t2, s2) => {
38864
38864
  const { createLogger: n2, format: i3, transports: r5 } = s2(469), { combine: o2, printf: a, timestamp: c3 } = i3, d3 = n2({ format: o2(c3(), a(({ level: e3, message: t3, timestamp: s3 }) => `${s3} -- ${e3.toUpperCase()} -- ${t3}`)), transports: [new r5.Console()] });
38865
38865
  e2.exports = d3;
@@ -38912,7 +38912,7 @@ __export(main_exports, {
38912
38912
  module.exports = __toCommonJS(main_exports);
38913
38913
 
38914
38914
  // ../core/dist/esm/index.mjs
38915
- var Ee = class {
38915
+ var Re = class {
38916
38916
  constructor(e, t) {
38917
38917
  this.operator = e;
38918
38918
  this.child = t;
@@ -38921,7 +38921,7 @@ var Ee = class {
38921
38921
  return `${this.operator}(${this.child.toString()})`;
38922
38922
  }
38923
38923
  };
38924
- var j = class {
38924
+ var Q = class {
38925
38925
  constructor(e, t, n) {
38926
38926
  this.operator = e;
38927
38927
  this.left = 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 be = class {
38934
+ var Pe = class {
38935
38935
  constructor() {
38936
38936
  this.prefixParselets = {};
38937
38937
  this.infixParselets = {};
@@ -38955,10 +38955,10 @@ var be = class {
38955
38955
  }, precedence: t });
38956
38956
  }
38957
38957
  construct(e) {
38958
- return new at(e, this.prefixParselets, this.infixParselets);
38958
+ return new ut(e, this.prefixParselets, this.infixParselets);
38959
38959
  }
38960
38960
  };
38961
- var at = class {
38961
+ var ut = class {
38962
38962
  constructor(e, t, n) {
38963
38963
  this.tokens = e, this.prefixParselets = t, this.infixParselets = n;
38964
38964
  }
@@ -39009,139 +39009,177 @@ var at = class {
39009
39009
  return this.infixParselets[e.id === "Symbol" ? e.value : e.id];
39010
39010
  }
39011
39011
  };
39012
- function z(r4) {
39013
- let e = de(r4), t = On(r4);
39012
+ var lt = "ok";
39013
+ var Ce = "created";
39014
+ var pt = "not-modified";
39015
+ var ft = "not-found";
39016
+ var Ae = "accepted";
39017
+ var ir = { resourceType: "OperationOutcome", id: ft, issue: [{ severity: "error", code: "not-found", details: { text: "Not found" } }] };
39018
+ function v(r4, e) {
39019
+ return { resourceType: "OperationOutcome", issue: [{ severity: "error", code: "invalid", details: { text: r4 }, expression: e ? [e] : void 0 }] };
39020
+ }
39021
+ function h(r4) {
39022
+ return { resourceType: "OperationOutcome", issue: [{ severity: "error", code: "structure", details: { text: r4 } }] };
39023
+ }
39024
+ function ne(r4) {
39025
+ return typeof r4 == "object" && r4 !== null && r4.resourceType === "OperationOutcome";
39026
+ }
39027
+ function mt(r4) {
39028
+ return r4.id === lt || r4.id === Ce || r4.id === pt || r4.id === Ae;
39029
+ }
39030
+ var d = class extends Error {
39031
+ constructor(t, n) {
39032
+ super(or(t));
39033
+ this.outcome = t, this.cause = n;
39034
+ }
39035
+ };
39036
+ function we(r4) {
39037
+ return r4 instanceof d ? r4.outcome : ne(r4) ? r4 : v(Nn(r4));
39038
+ }
39039
+ function Nn(r4) {
39040
+ return r4 ? typeof r4 == "string" ? r4 : r4 instanceof Error ? r4.message : ne(r4) ? or(r4) : typeof r4 == "object" && "code" in r4 && typeof r4.code == "string" ? r4.code : JSON.stringify(r4) : "Unknown error";
39041
+ }
39042
+ function or(r4) {
39043
+ let e = r4.issue?.map(Fn) ?? [];
39044
+ return e.length > 0 ? e.join("; ") : "Unknown error";
39045
+ }
39046
+ function Fn(r4) {
39047
+ let e;
39048
+ 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;
39049
+ }
39050
+ function J(r4) {
39051
+ let e = pe(r4), t = _n(r4);
39014
39052
  return t === e ? { reference: e } : { reference: e, display: t };
39015
39053
  }
39016
- function de(r4) {
39017
- return pe(r4) ? r4.reference : `${r4.resourceType}/${r4.id}`;
39054
+ function pe(r4) {
39055
+ return fe(r4) ? r4.reference : `${r4.resourceType}/${r4.id}`;
39018
39056
  }
39019
- function tr(r4) {
39057
+ function ur(r4) {
39020
39058
  if (r4)
39021
- return pe(r4) ? r4.reference.split("/")[1] : r4.id;
39059
+ return fe(r4) ? r4.reference.split("/")[1] : r4.id;
39022
39060
  }
39023
- function kn(r4) {
39061
+ function Mn(r4) {
39024
39062
  return r4.resourceType === "Patient" || r4.resourceType === "Practitioner" || r4.resourceType === "RelatedPerson";
39025
39063
  }
39026
- function On(r4) {
39027
- if (kn(r4)) {
39028
- let e = Vn(r4);
39064
+ function _n(r4) {
39065
+ if (Mn(r4)) {
39066
+ let e = Ln(r4);
39029
39067
  if (e)
39030
39068
  return e;
39031
39069
  }
39032
39070
  if (r4.resourceType === "Device") {
39033
- let e = Dn(r4);
39071
+ let e = Un(r4);
39034
39072
  if (e)
39035
39073
  return e;
39036
39074
  }
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);
39075
+ 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 : pe(r4);
39038
39076
  }
39039
- function Vn(r4) {
39077
+ function Ln(r4) {
39040
39078
  let e = r4.name;
39041
39079
  if (e && e.length > 0)
39042
- return Ie(e[0]);
39080
+ return Ne(e[0]);
39043
39081
  }
39044
- function Dn(r4) {
39082
+ function Un(r4) {
39045
39083
  let e = r4.deviceName;
39046
39084
  if (e && e.length > 0)
39047
39085
  return e[0].name;
39048
39086
  }
39049
- function Re(r4, e) {
39087
+ function Ie(r4, e) {
39050
39088
  let t = new Date(r4);
39051
39089
  t.setUTCHours(0, 0, 0, 0);
39052
39090
  let n = e ? new Date(e) : /* @__PURE__ */ new Date();
39053
39091
  n.setUTCHours(0, 0, 0, 0);
39054
39092
  let i2 = t.getUTCFullYear(), o = t.getUTCMonth(), s = t.getUTCDate(), a = n.getUTCFullYear(), u2 = n.getUTCMonth(), l2 = n.getUTCDate(), f = a - i2;
39055
39093
  (u2 < o || u2 === o && l2 < s) && f--;
39056
- let P = a * 12 + u2 - (i2 * 12 + o);
39057
- l2 < s && P--;
39058
- let B = Math.floor((n.getTime() - t.getTime()) / (1e3 * 60 * 60 * 24));
39059
- return { years: f, months: P, days: B };
39094
+ let E2 = a * 12 + u2 - (i2 * 12 + o);
39095
+ l2 < s && E2--;
39096
+ let q = Math.floor((n.getTime() - t.getTime()) / (1e3 * 60 * 60 * 24));
39097
+ return { years: f, months: E2, days: q };
39060
39098
  }
39061
- function ir(r4, ...e) {
39099
+ function pr(r4, ...e) {
39062
39100
  let t = r4;
39063
39101
  for (let n = 0; n < e.length && t; n++)
39064
39102
  t = t?.extension?.find((i2) => i2.url === e[n]);
39065
39103
  return t;
39066
39104
  }
39067
- function or(r4, e) {
39068
- return JSON.stringify(r4, Nn, e ? 2 : void 0);
39105
+ function fr(r4, e) {
39106
+ return JSON.stringify(r4, Bn, e ? 2 : void 0);
39069
39107
  }
39070
- function Nn(r4, e) {
39071
- return !Fn(r4) && E(e) ? void 0 : e;
39108
+ function Bn(r4, e) {
39109
+ return !qn(r4) && R(e) ? void 0 : e;
39072
39110
  }
39073
- function Fn(r4) {
39111
+ function qn(r4) {
39074
39112
  return !!/\d+$/.exec(r4);
39075
39113
  }
39076
- function E(r4) {
39114
+ function R(r4) {
39077
39115
  if (r4 == null)
39078
39116
  return true;
39079
39117
  let e = typeof r4;
39080
- return e === "string" || e === "object" ? !_n(r4) : false;
39118
+ return e === "string" || e === "object" ? !jn(r4) : false;
39081
39119
  }
39082
- function _n(r4) {
39120
+ function jn(r4) {
39083
39121
  if (r4 == null)
39084
39122
  return false;
39085
39123
  let e = typeof r4;
39086
39124
  return e === "string" && r4 !== "" || e === "object" && ("length" in r4 && r4.length > 0 || Object.keys(r4).length > 0);
39087
39125
  }
39088
- function sr(r4) {
39126
+ function mr(r4) {
39089
39127
  return r4.every((e) => typeof e == "string");
39090
39128
  }
39091
- var ar = [];
39129
+ var hr = [];
39092
39130
  for (let r4 = 0; r4 < 256; r4++)
39093
- ar.push(r4.toString(16).padStart(2, "0"));
39094
- function cr(r4) {
39131
+ hr.push(r4.toString(16).padStart(2, "0"));
39132
+ function gr(r4) {
39095
39133
  let e = new Uint8Array(r4), t = new Array(e.length);
39096
39134
  for (let n = 0; n < e.length; n++)
39097
- t[n] = ar[e[n]];
39135
+ t[n] = hr[e[n]];
39098
39136
  return t.join("");
39099
39137
  }
39100
- function ur(r4) {
39138
+ function yr(r4) {
39101
39139
  let e = new Uint8Array(r4), t = [];
39102
39140
  for (let n = 0; n < e.length; n++)
39103
39141
  t[n] = String.fromCharCode(e[n]);
39104
39142
  return window.btoa(t.join(""));
39105
39143
  }
39106
- function w(r4) {
39144
+ function I(r4) {
39107
39145
  return r4 ? r4.charAt(0).toUpperCase() + r4.substring(1) : "";
39108
39146
  }
39109
- var lt = (r4) => new Promise((e) => {
39147
+ var xt = (r4) => new Promise((e) => {
39110
39148
  setTimeout(e, r4);
39111
39149
  });
39112
- function Ie(r4, e) {
39150
+ function Ne(r4, e) {
39113
39151
  let t = [];
39114
39152
  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) {
39115
- let n = re(r4.text);
39153
+ let n = ie(r4.text);
39116
39154
  if (n)
39117
39155
  return n;
39118
39156
  }
39119
39157
  return t.join(" ").trim();
39120
39158
  }
39121
- function re(r4) {
39159
+ function ie(r4) {
39122
39160
  return typeof r4 == "string" ? r4 : void 0;
39123
39161
  }
39124
- function ni(r4, e) {
39162
+ function ui(r4, e) {
39125
39163
  let t = e.max && e.max === Number.MAX_SAFE_INTEGER ? Number.POSITIVE_INFINITY : e.max;
39126
39164
  return { path: r4, description: "", type: e.type ?? [], min: e.min ?? 0, max: t ?? 1, isArray: !!t && t > 1, constraints: [] };
39127
39165
  }
39128
- function fr(r4) {
39166
+ function Sr(r4) {
39129
39167
  let e = /* @__PURE__ */ Object.create(null);
39130
39168
  for (let [t, n] of Object.entries(r4))
39131
- e[t] = { name: t, elements: Object.fromEntries(Object.entries(n.elements).map(([i2, o]) => [i2, ni(i2, o)])), constraints: [], innerTypes: [] };
39169
+ e[t] = { name: t, elements: Object.fromEntries(Object.entries(n.elements).map(([i2, o]) => [i2, ui(i2, o)])), constraints: [], innerTypes: [] };
39132
39170
  return e;
39133
39171
  }
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" }] } } } };
39135
- function d(r4) {
39172
+ var Er = { 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" }] } } } };
39173
+ function p(r4) {
39136
39174
  return [{ type: c.boolean, value: r4 }];
39137
39175
  }
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 };
39176
+ function y(r4) {
39177
+ 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 } : P(r4) ? { type: c.Quantity, value: r4 } : _(r4) ? { type: r4.resourceType, value: r4 } : { type: c.BackboneElement, value: r4 };
39140
39178
  }
39141
- function V(r4) {
39179
+ function D(r4) {
39142
39180
  return r4.length === 0 ? false : !!r4[0].value;
39143
39181
  }
39144
- function _(r4, e) {
39182
+ function M(r4, e) {
39145
39183
  if (r4.length !== 0) {
39146
39184
  if (r4.length === 1 && (!e || r4[0].type === e))
39147
39185
  return r4[0];
@@ -39151,10 +39189,10 @@ function _(r4, e) {
39151
39189
  function A(r4, e) {
39152
39190
  if (!r4.value)
39153
39191
  return;
39154
- let t = Ve(r4.type, e);
39155
- return t ? oi(r4.value, e, t) : si(r4, e);
39192
+ let t = _e(r4.type, e);
39193
+ return t ? di(r4.value, e, t) : pi(r4, e);
39156
39194
  }
39157
- function oi(r4, e, t) {
39195
+ function di(r4, e, t) {
39158
39196
  let n = t.type;
39159
39197
  if (!n || n.length === 0)
39160
39198
  return;
@@ -39162,7 +39200,7 @@ function oi(r4, e, t) {
39162
39200
  if (t.path.endsWith("[x]")) {
39163
39201
  let a = t.path.split(".").pop().replace("[x]", "");
39164
39202
  for (let u2 of n) {
39165
- let l2 = a + w(u2.code);
39203
+ let l2 = a + I(u2.code);
39166
39204
  if (i2 = r4[l2], s = r4["_" + l2], i2 !== void 0 || s !== void 0) {
39167
39205
  o = u2.code;
39168
39206
  break;
@@ -39173,16 +39211,16 @@ function oi(r4, e, t) {
39173
39211
  if (s)
39174
39212
  if (Array.isArray(i2))
39175
39213
  for (let a = 0; a < Math.max(i2.length, s.length); a++)
39176
- i2[a] = xr(i2[a], s[a]);
39214
+ i2[a] = Cr(i2[a], s[a]);
39177
39215
  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);
39216
+ i2 = Cr(i2, s);
39217
+ if (!R(i2))
39218
+ return (o === "Element" || o === "BackboneElement") && (o = t.type[0].code), Array.isArray(i2) ? i2.map((a) => br(a, o)) : br(i2, o);
39181
39219
  }
39182
- function hr(r4, e) {
39183
- return e === "Resource" && M(r4) && (e = r4.resourceType), { type: e, value: r4 };
39220
+ function br(r4, e) {
39221
+ return e === "Resource" && _(r4) && (e = r4.resourceType), { type: e, value: r4 };
39184
39222
  }
39185
- function si(r4, e) {
39223
+ function pi(r4, e) {
39186
39224
  let t = r4.value;
39187
39225
  if (!t || typeof t != "object")
39188
39226
  return;
@@ -39191,21 +39229,21 @@ function si(r4, e) {
39191
39229
  n = t[e];
39192
39230
  else
39193
39231
  for (let i2 in c) {
39194
- let o = e + w(i2);
39232
+ let o = e + I(i2);
39195
39233
  if (o in t) {
39196
39234
  n = t[o];
39197
39235
  break;
39198
39236
  }
39199
39237
  }
39200
- if (!E(n))
39201
- return Array.isArray(n) ? n.map(g) : g(n);
39238
+ if (!R(n))
39239
+ return Array.isArray(n) ? n.map(y) : y(n);
39202
39240
  }
39203
- function ke(r4) {
39241
+ function Fe(r4) {
39204
39242
  let e = [];
39205
39243
  for (let t of r4) {
39206
39244
  let n = false;
39207
39245
  for (let i2 of e)
39208
- if (V(Tr(t, i2))) {
39246
+ if (D(Ar(t, i2))) {
39209
39247
  n = true;
39210
39248
  break;
39211
39249
  }
@@ -39213,28 +39251,28 @@ function ke(r4) {
39213
39251
  }
39214
39252
  return e;
39215
39253
  }
39216
- function ft(r4) {
39217
- return d(!V(r4));
39254
+ function St(r4) {
39255
+ return p(!D(r4));
39218
39256
  }
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]))));
39257
+ function Et(r4, e) {
39258
+ return r4.length === 0 || e.length === 0 ? [] : r4.length !== e.length ? p(false) : p(r4.every((t, n) => D(Ar(t, e[n]))));
39221
39259
  }
39222
- function Tr(r4, e) {
39260
+ function Ar(r4, e) {
39223
39261
  let t = r4.value?.valueOf(), n = e.value?.valueOf();
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);
39262
+ return typeof t == "number" && typeof n == "number" ? p(Math.abs(t - n) < 1e-8) : P(t) && P(n) ? p(wr(t, n)) : p(typeof t == "object" && typeof n == "object" ? Rt(r4, e) : t === n);
39225
39263
  }
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])))));
39264
+ function bt(r4, e) {
39265
+ return r4.length === 0 && e.length === 0 ? p(true) : r4.length !== e.length ? p(false) : (r4.sort(Rr), e.sort(Rr), p(r4.every((t, n) => D(fi(t, e[n])))));
39228
39266
  }
39229
- function ai(r4, e) {
39267
+ function fi(r4, e) {
39230
39268
  let { type: t, value: n } = r4, { type: i2, value: o } = e, s = n?.valueOf(), a = o?.valueOf();
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);
39269
+ return typeof s == "number" && typeof a == "number" ? p(Math.abs(s - a) < 0.01) : P(s) && P(a) ? p(wr(s, a)) : p(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" ? Rt({ ...s, id: void 0 }, { ...a, id: void 0 }) : typeof s == "string" && typeof a == "string" ? s.toLowerCase() === a.toLowerCase() : s === a);
39232
39270
  }
39233
- function yr(r4, e) {
39271
+ function Rr(r4, e) {
39234
39272
  let t = r4.value?.valueOf(), n = e.value?.valueOf();
39235
39273
  return typeof t == "number" && typeof n == "number" ? t - n : typeof t == "string" && typeof n == "string" ? t.localeCompare(n) : 0;
39236
39274
  }
39237
- function Oe(r4, e) {
39275
+ function Me(r4, e) {
39238
39276
  let { value: t } = r4;
39239
39277
  if (t == null)
39240
39278
  return false;
@@ -39251,127 +39289,89 @@ function Oe(r4, e) {
39251
39289
  case "Time":
39252
39290
  return typeof t == "string" && !!/^T\d/.exec(t);
39253
39291
  case "Period":
39254
- return ci(t);
39292
+ return mi(t);
39255
39293
  case "Quantity":
39256
- return b(t);
39294
+ return P(t);
39257
39295
  default:
39258
39296
  return typeof t == "object" && t?.resourceType === e;
39259
39297
  }
39260
39298
  }
39261
- function ci(r4) {
39299
+ function mi(r4) {
39262
39300
  return !!(r4 && typeof r4 == "object" && "start" in r4);
39263
39301
  }
39264
- function b(r4) {
39302
+ function P(r4) {
39265
39303
  return !!(r4 && typeof r4 == "object" && "value" in r4 && typeof r4.value == "number");
39266
39304
  }
39267
- function vr(r4, e) {
39305
+ function wr(r4, e) {
39268
39306
  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);
39269
39307
  }
39270
- function yt(r4, e) {
39308
+ function Rt(r4, e) {
39271
39309
  let t = Object.keys(r4), n = Object.keys(e);
39272
39310
  if (t.length !== n.length)
39273
39311
  return false;
39274
39312
  for (let i2 of t) {
39275
39313
  let o = r4[i2], s = e[i2];
39276
- if (gr(o) && gr(s)) {
39277
- if (!yt(o, s))
39314
+ if (Pr(o) && Pr(s)) {
39315
+ if (!Rt(o, s))
39278
39316
  return false;
39279
39317
  } else if (o !== s)
39280
39318
  return false;
39281
39319
  }
39282
39320
  return true;
39283
39321
  }
39284
- function gr(r4) {
39322
+ function Pr(r4) {
39285
39323
  return r4 !== null && typeof r4 == "object";
39286
39324
  }
39287
- function xr(r4, e) {
39325
+ function Cr(r4, e) {
39288
39326
  if (e) {
39289
39327
  if (typeof e != "object")
39290
39328
  throw new Error("Primitive extension must be an object");
39291
- return ui(r4 ?? {}, e);
39329
+ return hi(r4 ?? {}, e);
39292
39330
  }
39293
39331
  return r4;
39294
39332
  }
39295
- function ui(r4, e) {
39333
+ function hi(r4, e) {
39296
39334
  return delete e.__proto__, delete e.constructor, Object.assign(r4, e);
39297
39335
  }
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) {
39305
- return { resourceType: "OperationOutcome", issue: [{ severity: "error", code: "invalid", details: { text: r4 }, expression: e ? [e] : void 0 }] };
39306
- }
39307
- function h(r4) {
39308
- return { resourceType: "OperationOutcome", issue: [{ severity: "error", code: "structure", details: { text: r4 } }] };
39309
- }
39310
- function Fe(r4) {
39311
- return typeof r4 == "object" && r4 !== null && r4.resourceType === "OperationOutcome";
39312
- }
39313
- function St(r4) {
39314
- return r4.id === gt || r4.id === De || r4.id === Tt || r4.id === Ne;
39315
- }
39316
- var p = class extends Error {
39317
- constructor(t, n) {
39318
- super(Pr(t));
39319
- this.outcome = t, this.cause = n;
39320
- }
39321
- };
39322
- function _e(r4) {
39323
- return r4 instanceof p ? r4.outcome : Fe(r4) ? r4 : I(li(r4));
39324
- }
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";
39327
- }
39328
- function Pr(r4) {
39329
- let e = r4.issue?.map(di) ?? [];
39330
- return e.length > 0 ? e.join("; ") : "Unknown error";
39331
- }
39332
- function di(r4) {
39333
- let e;
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;
39335
- }
39336
- function At(r4) {
39337
- return new Rt(r4).parse();
39338
- }
39339
- var fe = fr(mr);
39340
- var Ct = /* @__PURE__ */ Object.create(null);
39341
- var wr = /* @__PURE__ */ Object.create(null);
39342
39336
  function wt(r4) {
39337
+ return new Ct(r4).parse();
39338
+ }
39339
+ var me = Sr(Er);
39340
+ var It = /* @__PURE__ */ Object.create(null);
39341
+ var Ir = /* @__PURE__ */ Object.create(null);
39342
+ function kt(r4) {
39343
39343
  let e;
39344
- return r4 ? (e = wr[r4], e || (e = wr[r4] = /* @__PURE__ */ Object.create(null))) : e = fe, e;
39344
+ return r4 ? (e = Ir[r4], e || (e = Ir[r4] = /* @__PURE__ */ Object.create(null))) : e = me, e;
39345
39345
  }
39346
- function It(r4, e) {
39346
+ function Ot(r4, e) {
39347
39347
  let t = Array.isArray(r4) ? r4 : r4.entry?.map((n) => n.resource) ?? [];
39348
39348
  for (let n of t)
39349
- pi(n, e);
39349
+ gi(n, e);
39350
39350
  }
39351
- function pi(r4, e) {
39351
+ function gi(r4, e) {
39352
39352
  if (!r4?.name)
39353
39353
  throw new Error("Failed loading StructureDefinition from bundle");
39354
39354
  if (r4.resourceType !== "StructureDefinition")
39355
39355
  return;
39356
- let t = At(r4), n = wt(e);
39357
- n[r4.name] = t, e && r4.url === e && (Ct[e] = t);
39356
+ let t = wt(r4), n = kt(e);
39357
+ n[r4.name] = t, e && r4.url === e && (It[e] = t);
39358
39358
  for (let i2 of t.innerTypes)
39359
39359
  i2.parentType = t, n[i2.name] = i2;
39360
39360
  }
39361
- function Dr(r4) {
39362
- return !!fe[r4];
39361
+ function Nr(r4) {
39362
+ return !!me[r4];
39363
39363
  }
39364
- function Nr(r4, e) {
39365
- return wt(e)[r4];
39364
+ function Le(r4, e) {
39365
+ return kt(e)[r4];
39366
39366
  }
39367
- function _r(r4) {
39368
- return !!Ct[r4];
39367
+ function Mr(r4) {
39368
+ return !!It[r4];
39369
39369
  }
39370
- var Rt = class {
39370
+ var Ct = class {
39371
39371
  constructor(e) {
39372
39372
  if (!e.snapshot?.element || e.snapshot.element.length === 0)
39373
39373
  throw new Error(`No snapshot defined for StructureDefinition '${e.name}'`);
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 = [];
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: vi(e), elements: {}, constraints: this.parseElementDefinition(this.root).constraints, innerTypes: [], summaryProperties: /* @__PURE__ */ new Set(), mandatoryProperties: /* @__PURE__ */ new Set() }, this.innerTypes = [];
39375
39375
  }
39376
39376
  parse() {
39377
39377
  let e = this.next();
@@ -39380,7 +39380,7 @@ var Rt = class {
39380
39380
  this.parseSliceStart(e);
39381
39381
  else if (e.id?.includes(":")) {
39382
39382
  if (this.slicingContext?.current) {
39383
- let t = bt(e, this.slicingContext.path);
39383
+ let t = Pt(e, this.slicingContext.path);
39384
39384
  this.slicingContext.current.elements[t] = this.parseElementDefinition(e);
39385
39385
  }
39386
39386
  } else {
@@ -39389,13 +39389,13 @@ var Rt = class {
39389
39389
  let n = this.backboneContext;
39390
39390
  for (; n; ) {
39391
39391
  if (e.path?.startsWith(n.path + ".")) {
39392
- n.type.elements[bt(e, n.path)] = t;
39392
+ n.type.elements[Pt(e, n.path)] = t;
39393
39393
  break;
39394
39394
  }
39395
39395
  n = n.parent;
39396
39396
  }
39397
39397
  if (!n) {
39398
- let i2 = bt(e, this.root.path);
39398
+ let i2 = Pt(e, this.root.path);
39399
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;
39400
39400
  }
39401
39401
  this.checkFieldExit(e);
@@ -39408,26 +39408,26 @@ var Rt = class {
39408
39408
  this.isInnerType(e) && this.enterInnerType(e), e.slicing && !this.slicingContext && this.enterSlice(e, t);
39409
39409
  }
39410
39410
  enterInnerType(e) {
39411
- for (; this.backboneContext && !ne(this.backboneContext?.path, e.path); )
39411
+ for (; this.backboneContext && !oe(this.backboneContext?.path, e.path); )
39412
39412
  this.innerTypes.push(this.backboneContext.type), 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 };
39413
+ this.backboneContext = { type: { name: At(e), title: e.label, description: e.definition, elements: {}, constraints: this.parseElementDefinition(e).constraints, innerTypes: [] }, path: e.path ?? "", parent: oe(this.backboneContext?.path, e.path) ? this.backboneContext : this.backboneContext?.parent };
39414
39414
  }
39415
39415
  enterSlice(e, t) {
39416
- hi(e) && !this.peek()?.sliceName || (t.slicing = { discriminator: (e.slicing?.discriminator ?? []).map((n) => {
39416
+ Ti(e) && !this.peek()?.sliceName || (t.slicing = { discriminator: (e.slicing?.discriminator ?? []).map((n) => {
39417
39417
  if (n.type !== "value" && n.type !== "pattern" && n.type !== "type")
39418
39418
  throw new Error(`Unsupported slicing discriminator type: ${n.type}`);
39419
39419
  return { path: n.path, type: n.type };
39420
39420
  }), slices: [], ordered: e.slicing?.ordered ?? false, rule: e.slicing?.rules }, this.slicingContext = { field: t.slicing, path: e.path ?? "" });
39421
39421
  }
39422
39422
  checkFieldExit(e = void 0) {
39423
- if (this.backboneContext && !ne(this.backboneContext.path, e?.path))
39423
+ if (this.backboneContext && !oe(this.backboneContext.path, e?.path))
39424
39424
  if (this.backboneContext.parent)
39425
39425
  do
39426
39426
  this.innerTypes.push(this.backboneContext.type), this.backboneContext = this.backboneContext.parent;
39427
- while (this.backboneContext && !ne(this.backboneContext.path, e?.path));
39427
+ while (this.backboneContext && !oe(this.backboneContext.path, e?.path));
39428
39428
  else
39429
39429
  this.innerTypes.push(this.backboneContext.type), delete this.backboneContext;
39430
- this.slicingContext && !ne(this.slicingContext.path, e?.path) && (this.slicingContext?.current && this.slicingContext.field.slices.push(this.slicingContext.current), delete this.slicingContext);
39430
+ this.slicingContext && !oe(this.slicingContext.path, e?.path) && (this.slicingContext?.current && this.slicingContext.field.slices.push(this.slicingContext.current), delete this.slicingContext);
39431
39431
  }
39432
39432
  next() {
39433
39433
  let e = this.peek();
@@ -39446,7 +39446,7 @@ var Rt = class {
39446
39446
  }
39447
39447
  isInnerType(e) {
39448
39448
  let t = this.peek();
39449
- return !!(ne(e?.path, t?.path) && e.type?.some((n) => ["BackboneElement", "Element"].includes(n.code)));
39449
+ return !!(oe(e?.path, t?.path) && e.type?.some((n) => ["BackboneElement", "Element"].includes(n.code)));
39450
39450
  }
39451
39451
  parseSliceStart(e) {
39452
39452
  if (!this.slicingContext)
@@ -39456,57 +39456,57 @@ var Rt = class {
39456
39456
  parseElementDefinitionType(e) {
39457
39457
  return (e.type ?? []).map((t) => {
39458
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 };
39459
+ return (t.code === "BackboneElement" || t.code === "Element") && (n = At(e)), n || (n = pr(t, "http://hl7.org/fhir/StructureDefinition/structuredefinition-fhir-type")?.valueUrl), n || (n = t.code ?? ""), { code: n, targetProfile: t.targetProfile, profile: t.profile };
39460
39460
  });
39461
39461
  }
39462
39462
  parseElementDefinition(e) {
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 };
39463
+ let t = Or(e.max), n = e.base?.max ? Or(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: Vr(A(i2, "fixed[x]")), pattern: Vr(A(i2, "pattern[x]")), binding: e.binding };
39465
39465
  }
39466
39466
  };
39467
- function kr(r4) {
39467
+ function Or(r4) {
39468
39468
  return r4 === "*" ? Number.POSITIVE_INFINITY : Number.parseInt(r4, 10);
39469
39469
  }
39470
- function bt(r4, e = "") {
39471
- return mi(r4.path, e);
39470
+ function Pt(r4, e = "") {
39471
+ return xi(r4.path, e);
39472
39472
  }
39473
- function mi(r4, e) {
39473
+ function xi(r4, e) {
39474
39474
  return r4 ? e && r4.startsWith(e) ? r4.substring(e.length + 1) : r4 : "";
39475
39475
  }
39476
- function ne(r4, e) {
39476
+ function oe(r4, e) {
39477
39477
  return !r4 || !e ? false : e.startsWith(r4 + ".") || e === r4;
39478
39478
  }
39479
- function Or(r4) {
39480
- return Array.isArray(r4) && r4.length > 0 ? r4[0] : E(r4) ? void 0 : r4;
39479
+ function Vr(r4) {
39480
+ return Array.isArray(r4) && r4.length > 0 ? r4[0] : R(r4) ? void 0 : r4;
39481
39481
  }
39482
- function hi(r4) {
39482
+ function Ti(r4) {
39483
39483
  let e = r4.slicing?.discriminator;
39484
39484
  return !!(r4.type?.some((t) => t.code === "Extension") && e?.length === 1 && e[0].type === "value" && e[0].path === "url");
39485
39485
  }
39486
- function yi(r4) {
39486
+ function vi(r4) {
39487
39487
  let e = r4.description;
39488
39488
  return e?.startsWith(`Base StructureDefinition for ${r4.name} Type: `) && (e = e.substring(`Base StructureDefinition for ${r4.name} Type: `.length)), e;
39489
39489
  }
39490
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" };
39491
- function Ot(r4) {
39491
+ function Dt(r4) {
39492
39492
  for (let e of r4.base ?? []) {
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;
39493
+ let t = N.types[e];
39494
+ t || (t = { searchParamsDetails: {} }, N.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;
39495
39495
  }
39496
39496
  }
39497
- function Pt(r4) {
39497
+ function At(r4) {
39498
39498
  let e = r4.type?.[0]?.code;
39499
- return e === "BackboneElement" || e === "Element" ? gi((r4.base?.path ?? r4.path)?.split(".")) : e;
39499
+ return e === "BackboneElement" || e === "Element" ? Si((r4.base?.path ?? r4.path)?.split(".")) : e;
39500
39500
  }
39501
- function gi(r4) {
39502
- return r4.length === 1 ? r4[0] : r4.map(w).join("");
39501
+ function Si(r4) {
39502
+ return r4.length === 1 ? r4[0] : r4.map(I).join("");
39503
39503
  }
39504
- function Ve(r4, e) {
39505
- let t = Nr(r4);
39504
+ function _e(r4, e) {
39505
+ let t = Le(r4);
39506
39506
  if (t)
39507
- return Si(t.elements, e);
39507
+ return Pi(t.elements, e);
39508
39508
  }
39509
- function Si(r4, e) {
39509
+ function Pi(r4, e) {
39510
39510
  let t = r4[e] ?? r4[e + "[x]"];
39511
39511
  if (t)
39512
39512
  return t;
@@ -39519,14 +39519,14 @@ function Si(r4, e) {
39519
39519
  }
39520
39520
  }
39521
39521
  }
39522
- function M(r4) {
39522
+ function _(r4) {
39523
39523
  return !!(r4 && typeof r4 == "object" && "resourceType" in r4);
39524
39524
  }
39525
- function pe(r4) {
39525
+ function fe(r4) {
39526
39526
  return !!(r4 && typeof r4 == "object" && "reference" in r4);
39527
39527
  }
39528
- var D = { types: {} };
39529
- function oe(r4) {
39528
+ var N = { types: {} };
39529
+ function ae(r4) {
39530
39530
  if (r4.startsWith("T"))
39531
39531
  return r4 + "T00:00:00.000Z".substring(r4.length);
39532
39532
  if (r4.length <= 10)
@@ -39537,33 +39537,33 @@ function oe(r4) {
39537
39537
  return r4;
39538
39538
  }
39539
39539
  }
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) => {
39540
+ var he = () => [];
39541
+ var b = { empty: (r4, e) => p(e.length === 0), exists: (r4, e, t) => t ? p(e.filter((n) => D(t.eval(r4, [n]))).length > 0) : p(e.length > 0), all: (r4, e, t) => p(e.every((n) => D(t.eval(r4, [n])))), allTrue: (r4, e) => {
39542
39542
  for (let t of e)
39543
39543
  if (!t.value)
39544
- return d(false);
39545
- return d(true);
39544
+ return p(false);
39545
+ return p(true);
39546
39546
  }, anyTrue: (r4, e) => {
39547
39547
  for (let t of e)
39548
39548
  if (t.value)
39549
- return d(true);
39550
- return d(false);
39549
+ return p(true);
39550
+ return p(false);
39551
39551
  }, allFalse: (r4, e) => {
39552
39552
  for (let t of e)
39553
39553
  if (t.value)
39554
- return d(false);
39555
- return d(true);
39554
+ return p(false);
39555
+ return p(true);
39556
39556
  }, anyFalse: (r4, e) => {
39557
39557
  for (let t of e)
39558
39558
  if (!t.value)
39559
- return d(true);
39560
- return d(false);
39561
- }, subsetOf: me, supersetOf: me, count: (r4, e) => [{ type: c.integer, value: e.length }], distinct: (r4, e) => {
39559
+ return p(true);
39560
+ return p(false);
39561
+ }, subsetOf: he, supersetOf: he, count: (r4, e) => [{ type: c.integer, value: e.length }], distinct: (r4, e) => {
39562
39562
  let t = [];
39563
39563
  for (let n of e)
39564
39564
  t.some((i2) => i2.value === n.value) || t.push(n);
39565
39565
  return t;
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) => {
39566
+ }, isDistinct: (r4, e) => p(e.length === b.distinct(r4, e).length), where: (r4, e, t) => e.filter((n) => D(t.eval(r4, [n]))), select: (r4, e, t) => e.map((n) => t.eval(r4, [n])).flat(), repeat: he, ofType: (r4, e, t) => e.filter((n) => n.type === t.name), single: (r4, e) => {
39567
39567
  if (e.length > 1)
39568
39568
  throw new Error("Expected input length one for single()");
39569
39569
  return e.length === 0 ? [] : e.slice(0, 1);
@@ -39595,17 +39595,17 @@ var S = { empty: (r4, e) => d(e.length === 0), exists: (r4, e, t) => t ? d(e.fil
39595
39595
  if (!t)
39596
39596
  return e;
39597
39597
  let n = t.eval(r4, e);
39598
- return ke([...e, ...n]);
39598
+ return Fe([...e, ...n]);
39599
39599
  }, combine: (r4, e, t) => {
39600
39600
  if (!t)
39601
39601
  return e;
39602
39602
  let n = t.eval(r4, e);
39603
39603
  return [...e, ...n];
39604
- }, htmlChecks: (r4, e, t) => [g(true)], iif: (r4, e, t, n, i2) => {
39604
+ }, htmlChecks: (r4, e, t) => [y(true)], iif: (r4, e, t, n, i2) => {
39605
39605
  let o = t.eval(r4, e);
39606
39606
  if (o.length > 1 || o.length === 1 && typeof o[0].value != "boolean")
39607
39607
  throw new Error("Expected criterion to evaluate to a Boolean");
39608
- return V(o) ? n.eval(r4, e) : i2 ? i2.eval(r4, e) : [];
39608
+ return D(o) ? n.eval(r4, e) : i2 ? i2.eval(r4, e) : [];
39609
39609
  }, toBoolean: (r4, e) => {
39610
39610
  if (e.length === 0)
39611
39611
  return [];
@@ -39613,81 +39613,81 @@ var S = { empty: (r4, e) => d(e.length === 0), exists: (r4, e, t) => t ? d(e.fil
39613
39613
  if (typeof t == "boolean")
39614
39614
  return [{ type: c.boolean, value: t }];
39615
39615
  if (typeof t == "number" && (t === 0 || t === 1))
39616
- return d(!!t);
39616
+ return p(!!t);
39617
39617
  if (typeof t == "string") {
39618
39618
  let n = t.toLowerCase();
39619
39619
  if (["true", "t", "yes", "y", "1", "1.0"].includes(n))
39620
- return d(true);
39620
+ return p(true);
39621
39621
  if (["false", "f", "no", "n", "0", "0.0"].includes(n))
39622
- return d(false);
39622
+ return p(false);
39623
39623
  }
39624
39624
  return [];
39625
- }, convertsToBoolean: (r4, e) => e.length === 0 ? [] : d(S.toBoolean(r4, e).length === 1), toInteger: (r4, e) => {
39625
+ }, convertsToBoolean: (r4, e) => e.length === 0 ? [] : p(b.toBoolean(r4, e).length === 1), toInteger: (r4, e) => {
39626
39626
  if (e.length === 0)
39627
39627
  return [];
39628
39628
  let [{ value: t }] = U(e, 1);
39629
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 }] : [];
39630
- }, convertsToInteger: (r4, e) => e.length === 0 ? [] : d(S.toInteger(r4, e).length === 1), toDate: (r4, e) => {
39630
+ }, convertsToInteger: (r4, e) => e.length === 0 ? [] : p(b.toInteger(r4, e).length === 1), toDate: (r4, e) => {
39631
39631
  if (e.length === 0)
39632
39632
  return [];
39633
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) }] : [];
39635
- }, convertsToDate: (r4, e) => e.length === 0 ? [] : d(S.toDate(r4, e).length === 1), toDateTime: (r4, e) => {
39634
+ return typeof t == "string" && /^\d{4}(-\d{2}(-\d{2})?)?/.exec(t) ? [{ type: c.date, value: ae(t) }] : [];
39635
+ }, convertsToDate: (r4, e) => e.length === 0 ? [] : p(b.toDate(r4, e).length === 1), toDateTime: (r4, e) => {
39636
39636
  if (e.length === 0)
39637
39637
  return [];
39638
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) }] : [];
39640
- }, convertsToDateTime: (r4, e) => e.length === 0 ? [] : d(S.toDateTime(r4, e).length === 1), toDecimal: (r4, e) => {
39639
+ return typeof t == "string" && /^\d{4}(-\d{2}(-\d{2})?)?/.exec(t) ? [{ type: c.dateTime, value: ae(t) }] : [];
39640
+ }, convertsToDateTime: (r4, e) => e.length === 0 ? [] : p(b.toDateTime(r4, e).length === 1), toDecimal: (r4, e) => {
39641
39641
  if (e.length === 0)
39642
39642
  return [];
39643
39643
  let [{ value: t }] = U(e, 1);
39644
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 }] : [];
39645
- }, convertsToDecimal: (r4, e) => e.length === 0 ? [] : d(S.toDecimal(r4, e).length === 1), toQuantity: (r4, e) => {
39645
+ }, convertsToDecimal: (r4, e) => e.length === 0 ? [] : p(b.toDecimal(r4, e).length === 1), toQuantity: (r4, e) => {
39646
39646
  if (e.length === 0)
39647
39647
  return [];
39648
39648
  let [{ value: t }] = U(e, 1);
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" } }] : [];
39650
- }, convertsToQuantity: (r4, e) => e.length === 0 ? [] : d(S.toQuantity(r4, e).length === 1), toString: (r4, e) => {
39649
+ return P(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" } }] : [];
39650
+ }, convertsToQuantity: (r4, e) => e.length === 0 ? [] : p(b.toQuantity(r4, e).length === 1), toString: (r4, e) => {
39651
39651
  if (e.length === 0)
39652
39652
  return [];
39653
39653
  let [{ value: t }] = U(e, 1);
39654
- return t == null ? [] : b(t) ? [{ type: c.string, value: `${t.value} '${t.unit}'` }] : [{ type: c.string, value: t.toString() }];
39655
- }, convertsToString: (r4, e) => e.length === 0 ? [] : d(S.toString(r4, e).length === 1), toTime: (r4, e) => {
39654
+ return t == null ? [] : P(t) ? [{ type: c.string, value: `${t.value} '${t.unit}'` }] : [{ type: c.string, value: t.toString() }];
39655
+ }, convertsToString: (r4, e) => e.length === 0 ? [] : p(b.toString(r4, e).length === 1), toTime: (r4, e) => {
39656
39656
  if (e.length === 0)
39657
39657
  return [];
39658
39658
  let [{ value: t }] = U(e, 1);
39659
39659
  if (typeof t == "string") {
39660
39660
  let n = /^T?(\d{2}(:\d{2}(:\d{2})?)?)/.exec(t);
39661
39661
  if (n)
39662
- return [{ type: c.time, value: oe("T" + n[1]) }];
39662
+ return [{ type: c.time, value: ae("T" + n[1]) }];
39663
39663
  }
39664
39664
  return [];
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) => {
39665
+ }, convertsToTime: (r4, e) => e.length === 0 ? [] : p(b.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) => {
39666
39666
  let a = o, u2 = s ? a + s : i2.length;
39667
39667
  return a < 0 || a >= i2.length ? void 0 : i2.substring(a, u2);
39668
- }, r4, e, t, n), startsWith: (r4, e, t) => k((n, i2) => n.startsWith(i2), r4, e, t), endsWith: (r4, e, t) => k((n, i2) => n.endsWith(i2), r4, e, t), contains: (r4, e, t) => k((n, i2) => n.includes(i2), r4, e, t), upper: (r4, e) => k((t) => t.toUpperCase(), r4, e), lower: (r4, e) => k((t) => t.toLowerCase(), r4, e), replace: (r4, e, t, n) => k((i2, o, s) => i2.replaceAll(o, s), r4, e, t, n), matches: (r4, e, t) => k((n, i2) => !!new RegExp(i2).exec(n), r4, e, t), replaceMatches: (r4, e, t, n) => k((i2, o, s) => i2.replaceAll(o, s), r4, e, t, n), length: (r4, e) => k((t) => t.length, r4, e), toChars: (r4, e) => k((t) => t ? t.split("") : void 0, r4, e), abs: (r4, e) => L(Math.abs, r4, e), ceiling: (r4, e) => L(Math.ceil, r4, e), exp: (r4, e) => L(Math.exp, r4, e), floor: (r4, e) => L(Math.floor, r4, e), ln: (r4, e) => L(Math.log, r4, e), log: (r4, e, t) => L((n, i2) => Math.log(n) / Math.log(i2), r4, e, t), power: (r4, e, t) => L(Math.pow, r4, e, t), round: (r4, e) => L(Math.round, r4, e), sqrt: (r4, e) => L(Math.sqrt, r4, e), truncate: (r4, e) => L((t) => t | 0, r4, e), children: me, descendants: me, trace: (r4, e, t) => (console.log("trace", e, t), e), now: () => [{ type: c.dateTime, value: (/* @__PURE__ */ new Date()).toISOString() }], timeOfDay: () => [{ type: c.time, value: (/* @__PURE__ */ new Date()).toISOString().substring(11) }], today: () => [{ type: c.date, value: (/* @__PURE__ */ new Date()).toISOString().substring(0, 10) }], between: (r4, e, t, n, i2) => {
39669
- let o = S.toDateTime(r4, t.eval(r4, e));
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: he, descendants: he, trace: (r4, e, t) => (console.log("trace", e, t), e), now: () => [{ type: c.dateTime, value: (/* @__PURE__ */ new Date()).toISOString() }], timeOfDay: () => [{ type: c.time, value: (/* @__PURE__ */ new Date()).toISOString().substring(11) }], today: () => [{ type: c.date, value: (/* @__PURE__ */ new Date()).toISOString().substring(0, 10) }], between: (r4, e, t, n, i2) => {
39669
+ let o = b.toDateTime(r4, t.eval(r4, e));
39670
39670
  if (o.length === 0)
39671
39671
  throw new Error("Invalid start date");
39672
- let s = S.toDateTime(r4, n.eval(r4, e));
39672
+ let s = b.toDateTime(r4, n.eval(r4, e));
39673
39673
  if (s.length === 0)
39674
39674
  throw new Error("Invalid end date");
39675
39675
  let a = i2.eval(r4, e)[0]?.value;
39676
39676
  if (a !== "years" && a !== "months" && a !== "days")
39677
39677
  throw new Error("Invalid units");
39678
- let u2 = Re(o[0].value, s[0].value);
39678
+ let u2 = Ie(o[0].value, s[0].value);
39679
39679
  return [{ type: c.Quantity, value: { value: u2[a], unit: a } }];
39680
39680
  }, is: (r4, e, t) => {
39681
39681
  let 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) })) : [];
39683
- }, not: (r4, e) => S.toBoolean(r4, e).map((t) => ({ type: c.boolean, value: !t.value })), resolve: (r4, e) => e.map((t) => {
39682
+ return t instanceof B ? n = t.name : t instanceof G && (n = t.left.name + "." + t.right.name), n ? e.map((i2) => ({ type: c.boolean, value: Me(i2, n) })) : [];
39683
+ }, not: (r4, e) => b.toBoolean(r4, e).map((t) => ({ type: c.boolean, value: !t.value })), resolve: (r4, e) => e.map((t) => {
39684
39684
  let n = t.value, i2;
39685
39685
  if (typeof n == "string")
39686
39686
  i2 = n;
39687
39687
  else if (typeof n == "object") {
39688
39688
  let o = n;
39689
39689
  if (o.resource)
39690
- return g(o.resource);
39690
+ return y(o.resource);
39691
39691
  o.reference ? i2 = o.reference : o.type && o.identifier && (i2 = `${o.type}?identifier=${o.identifier.system}|${o.identifier.value}`);
39692
39692
  }
39693
39693
  if (i2?.includes("?")) {
@@ -39699,7 +39699,7 @@ var S = { empty: (r4, e) => d(e.length === 0), exists: (r4, e, t) => t ? d(e.fil
39699
39699
  return { type: o, value: { resourceType: o, id: s } };
39700
39700
  }
39701
39701
  return { type: c.BackboneElement, value: void 0 };
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) => {
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" } } : _(t) ? { type: c.BackboneElement, value: { namespace: "FHIR", name: t.resourceType } } : { type: c.BackboneElement, value: null }), conformsTo: (r4, e, t) => {
39703
39703
  let n = t.eval(r4, e)[0].value;
39704
39704
  if (!n.startsWith("http://hl7.org/fhir/StructureDefinition/"))
39705
39705
  throw new Error("Expected a StructureDefinition URL");
@@ -39713,12 +39713,12 @@ function k(r4, e, t, ...n) {
39713
39713
  if (typeof i2 != "string")
39714
39714
  throw new Error("String function cannot be called with non-string");
39715
39715
  let o = r4(i2, ...n.map((s) => s?.eval(e, t)[0]?.value));
39716
- return o === void 0 ? [] : Array.isArray(o) ? o.map(g) : [g(o)];
39716
+ return o === void 0 ? [] : Array.isArray(o) ? o.map(y) : [y(o)];
39717
39717
  }
39718
39718
  function L(r4, e, t, ...n) {
39719
39719
  if (t.length === 0)
39720
39720
  return [];
39721
- let [{ value: i2 }] = U(t, 1), o = b(i2), s = o ? i2.value : i2;
39721
+ let [{ value: i2 }] = U(t, 1), o = P(i2), s = o ? i2.value : i2;
39722
39722
  if (typeof s != "number")
39723
39723
  throw new Error("Math function cannot be called with non-number");
39724
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;
@@ -39732,7 +39732,7 @@ function U(r4, e) {
39732
39732
  throw new Error("Expected non-null argument");
39733
39733
  return r4;
39734
39734
  }
39735
- var N = class {
39735
+ var O = class {
39736
39736
  constructor(e) {
39737
39737
  this.value = e;
39738
39738
  }
@@ -39744,31 +39744,30 @@ var N = class {
39744
39744
  return typeof e == "string" ? `'${e}'` : e.toString();
39745
39745
  }
39746
39746
  };
39747
- var q = class {
39747
+ var B = class {
39748
39748
  constructor(e) {
39749
39749
  this.name = e;
39750
39750
  }
39751
39751
  eval(e, t) {
39752
39752
  if (this.name === "$this")
39753
39753
  return t;
39754
- if (this.name.startsWith("%")) {
39755
- let n = e.variables[this.name.slice(1)];
39756
- if (!n)
39757
- throw new Error(`Undefined variable ${this.name}`);
39754
+ let n = e.variables[this.name];
39755
+ if (n)
39758
39756
  return [n];
39759
- }
39760
- return t.flatMap((n) => this.evalValue(n)).filter((n) => n?.value !== void 0);
39757
+ if (this.name.startsWith("%"))
39758
+ throw new Error(`Undefined variable ${this.name}`);
39759
+ return t.flatMap((i2) => this.evalValue(i2)).filter((i2) => i2?.value !== void 0);
39761
39760
  }
39762
39761
  evalValue(e) {
39763
39762
  let t = e.value;
39764
39763
  if (!(!t || typeof t != "object"))
39765
- return M(t) && t.resourceType === this.name ? e : A(e, this.name);
39764
+ return _(t) && t.resourceType === this.name ? e : A(e, this.name);
39766
39765
  }
39767
39766
  toString() {
39768
39767
  return this.name;
39769
39768
  }
39770
39769
  };
39771
- var Le = class {
39770
+ var Be = class {
39772
39771
  eval() {
39773
39772
  return [];
39774
39773
  }
@@ -39776,7 +39775,7 @@ var Le = class {
39776
39775
  return "{}";
39777
39776
  }
39778
39777
  };
39779
- var Ue = class extends Ee {
39778
+ var qe = class extends Re {
39780
39779
  constructor(t, n, i2) {
39781
39780
  super(t, n);
39782
39781
  this.impl = i2;
@@ -39788,17 +39787,17 @@ var Ue = class extends Ee {
39788
39787
  return this.operator + this.child.toString();
39789
39788
  }
39790
39789
  };
39791
- var Y = class extends j {
39790
+ var X = class extends Q {
39792
39791
  constructor(e, t) {
39793
39792
  super("as", e, t);
39794
39793
  }
39795
39794
  eval(e, t) {
39796
- return S.ofType(e, this.left.eval(e, t), this.right);
39795
+ return b.ofType(e, this.left.eval(e, t), this.right);
39797
39796
  }
39798
39797
  };
39799
- var v = class extends j {
39798
+ var S = class extends Q {
39800
39799
  };
39801
- var R = class extends v {
39800
+ var C = class extends S {
39802
39801
  constructor(t, n, i2, o) {
39803
39802
  super(t, n, i2);
39804
39803
  this.impl = o;
@@ -39810,11 +39809,11 @@ var R = class extends v {
39810
39809
  let o = this.right.eval(t, n);
39811
39810
  if (o.length !== 1)
39812
39811
  return [];
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);
39814
- return typeof f == "boolean" ? d(f) : b(s) ? [{ type: c.Quantity, value: { ...s, value: f } }] : [g(f)];
39812
+ let s = i2[0].value, a = o[0].value, u2 = P(s) ? s.value : s, l2 = P(a) ? a.value : a, f = this.impl(u2, l2);
39813
+ return typeof f == "boolean" ? p(f) : P(s) ? [{ type: c.Quantity, value: { ...s, value: f } }] : [y(f)];
39815
39814
  }
39816
39815
  };
39817
- var Be = class extends j {
39816
+ var je = class extends Q {
39818
39817
  constructor(e, t) {
39819
39818
  super("&", e, t);
39820
39819
  }
@@ -39823,25 +39822,25 @@ var Be = class extends j {
39823
39822
  return o.length > 0 && o.every((s) => typeof s.value == "string") ? [{ type: c.string, value: o.map((s) => s.value).join("") }] : o;
39824
39823
  }
39825
39824
  };
39826
- var qe = class extends v {
39825
+ var $e = class extends S {
39827
39826
  constructor(e, t) {
39828
39827
  super("contains", e, t);
39829
39828
  }
39830
39829
  eval(e, t) {
39831
39830
  let n = this.left.eval(e, t), i2 = this.right.eval(e, t);
39832
- return d(n.some((o) => o.value === i2[0].value));
39831
+ return p(n.some((o) => o.value === i2[0].value));
39833
39832
  }
39834
39833
  };
39835
- var $e = class extends v {
39834
+ var Qe = class extends S {
39836
39835
  constructor(e, t) {
39837
39836
  super("in", e, t);
39838
39837
  }
39839
39838
  eval(e, t) {
39840
- let n = _(this.left.eval(e, t)), i2 = this.right.eval(e, t);
39841
- return n ? d(i2.some((o) => o.value === n.value)) : [];
39839
+ let n = M(this.left.eval(e, t)), i2 = this.right.eval(e, t);
39840
+ return n ? p(i2.some((o) => o.value === n.value)) : [];
39842
39841
  }
39843
39842
  };
39844
- var H = class extends j {
39843
+ var G = class extends Q {
39845
39844
  constructor(e, t) {
39846
39845
  super(".", e, t);
39847
39846
  }
@@ -39852,52 +39851,52 @@ var H = class extends j {
39852
39851
  return `${this.left.toString()}.${this.right.toString()}`;
39853
39852
  }
39854
39853
  };
39855
- var se = class extends j {
39854
+ var ce = class extends Q {
39856
39855
  constructor(e, t) {
39857
39856
  super("|", e, t);
39858
39857
  }
39859
39858
  eval(e, t) {
39860
39859
  let n = this.left.eval(e, t), i2 = this.right.eval(e, t);
39861
- return ke([...n, ...i2]);
39860
+ return Fe([...n, ...i2]);
39862
39861
  }
39863
39862
  };
39864
- var je = class extends v {
39863
+ var He = class extends S {
39865
39864
  constructor(e, t) {
39866
39865
  super("=", e, t);
39867
39866
  }
39868
39867
  eval(e, t) {
39869
39868
  let n = this.left.eval(e, t), i2 = this.right.eval(e, t);
39870
- return mt(n, i2);
39869
+ return Et(n, i2);
39871
39870
  }
39872
39871
  };
39873
- var Qe = class extends v {
39872
+ var Ge = class extends S {
39874
39873
  constructor(e, t) {
39875
39874
  super("!=", e, t);
39876
39875
  }
39877
39876
  eval(e, t) {
39878
39877
  let n = this.left.eval(e, t), i2 = this.right.eval(e, t);
39879
- return ft(mt(n, i2));
39878
+ return St(Et(n, i2));
39880
39879
  }
39881
39880
  };
39882
- var He = class extends v {
39881
+ var Ke = class extends S {
39883
39882
  constructor(e, t) {
39884
39883
  super("~", e, t);
39885
39884
  }
39886
39885
  eval(e, t) {
39887
39886
  let n = this.left.eval(e, t), i2 = this.right.eval(e, t);
39888
- return ht(n, i2);
39887
+ return bt(n, i2);
39889
39888
  }
39890
39889
  };
39891
- var Ge = class extends v {
39890
+ var We = class extends S {
39892
39891
  constructor(e, t) {
39893
39892
  super("!~", e, t);
39894
39893
  }
39895
39894
  eval(e, t) {
39896
39895
  let n = this.left.eval(e, t), i2 = this.right.eval(e, t);
39897
- return ft(ht(n, i2));
39896
+ return St(bt(n, i2));
39898
39897
  }
39899
39898
  };
39900
- var X = class extends v {
39899
+ var Z = class extends S {
39901
39900
  constructor(e, t) {
39902
39901
  super("is", e, t);
39903
39902
  }
@@ -39906,52 +39905,52 @@ var X = class extends v {
39906
39905
  if (n.length !== 1)
39907
39906
  return [];
39908
39907
  let i2 = this.right.name;
39909
- return d(Oe(n[0], i2));
39908
+ return p(Me(n[0], i2));
39910
39909
  }
39911
39910
  };
39912
- var Ke = class extends v {
39911
+ var ze = class extends S {
39913
39912
  constructor(e, t) {
39914
39913
  super("and", e, t);
39915
39914
  }
39916
39915
  eval(e, t) {
39917
- let n = _(this.left.eval(e, t), "boolean"), i2 = _(this.right.eval(e, t), "boolean");
39918
- return n?.value === true && i2?.value === true ? d(true) : n?.value === false || i2?.value === false ? d(false) : [];
39916
+ let n = M(this.left.eval(e, t), "boolean"), i2 = M(this.right.eval(e, t), "boolean");
39917
+ return n?.value === true && i2?.value === true ? p(true) : n?.value === false || i2?.value === false ? p(false) : [];
39919
39918
  }
39920
39919
  };
39921
- var We = class extends v {
39920
+ var Je = class extends S {
39922
39921
  constructor(e, t) {
39923
39922
  super("or", e, t);
39924
39923
  }
39925
39924
  eval(e, t) {
39926
- let n = _(this.left.eval(e, t), "boolean"), i2 = _(this.right.eval(e, t), "boolean");
39927
- return n?.value === false && i2?.value === false ? d(false) : n?.value || i2?.value ? d(true) : [];
39925
+ let n = M(this.left.eval(e, t), "boolean"), i2 = M(this.right.eval(e, t), "boolean");
39926
+ return n?.value === false && i2?.value === false ? p(false) : n?.value || i2?.value ? p(true) : [];
39928
39927
  }
39929
39928
  };
39930
- var ze = class extends v {
39929
+ var Ye = class extends S {
39931
39930
  constructor(e, t) {
39932
39931
  super("xor", e, t);
39933
39932
  }
39934
39933
  eval(e, t) {
39935
- let n = _(this.left.eval(e, t), "boolean"), i2 = _(this.right.eval(e, t), "boolean");
39936
- return !n || !i2 ? [] : d(n.value !== i2.value);
39934
+ let n = M(this.left.eval(e, t), "boolean"), i2 = M(this.right.eval(e, t), "boolean");
39935
+ return !n || !i2 ? [] : p(n.value !== i2.value);
39937
39936
  }
39938
39937
  };
39939
- var Je = class extends v {
39938
+ var Xe = class extends S {
39940
39939
  constructor(e, t) {
39941
39940
  super("implies", e, t);
39942
39941
  }
39943
39942
  eval(e, t) {
39944
- let n = _(this.left.eval(e, t), "boolean"), i2 = _(this.right.eval(e, t), "boolean");
39945
- return i2?.value === true || n?.value === false ? d(true) : !n || !i2 ? [] : d(false);
39943
+ let n = M(this.left.eval(e, t), "boolean"), i2 = M(this.right.eval(e, t), "boolean");
39944
+ return i2?.value === true || n?.value === false ? p(true) : !n || !i2 ? [] : p(false);
39946
39945
  }
39947
39946
  };
39948
- var $ = class {
39947
+ var j = class {
39949
39948
  constructor(e, t) {
39950
39949
  this.name = e;
39951
39950
  this.args = t;
39952
39951
  }
39953
39952
  eval(e, t) {
39954
- let n = S[this.name];
39953
+ let n = b[this.name];
39955
39954
  if (!n)
39956
39955
  throw new Error("Unrecognized function: " + this.name);
39957
39956
  return n(e, t, ...this.args);
@@ -39960,7 +39959,7 @@ var $ = class {
39960
39959
  return `${this.name}(${this.args.map((e) => e.toString()).join(", ")})`;
39961
39960
  }
39962
39961
  };
39963
- var Z = class {
39962
+ var ee = class {
39964
39963
  constructor(e, t) {
39965
39964
  this.left = e;
39966
39965
  this.expr = t;
@@ -39981,37 +39980,37 @@ var Z = class {
39981
39980
  };
39982
39981
  var ye = ["!=", "!~", "<=", ">=", "{}", "->"];
39983
39982
  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 };
39984
- var Ri = { parse(r4) {
39983
+ var wi = { parse(r4) {
39985
39984
  let e = r4.consumeAndParse();
39986
39985
  if (!r4.match(")"))
39987
39986
  throw new Error("Parse error: expected `)` got `" + r4.peek()?.value + "`");
39988
39987
  return e;
39989
39988
  } };
39990
- var Pi = { parse(r4, e) {
39989
+ var Ii = { parse(r4, e) {
39991
39990
  let t = r4.consumeAndParse();
39992
39991
  if (!r4.match("]"))
39993
39992
  throw new Error("Parse error: expected `]`");
39994
- return new Z(e, t);
39993
+ return new ee(e, t);
39995
39994
  }, precedence: m.Indexer };
39996
- var Ai = { parse(r4, e) {
39997
- if (!(e instanceof q))
39995
+ var ki = { parse(r4, e) {
39996
+ if (!(e instanceof B))
39998
39997
  throw new Error("Unexpected parentheses");
39999
39998
  let t = [];
40000
39999
  for (; !r4.match(")"); )
40001
40000
  t.push(r4.consumeAndParse()), r4.match(",");
40002
- return new $(e.name, t);
40001
+ return new j(e.name, t);
40003
40002
  }, precedence: m.FunctionCall };
40004
- function Ci(r4) {
40003
+ function Oi(r4) {
40005
40004
  let e = r4.split(" "), t = parseFloat(e[0]), n = e[1];
40006
40005
  return n?.startsWith("'") && n.endsWith("'") ? n = n.substring(1, n.length - 1) : n = "{" + n + "}", { value: t, unit: n };
40007
40006
  }
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));
40007
+ function xe() {
40008
+ return new Pe().registerPrefix("String", { parse: (r4, e) => new O({ type: c.string, value: e.value }) }).registerPrefix("DateTime", { parse: (r4, e) => new O({ type: c.dateTime, value: ae(e.value) }) }).registerPrefix("Quantity", { parse: (r4, e) => new O({ type: c.Quantity, value: Oi(e.value) }) }).registerPrefix("Number", { parse: (r4, e) => new O({ type: e.value.includes(".") ? c.decimal : c.integer, value: parseFloat(e.value) }) }).registerPrefix("true", { parse: () => new O({ type: c.boolean, value: true }) }).registerPrefix("false", { parse: () => new O({ type: c.boolean, value: false }) }).registerPrefix("Symbol", { parse: (r4, e) => new B(e.value) }).registerPrefix("{}", { parse: () => new Be() }).registerPrefix("(", wi).registerInfix("[", Ii).registerInfix("(", ki).prefix("+", m.UnaryAdd, (r4, e) => new qe("+", e, (t) => t)).prefix("-", m.UnarySubtract, (r4, e) => new C("-", e, e, (t, n) => -n)).infixLeft(".", m.Dot, (r4, e, t) => new G(r4, t)).infixLeft("/", m.Divide, (r4, e, t) => new C("/", r4, t, (n, i2) => n / i2)).infixLeft("*", m.Multiply, (r4, e, t) => new C("*", r4, t, (n, i2) => n * i2)).infixLeft("+", m.Add, (r4, e, t) => new C("+", r4, t, (n, i2) => n + i2)).infixLeft("-", m.Subtract, (r4, e, t) => new C("-", r4, t, (n, i2) => n - i2)).infixLeft("|", m.Union, (r4, e, t) => new ce(r4, t)).infixLeft("=", m.Equals, (r4, e, t) => new He(r4, t)).infixLeft("!=", m.NotEquals, (r4, e, t) => new Ge(r4, t)).infixLeft("~", m.Equivalent, (r4, e, t) => new Ke(r4, t)).infixLeft("!~", m.NotEquivalent, (r4, e, t) => new We(r4, t)).infixLeft("<", m.LessThan, (r4, e, t) => new C("<", r4, t, (n, i2) => n < i2)).infixLeft("<=", m.LessThanOrEquals, (r4, e, t) => new C("<=", r4, t, (n, i2) => n <= i2)).infixLeft(">", m.GreaterThan, (r4, e, t) => new C(">", r4, t, (n, i2) => n > i2)).infixLeft(">=", m.GreaterThanOrEquals, (r4, e, t) => new C(">=", r4, t, (n, i2) => n >= i2)).infixLeft("&", m.Ampersand, (r4, e, t) => new je(r4, t)).infixLeft("and", m.And, (r4, e, t) => new ze(r4, t)).infixLeft("as", m.As, (r4, e, t) => new X(r4, t)).infixLeft("contains", m.Contains, (r4, e, t) => new $e(r4, t)).infixLeft("div", m.Divide, (r4, e, t) => new C("div", r4, t, (n, i2) => n / i2 | 0)).infixLeft("in", m.In, (r4, e, t) => new Qe(r4, t)).infixLeft("is", m.Is, (r4, e, t) => new Z(r4, t)).infixLeft("mod", m.Modulo, (r4, e, t) => new C("mod", r4, t, (n, i2) => n % i2)).infixLeft("or", m.Or, (r4, e, t) => new Je(r4, t)).infixLeft("xor", m.Xor, (r4, e, t) => new Ye(r4, t)).infixLeft("implies", m.Implies, (r4, e, t) => new Xe(r4, t));
40010
40009
  }
40011
- var wi = ge();
40010
+ var Vi = xe();
40012
40011
  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 || {});
40012
+ var Ui = ((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))(Ui || {});
40013
+ var so = ((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))(so || {});
40015
40014
  function Xr(r4) {
40016
40015
  if (typeof window < "u")
40017
40016
  return window.atob(r4);
@@ -40026,20 +40025,20 @@ function Zr(r4) {
40026
40025
  return Buffer.from(r4, "binary").toString("base64");
40027
40026
  throw new Error("Unable to encode base64");
40028
40027
  }
40029
- function Ut() {
40028
+ function qt() {
40030
40029
  let r4 = new Uint32Array(28);
40031
- return crypto.getRandomValues(r4), cr(r4.buffer);
40030
+ return crypto.getRandomValues(r4), gr(r4.buffer);
40032
40031
  }
40033
40032
  async function en(r4) {
40034
40033
  return crypto.subtle.digest("SHA-256", new TextEncoder().encode(r4));
40035
40034
  }
40036
- function ee() {
40035
+ function te() {
40037
40036
  return "xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g, (r4) => {
40038
40037
  let e = Math.random() * 16 | 0;
40039
40038
  return (r4 === "x" ? e : e & 3 | 8).toString(16);
40040
40039
  });
40041
40040
  }
40042
- var Xe = class {
40041
+ var et = class {
40043
40042
  constructor(e = 10) {
40044
40043
  this.max = e, this.cache = /* @__PURE__ */ new Map();
40045
40044
  }
@@ -40063,8 +40062,8 @@ var Xe = class {
40063
40062
  return this.cache.keys().next().value;
40064
40063
  }
40065
40064
  };
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 {
40065
+ var V = { 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" };
40066
+ var ve = class {
40068
40067
  constructor() {
40069
40068
  this.listeners = {};
40070
40069
  }
@@ -40089,9 +40088,9 @@ var Te = class {
40089
40088
  return !e.defaultPrevented;
40090
40089
  }
40091
40090
  };
40092
- var Ze = class {
40091
+ var tt = class {
40093
40092
  constructor() {
40094
- this.emitter = new Te();
40093
+ this.emitter = new ve();
40095
40094
  }
40096
40095
  dispatchEvent(e) {
40097
40096
  this.emitter.dispatchEvent(e);
@@ -40103,100 +40102,100 @@ var Ze = class {
40103
40102
  this.emitter.removeEventListener(e, t);
40104
40103
  }
40105
40104
  };
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"];
40105
+ var jt = { "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" };
40106
+ var go = ["Patient", "Encounter", "ImagingStudy", "DiagnosticReport", "OperationOutcome", "Bundle"];
40107
+ var $t = ["DiagnosticReport-update"];
40109
40108
  function nn(r4) {
40110
- return qt.includes(r4);
40109
+ return $t.includes(r4);
40111
40110
  }
40112
40111
  function on(r4) {
40113
- if (qt.includes(r4))
40114
- throw new p(h(`'context.version' is required for '${r4}'.`));
40112
+ if ($t.includes(r4))
40113
+ throw new d(h(`'context.version' is required for '${r4}'.`));
40115
40114
  }
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);
40115
+ var yo = { "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" } } };
40116
+ function xo(r4) {
40117
+ return go.includes(r4);
40119
40118
  }
40120
40119
  function sn(r4) {
40121
40120
  return !!r4.endpoint;
40122
40121
  }
40123
- function $t(r4) {
40124
- if (!tt(r4))
40125
- throw new p(h("subscriptionRequest must be an object conforming to SubscriptionRequest type."));
40122
+ function Qt(r4) {
40123
+ if (!nt(r4))
40124
+ throw new d(h("subscriptionRequest must be an object conforming to SubscriptionRequest type."));
40126
40125
  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(",") };
40127
40126
  return sn(r4) && (o.endpoint = r4.endpoint), new URLSearchParams(o).toString();
40128
40127
  }
40129
- function tt(r4) {
40128
+ function nt(r4) {
40130
40129
  if (typeof r4 != "object")
40131
40130
  return false;
40132
40131
  let { channelType: e, mode: t, topic: n, events: i2 } = r4;
40133
40132
  if (!(e && t && n && i2) || typeof n != "string" || typeof i2 != "object" || !Array.isArray(i2) || i2.length < 1 || e !== "websocket" || t !== "subscribe" && t !== "unsubscribe")
40134
40133
  return false;
40135
40134
  for (let o of i2)
40136
- if (!Bt[o])
40135
+ if (!jt[o])
40137
40136
  return false;
40138
40137
  return !(sn(r4) && !(typeof r4.endpoint == "string" && r4.endpoint.startsWith("ws")));
40139
40138
  }
40140
40139
  function rn(r4, e, t, n) {
40141
40140
  if (typeof e != "object")
40142
- throw new p(h(`context[${t}] is invalid. Context must contain a single valid FHIR resource! Resource is not an object.`));
40141
+ throw new d(h(`context[${t}] is invalid. Context must contain a single valid FHIR resource! Resource is not an object.`));
40143
40142
  if (!(e.id && typeof e.id == "string"))
40144
- throw new p(h(`context[${t}] is invalid. Resource must contain a valid string ID.`));
40143
+ throw new d(h(`context[${t}] is invalid. Resource must contain a valid string ID.`));
40145
40144
  if (!e.resourceType)
40146
- throw new p(h(`context[${t}] is invalid. Resource must contain a resource type. No resource type found.`));
40145
+ throw new d(h(`context[${t}] is invalid. Resource must contain a resource type. No resource type found.`));
40147
40146
  let i2 = n.resourceType;
40148
40147
  if (i2 !== "*") {
40149
- if (!mo(e.resourceType))
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.`));
40148
+ if (!xo(e.resourceType))
40149
+ throw new d(h(`context[${t}] is invalid. Resource must contain a valid FHIRcast resource type. Resource type is not a known resource type.`));
40151
40150
  if (i2 && e.resourceType !== i2)
40152
- throw new p(h(`context[${t}] is invalid. context[${t}] for the '${r4}' event should contain resource of type ${i2}.`));
40151
+ throw new d(h(`context[${t}] is invalid. context[${t}] for the '${r4}' event should contain resource of type ${i2}.`));
40153
40152
  }
40154
40153
  }
40155
- function ho(r4, e, t, n, i2) {
40154
+ function To(r4, e, t, n, i2) {
40156
40155
  if (i2.set(e.key, (i2.get(e.key) ?? 0) + 1), !n.isArray)
40157
40156
  rn(r4, e.resource, t, n);
40158
40157
  else {
40159
40158
  let { resources: o } = e;
40160
40159
  if (!o)
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'.`));
40160
+ throw new d(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'.`));
40162
40161
  for (let s of o)
40163
40162
  rn(r4, s, t, n);
40164
40163
  }
40165
40164
  }
40166
- function yo(r4, e) {
40167
- let t = /* @__PURE__ */ new Map(), n = fo[r4];
40165
+ function vo(r4, e) {
40166
+ let t = /* @__PURE__ */ new Map(), n = yo[r4];
40168
40167
  for (let i2 = 0; i2 < e.length; i2++) {
40169
40168
  let o = e[i2].key;
40170
40169
  if (!n[o])
40171
- throw new p(h(`Key '${o}' not found for event '${r4}'. Make sure to add only valid keys.`));
40172
- ho(r4, e[i2], i2, n[o], t);
40170
+ throw new d(h(`Key '${o}' not found for event '${r4}'. Make sure to add only valid keys.`));
40171
+ To(r4, e[i2], i2, n[o], t);
40173
40172
  }
40174
40173
  for (let [i2, o] of Object.entries(n)) {
40175
40174
  if (!(o.optional || t.has(i2)))
40176
- throw new p(h(`Missing required key '${i2}' on context for '${r4}' event.`));
40175
+ throw new d(h(`Missing required key '${i2}' on context for '${r4}' event.`));
40177
40176
  if (!o.manyAllowed && (t.get(i2) || 0) > 1)
40178
- throw new p(h(`${t.get(i2)} context entries with key '${i2}' found for the '${r4}' event when schema only allows for 1.`));
40177
+ throw new d(h(`${t.get(i2)} context entries with key '${i2}' found for the '${r4}' event when schema only allows for 1.`));
40179
40178
  }
40180
40179
  }
40181
- function jt(r4, e, t, n) {
40180
+ function Ht(r4, e, t, n) {
40182
40181
  if (!(r4 && typeof r4 == "string"))
40183
- throw new p(h("Must provide a topic."));
40184
- if (!Bt[e])
40185
- throw new p(h(`Must provide a valid FHIRcast event name. Supported events: ${Object.keys(Bt).join(", ")}`));
40182
+ throw new d(h("Must provide a topic."));
40183
+ if (!jt[e])
40184
+ throw new d(h(`Must provide a valid FHIRcast event name. Supported events: ${Object.keys(jt).join(", ")}`));
40186
40185
  if (typeof t != "object")
40187
- throw new p(h("context must be a context object or array of context objects."));
40188
- if (qt.includes(e) && !n)
40189
- throw new p(h(`The '${e}' event must contain a 'context.versionId'.`));
40186
+ throw new d(h("context must be a context object or array of context objects."));
40187
+ if ($t.includes(e) && !n)
40188
+ throw new d(h(`The '${e}' event must contain a 'context.versionId'.`));
40190
40189
  let i2 = Array.isArray(t) ? t : [t];
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 } : {} } };
40190
+ return vo(e, i2), { timestamp: (/* @__PURE__ */ new Date()).toISOString(), id: te(), event: { "hub.topic": r4, "hub.event": e, context: i2, ...n ? { "context.versionId": n } : {} } };
40192
40191
  }
40193
- var et = class extends Ze {
40192
+ var rt = class extends tt {
40194
40193
  constructor(t) {
40195
40194
  super();
40196
40195
  if (this.subRequest = t, !t.endpoint)
40197
- throw new p(h("Subscription request should contain an endpoint."));
40198
- if (!tt(t))
40199
- throw new p(h("Subscription request failed validation."));
40196
+ throw new d(h("Subscription request should contain an endpoint."));
40197
+ if (!nt(t))
40198
+ throw new d(h("Subscription request failed validation."));
40200
40199
  let n = new WebSocket(t.endpoint);
40201
40200
  n.addEventListener("open", () => {
40202
40201
  this.dispatchEvent({ type: "connect" }), n.addEventListener("message", (i2) => {
@@ -40214,7 +40213,7 @@ var et = class extends Ze {
40214
40213
  this.websocket.close();
40215
40214
  }
40216
40215
  };
40217
- function go(r4) {
40216
+ function So(r4) {
40218
40217
  let e = r4.replace(/-/g, "+").replace(/_/g, "/"), t = Xr(e), n = Array.from(t).reduce((o, s) => {
40219
40218
  let a = ("00" + s.charCodeAt(0).toString(16)).slice(-2);
40220
40219
  return `${o}%${a}`;
@@ -40224,21 +40223,29 @@ function go(r4) {
40224
40223
  function an(r4) {
40225
40224
  return r4.split(".").length === 3;
40226
40225
  }
40227
- function Qt(r4) {
40226
+ function it(r4) {
40228
40227
  let [e, t, n] = r4.split(".");
40229
- return go(t);
40228
+ return So(t);
40230
40229
  }
40231
40230
  function cn(r4) {
40232
40231
  try {
40233
- return typeof Qt(r4).login_id == "string";
40232
+ return typeof it(r4).login_id == "string";
40234
40233
  } catch {
40235
40234
  return false;
40236
40235
  }
40237
40236
  }
40238
- var xo;
40239
- var C = class {
40237
+ function un(r4) {
40238
+ try {
40239
+ let t = it(r4).exp;
40240
+ return typeof t == "number" ? t * 1e3 : void 0;
40241
+ } catch {
40242
+ return;
40243
+ }
40244
+ }
40245
+ var Eo;
40246
+ var w = class {
40240
40247
  constructor(e) {
40241
- this[xo] = "ReadablePromise";
40248
+ this[Eo] = "ReadablePromise";
40242
40249
  this.status = "pending";
40243
40250
  this.suspender = e.then((t) => (this.status = "success", this.response = t, t), (t) => {
40244
40251
  throw this.status = "error", this.error = t, t;
@@ -40270,10 +40277,10 @@ var C = class {
40270
40277
  return this.suspender.finally(e);
40271
40278
  }
40272
40279
  };
40273
- xo = Symbol.toStringTag;
40274
- var ve = class {
40280
+ Eo = Symbol.toStringTag;
40281
+ var Se = class {
40275
40282
  constructor(e) {
40276
- this.storage = e ?? (typeof localStorage < "u" ? localStorage : new Ht());
40283
+ this.storage = e ?? (typeof localStorage < "u" ? localStorage : new Gt());
40277
40284
  }
40278
40285
  clear() {
40279
40286
  this.storage.clear();
@@ -40289,10 +40296,10 @@ var ve = class {
40289
40296
  return t ? JSON.parse(t) : void 0;
40290
40297
  }
40291
40298
  setObject(e, t) {
40292
- this.setString(e, t ? or(t) : void 0);
40299
+ this.setString(e, t ? fr(t) : void 0);
40293
40300
  }
40294
40301
  };
40295
- var Ht = class {
40302
+ var Gt = class {
40296
40303
  constructor() {
40297
40304
  this.data = /* @__PURE__ */ new Map();
40298
40305
  }
@@ -40315,23 +40322,23 @@ var Ht = class {
40315
40322
  return Array.from(this.data.keys())[e];
40316
40323
  }
40317
40324
  };
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 {
40325
+ var bo = V.FHIR_JSON + ", */*; q=0.1";
40326
+ var Ro = "https://api.medplum.com/";
40327
+ var Po = 1e3;
40328
+ var Co = 6e4;
40329
+ var dn = "Binary/";
40330
+ var pn = { resourceType: "Device", id: "system", deviceName: [{ name: "System" }] };
40331
+ var Ao = ((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))(Ao || {});
40332
+ var wo = ((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))(wo || {});
40333
+ 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 || {});
40334
+ var ko = ((e) => (e.JwtBearer = "urn:ietf:params:oauth:client-assertion-type:jwt-bearer", e))(ko || {});
40335
+ var fn = class extends ve {
40329
40336
  constructor(t) {
40330
40337
  super();
40331
40338
  this.initComplete = true;
40332
40339
  if (t?.baseUrl && !t.baseUrl.startsWith("http"))
40333
40340
  throw new Error("Base URL must start with http or https");
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)
40341
+ if (this.options = t ?? {}, this.fetch = t?.fetch ?? Oo(), this.storage = t?.storage ?? new Se(), this.createPdfImpl = t?.createPdf, this.baseUrl = hn(t?.baseUrl ?? Ro), this.fhirBaseUrl = hn(ot(this.baseUrl, t?.fhirUrlPath ?? "fhir/R4/")), this.authorizeUrl = ot(this.baseUrl, t?.authorizeUrl ?? "oauth2/authorize"), this.tokenUrl = ot(this.baseUrl, t?.tokenUrl ?? "oauth2/token"), this.logoutUrl = ot(this.baseUrl, t?.logoutUrl ?? "oauth2/logout"), this.clientId = t?.clientId ?? "", this.clientSecret = t?.clientSecret ?? "", this.onUnauthenticated = t?.onUnauthenticated, this.cacheTime = t?.cacheTime ?? Co, this.cacheTime > 0 ? this.requestCache = new et(t?.resourceCacheSize ?? Po) : this.requestCache = void 0, t?.autoBatchTime ? (this.autoBatchTime = t.autoBatchTime, this.autoBatchQueue = []) : (this.autoBatchTime = 0, this.autoBatchQueue = void 0), t?.accessToken)
40335
40342
  this.setAccessToken(t.accessToken), this.initPromise = Promise.resolve();
40336
40343
  else if (this.storage.getInitPromise !== void 0) {
40337
40344
  let n = this.storage.getInitPromise(), i2 = new Promise((o) => {
@@ -40370,7 +40377,7 @@ var pn = class extends Te {
40370
40377
  this.storage.clear(), sessionStorage.clear(), this.clearActiveLogin();
40371
40378
  }
40372
40379
  clearActiveLogin() {
40373
- this.storage.setString("activeLogin", void 0), this.requestCache?.clear(), this.accessToken = void 0, this.refreshToken = void 0, this.sessionDetails = void 0, this.medplumServer = void 0, this.dispatchEvent({ type: "change" });
40380
+ this.storage.setString("activeLogin", void 0), this.requestCache?.clear(), this.accessToken = void 0, this.refreshToken = void 0, this.accessTokenExpires = void 0, this.sessionDetails = void 0, this.medplumServer = void 0, this.dispatchEvent({ type: "change" });
40374
40381
  }
40375
40382
  invalidateUrl(t) {
40376
40383
  t = t.toString(), this.requestCache?.delete(t);
@@ -40393,7 +40400,7 @@ var pn = class extends Te {
40393
40400
  t.startsWith(this.fhirBaseUrl) && this.autoBatchQueue ? o = new Promise((a, u2) => {
40394
40401
  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));
40395
40402
  }) : o = this.request("GET", t, n);
40396
- let s = new C(o);
40403
+ let s = new w(o);
40397
40404
  return this.setCacheEntry(t, s), s;
40398
40405
  }
40399
40406
  post(t, n, i2, o = {}) {
@@ -40403,7 +40410,7 @@ var pn = class extends Te {
40403
40410
  return t = t.toString(), this.setRequestBody(o, n), i2 && this.setRequestContentType(o, i2), this.invalidateUrl(t), this.request("PUT", t, o);
40404
40411
  }
40405
40412
  patch(t, n, i2 = {}) {
40406
- return t = t.toString(), this.setRequestBody(i2, n), this.setRequestContentType(i2, O.JSON_PATCH), this.invalidateUrl(t), this.request("PATCH", t, i2);
40413
+ return t = t.toString(), this.setRequestBody(i2, n), this.setRequestContentType(i2, V.JSON_PATCH), this.invalidateUrl(t), this.request("PATCH", t, i2);
40407
40414
  }
40408
40415
  delete(t, n) {
40409
40416
  return t = t.toString(), this.invalidateUrl(t), this.request("DELETE", t, n);
@@ -40432,9 +40439,11 @@ var pn = class extends Te {
40432
40439
  }
40433
40440
  async signInWithRedirect(t) {
40434
40441
  let i2 = new URLSearchParams(window.location.search).get("code");
40435
- if (i2)
40436
- return this.processCode(i2);
40437
- await this.requestAuthorization(t);
40442
+ if (!i2) {
40443
+ await this.requestAuthorization(t);
40444
+ return;
40445
+ }
40446
+ return this.processCode(i2);
40438
40447
  }
40439
40448
  signOutWithRedirect() {
40440
40449
  window.location.assign(this.logoutUrl);
@@ -40469,10 +40478,10 @@ var pn = class extends Te {
40469
40478
  return n && (i2.search = new URLSearchParams(n).toString()), i2;
40470
40479
  }
40471
40480
  search(t, n, i2) {
40472
- let o = this.fhirSearchUrl(t, n), s = o.toString() + "-search", a = this.getCacheEntry(s, i2);
40481
+ let o = this.fhirSearchUrl(t, n), s = "search-" + o.toString(), a = this.getCacheEntry(s, i2);
40473
40482
  if (a)
40474
40483
  return a.value;
40475
- let u2 = new C((async () => {
40484
+ let u2 = new w((async () => {
40476
40485
  let l2 = await this.get(o, i2);
40477
40486
  if (l2.entry)
40478
40487
  for (let f of l2.entry)
@@ -40484,17 +40493,17 @@ var pn = class extends Te {
40484
40493
  searchOne(t, n, i2) {
40485
40494
  let o = this.fhirSearchUrl(t, n);
40486
40495
  o.searchParams.set("_count", "1"), o.searchParams.sort();
40487
- let s = o.toString() + "-searchOne", a = this.getCacheEntry(s, i2);
40496
+ let s = "searchOne-" + o.toString(), a = this.getCacheEntry(s, i2);
40488
40497
  if (a)
40489
40498
  return a.value;
40490
- let u2 = new C(this.search(t, o.searchParams, i2).then((l2) => l2.entry?.[0]?.resource));
40499
+ let u2 = new w(this.search(t, o.searchParams, i2).then((l2) => l2.entry?.[0]?.resource));
40491
40500
  return this.setCacheEntry(s, u2), u2;
40492
40501
  }
40493
40502
  searchResources(t, n, i2) {
40494
- let s = this.fhirSearchUrl(t, n).toString() + "-searchResources", a = this.getCacheEntry(s, i2);
40503
+ let s = "searchResources-" + this.fhirSearchUrl(t, n).toString(), a = this.getCacheEntry(s, i2);
40495
40504
  if (a)
40496
40505
  return a.value;
40497
- let u2 = new C(this.search(t, n, i2).then(yn));
40506
+ let u2 = new w(this.search(t, n, i2).then(yn));
40498
40507
  return this.setCacheEntry(s, u2), u2;
40499
40508
  }
40500
40509
  async *searchResourcePages(t, n, i2) {
@@ -40507,8 +40516,11 @@ var pn = class extends Te {
40507
40516
  }
40508
40517
  }
40509
40518
  searchValueSet(t, n, i2) {
40510
- let o = this.fhirUrl("ValueSet", "$expand");
40511
- return o.searchParams.set("url", t), o.searchParams.set("filter", n), this.get(o.toString(), i2);
40519
+ return this.valueSetExpand({ url: t, filter: n }, i2);
40520
+ }
40521
+ valueSetExpand(t, n) {
40522
+ let i2 = this.fhirUrl("ValueSet", "$expand");
40523
+ return i2.search = new URLSearchParams(t).toString(), this.get(i2.toString(), n);
40512
40524
  }
40513
40525
  getCached(t, n) {
40514
40526
  let i2 = this.requestCache?.get(this.fhirUrl(t, n).toString())?.value;
@@ -40519,7 +40531,7 @@ var pn = class extends Te {
40519
40531
  if (!n)
40520
40532
  return;
40521
40533
  if (n === "system")
40522
- return dn;
40534
+ return pn;
40523
40535
  let [i2, o] = n.split("/");
40524
40536
  if (!(!i2 || !o))
40525
40537
  return this.getCached(i2, o);
@@ -40530,19 +40542,19 @@ var pn = class extends Te {
40530
40542
  readReference(t, n) {
40531
40543
  let i2 = t.reference;
40532
40544
  if (!i2)
40533
- return new C(Promise.reject(new Error("Missing reference")));
40545
+ return new w(Promise.reject(new Error("Missing reference")));
40534
40546
  if (i2 === "system")
40535
- return new C(Promise.resolve(dn));
40547
+ return new w(Promise.resolve(pn));
40536
40548
  let [o, s] = i2.split("/");
40537
- return !o || !s ? new C(Promise.reject(new Error("Invalid reference"))) : this.readResource(o, s, n);
40549
+ return !o || !s ? new w(Promise.reject(new Error("Invalid reference"))) : this.readResource(o, s, n);
40538
40550
  }
40539
40551
  requestSchema(t) {
40540
- if (Dr(t))
40552
+ if (Nr(t))
40541
40553
  return Promise.resolve();
40542
40554
  let n = t + "-requestSchema", i2 = this.getCacheEntry(n, void 0);
40543
40555
  if (i2)
40544
40556
  return i2.value;
40545
- let o = new C((async () => {
40557
+ let o = new w((async () => {
40546
40558
  let s = `{
40547
40559
  StructureDefinitionList(name: "${t}") {
40548
40560
  resourceType,
@@ -40583,21 +40595,21 @@ var pn = class extends Te {
40583
40595
  target
40584
40596
  }
40585
40597
  }`.replace(/\s+/g, " "), a = await this.graphql(s);
40586
- It(a.data.StructureDefinitionList);
40598
+ Ot(a.data.StructureDefinitionList);
40587
40599
  for (let u2 of a.data.SearchParameterList)
40588
- Ot(u2);
40600
+ Dt(u2);
40589
40601
  })());
40590
40602
  return this.setCacheEntry(n, o), o;
40591
40603
  }
40592
40604
  requestProfileSchema(t) {
40593
- if (_r(t))
40605
+ if (Mr(t))
40594
40606
  return Promise.resolve();
40595
40607
  let n = t + "-requestSchema", i2 = this.getCacheEntry(n, void 0);
40596
40608
  if (i2)
40597
40609
  return i2.value;
40598
- let o = new C((async () => {
40610
+ let o = new w((async () => {
40599
40611
  let s = await this.searchOne("StructureDefinition", { url: t, _sort: "-_lastUpdated" });
40600
- s ? It([s], t) : console.warn(`No StructureDefinition found for ${t}!`);
40612
+ s ? Ot([s], t) : console.warn(`No StructureDefinition found for ${t}!`);
40601
40613
  })());
40602
40614
  return this.setCacheEntry(n, o), o;
40603
40615
  }
@@ -40630,11 +40642,11 @@ var pn = class extends Te {
40630
40642
  return new Promise((a, u2) => {
40631
40643
  let l2 = new XMLHttpRequest(), f = () => l2.abort();
40632
40644
  s?.signal?.addEventListener("abort", f);
40633
- let P = (B) => {
40634
- s?.signal?.removeEventListener("abort", f), B instanceof Error ? u2(B) : a(B);
40645
+ let E2 = (q) => {
40646
+ s?.signal?.removeEventListener("abort", f), q instanceof Error ? u2(q) : a(q);
40635
40647
  };
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)));
40648
+ l2.responseType = "json", l2.onabort = () => E2(new Error("Request aborted")), l2.onerror = () => E2(new Error("Request error")), o && (l2.upload.onprogress = (q) => o(q), l2.upload.onload = (q) => o(q)), l2.onload = () => {
40649
+ l2.status >= 200 && l2.status < 300 ? E2(l2.response) : E2(new d(we(l2.response || l2.statusText)));
40638
40650
  }, 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);
40639
40651
  });
40640
40652
  }
@@ -40646,7 +40658,7 @@ var pn = class extends Te {
40646
40658
  }
40647
40659
  createComment(t, n, i2) {
40648
40660
  let o = this.getProfile(), s, a;
40649
- return t.resourceType === "Encounter" && (s = z(t), a = t.subject), t.resourceType === "ServiceRequest" && (s = t.encounter, a = t.subject), t.resourceType === "Patient" && (a = z(t)), this.createResource({ resourceType: "Communication", basedOn: [z(t)], encounter: s, subject: a, sender: o ? z(o) : void 0, sent: (/* @__PURE__ */ new Date()).toISOString(), payload: [{ contentString: n }] }, i2);
40661
+ return t.resourceType === "Encounter" && (s = J(t), a = t.subject), t.resourceType === "ServiceRequest" && (s = t.encounter, a = t.subject), t.resourceType === "Patient" && (a = J(t)), this.createResource({ resourceType: "Communication", basedOn: [J(t)], encounter: s, subject: a, sender: o ? J(o) : void 0, sent: (/* @__PURE__ */ new Date()).toISOString(), payload: [{ contentString: n }] }, i2);
40650
40662
  }
40651
40663
  async updateResource(t, n) {
40652
40664
  if (!t.resourceType)
@@ -40680,28 +40692,28 @@ var pn = class extends Te {
40680
40692
  return this.post(this.fhirBaseUrl.slice(0, -1), t, void 0, n);
40681
40693
  }
40682
40694
  sendEmail(t, n) {
40683
- return this.post("email/v1/send", t, O.JSON, n);
40695
+ return this.post("email/v1/send", t, V.JSON, n);
40684
40696
  }
40685
40697
  graphql(t, n, i2, o) {
40686
- return this.post(this.fhirUrl("$graphql"), { query: t, operationName: n, variables: i2 }, O.JSON, o);
40698
+ return this.post(this.fhirUrl("$graphql"), { query: t, operationName: n, variables: i2 }, V.JSON, o);
40687
40699
  }
40688
40700
  readResourceGraph(t, n, i2, o) {
40689
40701
  return this.get(`${this.fhirUrl(t, n)}/$graph?graph=${i2}`, o);
40690
40702
  }
40691
40703
  pushToAgent(t, n, i2, o, s, a) {
40692
- return this.post(this.fhirUrl("Agent", tr(t), "$push"), { destination: de(n), body: i2, contentType: o, waitForResponse: s }, O.FHIR_JSON, a);
40704
+ return this.post(this.fhirUrl("Agent", ur(t), "$push"), { destination: pe(n), body: i2, contentType: o, waitForResponse: s }, V.FHIR_JSON, a);
40693
40705
  }
40694
40706
  getActiveLogin() {
40695
40707
  return this.storage.getObject("activeLogin");
40696
40708
  }
40697
40709
  async setActiveLogin(t) {
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();
40710
+ (!this.sessionDetails?.profile || pe(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();
40699
40711
  }
40700
40712
  getAccessToken() {
40701
40713
  return this.accessToken;
40702
40714
  }
40703
40715
  setAccessToken(t, n) {
40704
- this.accessToken = t, this.refreshToken = n, this.sessionDetails = void 0, this.medplumServer = cn(t);
40716
+ this.accessToken = t, this.refreshToken = n, this.sessionDetails = void 0, this.accessTokenExpires = un(t), this.medplumServer = cn(t);
40705
40717
  }
40706
40718
  getLogins() {
40707
40719
  return this.storage.getObject("logins") ?? [];
@@ -40749,11 +40761,11 @@ var pn = class extends Te {
40749
40761
  async download(t, n = {}) {
40750
40762
  this.refreshPromise && await this.refreshPromise;
40751
40763
  let i2 = t.toString();
40752
- return i2.startsWith(ln) && (t = this.fhirUrl(i2)), this.addFetchOptionsDefaults(n), (await this.fetchWithRetry(t.toString(), n)).blob();
40764
+ return i2.startsWith(dn) && (t = this.fhirUrl(i2)), this.addFetchOptionsDefaults(n), (await this.fetchWithRetry(t.toString(), n)).blob();
40753
40765
  }
40754
40766
  async uploadMedia(t, n, i2, o, s) {
40755
40767
  let a = await this.createBinary(t, i2, n);
40756
- return this.createResource({ resourceType: "Media", status: "completed", content: { contentType: n, url: ln + a.id, title: i2 }, ...o }, s);
40768
+ return this.createResource({ resourceType: "Media", status: "completed", content: { contentType: n, url: dn + a.id, title: i2 }, ...o }, s);
40757
40769
  }
40758
40770
  async bulkExport(t = "", n, i2, o) {
40759
40771
  let s = t && `${t}/`, a = this.fhirUrl(`${s}$export`);
@@ -40765,7 +40777,7 @@ var pn = class extends Te {
40765
40777
  i2.Prefer = "respond-async";
40766
40778
  let o = await this.fetchWithRetry(t, n);
40767
40779
  if (o.status === 202) {
40768
- let s = await hn(o);
40780
+ let s = await gn(o);
40769
40781
  if (s)
40770
40782
  return this.pollStatus(s);
40771
40783
  }
@@ -40782,13 +40794,13 @@ var pn = class extends Te {
40782
40794
  this.requestCache && this.requestCache.set(t, { requestTime: Date.now(), value: n });
40783
40795
  }
40784
40796
  cacheResource(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)));
40797
+ t?.id && !t.meta?.tag?.some((n) => n.code === "SUBSETTED") && this.setCacheEntry(this.fhirUrl(t.resourceType, t.id).toString(), new w(Promise.resolve(t)));
40786
40798
  }
40787
40799
  deleteCacheEntry(t) {
40788
40800
  this.requestCache && this.requestCache.delete(t);
40789
40801
  }
40790
40802
  async request(t, n, i2 = {}) {
40791
- this.refreshPromise && await this.refreshPromise, i2.method = t, this.addFetchOptionsDefaults(i2);
40803
+ await this.refreshIfExpired(), i2.method = t, this.addFetchOptionsDefaults(i2);
40792
40804
  let o = await this.fetchWithRetry(n, i2);
40793
40805
  return this.parseResponse(o, t, n, i2);
40794
40806
  }
@@ -40799,7 +40811,7 @@ var pn = class extends Te {
40799
40811
  return;
40800
40812
  let a = t.headers.get("content-type")?.includes("json");
40801
40813
  if (t.status === 404 && !a)
40802
- throw new p(Rr);
40814
+ throw new d(ir);
40803
40815
  let u2 = t.headers.get("content-location"), l2 = o.redirect ?? this.options.redirect;
40804
40816
  if (t.status === 201 && u2 && l2 === "follow")
40805
40817
  return this.request("GET", u2, { ...o, body: void 0 });
@@ -40807,13 +40819,13 @@ var pn = class extends Te {
40807
40819
  if (a)
40808
40820
  try {
40809
40821
  f = await t.json();
40810
- } catch (P) {
40811
- throw console.error("Error parsing response", t.status, P), P;
40822
+ } catch (E2) {
40823
+ throw console.error("Error parsing response", t.status, E2), E2;
40812
40824
  }
40813
40825
  else
40814
40826
  f = await t.text();
40815
40827
  if (t.status >= 400)
40816
- throw new p(_e(f));
40828
+ throw new d(we(f));
40817
40829
  return f;
40818
40830
  }
40819
40831
  async fetchWithRetry(t, n) {
@@ -40826,7 +40838,7 @@ var pn = class extends Te {
40826
40838
  } catch (u2) {
40827
40839
  this.retryCatch(a, i2, u2);
40828
40840
  }
40829
- await lt(o);
40841
+ await xt(o);
40830
40842
  }
40831
40843
  return s;
40832
40844
  }
@@ -40847,10 +40859,10 @@ var pn = class extends Te {
40847
40859
  this.addFetchOptionsDefaults(s);
40848
40860
  let a = await this.fetchWithRetry(t, s);
40849
40861
  if (a.status !== 202 && (n = false, i2 = a, a.status === 201)) {
40850
- let u2 = await hn(a);
40862
+ let u2 = await gn(a);
40851
40863
  u2 && (i2 = await this.fetchWithRetry(u2, s));
40852
40864
  }
40853
- await lt(o);
40865
+ await xt(o);
40854
40866
  }
40855
40867
  return this.parseResponse(i2, "POST", t);
40856
40868
  }
@@ -40861,19 +40873,19 @@ var pn = class extends Te {
40861
40873
  try {
40862
40874
  o.resolve(await this.request(o.method, this.fhirBaseUrl + o.url, o.options));
40863
40875
  } catch (s) {
40864
- o.reject(new p(_e(s)));
40876
+ o.reject(new d(we(s)));
40865
40877
  }
40866
40878
  return;
40867
40879
  }
40868
40880
  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);
40869
40881
  for (let o = 0; o < t.length; o++) {
40870
40882
  let s = t[o], a = i2.entry?.[o];
40871
- a?.response?.outcome && !St(a.response.outcome) ? s.reject(new p(a.response.outcome)) : s.resolve(a?.resource);
40883
+ a?.response?.outcome && !mt(a.response.outcome) ? s.reject(new d(a.response.outcome)) : s.resolve(a?.resource);
40872
40884
  }
40873
40885
  }
40874
40886
  addFetchOptionsDefaults(t) {
40875
40887
  let n = t.headers;
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");
40888
+ n || (n = {}, t.headers = n), n.Accept || (n.Accept = bo), n["X-Medplum"] = "extended", t.body && !n["Content-Type"] && (n["Content-Type"] = V.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");
40877
40889
  }
40878
40890
  setRequestContentType(t, n) {
40879
40891
  t.headers || (t.headers = {});
@@ -40887,25 +40899,28 @@ var pn = class extends Te {
40887
40899
  return this.refresh() ? this.request(t, n, i2) : (this.clearActiveLogin(), this.onUnauthenticated && this.onUnauthenticated(), Promise.reject(new Error("Unauthenticated")));
40888
40900
  }
40889
40901
  async startPkce() {
40890
- let t = Ut();
40902
+ let t = qt();
40891
40903
  sessionStorage.setItem("pkceState", t);
40892
- let n = Ut();
40904
+ let n = qt();
40893
40905
  sessionStorage.setItem("codeVerifier", n);
40894
- let i2 = await en(n), o = ur(i2).replaceAll("+", "-").replaceAll("/", "_").replaceAll("=", "");
40906
+ let i2 = await en(n), o = yr(i2).replaceAll("+", "-").replaceAll("/", "_").replaceAll("=", "");
40895
40907
  return sessionStorage.setItem("codeChallenge", o), { codeChallengeMethod: "S256", codeChallenge: o };
40896
40908
  }
40897
40909
  async requestAuthorization(t) {
40898
40910
  let n = await this.ensureCodeChallenge(t ?? {}), i2 = new URL(this.authorizeUrl);
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());
40911
+ 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 ?? mn()), 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());
40900
40912
  }
40901
40913
  processCode(t, n) {
40902
40914
  let i2 = new URLSearchParams();
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") {
40915
+ 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 ?? mn()), typeof sessionStorage < "u") {
40904
40916
  let o = sessionStorage.getItem("codeVerifier");
40905
40917
  o && i2.set("code_verifier", o);
40906
40918
  }
40907
40919
  return this.fetchTokens(i2);
40908
40920
  }
40921
+ refreshIfExpired() {
40922
+ return !this.refreshPromise && this.accessTokenExpires !== void 0 && this.accessTokenExpires < Date.now() && this.refresh(), this.refreshPromise ?? Promise.resolve();
40923
+ }
40909
40924
  refresh() {
40910
40925
  if (this.refreshPromise)
40911
40926
  return this.refreshPromise;
@@ -40935,26 +40950,26 @@ var pn = class extends Te {
40935
40950
  }
40936
40951
  async fhircastSubscribe(t, n) {
40937
40952
  if (!(typeof t == "string" && t !== ""))
40938
- throw new p(h("Invalid topic provided. Topic must be a valid string."));
40953
+ throw new d(h("Invalid topic provided. Topic must be a valid string."));
40939
40954
  if (!(typeof n == "object" && Array.isArray(n) && n.length > 0))
40940
- throw new p(h("Invalid events provided. Events must be an array of event names containing at least one event."));
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"];
40955
+ throw new d(h("Invalid events provided. Events must be an array of event names containing at least one event."));
40956
+ let i2 = { channelType: "websocket", mode: "subscribe", topic: t, events: n }, s = (await this.post("/fhircast/STU3", Qt(i2), V.FORM_URL_ENCODED))["hub.channel.endpoint"];
40942
40957
  if (!s)
40943
40958
  throw new Error("Invalid response!");
40944
40959
  return i2.endpoint = s, i2;
40945
40960
  }
40946
40961
  async fhircastUnsubscribe(t) {
40947
- if (!tt(t))
40948
- throw new p(h("Invalid topic or subscriptionRequest. SubscriptionRequest must be an object."));
40962
+ if (!nt(t))
40963
+ throw new d(h("Invalid topic or subscriptionRequest. SubscriptionRequest must be an object."));
40949
40964
  if (!(t.endpoint && typeof t.endpoint == "string" && t.endpoint.startsWith("ws")))
40950
- throw new p(h("Provided subscription request must have an endpoint in order to unsubscribe."));
40951
- t.mode = "unsubscribe", await this.post("/fhircast/STU3", $t(t), O.FORM_URL_ENCODED);
40965
+ throw new d(h("Provided subscription request must have an endpoint in order to unsubscribe."));
40966
+ t.mode = "unsubscribe", await this.post("/fhircast/STU3", Qt(t), V.FORM_URL_ENCODED);
40952
40967
  }
40953
40968
  fhircastConnect(t) {
40954
- return new et(t);
40969
+ return new rt(t);
40955
40970
  }
40956
40971
  async fhircastPublish(t, n, i2, o) {
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));
40972
+ return nn(n) ? this.post(`/fhircast/STU3/${t}`, Ht(t, n, i2, o), V.JSON) : (on(n), this.post(`/fhircast/STU3/${t}`, Ht(t, n, i2), V.JSON));
40958
40973
  }
40959
40974
  async fhircastGetContext(t) {
40960
40975
  return this.get(`/fhircast/STU3/${t}`);
@@ -40963,16 +40978,16 @@ var pn = class extends Te {
40963
40978
  return this.post("admin/projects/" + t + "/invite", n);
40964
40979
  }
40965
40980
  async fetchTokens(t) {
40966
- let n = { method: "POST", headers: { "Content-Type": O.FORM_URL_ENCODED }, body: t.toString(), credentials: "include" }, i2 = n.headers;
40981
+ let n = { method: "POST", headers: { "Content-Type": V.FORM_URL_ENCODED }, body: t.toString(), credentials: "include" }, i2 = n.headers;
40967
40982
  this.basicAuth && (i2.Authorization = `Basic ${this.basicAuth}`);
40968
40983
  let o = await this.fetchWithRetry(this.tokenUrl, n);
40969
40984
  if (!o.ok) {
40970
40985
  this.clearActiveLogin();
40971
40986
  try {
40972
40987
  let a = await o.json();
40973
- throw new p(I(a.error_description));
40988
+ throw new d(v(a.error_description));
40974
40989
  } catch (a) {
40975
- throw new p(I("Failed to fetch tokens"), a);
40990
+ throw new d(v("Failed to fetch tokens"), a);
40976
40991
  }
40977
40992
  }
40978
40993
  let s = await o.json();
@@ -40981,7 +40996,7 @@ var pn = class extends Te {
40981
40996
  async verifyTokens(t) {
40982
40997
  let n = t.access_token;
40983
40998
  if (an(n)) {
40984
- let i2 = Qt(n);
40999
+ let i2 = it(n);
40985
41000
  if (Date.now() >= i2.exp * 1e3)
40986
41001
  throw this.clearActiveLogin(), new Error("Token expired");
40987
41002
  if (i2.cid) {
@@ -41005,21 +41020,21 @@ var pn = class extends Te {
41005
41020
  throw i2;
41006
41021
  }
41007
41022
  };
41008
- function Co() {
41023
+ function Oo() {
41009
41024
  if (!globalThis.fetch)
41010
41025
  throw new Error("Fetch not available in this environment");
41011
41026
  return globalThis.fetch.bind(globalThis);
41012
41027
  }
41013
- function fn() {
41028
+ function mn() {
41014
41029
  return typeof window > "u" ? "" : window.location.protocol + "//" + window.location.host + "/";
41015
41030
  }
41016
- function mn(r4) {
41031
+ function hn(r4) {
41017
41032
  return r4.endsWith("/") ? r4 : r4 + "/";
41018
41033
  }
41019
- function rt(r4, e) {
41034
+ function ot(r4, e) {
41020
41035
  return new URL(e, r4).toString();
41021
41036
  }
41022
- async function hn(r4) {
41037
+ async function gn(r4) {
41023
41038
  let e = r4.headers.get("content-location");
41024
41039
  if (e)
41025
41040
  return e;
@@ -41027,18 +41042,18 @@ async function hn(r4) {
41027
41042
  if (t)
41028
41043
  return t;
41029
41044
  let n = await r4.json();
41030
- if (Fe(n) && n.issue?.[0]?.diagnostics)
41045
+ if (ne(n) && n.issue?.[0]?.diagnostics)
41031
41046
  return n.issue[0].diagnostics;
41032
41047
  }
41033
41048
  function yn(r4) {
41034
41049
  let e = r4.entry?.map((t) => t.resource) ?? [];
41035
41050
  return Object.assign(e, { bundle: r4 });
41036
41051
  }
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 {
41052
+ var Mo = [...ye, "->", "<<", ">>", "=="];
41053
+ var Uo = xe().registerInfix("->", { precedence: m.Arrow }).registerInfix(";", { precedence: m.Semicolon });
41054
+ var Zo = [...ye, "eq", "ne", "co"];
41055
+ var rs = xe();
41056
+ var z = class {
41042
41057
  constructor(e = "\r", t = "|", n = "^", i2 = "~", o = "\\", s = "&") {
41043
41058
  this.segmentSeparator = e;
41044
41059
  this.fieldSeparator = t;
@@ -41054,8 +41069,8 @@ var W = class {
41054
41069
  return this.componentSeparator + this.repetitionSeparator + this.escapeCharacter + this.subcomponentSeparator;
41055
41070
  }
41056
41071
  };
41057
- var An = class r {
41058
- constructor(e, t = new W()) {
41072
+ var kn = class r {
41073
+ constructor(e, t = new z()) {
41059
41074
  this.context = t, this.segments = e;
41060
41075
  }
41061
41076
  get header() {
@@ -41078,7 +41093,7 @@ var An = class r {
41078
41093
  }
41079
41094
  buildAck() {
41080
41095
  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";
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)]);
41096
+ return new r([new be(["MSH", this.context.getMsh2(), o, s, n, i2, is(e), "", this.buildAckMessageType(t), e.getTime().toString(), "P", u2], this.context), new be(["MSA", "AA", a, "OK"], this.context)]);
41082
41097
  }
41083
41098
  buildAckMessageType(e) {
41084
41099
  let t = e?.getField(9), n = t?.getComponent(2), i2 = t?.getComponent(3), o = "ACK";
@@ -41089,13 +41104,13 @@ var An = class r {
41089
41104
  let n = new Error("Invalid HL7 message");
41090
41105
  throw n.type = "entity.parse.failed", n;
41091
41106
  }
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);
41107
+ let t = new z("\r", e.charAt(3), e.charAt(4), e.charAt(5), e.charAt(6), e.charAt(7));
41108
+ return new r(e.split(/[\r\n]+/).map((n) => be.parse(n, t)), t);
41094
41109
  }
41095
41110
  };
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];
41111
+ var be = class r2 {
41112
+ constructor(e, t = new z()) {
41113
+ this.context = t, mr(e) ? this.fields = e.map((n) => de.parse(n, t)) : this.fields = e, this.name = this.fields[0].components[0][0];
41099
41114
  }
41100
41115
  get(e) {
41101
41116
  return this.fields[e];
@@ -41103,9 +41118,9 @@ var Se = class r2 {
41103
41118
  getField(e) {
41104
41119
  if (this.name === "MSH") {
41105
41120
  if (e === 1)
41106
- return new le([[this.context.getMsh1()]], this.context);
41121
+ return new de([[this.context.getMsh1()]], this.context);
41107
41122
  if (e === 2)
41108
- return new le([[this.context.getMsh2()]], this.context);
41123
+ return new de([[this.context.getMsh2()]], this.context);
41109
41124
  if (e > 2)
41110
41125
  return this.fields[e - 1];
41111
41126
  }
@@ -41117,12 +41132,12 @@ var Se = class r2 {
41117
41132
  toString() {
41118
41133
  return this.fields.map((e) => e.toString()).join(this.context.fieldSeparator);
41119
41134
  }
41120
- static parse(e, t = new W()) {
41121
- return new r2(e.split(t.fieldSeparator).map((n) => le.parse(n, t)), t);
41135
+ static parse(e, t = new z()) {
41136
+ return new r2(e.split(t.fieldSeparator).map((n) => de.parse(n, t)), t);
41122
41137
  }
41123
41138
  };
41124
- var le = class r3 {
41125
- constructor(e, t = new W()) {
41139
+ var de = class r3 {
41140
+ constructor(e, t = new z()) {
41126
41141
  this.context = t, this.components = e;
41127
41142
  }
41128
41143
  get(e, t, n = 0) {
@@ -41135,11 +41150,11 @@ var le = class r3 {
41135
41150
  toString() {
41136
41151
  return this.components.map((e) => e.join(this.context.componentSeparator)).join(this.context.repetitionSeparator);
41137
41152
  }
41138
- static parse(e, t = new W()) {
41153
+ static parse(e, t = new z()) {
41139
41154
  return new r3(e.split(t.repetitionSeparator).map((n) => n.split(t.componentSeparator)), t);
41140
41155
  }
41141
41156
  };
41142
- function Qo(r4) {
41157
+ function is(r4) {
41143
41158
  let e = r4 instanceof Date ? r4 : new Date(r4), n = e.toISOString().replace(/[-:T]/g, "").replace(/(\.\d+)?Z$/, ""), i2 = e.getUTCMilliseconds();
41144
41159
  return i2 > 0 && (n += "." + i2.toString()), n;
41145
41160
  }
@@ -41183,7 +41198,7 @@ var c2 = class extends i {
41183
41198
  e.on("data", (s) => {
41184
41199
  try {
41185
41200
  if (o += s.toString(), o.endsWith(p2 + v2)) {
41186
- let r4 = An.parse(o.substring(1, o.length - 2));
41201
+ let r4 = kn.parse(o.substring(1, o.length - 2));
41187
41202
  this.dispatchEvent(new d2(this, r4)), o = "";
41188
41203
  }
41189
41204
  } catch (r4) {
@@ -41231,7 +41246,7 @@ var h2 = class extends i {
41231
41246
  this.connection && (this.connection.close(), delete this.connection);
41232
41247
  }
41233
41248
  };
41234
- var E2 = class {
41249
+ var E = class {
41235
41250
  constructor(n) {
41236
41251
  this.handler = n;
41237
41252
  }
@@ -41323,11 +41338,11 @@ var DcmjsDimseScp = class extends dimse.Scp {
41323
41338
  accessToken: App.instance.medplum.getAccessToken(),
41324
41339
  channel: AgentDicomChannel.instance.definition.name,
41325
41340
  remote: "foo",
41326
- contentType: O.JSON,
41341
+ contentType: V.JSON,
41327
41342
  body: JSON.stringify(request.getDataset())
41328
41343
  });
41329
41344
  } catch (err) {
41330
- App.instance.log.error(`DICOM error: ${li(err)}`);
41345
+ App.instance.log.error(`DICOM error: ${Nn(err)}`);
41331
41346
  }
41332
41347
  const response = dimse.responses.CStoreResponse.fromRequest(request);
41333
41348
  response.setStatus(dimse.constants.Status.Success);
@@ -41342,7 +41357,7 @@ var AgentHl7Channel = class {
41342
41357
  this.definition = definition;
41343
41358
  this.endpoint = endpoint;
41344
41359
  this.connections = /* @__PURE__ */ new Map();
41345
- this.server = new E2((connection) => this.handleNewConnection(connection));
41360
+ this.server = new E((connection) => this.handleNewConnection(connection));
41346
41361
  }
41347
41362
  start() {
41348
41363
  const address = new URL(this.endpoint.address);
@@ -41359,7 +41374,7 @@ var AgentHl7Channel = class {
41359
41374
  sendToRemote(msg) {
41360
41375
  const connection = this.connections.get(msg.remote);
41361
41376
  if (connection) {
41362
- connection.hl7Connection.send(An.parse(msg.body));
41377
+ connection.hl7Connection.send(kn.parse(msg.body));
41363
41378
  }
41364
41379
  }
41365
41380
  handleNewConnection(connection) {
@@ -41381,14 +41396,14 @@ var AgentHl7ChannelConnection = class {
41381
41396
  this.channel.app.log.info(event.message.toString().replaceAll("\r", "\n"));
41382
41397
  this.channel.app.addToWebSocketQueue({
41383
41398
  type: "agent:transmit:request",
41384
- accessToken: this.channel.app.medplum.getAccessToken(),
41399
+ accessToken: await this.channel.app.getAccessToken(),
41385
41400
  channel: this.channel.definition.name,
41386
41401
  remote: this.remote,
41387
- contentType: O.HL7_V2,
41402
+ contentType: V.HL7_V2,
41388
41403
  body: event.message.toString()
41389
41404
  });
41390
41405
  } catch (err) {
41391
- this.channel.app.log.error(`HL7 error: ${li(err)}`);
41406
+ this.channel.app.log.error(`HL7 error: ${Nn(err)}`);
41392
41407
  }
41393
41408
  }
41394
41409
  close() {
@@ -41405,26 +41420,41 @@ var App = class _App {
41405
41420
  this.channels = /* @__PURE__ */ new Map();
41406
41421
  this.hl7Queue = [];
41407
41422
  this.live = false;
41423
+ this.shutdown = false;
41408
41424
  _App.instance = this;
41409
41425
  this.log = {
41410
41426
  info: console.log,
41411
41427
  warn: console.warn,
41412
41428
  error: console.error
41413
41429
  };
41414
- const webSocketUrl = new URL(medplum.getBaseUrl());
41430
+ this.connectWebSocket();
41431
+ }
41432
+ connectWebSocket() {
41433
+ const webSocketUrl = new URL(this.medplum.getBaseUrl());
41415
41434
  webSocketUrl.protocol = webSocketUrl.protocol === "https:" ? "wss:" : "ws:";
41416
41435
  webSocketUrl.pathname = "/ws/agent";
41417
41436
  this.log.info(`Connecting to WebSocket: ${webSocketUrl.href}`);
41418
41437
  this.webSocket = new wrapper_default(webSocketUrl);
41419
41438
  this.webSocket.binaryType = "nodebuffer";
41420
- this.webSocket.addEventListener("error", (err) => this.log.error(err.message));
41439
+ this.webSocket.addEventListener("error", (err) => {
41440
+ if (!this.shutdown) {
41441
+ this.log.error(Nn(err.error));
41442
+ }
41443
+ });
41421
41444
  this.webSocket.addEventListener("open", () => {
41422
41445
  this.sendToWebSocket({
41423
41446
  type: "agent:connect:request",
41424
- accessToken: medplum.getAccessToken(),
41425
- agentId
41447
+ accessToken: this.medplum.getAccessToken(),
41448
+ agentId: this.agentId
41426
41449
  });
41427
41450
  });
41451
+ this.webSocket.addEventListener("close", () => {
41452
+ if (!this.shutdown) {
41453
+ this.live = false;
41454
+ this.log.info("WebSocket closed");
41455
+ setTimeout(() => this.connectWebSocket(), 1e3);
41456
+ }
41457
+ });
41428
41458
  this.webSocket.addEventListener("message", (e) => {
41429
41459
  try {
41430
41460
  const data = e.data;
@@ -41448,11 +41478,14 @@ var App = class _App {
41448
41478
  case "agent:transmit:request":
41449
41479
  this.pushMessage(command);
41450
41480
  break;
41481
+ case "agent:error":
41482
+ this.log.error(command.body);
41483
+ break;
41451
41484
  default:
41452
41485
  this.log.error(`Unknown message type: ${command.type}`);
41453
41486
  }
41454
41487
  } catch (err) {
41455
- this.log.error(`WebSocket error: ${li(err)}`);
41488
+ this.log.error(`WebSocket error: ${Nn(err)}`);
41456
41489
  }
41457
41490
  });
41458
41491
  }
@@ -41480,9 +41513,18 @@ var App = class _App {
41480
41513
  }
41481
41514
  stop() {
41482
41515
  this.log.info("Medplum service stopping...");
41516
+ this.shutdown = true;
41483
41517
  this.channels.forEach((channel) => channel.stop());
41518
+ if (this.webSocket) {
41519
+ this.webSocket.close();
41520
+ this.webSocket = void 0;
41521
+ }
41484
41522
  this.log.info("Medplum service stopped successfully");
41485
41523
  }
41524
+ async getAccessToken() {
41525
+ await this.medplum.refreshIfExpired();
41526
+ return this.medplum.getAccessToken();
41527
+ }
41486
41528
  addToWebSocketQueue(message) {
41487
41529
  this.webSocketQueue.push(message);
41488
41530
  this.trySendToWebSocket();
@@ -41513,6 +41555,9 @@ var App = class _App {
41513
41555
  }
41514
41556
  }
41515
41557
  sendToWebSocket(message) {
41558
+ if (!this.webSocket) {
41559
+ throw new Error("WebSocket not connected");
41560
+ }
41516
41561
  this.webSocket.send(JSON.stringify(message));
41517
41562
  }
41518
41563
  pushMessage(message) {
@@ -41525,18 +41570,18 @@ var App = class _App {
41525
41570
  host: address.hostname,
41526
41571
  port: parseInt(address.port, 10)
41527
41572
  });
41528
- client.sendAndWait(An.parse(message.body)).then((response) => {
41573
+ client.sendAndWait(kn.parse(message.body)).then((response) => {
41529
41574
  this.log.info(`Response: ${response.toString().replaceAll("\r", "\n")}`);
41530
41575
  this.addToWebSocketQueue({
41531
41576
  type: "agent:transmit:response",
41532
41577
  channel: message.channel,
41533
41578
  remote: message.remote,
41534
41579
  callback: message.callback,
41535
- contentType: O.HL7_V2,
41580
+ contentType: V.HL7_V2,
41536
41581
  body: response.toString()
41537
41582
  });
41538
41583
  }).catch((err) => {
41539
- this.log.error(`HL7 error: ${li(err)}`);
41584
+ this.log.error(`HL7 error: ${Nn(err)}`);
41540
41585
  }).finally(() => {
41541
41586
  client.close();
41542
41587
  });
@@ -41569,15 +41614,16 @@ async function main(argv) {
41569
41614
  process.exit(1);
41570
41615
  }
41571
41616
  const { baseUrl, clientId, clientSecret, agentId } = args;
41572
- const medplum = new pn({ baseUrl, clientId });
41617
+ const medplum = new fn({ baseUrl, clientId });
41573
41618
  await medplum.startClientLogin(clientId, clientSecret);
41574
41619
  const app = new App(medplum, agentId);
41575
41620
  await app.start();
41576
41621
  process.on("SIGINT", () => {
41577
- console.log("\ngracefully shutting down from SIGINT (Crtl-C)");
41622
+ console.log("Gracefully shutting down from SIGINT (Crtl-C)");
41578
41623
  app.stop();
41579
41624
  process.exit();
41580
41625
  });
41626
+ return app;
41581
41627
  }
41582
41628
  function readCommandLineArgs(argv) {
41583
41629
  const [_node, _script, baseUrl, clientId, clientSecret, agentId] = argv;