@medplum/agent 2.2.5 → 2.2.6

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 +695 -672
  2. package/package.json +1 -1
@@ -4922,12 +4922,12 @@ var require_dcmjs = __commonJS({
4922
4922
  };
4923
4923
  return _getPrototypeOf(o);
4924
4924
  }
4925
- function _setPrototypeOf(o, p3) {
4926
- _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf2(o2, p4) {
4927
- o2.__proto__ = p4;
4925
+ function _setPrototypeOf(o, p2) {
4926
+ _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf2(o2, p3) {
4927
+ o2.__proto__ = p3;
4928
4928
  return o2;
4929
4929
  };
4930
- return _setPrototypeOf(o, p3);
4930
+ return _setPrototypeOf(o, p2);
4931
4931
  }
4932
4932
  function _isNativeReflectConstruct() {
4933
4933
  if (typeof Reflect === "undefined" || !Reflect.construct)
@@ -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;
@@ -5297,7 +5297,7 @@ var require_dcmjs = __commonJS({
5297
5297
  let n, m3;
5298
5298
  let bits;
5299
5299
  let xbits;
5300
- let f;
5300
+ let f2;
5301
5301
  let overflow = 0;
5302
5302
  for (bits = 0; bits <= MAX_BITS$1; bits++) {
5303
5303
  s.bl_count[bits] = 0;
@@ -5319,10 +5319,10 @@ var require_dcmjs = __commonJS({
5319
5319
  if (n >= base) {
5320
5320
  xbits = extra[n - base];
5321
5321
  }
5322
- f = tree[n * 2];
5323
- s.opt_len += f * (bits + xbits);
5322
+ f2 = tree[n * 2];
5323
+ s.opt_len += f2 * (bits + xbits);
5324
5324
  if (has_stree) {
5325
- s.static_len += f * (stree[n * 2 + 1] + xbits);
5325
+ s.static_len += f2 * (stree[n * 2 + 1] + xbits);
5326
5326
  }
5327
5327
  }
5328
5328
  if (overflow === 0) {
@@ -5958,8 +5958,8 @@ var require_dcmjs = __commonJS({
5958
5958
  strm.msg = messages[errorCode];
5959
5959
  return errorCode;
5960
5960
  };
5961
- const rank = (f) => {
5962
- return (f << 1) - (f > 4 ? 9 : 0);
5961
+ const rank = (f2) => {
5962
+ return (f2 << 1) - (f2 > 4 ? 9 : 0);
5963
5963
  };
5964
5964
  const zero$2 = (buf) => {
5965
5965
  let len2 = buf.length;
@@ -6067,7 +6067,7 @@ var require_dcmjs = __commonJS({
6067
6067
  };
6068
6068
  const fill_window = (s) => {
6069
6069
  const _w_size = s.w_size;
6070
- let p3, n, m3, more, str2;
6070
+ let p2, n, m3, more, str2;
6071
6071
  do {
6072
6072
  more = s.window_size - s.lookahead - s.strstart;
6073
6073
  if (s.strstart >= _w_size + (_w_size - MIN_LOOKAHEAD)) {
@@ -6076,16 +6076,16 @@ var require_dcmjs = __commonJS({
6076
6076
  s.strstart -= _w_size;
6077
6077
  s.block_start -= _w_size;
6078
6078
  n = s.hash_size;
6079
- p3 = n;
6079
+ p2 = n;
6080
6080
  do {
6081
- m3 = s.head[--p3];
6082
- s.head[p3] = m3 >= _w_size ? m3 - _w_size : 0;
6081
+ m3 = s.head[--p2];
6082
+ s.head[p2] = m3 >= _w_size ? m3 - _w_size : 0;
6083
6083
  } while (--n);
6084
6084
  n = _w_size;
6085
- p3 = n;
6085
+ p2 = n;
6086
6086
  do {
6087
- m3 = s.prev[--p3];
6088
- s.prev[p3] = m3 >= _w_size ? m3 - _w_size : 0;
6087
+ m3 = s.prev[--p2];
6088
+ s.prev[p2] = m3 >= _w_size ? m3 - _w_size : 0;
6089
6089
  } while (--n);
6090
6090
  more += _w_size;
6091
6091
  }
@@ -6962,9 +6962,9 @@ var require_dcmjs = __commonJS({
6962
6962
  if (typeof source !== "object") {
6963
6963
  throw new TypeError(source + "must be non-object");
6964
6964
  }
6965
- for (const p3 in source) {
6966
- if (_has(source, p3)) {
6967
- obj[p3] = source[p3];
6965
+ for (const p2 in source) {
6966
+ if (_has(source, p2)) {
6967
+ obj[p2] = source[p2];
6968
6968
  }
6969
6969
  }
6970
6970
  }
@@ -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;
@@ -10847,10 +10847,10 @@ var require_dcmjs = __commonJS({
10847
10847
  while (1) {
10848
10848
  var g3 = stream.readUint16();
10849
10849
  if (g3 == 65534) {
10850
- var ge2 = stream.readUint16();
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++;
@@ -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",
@@ -15052,8 +15052,8 @@ var require_dcmjs = __commonJS({
15052
15052
  var imageId = images[frame].imageId;
15053
15053
  var imageIdSpecificToolState = toolState[imageId];
15054
15054
  var brushPixelData = imageIdSpecificToolState.brush.data[segmentIndex].pixelData;
15055
- for (var p3 = 0; p3 < brushPixelData.length; p3++) {
15056
- pixelData[pixelDataIndex] = brushPixelData[p3];
15055
+ for (var p2 = 0; p2 < brushPixelData.length; p2++) {
15056
+ pixelData[pixelDataIndex] = brushPixelData[p2];
15057
15057
  pixelDataIndex++;
15058
15058
  }
15059
15059
  }
@@ -15196,11 +15196,11 @@ var require_dcmjs = __commonJS({
15196
15196
  var _pixelData2D$shape = _slicedToArray(pixelData2D.shape, 2);
15197
15197
  _pixelData2D$shape[0];
15198
15198
  _pixelData2D$shape[1];
15199
- for (var p3 = 0; p3 < cToolsPixelData.length; p3++) {
15200
- if (pixelData2D.data[p3]) {
15201
- cToolsPixelData[p3] = 1;
15199
+ for (var p2 = 0; p2 < cToolsPixelData.length; p2++) {
15200
+ if (pixelData2D.data[p2]) {
15201
+ cToolsPixelData[p2] = 1;
15202
15202
  } else {
15203
- cToolsPixelData[p3] = 0;
15203
+ cToolsPixelData[p2] = 0;
15204
15204
  }
15205
15205
  }
15206
15206
  }
@@ -15513,8 +15513,8 @@ var require_dcmjs = __commonJS({
15513
15513
  out[2] = x * m3[2] + y * 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];
15516
+ function transformQuat(out, a, q) {
15517
+ var qx = q[0], qy = q[1], qz = q[2], qw = q[3];
15518
15518
  var x = a[0], y = a[1], z2 = a[2];
15519
15519
  var uvx = qy * z2 - qz * y, uvy = qz * x - qx * z2, uvz = qx * y - qy * x;
15520
15520
  var uuvx = qy * uvz - qz * uvy, uuvy = qz * uvx - qx * uvz, uuvz = qx * uvy - qy * uvx;
@@ -15531,39 +15531,39 @@ var require_dcmjs = __commonJS({
15531
15531
  return out;
15532
15532
  }
15533
15533
  function rotateX(out, a, b2, rad) {
15534
- var p3 = [], r4 = [];
15535
- p3[0] = a[0] - b2[0];
15536
- p3[1] = a[1] - b2[1];
15537
- p3[2] = a[2] - b2[2];
15538
- r4[0] = p3[0];
15539
- r4[1] = p3[1] * Math.cos(rad) - p3[2] * Math.sin(rad);
15540
- r4[2] = p3[1] * Math.sin(rad) + p3[2] * Math.cos(rad);
15534
+ var p2 = [], r4 = [];
15535
+ p2[0] = a[0] - b2[0];
15536
+ p2[1] = a[1] - b2[1];
15537
+ p2[2] = a[2] - b2[2];
15538
+ r4[0] = p2[0];
15539
+ r4[1] = p2[1] * Math.cos(rad) - p2[2] * Math.sin(rad);
15540
+ r4[2] = p2[1] * Math.sin(rad) + p2[2] * Math.cos(rad);
15541
15541
  out[0] = r4[0] + b2[0];
15542
15542
  out[1] = r4[1] + b2[1];
15543
15543
  out[2] = r4[2] + b2[2];
15544
15544
  return out;
15545
15545
  }
15546
15546
  function rotateY(out, a, b2, rad) {
15547
- var p3 = [], r4 = [];
15548
- p3[0] = a[0] - b2[0];
15549
- p3[1] = a[1] - b2[1];
15550
- p3[2] = a[2] - b2[2];
15551
- r4[0] = p3[2] * Math.sin(rad) + p3[0] * Math.cos(rad);
15552
- r4[1] = p3[1];
15553
- r4[2] = p3[2] * Math.cos(rad) - p3[0] * Math.sin(rad);
15547
+ var p2 = [], r4 = [];
15548
+ p2[0] = a[0] - b2[0];
15549
+ p2[1] = a[1] - b2[1];
15550
+ p2[2] = a[2] - b2[2];
15551
+ r4[0] = p2[2] * Math.sin(rad) + p2[0] * Math.cos(rad);
15552
+ r4[1] = p2[1];
15553
+ r4[2] = p2[2] * Math.cos(rad) - p2[0] * Math.sin(rad);
15554
15554
  out[0] = r4[0] + b2[0];
15555
15555
  out[1] = r4[1] + b2[1];
15556
15556
  out[2] = r4[2] + b2[2];
15557
15557
  return out;
15558
15558
  }
15559
15559
  function rotateZ(out, a, b2, rad) {
15560
- var p3 = [], r4 = [];
15561
- p3[0] = a[0] - b2[0];
15562
- p3[1] = a[1] - b2[1];
15563
- p3[2] = a[2] - b2[2];
15564
- r4[0] = p3[0] * Math.cos(rad) - p3[1] * Math.sin(rad);
15565
- r4[1] = p3[0] * Math.sin(rad) + p3[1] * Math.cos(rad);
15566
- r4[2] = p3[2];
15560
+ var p2 = [], r4 = [];
15561
+ p2[0] = a[0] - b2[0];
15562
+ p2[1] = a[1] - b2[1];
15563
+ p2[2] = a[2] - b2[2];
15564
+ r4[0] = p2[0] * Math.cos(rad) - p2[1] * Math.sin(rad);
15565
+ r4[1] = p2[0] * Math.sin(rad) + p2[1] * Math.cos(rad);
15566
+ r4[2] = p2[2];
15567
15567
  out[0] = r4[0] + b2[0];
15568
15568
  out[1] = r4[1] + b2[1];
15569
15569
  out[2] = r4[2] + b2[2];
@@ -15787,8 +15787,8 @@ var require_dcmjs = __commonJS({
15787
15787
  if (byteValue <= 127) {
15788
15788
  var N2 = byteValue + 1;
15789
15789
  var next = i2 + 1;
15790
- for (var p3 = next; p3 < next + N2; p3++) {
15791
- pixelData[pixelDataIndex] = uInt8Frame[p3];
15790
+ for (var p2 = next; p2 < next + N2; p2++) {
15791
+ pixelData[pixelDataIndex] = uInt8Frame[p2];
15792
15792
  pixelDataIndex++;
15793
15793
  }
15794
15794
  i2 += N2 + 1;
@@ -26796,10 +26796,10 @@ var require_buffer_list = __commonJS({
26796
26796
  value: function join(s) {
26797
26797
  if (this.length === 0)
26798
26798
  return "";
26799
- var p3 = this.head;
26800
- var ret = "" + p3.data;
26801
- while (p3 = p3.next)
26802
- ret += s + p3.data;
26799
+ var p2 = this.head;
26800
+ var ret = "" + p2.data;
26801
+ while (p2 = p2.next)
26802
+ ret += s + p2.data;
26803
26803
  return ret;
26804
26804
  }
26805
26805
  }, {
@@ -26808,12 +26808,12 @@ var require_buffer_list = __commonJS({
26808
26808
  if (this.length === 0)
26809
26809
  return Buffer2.alloc(0);
26810
26810
  var ret = Buffer2.allocUnsafe(n >>> 0);
26811
- var p3 = this.head;
26811
+ var p2 = this.head;
26812
26812
  var i2 = 0;
26813
- while (p3) {
26814
- copyBuffer(p3.data, ret, i2);
26815
- i2 += p3.data.length;
26816
- p3 = p3.next;
26813
+ while (p2) {
26814
+ copyBuffer(p2.data, ret, i2);
26815
+ i2 += p2.data.length;
26816
+ p2 = p2.next;
26817
26817
  }
26818
26818
  return ret;
26819
26819
  }
@@ -26841,12 +26841,12 @@ var require_buffer_list = __commonJS({
26841
26841
  }, {
26842
26842
  key: "_getString",
26843
26843
  value: function _getString(n) {
26844
- var p3 = this.head;
26844
+ var p2 = this.head;
26845
26845
  var c3 = 1;
26846
- var ret = p3.data;
26846
+ var ret = p2.data;
26847
26847
  n -= ret.length;
26848
- while (p3 = p3.next) {
26849
- var str = p3.data;
26848
+ while (p2 = p2.next) {
26849
+ var str = p2.data;
26850
26850
  var nb = n > str.length ? str.length : n;
26851
26851
  if (nb === str.length)
26852
26852
  ret += str;
@@ -26856,13 +26856,13 @@ var require_buffer_list = __commonJS({
26856
26856
  if (n === 0) {
26857
26857
  if (nb === str.length) {
26858
26858
  ++c3;
26859
- if (p3.next)
26860
- this.head = p3.next;
26859
+ if (p2.next)
26860
+ this.head = p2.next;
26861
26861
  else
26862
26862
  this.head = this.tail = null;
26863
26863
  } else {
26864
- this.head = p3;
26865
- p3.data = str.slice(nb);
26864
+ this.head = p2;
26865
+ p2.data = str.slice(nb);
26866
26866
  }
26867
26867
  break;
26868
26868
  }
@@ -26876,25 +26876,25 @@ var require_buffer_list = __commonJS({
26876
26876
  key: "_getBuffer",
26877
26877
  value: function _getBuffer(n) {
26878
26878
  var ret = Buffer2.allocUnsafe(n);
26879
- var p3 = this.head;
26879
+ var p2 = this.head;
26880
26880
  var c3 = 1;
26881
- p3.data.copy(ret);
26882
- n -= p3.data.length;
26883
- while (p3 = p3.next) {
26884
- var buf = p3.data;
26881
+ p2.data.copy(ret);
26882
+ n -= p2.data.length;
26883
+ while (p2 = p2.next) {
26884
+ var buf = p2.data;
26885
26885
  var nb = n > buf.length ? buf.length : n;
26886
26886
  buf.copy(ret, ret.length - n, 0, nb);
26887
26887
  n -= nb;
26888
26888
  if (n === 0) {
26889
26889
  if (nb === buf.length) {
26890
26890
  ++c3;
26891
- if (p3.next)
26892
- this.head = p3.next;
26891
+ if (p2.next)
26892
+ this.head = p2.next;
26893
26893
  else
26894
26894
  this.head = this.tail = null;
26895
26895
  } else {
26896
- this.head = p3;
26897
- p3.data = buf.slice(nb);
26896
+ this.head = p2;
26897
+ p2.data = buf.slice(nb);
26898
26898
  }
26899
26899
  break;
26900
26900
  }
@@ -27136,7 +27136,7 @@ var require_string_decoder = __commonJS({
27136
27136
  }
27137
27137
  return 0;
27138
27138
  }
27139
- function utf8CheckExtraBytes(self2, buf, p3) {
27139
+ function utf8CheckExtraBytes(self2, buf, p2) {
27140
27140
  if ((buf[0] & 192) !== 128) {
27141
27141
  self2.lastNeed = 0;
27142
27142
  return "\uFFFD";
@@ -27155,15 +27155,15 @@ var require_string_decoder = __commonJS({
27155
27155
  }
27156
27156
  }
27157
27157
  function utf8FillLast(buf) {
27158
- var p3 = this.lastTotal - this.lastNeed;
27159
- var r4 = utf8CheckExtraBytes(this, buf, p3);
27158
+ var p2 = this.lastTotal - this.lastNeed;
27159
+ var r4 = utf8CheckExtraBytes(this, buf, p2);
27160
27160
  if (r4 !== void 0)
27161
27161
  return r4;
27162
27162
  if (this.lastNeed <= buf.length) {
27163
- buf.copy(this.lastChar, p3, 0, this.lastNeed);
27163
+ buf.copy(this.lastChar, p2, 0, this.lastNeed);
27164
27164
  return this.lastChar.toString(this.encoding, 0, this.lastTotal);
27165
27165
  }
27166
- buf.copy(this.lastChar, p3, 0, buf.length);
27166
+ buf.copy(this.lastChar, p2, 0, buf.length);
27167
27167
  this.lastNeed -= buf.length;
27168
27168
  }
27169
27169
  function utf8Text(buf, i2) {
@@ -27875,11 +27875,11 @@ var require_stream_readable = __commonJS({
27875
27875
  var decoder = new StringDecoder(enc);
27876
27876
  this._readableState.decoder = decoder;
27877
27877
  this._readableState.encoding = this._readableState.decoder.encoding;
27878
- var p3 = this._readableState.buffer.head;
27878
+ var p2 = this._readableState.buffer.head;
27879
27879
  var content = "";
27880
- while (p3 !== null) {
27881
- content += decoder.write(p3.data);
27882
- p3 = p3.next;
27880
+ while (p2 !== null) {
27881
+ content += decoder.write(p2.data);
27882
+ p2 = p2.next;
27883
27883
  }
27884
27884
  this._readableState.buffer.clear();
27885
27885
  if (content !== "")
@@ -30026,10 +30026,10 @@ var require_buffer_list2 = __commonJS({
30026
30026
  value: function join(s) {
30027
30027
  if (this.length === 0)
30028
30028
  return "";
30029
- var p3 = this.head;
30030
- var ret = "" + p3.data;
30031
- while (p3 = p3.next)
30032
- ret += s + p3.data;
30029
+ var p2 = this.head;
30030
+ var ret = "" + p2.data;
30031
+ while (p2 = p2.next)
30032
+ ret += s + p2.data;
30033
30033
  return ret;
30034
30034
  }
30035
30035
  }, {
@@ -30038,12 +30038,12 @@ var require_buffer_list2 = __commonJS({
30038
30038
  if (this.length === 0)
30039
30039
  return Buffer2.alloc(0);
30040
30040
  var ret = Buffer2.allocUnsafe(n >>> 0);
30041
- var p3 = this.head;
30041
+ var p2 = this.head;
30042
30042
  var i2 = 0;
30043
- while (p3) {
30044
- copyBuffer(p3.data, ret, i2);
30045
- i2 += p3.data.length;
30046
- p3 = p3.next;
30043
+ while (p2) {
30044
+ copyBuffer(p2.data, ret, i2);
30045
+ i2 += p2.data.length;
30046
+ p2 = p2.next;
30047
30047
  }
30048
30048
  return ret;
30049
30049
  }
@@ -30071,12 +30071,12 @@ var require_buffer_list2 = __commonJS({
30071
30071
  }, {
30072
30072
  key: "_getString",
30073
30073
  value: function _getString(n) {
30074
- var p3 = this.head;
30074
+ var p2 = this.head;
30075
30075
  var c3 = 1;
30076
- var ret = p3.data;
30076
+ var ret = p2.data;
30077
30077
  n -= ret.length;
30078
- while (p3 = p3.next) {
30079
- var str = p3.data;
30078
+ while (p2 = p2.next) {
30079
+ var str = p2.data;
30080
30080
  var nb = n > str.length ? str.length : n;
30081
30081
  if (nb === str.length)
30082
30082
  ret += str;
@@ -30086,13 +30086,13 @@ var require_buffer_list2 = __commonJS({
30086
30086
  if (n === 0) {
30087
30087
  if (nb === str.length) {
30088
30088
  ++c3;
30089
- if (p3.next)
30090
- this.head = p3.next;
30089
+ if (p2.next)
30090
+ this.head = p2.next;
30091
30091
  else
30092
30092
  this.head = this.tail = null;
30093
30093
  } else {
30094
- this.head = p3;
30095
- p3.data = str.slice(nb);
30094
+ this.head = p2;
30095
+ p2.data = str.slice(nb);
30096
30096
  }
30097
30097
  break;
30098
30098
  }
@@ -30106,25 +30106,25 @@ var require_buffer_list2 = __commonJS({
30106
30106
  key: "_getBuffer",
30107
30107
  value: function _getBuffer(n) {
30108
30108
  var ret = Buffer2.allocUnsafe(n);
30109
- var p3 = this.head;
30109
+ var p2 = this.head;
30110
30110
  var c3 = 1;
30111
- p3.data.copy(ret);
30112
- n -= p3.data.length;
30113
- while (p3 = p3.next) {
30114
- var buf = p3.data;
30111
+ p2.data.copy(ret);
30112
+ n -= p2.data.length;
30113
+ while (p2 = p2.next) {
30114
+ var buf = p2.data;
30115
30115
  var nb = n > buf.length ? buf.length : n;
30116
30116
  buf.copy(ret, ret.length - n, 0, nb);
30117
30117
  n -= nb;
30118
30118
  if (n === 0) {
30119
30119
  if (nb === buf.length) {
30120
30120
  ++c3;
30121
- if (p3.next)
30122
- this.head = p3.next;
30121
+ if (p2.next)
30122
+ this.head = p2.next;
30123
30123
  else
30124
30124
  this.head = this.tail = null;
30125
30125
  } else {
30126
- this.head = p3;
30127
- p3.data = buf.slice(nb);
30126
+ this.head = p2;
30127
+ p2.data = buf.slice(nb);
30128
30128
  }
30129
30129
  break;
30130
30130
  }
@@ -31604,11 +31604,11 @@ var require_stream_readable2 = __commonJS({
31604
31604
  var decoder = new StringDecoder(enc);
31605
31605
  this._readableState.decoder = decoder;
31606
31606
  this._readableState.encoding = this._readableState.decoder.encoding;
31607
- var p3 = this._readableState.buffer.head;
31607
+ var p2 = this._readableState.buffer.head;
31608
31608
  var content = "";
31609
- while (p3 !== null) {
31610
- content += decoder.write(p3.data);
31611
- p3 = p3.next;
31609
+ while (p2 !== null) {
31610
+ content += decoder.write(p2.data);
31611
+ p2 = p2.next;
31612
31612
  }
31613
31613
  this._readableState.buffer.clear();
31614
31614
  if (content !== "")
@@ -32188,14 +32188,14 @@ var require_stream_transform = __commonJS({
32188
32188
  var Duplex = require_stream_duplex2();
32189
32189
  require_inherits()(Transform, Duplex);
32190
32190
  function afterTransform(er, data) {
32191
- var ts = this._transformState;
32192
- ts.transforming = false;
32193
- var cb = ts.writecb;
32191
+ var ts2 = this._transformState;
32192
+ ts2.transforming = false;
32193
+ var cb = ts2.writecb;
32194
32194
  if (cb === null) {
32195
32195
  return this.emit("error", new ERR_MULTIPLE_CALLBACK());
32196
32196
  }
32197
- ts.writechunk = null;
32198
- ts.writecb = null;
32197
+ ts2.writechunk = null;
32198
+ ts2.writecb = null;
32199
32199
  if (data != null)
32200
32200
  this.push(data);
32201
32201
  cb(er);
@@ -32245,23 +32245,23 @@ var require_stream_transform = __commonJS({
32245
32245
  cb(new ERR_METHOD_NOT_IMPLEMENTED("_transform()"));
32246
32246
  };
32247
32247
  Transform.prototype._write = function(chunk, encoding, cb) {
32248
- var ts = this._transformState;
32249
- ts.writecb = cb;
32250
- ts.writechunk = chunk;
32251
- ts.writeencoding = encoding;
32252
- if (!ts.transforming) {
32248
+ var ts2 = this._transformState;
32249
+ ts2.writecb = cb;
32250
+ ts2.writechunk = chunk;
32251
+ ts2.writeencoding = encoding;
32252
+ if (!ts2.transforming) {
32253
32253
  var rs = this._readableState;
32254
- if (ts.needTransform || rs.needReadable || rs.length < rs.highWaterMark)
32254
+ if (ts2.needTransform || rs.needReadable || rs.length < rs.highWaterMark)
32255
32255
  this._read(rs.highWaterMark);
32256
32256
  }
32257
32257
  };
32258
32258
  Transform.prototype._read = function(n) {
32259
- var ts = this._transformState;
32260
- if (ts.writechunk !== null && !ts.transforming) {
32261
- ts.transforming = true;
32262
- this._transform(ts.writechunk, ts.writeencoding, ts.afterTransform);
32259
+ var ts2 = this._transformState;
32260
+ if (ts2.writechunk !== null && !ts2.transforming) {
32261
+ ts2.transforming = true;
32262
+ this._transform(ts2.writechunk, ts2.writeencoding, ts2.afterTransform);
32263
32263
  } else {
32264
- ts.needTransform = true;
32264
+ ts2.needTransform = true;
32265
32265
  }
32266
32266
  };
32267
32267
  Transform.prototype._destroy = function(err, cb) {
@@ -33187,24 +33187,24 @@ var require_conversions = __commonJS({
33187
33187
  var s = hsv[1] / 100;
33188
33188
  var v3 = hsv[2] / 100;
33189
33189
  var hi2 = Math.floor(h3) % 6;
33190
- var f = h3 - Math.floor(h3);
33191
- var p3 = 255 * v3 * (1 - s);
33192
- var q2 = 255 * v3 * (1 - s * f);
33193
- var t = 255 * v3 * (1 - s * (1 - f));
33190
+ var f2 = h3 - Math.floor(h3);
33191
+ var p2 = 255 * v3 * (1 - s);
33192
+ var q = 255 * v3 * (1 - s * f2);
33193
+ var t = 255 * v3 * (1 - s * (1 - f2));
33194
33194
  v3 *= 255;
33195
33195
  switch (hi2) {
33196
33196
  case 0:
33197
- return [v3, t, p3];
33197
+ return [v3, t, p2];
33198
33198
  case 1:
33199
- return [q2, v3, p3];
33199
+ return [q, v3, p2];
33200
33200
  case 2:
33201
- return [p3, v3, t];
33201
+ return [p2, v3, t];
33202
33202
  case 3:
33203
- return [p3, q2, v3];
33203
+ return [p2, q, v3];
33204
33204
  case 4:
33205
- return [t, p3, v3];
33205
+ return [t, p2, v3];
33206
33206
  case 5:
33207
- return [v3, p3, q2];
33207
+ return [v3, p2, q];
33208
33208
  }
33209
33209
  };
33210
33210
  convert.hsv.hsl = function(hsv) {
@@ -33230,7 +33230,7 @@ var require_conversions = __commonJS({
33230
33230
  var ratio = wh + bl;
33231
33231
  var i2;
33232
33232
  var v3;
33233
- var f;
33233
+ var f2;
33234
33234
  var n;
33235
33235
  if (ratio > 1) {
33236
33236
  wh /= ratio;
@@ -33238,11 +33238,11 @@ var require_conversions = __commonJS({
33238
33238
  }
33239
33239
  i2 = Math.floor(6 * h3);
33240
33240
  v3 = 1 - bl;
33241
- f = 6 * h3 - i2;
33241
+ f2 = 6 * h3 - i2;
33242
33242
  if ((i2 & 1) !== 0) {
33243
- f = 1 - f;
33243
+ f2 = 1 - f2;
33244
33244
  }
33245
- n = wh + f * (v3 - wh);
33245
+ n = wh + f2 * (v3 - wh);
33246
33246
  var r4;
33247
33247
  var g3;
33248
33248
  var b2;
@@ -33493,26 +33493,26 @@ var require_conversions = __commonJS({
33493
33493
  var s = hsl[1] / 100;
33494
33494
  var l2 = hsl[2] / 100;
33495
33495
  var c3 = 1;
33496
- var f = 0;
33496
+ var f2 = 0;
33497
33497
  if (l2 < 0.5) {
33498
33498
  c3 = 2 * s * l2;
33499
33499
  } else {
33500
33500
  c3 = 2 * s * (1 - l2);
33501
33501
  }
33502
33502
  if (c3 < 1) {
33503
- f = (l2 - 0.5 * c3) / (1 - c3);
33503
+ f2 = (l2 - 0.5 * c3) / (1 - c3);
33504
33504
  }
33505
- return [hsl[0], c3 * 100, f * 100];
33505
+ return [hsl[0], c3 * 100, f2 * 100];
33506
33506
  };
33507
33507
  convert.hsv.hcg = function(hsv) {
33508
33508
  var s = hsv[1] / 100;
33509
33509
  var v3 = hsv[2] / 100;
33510
33510
  var c3 = s * v3;
33511
- var f = 0;
33511
+ var f2 = 0;
33512
33512
  if (c3 < 1) {
33513
- f = (v3 - c3) / (1 - c3);
33513
+ f2 = (v3 - c3) / (1 - c3);
33514
33514
  }
33515
- return [hsv[0], c3 * 100, f * 100];
33515
+ return [hsv[0], c3 * 100, f2 * 100];
33516
33516
  };
33517
33517
  convert.hcg.rgb = function(hcg) {
33518
33518
  var h3 = hcg[0] / 360;
@@ -33568,11 +33568,11 @@ var require_conversions = __commonJS({
33568
33568
  var c3 = hcg[1] / 100;
33569
33569
  var g3 = hcg[2] / 100;
33570
33570
  var v3 = c3 + g3 * (1 - c3);
33571
- var f = 0;
33571
+ var f2 = 0;
33572
33572
  if (v3 > 0) {
33573
- f = c3 / v3;
33573
+ f2 = c3 / v3;
33574
33574
  }
33575
- return [hcg[0], f * 100, v3 * 100];
33575
+ return [hcg[0], f2 * 100, v3 * 100];
33576
33576
  };
33577
33577
  convert.hcg.hsl = function(hcg) {
33578
33578
  var c3 = hcg[1] / 100;
@@ -34064,8 +34064,8 @@ var require_color = __commonJS({
34064
34064
  }
34065
34065
  var color1 = mixinColor.rgb();
34066
34066
  var color2 = this.rgb();
34067
- var p3 = weight === void 0 ? 0.5 : weight;
34068
- var w2 = 2 * p3 - 1;
34067
+ var p2 = weight === void 0 ? 0.5 : weight;
34068
+ var w2 = 2 * p2 - 1;
34069
34069
  var a = color1.alpha() - color2.alpha();
34070
34070
  var w1 = ((w2 * a === -1 ? w2 : (w2 + a) / (1 + w2 * a)) + 1) / 2;
34071
34071
  var w22 = 1 - w1;
@@ -34073,7 +34073,7 @@ var require_color = __commonJS({
34073
34073
  w1 * color1.red() + w22 * color2.red(),
34074
34074
  w1 * color1.green() + w22 * color2.green(),
34075
34075
  w1 * color1.blue() + w22 * color2.blue(),
34076
- color1.alpha() * p3 + color2.alpha() * (1 - p3)
34076
+ color1.alpha() * p2 + color2.alpha() * (1 - p2)
34077
34077
  );
34078
34078
  }
34079
34079
  };
@@ -37165,26 +37165,26 @@ 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);
37169
- p3.on("connect", () => {
37170
- this.emit("connected"), p3.sendAssociationRequest(d4);
37171
- }), p3.on("associationAccepted", (e4) => {
37172
- this.emit("associationAccepted", e4), p3.sendRequests(this.requests);
37173
- }), p3.on("associationReleaseResponse", () => {
37168
+ const l2 = (a2.securityOptions ? g3 : m3).connect({ host: e3, port: t3, ...h4 }), p2 = new c3(l2, a2);
37169
+ p2.on("connect", () => {
37170
+ this.emit("connected"), p2.sendAssociationRequest(d4);
37171
+ }), p2.on("associationAccepted", (e4) => {
37172
+ this.emit("associationAccepted", e4), p2.sendRequests(this.requests);
37173
+ }), p2.on("associationReleaseResponse", () => {
37174
37174
  this.emit("associationReleased"), l2.end();
37175
- }), p3.on("associationRejected", (e4) => {
37175
+ }), p2.on("associationRejected", (e4) => {
37176
37176
  this.emit("associationRejected", e4), l2.end();
37177
- }), p3.on("done", () => {
37178
- setTimeout(() => p3.sendAssociationReleaseRequest(), this.associationLingerTimeout);
37179
- }), p3.on("cStoreRequest", (e4, t4) => {
37177
+ }), p2.on("done", () => {
37178
+ setTimeout(() => p2.sendAssociationReleaseRequest(), this.associationLingerTimeout);
37179
+ }), p2.on("cStoreRequest", (e4, t4) => {
37180
37180
  this.emit("cStoreRequest", e4, t4);
37181
- }), p3.on("nEventReportRequest", (e4, t4) => {
37181
+ }), p2.on("nEventReportRequest", (e4, t4) => {
37182
37182
  this.emit("nEventReportRequest", e4, t4);
37183
- }), p3.on("networkError", (e4) => {
37183
+ }), p2.on("networkError", (e4) => {
37184
37184
  l2.end(), this.emit("networkError", e4);
37185
- }), p3.on("close", () => {
37186
- this.statistics.addFromOtherStatistics(p3.getStatistics()), this.network = void 0, this.emit("closed");
37187
- }), this.network = p3;
37185
+ }), p2.on("close", () => {
37186
+ this.statistics.addFromOtherStatistics(p2.getStatistics()), this.network = void 0, this.emit("closed");
37187
+ }), this.network = p2;
37188
37188
  }
37189
37189
  getStatistics() {
37190
37190
  return this.statistics;
@@ -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 p2 extends g3 {
37341
37341
  constructor(e3, t3, s3, i4, r6) {
37342
37342
  switch (super(new a({ CommandField: e3, CommandDataSetType: s3 ? 514 : 257, Status: i4, ErrorComment: r6 })), e3) {
37343
37343
  case n2.NGetRequest:
@@ -37449,14 +37449,14 @@ var require_dcmjs_dimse_min = __commonJS({
37449
37449
  super(n2.CEchoRequest, r5.Verification, false);
37450
37450
  }
37451
37451
  }
37452
- class f extends p3 {
37452
+ class f2 extends p2 {
37453
37453
  constructor(e3, t3) {
37454
37454
  super(n2.CEchoResponse, r5.Verification, false, e3, t3);
37455
37455
  }
37456
37456
  static fromRequest(e3) {
37457
37457
  if (!(e3 instanceof R2))
37458
37458
  throw new Error("Request should be an instance of CEchoRequest");
37459
- const t3 = new f(o2.ProcessingFailure);
37459
+ const t3 = new f2(o2.ProcessingFailure);
37460
37460
  return t3.setMessageIdBeingRespondedTo(e3.getMessageId()), t3;
37461
37461
  }
37462
37462
  }
@@ -37495,7 +37495,7 @@ var require_dcmjs_dimse_min = __commonJS({
37495
37495
  return n3.setAffectedSopClassUid(r5.ModalityWorklistInformationModelFind), n3.setDataset(new a(s3)), n3;
37496
37496
  }
37497
37497
  }
37498
- class S2 extends p3 {
37498
+ class S2 extends p2 {
37499
37499
  constructor(e3, t3) {
37500
37500
  super(n2.CFindResponse, r5.StudyRootQueryRetrieveInformationModelFind, false, e3, t3);
37501
37501
  }
@@ -37525,7 +37525,7 @@ var require_dcmjs_dimse_min = __commonJS({
37525
37525
  void 0 !== this.needsFullDatasetLoading && true === this.needsFullDatasetLoading && void 0 !== this.datasetOrFile && "" !== this.datasetOrFile.trim() && this.setDataset(a.fromFile(this.datasetOrFile));
37526
37526
  }
37527
37527
  }
37528
- class C2 extends p3 {
37528
+ class C2 extends p2 {
37529
37529
  constructor(e3, t3) {
37530
37530
  super(n2.CStoreResponse, "", false, e3, t3);
37531
37531
  }
@@ -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,19 +37547,19 @@ 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
  }
37562
- class v3 extends p3 {
37562
+ class v3 extends p2 {
37563
37563
  constructor(e3, t3) {
37564
37564
  super(n2.CMoveResponse, r5.StudyRootQueryRetrieveInformationModelMove, false, e3, t3);
37565
37565
  }
@@ -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;
@@ -37611,7 +37611,7 @@ var require_dcmjs_dimse_min = __commonJS({
37611
37611
  return r6.setDataset(new a(i4)), r6;
37612
37612
  }
37613
37613
  }
37614
- class w2 extends p3 {
37614
+ class w2 extends p2 {
37615
37615
  constructor(e3, t3) {
37616
37616
  super(n2.CGetResponse, r5.StudyRootQueryRetrieveInformationModelGet, false, e3, t3);
37617
37617
  }
@@ -37639,7 +37639,7 @@ var require_dcmjs_dimse_min = __commonJS({
37639
37639
  super(n2.NCreateRequest, e3, false), this.setAffectedSopInstanceUid(t3);
37640
37640
  }
37641
37641
  }
37642
- class U2 extends p3 {
37642
+ class U2 extends p2 {
37643
37643
  constructor(e3, t3, s3, i4) {
37644
37644
  super(n2.NCreateResponse, e3, false, s3, i4), this.setAffectedSopInstanceUid(t3);
37645
37645
  }
@@ -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
  }
@@ -37661,7 +37661,7 @@ var require_dcmjs_dimse_min = __commonJS({
37661
37661
  this.getCommandDataset().setElement("ActionTypeID", e3);
37662
37662
  }
37663
37663
  }
37664
- class D2 extends p3 {
37664
+ class D2 extends p2 {
37665
37665
  constructor(e3, t3, s3, i4, r6) {
37666
37666
  super(n2.NActionResponse, e3, false, i4, r6), this.setAffectedSopInstanceUid(t3), this.setActionTypeId(s3);
37667
37667
  }
@@ -37672,23 +37672,23 @@ 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
  }
37685
37685
  }
37686
- class T extends p3 {
37686
+ class T extends p2 {
37687
37687
  constructor(e3, t3, s3, i4) {
37688
37688
  super(n2.NDeleteResponse, e3, false, s3, i4), this.setAffectedSopInstanceUid(t3);
37689
37689
  }
37690
37690
  static fromRequest(e3) {
37691
- 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;
@@ -37705,7 +37705,7 @@ var require_dcmjs_dimse_min = __commonJS({
37705
37705
  this.getCommandDataset().setElement("EventTypeID", e3);
37706
37706
  }
37707
37707
  }
37708
- class b2 extends p3 {
37708
+ class b2 extends p2 {
37709
37709
  constructor(e3, t3, s3, i4, r6) {
37710
37710
  super(n2.NEventReportResponse, e3, false, i4, r6), this.setAffectedSopInstanceUid(t3), this.setEventTypeId(s3);
37711
37711
  }
@@ -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 p2 {
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
  }
@@ -37764,7 +37764,7 @@ var require_dcmjs_dimse_min = __commonJS({
37764
37764
  super(n2.NSetRequest, e3, false), this.setRequestedSopInstanceUid(t3);
37765
37765
  }
37766
37766
  }
37767
- class L2 extends p3 {
37767
+ class L2 extends p2 {
37768
37768
  constructor(e3, t3, s3, i4) {
37769
37769
  super(n2.NSetResponse, e3, false, s3, i4), this.setAffectedSopInstanceUid(t3);
37770
37770
  }
@@ -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 y || 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: f2, CFindRequest: y, CFindResponse: S2, CGetRequest: x, CGetResponse: w2, CMoveRequest: P2, CMoveResponse: v3, Command: g3, 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: p2 };
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);
@@ -37821,15 +37821,15 @@ var require_dcmjs_dimse_min = __commonJS({
37821
37821
  Object.freeze(g3);
37822
37822
  const l2 = { ImplicitVRLittleEndian: "1.2.840.10008.1.2", ExplicitVRLittleEndian: "1.2.840.10008.1.2.1", DeflatedExplicitVRLittleEndian: "1.2.840.10008.1.2.1.99", ExplicitVRBigEndian: "1.2.840.10008.1.2.2", RleLossless: "1.2.840.10008.1.2.5", JpegBaseline: "1.2.840.10008.1.2.4.50", JpegLossless: "1.2.840.10008.1.2.4.70", JpegLsLossless: "1.2.840.10008.1.2.4.80", JpegLsLossy: "1.2.840.10008.1.2.4.81", Jpeg2000Lossless: "1.2.840.10008.1.2.4.90", Jpeg2000Lossy: "1.2.840.10008.1.2.4.91" };
37823
37823
  Object.freeze(l2);
37824
- const p3 = [l2.ImplicitVRLittleEndian, l2.ExplicitVRLittleEndian];
37825
- Object.freeze(p3);
37824
+ const p2 = [l2.ImplicitVRLittleEndian, l2.ExplicitVRLittleEndian];
37825
+ Object.freeze(p2);
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: g3, Status: u2, StorageClass: m3, TranscodableTransferSyntaxes: p2, 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;
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: p2, WriteBufferStream: R2 } = h3.data, f2 = h3.log;
37830
37830
  class y {
37831
37831
  constructor(e3, t3, s3) {
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 || {};
37832
+ s3 = s3 || {}, s3 = { ignoreErrors: true, ...s3 }, f2.level = "error", this.transferSyntaxUid = t3 || i3.ImplicitVRLittleEndian, Buffer.isBuffer(e3) ? this.elements = this._fromElementsBuffer(e3, this.transferSyntaxUid, s3) : this.elements = e3 || {};
37833
37833
  }
37834
37834
  getElement(e3) {
37835
37835
  return this.elements[e3];
@@ -37887,7 +37887,7 @@ var require_dcmjs_dimse_min = __commonJS({
37887
37887
  return new y(i4, n3);
37888
37888
  }
37889
37889
  _fromElementsBuffer(e3, t3, s3) {
37890
- const n3 = new p3(e3.buffer.slice(e3.byteOffset, e3.byteOffset + e3.byteLength));
37890
+ const n3 = new p2(e3.buffer.slice(e3.byteOffset, e3.byteOffset + e3.byteLength));
37891
37891
  let r6 = t3 === i3.ImplicitVRLittleEndian ? i3.ImplicitVRLittleEndian : i3.ExplicitVRLittleEndian;
37892
37892
  const o3 = g3._read(n3, r6, s3);
37893
37893
  return l2.naturalizeDataset(o3);
@@ -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: g3, Status: l2, TranscodableTransferSyntaxes: p2 } = s2(855), { CCancelRequest: R2, CEchoRequest: f2, CEchoResponse: y, 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();
@@ -38035,7 +38035,7 @@ var require_dcmjs_dimse_min = __commonJS({
38035
38035
  try {
38036
38036
  const t3 = e3.command.getDataset(), s3 = this.association.getPresentationContext(e3.context.getPresentationContextId()).getAcceptedTransferSyntaxUid();
38037
38037
  if (t3 && s3 !== t3.getTransferSyntaxUid()) {
38038
- if (!p3.includes(s3) || !p3.includes(t3.getTransferSyntaxUid()))
38038
+ if (!p2.includes(s3) || !p2.includes(t3.getTransferSyntaxUid()))
38039
38039
  return _2.error(`A transfer syntax transcoding from ${t3.getTransferSyntaxUid()} to ${s3} is currently not supported. Skipping...`), void e3.command.raiseDoneEvent();
38040
38040
  t3.setTransferSyntaxUid(s3);
38041
38041
  }
@@ -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();
@@ -38117,7 +38117,7 @@ var require_dcmjs_dimse_min = __commonJS({
38117
38117
  const s3 = new w2(new j2(this.dimseBuffer.toBuffer()));
38118
38118
  switch (s3.getCommandFieldType()) {
38119
38119
  case g3.CEchoRequest:
38120
- this.dimse = Object.assign(new f(), s3);
38120
+ this.dimse = Object.assign(new f2(), s3);
38121
38121
  break;
38122
38122
  case g3.CEchoResponse:
38123
38123
  this.dimse = Object.assign(new y(), s3);
@@ -38144,16 +38144,16 @@ var require_dcmjs_dimse_min = __commonJS({
38144
38144
  this.dimse = Object.assign(new C2(), s3);
38145
38145
  break;
38146
38146
  case g3.CGetResponse:
38147
- this.dimse = Object.assign(new P(), s3);
38147
+ this.dimse = Object.assign(new P2(), s3);
38148
38148
  break;
38149
38149
  case g3.NCreateRequest:
38150
- this.dimse = Object.assign(new E3(), s3);
38150
+ this.dimse = Object.assign(new E2(), s3);
38151
38151
  break;
38152
38152
  case g3.NCreateResponse:
38153
38153
  this.dimse = Object.assign(new T(), s3);
38154
38154
  break;
38155
38155
  case g3.NActionRequest:
38156
- this.dimse = Object.assign(new q2(), s3);
38156
+ this.dimse = Object.assign(new q(), s3);
38157
38157
  break;
38158
38158
  case g3.NActionResponse:
38159
38159
  this.dimse = Object.assign(new D2(), s3);
@@ -38168,7 +38168,7 @@ var require_dcmjs_dimse_min = __commonJS({
38168
38168
  this.dimse = Object.assign(new N2(), s3);
38169
38169
  break;
38170
38170
  case g3.NEventReportResponse:
38171
- this.dimse = Object.assign(new B(), s3);
38171
+ this.dimse = Object.assign(new B2(), s3);
38172
38172
  break;
38173
38173
  case g3.NGetRequest:
38174
38174
  this.dimse = Object.assign(new M2(), s3);
@@ -38201,7 +38201,7 @@ 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
@@ -38239,7 +38239,7 @@ var require_dcmjs_dimse_min = __commonJS({
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: g3 } = s2(406), l2 = s2(988), p2 = s2(266), R2 = s2(437), f2 = s2(425), y = s2(808), S2 = s2(404);
38720
38720
  e2.exports = { Scp: class extends l2 {
38721
38721
  constructor(e3, t3) {
38722
38722
  super(e3, t3), this.on("associationRequested", (e4) => {
@@ -38796,9 +38796,9 @@ var require_dcmjs_dimse_min = __commonJS({
38796
38796
  abort(e3, t3) {
38797
38797
  R2.error("abort method must be implemented");
38798
38798
  }
38799
- }, Server: class extends f {
38799
+ }, Server: class extends f2 {
38800
38800
  constructor(e3) {
38801
- super(), this.scp = { class: e3 }, this.server = void 0, this.clients = [], this.statistics = new p3();
38801
+ super(), this.scp = { class: e3 }, this.server = void 0, this.clients = [], this.statistics = new p2();
38802
38802
  }
38803
38803
  listen(e3, t3) {
38804
38804
  let s3 = {};
@@ -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: g3, CMoveRequest: l2, CMoveResponse: p2, CStoreRequest: R2, CStoreResponse: f2, NActionRequest: y, 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: y, NCreateRequest: I2, NDeleteRequest: P2, NEventReportRequest: x, NGetRequest: A2, NSetRequest: q }, responses: { CEchoResponse: d3, CFindResponse: h3, CGetResponse: g3, CMoveResponse: p2, CStoreResponse: f2, 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 ct(e, this.prefixParselets, this.infixParselets);
38959
38959
  }
38960
38960
  };
38961
- var at = class {
38961
+ var ct = class {
38962
38962
  constructor(e, t, n) {
38963
38963
  this.tokens = e, this.prefixParselets = t, this.infixParselets = n;
38964
38964
  }
@@ -39009,139 +39009,139 @@ 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
+ function J(r4) {
39013
+ let e = pe(r4), t = Nn(r4);
39014
39014
  return t === e ? { reference: e } : { reference: e, display: t };
39015
39015
  }
39016
- function de(r4) {
39017
- return pe(r4) ? r4.reference : `${r4.resourceType}/${r4.id}`;
39016
+ function pe(r4) {
39017
+ return fe(r4) ? r4.reference : `${r4.resourceType}/${r4.id}`;
39018
39018
  }
39019
- function tr(r4) {
39019
+ function rr(r4) {
39020
39020
  if (r4)
39021
- return pe(r4) ? r4.reference.split("/")[1] : r4.id;
39021
+ return fe(r4) ? r4.reference.split("/")[1] : r4.id;
39022
39022
  }
39023
- function kn(r4) {
39023
+ function Dn(r4) {
39024
39024
  return r4.resourceType === "Patient" || r4.resourceType === "Practitioner" || r4.resourceType === "RelatedPerson";
39025
39025
  }
39026
- function On(r4) {
39027
- if (kn(r4)) {
39028
- let e = Vn(r4);
39026
+ function Nn(r4) {
39027
+ if (Dn(r4)) {
39028
+ let e = Fn(r4);
39029
39029
  if (e)
39030
39030
  return e;
39031
39031
  }
39032
39032
  if (r4.resourceType === "Device") {
39033
- let e = Dn(r4);
39033
+ let e = Mn(r4);
39034
39034
  if (e)
39035
39035
  return e;
39036
39036
  }
39037
- return r4.resourceType === "Observation" && "code" in r4 && r4.code?.text ? r4.code.text : r4.resourceType === "User" && r4.email ? r4.email : "name" in r4 && r4.name && typeof r4.name == "string" ? r4.name : de(r4);
39037
+ return r4.resourceType === "Observation" && "code" in r4 && r4.code?.text ? r4.code.text : r4.resourceType === "User" && r4.email ? r4.email : "name" in r4 && r4.name && typeof r4.name == "string" ? r4.name : pe(r4);
39038
39038
  }
39039
- function Vn(r4) {
39039
+ function Fn(r4) {
39040
39040
  let e = r4.name;
39041
39041
  if (e && e.length > 0)
39042
- return Ie(e[0]);
39042
+ return Oe(e[0]);
39043
39043
  }
39044
- function Dn(r4) {
39044
+ function Mn(r4) {
39045
39045
  let e = r4.deviceName;
39046
39046
  if (e && e.length > 0)
39047
39047
  return e[0].name;
39048
39048
  }
39049
- function Re(r4, e) {
39049
+ function Ce(r4, e) {
39050
39050
  let t = new Date(r4);
39051
39051
  t.setUTCHours(0, 0, 0, 0);
39052
39052
  let n = e ? new Date(e) : /* @__PURE__ */ new Date();
39053
39053
  n.setUTCHours(0, 0, 0, 0);
39054
- let i2 = t.getUTCFullYear(), o = t.getUTCMonth(), s = t.getUTCDate(), a = n.getUTCFullYear(), u2 = n.getUTCMonth(), l2 = n.getUTCDate(), f = a - i2;
39055
- (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 };
39054
+ let i2 = t.getUTCFullYear(), o = t.getUTCMonth(), s = t.getUTCDate(), a = n.getUTCFullYear(), u2 = n.getUTCMonth(), l2 = n.getUTCDate(), p2 = a - i2;
39055
+ (u2 < o || u2 === o && l2 < s) && p2--;
39056
+ let E2 = a * 12 + u2 - (i2 * 12 + o);
39057
+ l2 < s && E2--;
39058
+ let q = Math.floor((n.getTime() - t.getTime()) / (1e3 * 60 * 60 * 24));
39059
+ return { years: p2, months: E2, days: q };
39060
39060
  }
39061
- function ir(r4, ...e) {
39061
+ function or(r4, ...e) {
39062
39062
  let t = r4;
39063
39063
  for (let n = 0; n < e.length && t; n++)
39064
39064
  t = t?.extension?.find((i2) => i2.url === e[n]);
39065
39065
  return t;
39066
39066
  }
39067
- function or(r4, e) {
39068
- return JSON.stringify(r4, Nn, e ? 2 : void 0);
39067
+ function sr(r4, e) {
39068
+ return JSON.stringify(r4, _n, e ? 2 : void 0);
39069
39069
  }
39070
- function Nn(r4, e) {
39071
- return !Fn(r4) && E(e) ? void 0 : e;
39070
+ function _n(r4, e) {
39071
+ return !Ln(r4) && R(e) ? void 0 : e;
39072
39072
  }
39073
- function Fn(r4) {
39073
+ function Ln(r4) {
39074
39074
  return !!/\d+$/.exec(r4);
39075
39075
  }
39076
- function E(r4) {
39076
+ function R(r4) {
39077
39077
  if (r4 == null)
39078
39078
  return true;
39079
39079
  let e = typeof r4;
39080
- return e === "string" || e === "object" ? !_n(r4) : false;
39080
+ return e === "string" || e === "object" ? !Un(r4) : false;
39081
39081
  }
39082
- function _n(r4) {
39082
+ function Un(r4) {
39083
39083
  if (r4 == null)
39084
39084
  return false;
39085
39085
  let e = typeof r4;
39086
39086
  return e === "string" && r4 !== "" || e === "object" && ("length" in r4 && r4.length > 0 || Object.keys(r4).length > 0);
39087
39087
  }
39088
- function sr(r4) {
39088
+ function ar(r4) {
39089
39089
  return r4.every((e) => typeof e == "string");
39090
39090
  }
39091
- var ar = [];
39091
+ var cr = [];
39092
39092
  for (let r4 = 0; r4 < 256; r4++)
39093
- ar.push(r4.toString(16).padStart(2, "0"));
39094
- function cr(r4) {
39093
+ cr.push(r4.toString(16).padStart(2, "0"));
39094
+ function ur(r4) {
39095
39095
  let e = new Uint8Array(r4), t = new Array(e.length);
39096
39096
  for (let n = 0; n < e.length; n++)
39097
- t[n] = ar[e[n]];
39097
+ t[n] = cr[e[n]];
39098
39098
  return t.join("");
39099
39099
  }
39100
- function ur(r4) {
39100
+ function lr(r4) {
39101
39101
  let e = new Uint8Array(r4), t = [];
39102
39102
  for (let n = 0; n < e.length; n++)
39103
39103
  t[n] = String.fromCharCode(e[n]);
39104
39104
  return window.btoa(t.join(""));
39105
39105
  }
39106
- function w(r4) {
39106
+ function I(r4) {
39107
39107
  return r4 ? r4.charAt(0).toUpperCase() + r4.substring(1) : "";
39108
39108
  }
39109
- var lt = (r4) => new Promise((e) => {
39109
+ var dt = (r4) => new Promise((e) => {
39110
39110
  setTimeout(e, r4);
39111
39111
  });
39112
- function Ie(r4, e) {
39112
+ function Oe(r4, e) {
39113
39113
  let t = [];
39114
39114
  if (r4.prefix && e?.prefix !== false && t.push(...r4.prefix), r4.given && t.push(...r4.given), r4.family && t.push(r4.family), r4.suffix && e?.suffix !== false && t.push(...r4.suffix), r4.use && (e?.all || e?.use) && t.push("[" + r4.use + "]"), t.length === 0) {
39115
- let n = re(r4.text);
39115
+ let n = ne(r4.text);
39116
39116
  if (n)
39117
39117
  return n;
39118
39118
  }
39119
39119
  return t.join(" ").trim();
39120
39120
  }
39121
- function re(r4) {
39121
+ function ne(r4) {
39122
39122
  return typeof r4 == "string" ? r4 : void 0;
39123
39123
  }
39124
- function ni(r4, e) {
39124
+ function si(r4, e) {
39125
39125
  let t = e.max && e.max === Number.MAX_SAFE_INTEGER ? Number.POSITIVE_INFINITY : e.max;
39126
39126
  return { path: r4, description: "", type: e.type ?? [], min: e.min ?? 0, max: t ?? 1, isArray: !!t && t > 1, constraints: [] };
39127
39127
  }
39128
- function fr(r4) {
39128
+ function mr(r4) {
39129
39129
  let e = /* @__PURE__ */ Object.create(null);
39130
39130
  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: [] };
39131
+ e[t] = { name: t, elements: Object.fromEntries(Object.entries(n.elements).map(([i2, o]) => [i2, si(i2, o)])), constraints: [], innerTypes: [] };
39132
39132
  return e;
39133
39133
  }
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" }] } } } };
39134
+ var hr = { 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
39135
  function d(r4) {
39136
39136
  return [{ type: c.boolean, value: r4 }];
39137
39137
  }
39138
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 };
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 } : P(r4) ? { type: c.Quantity, value: r4 } : _(r4) ? { type: r4.resourceType, value: r4 } : { type: c.BackboneElement, value: r4 };
39140
39140
  }
39141
- function V(r4) {
39141
+ function D(r4) {
39142
39142
  return r4.length === 0 ? false : !!r4[0].value;
39143
39143
  }
39144
- function _(r4, e) {
39144
+ function M(r4, e) {
39145
39145
  if (r4.length !== 0) {
39146
39146
  if (r4.length === 1 && (!e || r4[0].type === e))
39147
39147
  return r4[0];
@@ -39151,10 +39151,10 @@ function _(r4, e) {
39151
39151
  function A(r4, e) {
39152
39152
  if (!r4.value)
39153
39153
  return;
39154
- let t = Ve(r4.type, e);
39155
- return t ? oi(r4.value, e, t) : si(r4, e);
39154
+ let t = Ne(r4.type, e);
39155
+ return t ? ci(r4.value, e, t) : ui(r4, e);
39156
39156
  }
39157
- function oi(r4, e, t) {
39157
+ function ci(r4, e, t) {
39158
39158
  let n = t.type;
39159
39159
  if (!n || n.length === 0)
39160
39160
  return;
@@ -39162,7 +39162,7 @@ function oi(r4, e, t) {
39162
39162
  if (t.path.endsWith("[x]")) {
39163
39163
  let a = t.path.split(".").pop().replace("[x]", "");
39164
39164
  for (let u2 of n) {
39165
- let l2 = a + w(u2.code);
39165
+ let l2 = a + I(u2.code);
39166
39166
  if (i2 = r4[l2], s = r4["_" + l2], i2 !== void 0 || s !== void 0) {
39167
39167
  o = u2.code;
39168
39168
  break;
@@ -39173,16 +39173,16 @@ function oi(r4, e, t) {
39173
39173
  if (s)
39174
39174
  if (Array.isArray(i2))
39175
39175
  for (let a = 0; a < Math.max(i2.length, s.length); a++)
39176
- i2[a] = xr(i2[a], s[a]);
39176
+ i2[a] = Tr(i2[a], s[a]);
39177
39177
  else
39178
- i2 = xr(i2, s);
39179
- if (!E(i2))
39180
- return (o === "Element" || o === "BackboneElement") && (o = t.type[0].code), Array.isArray(i2) ? i2.map((a) => hr(a, o)) : hr(i2, o);
39178
+ i2 = Tr(i2, s);
39179
+ if (!R(i2))
39180
+ return (o === "Element" || o === "BackboneElement") && (o = t.type[0].code), Array.isArray(i2) ? i2.map((a) => gr(a, o)) : gr(i2, o);
39181
39181
  }
39182
- function hr(r4, e) {
39183
- return e === "Resource" && M(r4) && (e = r4.resourceType), { type: e, value: r4 };
39182
+ function gr(r4, e) {
39183
+ return e === "Resource" && _(r4) && (e = r4.resourceType), { type: e, value: r4 };
39184
39184
  }
39185
- function si(r4, e) {
39185
+ function ui(r4, e) {
39186
39186
  let t = r4.value;
39187
39187
  if (!t || typeof t != "object")
39188
39188
  return;
@@ -39191,21 +39191,21 @@ function si(r4, e) {
39191
39191
  n = t[e];
39192
39192
  else
39193
39193
  for (let i2 in c) {
39194
- let o = e + w(i2);
39194
+ let o = e + I(i2);
39195
39195
  if (o in t) {
39196
39196
  n = t[o];
39197
39197
  break;
39198
39198
  }
39199
39199
  }
39200
- if (!E(n))
39200
+ if (!R(n))
39201
39201
  return Array.isArray(n) ? n.map(g) : g(n);
39202
39202
  }
39203
- function ke(r4) {
39203
+ function Ve(r4) {
39204
39204
  let e = [];
39205
39205
  for (let t of r4) {
39206
39206
  let n = false;
39207
39207
  for (let i2 of e)
39208
- if (V(Tr(t, i2))) {
39208
+ if (D(vr(t, i2))) {
39209
39209
  n = true;
39210
39210
  break;
39211
39211
  }
@@ -39213,28 +39213,28 @@ function ke(r4) {
39213
39213
  }
39214
39214
  return e;
39215
39215
  }
39216
- function ft(r4) {
39217
- return d(!V(r4));
39216
+ function mt(r4) {
39217
+ return d(!D(r4));
39218
39218
  }
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]))));
39219
+ function ht(r4, e) {
39220
+ return r4.length === 0 || e.length === 0 ? [] : r4.length !== e.length ? d(false) : d(r4.every((t, n) => D(vr(t, e[n]))));
39221
39221
  }
39222
- function Tr(r4, e) {
39222
+ function vr(r4, e) {
39223
39223
  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);
39224
+ return typeof t == "number" && typeof n == "number" ? d(Math.abs(t - n) < 1e-8) : P(t) && P(n) ? d(Sr(t, n)) : d(typeof t == "object" && typeof n == "object" ? yt(r4, e) : t === n);
39225
39225
  }
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])))));
39226
+ function gt(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) => D(li(t, e[n])))));
39228
39228
  }
39229
- function ai(r4, e) {
39229
+ function li(r4, e) {
39230
39230
  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);
39231
+ return typeof s == "number" && typeof a == "number" ? d(Math.abs(s - a) < 0.01) : P(s) && P(a) ? d(Sr(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);
39232
39232
  }
39233
39233
  function yr(r4, e) {
39234
39234
  let t = r4.value?.valueOf(), n = e.value?.valueOf();
39235
39235
  return typeof t == "number" && typeof n == "number" ? t - n : typeof t == "string" && typeof n == "string" ? t.localeCompare(n) : 0;
39236
39236
  }
39237
- function Oe(r4, e) {
39237
+ function De(r4, e) {
39238
39238
  let { value: t } = r4;
39239
39239
  if (t == null)
39240
39240
  return false;
@@ -39251,20 +39251,20 @@ function Oe(r4, e) {
39251
39251
  case "Time":
39252
39252
  return typeof t == "string" && !!/^T\d/.exec(t);
39253
39253
  case "Period":
39254
- return ci(t);
39254
+ return di(t);
39255
39255
  case "Quantity":
39256
- return b(t);
39256
+ return P(t);
39257
39257
  default:
39258
39258
  return typeof t == "object" && t?.resourceType === e;
39259
39259
  }
39260
39260
  }
39261
- function ci(r4) {
39261
+ function di(r4) {
39262
39262
  return !!(r4 && typeof r4 == "object" && "start" in r4);
39263
39263
  }
39264
- function b(r4) {
39264
+ function P(r4) {
39265
39265
  return !!(r4 && typeof r4 == "object" && "value" in r4 && typeof r4.value == "number");
39266
39266
  }
39267
- function vr(r4, e) {
39267
+ function Sr(r4, e) {
39268
39268
  return Math.abs(r4.value - e.value) < 0.01 && (r4.unit === e.unit || r4.code === e.code || r4.unit === e.code || r4.code === e.unit);
39269
39269
  }
39270
39270
  function yt(r4, e) {
@@ -39273,7 +39273,7 @@ function yt(r4, e) {
39273
39273
  return false;
39274
39274
  for (let i2 of t) {
39275
39275
  let o = r4[i2], s = e[i2];
39276
- if (gr(o) && gr(s)) {
39276
+ if (xr(o) && xr(s)) {
39277
39277
  if (!yt(o, s))
39278
39278
  return false;
39279
39279
  } else if (o !== s)
@@ -39281,97 +39281,97 @@ function yt(r4, e) {
39281
39281
  }
39282
39282
  return true;
39283
39283
  }
39284
- function gr(r4) {
39284
+ function xr(r4) {
39285
39285
  return r4 !== null && typeof r4 == "object";
39286
39286
  }
39287
- function xr(r4, e) {
39287
+ function Tr(r4, e) {
39288
39288
  if (e) {
39289
39289
  if (typeof e != "object")
39290
39290
  throw new Error("Primitive extension must be an object");
39291
- return ui(r4 ?? {}, e);
39291
+ return pi(r4 ?? {}, e);
39292
39292
  }
39293
39293
  return r4;
39294
39294
  }
39295
- function ui(r4, e) {
39295
+ function pi(r4, e) {
39296
39296
  return delete e.__proto__, delete e.constructor, Object.assign(r4, e);
39297
39297
  }
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) {
39298
+ var xt = "ok";
39299
+ var Fe = "created";
39300
+ var vt = "not-modified";
39301
+ var St = "not-found";
39302
+ var Me = "accepted";
39303
+ var Pr = { resourceType: "OperationOutcome", id: St, issue: [{ severity: "error", code: "not-found", details: { text: "Not found" } }] };
39304
+ function v(r4, e) {
39305
39305
  return { resourceType: "OperationOutcome", issue: [{ severity: "error", code: "invalid", details: { text: r4 }, expression: e ? [e] : void 0 }] };
39306
39306
  }
39307
39307
  function h(r4) {
39308
39308
  return { resourceType: "OperationOutcome", issue: [{ severity: "error", code: "structure", details: { text: r4 } }] };
39309
39309
  }
39310
- function Fe(r4) {
39310
+ function ie(r4) {
39311
39311
  return typeof r4 == "object" && r4 !== null && r4.resourceType === "OperationOutcome";
39312
39312
  }
39313
- function St(r4) {
39314
- return r4.id === gt || r4.id === De || r4.id === Tt || r4.id === Ne;
39313
+ function Et(r4) {
39314
+ return r4.id === xt || r4.id === Fe || r4.id === vt || r4.id === Me;
39315
39315
  }
39316
- var p = class extends Error {
39316
+ var f = class extends Error {
39317
39317
  constructor(t, n) {
39318
- super(Pr(t));
39318
+ super(Cr(t));
39319
39319
  this.outcome = t, this.cause = n;
39320
39320
  }
39321
39321
  };
39322
39322
  function _e(r4) {
39323
- return r4 instanceof p ? r4.outcome : Fe(r4) ? r4 : I(li(r4));
39323
+ return r4 instanceof f ? r4.outcome : ie(r4) ? r4 : v(fi(r4));
39324
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";
39325
+ function fi(r4) {
39326
+ return r4 ? typeof r4 == "string" ? r4 : r4 instanceof Error ? r4.message : ie(r4) ? Cr(r4) : typeof r4 == "object" && "code" in r4 && typeof r4.code == "string" ? r4.code : JSON.stringify(r4) : "Unknown error";
39327
39327
  }
39328
- function Pr(r4) {
39329
- let e = r4.issue?.map(di) ?? [];
39328
+ function Cr(r4) {
39329
+ let e = r4.issue?.map(mi) ?? [];
39330
39330
  return e.length > 0 ? e.join("; ") : "Unknown error";
39331
39331
  }
39332
- function di(r4) {
39332
+ function mi(r4) {
39333
39333
  let e;
39334
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
39335
  }
39336
39336
  function At(r4) {
39337
- return new Rt(r4).parse();
39337
+ return new Pt(r4).parse();
39338
39338
  }
39339
- var fe = fr(mr);
39340
- var Ct = /* @__PURE__ */ Object.create(null);
39341
- var wr = /* @__PURE__ */ Object.create(null);
39342
- function wt(r4) {
39339
+ var me = mr(hr);
39340
+ var wt = /* @__PURE__ */ Object.create(null);
39341
+ var Ir = /* @__PURE__ */ Object.create(null);
39342
+ function It(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 kt(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
+ hi(n, e);
39350
39350
  }
39351
- function pi(r4, e) {
39351
+ function hi(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 = At(r4), n = It(e);
39357
+ n[r4.name] = t, e && r4.url === e && (wt[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 It(e)[r4];
39366
39366
  }
39367
- function _r(r4) {
39368
- return !!Ct[r4];
39367
+ function Mr(r4) {
39368
+ return !!wt[r4];
39369
39369
  }
39370
- var Rt = class {
39370
+ var Pt = 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: Ti(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 = Rt(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[Rt(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 = Rt(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: Ct(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
+ xi(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 = Ct(e)), n || (n = or(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 Rt(r4, e = "") {
39471
+ return yi(r4.path, e);
39472
39472
  }
39473
- function mi(r4, e) {
39473
+ function yi(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 xi(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 Ti(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 Vt(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 Ct(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" ? vi((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 vi(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 Ne(r4, e) {
39505
+ let t = Le(r4);
39506
39506
  if (t)
39507
- return Si(t.elements, e);
39507
+ return Ri(t.elements, e);
39508
39508
  }
39509
- function Si(r4, e) {
39509
+ function Ri(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,8 +39537,8 @@ 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) => d(e.length === 0), exists: (r4, e, t) => t ? d(e.filter((n) => D(t.eval(r4, [n]))).length > 0) : d(e.length > 0), all: (r4, e, t) => d(e.every((n) => D(t.eval(r4, [n])))), allTrue: (r4, e) => {
39542
39542
  for (let t of e)
39543
39543
  if (!t.value)
39544
39544
  return d(false);
@@ -39558,12 +39558,12 @@ var S = { empty: (r4, e) => d(e.length === 0), exists: (r4, e, t) => t ? d(e.fil
39558
39558
  if (!t.value)
39559
39559
  return d(true);
39560
39560
  return d(false);
39561
- }, subsetOf: me, supersetOf: me, count: (r4, e) => [{ type: c.integer, value: e.length }], distinct: (r4, e) => {
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) => d(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,7 +39595,7 @@ 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 Ve([...e, ...n]);
39599
39599
  }, combine: (r4, e, t) => {
39600
39600
  if (!t)
39601
39601
  return e;
@@ -39605,7 +39605,7 @@ var S = { empty: (r4, e) => d(e.length === 0), exists: (r4, e, t) => t ? d(e.fil
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 [];
@@ -39622,65 +39622,65 @@ var S = { empty: (r4, e) => d(e.length === 0), exists: (r4, e, t) => t ? d(e.fil
39622
39622
  return d(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 ? [] : d(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 ? [] : d(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 ? [] : d(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 ? [] : d(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 ? [] : d(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 ? [] : d(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 ? [] : d(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 ? [] : d(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 = Ce(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: De(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;
@@ -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");
@@ -39718,10 +39718,10 @@ function k(r4, e, t, ...n) {
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
- 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;
39724
+ let a = r4(s, ...n.map((p2) => p2.eval(e, t)[0]?.value)), u2 = o ? c.Quantity : t[0].type, l2 = o ? { ...i2, value: a } : a;
39725
39725
  return [{ type: u2, value: l2 }];
39726
39726
  }
39727
39727
  function U(r4, e) {
@@ -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, p2 = this.impl(u2, l2);
39813
+ return typeof p2 == "boolean" ? d(p2) : P(s) ? [{ type: c.Quantity, value: { ...s, value: p2 } }] : [g(p2)];
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,7 +39822,7 @@ 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
  }
@@ -39832,16 +39831,16 @@ var qe = class extends v {
39832
39831
  return d(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);
39839
+ let n = M(this.left.eval(e, t)), i2 = this.right.eval(e, t);
39841
39840
  return n ? d(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 Ve([...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 ht(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 mt(ht(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 gt(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 mt(gt(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 d(De(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");
39916
+ let n = M(this.left.eval(e, t), "boolean"), i2 = M(this.right.eval(e, t), "boolean");
39918
39917
  return n?.value === true && i2?.value === true ? d(true) : n?.value === false || i2?.value === false ? d(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");
39925
+ let n = M(this.left.eval(e, t), "boolean"), i2 = M(this.right.eval(e, t), "boolean");
39927
39926
  return n?.value === false && i2?.value === false ? d(false) : n?.value || i2?.value ? d(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");
39934
+ let n = M(this.left.eval(e, t), "boolean"), i2 = M(this.right.eval(e, t), "boolean");
39936
39935
  return !n || !i2 ? [] : d(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");
39943
+ let n = M(this.left.eval(e, t), "boolean"), i2 = M(this.right.eval(e, t), "boolean");
39945
39944
  return i2?.value === true || n?.value === false ? d(true) : !n || !i2 ? [] : d(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 Ai = { 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 wi = { 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 Ii = { 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 ki(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: ki(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("(", Ai).registerInfix("[", wi).registerInfix("(", Ii).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();
40012
- var Br = ((f) => (f.BOOLEAN = "BOOLEAN", f.NUMBER = "NUMBER", f.QUANTITY = "QUANTITY", f.TEXT = "TEXT", f.REFERENCE = "REFERENCE", f.CANONICAL = "CANONICAL", f.DATE = "DATE", f.DATETIME = "DATETIME", f.PERIOD = "PERIOD", f.UUID = "UUID", f))(Br || {});
40013
- var Fi = ((x) => (x.EQUALS = "eq", x.NOT_EQUALS = "ne", x.GREATER_THAN = "gt", x.LESS_THAN = "lt", x.GREATER_THAN_OR_EQUALS = "ge", x.LESS_THAN_OR_EQUALS = "le", x.STARTS_AFTER = "sa", x.ENDS_BEFORE = "eb", x.APPROXIMATELY = "ap", x.CONTAINS = "contains", x.EXACT = "exact", x.TEXT = "text", x.NOT = "not", x.ABOVE = "above", x.BELOW = "below", x.IN = "in", x.NOT_IN = "not-in", x.OF_TYPE = "of-type", x.MISSING = "missing", x.IDENTIFIER = "identifier", x.ITERATE = "iterate", x))(Fi || {});
40014
- var ro = ((T) => (T.READ = "read", T.VREAD = "vread", T.UPDATE = "update", T.PATCH = "patch", T.DELETE = "delete", T.HISTORY = "history", T.HISTORY_INSTANCE = "history-instance", T.HISTORY_TYPE = "history-type", T.HISTORY_SYSTEM = "history-system", T.CREATE = "create", T.SEARCH = "search", T.SEARCH_TYPE = "search-type", T.SEARCH_SYSTEM = "search-system", T.SEARCH_COMPARTMENT = "search-compartment", T.CAPABILITIES = "capabilities", T.TRANSACTION = "transaction", T.BATCH = "batch", T.OPERATION = "operation", T))(ro || {});
40010
+ var Oi = xe();
40011
+ var Br = ((p2) => (p2.BOOLEAN = "BOOLEAN", p2.NUMBER = "NUMBER", p2.QUANTITY = "QUANTITY", p2.TEXT = "TEXT", p2.REFERENCE = "REFERENCE", p2.CANONICAL = "CANONICAL", p2.DATE = "DATE", p2.DATETIME = "DATETIME", p2.PERIOD = "PERIOD", p2.UUID = "UUID", p2))(Br || {});
40012
+ var Li = ((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))(Li || {});
40013
+ var oo = ((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))(oo || {});
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 Bt() {
40030
40029
  let r4 = new Uint32Array(28);
40031
- return crypto.getRandomValues(r4), cr(r4.buffer);
40030
+ return crypto.getRandomValues(r4), ur(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 qt = { "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 ho = ["Patient", "Encounter", "ImagingStudy", "DiagnosticReport", "OperationOutcome", "Bundle"];
40107
+ var jt = ["DiagnosticReport-update"];
40109
40108
  function nn(r4) {
40110
- return qt.includes(r4);
40109
+ return jt.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 (jt.includes(r4))
40113
+ throw new f(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 go = { "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 yo(r4) {
40117
+ return ho.includes(r4);
40119
40118
  }
40120
40119
  function sn(r4) {
40121
40120
  return !!r4.endpoint;
40122
40121
  }
40123
40122
  function $t(r4) {
40124
- if (!tt(r4))
40125
- throw new p(h("subscriptionRequest must be an object conforming to SubscriptionRequest type."));
40123
+ if (!nt(r4))
40124
+ throw new f(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 (!qt[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 f(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 f(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 f(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 (!yo(e.resourceType))
40149
+ throw new f(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 f(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 xo(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 f(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 To(r4, e) {
40166
+ let t = /* @__PURE__ */ new Map(), n = go[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 f(h(`Key '${o}' not found for event '${r4}'. Make sure to add only valid keys.`));
40171
+ xo(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 f(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 f(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 Qt(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 f(h("Must provide a topic."));
40183
+ if (!qt[e])
40184
+ throw new f(h(`Must provide a valid FHIRcast event name. Supported events: ${Object.keys(qt).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 f(h("context must be a context object or array of context objects."));
40187
+ if (jt.includes(e) && !n)
40188
+ throw new f(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 To(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 f(h("Subscription request should contain an endpoint."));
40197
+ if (!nt(t))
40198
+ throw new f(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 vo(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,21 @@ function go(r4) {
40224
40223
  function an(r4) {
40225
40224
  return r4.split(".").length === 3;
40226
40225
  }
40227
- function Qt(r4) {
40226
+ function Ht(r4) {
40228
40227
  let [e, t, n] = r4.split(".");
40229
- return go(t);
40228
+ return vo(t);
40230
40229
  }
40231
40230
  function cn(r4) {
40232
40231
  try {
40233
- return typeof Qt(r4).login_id == "string";
40232
+ return typeof Ht(r4).login_id == "string";
40234
40233
  } catch {
40235
40234
  return false;
40236
40235
  }
40237
40236
  }
40238
- var xo;
40239
- var C = class {
40237
+ var So;
40238
+ var w = class {
40240
40239
  constructor(e) {
40241
- this[xo] = "ReadablePromise";
40240
+ this[So] = "ReadablePromise";
40242
40241
  this.status = "pending";
40243
40242
  this.suspender = e.then((t) => (this.status = "success", this.response = t, t), (t) => {
40244
40243
  throw this.status = "error", this.error = t, t;
@@ -40270,10 +40269,10 @@ var C = class {
40270
40269
  return this.suspender.finally(e);
40271
40270
  }
40272
40271
  };
40273
- xo = Symbol.toStringTag;
40274
- var ve = class {
40272
+ So = Symbol.toStringTag;
40273
+ var Se = class {
40275
40274
  constructor(e) {
40276
- this.storage = e ?? (typeof localStorage < "u" ? localStorage : new Ht());
40275
+ this.storage = e ?? (typeof localStorage < "u" ? localStorage : new Gt());
40277
40276
  }
40278
40277
  clear() {
40279
40278
  this.storage.clear();
@@ -40289,10 +40288,10 @@ var ve = class {
40289
40288
  return t ? JSON.parse(t) : void 0;
40290
40289
  }
40291
40290
  setObject(e, t) {
40292
- this.setString(e, t ? or(t) : void 0);
40291
+ this.setString(e, t ? sr(t) : void 0);
40293
40292
  }
40294
40293
  };
40295
- var Ht = class {
40294
+ var Gt = class {
40296
40295
  constructor() {
40297
40296
  this.data = /* @__PURE__ */ new Map();
40298
40297
  }
@@ -40315,23 +40314,23 @@ var Ht = class {
40315
40314
  return Array.from(this.data.keys())[e];
40316
40315
  }
40317
40316
  };
40318
- var To = O.FHIR_JSON + ", */*; q=0.1";
40319
- var vo = "https://api.medplum.com/";
40320
- var So = 1e3;
40321
- var Eo = 6e4;
40317
+ var Eo = V.FHIR_JSON + ", */*; q=0.1";
40318
+ var bo = "https://api.medplum.com/";
40319
+ var Ro = 1e3;
40320
+ var Po = 6e4;
40322
40321
  var ln = "Binary/";
40323
40322
  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 {
40323
+ var Co = ((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))(Co || {});
40324
+ var Ao = ((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))(Ao || {});
40325
+ var wo = ((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))(wo || {});
40326
+ var Io = ((e) => (e.JwtBearer = "urn:ietf:params:oauth:client-assertion-type:jwt-bearer", e))(Io || {});
40327
+ var pn = class extends ve {
40329
40328
  constructor(t) {
40330
40329
  super();
40331
40330
  this.initComplete = true;
40332
40331
  if (t?.baseUrl && !t.baseUrl.startsWith("http"))
40333
40332
  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)
40333
+ if (this.options = t ?? {}, this.fetch = t?.fetch ?? ko(), this.storage = t?.storage ?? new Se(), this.createPdfImpl = t?.createPdf, this.baseUrl = mn(t?.baseUrl ?? bo), this.fhirBaseUrl = mn(it(this.baseUrl, t?.fhirUrlPath ?? "fhir/R4/")), this.authorizeUrl = it(this.baseUrl, t?.authorizeUrl ?? "oauth2/authorize"), this.tokenUrl = it(this.baseUrl, t?.tokenUrl ?? "oauth2/token"), this.logoutUrl = it(this.baseUrl, t?.logoutUrl ?? "oauth2/logout"), this.clientId = t?.clientId ?? "", this.clientSecret = t?.clientSecret ?? "", this.onUnauthenticated = t?.onUnauthenticated, this.cacheTime = t?.cacheTime ?? Po, this.cacheTime > 0 ? this.requestCache = new et(t?.resourceCacheSize ?? Ro) : this.requestCache = void 0, t?.autoBatchTime ? (this.autoBatchTime = t.autoBatchTime, this.autoBatchQueue = []) : (this.autoBatchTime = 0, this.autoBatchQueue = void 0), t?.accessToken)
40335
40334
  this.setAccessToken(t.accessToken), this.initPromise = Promise.resolve();
40336
40335
  else if (this.storage.getInitPromise !== void 0) {
40337
40336
  let n = this.storage.getInitPromise(), i2 = new Promise((o) => {
@@ -40393,7 +40392,7 @@ var pn = class extends Te {
40393
40392
  t.startsWith(this.fhirBaseUrl) && this.autoBatchQueue ? o = new Promise((a, u2) => {
40394
40393
  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
40394
  }) : o = this.request("GET", t, n);
40396
- let s = new C(o);
40395
+ let s = new w(o);
40397
40396
  return this.setCacheEntry(t, s), s;
40398
40397
  }
40399
40398
  post(t, n, i2, o = {}) {
@@ -40403,7 +40402,7 @@ var pn = class extends Te {
40403
40402
  return t = t.toString(), this.setRequestBody(o, n), i2 && this.setRequestContentType(o, i2), this.invalidateUrl(t), this.request("PUT", t, o);
40404
40403
  }
40405
40404
  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);
40405
+ return t = t.toString(), this.setRequestBody(i2, n), this.setRequestContentType(i2, V.JSON_PATCH), this.invalidateUrl(t), this.request("PATCH", t, i2);
40407
40406
  }
40408
40407
  delete(t, n) {
40409
40408
  return t = t.toString(), this.invalidateUrl(t), this.request("DELETE", t, n);
@@ -40472,11 +40471,11 @@ var pn = class extends Te {
40472
40471
  let o = this.fhirSearchUrl(t, n), s = o.toString() + "-search", a = this.getCacheEntry(s, i2);
40473
40472
  if (a)
40474
40473
  return a.value;
40475
- let u2 = new C((async () => {
40474
+ let u2 = new w((async () => {
40476
40475
  let l2 = await this.get(o, i2);
40477
40476
  if (l2.entry)
40478
- for (let f of l2.entry)
40479
- this.cacheResource(f.resource);
40477
+ for (let p2 of l2.entry)
40478
+ this.cacheResource(p2.resource);
40480
40479
  return l2;
40481
40480
  })());
40482
40481
  return this.setCacheEntry(s, u2), u2;
@@ -40487,14 +40486,14 @@ var pn = class extends Te {
40487
40486
  let s = o.toString() + "-searchOne", a = this.getCacheEntry(s, i2);
40488
40487
  if (a)
40489
40488
  return a.value;
40490
- let u2 = new C(this.search(t, o.searchParams, i2).then((l2) => l2.entry?.[0]?.resource));
40489
+ let u2 = new w(this.search(t, o.searchParams, i2).then((l2) => l2.entry?.[0]?.resource));
40491
40490
  return this.setCacheEntry(s, u2), u2;
40492
40491
  }
40493
40492
  searchResources(t, n, i2) {
40494
40493
  let s = this.fhirSearchUrl(t, n).toString() + "-searchResources", a = this.getCacheEntry(s, i2);
40495
40494
  if (a)
40496
40495
  return a.value;
40497
- let u2 = new C(this.search(t, n, i2).then(yn));
40496
+ let u2 = new w(this.search(t, n, i2).then(gn));
40498
40497
  return this.setCacheEntry(s, u2), u2;
40499
40498
  }
40500
40499
  async *searchResourcePages(t, n, i2) {
@@ -40503,7 +40502,7 @@ var pn = class extends Te {
40503
40502
  let s = new URL(o).searchParams, a = await this.search(t, s, i2), u2 = a.link?.find((l2) => l2.relation === "next");
40504
40503
  if (!a.entry?.length && !u2)
40505
40504
  break;
40506
- yield yn(a), o = u2?.url ? new URL(u2.url) : void 0;
40505
+ yield gn(a), o = u2?.url ? new URL(u2.url) : void 0;
40507
40506
  }
40508
40507
  }
40509
40508
  searchValueSet(t, n, i2) {
@@ -40530,19 +40529,19 @@ var pn = class extends Te {
40530
40529
  readReference(t, n) {
40531
40530
  let i2 = t.reference;
40532
40531
  if (!i2)
40533
- return new C(Promise.reject(new Error("Missing reference")));
40532
+ return new w(Promise.reject(new Error("Missing reference")));
40534
40533
  if (i2 === "system")
40535
- return new C(Promise.resolve(dn));
40534
+ return new w(Promise.resolve(dn));
40536
40535
  let [o, s] = i2.split("/");
40537
- return !o || !s ? new C(Promise.reject(new Error("Invalid reference"))) : this.readResource(o, s, n);
40536
+ return !o || !s ? new w(Promise.reject(new Error("Invalid reference"))) : this.readResource(o, s, n);
40538
40537
  }
40539
40538
  requestSchema(t) {
40540
- if (Dr(t))
40539
+ if (Nr(t))
40541
40540
  return Promise.resolve();
40542
40541
  let n = t + "-requestSchema", i2 = this.getCacheEntry(n, void 0);
40543
40542
  if (i2)
40544
40543
  return i2.value;
40545
- let o = new C((async () => {
40544
+ let o = new w((async () => {
40546
40545
  let s = `{
40547
40546
  StructureDefinitionList(name: "${t}") {
40548
40547
  resourceType,
@@ -40583,21 +40582,21 @@ var pn = class extends Te {
40583
40582
  target
40584
40583
  }
40585
40584
  }`.replace(/\s+/g, " "), a = await this.graphql(s);
40586
- It(a.data.StructureDefinitionList);
40585
+ kt(a.data.StructureDefinitionList);
40587
40586
  for (let u2 of a.data.SearchParameterList)
40588
- Ot(u2);
40587
+ Vt(u2);
40589
40588
  })());
40590
40589
  return this.setCacheEntry(n, o), o;
40591
40590
  }
40592
40591
  requestProfileSchema(t) {
40593
- if (_r(t))
40592
+ if (Mr(t))
40594
40593
  return Promise.resolve();
40595
40594
  let n = t + "-requestSchema", i2 = this.getCacheEntry(n, void 0);
40596
40595
  if (i2)
40597
40596
  return i2.value;
40598
- let o = new C((async () => {
40597
+ let o = new w((async () => {
40599
40598
  let s = await this.searchOne("StructureDefinition", { url: t, _sort: "-_lastUpdated" });
40600
- s ? It([s], t) : console.warn(`No StructureDefinition found for ${t}!`);
40599
+ s ? kt([s], t) : console.warn(`No StructureDefinition found for ${t}!`);
40601
40600
  })());
40602
40601
  return this.setCacheEntry(n, o), o;
40603
40602
  }
@@ -40628,13 +40627,13 @@ var pn = class extends Te {
40628
40627
  }
40629
40628
  uploadwithProgress(t, n, i2, o, s) {
40630
40629
  return new Promise((a, u2) => {
40631
- let l2 = new XMLHttpRequest(), f = () => l2.abort();
40632
- s?.signal?.addEventListener("abort", f);
40633
- let P = (B) => {
40634
- s?.signal?.removeEventListener("abort", f), B instanceof Error ? u2(B) : a(B);
40630
+ let l2 = new XMLHttpRequest(), p2 = () => l2.abort();
40631
+ s?.signal?.addEventListener("abort", p2);
40632
+ let E2 = (q) => {
40633
+ s?.signal?.removeEventListener("abort", p2), q instanceof Error ? u2(q) : a(q);
40635
40634
  };
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)));
40635
+ 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 = () => {
40636
+ l2.status >= 200 && l2.status < 300 ? E2(l2.response) : E2(new f(_e(l2.response || l2.statusText)));
40638
40637
  }, 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
40638
  });
40640
40639
  }
@@ -40646,7 +40645,7 @@ var pn = class extends Te {
40646
40645
  }
40647
40646
  createComment(t, n, i2) {
40648
40647
  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);
40648
+ 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
40649
  }
40651
40650
  async updateResource(t, n) {
40652
40651
  if (!t.resourceType)
@@ -40680,22 +40679,22 @@ var pn = class extends Te {
40680
40679
  return this.post(this.fhirBaseUrl.slice(0, -1), t, void 0, n);
40681
40680
  }
40682
40681
  sendEmail(t, n) {
40683
- return this.post("email/v1/send", t, O.JSON, n);
40682
+ return this.post("email/v1/send", t, V.JSON, n);
40684
40683
  }
40685
40684
  graphql(t, n, i2, o) {
40686
- return this.post(this.fhirUrl("$graphql"), { query: t, operationName: n, variables: i2 }, O.JSON, o);
40685
+ return this.post(this.fhirUrl("$graphql"), { query: t, operationName: n, variables: i2 }, V.JSON, o);
40687
40686
  }
40688
40687
  readResourceGraph(t, n, i2, o) {
40689
40688
  return this.get(`${this.fhirUrl(t, n)}/$graph?graph=${i2}`, o);
40690
40689
  }
40691
40690
  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);
40691
+ return this.post(this.fhirUrl("Agent", rr(t), "$push"), { destination: pe(n), body: i2, contentType: o, waitForResponse: s }, V.FHIR_JSON, a);
40693
40692
  }
40694
40693
  getActiveLogin() {
40695
40694
  return this.storage.getObject("activeLogin");
40696
40695
  }
40697
40696
  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();
40697
+ (!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
40698
  }
40700
40699
  getAccessToken() {
40701
40700
  return this.accessToken;
@@ -40782,7 +40781,7 @@ var pn = class extends Te {
40782
40781
  this.requestCache && this.requestCache.set(t, { requestTime: Date.now(), value: n });
40783
40782
  }
40784
40783
  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)));
40784
+ 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
40785
  }
40787
40786
  deleteCacheEntry(t) {
40788
40787
  this.requestCache && this.requestCache.delete(t);
@@ -40799,22 +40798,22 @@ var pn = class extends Te {
40799
40798
  return;
40800
40799
  let a = t.headers.get("content-type")?.includes("json");
40801
40800
  if (t.status === 404 && !a)
40802
- throw new p(Rr);
40801
+ throw new f(Pr);
40803
40802
  let u2 = t.headers.get("content-location"), l2 = o.redirect ?? this.options.redirect;
40804
40803
  if (t.status === 201 && u2 && l2 === "follow")
40805
40804
  return this.request("GET", u2, { ...o, body: void 0 });
40806
- let f;
40805
+ let p2;
40807
40806
  if (a)
40808
40807
  try {
40809
- f = await t.json();
40810
- } catch (P) {
40811
- throw console.error("Error parsing response", t.status, P), P;
40808
+ p2 = await t.json();
40809
+ } catch (E2) {
40810
+ throw console.error("Error parsing response", t.status, E2), E2;
40812
40811
  }
40813
40812
  else
40814
- f = await t.text();
40813
+ p2 = await t.text();
40815
40814
  if (t.status >= 400)
40816
- throw new p(_e(f));
40817
- return f;
40815
+ throw new f(_e(p2));
40816
+ return p2;
40818
40817
  }
40819
40818
  async fetchWithRetry(t, n) {
40820
40819
  t.startsWith("http") || (t = new URL(t, this.baseUrl).href);
@@ -40826,7 +40825,7 @@ var pn = class extends Te {
40826
40825
  } catch (u2) {
40827
40826
  this.retryCatch(a, i2, u2);
40828
40827
  }
40829
- await lt(o);
40828
+ await dt(o);
40830
40829
  }
40831
40830
  return s;
40832
40831
  }
@@ -40850,7 +40849,7 @@ var pn = class extends Te {
40850
40849
  let u2 = await hn(a);
40851
40850
  u2 && (i2 = await this.fetchWithRetry(u2, s));
40852
40851
  }
40853
- await lt(o);
40852
+ await dt(o);
40854
40853
  }
40855
40854
  return this.parseResponse(i2, "POST", t);
40856
40855
  }
@@ -40861,19 +40860,19 @@ var pn = class extends Te {
40861
40860
  try {
40862
40861
  o.resolve(await this.request(o.method, this.fhirBaseUrl + o.url, o.options));
40863
40862
  } catch (s) {
40864
- o.reject(new p(_e(s)));
40863
+ o.reject(new f(_e(s)));
40865
40864
  }
40866
40865
  return;
40867
40866
  }
40868
40867
  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
40868
  for (let o = 0; o < t.length; o++) {
40870
40869
  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);
40870
+ a?.response?.outcome && !Et(a.response.outcome) ? s.reject(new f(a.response.outcome)) : s.resolve(a?.resource);
40872
40871
  }
40873
40872
  }
40874
40873
  addFetchOptionsDefaults(t) {
40875
40874
  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");
40875
+ n || (n = {}, t.headers = n), n.Accept || (n.Accept = Eo), 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
40876
  }
40878
40877
  setRequestContentType(t, n) {
40879
40878
  t.headers || (t.headers = {});
@@ -40887,11 +40886,11 @@ var pn = class extends Te {
40887
40886
  return this.refresh() ? this.request(t, n, i2) : (this.clearActiveLogin(), this.onUnauthenticated && this.onUnauthenticated(), Promise.reject(new Error("Unauthenticated")));
40888
40887
  }
40889
40888
  async startPkce() {
40890
- let t = Ut();
40889
+ let t = Bt();
40891
40890
  sessionStorage.setItem("pkceState", t);
40892
- let n = Ut();
40891
+ let n = Bt();
40893
40892
  sessionStorage.setItem("codeVerifier", n);
40894
- let i2 = await en(n), o = ur(i2).replaceAll("+", "-").replaceAll("/", "_").replaceAll("=", "");
40893
+ let i2 = await en(n), o = lr(i2).replaceAll("+", "-").replaceAll("/", "_").replaceAll("=", "");
40895
40894
  return sessionStorage.setItem("codeChallenge", o), { codeChallengeMethod: "S256", codeChallenge: o };
40896
40895
  }
40897
40896
  async requestAuthorization(t) {
@@ -40935,26 +40934,26 @@ var pn = class extends Te {
40935
40934
  }
40936
40935
  async fhircastSubscribe(t, n) {
40937
40936
  if (!(typeof t == "string" && t !== ""))
40938
- throw new p(h("Invalid topic provided. Topic must be a valid string."));
40937
+ throw new f(h("Invalid topic provided. Topic must be a valid string."));
40939
40938
  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"];
40939
+ throw new f(h("Invalid events provided. Events must be an array of event names containing at least one event."));
40940
+ let i2 = { channelType: "websocket", mode: "subscribe", topic: t, events: n }, s = (await this.post("/fhircast/STU3", $t(i2), V.FORM_URL_ENCODED))["hub.channel.endpoint"];
40942
40941
  if (!s)
40943
40942
  throw new Error("Invalid response!");
40944
40943
  return i2.endpoint = s, i2;
40945
40944
  }
40946
40945
  async fhircastUnsubscribe(t) {
40947
- if (!tt(t))
40948
- throw new p(h("Invalid topic or subscriptionRequest. SubscriptionRequest must be an object."));
40946
+ if (!nt(t))
40947
+ throw new f(h("Invalid topic or subscriptionRequest. SubscriptionRequest must be an object."));
40949
40948
  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);
40949
+ throw new f(h("Provided subscription request must have an endpoint in order to unsubscribe."));
40950
+ t.mode = "unsubscribe", await this.post("/fhircast/STU3", $t(t), V.FORM_URL_ENCODED);
40952
40951
  }
40953
40952
  fhircastConnect(t) {
40954
- return new et(t);
40953
+ return new rt(t);
40955
40954
  }
40956
40955
  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));
40956
+ return nn(n) ? this.post(`/fhircast/STU3/${t}`, Qt(t, n, i2, o), V.JSON) : (on(n), this.post(`/fhircast/STU3/${t}`, Qt(t, n, i2), V.JSON));
40958
40957
  }
40959
40958
  async fhircastGetContext(t) {
40960
40959
  return this.get(`/fhircast/STU3/${t}`);
@@ -40963,16 +40962,16 @@ var pn = class extends Te {
40963
40962
  return this.post("admin/projects/" + t + "/invite", n);
40964
40963
  }
40965
40964
  async fetchTokens(t) {
40966
- let n = { method: "POST", headers: { "Content-Type": O.FORM_URL_ENCODED }, body: t.toString(), credentials: "include" }, i2 = n.headers;
40965
+ let n = { method: "POST", headers: { "Content-Type": V.FORM_URL_ENCODED }, body: t.toString(), credentials: "include" }, i2 = n.headers;
40967
40966
  this.basicAuth && (i2.Authorization = `Basic ${this.basicAuth}`);
40968
40967
  let o = await this.fetchWithRetry(this.tokenUrl, n);
40969
40968
  if (!o.ok) {
40970
40969
  this.clearActiveLogin();
40971
40970
  try {
40972
40971
  let a = await o.json();
40973
- throw new p(I(a.error_description));
40972
+ throw new f(v(a.error_description));
40974
40973
  } catch (a) {
40975
- throw new p(I("Failed to fetch tokens"), a);
40974
+ throw new f(v("Failed to fetch tokens"), a);
40976
40975
  }
40977
40976
  }
40978
40977
  let s = await o.json();
@@ -40981,7 +40980,7 @@ var pn = class extends Te {
40981
40980
  async verifyTokens(t) {
40982
40981
  let n = t.access_token;
40983
40982
  if (an(n)) {
40984
- let i2 = Qt(n);
40983
+ let i2 = Ht(n);
40985
40984
  if (Date.now() >= i2.exp * 1e3)
40986
40985
  throw this.clearActiveLogin(), new Error("Token expired");
40987
40986
  if (i2.cid) {
@@ -41005,7 +41004,7 @@ var pn = class extends Te {
41005
41004
  throw i2;
41006
41005
  }
41007
41006
  };
41008
- function Co() {
41007
+ function ko() {
41009
41008
  if (!globalThis.fetch)
41010
41009
  throw new Error("Fetch not available in this environment");
41011
41010
  return globalThis.fetch.bind(globalThis);
@@ -41016,7 +41015,7 @@ function fn() {
41016
41015
  function mn(r4) {
41017
41016
  return r4.endsWith("/") ? r4 : r4 + "/";
41018
41017
  }
41019
- function rt(r4, e) {
41018
+ function it(r4, e) {
41020
41019
  return new URL(e, r4).toString();
41021
41020
  }
41022
41021
  async function hn(r4) {
@@ -41027,18 +41026,18 @@ async function hn(r4) {
41027
41026
  if (t)
41028
41027
  return t;
41029
41028
  let n = await r4.json();
41030
- if (Fe(n) && n.issue?.[0]?.diagnostics)
41029
+ if (ie(n) && n.issue?.[0]?.diagnostics)
41031
41030
  return n.issue[0].diagnostics;
41032
41031
  }
41033
- function yn(r4) {
41032
+ function gn(r4) {
41034
41033
  let e = r4.entry?.map((t) => t.resource) ?? [];
41035
41034
  return Object.assign(e, { bundle: r4 });
41036
41035
  }
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 {
41036
+ var Fo = [...ye, "->", "<<", ">>", "=="];
41037
+ var Lo = xe().registerInfix("->", { precedence: m.Arrow }).registerInfix(";", { precedence: m.Semicolon });
41038
+ var Xo = [...ye, "eq", "ne", "co"];
41039
+ var ts = xe();
41040
+ var z = class {
41042
41041
  constructor(e = "\r", t = "|", n = "^", i2 = "~", o = "\\", s = "&") {
41043
41042
  this.segmentSeparator = e;
41044
41043
  this.fieldSeparator = t;
@@ -41054,8 +41053,8 @@ var W = class {
41054
41053
  return this.componentSeparator + this.repetitionSeparator + this.escapeCharacter + this.subcomponentSeparator;
41055
41054
  }
41056
41055
  };
41057
- var An = class r {
41058
- constructor(e, t = new W()) {
41056
+ var In = class r {
41057
+ constructor(e, t = new z()) {
41059
41058
  this.context = t, this.segments = e;
41060
41059
  }
41061
41060
  get header() {
@@ -41078,7 +41077,7 @@ var An = class r {
41078
41077
  }
41079
41078
  buildAck() {
41080
41079
  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)]);
41080
+ return new r([new be(["MSH", this.context.getMsh2(), o, s, n, i2, ns(e), "", this.buildAckMessageType(t), e.getTime().toString(), "P", u2], this.context), new be(["MSA", "AA", a, "OK"], this.context)]);
41082
41081
  }
41083
41082
  buildAckMessageType(e) {
41084
41083
  let t = e?.getField(9), n = t?.getComponent(2), i2 = t?.getComponent(3), o = "ACK";
@@ -41089,13 +41088,13 @@ var An = class r {
41089
41088
  let n = new Error("Invalid HL7 message");
41090
41089
  throw n.type = "entity.parse.failed", n;
41091
41090
  }
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);
41091
+ let t = new z("\r", e.charAt(3), e.charAt(4), e.charAt(5), e.charAt(6), e.charAt(7));
41092
+ return new r(e.split(/[\r\n]+/).map((n) => be.parse(n, t)), t);
41094
41093
  }
41095
41094
  };
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];
41095
+ var be = class r2 {
41096
+ constructor(e, t = new z()) {
41097
+ this.context = t, ar(e) ? this.fields = e.map((n) => de.parse(n, t)) : this.fields = e, this.name = this.fields[0].components[0][0];
41099
41098
  }
41100
41099
  get(e) {
41101
41100
  return this.fields[e];
@@ -41103,9 +41102,9 @@ var Se = class r2 {
41103
41102
  getField(e) {
41104
41103
  if (this.name === "MSH") {
41105
41104
  if (e === 1)
41106
- return new le([[this.context.getMsh1()]], this.context);
41105
+ return new de([[this.context.getMsh1()]], this.context);
41107
41106
  if (e === 2)
41108
- return new le([[this.context.getMsh2()]], this.context);
41107
+ return new de([[this.context.getMsh2()]], this.context);
41109
41108
  if (e > 2)
41110
41109
  return this.fields[e - 1];
41111
41110
  }
@@ -41117,12 +41116,12 @@ var Se = class r2 {
41117
41116
  toString() {
41118
41117
  return this.fields.map((e) => e.toString()).join(this.context.fieldSeparator);
41119
41118
  }
41120
- static parse(e, t = new W()) {
41121
- return new r2(e.split(t.fieldSeparator).map((n) => le.parse(n, t)), t);
41119
+ static parse(e, t = new z()) {
41120
+ return new r2(e.split(t.fieldSeparator).map((n) => de.parse(n, t)), t);
41122
41121
  }
41123
41122
  };
41124
- var le = class r3 {
41125
- constructor(e, t = new W()) {
41123
+ var de = class r3 {
41124
+ constructor(e, t = new z()) {
41126
41125
  this.context = t, this.components = e;
41127
41126
  }
41128
41127
  get(e, t, n = 0) {
@@ -41135,11 +41134,11 @@ var le = class r3 {
41135
41134
  toString() {
41136
41135
  return this.components.map((e) => e.join(this.context.componentSeparator)).join(this.context.repetitionSeparator);
41137
41136
  }
41138
- static parse(e, t = new W()) {
41137
+ static parse(e, t = new z()) {
41139
41138
  return new r3(e.split(t.repetitionSeparator).map((n) => n.split(t.componentSeparator)), t);
41140
41139
  }
41141
41140
  };
41142
- function Qo(r4) {
41141
+ function ns(r4) {
41143
41142
  let e = r4 instanceof Date ? r4 : new Date(r4), n = e.toISOString().replace(/[-:T]/g, "").replace(/(\.\d+)?Z$/, ""), i2 = e.getUTCMilliseconds();
41144
41143
  return i2 > 0 && (n += "." + i2.toString()), n;
41145
41144
  }
@@ -41159,7 +41158,7 @@ var i = class extends EventTarget {
41159
41158
  }
41160
41159
  };
41161
41160
  var m2 = "\v";
41162
- var p2 = "";
41161
+ var p = "";
41163
41162
  var v2 = "\r";
41164
41163
  var d2 = class extends Event {
41165
41164
  constructor(e, t) {
@@ -41182,8 +41181,8 @@ var c2 = class extends i {
41182
41181
  let o = "";
41183
41182
  e.on("data", (s) => {
41184
41183
  try {
41185
- if (o += s.toString(), o.endsWith(p2 + v2)) {
41186
- let r4 = An.parse(o.substring(1, o.length - 2));
41184
+ if (o += s.toString(), o.endsWith(p + v2)) {
41185
+ let r4 = In.parse(o.substring(1, o.length - 2));
41187
41186
  this.dispatchEvent(new d2(this, r4)), o = "";
41188
41187
  }
41189
41188
  } catch (r4) {
@@ -41194,7 +41193,7 @@ var c2 = class extends i {
41194
41193
  });
41195
41194
  }
41196
41195
  send(e) {
41197
- this.socket.write(m2 + e.toString() + p2 + v2);
41196
+ this.socket.write(m2 + e.toString() + p + v2);
41198
41197
  }
41199
41198
  async sendAndWait(e) {
41200
41199
  let t = new Promise((o) => {
@@ -41231,7 +41230,7 @@ var h2 = class extends i {
41231
41230
  this.connection && (this.connection.close(), delete this.connection);
41232
41231
  }
41233
41232
  };
41234
- var E2 = class {
41233
+ var E = class {
41235
41234
  constructor(n) {
41236
41235
  this.handler = n;
41237
41236
  }
@@ -41289,8 +41288,8 @@ var DcmjsDimseScp = class extends dimse.Scp {
41289
41288
  associationRequested(association) {
41290
41289
  association.setMaxPduLength(65536);
41291
41290
  association.getPresentationContexts().forEach(({ context }) => {
41292
- context.getTransferSyntaxUids().forEach((ts) => {
41293
- context.setResult(dimse.constants.PresentationContextResult.Accept, ts);
41291
+ context.getTransferSyntaxUids().forEach((ts2) => {
41292
+ context.setResult(dimse.constants.PresentationContextResult.Accept, ts2);
41294
41293
  });
41295
41294
  });
41296
41295
  this.sendAssociationAccept();
@@ -41323,11 +41322,11 @@ var DcmjsDimseScp = class extends dimse.Scp {
41323
41322
  accessToken: App.instance.medplum.getAccessToken(),
41324
41323
  channel: AgentDicomChannel.instance.definition.name,
41325
41324
  remote: "foo",
41326
- contentType: O.JSON,
41325
+ contentType: V.JSON,
41327
41326
  body: JSON.stringify(request.getDataset())
41328
41327
  });
41329
41328
  } catch (err) {
41330
- App.instance.log.error(`DICOM error: ${li(err)}`);
41329
+ App.instance.log.error(`DICOM error: ${fi(err)}`);
41331
41330
  }
41332
41331
  const response = dimse.responses.CStoreResponse.fromRequest(request);
41333
41332
  response.setStatus(dimse.constants.Status.Success);
@@ -41342,7 +41341,7 @@ var AgentHl7Channel = class {
41342
41341
  this.definition = definition;
41343
41342
  this.endpoint = endpoint;
41344
41343
  this.connections = /* @__PURE__ */ new Map();
41345
- this.server = new E2((connection) => this.handleNewConnection(connection));
41344
+ this.server = new E((connection) => this.handleNewConnection(connection));
41346
41345
  }
41347
41346
  start() {
41348
41347
  const address = new URL(this.endpoint.address);
@@ -41359,7 +41358,7 @@ var AgentHl7Channel = class {
41359
41358
  sendToRemote(msg) {
41360
41359
  const connection = this.connections.get(msg.remote);
41361
41360
  if (connection) {
41362
- connection.hl7Connection.send(An.parse(msg.body));
41361
+ connection.hl7Connection.send(In.parse(msg.body));
41363
41362
  }
41364
41363
  }
41365
41364
  handleNewConnection(connection) {
@@ -41384,11 +41383,11 @@ var AgentHl7ChannelConnection = class {
41384
41383
  accessToken: this.channel.app.medplum.getAccessToken(),
41385
41384
  channel: this.channel.definition.name,
41386
41385
  remote: this.remote,
41387
- contentType: O.HL7_V2,
41386
+ contentType: V.HL7_V2,
41388
41387
  body: event.message.toString()
41389
41388
  });
41390
41389
  } catch (err) {
41391
- this.channel.app.log.error(`HL7 error: ${li(err)}`);
41390
+ this.channel.app.log.error(`HL7 error: ${fi(err)}`);
41392
41391
  }
41393
41392
  }
41394
41393
  close() {
@@ -41405,26 +41404,41 @@ var App = class _App {
41405
41404
  this.channels = /* @__PURE__ */ new Map();
41406
41405
  this.hl7Queue = [];
41407
41406
  this.live = false;
41407
+ this.shutdown = false;
41408
41408
  _App.instance = this;
41409
41409
  this.log = {
41410
41410
  info: console.log,
41411
41411
  warn: console.warn,
41412
41412
  error: console.error
41413
41413
  };
41414
- const webSocketUrl = new URL(medplum.getBaseUrl());
41414
+ this.connectWebSocket();
41415
+ }
41416
+ connectWebSocket() {
41417
+ const webSocketUrl = new URL(this.medplum.getBaseUrl());
41415
41418
  webSocketUrl.protocol = webSocketUrl.protocol === "https:" ? "wss:" : "ws:";
41416
41419
  webSocketUrl.pathname = "/ws/agent";
41417
41420
  this.log.info(`Connecting to WebSocket: ${webSocketUrl.href}`);
41418
41421
  this.webSocket = new wrapper_default(webSocketUrl);
41419
41422
  this.webSocket.binaryType = "nodebuffer";
41420
- this.webSocket.addEventListener("error", (err) => this.log.error(err.message));
41423
+ this.webSocket.addEventListener("error", (err) => {
41424
+ if (!this.shutdown) {
41425
+ this.log.error(fi(err.error));
41426
+ }
41427
+ });
41421
41428
  this.webSocket.addEventListener("open", () => {
41422
41429
  this.sendToWebSocket({
41423
41430
  type: "agent:connect:request",
41424
- accessToken: medplum.getAccessToken(),
41425
- agentId
41431
+ accessToken: this.medplum.getAccessToken(),
41432
+ agentId: this.agentId
41426
41433
  });
41427
41434
  });
41435
+ this.webSocket.addEventListener("close", () => {
41436
+ if (!this.shutdown) {
41437
+ this.live = false;
41438
+ this.log.info("WebSocket closed");
41439
+ setTimeout(() => this.connectWebSocket(), 1e3);
41440
+ }
41441
+ });
41428
41442
  this.webSocket.addEventListener("message", (e) => {
41429
41443
  try {
41430
41444
  const data = e.data;
@@ -41452,7 +41466,7 @@ var App = class _App {
41452
41466
  this.log.error(`Unknown message type: ${command.type}`);
41453
41467
  }
41454
41468
  } catch (err) {
41455
- this.log.error(`WebSocket error: ${li(err)}`);
41469
+ this.log.error(`WebSocket error: ${fi(err)}`);
41456
41470
  }
41457
41471
  });
41458
41472
  }
@@ -41480,7 +41494,12 @@ var App = class _App {
41480
41494
  }
41481
41495
  stop() {
41482
41496
  this.log.info("Medplum service stopping...");
41497
+ this.shutdown = true;
41483
41498
  this.channels.forEach((channel) => channel.stop());
41499
+ if (this.webSocket) {
41500
+ this.webSocket.close();
41501
+ this.webSocket = void 0;
41502
+ }
41484
41503
  this.log.info("Medplum service stopped successfully");
41485
41504
  }
41486
41505
  addToWebSocketQueue(message) {
@@ -41513,6 +41532,9 @@ var App = class _App {
41513
41532
  }
41514
41533
  }
41515
41534
  sendToWebSocket(message) {
41535
+ if (!this.webSocket) {
41536
+ throw new Error("WebSocket not connected");
41537
+ }
41516
41538
  this.webSocket.send(JSON.stringify(message));
41517
41539
  }
41518
41540
  pushMessage(message) {
@@ -41525,18 +41547,18 @@ var App = class _App {
41525
41547
  host: address.hostname,
41526
41548
  port: parseInt(address.port, 10)
41527
41549
  });
41528
- client.sendAndWait(An.parse(message.body)).then((response) => {
41550
+ client.sendAndWait(In.parse(message.body)).then((response) => {
41529
41551
  this.log.info(`Response: ${response.toString().replaceAll("\r", "\n")}`);
41530
41552
  this.addToWebSocketQueue({
41531
41553
  type: "agent:transmit:response",
41532
41554
  channel: message.channel,
41533
41555
  remote: message.remote,
41534
41556
  callback: message.callback,
41535
- contentType: O.HL7_V2,
41557
+ contentType: V.HL7_V2,
41536
41558
  body: response.toString()
41537
41559
  });
41538
41560
  }).catch((err) => {
41539
- this.log.error(`HL7 error: ${li(err)}`);
41561
+ this.log.error(`HL7 error: ${fi(err)}`);
41540
41562
  }).finally(() => {
41541
41563
  client.close();
41542
41564
  });
@@ -41574,10 +41596,11 @@ async function main(argv) {
41574
41596
  const app = new App(medplum, agentId);
41575
41597
  await app.start();
41576
41598
  process.on("SIGINT", () => {
41577
- console.log("\ngracefully shutting down from SIGINT (Crtl-C)");
41599
+ console.log("Gracefully shutting down from SIGINT (Crtl-C)");
41578
41600
  app.stop();
41579
41601
  process.exit();
41580
41602
  });
41603
+ return app;
41581
41604
  }
41582
41605
  function readCommandLineArgs(argv) {
41583
41606
  const [_node, _script, baseUrl, clientId, clientSecret, agentId] = argv;