@medplum/agent 3.0.2 → 3.0.3

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 +946 -884
  2. package/package.json +1 -1
@@ -4319,11 +4319,11 @@ var require_dcmjs = __commonJS({
4319
4319
  s.bi_valid += length2;
4320
4320
  }
4321
4321
  };
4322
- const send_code = (s, c3, tree) => {
4322
+ const send_code = (s, c2, tree) => {
4323
4323
  send_bits(
4324
4324
  s,
4325
- tree[c3 * 2],
4326
- tree[c3 * 2 + 1]
4325
+ tree[c2 * 2],
4326
+ tree[c2 * 2 + 1]
4327
4327
  /*.Len*/
4328
4328
  );
4329
4329
  };
@@ -4359,7 +4359,7 @@ var require_dcmjs = __commonJS({
4359
4359
  let n, m3;
4360
4360
  let bits;
4361
4361
  let xbits;
4362
- let f;
4362
+ let f2;
4363
4363
  let overflow = 0;
4364
4364
  for (bits = 0; bits <= MAX_BITS$1; bits++) {
4365
4365
  s.bl_count[bits] = 0;
@@ -4381,10 +4381,10 @@ var require_dcmjs = __commonJS({
4381
4381
  if (n >= base) {
4382
4382
  xbits = extra[n - base];
4383
4383
  }
4384
- f = tree[n * 2];
4385
- s.opt_len += f * (bits + xbits);
4384
+ f2 = tree[n * 2];
4385
+ s.opt_len += f2 * (bits + xbits);
4386
4386
  if (has_stree) {
4387
- s.static_len += f * (stree[n * 2 + 1] + xbits);
4387
+ s.static_len += f2 * (stree[n * 2 + 1] + xbits);
4388
4388
  }
4389
4389
  }
4390
4390
  if (overflow === 0) {
@@ -4888,13 +4888,13 @@ var require_dcmjs = __commonJS({
4888
4888
  };
4889
4889
  var adler32_1 = adler32;
4890
4890
  const makeTable = () => {
4891
- let c3, table = [];
4891
+ let c2, table = [];
4892
4892
  for (var n = 0; n < 256; n++) {
4893
- c3 = n;
4893
+ c2 = n;
4894
4894
  for (var k2 = 0; k2 < 8; k2++) {
4895
- c3 = c3 & 1 ? 3988292384 ^ c3 >>> 1 : c3 >>> 1;
4895
+ c2 = c2 & 1 ? 3988292384 ^ c2 >>> 1 : c2 >>> 1;
4896
4896
  }
4897
- table[n] = c3;
4897
+ table[n] = c2;
4898
4898
  }
4899
4899
  return table;
4900
4900
  };
@@ -5020,8 +5020,8 @@ var require_dcmjs = __commonJS({
5020
5020
  strm.msg = messages[errorCode];
5021
5021
  return errorCode;
5022
5022
  };
5023
- const rank = (f) => {
5024
- return (f << 1) - (f > 4 ? 9 : 0);
5023
+ const rank = (f2) => {
5024
+ return (f2 << 1) - (f2 > 4 ? 9 : 0);
5025
5025
  };
5026
5026
  const zero$2 = (buf) => {
5027
5027
  let len2 = buf.length;
@@ -5055,12 +5055,12 @@ var require_dcmjs = __commonJS({
5055
5055
  s.block_start = s.strstart;
5056
5056
  flush_pending(s.strm);
5057
5057
  };
5058
- const put_byte = (s, b2) => {
5059
- s.pending_buf[s.pending++] = b2;
5058
+ const put_byte = (s, b) => {
5059
+ s.pending_buf[s.pending++] = b;
5060
5060
  };
5061
- const putShortMSB = (s, b2) => {
5062
- s.pending_buf[s.pending++] = b2 >>> 8 & 255;
5063
- s.pending_buf[s.pending++] = b2 & 255;
5061
+ const putShortMSB = (s, b) => {
5062
+ s.pending_buf[s.pending++] = b >>> 8 & 255;
5063
+ s.pending_buf[s.pending++] = b & 255;
5064
5064
  };
5065
5065
  const read_buf = (strm, buf, start, size) => {
5066
5066
  let len2 = strm.avail_in;
@@ -6064,42 +6064,42 @@ var require_dcmjs = __commonJS({
6064
6064
  if (typeof TextEncoder === "function" && TextEncoder.prototype.encode) {
6065
6065
  return new TextEncoder().encode(str2);
6066
6066
  }
6067
- let buf, c3, c22, m_pos, i2, str_len = str2.length, buf_len = 0;
6067
+ let buf, c2, c22, m_pos, i2, str_len = str2.length, buf_len = 0;
6068
6068
  for (m_pos = 0; m_pos < str_len; m_pos++) {
6069
- c3 = str2.charCodeAt(m_pos);
6070
- if ((c3 & 64512) === 55296 && m_pos + 1 < str_len) {
6069
+ c2 = str2.charCodeAt(m_pos);
6070
+ if ((c2 & 64512) === 55296 && m_pos + 1 < str_len) {
6071
6071
  c22 = str2.charCodeAt(m_pos + 1);
6072
6072
  if ((c22 & 64512) === 56320) {
6073
- c3 = 65536 + (c3 - 55296 << 10) + (c22 - 56320);
6073
+ c2 = 65536 + (c2 - 55296 << 10) + (c22 - 56320);
6074
6074
  m_pos++;
6075
6075
  }
6076
6076
  }
6077
- buf_len += c3 < 128 ? 1 : c3 < 2048 ? 2 : c3 < 65536 ? 3 : 4;
6077
+ buf_len += c2 < 128 ? 1 : c2 < 2048 ? 2 : c2 < 65536 ? 3 : 4;
6078
6078
  }
6079
6079
  buf = new Uint8Array(buf_len);
6080
6080
  for (i2 = 0, m_pos = 0; i2 < buf_len; m_pos++) {
6081
- c3 = str2.charCodeAt(m_pos);
6082
- if ((c3 & 64512) === 55296 && m_pos + 1 < str_len) {
6081
+ c2 = str2.charCodeAt(m_pos);
6082
+ if ((c2 & 64512) === 55296 && m_pos + 1 < str_len) {
6083
6083
  c22 = str2.charCodeAt(m_pos + 1);
6084
6084
  if ((c22 & 64512) === 56320) {
6085
- c3 = 65536 + (c3 - 55296 << 10) + (c22 - 56320);
6085
+ c2 = 65536 + (c2 - 55296 << 10) + (c22 - 56320);
6086
6086
  m_pos++;
6087
6087
  }
6088
6088
  }
6089
- if (c3 < 128) {
6090
- buf[i2++] = c3;
6091
- } else if (c3 < 2048) {
6092
- buf[i2++] = 192 | c3 >>> 6;
6093
- buf[i2++] = 128 | c3 & 63;
6094
- } else if (c3 < 65536) {
6095
- buf[i2++] = 224 | c3 >>> 12;
6096
- buf[i2++] = 128 | c3 >>> 6 & 63;
6097
- buf[i2++] = 128 | c3 & 63;
6089
+ if (c2 < 128) {
6090
+ buf[i2++] = c2;
6091
+ } else if (c2 < 2048) {
6092
+ buf[i2++] = 192 | c2 >>> 6;
6093
+ buf[i2++] = 128 | c2 & 63;
6094
+ } else if (c2 < 65536) {
6095
+ buf[i2++] = 224 | c2 >>> 12;
6096
+ buf[i2++] = 128 | c2 >>> 6 & 63;
6097
+ buf[i2++] = 128 | c2 & 63;
6098
6098
  } else {
6099
- buf[i2++] = 240 | c3 >>> 18;
6100
- buf[i2++] = 128 | c3 >>> 12 & 63;
6101
- buf[i2++] = 128 | c3 >>> 6 & 63;
6102
- buf[i2++] = 128 | c3 & 63;
6099
+ buf[i2++] = 240 | c2 >>> 18;
6100
+ buf[i2++] = 128 | c2 >>> 12 & 63;
6101
+ buf[i2++] = 128 | c2 >>> 6 & 63;
6102
+ buf[i2++] = 128 | c2 & 63;
6103
6103
  }
6104
6104
  }
6105
6105
  return buf;
@@ -6124,32 +6124,32 @@ var require_dcmjs = __commonJS({
6124
6124
  let i2, out;
6125
6125
  const utf16buf = new Array(len2 * 2);
6126
6126
  for (out = 0, i2 = 0; i2 < len2; ) {
6127
- let c3 = buf[i2++];
6128
- if (c3 < 128) {
6129
- utf16buf[out++] = c3;
6127
+ let c2 = buf[i2++];
6128
+ if (c2 < 128) {
6129
+ utf16buf[out++] = c2;
6130
6130
  continue;
6131
6131
  }
6132
- let c_len = _utf8len[c3];
6132
+ let c_len = _utf8len[c2];
6133
6133
  if (c_len > 4) {
6134
6134
  utf16buf[out++] = 65533;
6135
6135
  i2 += c_len - 1;
6136
6136
  continue;
6137
6137
  }
6138
- c3 &= c_len === 2 ? 31 : c_len === 3 ? 15 : 7;
6138
+ c2 &= c_len === 2 ? 31 : c_len === 3 ? 15 : 7;
6139
6139
  while (c_len > 1 && i2 < len2) {
6140
- c3 = c3 << 6 | buf[i2++] & 63;
6140
+ c2 = c2 << 6 | buf[i2++] & 63;
6141
6141
  c_len--;
6142
6142
  }
6143
6143
  if (c_len > 1) {
6144
6144
  utf16buf[out++] = 65533;
6145
6145
  continue;
6146
6146
  }
6147
- if (c3 < 65536) {
6148
- utf16buf[out++] = c3;
6147
+ if (c2 < 65536) {
6148
+ utf16buf[out++] = c2;
6149
6149
  } else {
6150
- c3 -= 65536;
6151
- utf16buf[out++] = 55296 | c3 >> 10 & 1023;
6152
- utf16buf[out++] = 56320 | c3 & 1023;
6150
+ c2 -= 65536;
6151
+ utf16buf[out++] = 55296 | c2 >> 10 & 1023;
6152
+ utf16buf[out++] = 56320 | c2 & 1023;
6153
6153
  }
6154
6154
  }
6155
6155
  return buf2binstring(utf16buf, out);
@@ -11126,9 +11126,9 @@ var require_dcmjs = __commonJS({
11126
11126
  key: "rgb2XYZ",
11127
11127
  value: function rgb2XYZ(rgb) {
11128
11128
  var R2 = Colors2.invGammaCorrection(rgb[0]);
11129
- var G2 = Colors2.invGammaCorrection(rgb[1]);
11129
+ var G = Colors2.invGammaCorrection(rgb[1]);
11130
11130
  var B2 = Colors2.invGammaCorrection(rgb[2]);
11131
- 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];
11131
+ return [0.41239558896741424 * R2 + 0.3575834307637148 * G + 0.18049264738170157 * B2, 0.21258623078559555 * R2 + 0.7151703037034108 * G + 0.07220049864333623 * B2, 0.019297215491746945 * R2 + 0.11918386458084854 * G + 0.9504971251315798 * B2];
11132
11132
  }
11133
11133
  }, {
11134
11134
  key: "xyz2LAB",
@@ -11152,9 +11152,9 @@ var require_dcmjs = __commonJS({
11152
11152
  value: function lab2XYZ(lab) {
11153
11153
  var L2 = (lab[0] + 16) / 116;
11154
11154
  var a = L2 + lab[1] / 500;
11155
- var b2 = L2 - lab[2] / 200;
11155
+ var b = L2 - lab[2] / 200;
11156
11156
  var whitePoint = Colors2.d65WhitePointXYZ();
11157
- return [whitePoint[0] * Colors2.labfInv(a), whitePoint[1] * Colors2.labfInv(L2), whitePoint[2] * Colors2.labfInv(b2)];
11157
+ return [whitePoint[0] * Colors2.labfInv(a), whitePoint[1] * Colors2.labfInv(L2), whitePoint[2] * Colors2.labfInv(b)];
11158
11158
  }
11159
11159
  }, {
11160
11160
  key: "xyz2RGB",
@@ -11465,8 +11465,8 @@ var require_dcmjs = __commonJS({
11465
11465
  var distance2 = ImageNormalizer2.vec3Dot(positionVector, scanAxis);
11466
11466
  distanceDatasetPairs.push([distance2, dataset]);
11467
11467
  });
11468
- distanceDatasetPairs.sort(function(a, b2) {
11469
- return b2[0] - a[0];
11468
+ distanceDatasetPairs.sort(function(a, b) {
11469
+ return b[0] - a[0];
11470
11470
  });
11471
11471
  if (ds.BitsAllocated !== 16) {
11472
11472
  log.error("Only works with 16 bit data, not " + String(this.dataset.BitsAllocated));
@@ -11655,8 +11655,8 @@ var require_dcmjs = __commonJS({
11655
11655
  }
11656
11656
  }], [{
11657
11657
  key: "vec3CrossProduct",
11658
- value: function vec3CrossProduct(a, b2) {
11659
- var ax = a[0], ay = a[1], az = a[2], bx = b2[0], by = b2[1], bz = b2[2];
11658
+ value: function vec3CrossProduct(a, b) {
11659
+ var ax = a[0], ay = a[1], az = a[2], bx = b[0], by = b[1], bz = b[2];
11660
11660
  var out = [];
11661
11661
  out[0] = ay * bz - az * by;
11662
11662
  out[1] = az * bx - ax * bz;
@@ -11665,17 +11665,17 @@ var require_dcmjs = __commonJS({
11665
11665
  }
11666
11666
  }, {
11667
11667
  key: "vec3Subtract",
11668
- value: function vec3Subtract(a, b2) {
11668
+ value: function vec3Subtract(a, b) {
11669
11669
  var out = [];
11670
- out[0] = a[0] - b2[0];
11671
- out[1] = a[1] - b2[1];
11672
- out[2] = a[2] - b2[2];
11670
+ out[0] = a[0] - b[0];
11671
+ out[1] = a[1] - b[1];
11672
+ out[2] = a[2] - b[2];
11673
11673
  return out;
11674
11674
  }
11675
11675
  }, {
11676
11676
  key: "vec3Dot",
11677
- value: function vec3Dot(a, b2) {
11678
- return a[0] * b2[0] + a[1] * b2[1] + a[2] * b2[2];
11677
+ value: function vec3Dot(a, b) {
11678
+ return a[0] * b[0] + a[1] * b[1] + a[2] * b[2];
11679
11679
  }
11680
11680
  }]);
11681
11681
  return ImageNormalizer2;
@@ -13712,8 +13712,8 @@ var require_dcmjs = __commonJS({
13712
13712
  var iota = iota_1;
13713
13713
  var isBuffer = isBuffer_1;
13714
13714
  var hasTypedArrays = typeof Float64Array !== "undefined";
13715
- function compare1st(a, b2) {
13716
- return a[0] - b2[0];
13715
+ function compare1st(a, b) {
13716
+ return a[0] - b[0];
13717
13717
  }
13718
13718
  function order() {
13719
13719
  var stride = this.stride;
@@ -13932,17 +13932,17 @@ var require_dcmjs = __commonJS({
13932
13932
  if (shape === void 0) {
13933
13933
  shape = [data3.length];
13934
13934
  }
13935
- var d3 = shape.length;
13935
+ var d2 = shape.length;
13936
13936
  if (stride === void 0) {
13937
- stride = new Array(d3);
13938
- for (var i2 = d3 - 1, sz = 1; i2 >= 0; --i2) {
13937
+ stride = new Array(d2);
13938
+ for (var i2 = d2 - 1, sz = 1; i2 >= 0; --i2) {
13939
13939
  stride[i2] = sz;
13940
13940
  sz *= shape[i2];
13941
13941
  }
13942
13942
  }
13943
13943
  if (offset === void 0) {
13944
13944
  offset = 0;
13945
- for (var i2 = 0; i2 < d3; ++i2) {
13945
+ for (var i2 = 0; i2 < d2; ++i2) {
13946
13946
  if (stride[i2] < 0) {
13947
13947
  offset -= (shape[i2] - 1) * stride[i2];
13948
13948
  }
@@ -13950,16 +13950,16 @@ var require_dcmjs = __commonJS({
13950
13950
  }
13951
13951
  var dtype = arrayDType(data3);
13952
13952
  var ctor_list = CACHED_CONSTRUCTORS[dtype];
13953
- while (ctor_list.length <= d3 + 1) {
13953
+ while (ctor_list.length <= d2 + 1) {
13954
13954
  ctor_list.push(compileConstructor(dtype, ctor_list.length - 1));
13955
13955
  }
13956
- var ctor = ctor_list[d3 + 1];
13956
+ var ctor = ctor_list[d2 + 1];
13957
13957
  return ctor(data3, shape, stride, offset);
13958
13958
  }
13959
13959
  var ndarray = wrappedNDArrayCtor;
13960
13960
  var ndarray$1 = /* @__PURE__ */ getDefaultExportFromCjs(ndarray);
13961
- function crossProduct3D(a, b2) {
13962
- return [a[1] * b2[2] - a[2] * b2[1], a[2] * b2[0] - a[0] * b2[2], a[0] * b2[1] - a[1] * b2[0]];
13961
+ function crossProduct3D(a, b) {
13962
+ return [a[1] * b[2] - a[2] * b[1], a[2] * b[0] - a[0] * b[2], a[0] * b[1] - a[1] * b[0]];
13963
13963
  }
13964
13964
  var flipImageOrientationPatient = {
13965
13965
  /**
@@ -14002,10 +14002,10 @@ var require_dcmjs = __commonJS({
14002
14002
  }
14003
14003
  function rotateDirectionCosinesInPlane(iop, theta) {
14004
14004
  var r4 = [iop[0], iop[1], iop[2]];
14005
- var c3 = [iop[3], iop[4], iop[5]];
14006
- var rxc = crossProduct3D(r4, c3);
14005
+ var c2 = [iop[3], iop[4], iop[5]];
14006
+ var rxc = crossProduct3D(r4, c2);
14007
14007
  var rRot = rotateVectorAroundUnitVector(r4, rxc, theta);
14008
- var cRot = rotateVectorAroundUnitVector(c3, rxc, theta);
14008
+ var cRot = rotateVectorAroundUnitVector(c2, rxc, theta);
14009
14009
  return [].concat(_toConsumableArray(rRot), _toConsumableArray(cRot));
14010
14010
  }
14011
14011
  var flipMatrix2D = {
@@ -14043,13 +14043,13 @@ var require_dcmjs = __commonJS({
14043
14043
  }
14044
14044
  return result;
14045
14045
  }
14046
- function nearlyEqual(a, b2, epsilon) {
14046
+ function nearlyEqual(a, b, epsilon) {
14047
14047
  var absA = Math.abs(a);
14048
- var absB = Math.abs(b2);
14049
- var diff = Math.abs(a - b2);
14050
- if (a === b2) {
14048
+ var absB = Math.abs(b);
14049
+ var diff = Math.abs(a - b);
14050
+ if (a === b) {
14051
14051
  return true;
14052
- } else if (a === 0 || b2 === 0 || absA + absB < epsilon * epsilon) {
14052
+ } else if (a === 0 || b === 0 || absA + absB < epsilon * epsilon) {
14053
14053
  return diff < epsilon;
14054
14054
  } else {
14055
14055
  return diff / Math.min(absA + absB, Number.MAX_VALUE) < epsilon;
@@ -14396,28 +14396,28 @@ var require_dcmjs = __commonJS({
14396
14396
  out[2] = z2;
14397
14397
  return out;
14398
14398
  }
14399
- function add(out, a, b2) {
14400
- out[0] = a[0] + b2[0];
14401
- out[1] = a[1] + b2[1];
14402
- out[2] = a[2] + b2[2];
14399
+ function add(out, a, b) {
14400
+ out[0] = a[0] + b[0];
14401
+ out[1] = a[1] + b[1];
14402
+ out[2] = a[2] + b[2];
14403
14403
  return out;
14404
14404
  }
14405
- function subtract$1(out, a, b2) {
14406
- out[0] = a[0] - b2[0];
14407
- out[1] = a[1] - b2[1];
14408
- out[2] = a[2] - b2[2];
14405
+ function subtract$1(out, a, b) {
14406
+ out[0] = a[0] - b[0];
14407
+ out[1] = a[1] - b[1];
14408
+ out[2] = a[2] - b[2];
14409
14409
  return out;
14410
14410
  }
14411
- function multiply(out, a, b2) {
14412
- out[0] = a[0] * b2[0];
14413
- out[1] = a[1] * b2[1];
14414
- out[2] = a[2] * b2[2];
14411
+ function multiply(out, a, b) {
14412
+ out[0] = a[0] * b[0];
14413
+ out[1] = a[1] * b[1];
14414
+ out[2] = a[2] * b[2];
14415
14415
  return out;
14416
14416
  }
14417
- function divide(out, a, b2) {
14418
- out[0] = a[0] / b2[0];
14419
- out[1] = a[1] / b2[1];
14420
- out[2] = a[2] / b2[2];
14417
+ function divide(out, a, b) {
14418
+ out[0] = a[0] / b[0];
14419
+ out[1] = a[1] / b[1];
14420
+ out[2] = a[2] / b[2];
14421
14421
  return out;
14422
14422
  }
14423
14423
  function ceil(out, a) {
@@ -14432,16 +14432,16 @@ var require_dcmjs = __commonJS({
14432
14432
  out[2] = Math.floor(a[2]);
14433
14433
  return out;
14434
14434
  }
14435
- function min(out, a, b2) {
14436
- out[0] = Math.min(a[0], b2[0]);
14437
- out[1] = Math.min(a[1], b2[1]);
14438
- out[2] = Math.min(a[2], b2[2]);
14435
+ function min(out, a, b) {
14436
+ out[0] = Math.min(a[0], b[0]);
14437
+ out[1] = Math.min(a[1], b[1]);
14438
+ out[2] = Math.min(a[2], b[2]);
14439
14439
  return out;
14440
14440
  }
14441
- function max(out, a, b2) {
14442
- out[0] = Math.max(a[0], b2[0]);
14443
- out[1] = Math.max(a[1], b2[1]);
14444
- out[2] = Math.max(a[2], b2[2]);
14441
+ function max(out, a, b) {
14442
+ out[0] = Math.max(a[0], b[0]);
14443
+ out[1] = Math.max(a[1], b[1]);
14444
+ out[2] = Math.max(a[2], b[2]);
14445
14445
  return out;
14446
14446
  }
14447
14447
  function round(out, a) {
@@ -14450,28 +14450,28 @@ var require_dcmjs = __commonJS({
14450
14450
  out[2] = Math.round(a[2]);
14451
14451
  return out;
14452
14452
  }
14453
- function scale(out, a, b2) {
14454
- out[0] = a[0] * b2;
14455
- out[1] = a[1] * b2;
14456
- out[2] = a[2] * b2;
14453
+ function scale(out, a, b) {
14454
+ out[0] = a[0] * b;
14455
+ out[1] = a[1] * b;
14456
+ out[2] = a[2] * b;
14457
14457
  return out;
14458
14458
  }
14459
- function scaleAndAdd(out, a, b2, scale2) {
14460
- out[0] = a[0] + b2[0] * scale2;
14461
- out[1] = a[1] + b2[1] * scale2;
14462
- out[2] = a[2] + b2[2] * scale2;
14459
+ function scaleAndAdd(out, a, b, scale2) {
14460
+ out[0] = a[0] + b[0] * scale2;
14461
+ out[1] = a[1] + b[1] * scale2;
14462
+ out[2] = a[2] + b[2] * scale2;
14463
14463
  return out;
14464
14464
  }
14465
- function distance(a, b2) {
14466
- var x = b2[0] - a[0];
14467
- var y = b2[1] - a[1];
14468
- var z2 = b2[2] - a[2];
14465
+ function distance(a, b) {
14466
+ var x = b[0] - a[0];
14467
+ var y = b[1] - a[1];
14468
+ var z2 = b[2] - a[2];
14469
14469
  return Math.hypot(x, y, z2);
14470
14470
  }
14471
- function squaredDistance(a, b2) {
14472
- var x = b2[0] - a[0];
14473
- var y = b2[1] - a[1];
14474
- var z2 = b2[2] - a[2];
14471
+ function squaredDistance(a, b) {
14472
+ var x = b[0] - a[0];
14473
+ var y = b[1] - a[1];
14474
+ var z2 = b[2] - a[2];
14475
14475
  return x * x + y * y + z2 * z2;
14476
14476
  }
14477
14477
  function squaredLength(a) {
@@ -14505,38 +14505,38 @@ var require_dcmjs = __commonJS({
14505
14505
  out[2] = a[2] * len2;
14506
14506
  return out;
14507
14507
  }
14508
- function dot(a, b2) {
14509
- return a[0] * b2[0] + a[1] * b2[1] + a[2] * b2[2];
14508
+ function dot(a, b) {
14509
+ return a[0] * b[0] + a[1] * b[1] + a[2] * b[2];
14510
14510
  }
14511
- function cross$1(out, a, b2) {
14511
+ function cross$1(out, a, b) {
14512
14512
  var ax = a[0], ay = a[1], az = a[2];
14513
- var bx = b2[0], by = b2[1], bz = b2[2];
14513
+ var bx = b[0], by = b[1], bz = b[2];
14514
14514
  out[0] = ay * bz - az * by;
14515
14515
  out[1] = az * bx - ax * bz;
14516
14516
  out[2] = ax * by - ay * bx;
14517
14517
  return out;
14518
14518
  }
14519
- function lerp(out, a, b2, t) {
14519
+ function lerp(out, a, b, t) {
14520
14520
  var ax = a[0];
14521
14521
  var ay = a[1];
14522
14522
  var az = a[2];
14523
- out[0] = ax + t * (b2[0] - ax);
14524
- out[1] = ay + t * (b2[1] - ay);
14525
- out[2] = az + t * (b2[2] - az);
14523
+ out[0] = ax + t * (b[0] - ax);
14524
+ out[1] = ay + t * (b[1] - ay);
14525
+ out[2] = az + t * (b[2] - az);
14526
14526
  return out;
14527
14527
  }
14528
- function hermite(out, a, b2, c3, d3, t) {
14528
+ function hermite(out, a, b, c2, d2, t) {
14529
14529
  var factorTimes2 = t * t;
14530
14530
  var factor1 = factorTimes2 * (2 * t - 3) + 1;
14531
14531
  var factor2 = factorTimes2 * (t - 2) + t;
14532
14532
  var factor3 = factorTimes2 * (t - 1);
14533
14533
  var factor4 = factorTimes2 * (3 - 2 * t);
14534
- out[0] = a[0] * factor1 + b2[0] * factor2 + c3[0] * factor3 + d3[0] * factor4;
14535
- out[1] = a[1] * factor1 + b2[1] * factor2 + c3[1] * factor3 + d3[1] * factor4;
14536
- out[2] = a[2] * factor1 + b2[2] * factor2 + c3[2] * factor3 + d3[2] * factor4;
14534
+ out[0] = a[0] * factor1 + b[0] * factor2 + c2[0] * factor3 + d2[0] * factor4;
14535
+ out[1] = a[1] * factor1 + b[1] * factor2 + c2[1] * factor3 + d2[1] * factor4;
14536
+ out[2] = a[2] * factor1 + b[2] * factor2 + c2[2] * factor3 + d2[2] * factor4;
14537
14537
  return out;
14538
14538
  }
14539
- function bezier(out, a, b2, c3, d3, t) {
14539
+ function bezier(out, a, b, c2, d2, t) {
14540
14540
  var inverseFactor = 1 - t;
14541
14541
  var inverseFactorTimesTwo = inverseFactor * inverseFactor;
14542
14542
  var factorTimes2 = t * t;
@@ -14544,9 +14544,9 @@ var require_dcmjs = __commonJS({
14544
14544
  var factor2 = 3 * t * inverseFactorTimesTwo;
14545
14545
  var factor3 = 3 * factorTimes2 * inverseFactor;
14546
14546
  var factor4 = factorTimes2 * t;
14547
- out[0] = a[0] * factor1 + b2[0] * factor2 + c3[0] * factor3 + d3[0] * factor4;
14548
- out[1] = a[1] * factor1 + b2[1] * factor2 + c3[1] * factor3 + d3[1] * factor4;
14549
- out[2] = a[2] * factor1 + b2[2] * factor2 + c3[2] * factor3 + d3[2] * factor4;
14547
+ out[0] = a[0] * factor1 + b[0] * factor2 + c2[0] * factor3 + d2[0] * factor4;
14548
+ out[1] = a[1] * factor1 + b[1] * factor2 + c2[1] * factor3 + d2[1] * factor4;
14549
+ out[2] = a[2] * factor1 + b[2] * factor2 + c2[2] * factor3 + d2[2] * factor4;
14550
14550
  return out;
14551
14551
  }
14552
14552
  function random(out, scale2) {
@@ -14592,47 +14592,47 @@ var require_dcmjs = __commonJS({
14592
14592
  out[2] = z2 + uvz + uuvz;
14593
14593
  return out;
14594
14594
  }
14595
- function rotateX(out, a, b2, rad) {
14595
+ function rotateX(out, a, b, rad) {
14596
14596
  var p3 = [], r4 = [];
14597
- p3[0] = a[0] - b2[0];
14598
- p3[1] = a[1] - b2[1];
14599
- p3[2] = a[2] - b2[2];
14597
+ p3[0] = a[0] - b[0];
14598
+ p3[1] = a[1] - b[1];
14599
+ p3[2] = a[2] - b[2];
14600
14600
  r4[0] = p3[0];
14601
14601
  r4[1] = p3[1] * Math.cos(rad) - p3[2] * Math.sin(rad);
14602
14602
  r4[2] = p3[1] * Math.sin(rad) + p3[2] * Math.cos(rad);
14603
- out[0] = r4[0] + b2[0];
14604
- out[1] = r4[1] + b2[1];
14605
- out[2] = r4[2] + b2[2];
14603
+ out[0] = r4[0] + b[0];
14604
+ out[1] = r4[1] + b[1];
14605
+ out[2] = r4[2] + b[2];
14606
14606
  return out;
14607
14607
  }
14608
- function rotateY(out, a, b2, rad) {
14608
+ function rotateY(out, a, b, rad) {
14609
14609
  var p3 = [], r4 = [];
14610
- p3[0] = a[0] - b2[0];
14611
- p3[1] = a[1] - b2[1];
14612
- p3[2] = a[2] - b2[2];
14610
+ p3[0] = a[0] - b[0];
14611
+ p3[1] = a[1] - b[1];
14612
+ p3[2] = a[2] - b[2];
14613
14613
  r4[0] = p3[2] * Math.sin(rad) + p3[0] * Math.cos(rad);
14614
14614
  r4[1] = p3[1];
14615
14615
  r4[2] = p3[2] * Math.cos(rad) - p3[0] * Math.sin(rad);
14616
- out[0] = r4[0] + b2[0];
14617
- out[1] = r4[1] + b2[1];
14618
- out[2] = r4[2] + b2[2];
14616
+ out[0] = r4[0] + b[0];
14617
+ out[1] = r4[1] + b[1];
14618
+ out[2] = r4[2] + b[2];
14619
14619
  return out;
14620
14620
  }
14621
- function rotateZ(out, a, b2, rad) {
14621
+ function rotateZ(out, a, b, rad) {
14622
14622
  var p3 = [], r4 = [];
14623
- p3[0] = a[0] - b2[0];
14624
- p3[1] = a[1] - b2[1];
14625
- p3[2] = a[2] - b2[2];
14623
+ p3[0] = a[0] - b[0];
14624
+ p3[1] = a[1] - b[1];
14625
+ p3[2] = a[2] - b[2];
14626
14626
  r4[0] = p3[0] * Math.cos(rad) - p3[1] * Math.sin(rad);
14627
14627
  r4[1] = p3[0] * Math.sin(rad) + p3[1] * Math.cos(rad);
14628
14628
  r4[2] = p3[2];
14629
- out[0] = r4[0] + b2[0];
14630
- out[1] = r4[1] + b2[1];
14631
- out[2] = r4[2] + b2[2];
14629
+ out[0] = r4[0] + b[0];
14630
+ out[1] = r4[1] + b[1];
14631
+ out[2] = r4[2] + b[2];
14632
14632
  return out;
14633
14633
  }
14634
- function angle(a, b2) {
14635
- var ax = a[0], ay = a[1], az = a[2], bx = b2[0], by = b2[1], bz = b2[2], mag1 = Math.sqrt(ax * ax + ay * ay + az * az), mag2 = Math.sqrt(bx * bx + by * by + bz * bz), mag = mag1 * mag2, cosine = mag && dot(a, b2) / mag;
14634
+ function angle(a, b) {
14635
+ var ax = a[0], ay = a[1], az = a[2], bx = b[0], by = b[1], bz = b[2], mag1 = Math.sqrt(ax * ax + ay * ay + az * az), mag2 = Math.sqrt(bx * bx + by * by + bz * bz), mag = mag1 * mag2, cosine = mag && dot(a, b) / mag;
14636
14636
  return Math.acos(Math.min(Math.max(cosine, -1), 1));
14637
14637
  }
14638
14638
  function zero(out) {
@@ -14644,13 +14644,13 @@ var require_dcmjs = __commonJS({
14644
14644
  function str(a) {
14645
14645
  return "vec3(" + a[0] + ", " + a[1] + ", " + a[2] + ")";
14646
14646
  }
14647
- function exactEquals(a, b2) {
14648
- return a[0] === b2[0] && a[1] === b2[1] && a[2] === b2[2];
14647
+ function exactEquals(a, b) {
14648
+ return a[0] === b[0] && a[1] === b[1] && a[2] === b[2];
14649
14649
  }
14650
- function equals(a, b2) {
14650
+ function equals(a, b) {
14651
14651
  var a0 = a[0], a1 = a[1], a2 = a[2];
14652
- var b0 = b2[0], b1 = b2[1], b22 = b2[2];
14653
- return Math.abs(a0 - b0) <= EPSILON$1 * Math.max(1, Math.abs(a0), Math.abs(b0)) && Math.abs(a1 - b1) <= EPSILON$1 * Math.max(1, Math.abs(a1), Math.abs(b1)) && Math.abs(a2 - b22) <= EPSILON$1 * Math.max(1, Math.abs(a2), Math.abs(b22));
14652
+ var b0 = b[0], b1 = b[1], b2 = b[2];
14653
+ return Math.abs(a0 - b0) <= EPSILON$1 * Math.max(1, Math.abs(a0), Math.abs(b0)) && Math.abs(a1 - b1) <= EPSILON$1 * Math.max(1, Math.abs(a1), Math.abs(b1)) && Math.abs(a2 - b2) <= EPSILON$1 * Math.max(1, Math.abs(a2), Math.abs(b2));
14654
14654
  }
14655
14655
  var sub = subtract$1;
14656
14656
  var mul = multiply;
@@ -17291,10 +17291,10 @@ var require_dcmjs = __commonJS({
17291
17291
  }
17292
17292
  return den;
17293
17293
  }
17294
- function subtract(a, b2, out) {
17295
- out[0] = a[0] - b2[0];
17296
- out[1] = a[1] - b2[1];
17297
- out[2] = a[2] - b2[2];
17294
+ function subtract(a, b, out) {
17295
+ out[0] = a[0] - b[0];
17296
+ out[1] = a[1] - b[1];
17297
+ out[2] = a[2] - b[2];
17298
17298
  }
17299
17299
  function geometryFromFunctionalGroups(dataset, PerFrameFunctionalGroups) {
17300
17300
  var geometry = {};
@@ -19922,8 +19922,8 @@ var require_dcmjs = __commonJS({
19922
19922
  });
19923
19923
  var groupItem = _this22[0];
19924
19924
  var wereReferencesProvided = [options.referencedRegions !== void 0, options.referencedVolume !== void 0, options.referencedSegmentation !== void 0];
19925
- var numReferences = wereReferencesProvided.reduce(function(a, b2) {
19926
- return a + b2;
19925
+ var numReferences = wereReferencesProvided.reduce(function(a, b) {
19926
+ return a + b;
19927
19927
  });
19928
19928
  if (numReferences === 0) {
19929
19929
  throw new Error("One of the following options must be provided: 'referencedRegions', 'referencedVolume', or 'referencedSegmentation'.");
@@ -19965,8 +19965,8 @@ var require_dcmjs = __commonJS({
19965
19965
  function PlanarROIMeasurementsAndQualitativeEvaluations2(options) {
19966
19966
  _classCallCheck(this, PlanarROIMeasurementsAndQualitativeEvaluations2);
19967
19967
  var wereReferencesProvided = [options.referencedRegion !== void 0, options.referencedSegmentation !== void 0];
19968
- var numReferences = wereReferencesProvided.reduce(function(a, b2) {
19969
- return a + b2;
19968
+ var numReferences = wereReferencesProvided.reduce(function(a, b) {
19969
+ return a + b;
19970
19970
  });
19971
19971
  if (numReferences === 0) {
19972
19972
  throw new Error("One of the following options must be provided: 'referencedRegion', 'referencedSegmentation'.");
@@ -20163,8 +20163,8 @@ var require_dcmjs = __commonJS({
20163
20163
  var imageLibraryItem = new ImageLibrary();
20164
20164
  (_item$ContentSequence3 = item.ContentSequence).push.apply(_item$ContentSequence3, _toConsumableArray(imageLibraryItem));
20165
20165
  var wereOptionsProvided = [options.imagingMeasurements !== void 0, options.derivedImagingMeasurements !== void 0, options.qualitativeEvaluations !== void 0];
20166
- var numOptionsProvided = wereOptionsProvided.reduce(function(a, b2) {
20167
- return a + b2;
20166
+ var numOptionsProvided = wereOptionsProvided.reduce(function(a, b) {
20167
+ return a + b;
20168
20168
  });
20169
20169
  if (numOptionsProvided > 1) {
20170
20170
  throw new Error("Only one of the following options should be provided: 'imagingMeasurements', 'derivedImagingMeasurement', 'qualitativeEvaluations'.");
@@ -23549,19 +23549,19 @@ var require_decorator = __commonJS({
23549
23549
  mergedObject[key] = (0, util_1.unique)([...(_a = o1 === null || o1 === void 0 ? void 0 : o1[key]) !== null && _a !== void 0 ? _a : [], ...(_b = o2 === null || o2 === void 0 ? void 0 : o2[key]) !== null && _b !== void 0 ? _b : []]);
23550
23550
  return mergedObject;
23551
23551
  };
23552
- var mergePropertyAndMethodDecorators = (d1, d22) => {
23552
+ var mergePropertyAndMethodDecorators = (d1, d2) => {
23553
23553
  var _a, _b, _c, _d;
23554
23554
  return {
23555
- property: mergeObjectsOfDecorators((_a = d1 === null || d1 === void 0 ? void 0 : d1.property) !== null && _a !== void 0 ? _a : {}, (_b = d22 === null || d22 === void 0 ? void 0 : d22.property) !== null && _b !== void 0 ? _b : {}),
23556
- method: mergeObjectsOfDecorators((_c = d1 === null || d1 === void 0 ? void 0 : d1.method) !== null && _c !== void 0 ? _c : {}, (_d = d22 === null || d22 === void 0 ? void 0 : d22.method) !== null && _d !== void 0 ? _d : {})
23555
+ property: mergeObjectsOfDecorators((_a = d1 === null || d1 === void 0 ? void 0 : d1.property) !== null && _a !== void 0 ? _a : {}, (_b = d2 === null || d2 === void 0 ? void 0 : d2.property) !== null && _b !== void 0 ? _b : {}),
23556
+ method: mergeObjectsOfDecorators((_c = d1 === null || d1 === void 0 ? void 0 : d1.method) !== null && _c !== void 0 ? _c : {}, (_d = d2 === null || d2 === void 0 ? void 0 : d2.method) !== null && _d !== void 0 ? _d : {})
23557
23557
  };
23558
23558
  };
23559
- var mergeDecorators = (d1, d22) => {
23559
+ var mergeDecorators = (d1, d2) => {
23560
23560
  var _a, _b, _c, _d, _e2, _f;
23561
23561
  return {
23562
- class: (0, util_1.unique)([...(_a = d1 === null || d1 === void 0 ? void 0 : d1.class) !== null && _a !== void 0 ? _a : [], ...(_b = d22 === null || d22 === void 0 ? void 0 : d22.class) !== null && _b !== void 0 ? _b : []]),
23563
- static: mergePropertyAndMethodDecorators((_c = d1 === null || d1 === void 0 ? void 0 : d1.static) !== null && _c !== void 0 ? _c : {}, (_d = d22 === null || d22 === void 0 ? void 0 : d22.static) !== null && _d !== void 0 ? _d : {}),
23564
- instance: mergePropertyAndMethodDecorators((_e2 = d1 === null || d1 === void 0 ? void 0 : d1.instance) !== null && _e2 !== void 0 ? _e2 : {}, (_f = d22 === null || d22 === void 0 ? void 0 : d22.instance) !== null && _f !== void 0 ? _f : {})
23562
+ class: (0, util_1.unique)([...(_a = d1 === null || d1 === void 0 ? void 0 : d1.class) !== null && _a !== void 0 ? _a : [], ...(_b = d2 === null || d2 === void 0 ? void 0 : d2.class) !== null && _b !== void 0 ? _b : []]),
23563
+ static: mergePropertyAndMethodDecorators((_c = d1 === null || d1 === void 0 ? void 0 : d1.static) !== null && _c !== void 0 ? _c : {}, (_d = d2 === null || d2 === void 0 ? void 0 : d2.static) !== null && _d !== void 0 ? _d : {}),
23564
+ instance: mergePropertyAndMethodDecorators((_e2 = d1 === null || d1 === void 0 ? void 0 : d1.instance) !== null && _e2 !== void 0 ? _e2 : {}, (_f = d2 === null || d2 === void 0 ? void 0 : d2.instance) !== null && _f !== void 0 ? _f : {})
23565
23565
  };
23566
23566
  };
23567
23567
  var decorators = /* @__PURE__ */ new Map();
@@ -23574,7 +23574,7 @@ var require_decorator = __commonJS({
23574
23574
  const protoChainClasses = (0, util_1.protoChain)(clazz.prototype).map((proto) => proto.constructor);
23575
23575
  const mixinClasses = (_a = (0, mixin_tracking_1.getMixinsForClass)(clazz)) !== null && _a !== void 0 ? _a : [];
23576
23576
  const potentiallyNewClasses = [...protoChainClasses, ...mixinClasses];
23577
- const newClasses = potentiallyNewClasses.filter((c3) => !allClasses.has(c3));
23577
+ const newClasses = potentiallyNewClasses.filter((c2) => !allClasses.has(c2));
23578
23578
  for (let newClass of newClasses)
23579
23579
  frontier.add(newClass);
23580
23580
  allClasses.add(clazz);
@@ -23589,7 +23589,7 @@ var require_decorator = __commonJS({
23589
23589
  return {};
23590
23590
  if (decoratorsForClassChain.length == 1)
23591
23591
  return decoratorsForClassChain[0];
23592
- return decoratorsForClassChain.reduce((d1, d22) => mergeDecorators(d1, d22));
23592
+ return decoratorsForClassChain.reduce((d1, d2) => mergeDecorators(d1, d2));
23593
23593
  };
23594
23594
  exports2.deepDecoratorSearch = deepDecoratorSearch;
23595
23595
  var directDecoratorSearch = (...classes) => {
@@ -23598,7 +23598,7 @@ var require_decorator = __commonJS({
23598
23598
  return {};
23599
23599
  if (classDecorators.length === 1)
23600
23600
  return classDecorators[0];
23601
- return classDecorators.reduce((d1, d22) => mergeDecorators(d1, d22));
23601
+ return classDecorators.reduce((d1, d2) => mergeDecorators(d1, d2));
23602
23602
  };
23603
23603
  exports2.directDecoratorSearch = directDecoratorSearch;
23604
23604
  var getDecoratorsForClass = (clazz) => {
@@ -24006,14 +24006,14 @@ var require_trap = __commonJS({
24006
24006
  y: ["\xA5", "\u04B0", "\u04CB"],
24007
24007
  z: ["\u01B5", "\u0240"]
24008
24008
  };
24009
- text.forEach(function(c3) {
24010
- c3 = c3.toLowerCase();
24011
- var chars = trap[c3] || [" "];
24009
+ text.forEach(function(c2) {
24010
+ c2 = c2.toLowerCase();
24011
+ var chars = trap[c2] || [" "];
24012
24012
  var rand = Math.floor(Math.random() * chars.length);
24013
- if (typeof trap[c3] !== "undefined") {
24014
- result += trap[c3][rand];
24013
+ if (typeof trap[c2] !== "undefined") {
24014
+ result += trap[c2][rand];
24015
24015
  } else {
24016
- result += c3;
24016
+ result += c2;
24017
24017
  }
24018
24018
  });
24019
24019
  return result;
@@ -24193,8 +24193,8 @@ var require_zalgo = __commonJS({
24193
24193
  break;
24194
24194
  }
24195
24195
  var arr = ["up", "mid", "down"];
24196
- for (var d3 in arr) {
24197
- var index = arr[d3];
24196
+ for (var d2 in arr) {
24197
+ var index = arr[d2];
24198
24198
  for (var i2 = 0; i2 <= counts[index]; i2++) {
24199
24199
  if (options2[index]) {
24200
24200
  result = result + soul[index][randomNumber(soul[index].length)];
@@ -25547,9 +25547,9 @@ var require_ms = __commonJS({
25547
25547
  var s = 1e3;
25548
25548
  var m3 = s * 60;
25549
25549
  var h3 = m3 * 60;
25550
- var d3 = h3 * 24;
25551
- var w2 = d3 * 7;
25552
- var y = d3 * 365.25;
25550
+ var d2 = h3 * 24;
25551
+ var w2 = d2 * 7;
25552
+ var y = d2 * 365.25;
25553
25553
  module2.exports = function(val, options) {
25554
25554
  options = options || {};
25555
25555
  var type = typeof val;
@@ -25589,7 +25589,7 @@ var require_ms = __commonJS({
25589
25589
  case "days":
25590
25590
  case "day":
25591
25591
  case "d":
25592
- return n * d3;
25592
+ return n * d2;
25593
25593
  case "hours":
25594
25594
  case "hour":
25595
25595
  case "hrs":
@@ -25620,8 +25620,8 @@ var require_ms = __commonJS({
25620
25620
  }
25621
25621
  function fmtShort(ms) {
25622
25622
  var msAbs = Math.abs(ms);
25623
- if (msAbs >= d3) {
25624
- return Math.round(ms / d3) + "d";
25623
+ if (msAbs >= d2) {
25624
+ return Math.round(ms / d2) + "d";
25625
25625
  }
25626
25626
  if (msAbs >= h3) {
25627
25627
  return Math.round(ms / h3) + "h";
@@ -25636,8 +25636,8 @@ var require_ms = __commonJS({
25636
25636
  }
25637
25637
  function fmtLong(ms) {
25638
25638
  var msAbs = Math.abs(ms);
25639
- if (msAbs >= d3) {
25640
- return plural(ms, msAbs, d3, "day");
25639
+ if (msAbs >= d2) {
25640
+ return plural(ms, msAbs, d2, "day");
25641
25641
  }
25642
25642
  if (msAbs >= h3) {
25643
25643
  return plural(ms, msAbs, h3, "hour");
@@ -26918,7 +26918,7 @@ var require_buffer_list = __commonJS({
26918
26918
  key: "_getString",
26919
26919
  value: function _getString(n) {
26920
26920
  var p3 = this.head;
26921
- var c3 = 1;
26921
+ var c2 = 1;
26922
26922
  var ret = p3.data;
26923
26923
  n -= ret.length;
26924
26924
  while (p3 = p3.next) {
@@ -26931,7 +26931,7 @@ var require_buffer_list = __commonJS({
26931
26931
  n -= nb;
26932
26932
  if (n === 0) {
26933
26933
  if (nb === str.length) {
26934
- ++c3;
26934
+ ++c2;
26935
26935
  if (p3.next)
26936
26936
  this.head = p3.next;
26937
26937
  else
@@ -26942,9 +26942,9 @@ var require_buffer_list = __commonJS({
26942
26942
  }
26943
26943
  break;
26944
26944
  }
26945
- ++c3;
26945
+ ++c2;
26946
26946
  }
26947
- this.length -= c3;
26947
+ this.length -= c2;
26948
26948
  return ret;
26949
26949
  }
26950
26950
  // Consumes a specified amount of bytes from the buffered data.
@@ -26953,7 +26953,7 @@ var require_buffer_list = __commonJS({
26953
26953
  value: function _getBuffer(n) {
26954
26954
  var ret = Buffer2.allocUnsafe(n);
26955
26955
  var p3 = this.head;
26956
- var c3 = 1;
26956
+ var c2 = 1;
26957
26957
  p3.data.copy(ret);
26958
26958
  n -= p3.data.length;
26959
26959
  while (p3 = p3.next) {
@@ -26963,7 +26963,7 @@ var require_buffer_list = __commonJS({
26963
26963
  n -= nb;
26964
26964
  if (n === 0) {
26965
26965
  if (nb === buf.length) {
26966
- ++c3;
26966
+ ++c2;
26967
26967
  if (p3.next)
26968
26968
  this.head = p3.next;
26969
26969
  else
@@ -26974,9 +26974,9 @@ var require_buffer_list = __commonJS({
26974
26974
  }
26975
26975
  break;
26976
26976
  }
26977
- ++c3;
26977
+ ++c2;
26978
26978
  }
26979
- this.length -= c3;
26979
+ this.length -= c2;
26980
26980
  return ret;
26981
26981
  }
26982
26982
  // Make sure the linked list only shows the minimal necessary information.
@@ -27261,8 +27261,8 @@ var require_string_decoder = __commonJS({
27261
27261
  if ((buf.length - i2) % 2 === 0) {
27262
27262
  var r4 = buf.toString("utf16le", i2);
27263
27263
  if (r4) {
27264
- var c3 = r4.charCodeAt(r4.length - 1);
27265
- if (c3 >= 55296 && c3 <= 56319) {
27264
+ var c2 = r4.charCodeAt(r4.length - 1);
27265
+ if (c2 >= 55296 && c2 <= 56319) {
27266
27266
  this.lastNeed = 2;
27267
27267
  this.lastTotal = 4;
27268
27268
  this.lastChar[0] = buf[buf.length - 2];
@@ -27883,11 +27883,11 @@ var require_stream_readable = __commonJS({
27883
27883
  state.reading = false;
27884
27884
  onEofChunk(stream, state);
27885
27885
  } else {
27886
- var er;
27886
+ var er2;
27887
27887
  if (!skipChunkCheck)
27888
- er = chunkInvalid(state, chunk);
27889
- if (er) {
27890
- errorOrDestroy(stream, er);
27888
+ er2 = chunkInvalid(state, chunk);
27889
+ if (er2) {
27890
+ errorOrDestroy(stream, er2);
27891
27891
  } else if (state.objectMode || chunk && chunk.length > 0) {
27892
27892
  if (typeof chunk !== "string" && !state.objectMode && Object.getPrototypeOf(chunk) !== Buffer2.prototype) {
27893
27893
  chunk = _uint8ArrayToBuffer(chunk);
@@ -27936,11 +27936,11 @@ var require_stream_readable = __commonJS({
27936
27936
  maybeReadMore(stream, state);
27937
27937
  }
27938
27938
  function chunkInvalid(state, chunk) {
27939
- var er;
27939
+ var er2;
27940
27940
  if (!_isUint8Array(chunk) && typeof chunk !== "string" && chunk !== void 0 && !state.objectMode) {
27941
- er = new ERR_INVALID_ARG_TYPE("chunk", ["string", "Buffer", "Uint8Array"], chunk);
27941
+ er2 = new ERR_INVALID_ARG_TYPE("chunk", ["string", "Buffer", "Uint8Array"], chunk);
27942
27942
  }
27943
- return er;
27943
+ return er2;
27944
27944
  }
27945
27945
  Readable.prototype.isPaused = function() {
27946
27946
  return this._readableState.flowing === false;
@@ -28189,12 +28189,12 @@ var require_stream_readable = __commonJS({
28189
28189
  src.pause();
28190
28190
  }
28191
28191
  }
28192
- function onerror(er) {
28193
- debug("onerror", er);
28192
+ function onerror(er2) {
28193
+ debug("onerror", er2);
28194
28194
  unpipe();
28195
28195
  dest.removeListener("error", onerror);
28196
28196
  if (EElistenerCount(dest, "error") === 0)
28197
- errorOrDestroy(dest, er);
28197
+ errorOrDestroy(dest, er2);
28198
28198
  }
28199
28199
  prependListener(dest, "error", onerror);
28200
28200
  function onclose() {
@@ -28688,8 +28688,8 @@ var require_stream_writable = __commonJS({
28688
28688
  this.corked = 0;
28689
28689
  this.sync = true;
28690
28690
  this.bufferProcessing = false;
28691
- this.onwrite = function(er) {
28692
- onwrite(stream, er);
28691
+ this.onwrite = function(er2) {
28692
+ onwrite(stream, er2);
28693
28693
  };
28694
28694
  this.writecb = null;
28695
28695
  this.writelen = 0;
@@ -28762,20 +28762,20 @@ var require_stream_writable = __commonJS({
28762
28762
  errorOrDestroy(this, new ERR_STREAM_CANNOT_PIPE());
28763
28763
  };
28764
28764
  function writeAfterEnd(stream, cb) {
28765
- var er = new ERR_STREAM_WRITE_AFTER_END();
28766
- errorOrDestroy(stream, er);
28767
- process.nextTick(cb, er);
28765
+ var er2 = new ERR_STREAM_WRITE_AFTER_END();
28766
+ errorOrDestroy(stream, er2);
28767
+ process.nextTick(cb, er2);
28768
28768
  }
28769
28769
  function validChunk(stream, state, chunk, cb) {
28770
- var er;
28770
+ var er2;
28771
28771
  if (chunk === null) {
28772
- er = new ERR_STREAM_NULL_VALUES();
28772
+ er2 = new ERR_STREAM_NULL_VALUES();
28773
28773
  } else if (typeof chunk !== "string" && !state.objectMode) {
28774
- er = new ERR_INVALID_ARG_TYPE("chunk", ["string", "Buffer"], chunk);
28774
+ er2 = new ERR_INVALID_ARG_TYPE("chunk", ["string", "Buffer"], chunk);
28775
28775
  }
28776
- if (er) {
28777
- errorOrDestroy(stream, er);
28778
- process.nextTick(cb, er);
28776
+ if (er2) {
28777
+ errorOrDestroy(stream, er2);
28778
+ process.nextTick(cb, er2);
28779
28779
  return false;
28780
28780
  }
28781
28781
  return true;
@@ -28895,17 +28895,17 @@ var require_stream_writable = __commonJS({
28895
28895
  stream._write(chunk, encoding, state.onwrite);
28896
28896
  state.sync = false;
28897
28897
  }
28898
- function onwriteError(stream, state, sync, er, cb) {
28898
+ function onwriteError(stream, state, sync, er2, cb) {
28899
28899
  --state.pendingcb;
28900
28900
  if (sync) {
28901
- process.nextTick(cb, er);
28901
+ process.nextTick(cb, er2);
28902
28902
  process.nextTick(finishMaybe, stream, state);
28903
28903
  stream._writableState.errorEmitted = true;
28904
- errorOrDestroy(stream, er);
28904
+ errorOrDestroy(stream, er2);
28905
28905
  } else {
28906
- cb(er);
28906
+ cb(er2);
28907
28907
  stream._writableState.errorEmitted = true;
28908
- errorOrDestroy(stream, er);
28908
+ errorOrDestroy(stream, er2);
28909
28909
  finishMaybe(stream, state);
28910
28910
  }
28911
28911
  }
@@ -28915,15 +28915,15 @@ var require_stream_writable = __commonJS({
28915
28915
  state.length -= state.writelen;
28916
28916
  state.writelen = 0;
28917
28917
  }
28918
- function onwrite(stream, er) {
28918
+ function onwrite(stream, er2) {
28919
28919
  var state = stream._writableState;
28920
28920
  var sync = state.sync;
28921
28921
  var cb = state.writecb;
28922
28922
  if (typeof cb !== "function")
28923
28923
  throw new ERR_MULTIPLE_CALLBACK();
28924
28924
  onwriteStateUpdate(state);
28925
- if (er)
28926
- onwriteError(stream, state, sync, er, cb);
28925
+ if (er2)
28926
+ onwriteError(stream, state, sync, er2, cb);
28927
28927
  else {
28928
28928
  var finished = needFinish(state) || stream.destroyed;
28929
28929
  if (!finished && !state.corked && !state.bufferProcessing && state.bufferedRequest) {
@@ -30148,7 +30148,7 @@ var require_buffer_list2 = __commonJS({
30148
30148
  key: "_getString",
30149
30149
  value: function _getString(n) {
30150
30150
  var p3 = this.head;
30151
- var c3 = 1;
30151
+ var c2 = 1;
30152
30152
  var ret = p3.data;
30153
30153
  n -= ret.length;
30154
30154
  while (p3 = p3.next) {
@@ -30161,7 +30161,7 @@ var require_buffer_list2 = __commonJS({
30161
30161
  n -= nb;
30162
30162
  if (n === 0) {
30163
30163
  if (nb === str.length) {
30164
- ++c3;
30164
+ ++c2;
30165
30165
  if (p3.next)
30166
30166
  this.head = p3.next;
30167
30167
  else
@@ -30172,9 +30172,9 @@ var require_buffer_list2 = __commonJS({
30172
30172
  }
30173
30173
  break;
30174
30174
  }
30175
- ++c3;
30175
+ ++c2;
30176
30176
  }
30177
- this.length -= c3;
30177
+ this.length -= c2;
30178
30178
  return ret;
30179
30179
  }
30180
30180
  // Consumes a specified amount of bytes from the buffered data.
@@ -30183,7 +30183,7 @@ var require_buffer_list2 = __commonJS({
30183
30183
  value: function _getBuffer(n) {
30184
30184
  var ret = Buffer2.allocUnsafe(n);
30185
30185
  var p3 = this.head;
30186
- var c3 = 1;
30186
+ var c2 = 1;
30187
30187
  p3.data.copy(ret);
30188
30188
  n -= p3.data.length;
30189
30189
  while (p3 = p3.next) {
@@ -30193,7 +30193,7 @@ var require_buffer_list2 = __commonJS({
30193
30193
  n -= nb;
30194
30194
  if (n === 0) {
30195
30195
  if (nb === buf.length) {
30196
- ++c3;
30196
+ ++c2;
30197
30197
  if (p3.next)
30198
30198
  this.head = p3.next;
30199
30199
  else
@@ -30204,9 +30204,9 @@ var require_buffer_list2 = __commonJS({
30204
30204
  }
30205
30205
  break;
30206
30206
  }
30207
- ++c3;
30207
+ ++c2;
30208
30208
  }
30209
- this.length -= c3;
30209
+ this.length -= c2;
30210
30210
  return ret;
30211
30211
  }
30212
30212
  // Make sure the linked list only shows the minimal necessary information.
@@ -30511,8 +30511,8 @@ var require_stream_writable2 = __commonJS({
30511
30511
  this.corked = 0;
30512
30512
  this.sync = true;
30513
30513
  this.bufferProcessing = false;
30514
- this.onwrite = function(er) {
30515
- onwrite(stream, er);
30514
+ this.onwrite = function(er2) {
30515
+ onwrite(stream, er2);
30516
30516
  };
30517
30517
  this.writecb = null;
30518
30518
  this.writelen = 0;
@@ -30585,20 +30585,20 @@ var require_stream_writable2 = __commonJS({
30585
30585
  errorOrDestroy(this, new ERR_STREAM_CANNOT_PIPE());
30586
30586
  };
30587
30587
  function writeAfterEnd(stream, cb) {
30588
- var er = new ERR_STREAM_WRITE_AFTER_END();
30589
- errorOrDestroy(stream, er);
30590
- process.nextTick(cb, er);
30588
+ var er2 = new ERR_STREAM_WRITE_AFTER_END();
30589
+ errorOrDestroy(stream, er2);
30590
+ process.nextTick(cb, er2);
30591
30591
  }
30592
30592
  function validChunk(stream, state, chunk, cb) {
30593
- var er;
30593
+ var er2;
30594
30594
  if (chunk === null) {
30595
- er = new ERR_STREAM_NULL_VALUES();
30595
+ er2 = new ERR_STREAM_NULL_VALUES();
30596
30596
  } else if (typeof chunk !== "string" && !state.objectMode) {
30597
- er = new ERR_INVALID_ARG_TYPE("chunk", ["string", "Buffer"], chunk);
30597
+ er2 = new ERR_INVALID_ARG_TYPE("chunk", ["string", "Buffer"], chunk);
30598
30598
  }
30599
- if (er) {
30600
- errorOrDestroy(stream, er);
30601
- process.nextTick(cb, er);
30599
+ if (er2) {
30600
+ errorOrDestroy(stream, er2);
30601
+ process.nextTick(cb, er2);
30602
30602
  return false;
30603
30603
  }
30604
30604
  return true;
@@ -30718,17 +30718,17 @@ var require_stream_writable2 = __commonJS({
30718
30718
  stream._write(chunk, encoding, state.onwrite);
30719
30719
  state.sync = false;
30720
30720
  }
30721
- function onwriteError(stream, state, sync, er, cb) {
30721
+ function onwriteError(stream, state, sync, er2, cb) {
30722
30722
  --state.pendingcb;
30723
30723
  if (sync) {
30724
- process.nextTick(cb, er);
30724
+ process.nextTick(cb, er2);
30725
30725
  process.nextTick(finishMaybe, stream, state);
30726
30726
  stream._writableState.errorEmitted = true;
30727
- errorOrDestroy(stream, er);
30727
+ errorOrDestroy(stream, er2);
30728
30728
  } else {
30729
- cb(er);
30729
+ cb(er2);
30730
30730
  stream._writableState.errorEmitted = true;
30731
- errorOrDestroy(stream, er);
30731
+ errorOrDestroy(stream, er2);
30732
30732
  finishMaybe(stream, state);
30733
30733
  }
30734
30734
  }
@@ -30738,15 +30738,15 @@ var require_stream_writable2 = __commonJS({
30738
30738
  state.length -= state.writelen;
30739
30739
  state.writelen = 0;
30740
30740
  }
30741
- function onwrite(stream, er) {
30741
+ function onwrite(stream, er2) {
30742
30742
  var state = stream._writableState;
30743
30743
  var sync = state.sync;
30744
30744
  var cb = state.writecb;
30745
30745
  if (typeof cb !== "function")
30746
30746
  throw new ERR_MULTIPLE_CALLBACK();
30747
30747
  onwriteStateUpdate(state);
30748
- if (er)
30749
- onwriteError(stream, state, sync, er, cb);
30748
+ if (er2)
30749
+ onwriteError(stream, state, sync, er2, cb);
30750
30750
  else {
30751
30751
  var finished = needFinish(state) || stream.destroyed;
30752
30752
  if (!finished && !state.corked && !state.bufferProcessing && state.bufferedRequest) {
@@ -31612,11 +31612,11 @@ var require_stream_readable2 = __commonJS({
31612
31612
  state.reading = false;
31613
31613
  onEofChunk(stream, state);
31614
31614
  } else {
31615
- var er;
31615
+ var er2;
31616
31616
  if (!skipChunkCheck)
31617
- er = chunkInvalid(state, chunk);
31618
- if (er) {
31619
- errorOrDestroy(stream, er);
31617
+ er2 = chunkInvalid(state, chunk);
31618
+ if (er2) {
31619
+ errorOrDestroy(stream, er2);
31620
31620
  } else if (state.objectMode || chunk && chunk.length > 0) {
31621
31621
  if (typeof chunk !== "string" && !state.objectMode && Object.getPrototypeOf(chunk) !== Buffer2.prototype) {
31622
31622
  chunk = _uint8ArrayToBuffer(chunk);
@@ -31665,11 +31665,11 @@ var require_stream_readable2 = __commonJS({
31665
31665
  maybeReadMore(stream, state);
31666
31666
  }
31667
31667
  function chunkInvalid(state, chunk) {
31668
- var er;
31668
+ var er2;
31669
31669
  if (!_isUint8Array(chunk) && typeof chunk !== "string" && chunk !== void 0 && !state.objectMode) {
31670
- er = new ERR_INVALID_ARG_TYPE("chunk", ["string", "Buffer", "Uint8Array"], chunk);
31670
+ er2 = new ERR_INVALID_ARG_TYPE("chunk", ["string", "Buffer", "Uint8Array"], chunk);
31671
31671
  }
31672
- return er;
31672
+ return er2;
31673
31673
  }
31674
31674
  Readable.prototype.isPaused = function() {
31675
31675
  return this._readableState.flowing === false;
@@ -31918,12 +31918,12 @@ var require_stream_readable2 = __commonJS({
31918
31918
  src.pause();
31919
31919
  }
31920
31920
  }
31921
- function onerror(er) {
31922
- debug("onerror", er);
31921
+ function onerror(er2) {
31922
+ debug("onerror", er2);
31923
31923
  unpipe();
31924
31924
  dest.removeListener("error", onerror);
31925
31925
  if (EElistenerCount(dest, "error") === 0)
31926
- errorOrDestroy(dest, er);
31926
+ errorOrDestroy(dest, er2);
31927
31927
  }
31928
31928
  prependListener(dest, "error", onerror);
31929
31929
  function onclose() {
@@ -32263,7 +32263,7 @@ var require_stream_transform = __commonJS({
32263
32263
  var ERR_TRANSFORM_WITH_LENGTH_0 = _require$codes.ERR_TRANSFORM_WITH_LENGTH_0;
32264
32264
  var Duplex = require_stream_duplex2();
32265
32265
  require_inherits()(Transform, Duplex);
32266
- function afterTransform(er, data2) {
32266
+ function afterTransform(er2, data2) {
32267
32267
  var ts = this._transformState;
32268
32268
  ts.transforming = false;
32269
32269
  var cb = ts.writecb;
@@ -32274,7 +32274,7 @@ var require_stream_transform = __commonJS({
32274
32274
  ts.writecb = null;
32275
32275
  if (data2 != null)
32276
32276
  this.push(data2);
32277
- cb(er);
32277
+ cb(er2);
32278
32278
  var rs = this._readableState;
32279
32279
  rs.reading = false;
32280
32280
  if (rs.needReadable || rs.length < rs.highWaterMark) {
@@ -32306,8 +32306,8 @@ var require_stream_transform = __commonJS({
32306
32306
  function prefinish() {
32307
32307
  var _this = this;
32308
32308
  if (typeof this._flush === "function" && !this._readableState.destroyed) {
32309
- this._flush(function(er, data2) {
32310
- done(_this, er, data2);
32309
+ this._flush(function(er2, data2) {
32310
+ done(_this, er2, data2);
32311
32311
  });
32312
32312
  } else {
32313
32313
  done(this, null, null);
@@ -32345,9 +32345,9 @@ var require_stream_transform = __commonJS({
32345
32345
  cb(err2);
32346
32346
  });
32347
32347
  };
32348
- function done(stream, er, data2) {
32349
- if (er)
32350
- return stream.emit("error", er);
32348
+ function done(stream, er2, data2) {
32349
+ if (er2)
32350
+ return stream.emit("error", er2);
32351
32351
  if (data2 != null)
32352
32352
  stream.push(data2);
32353
32353
  if (stream._writableState.length)
@@ -32953,9 +32953,9 @@ var require_color_string = __commonJS({
32953
32953
  var alpha = parseFloat(match[4]);
32954
32954
  var h3 = (parseFloat(match[1]) % 360 + 360) % 360;
32955
32955
  var w2 = clamp(parseFloat(match[2]), 0, 100);
32956
- var b2 = clamp(parseFloat(match[3]), 0, 100);
32956
+ var b = clamp(parseFloat(match[3]), 0, 100);
32957
32957
  var a = clamp(isNaN(alpha) ? 1 : alpha, 0, 1);
32958
- return [h3, w2, b2, a];
32958
+ return [h3, w2, b, a];
32959
32959
  }
32960
32960
  return null;
32961
32961
  };
@@ -32971,8 +32971,8 @@ var require_color_string = __commonJS({
32971
32971
  var rgba = swizzle(arguments);
32972
32972
  var r4 = Math.round(rgba[0] / 255 * 100);
32973
32973
  var g3 = Math.round(rgba[1] / 255 * 100);
32974
- var b2 = Math.round(rgba[2] / 255 * 100);
32975
- return rgba.length < 4 || rgba[3] === 1 ? "rgb(" + r4 + "%, " + g3 + "%, " + b2 + "%)" : "rgba(" + r4 + "%, " + g3 + "%, " + b2 + "%, " + rgba[3] + ")";
32974
+ var b = Math.round(rgba[2] / 255 * 100);
32975
+ return rgba.length < 4 || rgba[3] === 1 ? "rgb(" + r4 + "%, " + g3 + "%, " + b + "%)" : "rgba(" + r4 + "%, " + g3 + "%, " + b + "%, " + rgba[3] + ")";
32976
32976
  };
32977
32977
  cs.to.hsl = function() {
32978
32978
  var hsla = swizzle(arguments);
@@ -33210,9 +33210,9 @@ var require_conversions = __commonJS({
33210
33210
  convert.rgb.hsl = function(rgb) {
33211
33211
  var r4 = rgb[0] / 255;
33212
33212
  var g3 = rgb[1] / 255;
33213
- var b2 = rgb[2] / 255;
33214
- var min = Math.min(r4, g3, b2);
33215
- var max = Math.max(r4, g3, b2);
33213
+ var b = rgb[2] / 255;
33214
+ var min = Math.min(r4, g3, b);
33215
+ var max = Math.max(r4, g3, b);
33216
33216
  var delta = max - min;
33217
33217
  var h3;
33218
33218
  var s;
@@ -33220,10 +33220,10 @@ var require_conversions = __commonJS({
33220
33220
  if (max === min) {
33221
33221
  h3 = 0;
33222
33222
  } else if (r4 === max) {
33223
- h3 = (g3 - b2) / delta;
33223
+ h3 = (g3 - b) / delta;
33224
33224
  } else if (g3 === max) {
33225
- h3 = 2 + (b2 - r4) / delta;
33226
- } else if (b2 === max) {
33225
+ h3 = 2 + (b - r4) / delta;
33226
+ } else if (b === max) {
33227
33227
  h3 = 4 + (r4 - g3) / delta;
33228
33228
  }
33229
33229
  h3 = Math.min(h3 * 60, 360);
@@ -33248,11 +33248,11 @@ var require_conversions = __commonJS({
33248
33248
  var s;
33249
33249
  var r4 = rgb[0] / 255;
33250
33250
  var g3 = rgb[1] / 255;
33251
- var b2 = rgb[2] / 255;
33252
- var v3 = Math.max(r4, g3, b2);
33253
- var diff = v3 - Math.min(r4, g3, b2);
33254
- var diffc = function(c3) {
33255
- return (v3 - c3) / 6 / diff + 1 / 2;
33251
+ var b = rgb[2] / 255;
33252
+ var v3 = Math.max(r4, g3, b);
33253
+ var diff = v3 - Math.min(r4, g3, b);
33254
+ var diffc = function(c2) {
33255
+ return (v3 - c2) / 6 / diff + 1 / 2;
33256
33256
  };
33257
33257
  if (diff === 0) {
33258
33258
  h3 = s = 0;
@@ -33260,12 +33260,12 @@ var require_conversions = __commonJS({
33260
33260
  s = diff / v3;
33261
33261
  rdif = diffc(r4);
33262
33262
  gdif = diffc(g3);
33263
- bdif = diffc(b2);
33263
+ bdif = diffc(b);
33264
33264
  if (r4 === v3) {
33265
33265
  h3 = bdif - gdif;
33266
33266
  } else if (g3 === v3) {
33267
33267
  h3 = 1 / 3 + rdif - bdif;
33268
- } else if (b2 === v3) {
33268
+ } else if (b === v3) {
33269
33269
  h3 = 2 / 3 + gdif - rdif;
33270
33270
  }
33271
33271
  if (h3 < 0) {
@@ -33283,25 +33283,25 @@ var require_conversions = __commonJS({
33283
33283
  convert.rgb.hwb = function(rgb) {
33284
33284
  var r4 = rgb[0];
33285
33285
  var g3 = rgb[1];
33286
- var b2 = rgb[2];
33286
+ var b = rgb[2];
33287
33287
  var h3 = convert.rgb.hsl(rgb)[0];
33288
- var w2 = 1 / 255 * Math.min(r4, Math.min(g3, b2));
33289
- b2 = 1 - 1 / 255 * Math.max(r4, Math.max(g3, b2));
33290
- return [h3, w2 * 100, b2 * 100];
33288
+ var w2 = 1 / 255 * Math.min(r4, Math.min(g3, b));
33289
+ b = 1 - 1 / 255 * Math.max(r4, Math.max(g3, b));
33290
+ return [h3, w2 * 100, b * 100];
33291
33291
  };
33292
33292
  convert.rgb.cmyk = function(rgb) {
33293
33293
  var r4 = rgb[0] / 255;
33294
33294
  var g3 = rgb[1] / 255;
33295
- var b2 = rgb[2] / 255;
33296
- var c3;
33295
+ var b = rgb[2] / 255;
33296
+ var c2;
33297
33297
  var m3;
33298
33298
  var y;
33299
33299
  var k2;
33300
- k2 = Math.min(1 - r4, 1 - g3, 1 - b2);
33301
- c3 = (1 - r4 - k2) / (1 - k2) || 0;
33300
+ k2 = Math.min(1 - r4, 1 - g3, 1 - b);
33301
+ c2 = (1 - r4 - k2) / (1 - k2) || 0;
33302
33302
  m3 = (1 - g3 - k2) / (1 - k2) || 0;
33303
- y = (1 - b2 - k2) / (1 - k2) || 0;
33304
- return [c3 * 100, m3 * 100, y * 100, k2 * 100];
33303
+ y = (1 - b - k2) / (1 - k2) || 0;
33304
+ return [c2 * 100, m3 * 100, y * 100, k2 * 100];
33305
33305
  };
33306
33306
  function comparativeDistance(x, y) {
33307
33307
  return Math.pow(x[0] - y[0], 2) + Math.pow(x[1] - y[1], 2) + Math.pow(x[2] - y[2], 2);
@@ -33331,13 +33331,13 @@ var require_conversions = __commonJS({
33331
33331
  convert.rgb.xyz = function(rgb) {
33332
33332
  var r4 = rgb[0] / 255;
33333
33333
  var g3 = rgb[1] / 255;
33334
- var b2 = rgb[2] / 255;
33334
+ var b = rgb[2] / 255;
33335
33335
  r4 = r4 > 0.04045 ? Math.pow((r4 + 0.055) / 1.055, 2.4) : r4 / 12.92;
33336
33336
  g3 = g3 > 0.04045 ? Math.pow((g3 + 0.055) / 1.055, 2.4) : g3 / 12.92;
33337
- b2 = b2 > 0.04045 ? Math.pow((b2 + 0.055) / 1.055, 2.4) : b2 / 12.92;
33338
- var x = r4 * 0.4124 + g3 * 0.3576 + b2 * 0.1805;
33339
- var y = r4 * 0.2126 + g3 * 0.7152 + b2 * 0.0722;
33340
- var z2 = r4 * 0.0193 + g3 * 0.1192 + b2 * 0.9505;
33337
+ b = b > 0.04045 ? Math.pow((b + 0.055) / 1.055, 2.4) : b / 12.92;
33338
+ var x = r4 * 0.4124 + g3 * 0.3576 + b * 0.1805;
33339
+ var y = r4 * 0.2126 + g3 * 0.7152 + b * 0.0722;
33340
+ var z2 = r4 * 0.0193 + g3 * 0.1192 + b * 0.9505;
33341
33341
  return [x * 100, y * 100, z2 * 100];
33342
33342
  };
33343
33343
  convert.rgb.lab = function(rgb) {
@@ -33347,7 +33347,7 @@ var require_conversions = __commonJS({
33347
33347
  var z2 = xyz[2];
33348
33348
  var l2;
33349
33349
  var a;
33350
- var b2;
33350
+ var b;
33351
33351
  x /= 95.047;
33352
33352
  y /= 100;
33353
33353
  z2 /= 108.883;
@@ -33356,8 +33356,8 @@ var require_conversions = __commonJS({
33356
33356
  z2 = z2 > 8856e-6 ? Math.pow(z2, 1 / 3) : 7.787 * z2 + 16 / 116;
33357
33357
  l2 = 116 * y - 16;
33358
33358
  a = 500 * (x - y);
33359
- b2 = 200 * (y - z2);
33360
- return [l2, a, b2];
33359
+ b = 200 * (y - z2);
33360
+ return [l2, a, b];
33361
33361
  };
33362
33362
  convert.hsl.rgb = function(hsl) {
33363
33363
  var h3 = hsl[0] / 360;
@@ -33420,10 +33420,10 @@ var require_conversions = __commonJS({
33420
33420
  var s = hsv[1] / 100;
33421
33421
  var v3 = hsv[2] / 100;
33422
33422
  var hi = Math.floor(h3) % 6;
33423
- var f = h3 - Math.floor(h3);
33423
+ var f2 = h3 - Math.floor(h3);
33424
33424
  var p3 = 255 * v3 * (1 - s);
33425
- var q = 255 * v3 * (1 - s * f);
33426
- var t = 255 * v3 * (1 - s * (1 - f));
33425
+ var q = 255 * v3 * (1 - s * f2);
33426
+ var t = 255 * v3 * (1 - s * (1 - f2));
33427
33427
  v3 *= 255;
33428
33428
  switch (hi) {
33429
33429
  case 0:
@@ -33463,7 +33463,7 @@ var require_conversions = __commonJS({
33463
33463
  var ratio = wh + bl;
33464
33464
  var i2;
33465
33465
  var v3;
33466
- var f;
33466
+ var f2;
33467
33467
  var n;
33468
33468
  if (ratio > 1) {
33469
33469
  wh /= ratio;
@@ -33471,62 +33471,62 @@ var require_conversions = __commonJS({
33471
33471
  }
33472
33472
  i2 = Math.floor(6 * h3);
33473
33473
  v3 = 1 - bl;
33474
- f = 6 * h3 - i2;
33474
+ f2 = 6 * h3 - i2;
33475
33475
  if ((i2 & 1) !== 0) {
33476
- f = 1 - f;
33476
+ f2 = 1 - f2;
33477
33477
  }
33478
- n = wh + f * (v3 - wh);
33478
+ n = wh + f2 * (v3 - wh);
33479
33479
  var r4;
33480
33480
  var g3;
33481
- var b2;
33481
+ var b;
33482
33482
  switch (i2) {
33483
33483
  default:
33484
33484
  case 6:
33485
33485
  case 0:
33486
33486
  r4 = v3;
33487
33487
  g3 = n;
33488
- b2 = wh;
33488
+ b = wh;
33489
33489
  break;
33490
33490
  case 1:
33491
33491
  r4 = n;
33492
33492
  g3 = v3;
33493
- b2 = wh;
33493
+ b = wh;
33494
33494
  break;
33495
33495
  case 2:
33496
33496
  r4 = wh;
33497
33497
  g3 = v3;
33498
- b2 = n;
33498
+ b = n;
33499
33499
  break;
33500
33500
  case 3:
33501
33501
  r4 = wh;
33502
33502
  g3 = n;
33503
- b2 = v3;
33503
+ b = v3;
33504
33504
  break;
33505
33505
  case 4:
33506
33506
  r4 = n;
33507
33507
  g3 = wh;
33508
- b2 = v3;
33508
+ b = v3;
33509
33509
  break;
33510
33510
  case 5:
33511
33511
  r4 = v3;
33512
33512
  g3 = wh;
33513
- b2 = n;
33513
+ b = n;
33514
33514
  break;
33515
33515
  }
33516
- return [r4 * 255, g3 * 255, b2 * 255];
33516
+ return [r4 * 255, g3 * 255, b * 255];
33517
33517
  };
33518
33518
  convert.cmyk.rgb = function(cmyk) {
33519
- var c3 = cmyk[0] / 100;
33519
+ var c2 = cmyk[0] / 100;
33520
33520
  var m3 = cmyk[1] / 100;
33521
33521
  var y = cmyk[2] / 100;
33522
33522
  var k2 = cmyk[3] / 100;
33523
33523
  var r4;
33524
33524
  var g3;
33525
- var b2;
33526
- r4 = 1 - Math.min(1, c3 * (1 - k2) + k2);
33525
+ var b;
33526
+ r4 = 1 - Math.min(1, c2 * (1 - k2) + k2);
33527
33527
  g3 = 1 - Math.min(1, m3 * (1 - k2) + k2);
33528
- b2 = 1 - Math.min(1, y * (1 - k2) + k2);
33529
- return [r4 * 255, g3 * 255, b2 * 255];
33528
+ b = 1 - Math.min(1, y * (1 - k2) + k2);
33529
+ return [r4 * 255, g3 * 255, b * 255];
33530
33530
  };
33531
33531
  convert.xyz.rgb = function(xyz) {
33532
33532
  var x = xyz[0] / 100;
@@ -33534,17 +33534,17 @@ var require_conversions = __commonJS({
33534
33534
  var z2 = xyz[2] / 100;
33535
33535
  var r4;
33536
33536
  var g3;
33537
- var b2;
33537
+ var b;
33538
33538
  r4 = x * 3.2406 + y * -1.5372 + z2 * -0.4986;
33539
33539
  g3 = x * -0.9689 + y * 1.8758 + z2 * 0.0415;
33540
- b2 = x * 0.0557 + y * -0.204 + z2 * 1.057;
33540
+ b = x * 0.0557 + y * -0.204 + z2 * 1.057;
33541
33541
  r4 = r4 > 31308e-7 ? 1.055 * Math.pow(r4, 1 / 2.4) - 0.055 : r4 * 12.92;
33542
33542
  g3 = g3 > 31308e-7 ? 1.055 * Math.pow(g3, 1 / 2.4) - 0.055 : g3 * 12.92;
33543
- b2 = b2 > 31308e-7 ? 1.055 * Math.pow(b2, 1 / 2.4) - 0.055 : b2 * 12.92;
33543
+ b = b > 31308e-7 ? 1.055 * Math.pow(b, 1 / 2.4) - 0.055 : b * 12.92;
33544
33544
  r4 = Math.min(Math.max(0, r4), 1);
33545
33545
  g3 = Math.min(Math.max(0, g3), 1);
33546
- b2 = Math.min(Math.max(0, b2), 1);
33547
- return [r4 * 255, g3 * 255, b2 * 255];
33546
+ b = Math.min(Math.max(0, b), 1);
33547
+ return [r4 * 255, g3 * 255, b * 255];
33548
33548
  };
33549
33549
  convert.xyz.lab = function(xyz) {
33550
33550
  var x = xyz[0];
@@ -33552,7 +33552,7 @@ var require_conversions = __commonJS({
33552
33552
  var z2 = xyz[2];
33553
33553
  var l2;
33554
33554
  var a;
33555
- var b2;
33555
+ var b;
33556
33556
  x /= 95.047;
33557
33557
  y /= 100;
33558
33558
  z2 /= 108.883;
@@ -33561,19 +33561,19 @@ var require_conversions = __commonJS({
33561
33561
  z2 = z2 > 8856e-6 ? Math.pow(z2, 1 / 3) : 7.787 * z2 + 16 / 116;
33562
33562
  l2 = 116 * y - 16;
33563
33563
  a = 500 * (x - y);
33564
- b2 = 200 * (y - z2);
33565
- return [l2, a, b2];
33564
+ b = 200 * (y - z2);
33565
+ return [l2, a, b];
33566
33566
  };
33567
33567
  convert.lab.xyz = function(lab) {
33568
33568
  var l2 = lab[0];
33569
33569
  var a = lab[1];
33570
- var b2 = lab[2];
33570
+ var b = lab[2];
33571
33571
  var x;
33572
33572
  var y;
33573
33573
  var z2;
33574
33574
  y = (l2 + 16) / 116;
33575
33575
  x = a / 500 + y;
33576
- z2 = y - b2 / 200;
33576
+ z2 = y - b / 200;
33577
33577
  var y2 = Math.pow(y, 3);
33578
33578
  var x2 = Math.pow(x, 3);
33579
33579
  var z22 = Math.pow(z2, 3);
@@ -33588,40 +33588,40 @@ var require_conversions = __commonJS({
33588
33588
  convert.lab.lch = function(lab) {
33589
33589
  var l2 = lab[0];
33590
33590
  var a = lab[1];
33591
- var b2 = lab[2];
33592
- var hr;
33591
+ var b = lab[2];
33592
+ var hr2;
33593
33593
  var h3;
33594
- var c3;
33595
- hr = Math.atan2(b2, a);
33596
- h3 = hr * 360 / 2 / Math.PI;
33594
+ var c2;
33595
+ hr2 = Math.atan2(b, a);
33596
+ h3 = hr2 * 360 / 2 / Math.PI;
33597
33597
  if (h3 < 0) {
33598
33598
  h3 += 360;
33599
33599
  }
33600
- c3 = Math.sqrt(a * a + b2 * b2);
33601
- return [l2, c3, h3];
33600
+ c2 = Math.sqrt(a * a + b * b);
33601
+ return [l2, c2, h3];
33602
33602
  };
33603
33603
  convert.lch.lab = function(lch) {
33604
33604
  var l2 = lch[0];
33605
- var c3 = lch[1];
33605
+ var c2 = lch[1];
33606
33606
  var h3 = lch[2];
33607
33607
  var a;
33608
- var b2;
33609
- var hr;
33610
- hr = h3 / 360 * 2 * Math.PI;
33611
- a = c3 * Math.cos(hr);
33612
- b2 = c3 * Math.sin(hr);
33613
- return [l2, a, b2];
33608
+ var b;
33609
+ var hr2;
33610
+ hr2 = h3 / 360 * 2 * Math.PI;
33611
+ a = c2 * Math.cos(hr2);
33612
+ b = c2 * Math.sin(hr2);
33613
+ return [l2, a, b];
33614
33614
  };
33615
33615
  convert.rgb.ansi16 = function(args) {
33616
33616
  var r4 = args[0];
33617
33617
  var g3 = args[1];
33618
- var b2 = args[2];
33618
+ var b = args[2];
33619
33619
  var value = 1 in arguments ? arguments[1] : convert.rgb.hsv(args)[2];
33620
33620
  value = Math.round(value / 50);
33621
33621
  if (value === 0) {
33622
33622
  return 30;
33623
33623
  }
33624
- var ansi = 30 + (Math.round(b2 / 255) << 2 | Math.round(g3 / 255) << 1 | Math.round(r4 / 255));
33624
+ var ansi = 30 + (Math.round(b / 255) << 2 | Math.round(g3 / 255) << 1 | Math.round(r4 / 255));
33625
33625
  if (value === 2) {
33626
33626
  ansi += 60;
33627
33627
  }
@@ -33633,8 +33633,8 @@ var require_conversions = __commonJS({
33633
33633
  convert.rgb.ansi256 = function(args) {
33634
33634
  var r4 = args[0];
33635
33635
  var g3 = args[1];
33636
- var b2 = args[2];
33637
- if (r4 === g3 && g3 === b2) {
33636
+ var b = args[2];
33637
+ if (r4 === g3 && g3 === b) {
33638
33638
  if (r4 < 8) {
33639
33639
  return 16;
33640
33640
  }
@@ -33643,7 +33643,7 @@ var require_conversions = __commonJS({
33643
33643
  }
33644
33644
  return Math.round((r4 - 8) / 247 * 24) + 232;
33645
33645
  }
33646
- var ansi = 16 + 36 * Math.round(r4 / 255 * 5) + 6 * Math.round(g3 / 255 * 5) + Math.round(b2 / 255 * 5);
33646
+ var ansi = 16 + 36 * Math.round(r4 / 255 * 5) + 6 * Math.round(g3 / 255 * 5) + Math.round(b / 255 * 5);
33647
33647
  return ansi;
33648
33648
  };
33649
33649
  convert.ansi16.rgb = function(args) {
@@ -33658,20 +33658,20 @@ var require_conversions = __commonJS({
33658
33658
  var mult = (~~(args > 50) + 1) * 0.5;
33659
33659
  var r4 = (color & 1) * mult * 255;
33660
33660
  var g3 = (color >> 1 & 1) * mult * 255;
33661
- var b2 = (color >> 2 & 1) * mult * 255;
33662
- return [r4, g3, b2];
33661
+ var b = (color >> 2 & 1) * mult * 255;
33662
+ return [r4, g3, b];
33663
33663
  };
33664
33664
  convert.ansi256.rgb = function(args) {
33665
33665
  if (args >= 232) {
33666
- var c3 = (args - 232) * 10 + 8;
33667
- return [c3, c3, c3];
33666
+ var c2 = (args - 232) * 10 + 8;
33667
+ return [c2, c2, c2];
33668
33668
  }
33669
33669
  args -= 16;
33670
33670
  var rem;
33671
33671
  var r4 = Math.floor(args / 36) / 5 * 255;
33672
33672
  var g3 = Math.floor((rem = args % 36) / 6) / 5 * 255;
33673
- var b2 = rem % 6 / 5 * 255;
33674
- return [r4, g3, b2];
33673
+ var b = rem % 6 / 5 * 255;
33674
+ return [r4, g3, b];
33675
33675
  };
33676
33676
  convert.rgb.hex = function(args) {
33677
33677
  var integer = ((Math.round(args[0]) & 255) << 16) + ((Math.round(args[1]) & 255) << 8) + (Math.round(args[2]) & 255);
@@ -33692,15 +33692,15 @@ var require_conversions = __commonJS({
33692
33692
  var integer = parseInt(colorString, 16);
33693
33693
  var r4 = integer >> 16 & 255;
33694
33694
  var g3 = integer >> 8 & 255;
33695
- var b2 = integer & 255;
33696
- return [r4, g3, b2];
33695
+ var b = integer & 255;
33696
+ return [r4, g3, b];
33697
33697
  };
33698
33698
  convert.rgb.hcg = function(rgb) {
33699
33699
  var r4 = rgb[0] / 255;
33700
33700
  var g3 = rgb[1] / 255;
33701
- var b2 = rgb[2] / 255;
33702
- var max = Math.max(Math.max(r4, g3), b2);
33703
- var min = Math.min(Math.min(r4, g3), b2);
33701
+ var b = rgb[2] / 255;
33702
+ var max = Math.max(Math.max(r4, g3), b);
33703
+ var min = Math.min(Math.min(r4, g3), b);
33704
33704
  var chroma = max - min;
33705
33705
  var grayscale;
33706
33706
  var hue;
@@ -33712,9 +33712,9 @@ var require_conversions = __commonJS({
33712
33712
  if (chroma <= 0) {
33713
33713
  hue = 0;
33714
33714
  } else if (max === r4) {
33715
- hue = (g3 - b2) / chroma % 6;
33715
+ hue = (g3 - b) / chroma % 6;
33716
33716
  } else if (max === g3) {
33717
- hue = 2 + (b2 - r4) / chroma;
33717
+ hue = 2 + (b - r4) / chroma;
33718
33718
  } else {
33719
33719
  hue = 4 + (r4 - g3) / chroma + 4;
33720
33720
  }
@@ -33725,33 +33725,33 @@ var require_conversions = __commonJS({
33725
33725
  convert.hsl.hcg = function(hsl) {
33726
33726
  var s = hsl[1] / 100;
33727
33727
  var l2 = hsl[2] / 100;
33728
- var c3 = 1;
33729
- var f = 0;
33728
+ var c2 = 1;
33729
+ var f2 = 0;
33730
33730
  if (l2 < 0.5) {
33731
- c3 = 2 * s * l2;
33731
+ c2 = 2 * s * l2;
33732
33732
  } else {
33733
- c3 = 2 * s * (1 - l2);
33733
+ c2 = 2 * s * (1 - l2);
33734
33734
  }
33735
- if (c3 < 1) {
33736
- f = (l2 - 0.5 * c3) / (1 - c3);
33735
+ if (c2 < 1) {
33736
+ f2 = (l2 - 0.5 * c2) / (1 - c2);
33737
33737
  }
33738
- return [hsl[0], c3 * 100, f * 100];
33738
+ return [hsl[0], c2 * 100, f2 * 100];
33739
33739
  };
33740
33740
  convert.hsv.hcg = function(hsv) {
33741
33741
  var s = hsv[1] / 100;
33742
33742
  var v3 = hsv[2] / 100;
33743
- var c3 = s * v3;
33744
- var f = 0;
33745
- if (c3 < 1) {
33746
- f = (v3 - c3) / (1 - c3);
33743
+ var c2 = s * v3;
33744
+ var f2 = 0;
33745
+ if (c2 < 1) {
33746
+ f2 = (v3 - c2) / (1 - c2);
33747
33747
  }
33748
- return [hsv[0], c3 * 100, f * 100];
33748
+ return [hsv[0], c2 * 100, f2 * 100];
33749
33749
  };
33750
33750
  convert.hcg.rgb = function(hcg) {
33751
33751
  var h3 = hcg[0] / 360;
33752
- var c3 = hcg[1] / 100;
33752
+ var c2 = hcg[1] / 100;
33753
33753
  var g3 = hcg[2] / 100;
33754
- if (c3 === 0) {
33754
+ if (c2 === 0) {
33755
33755
  return [g3 * 255, g3 * 255, g3 * 255];
33756
33756
  }
33757
33757
  var pure = [0, 0, 0];
@@ -33790,51 +33790,51 @@ var require_conversions = __commonJS({
33790
33790
  pure[1] = 0;
33791
33791
  pure[2] = w2;
33792
33792
  }
33793
- mg = (1 - c3) * g3;
33793
+ mg = (1 - c2) * g3;
33794
33794
  return [
33795
- (c3 * pure[0] + mg) * 255,
33796
- (c3 * pure[1] + mg) * 255,
33797
- (c3 * pure[2] + mg) * 255
33795
+ (c2 * pure[0] + mg) * 255,
33796
+ (c2 * pure[1] + mg) * 255,
33797
+ (c2 * pure[2] + mg) * 255
33798
33798
  ];
33799
33799
  };
33800
33800
  convert.hcg.hsv = function(hcg) {
33801
- var c3 = hcg[1] / 100;
33801
+ var c2 = hcg[1] / 100;
33802
33802
  var g3 = hcg[2] / 100;
33803
- var v3 = c3 + g3 * (1 - c3);
33804
- var f = 0;
33803
+ var v3 = c2 + g3 * (1 - c2);
33804
+ var f2 = 0;
33805
33805
  if (v3 > 0) {
33806
- f = c3 / v3;
33806
+ f2 = c2 / v3;
33807
33807
  }
33808
- return [hcg[0], f * 100, v3 * 100];
33808
+ return [hcg[0], f2 * 100, v3 * 100];
33809
33809
  };
33810
33810
  convert.hcg.hsl = function(hcg) {
33811
- var c3 = hcg[1] / 100;
33811
+ var c2 = hcg[1] / 100;
33812
33812
  var g3 = hcg[2] / 100;
33813
- var l2 = g3 * (1 - c3) + 0.5 * c3;
33813
+ var l2 = g3 * (1 - c2) + 0.5 * c2;
33814
33814
  var s = 0;
33815
33815
  if (l2 > 0 && l2 < 0.5) {
33816
- s = c3 / (2 * l2);
33816
+ s = c2 / (2 * l2);
33817
33817
  } else if (l2 >= 0.5 && l2 < 1) {
33818
- s = c3 / (2 * (1 - l2));
33818
+ s = c2 / (2 * (1 - l2));
33819
33819
  }
33820
33820
  return [hcg[0], s * 100, l2 * 100];
33821
33821
  };
33822
33822
  convert.hcg.hwb = function(hcg) {
33823
- var c3 = hcg[1] / 100;
33823
+ var c2 = hcg[1] / 100;
33824
33824
  var g3 = hcg[2] / 100;
33825
- var v3 = c3 + g3 * (1 - c3);
33826
- return [hcg[0], (v3 - c3) * 100, (1 - v3) * 100];
33825
+ var v3 = c2 + g3 * (1 - c2);
33826
+ return [hcg[0], (v3 - c2) * 100, (1 - v3) * 100];
33827
33827
  };
33828
33828
  convert.hwb.hcg = function(hwb) {
33829
33829
  var w2 = hwb[1] / 100;
33830
- var b2 = hwb[2] / 100;
33831
- var v3 = 1 - b2;
33832
- var c3 = v3 - w2;
33830
+ var b = hwb[2] / 100;
33831
+ var v3 = 1 - b;
33832
+ var c2 = v3 - w2;
33833
33833
  var g3 = 0;
33834
- if (c3 < 1) {
33835
- g3 = (v3 - c3) / (1 - c3);
33834
+ if (c2 < 1) {
33835
+ g3 = (v3 - c2) / (1 - c2);
33836
33836
  }
33837
- return [hwb[0], c3 * 100, g3 * 100];
33837
+ return [hwb[0], c2 * 100, g3 * 100];
33838
33838
  };
33839
33839
  convert.apple.rgb = function(apple) {
33840
33840
  return [apple[0] / 65535 * 255, apple[1] / 65535 * 255, apple[2] / 65535 * 255];
@@ -34443,15 +34443,15 @@ var require_kuler = __commonJS({
34443
34443
  color[1] = color[0];
34444
34444
  color = color.join("");
34445
34445
  }
34446
- var r4 = color.substring(0, 2), g3 = color.substring(2, 4), b2 = color.substring(4, 6);
34447
- return [parseInt(r4, 16), parseInt(g3, 16), parseInt(b2, 16)];
34446
+ var r4 = color.substring(0, 2), g3 = color.substring(2, 4), b = color.substring(4, 6);
34447
+ return [parseInt(r4, 16), parseInt(g3, 16), parseInt(b, 16)];
34448
34448
  };
34449
- Kuler.prototype.rgb = function rgb(r4, g3, b2) {
34450
- var red = r4 / 255 * 5, green = g3 / 255 * 5, blue = b2 / 255 * 5;
34449
+ Kuler.prototype.rgb = function rgb(r4, g3, b) {
34450
+ var red = r4 / 255 * 5, green = g3 / 255 * 5, blue = b / 255 * 5;
34451
34451
  return this.ansi(red, green, blue);
34452
34452
  };
34453
- Kuler.prototype.ansi = function ansi(r4, g3, b2) {
34454
- var red = Math.round(r4), green = Math.round(g3), blue = Math.round(b2);
34453
+ Kuler.prototype.ansi = function ansi(r4, g3, b) {
34454
+ var red = Math.round(r4), green = Math.round(g3), blue = Math.round(b);
34455
34455
  return 16 + red * 36 + green * 6 + blue;
34456
34456
  };
34457
34457
  Kuler.prototype.reset = function reset() {
@@ -37084,7 +37084,7 @@ var require_dcmjs_dimse_min = __commonJS({
37084
37084
  "object" == typeof exports2 && "object" == typeof module2 ? module2.exports = t(require_async_eventemitter(), require_dcmjs(), require_smartbuffer(), require_cjs(), require_winston()) : "function" == typeof define && define.amd ? define("dcmjs-dimse", ["async-eventemitter", "dcmjs", "smart-buffer", "ts-mixer", "winston"], t) : "object" == typeof exports2 ? exports2["dcmjs-dimse"] = t(require_async_eventemitter(), require_dcmjs(), require_smartbuffer(), require_cjs(), require_winston()) : e["dcmjs-dimse"] = t(e["async-eventemitter"], e.dcmjs, e["smart-buffer"], e["ts-mixer"], e.winston);
37085
37085
  }(global, (e, t, s, n, i2) => {
37086
37086
  return r4 = { 201: (e2, t2, s2) => {
37087
- const { CGetRequest: n2, CStoreRequest: i3 } = s2(406), { CommandFieldType: r5, PresentationContextResult: o2, SopClass: a, StorageClass: c3, TransferSyntax: d3, Uid: u2, UserIdentityType: h3 } = s2(855), m3 = s2(719), { EOL: g3 } = s2(37);
37087
+ const { CGetRequest: n2, CStoreRequest: i3 } = s2(406), { CommandFieldType: r5, PresentationContextResult: o2, SopClass: a, StorageClass: c2, TransferSyntax: d2, Uid: u3, UserIdentityType: h3 } = s2(855), m3 = s2(719), { EOL: g3 } = s2(37);
37088
37088
  class l2 {
37089
37089
  constructor(e3, t3, s3, n3) {
37090
37090
  this.pcId = e3, this.abstractSyntaxUid = t3, this.transferSyntaxes = [], s3 && this.transferSyntaxes.push(s3), this.result = n3 || o2.Proposed;
@@ -37148,7 +37148,7 @@ var require_dcmjs_dimse_min = __commonJS({
37148
37148
  }
37149
37149
  e2.exports = { Association: class {
37150
37150
  constructor(e3, t3) {
37151
- this.callingAeTitle = e3, this.calledAeTitle = t3, this.maxPduLength = m3.getMaxPduLength(), this.applicationContextName = u2.ApplicationContextName, this.implementationClassUid = m3.getImplementationClassUid(), this.implementationVersion = m3.getImplementationVersion(), this.presentationContexts = [], this.negotiateAsyncOps = false, this.maxAsyncOpsInvoked = 1, this.maxAsyncOpsPerformed = 1, this.negotiateUserIdentity = false, this.userIdentityType = h3.Username, this.userIdentityPositiveResponseRequested = false, this.userIdentityPrimaryField = "", this.userIdentitySecondaryField = "", this.negotiateUserIdentityServerResponse = false, this.userIdentityServerResponse = "";
37151
+ this.callingAeTitle = e3, this.calledAeTitle = t3, this.maxPduLength = m3.getMaxPduLength(), this.applicationContextName = u3.ApplicationContextName, this.implementationClassUid = m3.getImplementationClassUid(), this.implementationVersion = m3.getImplementationVersion(), this.presentationContexts = [], this.negotiateAsyncOps = false, this.maxAsyncOpsInvoked = 1, this.maxAsyncOpsPerformed = 1, this.negotiateUserIdentity = false, this.userIdentityType = h3.Username, this.userIdentityPositiveResponseRequested = false, this.userIdentityPrimaryField = "", this.userIdentitySecondaryField = "", this.negotiateUserIdentityServerResponse = false, this.userIdentityServerResponse = "";
37152
37152
  }
37153
37153
  getCallingAeTitle() {
37154
37154
  return this.callingAeTitle;
@@ -37283,7 +37283,7 @@ var require_dcmjs_dimse_min = __commonJS({
37283
37283
  this.presentationContexts.length = 0;
37284
37284
  }
37285
37285
  addPresentationContextFromRequest(e3, t3) {
37286
- let s3 = t3 || d3.ImplicitVRLittleEndian;
37286
+ let s3 = t3 || d2.ImplicitVRLittleEndian;
37287
37287
  s3 = Array.isArray(s3) ? s3 : [s3];
37288
37288
  const r6 = this._sopClassFromRequest(e3);
37289
37289
  let o3;
@@ -37292,12 +37292,12 @@ var require_dcmjs_dimse_min = __commonJS({
37292
37292
  this.addTransferSyntaxToPresentationContext(o3, e4);
37293
37293
  });
37294
37294
  const t4 = e3.getDataset().getTransferSyntaxUid();
37295
- t4 !== d3.ImplicitVRLittleEndian && t4 !== d3.ExplicitVRLittleEndian && (o3 = this.findPresentationContextByAbstractSyntaxAndTransferSyntax(r6, t4), void 0 === o3 && (o3 = this.addPresentationContext(r6), this.addTransferSyntaxToPresentationContext(o3, t4)));
37295
+ t4 !== d2.ImplicitVRLittleEndian && t4 !== d2.ExplicitVRLittleEndian && (o3 = this.findPresentationContextByAbstractSyntaxAndTransferSyntax(r6, t4), void 0 === o3 && (o3 = this.addPresentationContext(r6), this.addTransferSyntaxToPresentationContext(o3, t4)));
37296
37296
  } else
37297
37297
  e3 instanceof n2 ? (o3 = this.addOrGetPresentationContext(r6), s3.forEach((e4) => {
37298
37298
  this.addTransferSyntaxToPresentationContext(o3, e4);
37299
- }), true === e3.getAddStorageSopClassesToAssociation() && Object.keys(c3).forEach((e4) => {
37300
- const t4 = c3[e4], n3 = this.addOrGetPresentationContext(t4);
37299
+ }), true === e3.getAddStorageSopClassesToAssociation() && Object.keys(c2).forEach((e4) => {
37300
+ const t4 = c2[e4], n3 = this.addOrGetPresentationContext(t4);
37301
37301
  s3.forEach((e5) => {
37302
37302
  this.addTransferSyntaxToPresentationContext(n3, e5);
37303
37303
  });
@@ -37321,8 +37321,8 @@ var require_dcmjs_dimse_min = __commonJS({
37321
37321
  const e3 = [];
37322
37322
  return e3.push(`Application Context: ${this.getApplicationContextName()}`), e3.push(`Implementation Class: ${this.getImplementationClassUid()}`), e3.push(`Implementation Version: ${this.getImplementationVersion()}`), e3.push(`Maximum PDU Length: ${this.getMaxPduLength()}`), e3.push(`Called AE Title: ${this.getCalledAeTitle()}`), e3.push(`Calling AE Title: ${this.getCallingAeTitle()}`), this.getNegotiateAsyncOps() && e3.push(`Asynchronous Operations: Invoked: ${this.getMaxAsyncOpsInvoked()} Performed:${this.getMaxAsyncOpsPerformed()}`), this.getNegotiateUserIdentity() && e3.push(`User Identity: ${this._userIdentityTypeToString(this.getUserIdentityType()) || ""}`), e3.push(`Presentation Contexts: ${this.presentationContexts.length}`), this.presentationContexts.forEach((t3) => {
37323
37323
  const s3 = this.getPresentationContext(t3.id);
37324
- e3.push(` Presentation Context: ${t3.id} [${s3.getResultDescription()}]`), e3.push(` Abstract: ${this._uidNameFromValue([a, c3], s3.getAbstractSyntaxUid()) || s3.getAbstractSyntaxUid()}`), s3.getTransferSyntaxUids().forEach((t4) => {
37325
- e3.push(` Transfer: ${this._uidNameFromValue(d3, t4) || t4}`);
37324
+ e3.push(` Presentation Context: ${t3.id} [${s3.getResultDescription()}]`), e3.push(` Abstract: ${this._uidNameFromValue([a, c2], s3.getAbstractSyntaxUid()) || s3.getAbstractSyntaxUid()}`), s3.getTransferSyntaxUids().forEach((t4) => {
37325
+ e3.push(` Transfer: ${this._uidNameFromValue(d2, t4) || t4}`);
37326
37326
  });
37327
37327
  }), e3.push(""), e3.join(g3);
37328
37328
  }
@@ -37366,15 +37366,15 @@ var require_dcmjs_dimse_min = __commonJS({
37366
37366
  }
37367
37367
  }, PresentationContext: l2 };
37368
37368
  }, 185: (e2, t2, s2) => {
37369
- const { Association: n2, PresentationContext: i3 } = s2(201), { TransferSyntax: r5, UserIdentityType: o2 } = s2(855), { Request: a } = s2(406), c3 = s2(988), d3 = s2(266), u2 = s2(437), h3 = s2(425), m3 = s2(808), g3 = s2(404);
37369
+ const { Association: n2, PresentationContext: i3 } = s2(201), { TransferSyntax: r5, UserIdentityType: o2 } = s2(855), { Request: a } = s2(406), c2 = s2(988), d2 = s2(266), u3 = s2(437), h3 = s2(425), m3 = s2(808), g3 = s2(404);
37370
37370
  e2.exports = class extends h3 {
37371
37371
  constructor() {
37372
- super(), this.requests = [], this.additionalPresentationContexts = [], this.network = void 0, this.statistics = new d3();
37372
+ super(), this.requests = [], this.additionalPresentationContexts = [], this.network = void 0, this.statistics = new d2();
37373
37373
  }
37374
37374
  addRequest(e3) {
37375
37375
  if (!(e3 instanceof a))
37376
37376
  throw new Error(`${e3.toString()} is not a request`);
37377
- this.requests.includes(e3) ? u2.warn(`${e3.toString()} request has already been added. Ignoring...`) : this.requests.push(e3);
37377
+ this.requests.includes(e3) ? u3.warn(`${e3.toString()} request has already been added. Ignoring...`) : this.requests.push(e3);
37378
37378
  }
37379
37379
  clearRequests() {
37380
37380
  this.requests.length = 0;
@@ -37382,25 +37382,25 @@ var require_dcmjs_dimse_min = __commonJS({
37382
37382
  addAdditionalPresentationContext(e3, t3) {
37383
37383
  if (t3 = t3 || false, !(e3 instanceof i3))
37384
37384
  throw new Error(`${e3.toString()} is not a presentation context`);
37385
- this.additionalPresentationContexts.some((t4) => t4.context === e3) ? u2.warn(`${e3.toString()} context has already been added. Ignoring...`) : this.additionalPresentationContexts.push({ context: e3, addAsNew: t3 });
37385
+ this.additionalPresentationContexts.some((t4) => t4.context === e3) ? u3.warn(`${e3.toString()} context has already been added. Ignoring...`) : this.additionalPresentationContexts.push({ context: e3, addAsNew: t3 });
37386
37386
  }
37387
37387
  send(e3, t3, s3, i4, a2) {
37388
37388
  if (a2 = a2 || {}, this.associationLingerTimeout = a2.associationLingerTimeout || 0, 0 === this.requests.length)
37389
37389
  throw new Error("There are no requests to perform");
37390
- const d4 = new n2(s3, i4);
37391
- a2.asyncOps && (d4.setMaxAsyncOpsInvoked(a2.asyncOps.maxAsyncOpsInvoked || 1), d4.setMaxAsyncOpsPerformed(a2.asyncOps.maxAsyncOpsPerformed || 1), d4.setNegotiateAsyncOps(1 !== d4.getMaxAsyncOpsInvoked() || 1 !== d4.getMaxAsyncOpsPerformed())), a2.userIdentity && (d4.setUserIdentityType(a2.userIdentity.type || o2.Username), d4.setUserIdentityPositiveResponseRequested(a2.userIdentity.positiveResponseRequested || false), d4.setUserIdentityPrimaryField(a2.userIdentity.primaryField || ""), d4.setUserIdentitySecondaryField(a2.userIdentity.secondaryField || ""), d4.setNegotiateUserIdentity(true)), this.requests.forEach((e4) => {
37392
- d4.addPresentationContextFromRequest(e4, [r5.ImplicitVRLittleEndian, r5.ExplicitVRLittleEndian]);
37390
+ const d3 = new n2(s3, i4);
37391
+ a2.asyncOps && (d3.setMaxAsyncOpsInvoked(a2.asyncOps.maxAsyncOpsInvoked || 1), d3.setMaxAsyncOpsPerformed(a2.asyncOps.maxAsyncOpsPerformed || 1), d3.setNegotiateAsyncOps(1 !== d3.getMaxAsyncOpsInvoked() || 1 !== d3.getMaxAsyncOpsPerformed())), a2.userIdentity && (d3.setUserIdentityType(a2.userIdentity.type || o2.Username), d3.setUserIdentityPositiveResponseRequested(a2.userIdentity.positiveResponseRequested || false), d3.setUserIdentityPrimaryField(a2.userIdentity.primaryField || ""), d3.setUserIdentitySecondaryField(a2.userIdentity.secondaryField || ""), d3.setNegotiateUserIdentity(true)), this.requests.forEach((e4) => {
37392
+ d3.addPresentationContextFromRequest(e4, [r5.ImplicitVRLittleEndian, r5.ExplicitVRLittleEndian]);
37393
37393
  }), this.additionalPresentationContexts.forEach((e4) => {
37394
- const t4 = e4.addAsNew ? d4.addPresentationContext(e4.context.getAbstractSyntaxUid()) : d4.addOrGetPresentationContext(e4.context.getAbstractSyntaxUid());
37394
+ const t4 = e4.addAsNew ? d3.addPresentationContext(e4.context.getAbstractSyntaxUid()) : d3.addOrGetPresentationContext(e4.context.getAbstractSyntaxUid());
37395
37395
  e4.context.getTransferSyntaxUids().forEach((e5) => {
37396
- d4.addTransferSyntaxToPresentationContext(t4, e5);
37396
+ d3.addTransferSyntaxToPresentationContext(t4, e5);
37397
37397
  });
37398
37398
  });
37399
37399
  let h4 = {};
37400
- 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)" : ""}`);
37401
- const l2 = (a2.securityOptions ? g3 : m3).connect({ host: e3, port: t3, ...h4 }), p3 = new c3(l2, a2);
37400
+ 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 }), u3.info(`Connecting to ${e3}:${t3} ${a2.securityOptions ? "(TLS)" : ""}`);
37401
+ const l2 = (a2.securityOptions ? g3 : m3).connect({ host: e3, port: t3, ...h4 }), p3 = new c2(l2, a2);
37402
37402
  p3.on("connect", () => {
37403
- this.emit("connected"), p3.sendAssociationRequest(d4);
37403
+ this.emit("connected"), p3.sendAssociationRequest(d3);
37404
37404
  }), p3.on("associationAccepted", (e4) => {
37405
37405
  this.emit("associationAccepted", e4), p3.sendRequests(this.requests);
37406
37406
  }), p3.on("associationReleaseResponse", () => {
@@ -37434,7 +37434,7 @@ var require_dcmjs_dimse_min = __commonJS({
37434
37434
  }
37435
37435
  };
37436
37436
  }, 406: (e2, t2, s2) => {
37437
- const { CommandFieldType: n2, Priority: i3, SopClass: r5, Status: o2 } = s2(855), a = s2(347), { Mixin: c3 } = s2(842), { EOL: d3 } = s2(37), u2 = s2(425), h3 = s2(836), { DicomMetaDictionary: m3 } = h3.data;
37437
+ const { CommandFieldType: n2, Priority: i3, SopClass: r5, Status: o2 } = s2(855), a = s2(347), { Mixin: c2 } = s2(842), { EOL: d2 } = s2(37), u3 = s2(425), h3 = s2(836), { DicomMetaDictionary: m3 } = h3.data;
37438
37438
  class g3 {
37439
37439
  constructor(e3, t3) {
37440
37440
  this.commandDataset = e3 || new a(), this.dataset = t3;
@@ -37459,7 +37459,7 @@ var require_dcmjs_dimse_min = __commonJS({
37459
37459
  }
37460
37460
  toString(e3) {
37461
37461
  const t3 = e3 || {}, s3 = t3.includeCommandDataset || false, n3 = t3.includeDataset || false, i4 = [];
37462
- return i4.push(`${this._typeToString(this.getCommandFieldType())} [HasDataset: ${this.hasDataset()}]`), s3 && (i4.push("DIMSE Command Dataset:"), i4.push("=".repeat(50)), i4.push(JSON.stringify(this.commandDataset.getElements()))), n3 && this.dataset && (i4.push("DIMSE Dataset:"), i4.push("=".repeat(50)), i4.push(JSON.stringify(this.dataset.getElements()))), i4.join(d3);
37462
+ return i4.push(`${this._typeToString(this.getCommandFieldType())} [HasDataset: ${this.hasDataset()}]`), s3 && (i4.push("DIMSE Command Dataset:"), i4.push("=".repeat(50)), i4.push(JSON.stringify(this.commandDataset.getElements()))), n3 && this.dataset && (i4.push("DIMSE Dataset:"), i4.push("=".repeat(50)), i4.push(JSON.stringify(this.dataset.getElements()))), i4.join(d2);
37463
37463
  }
37464
37464
  _typeToString(e3) {
37465
37465
  switch (e3) {
@@ -37514,7 +37514,7 @@ var require_dcmjs_dimse_min = __commonJS({
37514
37514
  }
37515
37515
  }
37516
37516
  }
37517
- class l2 extends c3(g3, u2) {
37517
+ class l2 extends c2(g3, u3) {
37518
37518
  constructor(e3, t3, s3) {
37519
37519
  switch (super(new a({ CommandField: e3, CommandDataSetType: s3 ? 514 : 257 })), e3) {
37520
37520
  case n2.NGetRequest:
@@ -37682,14 +37682,14 @@ var require_dcmjs_dimse_min = __commonJS({
37682
37682
  super(n2.CEchoRequest, r5.Verification, false);
37683
37683
  }
37684
37684
  }
37685
- class f extends p3 {
37685
+ class f2 extends p3 {
37686
37686
  constructor(e3, t3) {
37687
37687
  super(n2.CEchoResponse, r5.Verification, false, e3, t3);
37688
37688
  }
37689
37689
  static fromRequest(e3) {
37690
37690
  if (!(e3 instanceof R2))
37691
37691
  throw new Error("Request should be an instance of CEchoRequest");
37692
- const t3 = new f(o2.ProcessingFailure);
37692
+ const t3 = new f2(o2.ProcessingFailure);
37693
37693
  return t3.setMessageIdBeingRespondedTo(e3.getMessageId()), t3;
37694
37694
  }
37695
37695
  }
@@ -37911,7 +37911,7 @@ var require_dcmjs_dimse_min = __commonJS({
37911
37911
  return t3.setMessageIdBeingRespondedTo(e3.getMessageId()), t3;
37912
37912
  }
37913
37913
  }
37914
- class E2 extends l2 {
37914
+ class E3 extends l2 {
37915
37915
  constructor(e3, t3) {
37916
37916
  super(n2.NDeleteRequest, e3, false), this.setRequestedSopInstanceUid(t3);
37917
37917
  }
@@ -37921,7 +37921,7 @@ var require_dcmjs_dimse_min = __commonJS({
37921
37921
  super(n2.NDeleteResponse, e3, false, s3, i4), this.setAffectedSopInstanceUid(t3);
37922
37922
  }
37923
37923
  static fromRequest(e3) {
37924
- if (!(e3 instanceof E2))
37924
+ if (!(e3 instanceof E3))
37925
37925
  throw new Error("Request should be an instance of NDeleteRequest");
37926
37926
  const t3 = new T(e3.getRequestedSopClassUid(), e3.getRequestedSopInstanceUid(), o2.ProcessingFailure);
37927
37927
  return t3.setMessageIdBeingRespondedTo(e3.getMessageId()), t3;
@@ -37938,7 +37938,7 @@ var require_dcmjs_dimse_min = __commonJS({
37938
37938
  this.getCommandDataset().setElement("EventTypeID", e3);
37939
37939
  }
37940
37940
  }
37941
- class b2 extends p3 {
37941
+ class b extends p3 {
37942
37942
  constructor(e3, t3, s3, i4, r6) {
37943
37943
  super(n2.NEventReportResponse, e3, false, i4, r6), this.setAffectedSopInstanceUid(t3), this.setEventTypeId(s3);
37944
37944
  }
@@ -37951,7 +37951,7 @@ var require_dcmjs_dimse_min = __commonJS({
37951
37951
  static fromRequest(e3) {
37952
37952
  if (!(e3 instanceof O2))
37953
37953
  throw new Error("Request should be an instance of NEventReportRequest");
37954
- const t3 = new b2(e3.getAffectedSopClassUid(), e3.getAffectedSopInstanceUid(), e3.getEventTypeId(), o2.ProcessingFailure);
37954
+ const t3 = new b(e3.getAffectedSopClassUid(), e3.getAffectedSopInstanceUid(), e3.getEventTypeId(), o2.ProcessingFailure);
37955
37955
  return t3.setMessageIdBeingRespondedTo(e3.getMessageId()), t3;
37956
37956
  }
37957
37957
  }
@@ -38024,7 +38024,7 @@ var require_dcmjs_dimse_min = __commonJS({
38024
38024
  return new F2(e3.getAffectedSopClassUid(), e3.getMessageId());
38025
38025
  }
38026
38026
  }
38027
- e2.exports = { CCancelRequest: F2, CEchoRequest: R2, CEchoResponse: f, 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: M, NSetResponse: L2, Request: l2, Response: p3 };
38027
+ e2.exports = { CCancelRequest: F2, 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: E3, NDeleteResponse: T, NEventReportRequest: O2, NEventReportResponse: b, NGetRequest: N2, NGetResponse: B2, NSetRequest: M, NSetResponse: L2, Request: l2, Response: p3 };
38028
38028
  }, 855: (e2) => {
38029
38029
  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 };
38030
38030
  Object.freeze(t2);
@@ -38040,12 +38040,12 @@ var require_dcmjs_dimse_min = __commonJS({
38040
38040
  Object.freeze(o2);
38041
38041
  const a = { ServiceUser: 1, ServiceProviderAcse: 2, ServiceProviderPresentation: 3 };
38042
38042
  Object.freeze(a);
38043
- const c3 = { NoReasonGiven: 1, ApplicationContextNotSupported: 2, CallingAeNotRecognized: 3, CalledAeNotRecognized: 7, ProtocolVersionNotSupported: 2, TemporaryCongestion: 1, LocalLimitExceeded: 2 };
38044
- Object.freeze(c3);
38045
- const d3 = { Low: 2, Medium: 0, High: 1 };
38046
- Object.freeze(d3);
38047
- const u2 = { Success: 0, Cancel: 65024, Pending: 65280, ClassInstanceConflict: 281, DataSetSopClassMismatch: 43264, DuplicateSOPInstance: 273, DuplicateInvocation: 528, InvalidArgumentValue: 277, InvalidAttributeValue: 262, InvalidObjectInstance: 279, MissingAttribute: 288, MissingAttributeValue: 289, MistypedArgument: 530, MoveDestinationUnknown: 43009, NoSuchActionType: 291, NoSuchArgument: 276, NoSuchEventType: 275, NoSuchObjectInstance: 274, NoSuchSopClass: 280, NotAuthorized: 292, OutOfResourcesNumberOfMatches: 42753, OutOfResourcesSubOperations: 42754, ProcessingFailure: 272, ResourceLimitation: 531, SopClassNotSupported: 290, UnrecognizedOperation: 529 };
38048
- Object.freeze(u2);
38043
+ const c2 = { NoReasonGiven: 1, ApplicationContextNotSupported: 2, CallingAeNotRecognized: 3, CalledAeNotRecognized: 7, ProtocolVersionNotSupported: 2, TemporaryCongestion: 1, LocalLimitExceeded: 2 };
38044
+ Object.freeze(c2);
38045
+ const d2 = { Low: 2, Medium: 0, High: 1 };
38046
+ Object.freeze(d2);
38047
+ const u3 = { Success: 0, Cancel: 65024, Pending: 65280, ClassInstanceConflict: 281, DataSetSopClassMismatch: 43264, DuplicateSOPInstance: 273, DuplicateInvocation: 528, InvalidArgumentValue: 277, InvalidAttributeValue: 262, InvalidObjectInstance: 279, MissingAttribute: 288, MissingAttributeValue: 289, MistypedArgument: 530, MoveDestinationUnknown: 43009, NoSuchActionType: 291, NoSuchArgument: 276, NoSuchEventType: 275, NoSuchObjectInstance: 274, NoSuchSopClass: 280, NotAuthorized: 292, OutOfResourcesNumberOfMatches: 42753, OutOfResourcesSubOperations: 42754, ProcessingFailure: 272, ResourceLimitation: 531, SopClassNotSupported: 290, UnrecognizedOperation: 529 };
38048
+ Object.freeze(u3);
38049
38049
  const h3 = { ApplicationContextName: "1.2.840.10008.3.1.1.1" };
38050
38050
  Object.freeze(h3);
38051
38051
  const m3 = { BasicTextSrStorage: "1.2.840.10008.5.1.4.1.1.88.11", BreastProjectionXRayImageStorageForPresentation: "1.2.840.10008.5.1.4.1.1.13.1.4", BreastProjectionXRayImageStorageForProcessing: "1.2.840.10008.5.1.4.1.1.13.1.5", BreastTomosynthesisImageStorage: "1.2.840.10008.5.1.4.1.1.13.1.3", ChestCadSrStorage: "1.2.840.10008.5.1.4.1.1.88.65", ComprehensiveSrStorage: "1.2.840.10008.5.1.4.1.1.88.33", ComputedRadiographyImageStorage: "1.2.840.10008.5.1.4.1.1.1", CtImageStorage: "1.2.840.10008.5.1.4.1.1.2", DigitalIntraOralXRayImageStorageForPresentation: "1.2.840.10008.5.1.4.1.1.1.3", DigitalIntraOralXRayImageStorageForProcessing: "1.2.840.10008.5.1.4.1.1.1.3.1", DigitalMammographyXRayImageStorageForPresentation: "1.2.840.10008.5.1.4.1.1.1.2", DigitalMammographyXRayImageStorageForProcessing: "1.2.840.10008.5.1.4.1.1.1.2.1", DigitalXRayImageStorageForPresentation: "1.2.840.10008.5.1.4.1.1.1.1", DigitalXRayImageStorageForProcessing: "1.2.840.10008.5.1.4.1.1.1.1.1", EncapsulatedCdaStorage: "1.2.840.10008.5.1.4.1.1.104.2", EncapsulatedPdfStorage: "1.2.840.10008.5.1.4.1.1.104.1", EnhancedCtImageStorage: "1.2.840.10008.5.1.4.1.1.2.1", EnhancedMrColorImageStorage: "1.2.840.10008.5.1.4.1.1.4.3", EnhancedMrImageStorage: "1.2.840.10008.5.1.4.1.1.4.1", EnhancedPetImageStorage: "1.2.840.10008.5.1.4.1.1.130", EnhancedSrStorage: "1.2.840.10008.5.1.4.1.1.88.22", EnhancedXaImageStorage: "1.2.840.10008.5.1.4.1.1.12.1.1", EnhancedXrfImageStorage: "1.2.840.10008.5.1.4.1.1.12.2.1", IntravascularOpticalCoherenceTomographyImageStorageForPresentation: "1.2.840.10008.5.1.4.1.1.14.1", IntravascularOpticalCoherenceTomographyImageStorageForProcessing: "1.2.840.10008.5.1.4.1.1.14.2", LegacyConvertedEnhancedCTImageStorage: "1.2.840.10008.5.1.4.1.1.2.2", LegacyConvertedEnhancedMRImageStorage: "1.2.840.10008.5.1.4.1.1.4.4", LegacyConvertedEnhancedPETImageStorage: "1.2.840.10008.5.1.4.1.1.128.1", MammographyCadSrStorage: "1.2.840.10008.5.1.4.1.1.88.50", MrImageStorage: "1.2.840.10008.5.1.4.1.1.4", MultiframeGrayscaleByteSecondaryCaptureImageStorage: "1.2.840.10008.5.1.4.1.1.7.2", MultiframeGrayscaleWordSecondaryCaptureImageStorage: "1.2.840.10008.5.1.4.1.1.7.3", MultiframeSingleBitSecondaryCaptureImageStorage: "1.2.840.10008.5.1.4.1.1.7.1", MultiframeTrueColorSecondaryCaptureImageStorage: "1.2.840.10008.5.1.4.1.1.7.4", NuclearMedicineImageStorage: "1.2.840.10008.5.1.4.1.1.20", OphthalmicOpticalCoherenceTomographyEnFaceImageStorage: "1.2.840.10008.5.1.4.1.1.77.1.5.7", OphthalmicPhotography16BitImageStorage: "1.2.840.10008.5.1.4.1.1.77.1.5.2", OphthalmicPhotography8BitImageStorage: "1.2.840.10008.5.1.4.1.1.77.1.5.1", OphthalmicTomographyImageStorage: "1.2.840.10008.5.1.4.1.1.77.1.5.4", PositronEmissionTomographyImageStorage: "1.2.840.10008.5.1.4.1.1.128", RtImageStorage: "1.2.840.10008.5.1.4.1.1.481.1", SecondaryCaptureImageStorage: "1.2.840.10008.5.1.4.1.1.7", UltrasoundImageStorage: "1.2.840.10008.5.1.4.1.1.6.1", UltrasoundMultiframeImageStorage: "1.2.840.10008.5.1.4.1.1.3.1", VideoEndoscopicImageStorage: "1.2.840.10008.5.1.4.1.1.77.1.1.1", VideoMicroscopicImageStorage: "1.2.840.10008.5.1.4.1.1.77.1.2.1", VideoPhotographicImageStorage: "1.2.840.10008.5.1.4.1.1.77.1.4.1", VlEndoscopicImageStorage: "1.2.840.10008.5.1.4.1.1.77.1.1", VlMicroscopicImageStorage: "1.2.840.10008.5.1.4.1.1.77.1.2", VlPhotographicImageStorage: "1.2.840.10008.5.1.4.1.1.77.1.4", VlSlideCoordinatesMicroscopicImageStorage: "1.2.840.10008.5.1.4.1.1.77.1.3", VlWholeSlideMicroscopyImageStorage: "1.2.840.10008.5.1.4.1.1.77.1.6", WideFieldOphthalmicPhotography3dCoordinatesImageStorage: "1.2.840.10008.5.1.4.1.1.77.1.5.6", WideFieldOphthalmicPhotographyStereographicProjectionImageStorage: "1.2.840.10008.5.1.4.1.1.77.1.5.5", XRay3dAngiographicImageStorage: "1.2.840.10008.5.1.4.1.1.13.1.1", XRay3dCraniofacialImageStorage: "1.2.840.10008.5.1.4.1.1.13.1.2", XRayAngiographicImageStorage: "1.2.840.10008.5.1.4.1.1.12.1", XRayRadiationDoseSRStorage: "1.2.840.10008.5.1.4.1.1.88.67", XRayRadiofluoroscopicImageStorage: "1.2.840.10008.5.1.4.1.1.12.2" };
@@ -38057,12 +38057,12 @@ var require_dcmjs_dimse_min = __commonJS({
38057
38057
  const p3 = [l2.ImplicitVRLittleEndian, l2.ExplicitVRLittleEndian];
38058
38058
  Object.freeze(p3);
38059
38059
  const R2 = { ImplementationClassUid: "1.2.826.0.1.3680043.10.854", ImplementationVersion: "DCMJS-DIMSE-V0.1", MaxPduLength: 262144 };
38060
- 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 };
38060
+ Object.freeze(R2), e2.exports = { AbortReason: r5, AbortSource: i3, CommandFieldType: t2, DefaultImplementation: R2, PresentationContextResult: s2, Priority: d2, RejectReason: c2, RejectResult: o2, RejectSource: a, SopClass: g3, Status: u3, StorageClass: m3, TranscodableTransferSyntaxes: p3, TransferSyntax: l2, Uid: h3, UserIdentityType: n2 };
38061
38061
  }, 347: (e2, t2, s2) => {
38062
- 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;
38062
+ const { StorageClass: n2, TransferSyntax: i3 } = s2(855), r5 = s2(719), { readFile: o2, readFileSync: a, writeFile: c2, writeFileSync: d2 } = s2(147), { EOL: u3 } = s2(37), h3 = s2(836), { DicomDict: m3, DicomMessage: g3, DicomMetaDictionary: l2, ReadBufferStream: p3, WriteBufferStream: R2 } = h3.data, f2 = h3.log;
38063
38063
  class y {
38064
38064
  constructor(e3, t3, s3) {
38065
- 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 || {};
38065
+ 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 || {};
38066
38066
  }
38067
38067
  getElement(e3) {
38068
38068
  return this.elements[e3];
@@ -38102,17 +38102,17 @@ var require_dcmjs_dimse_min = __commonJS({
38102
38102
  });
38103
38103
  }
38104
38104
  toFile(e3, t3, s3, i4) {
38105
- const o3 = { _meta: { FileMetaInformationVersion: new Uint8Array([0, 1]).buffer, MediaStorageSOPClassUID: this.getElement("SOPClassUID") || n2.SecondaryCaptureImageStorage, MediaStorageSOPInstanceUID: this.getElement("SOPInstanceUID") || y.generateDerivedUid(), TransferSyntaxUID: this.getTransferSyntaxUid(), ImplementationClassUID: r5.getImplementationClassUid(), ImplementationVersionName: r5.getImplementationVersion() }, ...this.getElements() }, a2 = l2.denaturalizeDataset(o3._meta), u3 = new m3(a2);
38106
- u3.dict = s3 ? l2.denaturalizeDataset(o3, { ...l2.nameMap, ...s3 }) : l2.denaturalizeDataset(o3), t3 instanceof Function ? c3(e3, Buffer.from(u3.write(i4)), (e4) => {
38105
+ const o3 = { _meta: { FileMetaInformationVersion: new Uint8Array([0, 1]).buffer, MediaStorageSOPClassUID: this.getElement("SOPClassUID") || n2.SecondaryCaptureImageStorage, MediaStorageSOPInstanceUID: this.getElement("SOPInstanceUID") || y.generateDerivedUid(), TransferSyntaxUID: this.getTransferSyntaxUid(), ImplementationClassUID: r5.getImplementationClassUid(), ImplementationVersionName: r5.getImplementationVersion() }, ...this.getElements() }, a2 = l2.denaturalizeDataset(o3._meta), u4 = new m3(a2);
38106
+ u4.dict = s3 ? l2.denaturalizeDataset(o3, { ...l2.nameMap, ...s3 }) : l2.denaturalizeDataset(o3), t3 instanceof Function ? c2(e3, Buffer.from(u4.write(i4)), (e4) => {
38107
38107
  t3(e4 || void 0);
38108
- }) : d3(e3, Buffer.from(u3.write(i4)));
38108
+ }) : d2(e3, Buffer.from(u4.write(i4)));
38109
38109
  }
38110
38110
  static generateDerivedUid() {
38111
38111
  return l2.uid();
38112
38112
  }
38113
38113
  toString() {
38114
38114
  const e3 = [];
38115
- return e3.push("Dataset:"), e3.push("=".repeat(50)), e3.push(JSON.stringify(this.getElements())), e3.join(u2);
38115
+ return e3.push("Dataset:"), e3.push("=".repeat(50)), e3.push(JSON.stringify(this.getElements())), e3.join(u3);
38116
38116
  }
38117
38117
  static _fromP10Buffer(e3, t3) {
38118
38118
  t3 = t3 || {}, t3 = { ignoreErrors: true, ...t3 };
@@ -38150,7 +38150,7 @@ var require_dcmjs_dimse_min = __commonJS({
38150
38150
  }
38151
38151
  };
38152
38152
  }, 988: (e2, t2, s2) => {
38153
- 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: 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: M, NGetResponse: L2, NSetRequest: F2, 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);
38153
+ const { Association: n2 } = s2(201), { AAbort: i3, AAssociateAC: r5, AAssociateRJ: o2, AAssociateRQ: a, AReleaseRP: c2, AReleaseRQ: d2, PDataTF: u3, Pdv: h3, RawPdu: m3 } = s2(634), { CommandFieldType: g3, Status: l2, TranscodableTransferSyntaxes: p3 } = 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: E3, NCreateResponse: T, NDeleteRequest: O2, NDeleteResponse: b, NEventReportRequest: N2, NEventReportResponse: B2, NGetRequest: M, NGetResponse: L2, NSetRequest: F2, NSetResponse: k2, Response: $ } = s2(406), j2 = s2(347), V2 = s2(719), G = s2(266), _2 = s2(437), { SmartBuffer: z2 } = s2(677), { EOL: Q2 } = s2(37), W = s2(425);
38154
38154
  class J2 extends W {
38155
38155
  constructor() {
38156
38156
  super();
@@ -38190,7 +38190,7 @@ var require_dcmjs_dimse_min = __commonJS({
38190
38190
  }
38191
38191
  e2.exports = class extends W {
38192
38192
  constructor(e3, t3) {
38193
- 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();
38193
+ 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();
38194
38194
  }
38195
38195
  sendAssociationRequest(e3) {
38196
38196
  this.association = e3;
@@ -38207,11 +38207,11 @@ var require_dcmjs_dimse_min = __commonJS({
38207
38207
  _2.info(`${this.logId} -> Association reject ${n3.toString()}`), this._sendPdu(i4);
38208
38208
  }
38209
38209
  sendAssociationReleaseRequest() {
38210
- const e3 = new d3().write();
38210
+ const e3 = new d2().write();
38211
38211
  _2.info(`${this.logId} -> Association release request`), this._sendPdu(e3);
38212
38212
  }
38213
38213
  sendAssociationReleaseResponse() {
38214
- const e3 = new c3().write();
38214
+ const e3 = new c2().write();
38215
38215
  _2.info(`${this.logId} -> Association release response`), this._sendPdu(e3);
38216
38216
  }
38217
38217
  sendRequests(e3) {
@@ -38282,18 +38282,18 @@ var require_dcmjs_dimse_min = __commonJS({
38282
38282
  s3 = 0 === s3 ? n3 : Math.min(s3, n3);
38283
38283
  const i4 = e3.getCommandDataset().getDenaturalizedCommandDataset();
38284
38284
  _2.info(`${this.logId} -> ${e3.toString({ includeCommandDataset: this.logCommandDatasets, includeDataset: this.logDatasets })} [pc: ${t3}]`);
38285
- const r6 = new u2(), o3 = new h3(t3, i4, true, true);
38285
+ const r6 = new u3(), o3 = new h3(t3, i4, true, true);
38286
38286
  r6.addPdv(o3);
38287
38287
  const a2 = r6.write().writePdu();
38288
38288
  this.socket.write(a2), this.statistics.addBytesSent(a2.length);
38289
- const c4 = e3.getDataset();
38290
- if (c4) {
38291
- const e4 = c4.getDenaturalizedDataset(this.datasetWriteOptions, this.datasetNameMap), n4 = [], i5 = e4.length, r7 = s3 - 6;
38289
+ const c3 = e3.getDataset();
38290
+ if (c3) {
38291
+ const e4 = c3.getDenaturalizedDataset(this.datasetWriteOptions, this.datasetNameMap), n4 = [], i5 = e4.length, r7 = s3 - 6;
38292
38292
  let o4 = 0;
38293
38293
  for (; o4 < i5; )
38294
38294
  n4.push(e4.slice(o4, o4 += r7));
38295
38295
  for (let e5 = 0; e5 < n4.length; e5++) {
38296
- const s4 = n4.length === e5 + 1, i6 = new h3(t3, n4[e5], false, s4), r8 = new u2();
38296
+ const s4 = n4.length === e5 + 1, i6 = new h3(t3, n4[e5], false, s4), r8 = new u3();
38297
38297
  r8.addPdv(i6);
38298
38298
  const o5 = r8.write().writePdu();
38299
38299
  this.socket.write(o5), this.statistics.addBytesSent(o5.length);
@@ -38316,15 +38316,15 @@ var require_dcmjs_dimse_min = __commonJS({
38316
38316
  break;
38317
38317
  }
38318
38318
  case 4: {
38319
- const e4 = new u2();
38319
+ const e4 = new u3();
38320
38320
  e4.read(t3), this._processPDataTf(e4);
38321
38321
  break;
38322
38322
  }
38323
38323
  case 5:
38324
- new d3().read(t3), _2.info(`${this.logId} <- Association release request`), this.emit("associationReleaseRequested");
38324
+ new d2().read(t3), _2.info(`${this.logId} <- Association release request`), this.emit("associationReleaseRequested");
38325
38325
  break;
38326
38326
  case 6:
38327
- new c3().read(t3), _2.info(`${this.logId} <- Association release response`), this.emit("associationReleaseResponse");
38327
+ new c2().read(t3), _2.info(`${this.logId} <- Association release response`), this.emit("associationReleaseResponse");
38328
38328
  break;
38329
38329
  case 7: {
38330
38330
  const e4 = new i3();
@@ -38350,7 +38350,7 @@ var require_dcmjs_dimse_min = __commonJS({
38350
38350
  const s3 = new w2(new j2(this.dimseBuffer.toBuffer()));
38351
38351
  switch (s3.getCommandFieldType()) {
38352
38352
  case g3.CEchoRequest:
38353
- this.dimse = Object.assign(new f(), s3);
38353
+ this.dimse = Object.assign(new f2(), s3);
38354
38354
  break;
38355
38355
  case g3.CEchoResponse:
38356
38356
  this.dimse = Object.assign(new y(), s3);
@@ -38380,7 +38380,7 @@ var require_dcmjs_dimse_min = __commonJS({
38380
38380
  this.dimse = Object.assign(new P2(), s3);
38381
38381
  break;
38382
38382
  case g3.NCreateRequest:
38383
- this.dimse = Object.assign(new E2(), s3);
38383
+ this.dimse = Object.assign(new E3(), s3);
38384
38384
  break;
38385
38385
  case g3.NCreateResponse:
38386
38386
  this.dimse = Object.assign(new T(), s3);
@@ -38395,7 +38395,7 @@ var require_dcmjs_dimse_min = __commonJS({
38395
38395
  this.dimse = Object.assign(new O2(), s3);
38396
38396
  break;
38397
38397
  case g3.NDeleteResponse:
38398
- this.dimse = Object.assign(new b2(), s3);
38398
+ this.dimse = Object.assign(new b(), s3);
38399
38399
  break;
38400
38400
  case g3.NEventReportRequest:
38401
38401
  this.dimse = Object.assign(new N2(), s3);
@@ -38498,12 +38498,12 @@ var require_dcmjs_dimse_min = __commonJS({
38498
38498
  }
38499
38499
  };
38500
38500
  }, 634: (e2, t2, s2) => {
38501
- const { AbortReason: n2, AbortSource: i3, RejectReason: r5, RejectResult: o2, RejectSource: a, TransferSyntax: c3 } = s2(855), { SmartBuffer: d3 } = s2(677), { EOL: u2 } = s2(37);
38501
+ const { AbortReason: n2, AbortSource: i3, RejectReason: r5, RejectResult: o2, RejectSource: a, TransferSyntax: c2 } = s2(855), { SmartBuffer: d2 } = s2(677), { EOL: u3 } = s2(37);
38502
38502
  class h3 {
38503
38503
  constructor(e3) {
38504
38504
  if (this.m16 = [], this.m32 = [], Buffer.isBuffer(e3))
38505
- return this.buffer = d3.fromBuffer(e3, "ascii"), void (this.type = this.buffer.readUInt8());
38506
- this.buffer = d3.fromOptions({ encoding: "ascii" }), this.type = e3;
38505
+ return this.buffer = d2.fromBuffer(e3, "ascii"), void (this.type = this.buffer.readUInt8());
38506
+ this.buffer = d2.fromOptions({ encoding: "ascii" }), this.type = e3;
38507
38507
  }
38508
38508
  getType() {
38509
38509
  return this.type;
@@ -38517,10 +38517,10 @@ var require_dcmjs_dimse_min = __commonJS({
38517
38517
  readPdu() {
38518
38518
  this.buffer.readUInt8();
38519
38519
  const e3 = this.buffer.readUInt32BE(), t3 = this.buffer.readBuffer(e3);
38520
- this.buffer = d3.fromBuffer(t3, "ascii");
38520
+ this.buffer = d2.fromBuffer(t3, "ascii");
38521
38521
  }
38522
38522
  writePdu() {
38523
- const e3 = d3.fromOptions({ encoding: "ascii" }), t3 = this.getLength();
38523
+ const e3 = d2.fromOptions({ encoding: "ascii" }), t3 = this.getLength();
38524
38524
  return e3.writeUInt8(this.type), e3.writeUInt8(0), e3.writeUInt8((4278190080 & t3) >> 24), e3.writeUInt8((16711680 & t3) >> 16), e3.writeUInt8((65280 & t3) >> 8), e3.writeUInt8(255 & t3), e3.writeBuffer(this.buffer.toBuffer()), e3.toBuffer();
38525
38525
  }
38526
38526
  checkOffset(e3, t3) {
@@ -38690,7 +38690,7 @@ var require_dcmjs_dimse_min = __commonJS({
38690
38690
  const e3 = new h3(2);
38691
38691
  return e3.writeUInt16("Version", 1), e3.writeByteMultiple("Reserved", 0, 2), e3.writeStringWithPadding("Called AE", this.association.getCalledAeTitle(), 16, " "), e3.writeStringWithPadding("Calling AE", this.association.getCallingAeTitle(), 16, " "), e3.writeByteMultiple("Reserved", 0, 32), e3.writeByte("Item-Type", 16), e3.writeByte("Reserved", 0), e3.markLength16("Item-Length"), e3.writeString("Application Context Name", this.association.getApplicationContextName()), e3.writeLength16(), this.association.getPresentationContexts().forEach((t3) => {
38692
38692
  const s3 = this.association.getPresentationContext(t3.id);
38693
- e3.writeByte("Item-Type", 33), e3.writeByte("Reserved", 0), e3.markLength16("Item-Length"), e3.writeByte("Presentation Context ID", s3.getPresentationContextId()), e3.writeByte("Reserved", 0), e3.writeByte("Result", s3.getResult()), e3.writeByte("Reserved", 0), e3.writeByte("Item-Type", 64), e3.writeByte("Reserved", 0), e3.markLength16("Item-Length"), e3.writeString("Transfer Syntax UID", s3.getAcceptedTransferSyntaxUid() || c3.ImplicitVRLittleEndian), e3.writeLength16(), e3.writeLength16();
38693
+ e3.writeByte("Item-Type", 33), e3.writeByte("Reserved", 0), e3.markLength16("Item-Length"), e3.writeByte("Presentation Context ID", s3.getPresentationContextId()), e3.writeByte("Reserved", 0), e3.writeByte("Result", s3.getResult()), e3.writeByte("Reserved", 0), e3.writeByte("Item-Type", 64), e3.writeByte("Reserved", 0), e3.markLength16("Item-Length"), e3.writeString("Transfer Syntax UID", s3.getAcceptedTransferSyntaxUid() || c2.ImplicitVRLittleEndian), e3.writeLength16(), e3.writeLength16();
38694
38694
  }), e3.writeByte("Item-Type", 80), e3.writeByte("Reserved", 0), e3.markLength16("Item-Length"), e3.writeByte("Item-Type", 81), e3.writeByte("Reserved", 0), e3.writeUInt16("Item-Length", 4), e3.writeUInt32("Max PDU Length", this.association.getMaxPduLength()), e3.writeByte("Item-Type", 82), e3.writeByte("Reserved", 0), e3.markLength16("Item-Length"), e3.writeString("Implementation Class UID", this.association.getImplementationClassUid()), e3.writeLength16(), !this.association.getNegotiateAsyncOps() || 1 === this.association.getMaxAsyncOpsInvoked() && 1 === this.association.getMaxAsyncOpsPerformed() || (e3.writeByte("Item-Type", 83), e3.writeByte("Reserved", 0), e3.writeUInt16("Item-Length", 4), e3.writeUInt16("Asynchronous Operations Invoked", this.association.getMaxAsyncOpsInvoked()), e3.writeUInt16("Asynchronous Operations Performed", this.association.getMaxAsyncOpsPerformed())), e3.writeByte("Item-Type", 85), e3.writeByte("Reserved", 0), e3.markLength16("Item-Length"), e3.writeString("Implementation Version", this.association.getImplementationVersion()), e3.writeLength16(), this.association.getNegotiateUserIdentityServerResponse() && (e3.writeByte("Item-Type", 89), e3.writeByte("Reserved", 0), e3.markLength16("Item-Length"), e3.markLength16("Server Response-Length"), e3.writeString("Server Response", this.association.getUserIdentityServerResponse()), e3.writeLength16(), e3.writeLength16()), e3.writeLength16(), e3;
38695
38695
  }
38696
38696
  read(e3) {
@@ -38742,7 +38742,7 @@ var require_dcmjs_dimse_min = __commonJS({
38742
38742
  }
38743
38743
  }
38744
38744
  toString() {
38745
- return `(A-ASSOCIATE-AC)${u2}${this.association.toString()}`;
38745
+ return `(A-ASSOCIATE-AC)${u3}${this.association.toString()}`;
38746
38746
  }
38747
38747
  }, AAssociateRJ: class {
38748
38748
  constructor(e3, t3, s3) {
@@ -38880,7 +38880,7 @@ var require_dcmjs_dimse_min = __commonJS({
38880
38880
  }
38881
38881
  }
38882
38882
  toString() {
38883
- return `(A-ASSOCIATE-RQ)${u2}${this.association.toString()}`;
38883
+ return `(A-ASSOCIATE-RQ)${u3}${this.association.toString()}`;
38884
38884
  }
38885
38885
  }, AReleaseRP: class {
38886
38886
  constructor() {
@@ -38949,7 +38949,7 @@ var require_dcmjs_dimse_min = __commonJS({
38949
38949
  }
38950
38950
  }, Pdv: m3, RawPdu: h3 };
38951
38951
  }, 975: (e2, t2, s2) => {
38952
- 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);
38952
+ const { CEchoResponse: n2, CFindResponse: i3, CGetResponse: r5, CMoveResponse: o2, CStoreResponse: a, NActionResponse: c2, NCreateResponse: d2, NDeleteResponse: u3, NEventReportResponse: h3, NGetResponse: m3, NSetResponse: g3 } = s2(406), l2 = s2(988), p3 = s2(266), R2 = s2(437), f2 = s2(425), y = s2(808), S2 = s2(404);
38953
38953
  e2.exports = { Scp: class extends l2 {
38954
38954
  constructor(e3, t3) {
38955
38955
  super(e3, t3), this.on("associationRequested", (e4) => {
@@ -39006,13 +39006,13 @@ var require_dcmjs_dimse_min = __commonJS({
39006
39006
  R2.error("cGetRequest method must be implemented"), t3(r5.fromRequest(e3));
39007
39007
  }
39008
39008
  nCreateRequest(e3, t3) {
39009
- R2.error("nCreateRequest method must be implemented"), t3(d3.fromRequest(e3));
39009
+ R2.error("nCreateRequest method must be implemented"), t3(d2.fromRequest(e3));
39010
39010
  }
39011
39011
  nActionRequest(e3, t3) {
39012
- R2.error("nActionRequest method must be implemented"), t3(c3.fromRequest(e3));
39012
+ R2.error("nActionRequest method must be implemented"), t3(c2.fromRequest(e3));
39013
39013
  }
39014
39014
  nDeleteRequest(e3, t3) {
39015
- R2.error("nDeleteRequest method must be implemented"), t3(u2.fromRequest(e3));
39015
+ R2.error("nDeleteRequest method must be implemented"), t3(u3.fromRequest(e3));
39016
39016
  }
39017
39017
  nEventReportRequest(e3, t3) {
39018
39018
  R2.error("nEventReportRequest method must be implemented"), t3(h3.fromRequest(e3));
@@ -39029,7 +39029,7 @@ var require_dcmjs_dimse_min = __commonJS({
39029
39029
  abort(e3, t3) {
39030
39030
  R2.error("abort method must be implemented");
39031
39031
  }
39032
- }, Server: class extends f {
39032
+ }, Server: class extends f2 {
39033
39033
  constructor(e3) {
39034
39034
  super(), this.scp = { class: e3 }, this.server = void 0, this.clients = [], this.statistics = new p3();
39035
39035
  }
@@ -39091,11 +39091,11 @@ var require_dcmjs_dimse_min = __commonJS({
39091
39091
  }
39092
39092
  };
39093
39093
  }, 10: (e2, t2, s2) => {
39094
- 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: 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: M, RejectSource: L2, SopClass: F2, 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: M, RejectSource: L2, SopClass: F2, 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: p3, CStoreResponse: f, NActionResponse: S2, NCreateResponse: C2, NDeleteResponse: v3, NEventReportResponse: w2, NGetResponse: U2, NSetResponse: D2 }, Scp: r5, Server: o2, Statistics: W, version: s2(972) };
39094
+ const { Association: n2, PresentationContext: i3 } = s2(201), { Scp: r5, Server: o2 } = s2(975), { CCancelRequest: a, CEchoRequest: c2, CEchoResponse: d2, CFindRequest: u3, CFindResponse: h3, CGetRequest: m3, CGetResponse: g3, CMoveRequest: l2, CMoveResponse: p3, 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: E3, AbortSource: T, CommandFieldType: O2, PresentationContextResult: b, Priority: N2, RejectReason: B2, RejectResult: M, RejectSource: L2, SopClass: F2, Status: k2, StorageClass: $, TransferSyntax: j2, Uid: V2, UserIdentityType: G } = s2(855), _2 = s2(185), z2 = s2(347), Q2 = s2(719), W = s2(266), J2 = { association: { Association: n2, PresentationContext: i3 }, Client: _2, constants: { AbortReason: E3, AbortSource: T, CommandFieldType: O2, PresentationContextResult: b, Priority: N2, RejectReason: B2, RejectResult: M, RejectSource: L2, SopClass: F2, Status: k2, StorageClass: $, TransferSyntax: j2, Uid: V2, UserIdentityType: G }, Dataset: z2, Implementation: Q2, log: s2(437), requests: { CCancelRequest: a, CEchoRequest: c2, CFindRequest: u3, CGetRequest: m3, CMoveRequest: l2, CStoreRequest: R2, NActionRequest: y, NCreateRequest: I2, NDeleteRequest: P2, NEventReportRequest: x, NGetRequest: A2, NSetRequest: q }, responses: { CEchoResponse: d2, CFindResponse: h3, CGetResponse: g3, CMoveResponse: p3, CStoreResponse: f2, NActionResponse: S2, NCreateResponse: C2, NDeleteResponse: v3, NEventReportResponse: w2, NGetResponse: U2, NSetResponse: D2 }, Scp: r5, Server: o2, Statistics: W, version: s2(972) };
39095
39095
  e2.exports = J2;
39096
39096
  }, 437: (e2, t2, s2) => {
39097
- 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()] });
39098
- e2.exports = d3;
39097
+ const { createLogger: n2, format: i3, transports: r5 } = s2(469), { combine: o2, printf: a, timestamp: c2 } = i3, d2 = n2({ format: o2(c2(), a(({ level: e3, message: t3, timestamp: s3 }) => `${s3} -- ${e3.toUpperCase()} -- ${t3}`)), transports: [new r5.Console()] });
39098
+ e2.exports = d2;
39099
39099
  }, 972: (e2) => {
39100
39100
  e2.exports = "0.1.24";
39101
39101
  }, 147: (e2) => {
@@ -39145,7 +39145,7 @@ __export(main_exports, {
39145
39145
  module.exports = __toCommonJS(main_exports);
39146
39146
 
39147
39147
  // ../core/dist/esm/index.mjs
39148
- var Pe = class {
39148
+ var Ce = class {
39149
39149
  constructor(e, t) {
39150
39150
  this.operator = e;
39151
39151
  this.child = t;
@@ -39164,7 +39164,7 @@ var Q = class {
39164
39164
  return `${this.left.toString()} ${this.operator} ${this.right.toString()}`;
39165
39165
  }
39166
39166
  };
39167
- var Ce = class {
39167
+ var Ae = class {
39168
39168
  constructor() {
39169
39169
  this.prefixParselets = {};
39170
39170
  this.infixParselets = {};
@@ -39243,11 +39243,11 @@ var pt = class {
39243
39243
  }
39244
39244
  };
39245
39245
  var ft = "ok";
39246
- var Ae = "created";
39246
+ var we = "created";
39247
39247
  var ht = "not-modified";
39248
39248
  var gt = "not-found";
39249
- var we = "accepted";
39250
- var cr = { resourceType: "OperationOutcome", id: gt, issue: [{ severity: "error", code: "not-found", details: { text: "Not found" } }] };
39249
+ var Ie = "accepted";
39250
+ var lr = { resourceType: "OperationOutcome", id: gt, issue: [{ severity: "error", code: "not-found", details: { text: "Not found" } }] };
39251
39251
  function v(r4, e) {
39252
39252
  return { resourceType: "OperationOutcome", issue: [{ severity: "error", code: "invalid", details: { text: r4 }, expression: e ? [e] : void 0 }] };
39253
39253
  }
@@ -39258,24 +39258,24 @@ function ne(r4) {
39258
39258
  return typeof r4 == "object" && r4 !== null && r4.resourceType === "OperationOutcome";
39259
39259
  }
39260
39260
  function yt(r4) {
39261
- return r4.id === ft || r4.id === Ae || r4.id === ht || r4.id === we;
39261
+ return r4.id === ft || r4.id === we || r4.id === ht || r4.id === Ie;
39262
39262
  }
39263
- var p = class extends Error {
39263
+ var f = class extends Error {
39264
39264
  constructor(e, t) {
39265
- super(ur(e)), this.outcome = e, this.cause = t;
39265
+ super(dr(e)), this.outcome = e, this.cause = t;
39266
39266
  }
39267
39267
  };
39268
- function Ie(r4) {
39269
- return r4 instanceof p ? r4.outcome : ne(r4) ? r4 : v($n(r4));
39268
+ function ke(r4) {
39269
+ return r4 instanceof f ? r4.outcome : ne(r4) ? r4 : v(jn(r4));
39270
39270
  }
39271
- function $n(r4) {
39272
- return r4 ? typeof r4 == "string" ? r4 : r4 instanceof Error ? r4.message : ne(r4) ? ur(r4) : typeof r4 == "object" && "code" in r4 && typeof r4.code == "string" ? r4.code : JSON.stringify(r4) : "Unknown error";
39271
+ function jn(r4) {
39272
+ return r4 ? typeof r4 == "string" ? r4 : r4 instanceof Error ? r4.message : ne(r4) ? dr(r4) : typeof r4 == "object" && "code" in r4 && typeof r4.code == "string" ? r4.code : JSON.stringify(r4) : "Unknown error";
39273
39273
  }
39274
- function ur(r4) {
39275
- let e = r4.issue?.map(jn) ?? [];
39274
+ function dr(r4) {
39275
+ let e = r4.issue?.map(Qn) ?? [];
39276
39276
  return e.length > 0 ? e.join("; ") : "Unknown error";
39277
39277
  }
39278
- function jn(r4) {
39278
+ function Qn(r4) {
39279
39279
  let e;
39280
39280
  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;
39281
39281
  }
@@ -39286,88 +39286,88 @@ function J(r4) {
39286
39286
  function fe(r4) {
39287
39287
  return me(r4) ? r4.reference : `${r4.resourceType}/${r4.id}`;
39288
39288
  }
39289
- function fr(r4) {
39289
+ function hr(r4) {
39290
39290
  if (r4)
39291
39291
  return me(r4) ? r4.reference.split("/")[1] : r4.id;
39292
39292
  }
39293
- function Qn(r4) {
39293
+ function Gn(r4) {
39294
39294
  return r4.resourceType === "Patient" || r4.resourceType === "Practitioner" || r4.resourceType === "RelatedPerson";
39295
39295
  }
39296
39296
  function Hn(r4) {
39297
- if (Qn(r4)) {
39298
- let e = Gn(r4);
39297
+ if (Gn(r4)) {
39298
+ let e = Kn(r4);
39299
39299
  if (e)
39300
39300
  return e;
39301
39301
  }
39302
39302
  if (r4.resourceType === "Device") {
39303
- let e = Kn(r4);
39303
+ let e = Wn(r4);
39304
39304
  if (e)
39305
39305
  return e;
39306
39306
  }
39307
39307
  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 : fe(r4);
39308
39308
  }
39309
- function Gn(r4) {
39309
+ function Kn(r4) {
39310
39310
  let e = r4.name;
39311
39311
  if (e && e.length > 0)
39312
- return Me(e[0]);
39312
+ return Fe(e[0]);
39313
39313
  }
39314
- function Kn(r4) {
39314
+ function Wn(r4) {
39315
39315
  let e = r4.deviceName;
39316
39316
  if (e && e.length > 0)
39317
39317
  return e[0].name;
39318
39318
  }
39319
- function ke(r4, e) {
39319
+ function Oe(r4, e) {
39320
39320
  let t = new Date(r4);
39321
39321
  t.setUTCHours(0, 0, 0, 0);
39322
39322
  let n = e ? new Date(e) : /* @__PURE__ */ new Date();
39323
39323
  n.setUTCHours(0, 0, 0, 0);
39324
- let i2 = t.getUTCFullYear(), o = t.getUTCMonth(), s = t.getUTCDate(), a = n.getUTCFullYear(), u2 = n.getUTCMonth(), l2 = n.getUTCDate(), f = a - i2;
39325
- (u2 < o || u2 === o && l2 < s) && f--;
39326
- let E2 = a * 12 + u2 - (i2 * 12 + o);
39327
- l2 < s && E2--;
39324
+ let i2 = t.getUTCFullYear(), o = t.getUTCMonth(), s = t.getUTCDate(), a = n.getUTCFullYear(), c2 = n.getUTCMonth(), l2 = n.getUTCDate(), d2 = a - i2;
39325
+ (c2 < o || c2 === o && l2 < s) && d2--;
39326
+ let b = a * 12 + c2 - (i2 * 12 + o);
39327
+ l2 < s && b--;
39328
39328
  let q = Math.floor((n.getTime() - t.getTime()) / (1e3 * 60 * 60 * 24));
39329
- return { years: f, months: E2, days: q };
39329
+ return { years: d2, months: b, days: q };
39330
39330
  }
39331
- function gr(r4, ...e) {
39331
+ function xr(r4, ...e) {
39332
39332
  let t = r4;
39333
39333
  for (let n = 0; n < e.length && t; n++)
39334
39334
  t = t?.extension?.find((i2) => i2.url === e[n]);
39335
39335
  return t;
39336
39336
  }
39337
- function yr(r4, e) {
39338
- return JSON.stringify(r4, Wn, e ? 2 : void 0);
39337
+ function Tr(r4, e) {
39338
+ return JSON.stringify(r4, zn, e ? 2 : void 0);
39339
39339
  }
39340
- function Wn(r4, e) {
39341
- return !zn(r4) && R(e) ? void 0 : e;
39340
+ function zn(r4, e) {
39341
+ return !Jn(r4) && S(e) ? void 0 : e;
39342
39342
  }
39343
- function zn(r4) {
39343
+ function Jn(r4) {
39344
39344
  return !!/\d+$/.exec(r4);
39345
39345
  }
39346
- function R(r4) {
39346
+ function S(r4) {
39347
39347
  if (r4 == null)
39348
39348
  return true;
39349
39349
  let e = typeof r4;
39350
- return e === "string" || e === "object" ? !Jn(r4) : false;
39350
+ return e === "string" || e === "object" ? !Yn(r4) : false;
39351
39351
  }
39352
- function Jn(r4) {
39352
+ function Yn(r4) {
39353
39353
  if (r4 == null)
39354
39354
  return false;
39355
39355
  let e = typeof r4;
39356
39356
  return e === "string" && r4 !== "" || e === "object" && ("length" in r4 && r4.length > 0 || Object.keys(r4).length > 0);
39357
39357
  }
39358
- function xr(r4) {
39358
+ function vr(r4) {
39359
39359
  return r4.every((e) => typeof e == "string");
39360
39360
  }
39361
- var Tr = [];
39361
+ var Sr = [];
39362
39362
  for (let r4 = 0; r4 < 256; r4++)
39363
- Tr.push(r4.toString(16).padStart(2, "0"));
39364
- function vr(r4) {
39363
+ Sr.push(r4.toString(16).padStart(2, "0"));
39364
+ function Er(r4) {
39365
39365
  let e = new Uint8Array(r4), t = new Array(e.length);
39366
39366
  for (let n = 0; n < e.length; n++)
39367
- t[n] = Tr[e[n]];
39367
+ t[n] = Sr[e[n]];
39368
39368
  return t.join("");
39369
39369
  }
39370
- function Sr(r4) {
39370
+ function br(r4) {
39371
39371
  let e = new Uint8Array(r4), t = [];
39372
39372
  for (let n = 0; n < e.length; n++)
39373
39373
  t[n] = String.fromCharCode(e[n]);
@@ -39379,7 +39379,7 @@ function I(r4) {
39379
39379
  var St = (r4) => new Promise((e) => {
39380
39380
  setTimeout(e, r4);
39381
39381
  });
39382
- function Me(r4, e) {
39382
+ function Fe(r4, e) {
39383
39383
  let t = [];
39384
39384
  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) {
39385
39385
  let n = oe(r4.text);
@@ -39391,23 +39391,23 @@ function Me(r4, e) {
39391
39391
  function oe(r4) {
39392
39392
  return typeof r4 == "string" ? r4 : void 0;
39393
39393
  }
39394
- function yi(r4, e) {
39394
+ function xi(r4, e) {
39395
39395
  let t = e.max && e.max === Number.MAX_SAFE_INTEGER ? Number.POSITIVE_INFINITY : e.max;
39396
39396
  return { path: r4, description: "", type: e.type ?? [], min: e.min ?? 0, max: t ?? 1, isArray: !!t && t > 1, constraints: [] };
39397
39397
  }
39398
- function Pr(r4) {
39398
+ function Ar(r4) {
39399
39399
  let e = /* @__PURE__ */ Object.create(null);
39400
39400
  for (let [t, n] of Object.entries(r4))
39401
- e[t] = { name: t, elements: Object.fromEntries(Object.entries(n.elements).map(([i2, o]) => [i2, yi(i2, o)])), constraints: [], innerTypes: [] };
39401
+ e[t] = { name: t, elements: Object.fromEntries(Object.entries(n.elements).map(([i2, o]) => [i2, xi(i2, o)])), constraints: [], innerTypes: [] };
39402
39402
  return e;
39403
39403
  }
39404
- var Cr = { 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", profile: ["http://hl7.org/fhir/StructureDefinition/SimpleQuantity"] }] }, maxDosePerLifetime: { type: [{ code: "Quantity", profile: ["http://hl7.org/fhir/StructureDefinition/SimpleQuantity"] }] } } }, 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: "uri" }] }, "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", profile: ["http://hl7.org/fhir/StructureDefinition/SimpleQuantity"] }] }, high: { type: [{ code: "Quantity", profile: ["http://hl7.org/fhir/StructureDefinition/SimpleQuantity"] }] } } }, 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", profile: ["http://hl7.org/fhir/StructureDefinition/SimpleQuantity"] }] }, 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" }] } } } };
39405
- var Fe = { base64Binary: /^([A-Za-z\d+/]{4})*([A-Za-z\d+/]{2}==|[A-Za-z\d+/]{3}=)?$/, canonical: /^\S*$/, code: /^[^\s]+( [^\s]+)*$/, date: /^(\d(\d(\d[1-9]|[1-9]0)|[1-9]00)|[1-9]000)(-(0[1-9]|1[0-2])(-(0[1-9]|[1-2]\d|3[0-1]))?)?$/, dateTime: /^(\d(\d(\d[1-9]|[1-9]0)|[1-9]00)|[1-9]000)(-(0[1-9]|1[0-2])(-(0[1-9]|[1-2]\d|3[0-1])(T([01]\d|2[0-3])(:[0-5]\d:([0-5]\d|60)(\.\d{1,9})?)?)?)?(Z|[+-]((0\d|1[0-3]):[0-5]\d|14:00)?)?)?$/, id: /^[A-Za-z0-9\-.]{1,64}$/, instant: /^(\d(\d(\d[1-9]|[1-9]0)|[1-9]00)|[1-9]000)-(0[1-9]|1[0-2])-(0[1-9]|[1-2]\d|3[0-1])T([01]\d|2[0-3]):[0-5]\d:([0-5]\d|60)(\.\d{1,9})?(Z|[+-]((0\d|1[0-3]):[0-5]\d|14:00))$/, markdown: /^[\s\S]+$/, oid: /^urn:oid:[0-2](\.(0|[1-9]\d*))+$/, string: /^[\s\S]+$/, time: /^([01]\d|2[0-3]):[0-5]\d:([0-5]\d|60)(\.\d{1,9})?$/, uri: /^\S*$/, url: /^\S*$/, uuid: /^urn:uuid:[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/, xhtml: /.*/ };
39406
- function d(r4) {
39407
- return [{ type: c.boolean, value: r4 }];
39404
+ var wr = { 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", profile: ["http://hl7.org/fhir/StructureDefinition/SimpleQuantity"] }] }, maxDosePerLifetime: { type: [{ code: "Quantity", profile: ["http://hl7.org/fhir/StructureDefinition/SimpleQuantity"] }] } } }, 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: "uri" }] }, "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", profile: ["http://hl7.org/fhir/StructureDefinition/SimpleQuantity"] }] }, high: { type: [{ code: "Quantity", profile: ["http://hl7.org/fhir/StructureDefinition/SimpleQuantity"] }] } } }, 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", profile: ["http://hl7.org/fhir/StructureDefinition/SimpleQuantity"] }] }, 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" }] } } } };
39405
+ var _e = { base64Binary: /^([A-Za-z\d+/]{4})*([A-Za-z\d+/]{2}==|[A-Za-z\d+/]{3}=)?$/, canonical: /^\S*$/, code: /^[^\s]+( [^\s]+)*$/, date: /^(\d(\d(\d[1-9]|[1-9]0)|[1-9]00)|[1-9]000)(-(0[1-9]|1[0-2])(-(0[1-9]|[1-2]\d|3[0-1]))?)?$/, dateTime: /^(\d(\d(\d[1-9]|[1-9]0)|[1-9]00)|[1-9]000)(-(0[1-9]|1[0-2])(-(0[1-9]|[1-2]\d|3[0-1])(T([01]\d|2[0-3])(:[0-5]\d:([0-5]\d|60)(\.\d{1,9})?)?)?)?(Z|[+-]((0\d|1[0-3]):[0-5]\d|14:00)?)?)?$/, id: /^[A-Za-z0-9\-.]{1,64}$/, instant: /^(\d(\d(\d[1-9]|[1-9]0)|[1-9]00)|[1-9]000)-(0[1-9]|1[0-2])-(0[1-9]|[1-2]\d|3[0-1])T([01]\d|2[0-3]):[0-5]\d:([0-5]\d|60)(\.\d{1,9})?(Z|[+-]((0\d|1[0-3]):[0-5]\d|14:00))$/, markdown: /^[\s\S]+$/, oid: /^urn:oid:[0-2](\.(0|[1-9]\d*))+$/, string: /^[\s\S]+$/, time: /^([01]\d|2[0-3]):[0-5]\d:([0-5]\d|60)(\.\d{1,9})?$/, uri: /^\S*$/, url: /^\S*$/, uuid: /^urn:uuid:[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/, xhtml: /.*/ };
39406
+ function p(r4) {
39407
+ return [{ type: u.boolean, value: r4 }];
39408
39408
  }
39409
39409
  function g(r4) {
39410
- 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 } : F(r4) ? { type: r4.resourceType, value: r4 } : { type: c.BackboneElement, value: r4 };
39410
+ return r4 == null ? { type: "undefined", value: void 0 } : Number.isSafeInteger(r4) ? { type: u.integer, value: r4 } : typeof r4 == "number" ? { type: u.decimal, value: r4 } : typeof r4 == "boolean" ? { type: u.boolean, value: r4 } : typeof r4 == "string" ? { type: u.string, value: r4 } : P(r4) ? { type: u.Quantity, value: r4 } : F(r4) ? { type: r4.resourceType, value: r4 } : { type: u.BackboneElement, value: r4 };
39411
39411
  }
39412
39412
  function D(r4) {
39413
39413
  return r4.length === 0 ? false : !!r4[0].value;
@@ -39419,41 +39419,41 @@ function _(r4, e) {
39419
39419
  throw new Error(`Expected singleton of type ${e}, but found ${JSON.stringify(r4)}`);
39420
39420
  }
39421
39421
  }
39422
- function A(r4, e) {
39422
+ function A(r4, e, t) {
39423
39423
  if (!r4.value)
39424
39424
  return;
39425
- let t = Be(r4.type, e);
39426
- return t ? Pi(r4.value, e, t) : Ci(r4, e);
39425
+ let n = qe(r4.type, e, t?.profileUrl);
39426
+ return n ? Ci(r4, e, n) : Ai(r4, e);
39427
39427
  }
39428
- function Pi(r4, e, t) {
39429
- let n = t.type;
39430
- if (!n || n.length === 0)
39428
+ function Ci(r4, e, t) {
39429
+ let n = r4.value, i2 = t.type;
39430
+ if (!i2 || i2.length === 0)
39431
39431
  return;
39432
- let i2, o = "undefined", s;
39432
+ let o, s = "undefined", a;
39433
39433
  if (t.path.endsWith("[x]")) {
39434
- let a = t.path.split(".").pop().replace("[x]", "");
39435
- for (let u2 of n) {
39436
- let l2 = a + I(u2.code);
39437
- if (i2 = r4[l2], s = r4["_" + l2], i2 !== void 0 || s !== void 0) {
39438
- o = u2.code;
39434
+ let c2 = t.path.split(".").pop().replace("[x]", "");
39435
+ for (let l2 of i2) {
39436
+ let d2 = c2 + I(l2.code);
39437
+ if (o = n[d2], a = n["_" + d2], o !== void 0 || a !== void 0) {
39438
+ s = l2.code;
39439
39439
  break;
39440
39440
  }
39441
39441
  }
39442
39442
  } else
39443
- console.assert(n.length === 1, "Expected single type", t.path), i2 = r4[e], o = n[0].code, s = r4["_" + e];
39444
- if (s)
39445
- if (Array.isArray(i2))
39446
- for (let a = 0; a < Math.max(i2.length, s.length); a++)
39447
- i2[a] = Nr(i2[a], s[a]);
39443
+ console.assert(i2.length === 1, "Expected single type", t.path), o = n[e], s = i2[0].code, a = n["_" + e];
39444
+ if (a)
39445
+ if (Array.isArray(o))
39446
+ for (let c2 = 0; c2 < Math.max(o.length, a.length); c2++)
39447
+ o[c2] = Fr(o[c2], a[c2]);
39448
39448
  else
39449
- i2 = Nr(i2, s);
39450
- if (!R(i2))
39451
- return (o === "Element" || o === "BackboneElement") && (o = t.type[0].code), Array.isArray(i2) ? i2.map((a) => kr(a, o)) : kr(i2, o);
39449
+ o = Fr(o, a);
39450
+ if (!S(o))
39451
+ return (s === "Element" || s === "BackboneElement") && (s = t.type[0].code), Array.isArray(o) ? o.map((c2) => Vr(c2, s)) : Vr(o, s);
39452
39452
  }
39453
- function kr(r4, e) {
39453
+ function Vr(r4, e) {
39454
39454
  return e === "Resource" && F(r4) && (e = r4.resourceType), { type: e, value: r4 };
39455
39455
  }
39456
- function Ci(r4, e) {
39456
+ function Ai(r4, e) {
39457
39457
  let t = r4.value;
39458
39458
  if (!t || typeof t != "object")
39459
39459
  return;
@@ -39461,22 +39461,22 @@ function Ci(r4, e) {
39461
39461
  if (e in t)
39462
39462
  n = t[e];
39463
39463
  else
39464
- for (let i2 in c) {
39464
+ for (let i2 in u) {
39465
39465
  let o = e + I(i2);
39466
39466
  if (o in t) {
39467
39467
  n = t[o];
39468
39468
  break;
39469
39469
  }
39470
39470
  }
39471
- if (!R(n))
39471
+ if (!S(n))
39472
39472
  return Array.isArray(n) ? n.map(g) : g(n);
39473
39473
  }
39474
- function Ue(r4) {
39474
+ function Le(r4) {
39475
39475
  let e = [];
39476
39476
  for (let t of r4) {
39477
39477
  let n = false;
39478
39478
  for (let i2 of e)
39479
- if (D(Mr(t, i2))) {
39479
+ if (D(_r(t, i2))) {
39480
39480
  n = true;
39481
39481
  break;
39482
39482
  }
@@ -39485,27 +39485,27 @@ function Ue(r4) {
39485
39485
  return e;
39486
39486
  }
39487
39487
  function kt(r4) {
39488
- return d(!D(r4));
39488
+ return p(!D(r4));
39489
39489
  }
39490
39490
  function Ot(r4, e) {
39491
- return r4.length === 0 || e.length === 0 ? [] : r4.length !== e.length ? d(false) : d(r4.every((t, n) => D(Mr(t, e[n]))));
39491
+ return r4.length === 0 || e.length === 0 ? [] : r4.length !== e.length ? p(false) : p(r4.every((t, n) => D(_r(t, e[n]))));
39492
39492
  }
39493
- function Mr(r4, e) {
39493
+ function _r(r4, e) {
39494
39494
  let t = r4.value?.valueOf(), n = e.value?.valueOf();
39495
- return typeof t == "number" && typeof n == "number" ? d(Math.abs(t - n) < 1e-8) : P(t) && P(n) ? d(Ur(t, n)) : d(typeof t == "object" && typeof n == "object" ? Dt(r4, e) : t === n);
39495
+ return typeof t == "number" && typeof n == "number" ? p(Math.abs(t - n) < 1e-8) : P(t) && P(n) ? p(Br(t, n)) : p(typeof t == "object" && typeof n == "object" ? Dt(r4, e) : t === n);
39496
39496
  }
39497
39497
  function Vt(r4, e) {
39498
- return r4.length === 0 && e.length === 0 ? d(true) : r4.length !== e.length ? d(false) : (r4.sort(Or), e.sort(Or), d(r4.every((t, n) => D(Ai(t, e[n])))));
39498
+ return r4.length === 0 && e.length === 0 ? p(true) : r4.length !== e.length ? p(false) : (r4.sort(Dr), e.sort(Dr), p(r4.every((t, n) => D(wi(t, e[n])))));
39499
39499
  }
39500
- function Ai(r4, e) {
39500
+ function wi(r4, e) {
39501
39501
  let { type: t, value: n } = r4, { type: i2, value: o } = e, s = n?.valueOf(), a = o?.valueOf();
39502
- return typeof s == "number" && typeof a == "number" ? d(Math.abs(s - a) < 0.01) : P(s) && P(a) ? d(Ur(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" ? Dt({ ...s, id: void 0 }, { ...a, id: void 0 }) : typeof s == "string" && typeof a == "string" ? s.toLowerCase() === a.toLowerCase() : s === a);
39502
+ return typeof s == "number" && typeof a == "number" ? p(Math.abs(s - a) < 0.01) : P(s) && P(a) ? p(Br(s, a)) : p(t === "Coding" && i2 === "Coding" ? typeof s != "object" || typeof a != "object" ? false : s.code === a.code && s.system === a.system : typeof s == "object" && typeof a == "object" ? Dt({ ...s, id: void 0 }, { ...a, id: void 0 }) : typeof s == "string" && typeof a == "string" ? s.toLowerCase() === a.toLowerCase() : s === a);
39503
39503
  }
39504
- function Or(r4, e) {
39504
+ function Dr(r4, e) {
39505
39505
  let t = r4.value?.valueOf(), n = e.value?.valueOf();
39506
39506
  return typeof t == "number" && typeof n == "number" ? t - n : typeof t == "string" && typeof n == "string" ? t.localeCompare(n) : 0;
39507
39507
  }
39508
- function Le(r4, e) {
39508
+ function Be(r4, e) {
39509
39509
  let { value: t } = r4;
39510
39510
  if (t == null)
39511
39511
  return false;
@@ -39516,32 +39516,32 @@ function Le(r4, e) {
39516
39516
  case "Integer":
39517
39517
  return typeof t == "number";
39518
39518
  case "Date":
39519
- return Fr(t);
39519
+ return Ur(t);
39520
39520
  case "DateTime":
39521
- return _e(t);
39521
+ return Ue(t);
39522
39522
  case "Time":
39523
39523
  return typeof t == "string" && !!/^T\d/.exec(t);
39524
39524
  case "Period":
39525
- return _r(t);
39525
+ return Lr(t);
39526
39526
  case "Quantity":
39527
39527
  return P(t);
39528
39528
  default:
39529
39529
  return typeof t == "object" && t?.resourceType === e;
39530
39530
  }
39531
39531
  }
39532
- function Fr(r4) {
39533
- return typeof r4 == "string" && !!Fe.date.exec(r4);
39532
+ function Ur(r4) {
39533
+ return typeof r4 == "string" && !!_e.date.exec(r4);
39534
39534
  }
39535
- function _e(r4) {
39536
- return typeof r4 == "string" && !!Fe.dateTime.exec(r4);
39535
+ function Ue(r4) {
39536
+ return typeof r4 == "string" && !!_e.dateTime.exec(r4);
39537
39537
  }
39538
- function _r(r4) {
39539
- return !!(r4 && typeof r4 == "object" && ("start" in r4 && _e(r4.start) || "end" in r4 && _e(r4.end)));
39538
+ function Lr(r4) {
39539
+ return !!(r4 && typeof r4 == "object" && ("start" in r4 && Ue(r4.start) || "end" in r4 && Ue(r4.end)));
39540
39540
  }
39541
39541
  function P(r4) {
39542
39542
  return !!(r4 && typeof r4 == "object" && "value" in r4 && typeof r4.value == "number");
39543
39543
  }
39544
- function Ur(r4, e) {
39544
+ function Br(r4, e) {
39545
39545
  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);
39546
39546
  }
39547
39547
  function Dt(r4, e) {
@@ -39550,7 +39550,7 @@ function Dt(r4, e) {
39550
39550
  return false;
39551
39551
  for (let i2 of t) {
39552
39552
  let o = r4[i2], s = e[i2];
39553
- if (Dr(o) && Dr(s)) {
39553
+ if (Mr(o) && Mr(s)) {
39554
39554
  if (!Dt(o, s))
39555
39555
  return false;
39556
39556
  } else if (o !== s)
@@ -39558,55 +39558,56 @@ function Dt(r4, e) {
39558
39558
  }
39559
39559
  return true;
39560
39560
  }
39561
- function Dr(r4) {
39561
+ function Mr(r4) {
39562
39562
  return r4 !== null && typeof r4 == "object";
39563
39563
  }
39564
- function Nr(r4, e) {
39564
+ function Fr(r4, e) {
39565
39565
  if (e) {
39566
39566
  if (typeof e != "object")
39567
39567
  throw new Error("Primitive extension must be an object");
39568
- return wi(r4 ?? {}, e);
39568
+ return Ii(r4 ?? {}, e);
39569
39569
  }
39570
39570
  return r4;
39571
39571
  }
39572
- function wi(r4, e) {
39572
+ function Ii(r4, e) {
39573
39573
  return delete e.__proto__, delete e.constructor, Object.assign(r4, e);
39574
39574
  }
39575
39575
  function It(r4) {
39576
- return new Mt(r4).parse();
39576
+ return new Ft(r4).parse();
39577
39577
  }
39578
- var he = Pr(Cr);
39579
- var _t = /* @__PURE__ */ Object.create(null);
39580
- var Lr = /* @__PURE__ */ Object.create(null);
39581
- function Ut(r4) {
39578
+ var he = Ar(wr);
39579
+ var Ut = /* @__PURE__ */ Object.create(null);
39580
+ var qr = /* @__PURE__ */ Object.create(null);
39581
+ function Mt(r4) {
39582
39582
  let e;
39583
- return r4 ? (e = Lr[r4], e || (e = Lr[r4] = /* @__PURE__ */ Object.create(null))) : e = he, e;
39583
+ return r4 ? (e = qr[r4], e || (e = qr[r4] = /* @__PURE__ */ Object.create(null))) : e = he, e;
39584
39584
  }
39585
39585
  function Lt(r4, e) {
39586
39586
  let t = Array.isArray(r4) ? r4 : r4.entry?.map((n) => n.resource) ?? [];
39587
39587
  for (let n of t)
39588
- Ii(n, e);
39588
+ Bt(n, e);
39589
39589
  }
39590
- function Ii(r4, e) {
39590
+ function Bt(r4, e) {
39591
39591
  if (!r4?.name)
39592
39592
  throw new Error("Failed loading StructureDefinition from bundle");
39593
39593
  if (r4.resourceType !== "StructureDefinition")
39594
39594
  return;
39595
- let t = It(r4), n = Ut(e);
39596
- n[r4.name] = t, e && r4.url === e && (_t[e] = t);
39595
+ let t = It(r4), n = Mt(e);
39596
+ n[r4.name] = t, e && r4.url === e && (Ut[e] = t);
39597
39597
  for (let i2 of t.innerTypes)
39598
39598
  i2.parentType = t, n[i2.name] = i2;
39599
39599
  }
39600
- function Qr(r4) {
39600
+ function Hr(r4) {
39601
39601
  return !!he[r4];
39602
39602
  }
39603
- function qe(r4, e) {
39604
- return Ut(e)[r4];
39603
+ function ge(r4, e) {
39604
+ let t = Mt(e)[r4];
39605
+ return !t && e && (t = Mt()[r4]), t;
39605
39606
  }
39606
- function Gr(r4) {
39607
- return !!_t[r4];
39607
+ function Wr(r4) {
39608
+ return !!Ut[r4];
39608
39609
  }
39609
- var Mt = class {
39610
+ var Ft = class {
39610
39611
  constructor(e) {
39611
39612
  if (!e.snapshot?.element || e.snapshot.element.length === 0)
39612
39613
  throw new Error(`No snapshot defined for StructureDefinition '${e.name}'`);
@@ -39649,7 +39650,7 @@ var Mt = class {
39649
39650
  enterInnerType(e) {
39650
39651
  for (; this.backboneContext && !ae(this.backboneContext?.path, e.path); )
39651
39652
  this.innerTypes.push(this.backboneContext.type), this.backboneContext = this.backboneContext.parent;
39652
- this.backboneContext = { type: { name: Ft(e), title: e.label, description: e.definition, elements: {}, constraints: this.parseElementDefinition(e).constraints, innerTypes: [] }, path: e.path ?? "", parent: ae(this.backboneContext?.path, e.path) ? this.backboneContext : this.backboneContext?.parent };
39653
+ this.backboneContext = { type: { name: _t(e), title: e.label, description: e.definition, elements: {}, constraints: this.parseElementDefinition(e).constraints, innerTypes: [] }, path: e.path ?? "", parent: ae(this.backboneContext?.path, e.path) ? this.backboneContext : this.backboneContext?.parent };
39653
39654
  }
39654
39655
  enterSlice(e, t) {
39655
39656
  Vi(e) && !this.peek()?.sliceName || (t.slicing = { discriminator: (e.slicing?.discriminator ?? []).map((n) => {
@@ -39690,20 +39691,20 @@ var Mt = class {
39690
39691
  parseSliceStart(e) {
39691
39692
  if (!this.slicingContext)
39692
39693
  throw new Error(`Invalid slice start before discriminator: ${e.sliceName} (${e.id})`);
39693
- this.slicingContext.current && this.slicingContext.field.slices.push(this.slicingContext.current), this.slicingContext.current = { name: e.sliceName ?? "", path: e.path ?? "", definition: e.definition, type: this.parseElementDefinitionType(e), elements: {}, min: e.min ?? 0, max: e.max === "*" ? Number.POSITIVE_INFINITY : Number.parseInt(e.max, 10) };
39694
+ this.slicingContext.current && this.slicingContext.field.slices.push(this.slicingContext.current), this.slicingContext.current = { name: e.sliceName ?? "", path: e.path ?? "", definition: e.definition, type: this.parseElementDefinitionType(e), elements: {}, min: e.min ?? 0, max: e.max === "*" ? Number.POSITIVE_INFINITY : Number.parseInt(e.max, 10), binding: e.binding };
39694
39695
  }
39695
39696
  parseElementDefinitionType(e) {
39696
39697
  return (e.type ?? []).map((t) => {
39697
39698
  let n;
39698
- return (t.code === "BackboneElement" || t.code === "Element") && (n = Ft(e)), n || (n = gr(t, "http://hl7.org/fhir/StructureDefinition/structuredefinition-fhir-type")?.valueUrl), n || (n = t.code ?? ""), { code: n, targetProfile: t.targetProfile, profile: t.profile };
39699
+ return (t.code === "BackboneElement" || t.code === "Element") && (n = _t(e)), n || (n = xr(t, "http://hl7.org/fhir/StructureDefinition/structuredefinition-fhir-type")?.valueUrl), n || (n = t.code ?? ""), { code: n, targetProfile: t.targetProfile, profile: t.profile };
39699
39700
  });
39700
39701
  }
39701
39702
  parseElementDefinition(e) {
39702
- let t = qr(e.max), n = e.base?.max ? qr(e.base.max) : t, i2 = { type: "ElementDefinition", value: e };
39703
- 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: $r(A(i2, "fixed[x]")), pattern: $r(A(i2, "pattern[x]")), binding: e.binding };
39703
+ let t = jr(e.max), n = e.base?.max ? jr(e.base.max) : t, i2 = { type: "ElementDefinition", value: e };
39704
+ 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: Qr(A(i2, "fixed[x]")), pattern: Qr(A(i2, "pattern[x]")), binding: e.binding };
39704
39705
  }
39705
39706
  };
39706
- function qr(r4) {
39707
+ function jr(r4) {
39707
39708
  return r4 === "*" ? Number.POSITIVE_INFINITY : Number.parseInt(r4, 10);
39708
39709
  }
39709
39710
  function Nt(r4, e = "") {
@@ -39715,8 +39716,8 @@ function Oi(r4, e) {
39715
39716
  function ae(r4, e) {
39716
39717
  return !r4 || !e ? false : e.startsWith(r4 + ".") || e === r4;
39717
39718
  }
39718
- function $r(r4) {
39719
- return Array.isArray(r4) && r4.length > 0 ? r4[0] : R(r4) ? void 0 : r4;
39719
+ function Qr(r4) {
39720
+ return Array.isArray(r4) && r4.length > 0 ? r4[0] : S(r4) ? void 0 : r4;
39720
39721
  }
39721
39722
  function Vi(r4) {
39722
39723
  let e = r4.slicing?.discriminator;
@@ -39726,24 +39727,24 @@ function Di(r4) {
39726
39727
  let e = r4.description;
39727
39728
  return e?.startsWith(`Base StructureDefinition for ${r4.name} Type: `) && (e = e.substring(`Base StructureDefinition for ${r4.name} Type: `.length)), e;
39728
39729
  }
39729
- 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" };
39730
- function qt(r4) {
39730
+ var u = { 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" };
39731
+ function $t(r4) {
39731
39732
  for (let e of r4.base ?? []) {
39732
39733
  let t = N.types[e];
39733
39734
  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;
39734
39735
  }
39735
39736
  }
39736
- function Ft(r4) {
39737
+ function _t(r4) {
39737
39738
  let e = r4.type?.[0]?.code;
39738
39739
  return e === "BackboneElement" || e === "Element" ? Ni((r4.base?.path ?? r4.path)?.split(".")) : e;
39739
39740
  }
39740
39741
  function Ni(r4) {
39741
39742
  return r4.length === 1 ? r4[0] : r4.map(I).join("");
39742
39743
  }
39743
- function Be(r4, e) {
39744
- let t = qe(r4);
39745
- if (t)
39746
- return Ui(t.elements, e);
39744
+ function qe(r4, e, t) {
39745
+ let n = ge(r4, t);
39746
+ if (n)
39747
+ return Ui(n.elements, e);
39747
39748
  }
39748
39749
  function Ui(r4, e) {
39749
39750
  let t = r4[e] ?? r4[e + "[x]"];
@@ -39776,33 +39777,33 @@ function ce(r4) {
39776
39777
  return r4;
39777
39778
  }
39778
39779
  }
39779
- var ge = () => [];
39780
- var b = { empty: (r4, e) => d(e.length === 0), hasValue: (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) => {
39780
+ var ye = () => [];
39781
+ var R = { empty: (r4, e) => p(e.length === 0 || e.every((t) => S(t.value))), hasValue: (r4, e) => p(e.length !== 0), exists: (r4, e, t) => t ? p(e.filter((n) => D(t.eval(r4, [n]))).length > 0) : p(e.length > 0 && e.every((n) => !S(n.value))), all: (r4, e, t) => p(e.every((n) => D(t.eval(r4, [n])))), allTrue: (r4, e) => {
39781
39782
  for (let t of e)
39782
39783
  if (!t.value)
39783
- return d(false);
39784
- return d(true);
39784
+ return p(false);
39785
+ return p(true);
39785
39786
  }, anyTrue: (r4, e) => {
39786
39787
  for (let t of e)
39787
39788
  if (t.value)
39788
- return d(true);
39789
- return d(false);
39789
+ return p(true);
39790
+ return p(false);
39790
39791
  }, allFalse: (r4, e) => {
39791
39792
  for (let t of e)
39792
39793
  if (t.value)
39793
- return d(false);
39794
- return d(true);
39794
+ return p(false);
39795
+ return p(true);
39795
39796
  }, anyFalse: (r4, e) => {
39796
39797
  for (let t of e)
39797
39798
  if (!t.value)
39798
- return d(true);
39799
- return d(false);
39800
- }, subsetOf: ge, supersetOf: ge, count: (r4, e) => [{ type: c.integer, value: e.length }], distinct: (r4, e) => {
39799
+ return p(true);
39800
+ return p(false);
39801
+ }, subsetOf: ye, supersetOf: ye, count: (r4, e) => [{ type: u.integer, value: e.length }], distinct: (r4, e) => {
39801
39802
  let t = [];
39802
39803
  for (let n of e)
39803
39804
  t.some((i2) => i2.value === n.value) || t.push(n);
39804
39805
  return t;
39805
- }, 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: ge, ofType: (r4, e, t) => e.filter((n) => n.type === t.name), single: (r4, e) => {
39806
+ }, isDistinct: (r4, e) => p(e.length === R.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: ye, ofType: (r4, e, t) => e.filter((n) => n.type === t.name), single: (r4, e) => {
39806
39807
  if (e.length > 1)
39807
39808
  throw new Error("Expected input length one for single()");
39808
39809
  return e.length === 0 ? [] : e.slice(0, 1);
@@ -39834,7 +39835,7 @@ var b = { empty: (r4, e) => d(e.length === 0), hasValue: (r4, e) => d(e.length !
39834
39835
  if (!t)
39835
39836
  return e;
39836
39837
  let n = t.eval(r4, e);
39837
- return Ue([...e, ...n]);
39838
+ return Le([...e, ...n]);
39838
39839
  }, combine: (r4, e, t) => {
39839
39840
  if (!t)
39840
39841
  return e;
@@ -39850,76 +39851,76 @@ var b = { empty: (r4, e) => d(e.length === 0), hasValue: (r4, e) => d(e.length !
39850
39851
  return [];
39851
39852
  let [{ value: t }] = L(e, 1);
39852
39853
  if (typeof t == "boolean")
39853
- return [{ type: c.boolean, value: t }];
39854
+ return [{ type: u.boolean, value: t }];
39854
39855
  if (typeof t == "number" && (t === 0 || t === 1))
39855
- return d(!!t);
39856
+ return p(!!t);
39856
39857
  if (typeof t == "string") {
39857
39858
  let n = t.toLowerCase();
39858
39859
  if (["true", "t", "yes", "y", "1", "1.0"].includes(n))
39859
- return d(true);
39860
+ return p(true);
39860
39861
  if (["false", "f", "no", "n", "0", "0.0"].includes(n))
39861
- return d(false);
39862
+ return p(false);
39862
39863
  }
39863
39864
  return [];
39864
- }, convertsToBoolean: (r4, e) => e.length === 0 ? [] : d(b.toBoolean(r4, e).length === 1), toInteger: (r4, e) => {
39865
+ }, convertsToBoolean: (r4, e) => e.length === 0 ? [] : p(R.toBoolean(r4, e).length === 1), toInteger: (r4, e) => {
39865
39866
  if (e.length === 0)
39866
39867
  return [];
39867
39868
  let [{ value: t }] = L(e, 1);
39868
- 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 }] : [];
39869
- }, convertsToInteger: (r4, e) => e.length === 0 ? [] : d(b.toInteger(r4, e).length === 1), toDate: (r4, e) => {
39869
+ return typeof t == "number" ? [{ type: u.integer, value: t }] : typeof t == "string" && /^[+-]?\d+$/.exec(t) ? [{ type: u.integer, value: parseInt(t, 10) }] : typeof t == "boolean" ? [{ type: u.integer, value: t ? 1 : 0 }] : [];
39870
+ }, convertsToInteger: (r4, e) => e.length === 0 ? [] : p(R.toInteger(r4, e).length === 1), toDate: (r4, e) => {
39870
39871
  if (e.length === 0)
39871
39872
  return [];
39872
39873
  let [{ value: t }] = L(e, 1);
39873
- return typeof t == "string" && /^\d{4}(-\d{2}(-\d{2})?)?/.exec(t) ? [{ type: c.date, value: ce(t) }] : [];
39874
- }, convertsToDate: (r4, e) => e.length === 0 ? [] : d(b.toDate(r4, e).length === 1), toDateTime: (r4, e) => {
39874
+ return typeof t == "string" && /^\d{4}(-\d{2}(-\d{2})?)?/.exec(t) ? [{ type: u.date, value: ce(t) }] : [];
39875
+ }, convertsToDate: (r4, e) => e.length === 0 ? [] : p(R.toDate(r4, e).length === 1), toDateTime: (r4, e) => {
39875
39876
  if (e.length === 0)
39876
39877
  return [];
39877
39878
  let [{ value: t }] = L(e, 1);
39878
- return typeof t == "string" && /^\d{4}(-\d{2}(-\d{2})?)?/.exec(t) ? [{ type: c.dateTime, value: ce(t) }] : [];
39879
- }, convertsToDateTime: (r4, e) => e.length === 0 ? [] : d(b.toDateTime(r4, e).length === 1), toDecimal: (r4, e) => {
39879
+ return typeof t == "string" && /^\d{4}(-\d{2}(-\d{2})?)?/.exec(t) ? [{ type: u.dateTime, value: ce(t) }] : [];
39880
+ }, convertsToDateTime: (r4, e) => e.length === 0 ? [] : p(R.toDateTime(r4, e).length === 1), toDecimal: (r4, e) => {
39880
39881
  if (e.length === 0)
39881
39882
  return [];
39882
39883
  let [{ value: t }] = L(e, 1);
39883
- 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 }] : [];
39884
- }, convertsToDecimal: (r4, e) => e.length === 0 ? [] : d(b.toDecimal(r4, e).length === 1), toQuantity: (r4, e) => {
39884
+ return typeof t == "number" ? [{ type: u.decimal, value: t }] : typeof t == "string" && /^-?\d{1,9}(\.\d{1,9})?$/.exec(t) ? [{ type: u.decimal, value: parseFloat(t) }] : typeof t == "boolean" ? [{ type: u.decimal, value: t ? 1 : 0 }] : [];
39885
+ }, convertsToDecimal: (r4, e) => e.length === 0 ? [] : p(R.toDecimal(r4, e).length === 1), toQuantity: (r4, e) => {
39885
39886
  if (e.length === 0)
39886
39887
  return [];
39887
39888
  let [{ value: t }] = L(e, 1);
39888
- 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" } }] : [];
39889
- }, convertsToQuantity: (r4, e) => e.length === 0 ? [] : d(b.toQuantity(r4, e).length === 1), toString: (r4, e) => {
39889
+ return P(t) ? [{ type: u.Quantity, value: t }] : typeof t == "number" ? [{ type: u.Quantity, value: { value: t, unit: "1" } }] : typeof t == "string" && /^-?\d{1,9}(\.\d{1,9})?/.exec(t) ? [{ type: u.Quantity, value: { value: parseFloat(t), unit: "1" } }] : typeof t == "boolean" ? [{ type: u.Quantity, value: { value: t ? 1 : 0, unit: "1" } }] : [];
39890
+ }, convertsToQuantity: (r4, e) => e.length === 0 ? [] : p(R.toQuantity(r4, e).length === 1), toString: (r4, e) => {
39890
39891
  if (e.length === 0)
39891
39892
  return [];
39892
39893
  let [{ value: t }] = L(e, 1);
39893
- return t == null ? [] : P(t) ? [{ type: c.string, value: `${t.value} '${t.unit}'` }] : [{ type: c.string, value: t.toString() }];
39894
- }, convertsToString: (r4, e) => e.length === 0 ? [] : d(b.toString(r4, e).length === 1), toTime: (r4, e) => {
39894
+ return t == null ? [] : P(t) ? [{ type: u.string, value: `${t.value} '${t.unit}'` }] : [{ type: u.string, value: t.toString() }];
39895
+ }, convertsToString: (r4, e) => e.length === 0 ? [] : p(R.toString(r4, e).length === 1), toTime: (r4, e) => {
39895
39896
  if (e.length === 0)
39896
39897
  return [];
39897
39898
  let [{ value: t }] = L(e, 1);
39898
39899
  if (typeof t == "string") {
39899
39900
  let n = /^T?(\d{2}(:\d{2}(:\d{2})?)?)/.exec(t);
39900
39901
  if (n)
39901
- return [{ type: c.time, value: ce("T" + n[1]) }];
39902
+ return [{ type: u.time, value: ce("T" + n[1]) }];
39902
39903
  }
39903
39904
  return [];
39904
- }, 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) => {
39905
- let a = o, u2 = s ? a + s : i2.length;
39906
- return a < 0 || a >= i2.length ? void 0 : i2.substring(a, u2);
39907
- }, 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) => U(Math.abs, r4, e), ceiling: (r4, e) => U(Math.ceil, r4, e), exp: (r4, e) => U(Math.exp, r4, e), floor: (r4, e) => U(Math.floor, r4, e), ln: (r4, e) => U(Math.log, r4, e), log: (r4, e, t) => U((n, i2) => Math.log(n) / Math.log(i2), r4, e, t), power: (r4, e, t) => U(Math.pow, r4, e, t), round: (r4, e) => U(Math.round, r4, e), sqrt: (r4, e) => U(Math.sqrt, r4, e), truncate: (r4, e) => U((t) => t | 0, r4, e), children: ge, descendants: ge, trace: (r4, 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) => {
39908
- let o = b.toDateTime(r4, t.eval(r4, e));
39905
+ }, convertsToTime: (r4, e) => e.length === 0 ? [] : p(R.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) => {
39906
+ let a = o, c2 = s ? a + s : i2.length;
39907
+ return a < 0 || a >= i2.length ? void 0 : i2.substring(a, c2);
39908
+ }, 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) => U(Math.abs, r4, e), ceiling: (r4, e) => U(Math.ceil, r4, e), exp: (r4, e) => U(Math.exp, r4, e), floor: (r4, e) => U(Math.floor, r4, e), ln: (r4, e) => U(Math.log, r4, e), log: (r4, e, t) => U((n, i2) => Math.log(n) / Math.log(i2), r4, e, t), power: (r4, e, t) => U(Math.pow, r4, e, t), round: (r4, e) => U(Math.round, r4, e), sqrt: (r4, e) => U(Math.sqrt, r4, e), truncate: (r4, e) => U((t) => t | 0, r4, e), children: ye, descendants: ye, trace: (r4, e, t) => e, now: () => [{ type: u.dateTime, value: (/* @__PURE__ */ new Date()).toISOString() }], timeOfDay: () => [{ type: u.time, value: (/* @__PURE__ */ new Date()).toISOString().substring(11) }], today: () => [{ type: u.date, value: (/* @__PURE__ */ new Date()).toISOString().substring(0, 10) }], between: (r4, e, t, n, i2) => {
39909
+ let o = R.toDateTime(r4, t.eval(r4, e));
39909
39910
  if (o.length === 0)
39910
39911
  throw new Error("Invalid start date");
39911
- let s = b.toDateTime(r4, n.eval(r4, e));
39912
+ let s = R.toDateTime(r4, n.eval(r4, e));
39912
39913
  if (s.length === 0)
39913
39914
  throw new Error("Invalid end date");
39914
39915
  let a = i2.eval(r4, e)[0]?.value;
39915
39916
  if (a !== "years" && a !== "months" && a !== "days")
39916
39917
  throw new Error("Invalid units");
39917
- let u2 = ke(o[0].value, s[0].value);
39918
- return [{ type: c.Quantity, value: { value: u2[a], unit: a } }];
39918
+ let c2 = Oe(o[0].value, s[0].value);
39919
+ return [{ type: u.Quantity, value: { value: c2[a], unit: a } }];
39919
39920
  }, is: (r4, e, t) => {
39920
39921
  let n = "";
39921
- 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: Le(i2, n) })) : [];
39922
- }, not: (r4, e) => b.toBoolean(r4, e).map((t) => ({ type: c.boolean, value: !t.value })), resolve: (r4, e) => e.map((t) => {
39922
+ return t instanceof B ? n = t.name : t instanceof H && (n = t.left.name + "." + t.right.name), n ? e.map((i2) => ({ type: u.boolean, value: Be(i2, n) })) : [];
39923
+ }, not: (r4, e) => R.toBoolean(r4, e).map((t) => ({ type: u.boolean, value: !t.value })), resolve: (r4, e) => e.map((t) => {
39923
39924
  let n = t.value, i2;
39924
39925
  if (typeof n == "string")
39925
39926
  i2 = n;
@@ -39937,13 +39938,13 @@ var b = { empty: (r4, e) => d(e.length === 0), hasValue: (r4, e) => d(e.length !
39937
39938
  let [o, s] = i2.split("/");
39938
39939
  return { type: o, value: { resourceType: o, id: s } };
39939
39940
  }
39940
- return { type: c.BackboneElement, value: void 0 };
39941
- }).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" } } : F(t) ? { type: c.BackboneElement, value: { namespace: "FHIR", name: t.resourceType } } : { type: c.BackboneElement, value: null }), conformsTo: (r4, e, t) => {
39941
+ return { type: u.BackboneElement, value: void 0 };
39942
+ }).filter((t) => !!t.value), as: (r4, e) => e, type: (r4, e) => e.map(({ value: t }) => typeof t == "boolean" ? { type: u.BackboneElement, value: { namespace: "System", name: "Boolean" } } : typeof t == "number" ? { type: u.BackboneElement, value: { namespace: "System", name: "Integer" } } : F(t) ? { type: u.BackboneElement, value: { namespace: "FHIR", name: t.resourceType } } : { type: u.BackboneElement, value: null }), conformsTo: (r4, e, t) => {
39942
39943
  let n = t.eval(r4, e)[0].value;
39943
39944
  if (!n.startsWith("http://hl7.org/fhir/StructureDefinition/"))
39944
39945
  throw new Error("Expected a StructureDefinition URL");
39945
39946
  let i2 = n.replace("http://hl7.org/fhir/StructureDefinition/", "");
39946
- return e.map((o) => ({ type: c.boolean, value: o.value?.resourceType === i2 }));
39947
+ return e.map((o) => ({ type: u.boolean, value: o.value?.resourceType === i2 }));
39947
39948
  } };
39948
39949
  function k(r4, e, t, ...n) {
39949
39950
  if (t.length === 0)
@@ -39960,8 +39961,8 @@ function U(r4, e, t, ...n) {
39960
39961
  let [{ value: i2 }] = L(t, 1), o = P(i2), s = o ? i2.value : i2;
39961
39962
  if (typeof s != "number")
39962
39963
  throw new Error("Math function cannot be called with non-number");
39963
- 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;
39964
- return [{ type: u2, value: l2 }];
39964
+ let a = r4(s, ...n.map((d2) => d2.eval(e, t)[0]?.value)), c2 = o ? u.Quantity : t[0].type, l2 = o ? { ...i2, value: a } : a;
39965
+ return [{ type: c2, value: l2 }];
39965
39966
  }
39966
39967
  function L(r4, e) {
39967
39968
  if (r4.length !== e)
@@ -40014,7 +40015,7 @@ var je = class {
40014
40015
  return "{}";
40015
40016
  }
40016
40017
  };
40017
- var Qe = class extends Pe {
40018
+ var Qe = class extends Ce {
40018
40019
  constructor(t, n, i2) {
40019
40020
  super(t, n);
40020
40021
  this.impl = i2;
@@ -40031,12 +40032,12 @@ var Z = class extends Q {
40031
40032
  super("as", e, t);
40032
40033
  }
40033
40034
  eval(e, t) {
40034
- return b.ofType(e, this.left.eval(e, t), this.right);
40035
+ return R.ofType(e, this.left.eval(e, t), this.right);
40035
40036
  }
40036
40037
  };
40037
- var S = class extends Q {
40038
+ var E = class extends Q {
40038
40039
  };
40039
- var C = class extends S {
40040
+ var C = class extends E {
40040
40041
  constructor(t, n, i2, o) {
40041
40042
  super(t, n, i2);
40042
40043
  this.impl = o;
@@ -40048,38 +40049,38 @@ var C = class extends S {
40048
40049
  let o = this.right.eval(t, n);
40049
40050
  if (o.length !== 1)
40050
40051
  return [];
40051
- let s = i2[0].value, a = o[0].value, u2 = P(s) ? s.value : s, l2 = P(a) ? a.value : a, f = this.impl(u2, l2);
40052
- return typeof f == "boolean" ? d(f) : P(s) ? [{ type: c.Quantity, value: { ...s, value: f } }] : [g(f)];
40052
+ let s = i2[0].value, a = o[0].value, c2 = P(s) ? s.value : s, l2 = P(a) ? a.value : a, d2 = this.impl(c2, l2);
40053
+ return typeof d2 == "boolean" ? p(d2) : P(s) ? [{ type: u.Quantity, value: { ...s, value: d2 } }] : [g(d2)];
40053
40054
  }
40054
40055
  };
40055
- var He = class extends Q {
40056
+ var Ge = class extends Q {
40056
40057
  constructor(e, t) {
40057
40058
  super("&", e, t);
40058
40059
  }
40059
40060
  eval(e, t) {
40060
40061
  let n = this.left.eval(e, t), i2 = this.right.eval(e, t), o = [...n, ...i2];
40061
- return o.length > 0 && o.every((s) => typeof s.value == "string") ? [{ type: c.string, value: o.map((s) => s.value).join("") }] : o;
40062
+ return o.length > 0 && o.every((s) => typeof s.value == "string") ? [{ type: u.string, value: o.map((s) => s.value).join("") }] : o;
40062
40063
  }
40063
40064
  };
40064
- var Ge = class extends S {
40065
+ var He = class extends E {
40065
40066
  constructor(e, t) {
40066
40067
  super("contains", e, t);
40067
40068
  }
40068
40069
  eval(e, t) {
40069
40070
  let n = this.left.eval(e, t), i2 = this.right.eval(e, t);
40070
- return d(n.some((o) => o.value === i2[0].value));
40071
+ return p(n.some((o) => o.value === i2[0].value));
40071
40072
  }
40072
40073
  };
40073
- var Ke = class extends S {
40074
+ var Ke = class extends E {
40074
40075
  constructor(e, t) {
40075
40076
  super("in", e, t);
40076
40077
  }
40077
40078
  eval(e, t) {
40078
40079
  let n = _(this.left.eval(e, t)), i2 = this.right.eval(e, t);
40079
- return n ? d(i2.some((o) => o.value === n.value)) : [];
40080
+ return n ? p(i2.some((o) => o.value === n.value)) : [];
40080
40081
  }
40081
40082
  };
40082
- var G = class extends Q {
40083
+ var H = class extends Q {
40083
40084
  constructor(e, t) {
40084
40085
  super(".", e, t);
40085
40086
  }
@@ -40096,10 +40097,10 @@ var ue = class extends Q {
40096
40097
  }
40097
40098
  eval(e, t) {
40098
40099
  let n = this.left.eval(e, t), i2 = this.right.eval(e, t);
40099
- return Ue([...n, ...i2]);
40100
+ return Le([...n, ...i2]);
40100
40101
  }
40101
40102
  };
40102
- var We = class extends S {
40103
+ var We = class extends E {
40103
40104
  constructor(e, t) {
40104
40105
  super("=", e, t);
40105
40106
  }
@@ -40108,7 +40109,7 @@ var We = class extends S {
40108
40109
  return Ot(n, i2);
40109
40110
  }
40110
40111
  };
40111
- var ze = class extends S {
40112
+ var ze = class extends E {
40112
40113
  constructor(e, t) {
40113
40114
  super("!=", e, t);
40114
40115
  }
@@ -40117,7 +40118,7 @@ var ze = class extends S {
40117
40118
  return kt(Ot(n, i2));
40118
40119
  }
40119
40120
  };
40120
- var Je = class extends S {
40121
+ var Je = class extends E {
40121
40122
  constructor(e, t) {
40122
40123
  super("~", e, t);
40123
40124
  }
@@ -40126,7 +40127,7 @@ var Je = class extends S {
40126
40127
  return Vt(n, i2);
40127
40128
  }
40128
40129
  };
40129
- var Ye = class extends S {
40130
+ var Ye = class extends E {
40130
40131
  constructor(e, t) {
40131
40132
  super("!~", e, t);
40132
40133
  }
@@ -40135,7 +40136,7 @@ var Ye = class extends S {
40135
40136
  return kt(Vt(n, i2));
40136
40137
  }
40137
40138
  };
40138
- var X = class extends S {
40139
+ var X = class extends E {
40139
40140
  constructor(e, t) {
40140
40141
  super("is", e, t);
40141
40142
  }
@@ -40144,43 +40145,43 @@ var X = class extends S {
40144
40145
  if (n.length !== 1)
40145
40146
  return [];
40146
40147
  let i2 = this.right.name;
40147
- return d(Le(n[0], i2));
40148
+ return p(Be(n[0], i2));
40148
40149
  }
40149
40150
  };
40150
- var Ze = class extends S {
40151
+ var Ze = class extends E {
40151
40152
  constructor(e, t) {
40152
40153
  super("and", e, t);
40153
40154
  }
40154
40155
  eval(e, t) {
40155
40156
  let n = _(this.left.eval(e, t), "boolean"), i2 = _(this.right.eval(e, t), "boolean");
40156
- return n?.value === true && i2?.value === true ? d(true) : n?.value === false || i2?.value === false ? d(false) : [];
40157
+ return n?.value === true && i2?.value === true ? p(true) : n?.value === false || i2?.value === false ? p(false) : [];
40157
40158
  }
40158
40159
  };
40159
- var Xe = class extends S {
40160
+ var Xe = class extends E {
40160
40161
  constructor(e, t) {
40161
40162
  super("or", e, t);
40162
40163
  }
40163
40164
  eval(e, t) {
40164
40165
  let n = _(this.left.eval(e, t), "boolean"), i2 = _(this.right.eval(e, t), "boolean");
40165
- return n?.value === false && i2?.value === false ? d(false) : n?.value || i2?.value ? d(true) : [];
40166
+ return n?.value === false && i2?.value === false ? p(false) : n?.value || i2?.value ? p(true) : [];
40166
40167
  }
40167
40168
  };
40168
- var et = class extends S {
40169
+ var et = class extends E {
40169
40170
  constructor(e, t) {
40170
40171
  super("xor", e, t);
40171
40172
  }
40172
40173
  eval(e, t) {
40173
40174
  let n = _(this.left.eval(e, t), "boolean"), i2 = _(this.right.eval(e, t), "boolean");
40174
- return !n || !i2 ? [] : d(n.value !== i2.value);
40175
+ return !n || !i2 ? [] : p(n.value !== i2.value);
40175
40176
  }
40176
40177
  };
40177
- var tt = class extends S {
40178
+ var tt = class extends E {
40178
40179
  constructor(e, t) {
40179
40180
  super("implies", e, t);
40180
40181
  }
40181
40182
  eval(e, t) {
40182
40183
  let n = _(this.left.eval(e, t), "boolean"), i2 = _(this.right.eval(e, t), "boolean");
40183
- return i2?.value === true || n?.value === false ? d(true) : !n || !i2 ? [] : d(false);
40184
+ return i2?.value === true || n?.value === false ? p(true) : !n || !i2 ? [] : p(false);
40184
40185
  }
40185
40186
  };
40186
40187
  var j = class {
@@ -40189,7 +40190,7 @@ var j = class {
40189
40190
  this.args = t;
40190
40191
  }
40191
40192
  eval(e, t) {
40192
- let n = b[this.name];
40193
+ let n = R[this.name];
40193
40194
  if (!n)
40194
40195
  throw new Error("Unrecognized function: " + this.name);
40195
40196
  return n(e, t, ...this.args);
@@ -40217,7 +40218,7 @@ var ee = class {
40217
40218
  return `${this.left.toString()}[${this.expr.toString()}]`;
40218
40219
  }
40219
40220
  };
40220
- var xe = ["!=", "!~", "<=", ">=", "{}", "->"];
40221
+ var Te = ["!=", "!~", "<=", ">=", "{}", "->"];
40221
40222
  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 };
40222
40223
  var qi = { parse(r4) {
40223
40224
  let e = r4.consumeAndParse();
@@ -40243,32 +40244,32 @@ function Qi(r4) {
40243
40244
  let e = r4.split(" "), t = parseFloat(e[0]), n = e[1];
40244
40245
  return n?.startsWith("'") && n.endsWith("'") ? n = n.substring(1, n.length - 1) : n = "{" + n + "}", { value: t, unit: n };
40245
40246
  }
40246
- function Te() {
40247
- return new Ce().registerPrefix("String", { parse: (r4, e) => new O({ type: c.string, value: e.value }) }).registerPrefix("DateTime", { parse: (r4, e) => new O({ type: c.dateTime, value: ce(e.value) }) }).registerPrefix("Quantity", { parse: (r4, e) => new O({ type: c.Quantity, value: Qi(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 je() }).registerPrefix("(", qi).registerInfix("[", $i).registerInfix("(", ji).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 ue(r4, t)).infixLeft("=", m.Equals, (r4, e, t) => new We(r4, t)).infixLeft("!=", m.NotEquals, (r4, e, t) => new ze(r4, t)).infixLeft("~", m.Equivalent, (r4, e, t) => new Je(r4, t)).infixLeft("!~", m.NotEquivalent, (r4, e, t) => new Ye(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 He(r4, t)).infixLeft("and", m.And, (r4, e, t) => new Ze(r4, t)).infixLeft("as", m.As, (r4, e, t) => new Z(r4, t)).infixLeft("contains", m.Contains, (r4, e, t) => new Ge(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 Ke(r4, t)).infixLeft("is", m.Is, (r4, e, t) => new X(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 Xe(r4, t)).infixLeft("xor", m.Xor, (r4, e, t) => new et(r4, t)).infixLeft("implies", m.Implies, (r4, e, t) => new tt(r4, t));
40247
+ function ve() {
40248
+ return new Ae().registerPrefix("String", { parse: (r4, e) => new O({ type: u.string, value: e.value }) }).registerPrefix("DateTime", { parse: (r4, e) => new O({ type: u.dateTime, value: ce(e.value) }) }).registerPrefix("Quantity", { parse: (r4, e) => new O({ type: u.Quantity, value: Qi(e.value) }) }).registerPrefix("Number", { parse: (r4, e) => new O({ type: e.value.includes(".") ? u.decimal : u.integer, value: parseFloat(e.value) }) }).registerPrefix("true", { parse: () => new O({ type: u.boolean, value: true }) }).registerPrefix("false", { parse: () => new O({ type: u.boolean, value: false }) }).registerPrefix("Symbol", { parse: (r4, e) => new B(e.value) }).registerPrefix("{}", { parse: () => new je() }).registerPrefix("(", qi).registerInfix("[", $i).registerInfix("(", ji).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 H(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 ue(r4, t)).infixLeft("=", m.Equals, (r4, e, t) => new We(r4, t)).infixLeft("!=", m.NotEquals, (r4, e, t) => new ze(r4, t)).infixLeft("~", m.Equivalent, (r4, e, t) => new Je(r4, t)).infixLeft("!~", m.NotEquivalent, (r4, e, t) => new Ye(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 Ge(r4, t)).infixLeft("and", m.And, (r4, e, t) => new Ze(r4, t)).infixLeft("as", m.As, (r4, e, t) => new Z(r4, t)).infixLeft("contains", m.Contains, (r4, e, t) => new He(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 Ke(r4, t)).infixLeft("is", m.Is, (r4, e, t) => new X(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 Xe(r4, t)).infixLeft("xor", m.Xor, (r4, e, t) => new et(r4, t)).infixLeft("implies", m.Implies, (r4, e, t) => new tt(r4, t));
40248
40249
  }
40249
- var Hi = Te();
40250
- var Jr = ((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))(Jr || {});
40250
+ var Gi = ve();
40251
+ var Zr = ((d2) => (d2.BOOLEAN = "BOOLEAN", d2.NUMBER = "NUMBER", d2.QUANTITY = "QUANTITY", d2.TEXT = "TEXT", d2.REFERENCE = "REFERENCE", d2.CANONICAL = "CANONICAL", d2.DATE = "DATE", d2.DATETIME = "DATETIME", d2.PERIOD = "PERIOD", d2.UUID = "UUID", d2))(Zr || {});
40251
40252
  var Zi = ((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))(Zi || {});
40252
40253
  var vo = ((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))(vo || {});
40253
- function un(r4) {
40254
+ function dn(r4) {
40254
40255
  if (typeof window < "u")
40255
40256
  return window.atob(r4);
40256
40257
  if (typeof Buffer < "u")
40257
40258
  return Buffer.from(r4, "base64").toString("binary");
40258
40259
  throw new Error("Unable to decode base64");
40259
40260
  }
40260
- function ln(r4) {
40261
+ function pn(r4) {
40261
40262
  if (typeof window < "u")
40262
40263
  return window.btoa(r4);
40263
40264
  if (typeof Buffer < "u")
40264
40265
  return Buffer.from(r4, "binary").toString("base64");
40265
40266
  throw new Error("Unable to encode base64");
40266
40267
  }
40267
- function Wt() {
40268
+ function zt() {
40268
40269
  let r4 = new Uint32Array(28);
40269
- return crypto.getRandomValues(r4), vr(r4.buffer);
40270
+ return crypto.getRandomValues(r4), Er(r4.buffer);
40270
40271
  }
40271
- async function dn(r4) {
40272
+ async function fn(r4) {
40272
40273
  return crypto.subtle.digest("SHA-256", new TextEncoder().encode(r4));
40273
40274
  }
40274
40275
  function te() {
@@ -40301,8 +40302,8 @@ var nt = class {
40301
40302
  return this.cache.keys().next().value;
40302
40303
  }
40303
40304
  };
40304
- 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" };
40305
- var Se = class {
40305
+ 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", PING: "x-application/ping" };
40306
+ var Ee = class {
40306
40307
  constructor() {
40307
40308
  this.listeners = {};
40308
40309
  }
@@ -40329,7 +40330,7 @@ var Se = class {
40329
40330
  };
40330
40331
  var it = class {
40331
40332
  constructor() {
40332
- this.emitter = new Se();
40333
+ this.emitter = new Ee();
40333
40334
  }
40334
40335
  dispatchEvent(e) {
40335
40336
  this.emitter.dispatchEvent(e);
@@ -40341,28 +40342,28 @@ var it = class {
40341
40342
  this.emitter.removeEventListener(e, t);
40342
40343
  }
40343
40344
  };
40344
- var zt = { "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" };
40345
+ var Jt = { "Patient-open": "Patient-open", "Patient-close": "Patient-close", "ImagingStudy-open": "ImagingStudy-open", "ImagingStudy-close": "ImagingStudy-close", "Encounter-open": "Encounter-open", "Encounter-close": "Encounter-close", "DiagnosticReport-open": "DiagnosticReport-open", "DiagnosticReport-close": "DiagnosticReport-close", "DiagnosticReport-select": "DiagnosticReport-select", "DiagnosticReport-update": "DiagnosticReport-update", syncerror: "syncerror" };
40345
40346
  var Io = ["Patient", "Encounter", "ImagingStudy", "DiagnosticReport", "OperationOutcome", "Bundle"];
40346
- var Jt = ["DiagnosticReport-update"];
40347
- function mn(r4) {
40348
- return Jt.includes(r4);
40347
+ var Yt = ["DiagnosticReport-update"];
40348
+ function gn(r4) {
40349
+ return Yt.includes(r4);
40349
40350
  }
40350
- function hn(r4) {
40351
- if (Jt.includes(r4))
40352
- throw new p(h(`'context.version' is required for '${r4}'.`));
40351
+ function yn(r4) {
40352
+ if (Yt.includes(r4))
40353
+ throw new f(h(`'context.version' is required for '${r4}'.`));
40353
40354
  }
40354
40355
  var ko = { "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" } } };
40355
40356
  function Oo(r4) {
40356
40357
  return Io.includes(r4);
40357
40358
  }
40358
- function gn(r4) {
40359
+ function xn(r4) {
40359
40360
  return !!r4.endpoint;
40360
40361
  }
40361
- function Yt(r4) {
40362
+ function Zt(r4) {
40362
40363
  if (!st(r4))
40363
- throw new p(h("subscriptionRequest must be an object conforming to SubscriptionRequest type."));
40364
+ throw new f(h("subscriptionRequest must be an object conforming to SubscriptionRequest type."));
40364
40365
  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(",") };
40365
- return gn(r4) && (o.endpoint = r4.endpoint), new URLSearchParams(o).toString();
40366
+ return xn(r4) && (o.endpoint = r4.endpoint), new URLSearchParams(o).toString();
40366
40367
  }
40367
40368
  function st(r4) {
40368
40369
  if (typeof r4 != "object")
@@ -40371,34 +40372,34 @@ function st(r4) {
40371
40372
  if (!(e && t && n && i2) || typeof n != "string" || typeof i2 != "object" || !Array.isArray(i2) || i2.length < 1 || e !== "websocket" || t !== "subscribe" && t !== "unsubscribe")
40372
40373
  return false;
40373
40374
  for (let o of i2)
40374
- if (!zt[o])
40375
+ if (!Jt[o])
40375
40376
  return false;
40376
- return !(gn(r4) && !(typeof r4.endpoint == "string" && r4.endpoint.startsWith("ws")));
40377
+ return !(xn(r4) && !(typeof r4.endpoint == "string" && r4.endpoint.startsWith("ws")));
40377
40378
  }
40378
- function fn(r4, e, t, n) {
40379
+ function hn(r4, e, t, n) {
40379
40380
  if (typeof e != "object")
40380
- throw new p(h(`context[${t}] is invalid. Context must contain a single valid FHIR resource! Resource is not an object.`));
40381
+ throw new f(h(`context[${t}] is invalid. Context must contain a single valid FHIR resource! Resource is not an object.`));
40381
40382
  if (!(e.id && typeof e.id == "string"))
40382
- throw new p(h(`context[${t}] is invalid. Resource must contain a valid string ID.`));
40383
+ throw new f(h(`context[${t}] is invalid. Resource must contain a valid string ID.`));
40383
40384
  if (!e.resourceType)
40384
- throw new p(h(`context[${t}] is invalid. Resource must contain a resource type. No resource type found.`));
40385
+ throw new f(h(`context[${t}] is invalid. Resource must contain a resource type. No resource type found.`));
40385
40386
  let i2 = n.resourceType;
40386
40387
  if (i2 !== "*") {
40387
40388
  if (!Oo(e.resourceType))
40388
- throw new p(h(`context[${t}] is invalid. Resource must contain a valid FHIRcast resource type. Resource type is not a known resource type.`));
40389
+ throw new f(h(`context[${t}] is invalid. Resource must contain a valid FHIRcast resource type. Resource type is not a known resource type.`));
40389
40390
  if (i2 && e.resourceType !== i2)
40390
- throw new p(h(`context[${t}] is invalid. context[${t}] for the '${r4}' event should contain resource of type ${i2}.`));
40391
+ throw new f(h(`context[${t}] is invalid. context[${t}] for the '${r4}' event should contain resource of type ${i2}.`));
40391
40392
  }
40392
40393
  }
40393
40394
  function Vo(r4, e, t, n, i2) {
40394
40395
  if (i2.set(e.key, (i2.get(e.key) ?? 0) + 1), !n.isArray)
40395
- fn(r4, e.resource, t, n);
40396
+ hn(r4, e.resource, t, n);
40396
40397
  else {
40397
40398
  let { resources: o } = e;
40398
40399
  if (!o)
40399
- 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'.`));
40400
+ 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'.`));
40400
40401
  for (let s of o)
40401
- fn(r4, s, t, n);
40402
+ hn(r4, s, t, n);
40402
40403
  }
40403
40404
  }
40404
40405
  function Do(r4, e) {
@@ -40406,34 +40407,34 @@ function Do(r4, e) {
40406
40407
  for (let i2 = 0; i2 < e.length; i2++) {
40407
40408
  let o = e[i2].key;
40408
40409
  if (!n[o])
40409
- throw new p(h(`Key '${o}' not found for event '${r4}'. Make sure to add only valid keys.`));
40410
+ throw new f(h(`Key '${o}' not found for event '${r4}'. Make sure to add only valid keys.`));
40410
40411
  Vo(r4, e[i2], i2, n[o], t);
40411
40412
  }
40412
40413
  for (let [i2, o] of Object.entries(n)) {
40413
40414
  if (!(o.optional || t.has(i2)))
40414
- throw new p(h(`Missing required key '${i2}' on context for '${r4}' event.`));
40415
+ throw new f(h(`Missing required key '${i2}' on context for '${r4}' event.`));
40415
40416
  if (!o.manyAllowed && (t.get(i2) || 0) > 1)
40416
- throw new p(h(`${t.get(i2)} context entries with key '${i2}' found for the '${r4}' event when schema only allows for 1.`));
40417
+ throw new f(h(`${t.get(i2)} context entries with key '${i2}' found for the '${r4}' event when schema only allows for 1.`));
40417
40418
  }
40418
40419
  }
40419
- function Zt(r4, e, t, n) {
40420
+ function Xt(r4, e, t, n) {
40420
40421
  if (!(r4 && typeof r4 == "string"))
40421
- throw new p(h("Must provide a topic."));
40422
- if (!zt[e])
40423
- throw new p(h(`Must provide a valid FHIRcast event name. Supported events: ${Object.keys(zt).join(", ")}`));
40422
+ throw new f(h("Must provide a topic."));
40423
+ if (!Jt[e])
40424
+ throw new f(h(`Must provide a valid FHIRcast event name. Supported events: ${Object.keys(Jt).join(", ")}`));
40424
40425
  if (typeof t != "object")
40425
- throw new p(h("context must be a context object or array of context objects."));
40426
- if (Jt.includes(e) && !n)
40427
- throw new p(h(`The '${e}' event must contain a 'context.versionId'.`));
40426
+ throw new f(h("context must be a context object or array of context objects."));
40427
+ if (Yt.includes(e) && !n)
40428
+ throw new f(h(`The '${e}' event must contain a 'context.versionId'.`));
40428
40429
  let i2 = Array.isArray(t) ? t : [t];
40429
40430
  return Do(e, i2), { timestamp: (/* @__PURE__ */ new Date()).toISOString(), id: te(), event: { "hub.topic": r4, "hub.event": e, context: i2, ...n ? { "context.versionId": n } : {} } };
40430
40431
  }
40431
40432
  var ot = class extends it {
40432
40433
  constructor(e) {
40433
40434
  if (super(), this.subRequest = e, !e.endpoint)
40434
- throw new p(h("Subscription request should contain an endpoint."));
40435
+ throw new f(h("Subscription request should contain an endpoint."));
40435
40436
  if (!st(e))
40436
- throw new p(h("Subscription request failed validation."));
40437
+ throw new f(h("Subscription request failed validation."));
40437
40438
  let t = new WebSocket(e.endpoint);
40438
40439
  t.addEventListener("open", () => {
40439
40440
  this.dispatchEvent({ type: "connect" }), t.addEventListener("message", (n) => {
@@ -40452,27 +40453,27 @@ var ot = class extends it {
40452
40453
  }
40453
40454
  };
40454
40455
  function No(r4) {
40455
- let e = r4.replace(/-/g, "+").replace(/_/g, "/"), t = un(e), n = Array.from(t).reduce((o, s) => {
40456
+ let e = r4.replace(/-/g, "+").replace(/_/g, "/"), t = dn(e), n = Array.from(t).reduce((o, s) => {
40456
40457
  let a = ("00" + s.charCodeAt(0).toString(16)).slice(-2);
40457
40458
  return `${o}%${a}`;
40458
40459
  }, ""), i2 = decodeURIComponent(n);
40459
40460
  return JSON.parse(i2);
40460
40461
  }
40461
- function yn(r4) {
40462
+ function Tn(r4) {
40462
40463
  return r4.split(".").length === 3;
40463
40464
  }
40464
40465
  function at(r4) {
40465
40466
  let [e, t, n] = r4.split(".");
40466
40467
  return No(t);
40467
40468
  }
40468
- function xn(r4) {
40469
+ function vn(r4) {
40469
40470
  try {
40470
40471
  return typeof at(r4).login_id == "string";
40471
40472
  } catch {
40472
40473
  return false;
40473
40474
  }
40474
40475
  }
40475
- function Tn(r4) {
40476
+ function Sn(r4) {
40476
40477
  try {
40477
40478
  let t = at(r4).exp;
40478
40479
  return typeof t == "number" ? t * 1e3 : void 0;
@@ -40516,9 +40517,9 @@ var w = class {
40516
40517
  }
40517
40518
  };
40518
40519
  Mo = Symbol.toStringTag;
40519
- var Ee = class {
40520
+ var be = class {
40520
40521
  constructor(e) {
40521
- this.storage = e ?? (typeof localStorage < "u" ? localStorage : new Xt());
40522
+ this.storage = e ?? (typeof localStorage < "u" ? localStorage : new er());
40522
40523
  }
40523
40524
  clear() {
40524
40525
  this.storage.clear();
@@ -40534,10 +40535,10 @@ var Ee = class {
40534
40535
  return t ? JSON.parse(t) : void 0;
40535
40536
  }
40536
40537
  setObject(e, t) {
40537
- this.setString(e, t ? yr(t) : void 0);
40538
+ this.setString(e, t ? Tr(t) : void 0);
40538
40539
  }
40539
40540
  };
40540
- var Xt = class {
40541
+ var er = class {
40541
40542
  constructor() {
40542
40543
  this.data = /* @__PURE__ */ new Map();
40543
40544
  }
@@ -40565,19 +40566,19 @@ var _o = "https://api.medplum.com/";
40565
40566
  var Uo = 1e3;
40566
40567
  var Lo = 6e4;
40567
40568
  var Bo = 0;
40568
- var Sn = "Binary/";
40569
- var En = { resourceType: "Device", id: "system", deviceName: [{ type: "model-name", name: "System" }] };
40569
+ var bn = "Binary/";
40570
+ var Rn = { resourceType: "Device", id: "system", deviceName: [{ type: "model-name", name: "System" }] };
40570
40571
  var qo = ((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))(qo || {});
40571
40572
  var $o = ((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))($o || {});
40572
40573
  var jo = ((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))(jo || {});
40573
40574
  var Qo = ((e) => (e.JwtBearer = "urn:ietf:params:oauth:client-assertion-type:jwt-bearer", e))(Qo || {});
40574
- var bn = class extends Se {
40575
+ var Pn = class extends Ee {
40575
40576
  constructor(t) {
40576
40577
  super();
40577
40578
  this.initComplete = true;
40578
40579
  if (t?.baseUrl && !t.baseUrl.startsWith("http"))
40579
40580
  throw new Error("Base URL must start with http or https");
40580
- if (this.options = t ?? {}, this.fetch = t?.fetch ?? Ho(), this.storage = t?.storage ?? new Ee(), this.createPdfImpl = t?.createPdf, this.baseUrl = Pn(t?.baseUrl ?? _o), this.fhirBaseUrl = Pn(ct(this.baseUrl, t?.fhirUrlPath ?? "fhir/R4/")), this.authorizeUrl = ct(this.baseUrl, t?.authorizeUrl ?? "oauth2/authorize"), this.tokenUrl = ct(this.baseUrl, t?.tokenUrl ?? "oauth2/token"), this.logoutUrl = ct(this.baseUrl, t?.logoutUrl ?? "oauth2/logout"), this.clientId = t?.clientId ?? "", this.clientSecret = t?.clientSecret ?? "", this.onUnauthenticated = t?.onUnauthenticated, this.cacheTime = t?.cacheTime ?? (typeof window > "u" ? Bo : Lo), this.cacheTime > 0 ? this.requestCache = new nt(t?.resourceCacheSize ?? Uo) : this.requestCache = void 0, t?.autoBatchTime ? (this.autoBatchTime = t.autoBatchTime, this.autoBatchQueue = []) : (this.autoBatchTime = 0, this.autoBatchQueue = void 0), t?.accessToken)
40581
+ if (this.options = t ?? {}, this.fetch = t?.fetch ?? Go(), this.storage = t?.storage ?? new be(), this.createPdfImpl = t?.createPdf, this.baseUrl = An(t?.baseUrl ?? _o), this.fhirBaseUrl = An(ct(this.baseUrl, t?.fhirUrlPath ?? "fhir/R4/")), this.authorizeUrl = ct(this.baseUrl, t?.authorizeUrl ?? "oauth2/authorize"), this.tokenUrl = ct(this.baseUrl, t?.tokenUrl ?? "oauth2/token"), this.logoutUrl = ct(this.baseUrl, t?.logoutUrl ?? "oauth2/logout"), this.clientId = t?.clientId ?? "", this.clientSecret = t?.clientSecret ?? "", this.onUnauthenticated = t?.onUnauthenticated, this.cacheTime = t?.cacheTime ?? (typeof window > "u" ? Bo : Lo), this.cacheTime > 0 ? this.requestCache = new nt(t?.resourceCacheSize ?? Uo) : this.requestCache = void 0, t?.autoBatchTime ? (this.autoBatchTime = t.autoBatchTime, this.autoBatchQueue = []) : (this.autoBatchTime = 0, this.autoBatchQueue = void 0), t?.accessToken)
40581
40582
  this.setAccessToken(t.accessToken), this.initPromise = Promise.resolve();
40582
40583
  else if (this.storage.getInitPromise !== void 0) {
40583
40584
  let n = this.storage.getInitPromise(), i2 = new Promise((o) => {
@@ -40636,8 +40637,8 @@ var bn = class extends Se {
40636
40637
  if (i2)
40637
40638
  return i2.value;
40638
40639
  let o;
40639
- t.startsWith(this.fhirBaseUrl) && this.autoBatchQueue ? o = new Promise((a, u2) => {
40640
- 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));
40640
+ t.startsWith(this.fhirBaseUrl) && this.autoBatchQueue ? o = new Promise((a, c2) => {
40641
+ this.autoBatchQueue.push({ method: "GET", url: t.replace(this.fhirBaseUrl, ""), options: n, resolve: a, reject: c2 }), this.autoBatchTimerId || (this.autoBatchTimerId = setTimeout(() => this.executeAutoBatch(), this.autoBatchTime));
40641
40642
  }) : o = this.request("GET", t, n);
40642
40643
  let s = new w(o);
40643
40644
  return this.setCacheEntry(t, s), s;
@@ -40700,12 +40701,12 @@ var bn = class extends Se {
40700
40701
  getExternalAuthRedirectUri(t, n, i2, o, s = true) {
40701
40702
  let a = new URL(t);
40702
40703
  if (a.searchParams.set("response_type", "code"), a.searchParams.set("client_id", n), a.searchParams.set("redirect_uri", i2), a.searchParams.set("scope", o.scope ?? "openid profile email"), a.searchParams.set("state", JSON.stringify(o)), s) {
40703
- let { codeChallenge: u2, codeChallengeMethod: l2 } = o;
40704
+ let { codeChallenge: c2, codeChallengeMethod: l2 } = o;
40704
40705
  if (!l2)
40705
40706
  throw new Error("`LoginRequest` for external auth must include a `codeChallengeMethod`.");
40706
- if (!u2)
40707
+ if (!c2)
40707
40708
  throw new Error("`LoginRequest` for external auth must include a `codeChallenge`.");
40708
- a.searchParams.set("code_challenge_method", l2), a.searchParams.set("code_challenge", u2);
40709
+ a.searchParams.set("code_challenge_method", l2), a.searchParams.set("code_challenge", c2);
40709
40710
  }
40710
40711
  return a.toString();
40711
40712
  }
@@ -40720,14 +40721,14 @@ var bn = class extends Se {
40720
40721
  let o = this.fhirSearchUrl(t, n), s = "search-" + o.toString(), a = this.getCacheEntry(s, i2);
40721
40722
  if (a)
40722
40723
  return a.value;
40723
- let u2 = new w((async () => {
40724
+ let c2 = new w((async () => {
40724
40725
  let l2 = await this.get(o, i2);
40725
40726
  if (l2.entry)
40726
- for (let f of l2.entry)
40727
- this.cacheResource(f.resource);
40727
+ for (let d2 of l2.entry)
40728
+ this.cacheResource(d2.resource);
40728
40729
  return l2;
40729
40730
  })());
40730
- return this.setCacheEntry(s, u2), u2;
40731
+ return this.setCacheEntry(s, c2), c2;
40731
40732
  }
40732
40733
  searchOne(t, n, i2) {
40733
40734
  let o = this.fhirSearchUrl(t, n);
@@ -40735,23 +40736,23 @@ var bn = class extends Se {
40735
40736
  let s = "searchOne-" + o.toString(), a = this.getCacheEntry(s, i2);
40736
40737
  if (a)
40737
40738
  return a.value;
40738
- let u2 = new w(this.search(t, o.searchParams, i2).then((l2) => l2.entry?.[0]?.resource));
40739
- return this.setCacheEntry(s, u2), u2;
40739
+ let c2 = new w(this.search(t, o.searchParams, i2).then((l2) => l2.entry?.[0]?.resource));
40740
+ return this.setCacheEntry(s, c2), c2;
40740
40741
  }
40741
40742
  searchResources(t, n, i2) {
40742
40743
  let s = "searchResources-" + this.fhirSearchUrl(t, n).toString(), a = this.getCacheEntry(s, i2);
40743
40744
  if (a)
40744
40745
  return a.value;
40745
- let u2 = new w(this.search(t, n, i2).then(An));
40746
- return this.setCacheEntry(s, u2), u2;
40746
+ let c2 = new w(this.search(t, n, i2).then(tr));
40747
+ return this.setCacheEntry(s, c2), c2;
40747
40748
  }
40748
40749
  async *searchResourcePages(t, n, i2) {
40749
40750
  let o = this.fhirSearchUrl(t, n);
40750
40751
  for (; o; ) {
40751
- let s = new URL(o).searchParams, a = await this.search(t, s, i2), u2 = a.link?.find((l2) => l2.relation === "next");
40752
- if (!a.entry?.length && !u2)
40752
+ let s = new URL(o).searchParams, a = await this.search(t, s, i2), c2 = a.link?.find((l2) => l2.relation === "next");
40753
+ if (!a.entry?.length && !c2)
40753
40754
  break;
40754
- yield An(a), o = u2?.url ? new URL(u2.url) : void 0;
40755
+ yield tr(a), o = c2?.url ? new URL(c2.url) : void 0;
40755
40756
  }
40756
40757
  }
40757
40758
  searchValueSet(t, n, i2) {
@@ -40770,7 +40771,7 @@ var bn = class extends Se {
40770
40771
  if (!n)
40771
40772
  return;
40772
40773
  if (n === "system")
40773
- return En;
40774
+ return Rn;
40774
40775
  let [i2, o] = n.split("/");
40775
40776
  if (!(!i2 || !o))
40776
40777
  return this.getCached(i2, o);
@@ -40783,12 +40784,12 @@ var bn = class extends Se {
40783
40784
  if (!i2)
40784
40785
  return new w(Promise.reject(new Error("Missing reference")));
40785
40786
  if (i2 === "system")
40786
- return new w(Promise.resolve(En));
40787
+ return new w(Promise.resolve(Rn));
40787
40788
  let [o, s] = i2.split("/");
40788
40789
  return !o || !s ? new w(Promise.reject(new Error("Invalid reference"))) : this.readResource(o, s, n);
40789
40790
  }
40790
40791
  requestSchema(t) {
40791
- if (Qr(t))
40792
+ if (Hr(t))
40792
40793
  return Promise.resolve();
40793
40794
  let n = t + "-requestSchema", i2 = this.getCacheEntry(n, void 0);
40794
40795
  if (i2)
@@ -40835,22 +40836,29 @@ var bn = class extends Se {
40835
40836
  }
40836
40837
  }`.replace(/\s+/g, " "), a = await this.graphql(s);
40837
40838
  Lt(a.data.StructureDefinitionList);
40838
- for (let u2 of a.data.SearchParameterList)
40839
- qt(u2);
40839
+ for (let c2 of a.data.SearchParameterList)
40840
+ $t(c2);
40840
40841
  })());
40841
40842
  return this.setCacheEntry(n, o), o;
40842
40843
  }
40843
- requestProfileSchema(t) {
40844
- if (Gr(t))
40845
- return Promise.resolve();
40846
- let n = t + "-requestSchema", i2 = this.getCacheEntry(n, void 0);
40847
- if (i2)
40848
- return i2.value;
40849
- let o = new w((async () => {
40850
- let s = await this.searchOne("StructureDefinition", { url: t, _sort: "-_lastUpdated" });
40851
- s ? Lt([s], t) : console.warn(`No StructureDefinition found for ${t}!`);
40844
+ requestProfileSchema(t, n) {
40845
+ if (!n?.expandProfile && Wr(t))
40846
+ return Promise.resolve([t]);
40847
+ let i2 = t + "-requestSchema" + (n?.expandProfile ? "-nested" : ""), o = this.getCacheEntry(i2, void 0);
40848
+ if (o)
40849
+ return o.value;
40850
+ let s = new w((async () => {
40851
+ if (n?.expandProfile) {
40852
+ let a = this.fhirUrl("StructureDefinition", "$expand-profile");
40853
+ a.search = new URLSearchParams({ url: t }).toString();
40854
+ let c2 = await this.get(a.toString());
40855
+ return tr(c2).map((l2) => (Bt(l2, l2.url), l2.url));
40856
+ } else {
40857
+ let a = await this.searchOne("StructureDefinition", { url: t, _sort: "-_lastUpdated" });
40858
+ return a ? (Lt([a], t), [t]) : (console.warn(`No StructureDefinition found for ${t}!`), []);
40859
+ }
40852
40860
  })());
40853
- return this.setCacheEntry(n, o), o;
40861
+ return this.setCacheEntry(i2, s), s;
40854
40862
  }
40855
40863
  readHistory(t, n, i2) {
40856
40864
  return this.get(this.fhirUrl(t, n, "_history"), i2);
@@ -40878,14 +40886,14 @@ var bn = class extends Se {
40878
40886
  return n && a.searchParams.set("_filename", n), o ? this.uploadwithProgress(a, t, i2, o, s) : this.post(a, t, i2, s);
40879
40887
  }
40880
40888
  uploadwithProgress(t, n, i2, o, s) {
40881
- return new Promise((a, u2) => {
40882
- let l2 = new XMLHttpRequest(), f = () => l2.abort();
40883
- s?.signal?.addEventListener("abort", f);
40884
- let E2 = (q) => {
40885
- s?.signal?.removeEventListener("abort", f), q instanceof Error ? u2(q) : a(q);
40886
- };
40887
- 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 = () => {
40888
- l2.status >= 200 && l2.status < 300 ? E2(l2.response) : E2(new p(Ie(l2.response || l2.statusText)));
40889
+ return new Promise((a, c2) => {
40890
+ let l2 = new XMLHttpRequest(), d2 = () => l2.abort();
40891
+ s?.signal?.addEventListener("abort", d2);
40892
+ let b = (q) => {
40893
+ s?.signal?.removeEventListener("abort", d2), q instanceof Error ? c2(q) : a(q);
40894
+ };
40895
+ l2.responseType = "json", l2.onabort = () => b(new Error("Request aborted")), l2.onerror = () => b(new Error("Request error")), o && (l2.upload.onprogress = (q) => o(q), l2.upload.onload = (q) => o(q)), l2.onload = () => {
40896
+ l2.status >= 200 && l2.status < 300 ? b(l2.response) : b(new f(ke(l2.response || l2.statusText)));
40889
40897
  }, 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);
40890
40898
  });
40891
40899
  }
@@ -40940,7 +40948,7 @@ var bn = class extends Se {
40940
40948
  return this.get(`${this.fhirUrl(t, n)}/$graph?graph=${i2}`, o);
40941
40949
  }
40942
40950
  pushToAgent(t, n, i2, o, s, a) {
40943
- return this.post(this.fhirUrl("Agent", fr(t), "$push"), { destination: fe(n), body: i2, contentType: o, waitForResponse: s }, V.FHIR_JSON, a);
40951
+ return this.post(this.fhirUrl("Agent", hr(t), "$push"), { destination: typeof n == "string" ? n : fe(n), body: i2, contentType: o, waitForResponse: s }, V.FHIR_JSON, a);
40944
40952
  }
40945
40953
  getActiveLogin() {
40946
40954
  return this.storage.getObject("activeLogin");
@@ -40952,7 +40960,7 @@ var bn = class extends Se {
40952
40960
  return this.accessToken;
40953
40961
  }
40954
40962
  setAccessToken(t, n) {
40955
- this.accessToken = t, this.refreshToken = n, this.sessionDetails = void 0, this.accessTokenExpires = Tn(t), this.medplumServer = xn(t);
40963
+ this.accessToken = t, this.refreshToken = n, this.sessionDetails = void 0, this.accessTokenExpires = Sn(t), this.medplumServer = vn(t);
40956
40964
  }
40957
40965
  getLogins() {
40958
40966
  return this.storage.getObject("logins") ?? [];
@@ -41000,11 +41008,11 @@ var bn = class extends Se {
41000
41008
  async download(t, n = {}) {
41001
41009
  this.refreshPromise && await this.refreshPromise;
41002
41010
  let i2 = t.toString();
41003
- return i2.startsWith(Sn) && (t = this.fhirUrl(i2)), this.addFetchOptionsDefaults(n), (await this.fetchWithRetry(t.toString(), n)).blob();
41011
+ return i2.startsWith(bn) && (t = this.fhirUrl(i2)), this.addFetchOptionsDefaults(n), (await this.fetchWithRetry(t.toString(), n)).blob();
41004
41012
  }
41005
41013
  async uploadMedia(t, n, i2, o, s) {
41006
41014
  let a = await this.createBinary(t, i2, n);
41007
- return this.createResource({ resourceType: "Media", status: "completed", content: { contentType: n, url: Sn + a.id, title: i2 }, ...o }, s);
41015
+ return this.createResource({ resourceType: "Media", status: "completed", content: { contentType: n, url: bn + a.id, title: i2 }, ...o }, s);
41008
41016
  }
41009
41017
  async bulkExport(t = "", n, i2, o) {
41010
41018
  let s = t && `${t}/`, a = this.fhirUrl(`${s}$export`);
@@ -41016,7 +41024,7 @@ var bn = class extends Se {
41016
41024
  i2.Prefer = "respond-async";
41017
41025
  let o = await this.fetchWithRetry(t, n);
41018
41026
  if (o.status === 202) {
41019
- let s = await Cn(o);
41027
+ let s = await wn(o);
41020
41028
  if (s)
41021
41029
  return this.pollStatus(s);
41022
41030
  }
@@ -41050,22 +41058,22 @@ var bn = class extends Se {
41050
41058
  return;
41051
41059
  let a = t.headers.get("content-type")?.includes("json");
41052
41060
  if (t.status === 404 && !a)
41053
- throw new p(cr);
41054
- let u2 = t.headers.get("content-location"), l2 = o.redirect ?? this.options.redirect;
41055
- if (t.status === 201 && u2 && l2 === "follow")
41056
- return this.request("GET", u2, { ...o, body: void 0 });
41057
- let f;
41061
+ throw new f(lr);
41062
+ let c2 = t.headers.get("content-location"), l2 = o.redirect ?? this.options.redirect;
41063
+ if (t.status === 201 && c2 && l2 === "follow")
41064
+ return this.request("GET", c2, { ...o, body: void 0 });
41065
+ let d2;
41058
41066
  if (a)
41059
41067
  try {
41060
- f = await t.json();
41061
- } catch (E2) {
41062
- throw console.error("Error parsing response", t.status, E2), E2;
41068
+ d2 = await t.json();
41069
+ } catch (b) {
41070
+ throw console.error("Error parsing response", t.status, b), b;
41063
41071
  }
41064
41072
  else
41065
- f = await t.text();
41073
+ d2 = await t.text();
41066
41074
  if (t.status >= 400)
41067
- throw new p(Ie(f));
41068
- return f;
41075
+ throw new f(ke(d2));
41076
+ return d2;
41069
41077
  }
41070
41078
  async fetchWithRetry(t, n) {
41071
41079
  t.startsWith("http") || (t = new URL(t, this.baseUrl).href);
@@ -41074,8 +41082,8 @@ var bn = class extends Se {
41074
41082
  try {
41075
41083
  if (this.options.verbose && this.logRequest(t, n), s = await this.fetch(t, n), this.options.verbose && this.logResponse(s), s.status < 500)
41076
41084
  return s;
41077
- } catch (u2) {
41078
- this.retryCatch(a, i2, u2);
41085
+ } catch (c2) {
41086
+ this.retryCatch(a, i2, c2);
41079
41087
  }
41080
41088
  await St(o);
41081
41089
  }
@@ -41098,8 +41106,8 @@ var bn = class extends Se {
41098
41106
  this.addFetchOptionsDefaults(s);
41099
41107
  let a = await this.fetchWithRetry(t, s);
41100
41108
  if (a.status !== 202 && (n = false, i2 = a, a.status === 201)) {
41101
- let u2 = await Cn(a);
41102
- u2 && (i2 = await this.fetchWithRetry(u2, s));
41109
+ let c2 = await wn(a);
41110
+ c2 && (i2 = await this.fetchWithRetry(c2, s));
41103
41111
  }
41104
41112
  await St(o);
41105
41113
  }
@@ -41112,14 +41120,14 @@ var bn = class extends Se {
41112
41120
  try {
41113
41121
  o.resolve(await this.request(o.method, this.fhirBaseUrl + o.url, o.options));
41114
41122
  } catch (s) {
41115
- o.reject(new p(Ie(s)));
41123
+ o.reject(new f(ke(s)));
41116
41124
  }
41117
41125
  return;
41118
41126
  }
41119
41127
  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);
41120
41128
  for (let o = 0; o < t.length; o++) {
41121
41129
  let s = t[o], a = i2.entry?.[o];
41122
- a?.response?.outcome && !yt(a.response.outcome) ? s.reject(new p(a.response.outcome)) : s.resolve(a?.resource);
41130
+ a?.response?.outcome && !yt(a.response.outcome) ? s.reject(new f(a.response.outcome)) : s.resolve(a?.resource);
41123
41131
  }
41124
41132
  }
41125
41133
  addFetchOptionsDefaults(t) {
@@ -41138,20 +41146,20 @@ var bn = class extends Se {
41138
41146
  return this.refresh() ? this.request(t, n, i2) : (this.clearActiveLogin(), this.onUnauthenticated && this.onUnauthenticated(), Promise.reject(new Error("Unauthenticated")));
41139
41147
  }
41140
41148
  async startPkce() {
41141
- let t = Wt();
41149
+ let t = zt();
41142
41150
  sessionStorage.setItem("pkceState", t);
41143
- let n = Wt();
41151
+ let n = zt();
41144
41152
  sessionStorage.setItem("codeVerifier", n);
41145
- let i2 = await dn(n), o = Sr(i2).replaceAll("+", "-").replaceAll("/", "_").replaceAll("=", "");
41153
+ let i2 = await fn(n), o = br(i2).replaceAll("+", "-").replaceAll("/", "_").replaceAll("=", "");
41146
41154
  return sessionStorage.setItem("codeChallenge", o), { codeChallengeMethod: "S256", codeChallenge: o };
41147
41155
  }
41148
41156
  async requestAuthorization(t) {
41149
41157
  let n = await this.ensureCodeChallenge(t ?? {}), i2 = new URL(this.authorizeUrl);
41150
- i2.searchParams.set("response_type", "code"), i2.searchParams.set("state", sessionStorage.getItem("pkceState")), i2.searchParams.set("client_id", n.clientId ?? this.clientId), i2.searchParams.set("redirect_uri", n.redirectUri ?? Rn()), i2.searchParams.set("code_challenge_method", n.codeChallengeMethod), i2.searchParams.set("code_challenge", n.codeChallenge), i2.searchParams.set("scope", n.scope ?? "openid profile"), window.location.assign(i2.toString());
41158
+ i2.searchParams.set("response_type", "code"), i2.searchParams.set("state", sessionStorage.getItem("pkceState")), i2.searchParams.set("client_id", n.clientId ?? this.clientId), i2.searchParams.set("redirect_uri", n.redirectUri ?? Cn()), i2.searchParams.set("code_challenge_method", n.codeChallengeMethod), i2.searchParams.set("code_challenge", n.codeChallenge), i2.searchParams.set("scope", n.scope ?? "openid profile"), window.location.assign(i2.toString());
41151
41159
  }
41152
41160
  processCode(t, n) {
41153
41161
  let i2 = new URLSearchParams();
41154
- if (i2.set("grant_type", "authorization_code"), i2.set("code", t), i2.set("client_id", n?.clientId ?? this.clientId), i2.set("redirect_uri", n?.redirectUri ?? Rn()), typeof sessionStorage < "u") {
41162
+ if (i2.set("grant_type", "authorization_code"), i2.set("code", t), i2.set("client_id", n?.clientId ?? this.clientId), i2.set("redirect_uri", n?.redirectUri ?? Cn()), typeof sessionStorage < "u") {
41155
41163
  let o = sessionStorage.getItem("codeVerifier");
41156
41164
  o && i2.set("code_verifier", o);
41157
41165
  }
@@ -41185,30 +41193,30 @@ var bn = class extends Se {
41185
41193
  return n.append("grant_type", "client_credentials"), n.append("client_assertion_type", "urn:ietf:params:oauth:client-assertion-type:jwt-bearer"), n.append("client_assertion", t), this.fetchTokens(n);
41186
41194
  }
41187
41195
  setBasicAuth(t, n) {
41188
- this.clientId = t, this.clientSecret = n, this.basicAuth = ln(t + ":" + n);
41196
+ this.clientId = t, this.clientSecret = n, this.basicAuth = pn(t + ":" + n);
41189
41197
  }
41190
41198
  async fhircastSubscribe(t, n) {
41191
41199
  if (!(typeof t == "string" && t !== ""))
41192
- throw new p(h("Invalid topic provided. Topic must be a valid string."));
41200
+ throw new f(h("Invalid topic provided. Topic must be a valid string."));
41193
41201
  if (!(typeof n == "object" && Array.isArray(n) && n.length > 0))
41194
- throw new p(h("Invalid events provided. Events must be an array of event names containing at least one event."));
41195
- let i2 = { channelType: "websocket", mode: "subscribe", topic: t, events: n }, s = (await this.post("/fhircast/STU3", Yt(i2), V.FORM_URL_ENCODED))["hub.channel.endpoint"];
41202
+ throw new f(h("Invalid events provided. Events must be an array of event names containing at least one event."));
41203
+ let i2 = { channelType: "websocket", mode: "subscribe", topic: t, events: n }, s = (await this.post("/fhircast/STU3", Zt(i2), V.FORM_URL_ENCODED))["hub.channel.endpoint"];
41196
41204
  if (!s)
41197
41205
  throw new Error("Invalid response!");
41198
41206
  return i2.endpoint = s, i2;
41199
41207
  }
41200
41208
  async fhircastUnsubscribe(t) {
41201
41209
  if (!st(t))
41202
- throw new p(h("Invalid topic or subscriptionRequest. SubscriptionRequest must be an object."));
41210
+ throw new f(h("Invalid topic or subscriptionRequest. SubscriptionRequest must be an object."));
41203
41211
  if (!(t.endpoint && typeof t.endpoint == "string" && t.endpoint.startsWith("ws")))
41204
- throw new p(h("Provided subscription request must have an endpoint in order to unsubscribe."));
41205
- t.mode = "unsubscribe", await this.post("/fhircast/STU3", Yt(t), V.FORM_URL_ENCODED);
41212
+ throw new f(h("Provided subscription request must have an endpoint in order to unsubscribe."));
41213
+ t.mode = "unsubscribe", await this.post("/fhircast/STU3", Zt(t), V.FORM_URL_ENCODED);
41206
41214
  }
41207
41215
  fhircastConnect(t) {
41208
41216
  return new ot(t);
41209
41217
  }
41210
41218
  async fhircastPublish(t, n, i2, o) {
41211
- return mn(n) ? this.post(`/fhircast/STU3/${t}`, Zt(t, n, i2, o), V.JSON) : (hn(n), this.post(`/fhircast/STU3/${t}`, Zt(t, n, i2), V.JSON));
41219
+ return gn(n) ? this.post(`/fhircast/STU3/${t}`, Xt(t, n, i2, o), V.JSON) : (yn(n), this.post(`/fhircast/STU3/${t}`, Xt(t, n, i2), V.JSON));
41212
41220
  }
41213
41221
  async fhircastGetContext(t) {
41214
41222
  return this.get(`/fhircast/STU3/${t}`);
@@ -41229,9 +41237,9 @@ var bn = class extends Se {
41229
41237
  this.clearActiveLogin();
41230
41238
  try {
41231
41239
  let a = await o.json();
41232
- throw new p(v(a.error_description));
41240
+ throw new f(v(a.error_description));
41233
41241
  } catch (a) {
41234
- throw new p(v("Failed to fetch tokens"), a);
41242
+ throw new f(v("Failed to fetch tokens"), a);
41235
41243
  }
41236
41244
  }
41237
41245
  let s = await o.json();
@@ -41239,7 +41247,7 @@ var bn = class extends Se {
41239
41247
  }
41240
41248
  async verifyTokens(t) {
41241
41249
  let n = t.access_token;
41242
- if (yn(n)) {
41250
+ if (Tn(n)) {
41243
41251
  let i2 = at(n);
41244
41252
  if (Date.now() >= i2.exp * 1e3)
41245
41253
  throw this.clearActiveLogin(), new Error("Token expired");
@@ -41264,21 +41272,21 @@ var bn = class extends Se {
41264
41272
  throw i2;
41265
41273
  }
41266
41274
  };
41267
- function Ho() {
41275
+ function Go() {
41268
41276
  if (!globalThis.fetch)
41269
41277
  throw new Error("Fetch not available in this environment");
41270
41278
  return globalThis.fetch.bind(globalThis);
41271
41279
  }
41272
- function Rn() {
41280
+ function Cn() {
41273
41281
  return typeof window > "u" ? "" : window.location.protocol + "//" + window.location.host + "/";
41274
41282
  }
41275
- function Pn(r4) {
41283
+ function An(r4) {
41276
41284
  return r4.endsWith("/") ? r4 : r4 + "/";
41277
41285
  }
41278
41286
  function ct(r4, e) {
41279
41287
  return new URL(e, r4).toString();
41280
41288
  }
41281
- async function Cn(r4) {
41289
+ async function wn(r4) {
41282
41290
  let e = r4.headers.get("content-location");
41283
41291
  if (e)
41284
41292
  return e;
@@ -41289,14 +41297,14 @@ async function Cn(r4) {
41289
41297
  if (ne(n) && n.issue?.[0]?.diagnostics)
41290
41298
  return n.issue[0].diagnostics;
41291
41299
  }
41292
- function An(r4) {
41300
+ function tr(r4) {
41293
41301
  let e = r4.entry?.map((t) => t.resource) ?? [];
41294
41302
  return Object.assign(e, { bundle: r4 });
41295
41303
  }
41296
- var Jo = [...xe, "->", "<<", ">>", "=="];
41297
- var Xo = Te().registerInfix("->", { precedence: m.Arrow }).registerInfix(";", { precedence: m.Semicolon });
41298
- var fs = [...xe, "eq", "ne", "co"];
41299
- var gs = Te();
41304
+ var Jo = [...Te, "->", "<<", ">>", "=="];
41305
+ var Xo = ve().registerInfix("->", { precedence: m.Arrow }).registerInfix(";", { precedence: m.Semicolon });
41306
+ var fs = [...Te, "eq", "ne", "co"];
41307
+ var gs = ve();
41300
41308
  var z = class {
41301
41309
  constructor(e = "\r", t = "|", n = "^", i2 = "~", o = "\\", s = "&") {
41302
41310
  this.segmentSeparator = e;
@@ -41313,7 +41321,7 @@ var z = class {
41313
41321
  return this.componentSeparator + this.repetitionSeparator + this.escapeCharacter + this.subcomponentSeparator;
41314
41322
  }
41315
41323
  };
41316
- var Ln = class r {
41324
+ var Bn = class r {
41317
41325
  constructor(e, t = new z()) {
41318
41326
  this.context = t, this.segments = e;
41319
41327
  }
@@ -41336,8 +41344,8 @@ var Ln = class r {
41336
41344
  return this.segments.map((e) => e.toString()).join(this.context.segmentSeparator);
41337
41345
  }
41338
41346
  buildAck() {
41339
- 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";
41340
- return new r([new Re(["MSH", this.context.getMsh2(), o, s, n, i2, xs(e), "", this.buildAckMessageType(t), e.getTime().toString(), "P", u2], this.context), new Re(["MSA", "AA", a, "OK"], this.context)]);
41347
+ 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() ?? "", c2 = t?.getField(12)?.toString() ?? "2.5.1";
41348
+ return new r([new Pe(["MSH", this.context.getMsh2(), o, s, n, i2, xs(e), "", this.buildAckMessageType(t), e.getTime().toString(), "P", c2], this.context), new Pe(["MSA", "AA", a, "OK"], this.context)]);
41341
41349
  }
41342
41350
  buildAckMessageType(e) {
41343
41351
  let t = e?.getField(9), n = t?.getComponent(2), i2 = t?.getComponent(3), o = "ACK";
@@ -41349,12 +41357,12 @@ var Ln = class r {
41349
41357
  throw n.type = "entity.parse.failed", n;
41350
41358
  }
41351
41359
  let t = new z("\r", e.charAt(3), e.charAt(4), e.charAt(5), e.charAt(6), e.charAt(7));
41352
- return new r(e.split(/[\r\n]+/).map((n) => Re.parse(n, t)), t);
41360
+ return new r(e.split(/[\r\n]+/).map((n) => Pe.parse(n, t)), t);
41353
41361
  }
41354
41362
  };
41355
- var Re = class r2 {
41363
+ var Pe = class r2 {
41356
41364
  constructor(e, t = new z()) {
41357
- this.context = t, xr(e) ? this.fields = e.map((n) => pe.parse(n, t)) : this.fields = e, this.name = this.fields[0].components[0][0];
41365
+ this.context = t, vr(e) ? this.fields = e.map((n) => pe.parse(n, t)) : this.fields = e, this.name = this.fields[0].components[0][0];
41358
41366
  }
41359
41367
  get(e) {
41360
41368
  return this.fields[e];
@@ -41402,8 +41410,8 @@ function xs(r4) {
41402
41410
  let e = r4 instanceof Date ? r4 : new Date(r4), n = e.toISOString().replace(/[-:T]/g, "").replace(/(\.\d+)?Z$/, ""), i2 = e.getUTCMilliseconds();
41403
41411
  return i2 > 0 && (n += "." + i2.toString()), n;
41404
41412
  }
41405
- var nr = ((o) => (o[o.NONE = 0] = "NONE", o[o.ERROR = 1] = "ERROR", o[o.WARN = 2] = "WARN", o[o.INFO = 3] = "INFO", o[o.DEBUG = 4] = "DEBUG", o))(nr || {});
41406
- var Bn = class {
41413
+ var or = ((o) => (o[o.NONE = 0] = "NONE", o[o.ERROR = 1] = "ERROR", o[o.WARN = 2] = "WARN", o[o.INFO = 3] = "INFO", o[o.DEBUG = 4] = "DEBUG", o))(or || {});
41414
+ var qn = class {
41407
41415
  constructor(e, t = {}, n = 3) {
41408
41416
  this.write = e;
41409
41417
  this.metadata = t;
@@ -41423,11 +41431,11 @@ var Bn = class {
41423
41431
  }
41424
41432
  log(e, t, n) {
41425
41433
  e > this.level || (n instanceof Error && (n = { error: n.toString(), stack: n.stack?.split(`
41426
- `) }), this.write(JSON.stringify({ level: nr[e], timestamp: (/* @__PURE__ */ new Date()).toISOString(), msg: t, ...n, ...this.metadata })));
41434
+ `) }), this.write(JSON.stringify({ level: or[e], timestamp: (/* @__PURE__ */ new Date()).toISOString(), msg: t, ...n, ...this.metadata })));
41427
41435
  }
41428
41436
  };
41429
41437
  function od(r4) {
41430
- let e = nr[r4.toUpperCase()];
41438
+ let e = or[r4.toUpperCase()];
41431
41439
  if (e === void 0)
41432
41440
  throw new Error(`Invalid log level: ${r4}`);
41433
41441
  return e;
@@ -41450,7 +41458,7 @@ var i = class extends EventTarget {
41450
41458
  var m2 = "\v";
41451
41459
  var p2 = "";
41452
41460
  var v2 = "\r";
41453
- var d2 = class extends Event {
41461
+ var d = class extends Event {
41454
41462
  constructor(t, n) {
41455
41463
  super("message");
41456
41464
  this.connection = t;
@@ -41463,7 +41471,7 @@ var l = class extends Event {
41463
41471
  this.error = t;
41464
41472
  }
41465
41473
  };
41466
- var c2 = class extends i {
41474
+ var c = class extends i {
41467
41475
  constructor(t, n) {
41468
41476
  super();
41469
41477
  this.socket = t;
@@ -41472,8 +41480,8 @@ var c2 = class extends i {
41472
41480
  t.on("data", (s) => {
41473
41481
  try {
41474
41482
  if (o += s.toString(), o.endsWith(p2 + v2)) {
41475
- let r4 = Ln.parse(o.substring(1, o.length - 2));
41476
- this.dispatchEvent(new d2(this, r4)), o = "";
41483
+ let r4 = Bn.parse(o.substring(1, o.length - 2));
41484
+ this.dispatchEvent(new d(this, r4)), o = "";
41477
41485
  }
41478
41486
  } catch (r4) {
41479
41487
  this.dispatchEvent(new l(r4));
@@ -41505,7 +41513,7 @@ var h2 = class extends i {
41505
41513
  connect() {
41506
41514
  return this.connection ? Promise.resolve(this.connection) : new Promise((e) => {
41507
41515
  let t = (0, import_net.connect)({ host: this.host, port: this.port }, () => {
41508
- this.connection = new c2(t), e(this.connection);
41516
+ this.connection = new c(t), e(this.connection);
41509
41517
  });
41510
41518
  });
41511
41519
  }
@@ -41519,13 +41527,13 @@ var h2 = class extends i {
41519
41527
  this.connection && (this.connection.close(), delete this.connection);
41520
41528
  }
41521
41529
  };
41522
- var E = class {
41530
+ var E2 = class {
41523
41531
  constructor(e) {
41524
41532
  this.handler = e;
41525
41533
  }
41526
41534
  start(e, t) {
41527
41535
  let n = import_net2.default.createServer((o) => {
41528
- let s = new c2(o, t);
41536
+ let s = new c(o, t);
41529
41537
  this.handler(s);
41530
41538
  });
41531
41539
  n.listen(e), this.server = n;
@@ -41535,6 +41543,12 @@ var E = class {
41535
41543
  }
41536
41544
  };
41537
41545
 
41546
+ // src/app.ts
41547
+ var import_node_child_process = require("child_process");
41548
+ var import_node_net = require("net");
41549
+ var import_node_util = require("util");
41550
+ var import_os = require("os");
41551
+
41538
41552
  // ../../node_modules/ws/wrapper.mjs
41539
41553
  var import_stream = __toESM(require_stream(), 1);
41540
41554
  var import_receiver = __toESM(require_receiver(), 1);
@@ -41653,7 +41667,7 @@ var DcmjsDimseScp = class extends dimse.Scp {
41653
41667
  });
41654
41668
  response.setStatus(dimse.constants.Status.Success);
41655
41669
  } catch (err) {
41656
- App.instance.log.error(`DICOM error: ${$n(err)}`);
41670
+ App.instance.log.error(`DICOM error: ${jn(err)}`);
41657
41671
  response.setStatus(dimse.constants.Status.ProcessingFailure);
41658
41672
  }
41659
41673
  return response;
@@ -41667,7 +41681,7 @@ var AgentHl7Channel = class {
41667
41681
  this.definition = definition;
41668
41682
  this.endpoint = endpoint;
41669
41683
  this.connections = /* @__PURE__ */ new Map();
41670
- this.server = new E((connection) => this.handleNewConnection(connection));
41684
+ this.server = new E2((connection) => this.handleNewConnection(connection));
41671
41685
  }
41672
41686
  start() {
41673
41687
  const address = new URL(this.endpoint.address);
@@ -41684,13 +41698,13 @@ var AgentHl7Channel = class {
41684
41698
  sendToRemote(msg) {
41685
41699
  const connection = this.connections.get(msg.remote);
41686
41700
  if (connection) {
41687
- connection.hl7Connection.send(Ln.parse(msg.body));
41701
+ connection.hl7Connection.send(Bn.parse(msg.body));
41688
41702
  }
41689
41703
  }
41690
41704
  handleNewConnection(connection) {
41691
- const c3 = new AgentHl7ChannelConnection(this, connection);
41692
- this.app.log.info(`HL7 connection established: ${c3.remote}`);
41693
- this.connections.set(c3.remote, c3);
41705
+ const c2 = new AgentHl7ChannelConnection(this, connection);
41706
+ this.app.log.info(`HL7 connection established: ${c2.remote}`);
41707
+ this.connections.set(c2.remote, c2);
41694
41708
  }
41695
41709
  };
41696
41710
  var AgentHl7ChannelConnection = class {
@@ -41713,7 +41727,7 @@ var AgentHl7ChannelConnection = class {
41713
41727
  body: event.message.toString()
41714
41728
  });
41715
41729
  } catch (err) {
41716
- this.channel.app.log.error(`HL7 error: ${$n(err)}`);
41730
+ this.channel.app.log.error(`HL7 error: ${jn(err)}`);
41717
41731
  }
41718
41732
  }
41719
41733
  close() {
@@ -41722,6 +41736,7 @@ var AgentHl7ChannelConnection = class {
41722
41736
  };
41723
41737
 
41724
41738
  // src/app.ts
41739
+ var exec = (0, import_node_util.promisify)(import_node_child_process.exec);
41725
41740
  var App = class _App {
41726
41741
  constructor(medplum, agentId, logLevel) {
41727
41742
  this.medplum = medplum;
@@ -41734,7 +41749,7 @@ var App = class _App {
41734
41749
  this.live = false;
41735
41750
  this.shutdown = false;
41736
41751
  _App.instance = this;
41737
- this.log = new Bn((msg) => console.log(msg), void 0, logLevel);
41752
+ this.log = new qn((msg) => console.log(msg), void 0, logLevel);
41738
41753
  }
41739
41754
  async start() {
41740
41755
  this.log.info("Medplum service starting...");
@@ -41776,7 +41791,7 @@ var App = class _App {
41776
41791
  this.webSocket.binaryType = "nodebuffer";
41777
41792
  this.webSocket.addEventListener("error", (err) => {
41778
41793
  if (!this.shutdown) {
41779
- this.log.error($n(err.error));
41794
+ this.log.error(jn(err.error));
41780
41795
  }
41781
41796
  });
41782
41797
  this.webSocket.addEventListener("open", async () => {
@@ -41817,7 +41832,11 @@ var App = class _App {
41817
41832
  break;
41818
41833
  case "push":
41819
41834
  case "agent:transmit:request":
41820
- this.pushMessage(command);
41835
+ if (command.contentType === V.PING) {
41836
+ await this.tryPingIp(command);
41837
+ } else {
41838
+ this.pushMessage(command);
41839
+ }
41821
41840
  break;
41822
41841
  case "agent:error":
41823
41842
  this.log.error(command.body);
@@ -41826,7 +41845,7 @@ var App = class _App {
41826
41845
  this.log.error(`Unknown message type: ${command.type}`);
41827
41846
  }
41828
41847
  } catch (err) {
41829
- this.log.error(`WebSocket error: ${$n(err)}`);
41848
+ this.log.error(`WebSocket error: ${jn(err)}`);
41830
41849
  }
41831
41850
  });
41832
41851
  }
@@ -41892,7 +41911,7 @@ var App = class _App {
41892
41911
  try {
41893
41912
  await this.sendToWebSocket(msg);
41894
41913
  } catch (err) {
41895
- this.log.error(`WebSocket error: ${$n(err)}`);
41914
+ this.log.error(`WebSocket error: ${jn(err)}`);
41896
41915
  this.webSocketQueue.unshift(msg);
41897
41916
  throw err;
41898
41917
  }
@@ -41912,6 +41931,49 @@ var App = class _App {
41912
41931
  }
41913
41932
  }
41914
41933
  }
41934
+ async tryPingIp(message) {
41935
+ try {
41936
+ if (message.body && message.body !== "PING") {
41937
+ const warnMsg = "Message body present but unused. Body should be empty for a ping request.";
41938
+ this.log.warn(warnMsg);
41939
+ }
41940
+ if (!(0, import_node_net.isIPv4)(message.remote)) {
41941
+ let errMsg = `Attempted to ping invalid IP: ${message.remote}`;
41942
+ if ((0, import_node_net.isIPv6)(message.remote)) {
41943
+ errMsg = `Attempted to ping an IPv6 address: ${message.remote}
41944
+
41945
+ IPv6 is currently unsupported.`;
41946
+ }
41947
+ this.log.error(errMsg);
41948
+ throw new Error(errMsg);
41949
+ }
41950
+ const { stderr, stdout } = await exec(
41951
+ (0, import_os.platform)() === "win32" ? `ping ${message.remote}` : `ping -c 4 ${message.remote}`
41952
+ );
41953
+ if (stderr) {
41954
+ throw new Error(`Received on stderr:
41955
+
41956
+ ${stderr}`);
41957
+ }
41958
+ this.log.info(`Ping result for ${message.remote}:
41959
+
41960
+ ${stdout}`);
41961
+ this.addToWebSocketQueue({
41962
+ type: "agent:transmit:response",
41963
+ channel: message.channel,
41964
+ contentType: V.PING,
41965
+ remote: message.remote,
41966
+ callback: message.callback,
41967
+ body: stdout
41968
+ });
41969
+ } catch (err) {
41970
+ this.log.error(`Error during ping attempt to ${message.remote ?? "NO_IP_GIVEN"}: ${jn(err)}`);
41971
+ this.addToWebSocketQueue({
41972
+ type: "agent:error",
41973
+ body: err.message
41974
+ });
41975
+ }
41976
+ }
41915
41977
  async sendToWebSocket(message) {
41916
41978
  if (!this.webSocket) {
41917
41979
  throw new Error("WebSocket not connected");
@@ -41932,7 +41994,7 @@ var App = class _App {
41932
41994
  host: address.hostname,
41933
41995
  port: parseInt(address.port, 10)
41934
41996
  });
41935
- client.sendAndWait(Ln.parse(message.body)).then((response) => {
41997
+ client.sendAndWait(Bn.parse(message.body)).then((response) => {
41936
41998
  this.log.info(`Response: ${response.toString().replaceAll("\r", "\n")}`);
41937
41999
  this.addToWebSocketQueue({
41938
42000
  type: "agent:transmit:response",
@@ -41943,7 +42005,7 @@ var App = class _App {
41943
42005
  body: response.toString()
41944
42006
  });
41945
42007
  }).catch((err) => {
41946
- this.log.error(`HL7 error: ${$n(err)}`);
42008
+ this.log.error(`HL7 error: ${jn(err)}`);
41947
42009
  }).finally(() => {
41948
42010
  client.close();
41949
42011
  });
@@ -41976,7 +42038,7 @@ async function main(argv) {
41976
42038
  process.exit(1);
41977
42039
  }
41978
42040
  const { baseUrl, clientId, clientSecret, agentId } = args;
41979
- const medplum = new bn({ baseUrl, clientId });
42041
+ const medplum = new Pn({ baseUrl, clientId });
41980
42042
  await medplum.startClientLogin(clientId, clientSecret);
41981
42043
  const app = new App(medplum, agentId, od(args.logLevel ?? "INFO"));
41982
42044
  await app.start();