@medplum/agent 4.1.9 → 4.1.11

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 +615 -611
  2. package/package.json +5 -5
@@ -7578,8 +7578,8 @@ var require_dcmjs = __commonJS({
7578
7578
  if (_isNativeReflectConstruct()) return Reflect.construct.apply(null, arguments);
7579
7579
  var o = [null];
7580
7580
  o.push.apply(o, e);
7581
- var p2 = new (t.bind.apply(t, o))();
7582
- return r6 && _setPrototypeOf(p2, r6.prototype), p2;
7581
+ var p = new (t.bind.apply(t, o))();
7582
+ return r6 && _setPrototypeOf(p, r6.prototype), p;
7583
7583
  }
7584
7584
  function _isNativeReflectConstruct() {
7585
7585
  try {
@@ -7713,12 +7713,12 @@ var require_dcmjs = __commonJS({
7713
7713
  };
7714
7714
  return _getPrototypeOf(o);
7715
7715
  }
7716
- function _setPrototypeOf(o, p2) {
7717
- _setPrototypeOf = Object.setPrototypeOf ? Object.setPrototypeOf.bind() : function _setPrototypeOf2(o2, p3) {
7718
- o2.__proto__ = p3;
7716
+ function _setPrototypeOf(o, p) {
7717
+ _setPrototypeOf = Object.setPrototypeOf ? Object.setPrototypeOf.bind() : function _setPrototypeOf2(o2, p2) {
7718
+ o2.__proto__ = p2;
7719
7719
  return o2;
7720
7720
  };
7721
- return _setPrototypeOf(o, p2);
7721
+ return _setPrototypeOf(o, p);
7722
7722
  }
7723
7723
  function _isNativeFunction(fn) {
7724
7724
  try {
@@ -8672,19 +8672,19 @@ var require_dcmjs = __commonJS({
8672
8672
  };
8673
8673
  const slide_hash = (s) => {
8674
8674
  let n, m2;
8675
- let p2;
8675
+ let p;
8676
8676
  let wsize = s.w_size;
8677
8677
  n = s.hash_size;
8678
- p2 = n;
8678
+ p = n;
8679
8679
  do {
8680
- m2 = s.head[--p2];
8681
- s.head[p2] = m2 >= wsize ? m2 - wsize : 0;
8680
+ m2 = s.head[--p];
8681
+ s.head[p] = m2 >= wsize ? m2 - wsize : 0;
8682
8682
  } while (--n);
8683
8683
  n = wsize;
8684
- p2 = n;
8684
+ p = n;
8685
8685
  do {
8686
- m2 = s.prev[--p2];
8687
- s.prev[p2] = m2 >= wsize ? m2 - wsize : 0;
8686
+ m2 = s.prev[--p];
8687
+ s.prev[p] = m2 >= wsize ? m2 - wsize : 0;
8688
8688
  } while (--n);
8689
8689
  };
8690
8690
  let HASH_ZLIB = (s, prev, data3) => (prev << s.hash_shift ^ data3) & s.hash_mask;
@@ -9763,9 +9763,9 @@ var require_dcmjs = __commonJS({
9763
9763
  if (typeof source !== "object") {
9764
9764
  throw new TypeError(source + "must be non-object");
9765
9765
  }
9766
- for (const p2 in source) {
9767
- if (_has(source, p2)) {
9768
- obj[p2] = source[p2];
9766
+ for (const p in source) {
9767
+ if (_has(source, p)) {
9768
+ obj[p] = source[p];
9769
9769
  }
9770
9770
  }
9771
9771
  }
@@ -15169,9 +15169,9 @@ var require_dcmjs = __commonJS({
15169
15169
  key: "rgb2XYZ",
15170
15170
  value: function rgb2XYZ(rgb) {
15171
15171
  var R2 = Colors2.invGammaCorrection(rgb[0]);
15172
- var G = Colors2.invGammaCorrection(rgb[1]);
15172
+ var G2 = Colors2.invGammaCorrection(rgb[1]);
15173
15173
  var B2 = Colors2.invGammaCorrection(rgb[2]);
15174
- 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];
15174
+ 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];
15175
15175
  }
15176
15176
  }, {
15177
15177
  key: "xyz2LAB",
@@ -18026,17 +18026,17 @@ var require_dcmjs = __commonJS({
18026
18026
  if (shape === void 0) {
18027
18027
  shape = [data3.length];
18028
18028
  }
18029
- var d2 = shape.length;
18029
+ var d3 = shape.length;
18030
18030
  if (stride === void 0) {
18031
- stride = new Array(d2);
18032
- for (var i2 = d2 - 1, sz = 1; i2 >= 0; --i2) {
18031
+ stride = new Array(d3);
18032
+ for (var i2 = d3 - 1, sz = 1; i2 >= 0; --i2) {
18033
18033
  stride[i2] = sz;
18034
18034
  sz *= shape[i2];
18035
18035
  }
18036
18036
  }
18037
18037
  if (offset === void 0) {
18038
18038
  offset = 0;
18039
- for (var i2 = 0; i2 < d2; ++i2) {
18039
+ for (var i2 = 0; i2 < d3; ++i2) {
18040
18040
  if (stride[i2] < 0) {
18041
18041
  offset -= (shape[i2] - 1) * stride[i2];
18042
18042
  }
@@ -18044,10 +18044,10 @@ var require_dcmjs = __commonJS({
18044
18044
  }
18045
18045
  var dtype = arrayDType(data3);
18046
18046
  var ctor_list = CACHED_CONSTRUCTORS[dtype];
18047
- while (ctor_list.length <= d2 + 1) {
18047
+ while (ctor_list.length <= d3 + 1) {
18048
18048
  ctor_list.push(compileConstructor(dtype, ctor_list.length - 1));
18049
18049
  }
18050
- var ctor = ctor_list[d2 + 1];
18050
+ var ctor = ctor_list[d3 + 1];
18051
18051
  return ctor(data3, shape, stride, offset);
18052
18052
  }
18053
18053
  var ndarray = wrappedNDArrayCtor;
@@ -18208,8 +18208,8 @@ var require_dcmjs = __commonJS({
18208
18208
  var imageId = images[frame].imageId;
18209
18209
  var imageIdSpecificToolState = toolState[imageId];
18210
18210
  var brushPixelData = imageIdSpecificToolState.brush.data[segmentIndex].pixelData;
18211
- for (var p2 = 0; p2 < brushPixelData.length; p2++) {
18212
- pixelData[pixelDataIndex] = brushPixelData[p2];
18211
+ for (var p = 0; p < brushPixelData.length; p++) {
18212
+ pixelData[pixelDataIndex] = brushPixelData[p];
18213
18213
  pixelDataIndex++;
18214
18214
  }
18215
18215
  }
@@ -18349,11 +18349,11 @@ var require_dcmjs = __commonJS({
18349
18349
  var brushDataI = toolState[imageId].brush.data[segmentIndex];
18350
18350
  brushDataI.pixelData = new Uint8Array(pixelData2D.data.length);
18351
18351
  var cToolsPixelData = brushDataI.pixelData;
18352
- for (var p2 = 0; p2 < cToolsPixelData.length; p2++) {
18353
- if (pixelData2D.data[p2]) {
18354
- cToolsPixelData[p2] = 1;
18352
+ for (var p = 0; p < cToolsPixelData.length; p++) {
18353
+ if (pixelData2D.data[p]) {
18354
+ cToolsPixelData[p] = 1;
18355
18355
  } else {
18356
- cToolsPixelData[p2] = 0;
18356
+ cToolsPixelData[p] = 0;
18357
18357
  }
18358
18358
  }
18359
18359
  }
@@ -18547,8 +18547,8 @@ var require_dcmjs = __commonJS({
18547
18547
  if (byteValue <= 127) {
18548
18548
  var N2 = byteValue + 1;
18549
18549
  var next = i2 + 1;
18550
- for (var p2 = next; p2 < next + N2; p2++) {
18551
- pixelData[pixelDataIndex] = uInt8Frame[p2];
18550
+ for (var p = next; p < next + N2; p++) {
18551
+ pixelData[pixelDataIndex] = uInt8Frame[p];
18552
18552
  pixelDataIndex++;
18553
18553
  }
18554
18554
  i2 += N2 + 1;
@@ -20148,8 +20148,8 @@ var require_dcmjs = __commonJS({
20148
20148
  value: function getCornerstoneLabelFromDefaultState(defaultState) {
20149
20149
  var _defaultState$finding = defaultState.findingSites, findingSites = _defaultState$finding === void 0 ? [] : _defaultState$finding, finding = defaultState.finding;
20150
20150
  var cornersoneFreeTextCodingValue = CodingScheme.codeValues.CORNERSTONEFREETEXT;
20151
- var freeTextLabel = findingSites.find(function(fs4) {
20152
- return fs4.CodeValue === cornersoneFreeTextCodingValue;
20151
+ var freeTextLabel = findingSites.find(function(fs3) {
20152
+ return fs3.CodeValue === cornersoneFreeTextCodingValue;
20153
20153
  });
20154
20154
  if (freeTextLabel) {
20155
20155
  return freeTextLabel.CodeMeaning;
@@ -20744,18 +20744,18 @@ var require_dcmjs = __commonJS({
20744
20744
  out[2] = az + t * (b2[2] - az);
20745
20745
  return out;
20746
20746
  }
20747
- function hermite(out, a2, b2, c, d2, t) {
20747
+ function hermite(out, a2, b2, c, d3, t) {
20748
20748
  var factorTimes2 = t * t;
20749
20749
  var factor1 = factorTimes2 * (2 * t - 3) + 1;
20750
20750
  var factor2 = factorTimes2 * (t - 2) + t;
20751
20751
  var factor3 = factorTimes2 * (t - 1);
20752
20752
  var factor4 = factorTimes2 * (3 - 2 * t);
20753
- out[0] = a2[0] * factor1 + b2[0] * factor2 + c[0] * factor3 + d2[0] * factor4;
20754
- out[1] = a2[1] * factor1 + b2[1] * factor2 + c[1] * factor3 + d2[1] * factor4;
20755
- out[2] = a2[2] * factor1 + b2[2] * factor2 + c[2] * factor3 + d2[2] * factor4;
20753
+ out[0] = a2[0] * factor1 + b2[0] * factor2 + c[0] * factor3 + d3[0] * factor4;
20754
+ out[1] = a2[1] * factor1 + b2[1] * factor2 + c[1] * factor3 + d3[1] * factor4;
20755
+ out[2] = a2[2] * factor1 + b2[2] * factor2 + c[2] * factor3 + d3[2] * factor4;
20756
20756
  return out;
20757
20757
  }
20758
- function bezier(out, a2, b2, c, d2, t) {
20758
+ function bezier(out, a2, b2, c, d3, t) {
20759
20759
  var inverseFactor = 1 - t;
20760
20760
  var inverseFactorTimesTwo = inverseFactor * inverseFactor;
20761
20761
  var factorTimes2 = t * t;
@@ -20763,9 +20763,9 @@ var require_dcmjs = __commonJS({
20763
20763
  var factor2 = 3 * t * inverseFactorTimesTwo;
20764
20764
  var factor3 = 3 * factorTimes2 * inverseFactor;
20765
20765
  var factor4 = factorTimes2 * t;
20766
- out[0] = a2[0] * factor1 + b2[0] * factor2 + c[0] * factor3 + d2[0] * factor4;
20767
- out[1] = a2[1] * factor1 + b2[1] * factor2 + c[1] * factor3 + d2[1] * factor4;
20768
- out[2] = a2[2] * factor1 + b2[2] * factor2 + c[2] * factor3 + d2[2] * factor4;
20766
+ out[0] = a2[0] * factor1 + b2[0] * factor2 + c[0] * factor3 + d3[0] * factor4;
20767
+ out[1] = a2[1] * factor1 + b2[1] * factor2 + c[1] * factor3 + d3[1] * factor4;
20768
+ out[2] = a2[2] * factor1 + b2[2] * factor2 + c[2] * factor3 + d3[2] * factor4;
20769
20769
  return out;
20770
20770
  }
20771
20771
  function random(out, scale2) {
@@ -20812,39 +20812,39 @@ var require_dcmjs = __commonJS({
20812
20812
  return out;
20813
20813
  }
20814
20814
  function rotateX(out, a2, b2, rad) {
20815
- var p2 = [], r6 = [];
20816
- p2[0] = a2[0] - b2[0];
20817
- p2[1] = a2[1] - b2[1];
20818
- p2[2] = a2[2] - b2[2];
20819
- r6[0] = p2[0];
20820
- r6[1] = p2[1] * Math.cos(rad) - p2[2] * Math.sin(rad);
20821
- r6[2] = p2[1] * Math.sin(rad) + p2[2] * Math.cos(rad);
20815
+ var p = [], r6 = [];
20816
+ p[0] = a2[0] - b2[0];
20817
+ p[1] = a2[1] - b2[1];
20818
+ p[2] = a2[2] - b2[2];
20819
+ r6[0] = p[0];
20820
+ r6[1] = p[1] * Math.cos(rad) - p[2] * Math.sin(rad);
20821
+ r6[2] = p[1] * Math.sin(rad) + p[2] * Math.cos(rad);
20822
20822
  out[0] = r6[0] + b2[0];
20823
20823
  out[1] = r6[1] + b2[1];
20824
20824
  out[2] = r6[2] + b2[2];
20825
20825
  return out;
20826
20826
  }
20827
20827
  function rotateY(out, a2, b2, rad) {
20828
- var p2 = [], r6 = [];
20829
- p2[0] = a2[0] - b2[0];
20830
- p2[1] = a2[1] - b2[1];
20831
- p2[2] = a2[2] - b2[2];
20832
- r6[0] = p2[2] * Math.sin(rad) + p2[0] * Math.cos(rad);
20833
- r6[1] = p2[1];
20834
- r6[2] = p2[2] * Math.cos(rad) - p2[0] * Math.sin(rad);
20828
+ var p = [], r6 = [];
20829
+ p[0] = a2[0] - b2[0];
20830
+ p[1] = a2[1] - b2[1];
20831
+ p[2] = a2[2] - b2[2];
20832
+ r6[0] = p[2] * Math.sin(rad) + p[0] * Math.cos(rad);
20833
+ r6[1] = p[1];
20834
+ r6[2] = p[2] * Math.cos(rad) - p[0] * Math.sin(rad);
20835
20835
  out[0] = r6[0] + b2[0];
20836
20836
  out[1] = r6[1] + b2[1];
20837
20837
  out[2] = r6[2] + b2[2];
20838
20838
  return out;
20839
20839
  }
20840
20840
  function rotateZ(out, a2, b2, rad) {
20841
- var p2 = [], r6 = [];
20842
- p2[0] = a2[0] - b2[0];
20843
- p2[1] = a2[1] - b2[1];
20844
- p2[2] = a2[2] - b2[2];
20845
- r6[0] = p2[0] * Math.cos(rad) - p2[1] * Math.sin(rad);
20846
- r6[1] = p2[0] * Math.sin(rad) + p2[1] * Math.cos(rad);
20847
- r6[2] = p2[2];
20841
+ var p = [], r6 = [];
20842
+ p[0] = a2[0] - b2[0];
20843
+ p[1] = a2[1] - b2[1];
20844
+ p[2] = a2[2] - b2[2];
20845
+ r6[0] = p[0] * Math.cos(rad) - p[1] * Math.sin(rad);
20846
+ r6[1] = p[0] * Math.sin(rad) + p[1] * Math.cos(rad);
20847
+ r6[2] = p[2];
20848
20848
  out[0] = r6[0] + b2[0];
20849
20849
  out[1] = r6[1] + b2[1];
20850
20850
  out[2] = r6[2] + b2[2];
@@ -25777,19 +25777,19 @@ var require_decorator = __commonJS({
25777
25777
  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 : []]);
25778
25778
  return mergedObject;
25779
25779
  };
25780
- var mergePropertyAndMethodDecorators = (d1, d2) => {
25780
+ var mergePropertyAndMethodDecorators = (d1, d22) => {
25781
25781
  var _a, _b, _c, _d;
25782
25782
  return {
25783
- 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 : {}),
25784
- 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 : {})
25783
+ 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 : {}),
25784
+ 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 : {})
25785
25785
  };
25786
25786
  };
25787
- var mergeDecorators = (d1, d2) => {
25787
+ var mergeDecorators = (d1, d22) => {
25788
25788
  var _a, _b, _c, _d, _e, _f;
25789
25789
  return {
25790
- 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 : []]),
25791
- 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 : {}),
25792
- instance: mergePropertyAndMethodDecorators((_e = d1 === null || d1 === void 0 ? void 0 : d1.instance) !== null && _e !== void 0 ? _e : {}, (_f = d2 === null || d2 === void 0 ? void 0 : d2.instance) !== null && _f !== void 0 ? _f : {})
25790
+ 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 : []]),
25791
+ 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 : {}),
25792
+ instance: mergePropertyAndMethodDecorators((_e = d1 === null || d1 === void 0 ? void 0 : d1.instance) !== null && _e !== void 0 ? _e : {}, (_f = d22 === null || d22 === void 0 ? void 0 : d22.instance) !== null && _f !== void 0 ? _f : {})
25793
25793
  };
25794
25794
  };
25795
25795
  var decorators = /* @__PURE__ */ new Map();
@@ -25817,7 +25817,7 @@ var require_decorator = __commonJS({
25817
25817
  return {};
25818
25818
  if (decoratorsForClassChain.length == 1)
25819
25819
  return decoratorsForClassChain[0];
25820
- return decoratorsForClassChain.reduce((d1, d2) => mergeDecorators(d1, d2));
25820
+ return decoratorsForClassChain.reduce((d1, d22) => mergeDecorators(d1, d22));
25821
25821
  };
25822
25822
  exports2.deepDecoratorSearch = deepDecoratorSearch;
25823
25823
  var directDecoratorSearch = (...classes) => {
@@ -25826,7 +25826,7 @@ var require_decorator = __commonJS({
25826
25826
  return {};
25827
25827
  if (classDecorators.length === 1)
25828
25828
  return classDecorators[0];
25829
- return classDecorators.reduce((d1, d2) => mergeDecorators(d1, d2));
25829
+ return classDecorators.reduce((d1, d22) => mergeDecorators(d1, d22));
25830
25830
  };
25831
25831
  exports2.directDecoratorSearch = directDecoratorSearch;
25832
25832
  var getDecoratorsForClass = (clazz) => {
@@ -26162,7 +26162,7 @@ var require_dcmjs_codecs_min = __commonJS({
26162
26162
  "use strict";
26163
26163
  e.exports = __WEBPACK_EXTERNAL_MODULE__111__;
26164
26164
  }, 190: (e, t, r6) => {
26165
- const { Implementation: s, StorageClass: o, TranscodeMap: i2, TransferSyntax: n } = r6(492), { Codec: a2 } = r6(258), l3 = r6(111), { DicomDict: c, DicomMessage: d2, DicomMetaDictionary: p2, ReadBufferStream: h3, WriteBufferStream: m2 } = l3.data, u2 = l3.log;
26165
+ const { Implementation: s, StorageClass: o, TranscodeMap: i2, TransferSyntax: n } = r6(492), { Codec: a2 } = r6(258), l3 = r6(111), { DicomDict: c, DicomMessage: d3, DicomMetaDictionary: p, ReadBufferStream: h3, WriteBufferStream: m2 } = l3.data, u2 = l3.log;
26166
26166
  e.exports = class {
26167
26167
  constructor(e2, t2, r7 = {}) {
26168
26168
  r7 = { ignoreErrors: true, ...r7 }, u2.level = "error", this.transferSyntaxUid = t2 || n.ImplicitVRLittleEndian, e2 instanceof ArrayBuffer ? t2 ? this._fromElementsBuffer(e2, t2, r7) : this._fromP10Buffer(e2) : this.elements = e2 || {};
@@ -26195,24 +26195,24 @@ var require_dcmjs_codecs_min = __commonJS({
26195
26195
  }
26196
26196
  getDicomDataset(e2, t2) {
26197
26197
  e2 = { fragmentMultiframe: false, ...e2 };
26198
- const r7 = t2 ? p2.denaturalizeDataset(this.getElements(), { ...p2.nameMap, ...t2 }) : p2.denaturalizeDataset(this.getElements()), s2 = new m2();
26199
- return d2.write(r7, s2, this.transferSyntaxUid, e2), s2.getBuffer();
26198
+ const r7 = t2 ? p.denaturalizeDataset(this.getElements(), { ...p.nameMap, ...t2 }) : p.denaturalizeDataset(this.getElements()), s2 = new m2();
26199
+ return d3.write(r7, s2, this.transferSyntaxUid, e2), s2.getBuffer();
26200
26200
  }
26201
26201
  getDicomPart10(e2, t2) {
26202
26202
  e2 = { fragmentMultiframe: false, ...e2 };
26203
- const r7 = { _meta: { FileMetaInformationVersion: new Uint8Array([0, 1]).buffer, MediaStorageSOPClassUID: this._getElement("SOPClassUID") || o.SecondaryCaptureImageStorage, MediaStorageSOPInstanceUID: this._getElement("SOPInstanceUID") || p2.uid(), TransferSyntaxUID: this.getTransferSyntaxUid(), ImplementationClassUID: s.ImplementationClassUid, ImplementationVersionName: s.ImplementationVersion }, ...this.getElements() }, i3 = p2.denaturalizeDataset(r7._meta), n2 = new c(i3);
26204
- return n2.dict = t2 ? p2.denaturalizeDataset(r7, { ...p2.nameMap, ...t2 }) : p2.denaturalizeDataset(r7), n2.write(e2);
26203
+ const r7 = { _meta: { FileMetaInformationVersion: new Uint8Array([0, 1]).buffer, MediaStorageSOPClassUID: this._getElement("SOPClassUID") || o.SecondaryCaptureImageStorage, MediaStorageSOPInstanceUID: this._getElement("SOPInstanceUID") || p.uid(), TransferSyntaxUID: this.getTransferSyntaxUid(), ImplementationClassUID: s.ImplementationClassUid, ImplementationVersionName: s.ImplementationVersion }, ...this.getElements() }, i3 = p.denaturalizeDataset(r7._meta), n2 = new c(i3);
26204
+ return n2.dict = t2 ? p.denaturalizeDataset(r7, { ...p.nameMap, ...t2 }) : p.denaturalizeDataset(r7), n2.write(e2);
26205
26205
  }
26206
26206
  _getElement(e2) {
26207
26207
  return this.elements[e2];
26208
26208
  }
26209
26209
  _fromP10Buffer(e2, t2) {
26210
- const r7 = d2.readFile(e2, t2), s2 = p2.naturalizeDataset(r7.meta).TransferSyntaxUID, o2 = p2.naturalizeDataset(r7.dict);
26210
+ const r7 = d3.readFile(e2, t2), s2 = p.naturalizeDataset(r7.meta).TransferSyntaxUID, o2 = p.naturalizeDataset(r7.dict);
26211
26211
  this.elements = o2, this.transferSyntaxUid = s2;
26212
26212
  }
26213
26213
  _fromElementsBuffer(e2, t2, r7) {
26214
- const s2 = new h3(e2), o2 = t2 === n.ImplicitVRLittleEndian ? n.ImplicitVRLittleEndian : t2 === n.ExplicitVRBigEndian ? n.ExplicitVRBigEndian : n.ExplicitVRLittleEndian, i3 = d2._read(s2, o2, r7);
26215
- this.elements = p2.naturalizeDataset(i3), this.transferSyntaxUid = t2;
26214
+ const s2 = new h3(e2), o2 = t2 === n.ImplicitVRLittleEndian ? n.ImplicitVRLittleEndian : t2 === n.ExplicitVRBigEndian ? n.ExplicitVRBigEndian : n.ExplicitVRLittleEndian, i3 = d3._read(s2, o2, r7);
26215
+ this.elements = p.naturalizeDataset(i3), this.transferSyntaxUid = t2;
26216
26216
  }
26217
26217
  };
26218
26218
  }, 213: function(e, t, r6) {
@@ -26246,16 +26246,16 @@ var require_dcmjs_codecs_min = __commonJS({
26246
26246
  }
26247
26247
  if (this.log = this.debug, typeof console === t2 && r8 < this.levels.SILENT) return "No console available for logging";
26248
26248
  }
26249
- function d2(e3) {
26249
+ function d3(e3) {
26250
26250
  return function() {
26251
26251
  typeof console !== t2 && (c.call(this), this[e3].apply(this, arguments));
26252
26252
  };
26253
26253
  }
26254
- function p2(e3, t3, r8) {
26255
- return l3(e3) || d2.apply(this, arguments);
26254
+ function p(e3, t3, r8) {
26255
+ return l3(e3) || d3.apply(this, arguments);
26256
26256
  }
26257
26257
  function h3(e3, r8) {
26258
- var n2, a3, l4, d3 = this, h4 = "loglevel";
26258
+ var n2, a3, l4, d4 = this, h4 = "loglevel";
26259
26259
  function m3(e4) {
26260
26260
  var r9 = (s2[e4] || "silent").toUpperCase();
26261
26261
  if (typeof window !== t2 && h4) {
@@ -26281,7 +26281,7 @@ var require_dcmjs_codecs_min = __commonJS({
26281
26281
  -1 !== o3 && (e4 = /^([^;]+)/.exec(r9.slice(o3 + s3.length + 1))[1]);
26282
26282
  } catch (e5) {
26283
26283
  }
26284
- return void 0 === d3.levels[e4] && (e4 = void 0), e4;
26284
+ return void 0 === d4.levels[e4] && (e4 = void 0), e4;
26285
26285
  }
26286
26286
  }
26287
26287
  function g2() {
@@ -26298,26 +26298,26 @@ var require_dcmjs_codecs_min = __commonJS({
26298
26298
  }
26299
26299
  function f3(e4) {
26300
26300
  var t3 = e4;
26301
- if ("string" == typeof t3 && void 0 !== d3.levels[t3.toUpperCase()] && (t3 = d3.levels[t3.toUpperCase()]), "number" == typeof t3 && t3 >= 0 && t3 <= d3.levels.SILENT) return t3;
26301
+ if ("string" == typeof t3 && void 0 !== d4.levels[t3.toUpperCase()] && (t3 = d4.levels[t3.toUpperCase()]), "number" == typeof t3 && t3 >= 0 && t3 <= d4.levels.SILENT) return t3;
26302
26302
  throw new TypeError("log.setLevel() called with invalid level: " + e4);
26303
26303
  }
26304
- "string" == typeof e3 ? h4 += ":" + e3 : "symbol" == typeof e3 && (h4 = void 0), d3.name = e3, d3.levels = { TRACE: 0, DEBUG: 1, INFO: 2, WARN: 3, ERROR: 4, SILENT: 5 }, d3.methodFactory = r8 || p2, d3.getLevel = function() {
26304
+ "string" == typeof e3 ? h4 += ":" + e3 : "symbol" == typeof e3 && (h4 = void 0), d4.name = e3, d4.levels = { TRACE: 0, DEBUG: 1, INFO: 2, WARN: 3, ERROR: 4, SILENT: 5 }, d4.methodFactory = r8 || p, d4.getLevel = function() {
26305
26305
  return null != l4 ? l4 : null != a3 ? a3 : n2;
26306
- }, d3.setLevel = function(e4, t3) {
26307
- return l4 = f3(e4), false !== t3 && m3(l4), c.call(d3);
26308
- }, d3.setDefaultLevel = function(e4) {
26309
- a3 = f3(e4), u2() || d3.setLevel(e4, false);
26310
- }, d3.resetLevel = function() {
26311
- l4 = null, g2(), c.call(d3);
26312
- }, d3.enableAll = function(e4) {
26313
- d3.setLevel(d3.levels.TRACE, e4);
26314
- }, d3.disableAll = function(e4) {
26315
- d3.setLevel(d3.levels.SILENT, e4);
26316
- }, d3.rebuild = function() {
26317
- if (i2 !== d3 && (n2 = f3(i2.getLevel())), c.call(d3), i2 === d3) for (var e4 in o2) o2[e4].rebuild();
26306
+ }, d4.setLevel = function(e4, t3) {
26307
+ return l4 = f3(e4), false !== t3 && m3(l4), c.call(d4);
26308
+ }, d4.setDefaultLevel = function(e4) {
26309
+ a3 = f3(e4), u2() || d4.setLevel(e4, false);
26310
+ }, d4.resetLevel = function() {
26311
+ l4 = null, g2(), c.call(d4);
26312
+ }, d4.enableAll = function(e4) {
26313
+ d4.setLevel(d4.levels.TRACE, e4);
26314
+ }, d4.disableAll = function(e4) {
26315
+ d4.setLevel(d4.levels.SILENT, e4);
26316
+ }, d4.rebuild = function() {
26317
+ if (i2 !== d4 && (n2 = f3(i2.getLevel())), c.call(d4), i2 === d4) for (var e4 in o2) o2[e4].rebuild();
26318
26318
  }, n2 = f3(i2 ? i2.getLevel() : "WARN");
26319
26319
  var w2 = u2();
26320
- null != w2 && (l4 = f3(w2)), c.call(d3);
26320
+ null != w2 && (l4 = f3(w2)), c.call(d4);
26321
26321
  }
26322
26322
  (i2 = new h3()).getLogger = function(e3) {
26323
26323
  if ("symbol" != typeof e3 && "string" != typeof e3 || "" === e3) throw new TypeError("You must supply a name when creating a logger.");
@@ -26336,8 +26336,8 @@ var require_dcmjs_codecs_min = __commonJS({
26336
26336
  const { PhotometricInterpretation: s } = r6(492);
26337
26337
  class o {
26338
26338
  constructor(e2 = {}) {
26339
- const { width: t2, height: r7, bitsAllocated: s2, bitsStored: o2, samplesPerPixel: i2, pixelRepresentation: n, planarConfiguration: a2, photometricInterpretation: l3, encodedBuffer: c, decodedBuffer: d2 } = e2;
26340
- this.width = t2, this.height = r7, this.bitsAllocated = s2, this.bitsStored = o2, this.samplesPerPixel = i2, this.pixelRepresentation = n, this.planarConfiguration = a2, this.photometricInterpretation = l3, this.encodedBuffer = c, this.decodedBuffer = d2;
26339
+ const { width: t2, height: r7, bitsAllocated: s2, bitsStored: o2, samplesPerPixel: i2, pixelRepresentation: n, planarConfiguration: a2, photometricInterpretation: l3, encodedBuffer: c, decodedBuffer: d3 } = e2;
26340
+ this.width = t2, this.height = r7, this.bitsAllocated = s2, this.bitsStored = o2, this.samplesPerPixel = i2, this.pixelRepresentation = n, this.planarConfiguration = a2, this.photometricInterpretation = l3, this.encodedBuffer = c, this.decodedBuffer = d3;
26341
26341
  }
26342
26342
  getWidth() {
26343
26343
  return this.width;
@@ -26422,10 +26422,10 @@ var require_dcmjs_codecs_min = __commonJS({
26422
26422
  }
26423
26423
  e.exports = o;
26424
26424
  }, 237: (e, t, r6) => {
26425
- const { Codec: s, ExplicitVRBigEndianCodec: o, ExplicitVRLittleEndianCodec: i2, HtJpeg2000LosslessCodec: n, HtJpeg2000LosslessRpclCodec: a2, HtJpeg2000LossyCodec: l3, ImplicitVRLittleEndianCodec: c, Jpeg2000LosslessCodec: d2, Jpeg2000LossyCodec: p2, JpegBaselineProcess1Codec: h3, JpegLosslessProcess14V1Codec: m2, JpegLsLosslessCodec: u2, JpegLsLossyCodec: g2, RleLosslessCodec: f3 } = r6(258), { Jpeg2000ProgressionOrder: w2, JpegSampleFactor: P, PhotometricInterpretation: y3, PixelRepresentation: x, PlanarConfiguration: C2, TransferSyntax: b2 } = r6(492), _2 = r6(234), I2 = r6(25), A2 = r6(190), S2 = { codecs: { Codec: s, ExplicitVRBigEndianCodec: o, ExplicitVRLittleEndianCodec: i2, HtJpeg2000LosslessCodec: n, HtJpeg2000LosslessRpclCodec: a2, HtJpeg2000LossyCodec: l3, ImplicitVRLittleEndianCodec: c, Jpeg2000LosslessCodec: d2, Jpeg2000LossyCodec: p2, JpegBaselineProcess1Codec: h3, JpegLosslessProcess14V1Codec: m2, JpegLsLosslessCodec: u2, JpegLsLossyCodec: g2, RleLosslessCodec: f3 }, constants: { Jpeg2000ProgressionOrder: w2, JpegSampleFactor: P, PhotometricInterpretation: y3, PixelRepresentation: x, PlanarConfiguration: C2, TransferSyntax: b2 }, Context: _2, log: r6(547), NativeCodecs: I2, Transcoder: A2, version: r6(837) };
26425
+ const { Codec: s, ExplicitVRBigEndianCodec: o, ExplicitVRLittleEndianCodec: i2, HtJpeg2000LosslessCodec: n, HtJpeg2000LosslessRpclCodec: a2, HtJpeg2000LossyCodec: l3, ImplicitVRLittleEndianCodec: c, Jpeg2000LosslessCodec: d3, Jpeg2000LossyCodec: p, JpegBaselineProcess1Codec: h3, JpegLosslessProcess14V1Codec: m2, JpegLsLosslessCodec: u2, JpegLsLossyCodec: g2, RleLosslessCodec: f3 } = r6(258), { Jpeg2000ProgressionOrder: w2, JpegSampleFactor: P, PhotometricInterpretation: y3, PixelRepresentation: x, PlanarConfiguration: C2, TransferSyntax: b2 } = r6(492), _2 = r6(234), I2 = r6(25), A2 = r6(190), S2 = { codecs: { Codec: s, ExplicitVRBigEndianCodec: o, ExplicitVRLittleEndianCodec: i2, HtJpeg2000LosslessCodec: n, HtJpeg2000LosslessRpclCodec: a2, HtJpeg2000LossyCodec: l3, ImplicitVRLittleEndianCodec: c, Jpeg2000LosslessCodec: d3, Jpeg2000LossyCodec: p, JpegBaselineProcess1Codec: h3, JpegLosslessProcess14V1Codec: m2, JpegLsLosslessCodec: u2, JpegLsLossyCodec: g2, RleLosslessCodec: f3 }, constants: { Jpeg2000ProgressionOrder: w2, JpegSampleFactor: P, PhotometricInterpretation: y3, PixelRepresentation: x, PlanarConfiguration: C2, TransferSyntax: b2 }, Context: _2, log: r6(547), NativeCodecs: I2, Transcoder: A2, version: r6(837) };
26426
26426
  e.exports = S2;
26427
26427
  }, 258: (e, t, r6) => {
26428
- const { Jpeg2000ProgressionOrder: s, JpegSampleFactor: o, PhotometricInterpretation: i2, PlanarConfiguration: n, TransferSyntax: a2 } = r6(492), { FrameConverter: l3, Frames: c } = r6(859), d2 = r6(234), p2 = r6(25), h3 = r6(984);
26428
+ const { Jpeg2000ProgressionOrder: s, JpegSampleFactor: o, PhotometricInterpretation: i2, PlanarConfiguration: n, TransferSyntax: a2 } = r6(492), { FrameConverter: l3, Frames: c } = r6(859), d3 = r6(234), p = r6(25), h3 = r6(984);
26429
26429
  class m2 {
26430
26430
  encode(e2, t2, r7 = {}) {
26431
26431
  throw new Error("encode should be implemented");
@@ -26443,9 +26443,9 @@ var require_dcmjs_codecs_min = __commonJS({
26443
26443
  for (let t3 = 0; t3 < i3; t3++) {
26444
26444
  let i4 = o2.getFrameBuffer(t3);
26445
26445
  s2.unpackLow16 && (i4 = l3.unpackLow16(i4)), s2.convertYbrFullToRgb && (i4 = l3.ybrFullToRgb(i4)), s2.convertYbrFull422ToRgb && (i4 = l3.ybrFull422ToRgb(i4, o2.getWidth())), s2.updatePlanarConfiguration && (i4 = l3.changePlanarConfiguration(i4, e2.BitsAllocated, e2.SamplesPerPixel, n.Planar));
26446
- const c2 = d2.fromDicomElements(e2);
26446
+ const c2 = d3.fromDicomElements(e2);
26447
26447
  c2.setDecodedBuffer(i4);
26448
- const m3 = p2[r7](c2, s2);
26448
+ const m3 = p[r7](c2, s2);
26449
26449
  let u3 = m3.getEncodedBuffer();
26450
26450
  u3.length % 2 != 0 && (u3 = h3.concatBuffers([u3, Uint8Array.from([0])])), a3.push(u3.buffer.slice(u3.byteOffset, u3.byteOffset + u3.byteLength)), Object.assign(e2, m3.toDicomElements());
26451
26451
  }
@@ -26454,9 +26454,9 @@ var require_dcmjs_codecs_min = __commonJS({
26454
26454
  _baseDecodeImpl(e2, t2, r7, s2 = {}) {
26455
26455
  const o2 = new c(e2, t2), i3 = o2.getNumberOfFrames(), a3 = [];
26456
26456
  for (let t3 = 0; t3 < i3; t3++) {
26457
- const i4 = o2.getFrameBuffer(t3), c2 = d2.fromDicomElements(e2);
26457
+ const i4 = o2.getFrameBuffer(t3), c2 = d3.fromDicomElements(e2);
26458
26458
  c2.setEncodedBuffer(i4);
26459
- const m3 = p2[r7](c2, s2);
26459
+ const m3 = p[r7](c2, s2);
26460
26460
  let u3 = m3.getDecodedBuffer();
26461
26461
  u3.length % 2 != 0 && (u3 = h3.concatBuffers([u3, Uint8Array.from([0])])), s2.updatePlanarConfiguration && (u3 = l3.changePlanarConfiguration(u3, e2.BitsAllocated, e2.SamplesPerPixel, n.Interleaved)), a3.push(u3.buffer.slice(u3.byteOffset, u3.byteOffset + u3.byteLength)), Object.assign(e2, m3.toDicomElements());
26462
26462
  }
@@ -26670,8 +26670,8 @@ var require_dcmjs_codecs_min = __commonJS({
26670
26670
  Object.freeze(l3);
26671
26671
  const c = { Sf444: 0, Sf422: 1, Unknown: 2 };
26672
26672
  Object.freeze(c);
26673
- const d2 = { Lrcp: 0, Rlcp: 1, Rpcl: 2, Pcrl: 3, Cprl: 4 };
26674
- Object.freeze(d2), e.exports = { ErrNo: l3, Implementation: n, Jpeg2000ProgressionOrder: d2, JpegSampleFactor: c, PhotometricInterpretation: s, PixelRepresentation: i2, PlanarConfiguration: o, StorageClass: a2, TranscodeMap: r6, TransferSyntax: t };
26673
+ const d3 = { Lrcp: 0, Rlcp: 1, Rpcl: 2, Pcrl: 3, Cprl: 4 };
26674
+ Object.freeze(d3), e.exports = { ErrNo: l3, Implementation: n, Jpeg2000ProgressionOrder: d3, JpegSampleFactor: c, PhotometricInterpretation: s, PixelRepresentation: i2, PlanarConfiguration: o, StorageClass: a2, TranscodeMap: r6, TransferSyntax: t };
26675
26675
  }, 547: (e, t, r6) => {
26676
26676
  const s = r6(213), o = r6(935);
26677
26677
  o.reg(s), s.enableAll(false), o.apply(s, { format: (e2, t2, r7) => `${r7} -- ${e2.toUpperCase()} --`, timestampFormatter: (e2) => e2.toISOString() }), e.exports = s;
@@ -26829,14 +26829,14 @@ var require_dcmjs_codecs_min = __commonJS({
26829
26829
  if (!e3 || !e3.setLevel) throw new TypeError("Argument is not a logger");
26830
26830
  var n2 = e3.methodFactory, a3 = e3.name || "", l3 = i2[a3] || i2[""] || o2;
26831
26831
  function c(e4, t3, r9) {
26832
- var s3 = n2(e4, t3, r9), o3 = i2[r9] || i2[""], l4 = -1 !== o3.template.indexOf("%t"), c2 = -1 !== o3.template.indexOf("%l"), d2 = -1 !== o3.template.indexOf("%n");
26832
+ var s3 = n2(e4, t3, r9), o3 = i2[r9] || i2[""], l4 = -1 !== o3.template.indexOf("%t"), c2 = -1 !== o3.template.indexOf("%l"), d3 = -1 !== o3.template.indexOf("%n");
26833
26833
  return function() {
26834
- for (var t4 = "", n3 = arguments.length, p2 = Array(n3), h3 = 0; h3 < n3; h3++) p2[h3] = arguments[h3];
26834
+ for (var t4 = "", n3 = arguments.length, p = Array(n3), h3 = 0; h3 < n3; h3++) p[h3] = arguments[h3];
26835
26835
  if (a3 || !i2[r9]) {
26836
26836
  var m2 = o3.timestampFormatter(/* @__PURE__ */ new Date()), u2 = o3.levelFormatter(e4), g2 = o3.nameFormatter(r9);
26837
- o3.format ? t4 += o3.format(u2, g2, m2) : (t4 += o3.template, l4 && (t4 = t4.replace(/%t/, m2)), c2 && (t4 = t4.replace(/%l/, u2)), d2 && (t4 = t4.replace(/%n/, g2))), p2.length && "string" == typeof p2[0] ? p2[0] = t4 + " " + p2[0] : p2.unshift(t4);
26837
+ o3.format ? t4 += o3.format(u2, g2, m2) : (t4 += o3.template, l4 && (t4 = t4.replace(/%t/, m2)), c2 && (t4 = t4.replace(/%l/, u2)), d3 && (t4 = t4.replace(/%n/, g2))), p.length && "string" == typeof p[0] ? p[0] = t4 + " " + p[0] : p.unshift(t4);
26838
26838
  }
26839
- s3.apply(void 0, p2);
26839
+ s3.apply(void 0, p);
26840
26840
  };
26841
26841
  }
26842
26842
  return i2[a3] || (e3.methodFactory = c), (r8 = r8 || {}).template && (r8.format = void 0), i2[a3] = s2({}, l3, r8), e3.setLevel(e3.getLevel()), t2 || e3.warn("It is necessary to call the function reg() of loglevel-plugin-prefix before calling apply. From the next release, it will throw an error. See more: https://github.com/kutuluk/loglevel-plugin-prefix/blob/master/README.md"), e3;
@@ -29267,8 +29267,8 @@ var require_dcmjs_dimse_min = __commonJS({
29267
29267
  if (t3 !== a3.ImplicitVRLittleEndian && t3 !== a3.ExplicitVRLittleEndian && t3 !== a3.ExplicitVRBigEndian && true !== n2.isInitialized()) throw new Error("Transcoding is not initialized. Please call Transcoding.initializeAsync() first.");
29268
29268
  if (!r7.includes(e3.getTransferSyntaxUid()) || !r7.includes(t3)) throw new Error(`Transcoding dataset from ${this._transferSyntaxDescriptionFromValue(e3.getTransferSyntaxUid())} to ${this._transferSyntaxDescriptionFromValue(t3)} is not supported.`);
29269
29269
  c2.info(`Transcoding dataset from ${this._transferSyntaxDescriptionFromValue(e3.getTransferSyntaxUid())} to ${this._transferSyntaxDescriptionFromValue(t3)}...`);
29270
- const d3 = new i3(e3.getElements(), e3.getTransferSyntaxUid());
29271
- return d3.transcode(t3, s3), new o2(d3.getElements(), d3.getTransferSyntaxUid());
29270
+ const d4 = new i3(e3.getElements(), e3.getTransferSyntaxUid());
29271
+ return d4.transcode(t3, s3), new o2(d4.getElements(), d4.getTransferSyntaxUid());
29272
29272
  }
29273
29273
  static _transferSyntaxDescriptionFromValue(e3) {
29274
29274
  const t3 = Object.keys(a3).find((t4) => a3[t4] === e3);
@@ -29305,8 +29305,8 @@ var require_dcmjs_dimse_min = __commonJS({
29305
29305
  "use strict";
29306
29306
  e2.exports = t;
29307
29307
  }, 237: (e2, t2, s2) => {
29308
- const { Association: n2, PresentationContext: i3 } = s2(570), { Scp: r7, Server: a3 } = s2(538), { CCancelRequest: o2, CEchoRequest: c2, CEchoResponse: d3, CFindRequest: u2, CFindResponse: h3, CGetRequest: m2, CGetResponse: g2, CMoveRequest: l3, CMoveResponse: p2, CStoreRequest: R2, CStoreResponse: S2, NActionRequest: y3, NActionResponse: f3, NCreateRequest: I2, NCreateResponse: C2, NDeleteRequest: P, NDeleteResponse: A2, NEventReportRequest: v2, NEventReportResponse: x, NGetRequest: w2, NGetResponse: U, NSetRequest: q2, NSetResponse: D2 } = s2(940), { AbortReason: E2, AbortSource: T, CommandFieldType: b2, PresentationContextResult: O2, Priority: N2, RawPduType: M2, RejectReason: B2, RejectResult: L2, RejectSource: F2, SopClass: k2, Status: $, StorageClass: j, TransferSyntax: V2, Uid: _2, UserIdentityType: G } = s2(492), z2 = s2(422), Q2 = s2(825), W2 = s2(139), J2 = s2(906), X2 = s2(73), H2 = { association: { Association: n2, PresentationContext: i3 }, Client: z2, constants: { AbortReason: E2, AbortSource: T, CommandFieldType: b2, PresentationContextResult: O2, Priority: N2, RawPduType: M2, RejectReason: B2, RejectResult: L2, RejectSource: F2, SopClass: k2, Status: $, StorageClass: j, TransferSyntax: V2, Uid: _2, UserIdentityType: G }, Dataset: Q2, Implementation: W2, log: s2(547), requests: { CCancelRequest: o2, CEchoRequest: c2, CFindRequest: u2, CGetRequest: m2, CMoveRequest: l3, CStoreRequest: R2, NActionRequest: y3, NCreateRequest: I2, NDeleteRequest: P, NEventReportRequest: v2, NGetRequest: w2, NSetRequest: q2 }, responses: { CEchoResponse: d3, CFindResponse: h3, CGetResponse: g2, CMoveResponse: p2, CStoreResponse: S2, NActionResponse: f3, NCreateResponse: C2, NDeleteResponse: A2, NEventReportResponse: x, NGetResponse: U, NSetResponse: D2 }, Scp: r7, Server: a3, Statistics: J2, Transcoding: X2, version: s2(837) };
29309
- e2.exports = H2;
29308
+ const { Association: n2, PresentationContext: i3 } = s2(570), { Scp: r7, Server: a3 } = s2(538), { CCancelRequest: o2, CEchoRequest: c2, CEchoResponse: d4, CFindRequest: u2, CFindResponse: h3, CGetRequest: m2, CGetResponse: g2, CMoveRequest: l3, CMoveResponse: p, CStoreRequest: R2, CStoreResponse: S2, NActionRequest: y3, NActionResponse: f3, NCreateRequest: I2, NCreateResponse: C2, NDeleteRequest: P, NDeleteResponse: A2, NEventReportRequest: v2, NEventReportResponse: x, NGetRequest: w2, NGetResponse: U, NSetRequest: q2, NSetResponse: D2 } = s2(940), { AbortReason: E2, AbortSource: T, CommandFieldType: b2, PresentationContextResult: O2, Priority: N2, RawPduType: M2, RejectReason: B2, RejectResult: L2, RejectSource: F2, SopClass: k2, Status: $, StorageClass: j, TransferSyntax: V2, Uid: _2, UserIdentityType: G2 } = s2(492), z2 = s2(422), Q2 = s2(825), W2 = s2(139), J2 = s2(906), X2 = s2(73), H = { association: { Association: n2, PresentationContext: i3 }, Client: z2, constants: { AbortReason: E2, AbortSource: T, CommandFieldType: b2, PresentationContextResult: O2, Priority: N2, RawPduType: M2, RejectReason: B2, RejectResult: L2, RejectSource: F2, SopClass: k2, Status: $, StorageClass: j, TransferSyntax: V2, Uid: _2, UserIdentityType: G2 }, Dataset: Q2, Implementation: W2, log: s2(547), requests: { CCancelRequest: o2, CEchoRequest: c2, CFindRequest: u2, CGetRequest: m2, CMoveRequest: l3, CStoreRequest: R2, NActionRequest: y3, NCreateRequest: I2, NDeleteRequest: P, NEventReportRequest: v2, NGetRequest: w2, NSetRequest: q2 }, responses: { CEchoResponse: d4, CFindResponse: h3, CGetResponse: g2, CMoveResponse: p, CStoreResponse: S2, NActionResponse: f3, NCreateResponse: C2, NDeleteResponse: A2, NEventReportResponse: x, NGetResponse: U, NSetResponse: D2 }, Scp: r7, Server: a3, Statistics: J2, Transcoding: X2, version: s2(837) };
29309
+ e2.exports = H;
29310
29310
  }, 278: (e2) => {
29311
29311
  "use strict";
29312
29312
  e2.exports = require("net");
@@ -29314,8 +29314,8 @@ var require_dcmjs_dimse_min = __commonJS({
29314
29314
  "use strict";
29315
29315
  e2.exports = s;
29316
29316
  }, 371: (e2, t2, s2) => {
29317
- const { Association: n2 } = s2(570), { AAbort: i3, AAssociateAC: r7, AAssociateRJ: a3, AAssociateRQ: o2, AReleaseRP: c2, AReleaseRQ: d3, PDataTF: u2, Pdv: h3, RawPdu: m2 } = s2(942), { CommandFieldType: g2, RawPduType: l3, Status: p2 } = s2(492), { CCancelRequest: R2, CEchoRequest: S2, CEchoResponse: y3, CFindRequest: f3, CFindResponse: I2, CGetRequest: C2, CGetResponse: P, CMoveRequest: A2, CMoveResponse: v2, Command: x, CStoreRequest: w2, CStoreResponse: U, NActionRequest: q2, NActionResponse: D2, NCreateRequest: E2, NCreateResponse: T, NDeleteRequest: b2, NDeleteResponse: O2, NEventReportRequest: N2, NEventReportResponse: M2, NGetRequest: B2, NGetResponse: L2, NSetRequest: F2, NSetResponse: k2, Response: $ } = s2(940), j = s2(825), V2 = s2(139), _2 = s2(906), G = s2(73), z2 = s2(547), { SmartBuffer: Q2 } = s2(766), { EOL: W2 } = s2(857), J2 = s2(733), X2 = s2(235);
29318
- class H2 extends J2 {
29317
+ const { Association: n2 } = s2(570), { AAbort: i3, AAssociateAC: r7, AAssociateRJ: a3, AAssociateRQ: o2, AReleaseRP: c2, AReleaseRQ: d4, PDataTF: u2, Pdv: h3, RawPdu: m2 } = s2(942), { CommandFieldType: g2, RawPduType: l3, Status: p } = s2(492), { CCancelRequest: R2, CEchoRequest: S2, CEchoResponse: y3, CFindRequest: f3, CFindResponse: I2, CGetRequest: C2, CGetResponse: P, CMoveRequest: A2, CMoveResponse: v2, Command: x, CStoreRequest: w2, CStoreResponse: U, NActionRequest: q2, NActionResponse: D2, NCreateRequest: E2, NCreateResponse: T, NDeleteRequest: b2, NDeleteResponse: O2, NEventReportRequest: N2, NEventReportResponse: M2, NGetRequest: B2, NGetResponse: L2, NSetRequest: F2, NSetResponse: k2, Response: $ } = s2(940), j = s2(825), V2 = s2(139), _2 = s2(906), G2 = s2(73), z2 = s2(547), { SmartBuffer: Q2 } = s2(766), { EOL: W2 } = s2(857), J2 = s2(733), X2 = s2(235);
29318
+ class H extends J2 {
29319
29319
  constructor() {
29320
29320
  super();
29321
29321
  }
@@ -29367,7 +29367,7 @@ var require_dcmjs_dimse_min = __commonJS({
29367
29367
  z2.info(`${this.logId} -> Association reject ${n3.toString()}`), this._sendPdu(i4);
29368
29368
  }
29369
29369
  sendAssociationReleaseRequest() {
29370
- const e3 = new d3().write();
29370
+ const e3 = new d4().write();
29371
29371
  z2.info(`${this.logId} -> Association release request`), this._sendPdu(e3);
29372
29372
  }
29373
29373
  sendAssociationReleaseResponse() {
@@ -29435,7 +29435,7 @@ var require_dcmjs_dimse_min = __commonJS({
29435
29435
  try {
29436
29436
  const t3 = e3.command.getDataset(), s3 = this.association.getPresentationContext(e3.context.getPresentationContextId()).getAcceptedTransferSyntaxUid();
29437
29437
  if (t3 && s3 !== t3.getTransferSyntaxUid()) try {
29438
- const n3 = G.transcodeDataset(t3, s3, this.datasetTranscodeOptions);
29438
+ const n3 = G2.transcodeDataset(t3, s3, this.datasetTranscodeOptions);
29439
29439
  e3.command.setDataset(n3);
29440
29440
  } catch (t4) {
29441
29441
  return z2.error(t4.message), void e3.command.raiseDoneEvent();
@@ -29488,7 +29488,7 @@ var require_dcmjs_dimse_min = __commonJS({
29488
29488
  break;
29489
29489
  }
29490
29490
  case l3.AReleaseRQ:
29491
- new d3().read(t3), z2.info(`${this.logId} <- Association release request`), this.emit("associationReleaseRequested");
29491
+ new d4().read(t3), z2.info(`${this.logId} <- Association release request`), this.emit("associationReleaseRequested");
29492
29492
  break;
29493
29493
  case l3.AReleaseRP:
29494
29494
  new c2().read(t3), z2.info(`${this.logId} <- Association release response`), this.emit("associationReleaseResponse");
@@ -29606,7 +29606,7 @@ var require_dcmjs_dimse_min = __commonJS({
29606
29606
  _performDimse(e3, t3) {
29607
29607
  if (t3 instanceof $) {
29608
29608
  const e4 = Object.assign(Object.create(Object.getPrototypeOf(t3)), t3), s3 = this.pending.find((e5) => e5.getMessageId() === t3.getMessageIdBeingRespondedTo());
29609
- s3 && (s3.raiseResponseEvent(e4), e4.getStatus() !== p2.Pending && s3.raiseDoneEvent());
29609
+ s3 && (s3.raiseResponseEvent(e4), e4.getStatus() !== p.Pending && s3.raiseDoneEvent());
29610
29610
  } else t3.getCommandFieldType() === g2.CEchoRequest ? this.emit("cEchoRequest", t3, (t4) => {
29611
29611
  this._sendDimse({ context: e3, command: t4 });
29612
29612
  }) : t3.getCommandFieldType() === g2.CFindRequest ? this.emit("cFindRequest", t3, (t4) => {
@@ -29641,7 +29641,7 @@ var require_dcmjs_dimse_min = __commonJS({
29641
29641
  this.socket.setTimeout(this.connectTimeout), this.socket.on("connect", () => {
29642
29642
  this.connected = true, this.connectedTime = Date.now(), this.emit("connect");
29643
29643
  });
29644
- const e3 = new H2();
29644
+ const e3 = new H();
29645
29645
  e3.on("pdu", async (e4) => {
29646
29646
  this.lastPduTime = Date.now(), await this._processPdu(e4);
29647
29647
  }), e3.on("error", (e4) => {
@@ -29671,10 +29671,10 @@ var require_dcmjs_dimse_min = __commonJS({
29671
29671
  }
29672
29672
  };
29673
29673
  }, 422: (e2, t2, s2) => {
29674
- const { Association: n2, PresentationContext: i3 } = s2(570), { TransferSyntax: r7, UserIdentityType: a3 } = s2(492), { Request: o2 } = s2(940), c2 = s2(371), d3 = s2(906), u2 = s2(547), h3 = s2(733), m2 = s2(278), g2 = s2(756);
29674
+ const { Association: n2, PresentationContext: i3 } = s2(570), { TransferSyntax: r7, UserIdentityType: a3 } = s2(492), { Request: o2 } = s2(940), c2 = s2(371), d4 = s2(906), u2 = s2(547), h3 = s2(733), m2 = s2(278), g2 = s2(756);
29675
29675
  e2.exports = class extends h3 {
29676
29676
  constructor() {
29677
- super(), this.requests = [], this.additionalPresentationContexts = [], this.network = void 0, this.statistics = new d3();
29677
+ super(), this.requests = [], this.additionalPresentationContexts = [], this.network = void 0, this.statistics = new d4();
29678
29678
  }
29679
29679
  addRequest(e3) {
29680
29680
  if (!(e3 instanceof o2)) throw new Error(`${e3.toString()} is not a request`);
@@ -29689,37 +29689,37 @@ var require_dcmjs_dimse_min = __commonJS({
29689
29689
  }
29690
29690
  send(e3, t3, s3, i4, o3) {
29691
29691
  if (o3 = o3 || {}, this.associationLingerTimeout = o3.associationLingerTimeout || 0, 0 === this.requests.length) throw new Error("There are no requests to perform");
29692
- const d4 = new n2(s3, i4);
29693
- o3.asyncOps && (d4.setMaxAsyncOpsInvoked(o3.asyncOps.maxAsyncOpsInvoked || 1), d4.setMaxAsyncOpsPerformed(o3.asyncOps.maxAsyncOpsPerformed || 1), d4.setNegotiateAsyncOps(1 !== d4.getMaxAsyncOpsInvoked() || 1 !== d4.getMaxAsyncOpsPerformed())), o3.userIdentity && (d4.setUserIdentityType(o3.userIdentity.type || a3.Username), d4.setUserIdentityPositiveResponseRequested(o3.userIdentity.positiveResponseRequested || false), d4.setUserIdentityPrimaryField(o3.userIdentity.primaryField || ""), d4.setUserIdentitySecondaryField(o3.userIdentity.secondaryField || ""), d4.setNegotiateUserIdentity(true)), this.requests.forEach((e4) => {
29694
- d4.addPresentationContextFromRequest(e4, [r7.ImplicitVRLittleEndian, r7.ExplicitVRLittleEndian]);
29692
+ const d5 = new n2(s3, i4);
29693
+ o3.asyncOps && (d5.setMaxAsyncOpsInvoked(o3.asyncOps.maxAsyncOpsInvoked || 1), d5.setMaxAsyncOpsPerformed(o3.asyncOps.maxAsyncOpsPerformed || 1), d5.setNegotiateAsyncOps(1 !== d5.getMaxAsyncOpsInvoked() || 1 !== d5.getMaxAsyncOpsPerformed())), o3.userIdentity && (d5.setUserIdentityType(o3.userIdentity.type || a3.Username), d5.setUserIdentityPositiveResponseRequested(o3.userIdentity.positiveResponseRequested || false), d5.setUserIdentityPrimaryField(o3.userIdentity.primaryField || ""), d5.setUserIdentitySecondaryField(o3.userIdentity.secondaryField || ""), d5.setNegotiateUserIdentity(true)), this.requests.forEach((e4) => {
29694
+ d5.addPresentationContextFromRequest(e4, [r7.ImplicitVRLittleEndian, r7.ExplicitVRLittleEndian]);
29695
29695
  }), this.additionalPresentationContexts.forEach((e4) => {
29696
- const t4 = e4.addAsNew ? d4.addPresentationContext(e4.context.getAbstractSyntaxUid()) : d4.addOrGetPresentationContext(e4.context.getAbstractSyntaxUid());
29696
+ const t4 = e4.addAsNew ? d5.addPresentationContext(e4.context.getAbstractSyntaxUid()) : d5.addOrGetPresentationContext(e4.context.getAbstractSyntaxUid());
29697
29697
  e4.context.getTransferSyntaxUids().forEach((e5) => {
29698
- d4.addTransferSyntaxToPresentationContext(t4, e5);
29698
+ d5.addTransferSyntaxToPresentationContext(t4, e5);
29699
29699
  });
29700
29700
  });
29701
29701
  let h4 = {};
29702
29702
  o3.securityOptions && (h4 = { key: o3.securityOptions.key, cert: o3.securityOptions.cert, ca: o3.securityOptions.ca, requestCert: o3.securityOptions.requestCert, rejectUnauthorized: o3.securityOptions.rejectUnauthorized, minVersion: o3.securityOptions.minVersion, maxVersion: o3.securityOptions.maxVersion, ciphers: o3.securityOptions.ciphers }), u2.info(`Connecting to ${e3}:${t3} ${o3.securityOptions ? "(TLS)" : ""}`);
29703
- const l3 = (o3.securityOptions ? g2 : m2).connect({ host: e3, port: t3, ...h4 }), p2 = new c2(l3, o3);
29704
- p2.on("connect", () => {
29705
- this.emit("connected"), p2.sendAssociationRequest(d4);
29706
- }), p2.on("associationAccepted", (e4) => {
29707
- this.emit("associationAccepted", e4), p2.sendRequests(this.requests);
29708
- }), p2.on("associationReleaseResponse", () => {
29703
+ const l3 = (o3.securityOptions ? g2 : m2).connect({ host: e3, port: t3, ...h4 }), p = new c2(l3, o3);
29704
+ p.on("connect", () => {
29705
+ this.emit("connected"), p.sendAssociationRequest(d5);
29706
+ }), p.on("associationAccepted", (e4) => {
29707
+ this.emit("associationAccepted", e4), p.sendRequests(this.requests);
29708
+ }), p.on("associationReleaseResponse", () => {
29709
29709
  this.emit("associationReleased"), l3.end();
29710
- }), p2.on("associationRejected", (e4) => {
29710
+ }), p.on("associationRejected", (e4) => {
29711
29711
  this.emit("associationRejected", e4), l3.end();
29712
- }), p2.on("done", () => {
29713
- setTimeout(() => p2.sendAssociationReleaseRequest(), this.associationLingerTimeout);
29714
- }), p2.on("cStoreRequest", (e4, t4) => {
29712
+ }), p.on("done", () => {
29713
+ setTimeout(() => p.sendAssociationReleaseRequest(), this.associationLingerTimeout);
29714
+ }), p.on("cStoreRequest", (e4, t4) => {
29715
29715
  this.emit("cStoreRequest", e4, t4);
29716
- }), p2.on("nEventReportRequest", (e4, t4) => {
29716
+ }), p.on("nEventReportRequest", (e4, t4) => {
29717
29717
  this.emit("nEventReportRequest", e4, t4);
29718
- }), p2.on("networkError", (e4) => {
29718
+ }), p.on("networkError", (e4) => {
29719
29719
  l3.end(), this.emit("networkError", e4);
29720
- }), p2.on("close", () => {
29721
- this.statistics.addFromOtherStatistics(p2.getStatistics()), this.network = void 0, this.emit("closed");
29722
- }), this.network = p2;
29720
+ }), p.on("close", () => {
29721
+ this.statistics.addFromOtherStatistics(p.getStatistics()), this.network = void 0, this.emit("closed");
29722
+ }), this.network = p;
29723
29723
  }
29724
29724
  getStatistics() {
29725
29725
  return this.statistics;
@@ -29753,8 +29753,8 @@ var require_dcmjs_dimse_min = __commonJS({
29753
29753
  Object.freeze(o2);
29754
29754
  const c2 = { ServiceUser: 1, ServiceProviderAcse: 2, ServiceProviderPresentation: 3 };
29755
29755
  Object.freeze(c2);
29756
- const d3 = { NoReasonGiven: 1, ApplicationContextNotSupported: 2, CallingAeNotRecognized: 3, CalledAeNotRecognized: 7, ProtocolVersionNotSupported: 2, TemporaryCongestion: 1, LocalLimitExceeded: 2 };
29757
- Object.freeze(d3);
29756
+ const d4 = { NoReasonGiven: 1, ApplicationContextNotSupported: 2, CallingAeNotRecognized: 3, CalledAeNotRecognized: 7, ProtocolVersionNotSupported: 2, TemporaryCongestion: 1, LocalLimitExceeded: 2 };
29757
+ Object.freeze(d4);
29758
29758
  const u2 = { Low: 2, Medium: 0, High: 1 };
29759
29759
  Object.freeze(u2);
29760
29760
  const h3 = { 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 };
@@ -29765,14 +29765,14 @@ var require_dcmjs_dimse_min = __commonJS({
29765
29765
  Object.freeze(g2);
29766
29766
  const l3 = { Verification: "1.2.840.10008.1.1", StudyRootQueryRetrieveInformationModelFind: "1.2.840.10008.5.1.4.1.2.2.1", ModalityWorklistInformationModelFind: "1.2.840.10008.5.1.4.31", ModalityPerformedProcedureStep: "1.2.840.10008.3.1.2.3.3", StudyRootQueryRetrieveInformationModelMove: "1.2.840.10008.5.1.4.1.2.2.2", StudyRootQueryRetrieveInformationModelGet: "1.2.840.10008.5.1.4.1.2.2.3", StorageCommitmentPushModel: "1.2.840.10008.1.20.1", BasicFilmSession: "1.2.840.10008.5.1.1.1", PrintJob: "1.2.840.10008.5.1.1.14", BasicAnnotationBox: "1.2.840.10008.5.1.1.15", Printer: "1.2.840.10008.5.1.1.16", PrinterConfigurationRetrieval: "1.2.840.10008.5.1.1.16.376", BasicGrayscalePrintManagementMeta: "1.2.840.10008.5.1.1.9", BasicColorPrintManagementMeta: "1.2.840.10008.5.1.1.18", BasicFilmBox: "1.2.840.10008.5.1.1.2", PresentationLut: "1.2.840.10008.5.1.1.23", BasicGrayscaleImageBox: "1.2.840.10008.5.1.1.4", BasicColorImageBox: "1.2.840.10008.5.1.1.4.1", InstanceAvailabilityNotification: "1.2.840.10008.5.1.4.33" };
29767
29767
  Object.freeze(l3);
29768
- const p2 = { ImplicitVRLittleEndian: "1.2.840.10008.1.2", ExplicitVRLittleEndian: "1.2.840.10008.1.2.1", DeflatedExplicitVRLittleEndian: "1.2.840.10008.1.2.1.99", ExplicitVRBigEndian: "1.2.840.10008.1.2.2", RleLossless: "1.2.840.10008.1.2.5", JpegBaseline: "1.2.840.10008.1.2.4.50", JpegLossless: "1.2.840.10008.1.2.4.70", JpegLsLossless: "1.2.840.10008.1.2.4.80", JpegLsLossy: "1.2.840.10008.1.2.4.81", Jpeg2000Lossless: "1.2.840.10008.1.2.4.90", Jpeg2000Lossy: "1.2.840.10008.1.2.4.91", JpegXlLossless: "1.2.840.10008.1.2.4.110", JpegXlRecompression: "1.2.840.10008.1.2.4.111", JpegXl: "1.2.840.10008.1.2.4.112", HtJpeg2000Lossless: "1.2.840.10008.1.2.4.201", HtJpeg2000LosslessRpcl: "1.2.840.10008.1.2.4.202", HtJpeg2000Lossy: "1.2.840.10008.1.2.4.203" };
29769
- Object.freeze(p2);
29770
- const R2 = [p2.ImplicitVRLittleEndian, p2.ExplicitVRLittleEndian, p2.ExplicitVRBigEndian, p2.RleLossless, p2.JpegBaseline, p2.JpegLossless, p2.JpegLsLossless, p2.JpegLsLossy, p2.Jpeg2000Lossless, p2.Jpeg2000Lossy, p2.HtJpeg2000Lossless, p2.HtJpeg2000LosslessRpcl, p2.HtJpeg2000Lossy];
29768
+ const p = { ImplicitVRLittleEndian: "1.2.840.10008.1.2", ExplicitVRLittleEndian: "1.2.840.10008.1.2.1", DeflatedExplicitVRLittleEndian: "1.2.840.10008.1.2.1.99", ExplicitVRBigEndian: "1.2.840.10008.1.2.2", RleLossless: "1.2.840.10008.1.2.5", JpegBaseline: "1.2.840.10008.1.2.4.50", JpegLossless: "1.2.840.10008.1.2.4.70", JpegLsLossless: "1.2.840.10008.1.2.4.80", JpegLsLossy: "1.2.840.10008.1.2.4.81", Jpeg2000Lossless: "1.2.840.10008.1.2.4.90", Jpeg2000Lossy: "1.2.840.10008.1.2.4.91", JpegXlLossless: "1.2.840.10008.1.2.4.110", JpegXlRecompression: "1.2.840.10008.1.2.4.111", JpegXl: "1.2.840.10008.1.2.4.112", HtJpeg2000Lossless: "1.2.840.10008.1.2.4.201", HtJpeg2000LosslessRpcl: "1.2.840.10008.1.2.4.202", HtJpeg2000Lossy: "1.2.840.10008.1.2.4.203" };
29769
+ Object.freeze(p);
29770
+ const R2 = [p.ImplicitVRLittleEndian, p.ExplicitVRLittleEndian, p.ExplicitVRBigEndian, p.RleLossless, p.JpegBaseline, p.JpegLossless, p.JpegLsLossless, p.JpegLsLossy, p.Jpeg2000Lossless, p.Jpeg2000Lossy, p.HtJpeg2000Lossless, p.HtJpeg2000LosslessRpcl, p.HtJpeg2000Lossy];
29771
29771
  Object.freeze(R2);
29772
29772
  const S2 = { ImplementationClassUid: "1.2.826.0.1.3680043.10.854", ImplementationVersion: "DCMJS-DIMSE-V0.2", MaxPduLength: 262144 };
29773
- Object.freeze(S2), e2.exports = { AbortReason: a3, AbortSource: r7, CommandFieldType: s2, DefaultImplementation: S2, PresentationContextResult: n2, Priority: u2, RawPduType: t2, RejectReason: d3, RejectResult: o2, RejectSource: c2, SopClass: l3, Status: h3, StorageClass: g2, TranscodableTransferSyntaxes: R2, TransferSyntax: p2, Uid: m2, UserIdentityType: i3 };
29773
+ Object.freeze(S2), e2.exports = { AbortReason: a3, AbortSource: r7, CommandFieldType: s2, DefaultImplementation: S2, PresentationContextResult: n2, Priority: u2, RawPduType: t2, RejectReason: d4, RejectResult: o2, RejectSource: c2, SopClass: l3, Status: h3, StorageClass: g2, TranscodableTransferSyntaxes: R2, TransferSyntax: p, Uid: m2, UserIdentityType: i3 };
29774
29774
  }, 538: (e2, t2, s2) => {
29775
- const { CEchoResponse: n2, CFindResponse: i3, CGetResponse: r7, CMoveResponse: a3, CStoreResponse: o2, NActionResponse: c2, NCreateResponse: d3, NDeleteResponse: u2, NEventReportResponse: h3, NGetResponse: m2, NSetResponse: g2 } = s2(940), l3 = s2(371), p2 = s2(906), R2 = s2(547), S2 = s2(733), y3 = s2(278), f3 = s2(756);
29775
+ const { CEchoResponse: n2, CFindResponse: i3, CGetResponse: r7, CMoveResponse: a3, CStoreResponse: o2, NActionResponse: c2, NCreateResponse: d4, NDeleteResponse: u2, NEventReportResponse: h3, NGetResponse: m2, NSetResponse: g2 } = s2(940), l3 = s2(371), p = s2(906), R2 = s2(547), S2 = s2(733), y3 = s2(278), f3 = s2(756);
29776
29776
  e2.exports = { Scp: class extends l3 {
29777
29777
  constructor(e3, t3) {
29778
29778
  super(e3, t3), this.on("associationRequested", (e4) => {
@@ -29835,7 +29835,7 @@ var require_dcmjs_dimse_min = __commonJS({
29835
29835
  R2.error("cGetRequest method must be implemented"), t3(r7.fromRequest(e3));
29836
29836
  }
29837
29837
  nCreateRequest(e3, t3) {
29838
- R2.error("nCreateRequest method must be implemented"), t3(d3.fromRequest(e3));
29838
+ R2.error("nCreateRequest method must be implemented"), t3(d4.fromRequest(e3));
29839
29839
  }
29840
29840
  nActionRequest(e3, t3) {
29841
29841
  R2.error("nActionRequest method must be implemented"), t3(c2.fromRequest(e3));
@@ -29860,7 +29860,7 @@ var require_dcmjs_dimse_min = __commonJS({
29860
29860
  }
29861
29861
  }, Server: class extends S2 {
29862
29862
  constructor(e3) {
29863
- super(), this.scp = { class: e3 }, this.server = void 0, this.clients = [], this.statistics = new p2();
29863
+ super(), this.scp = { class: e3 }, this.server = void 0, this.clients = [], this.statistics = new p();
29864
29864
  }
29865
29865
  listen(e3, t3) {
29866
29866
  let s3 = {};
@@ -29892,7 +29892,7 @@ var require_dcmjs_dimse_min = __commonJS({
29892
29892
  const n2 = s2(360), i3 = s2(707);
29893
29893
  i3.reg(n2), n2.enableAll(false), i3.apply(n2, { format: (e3, t3, s3) => `${s3} -- ${e3.toUpperCase()} --`, timestampFormatter: (e3) => e3.toISOString() }), e2.exports = n2;
29894
29894
  }, 570: (e2, t2, s2) => {
29895
- const { CGetRequest: n2, CStoreRequest: i3 } = s2(940), { CommandFieldType: r7, PresentationContextResult: a3, SopClass: o2, StorageClass: c2, TransferSyntax: d3, Uid: u2, UserIdentityType: h3 } = s2(492), m2 = s2(139), { EOL: g2 } = s2(857);
29895
+ const { CGetRequest: n2, CStoreRequest: i3 } = s2(940), { CommandFieldType: r7, PresentationContextResult: a3, SopClass: o2, StorageClass: c2, TransferSyntax: d4, Uid: u2, UserIdentityType: h3 } = s2(492), m2 = s2(139), { EOL: g2 } = s2(857);
29896
29896
  class l3 {
29897
29897
  constructor(e3, t3, s3, n3) {
29898
29898
  this.pcId = e3, this.abstractSyntaxUid = t3, this.transferSyntaxes = [], s3 && this.transferSyntaxes.push(s3), this.result = n3 || a3.Proposed;
@@ -30087,7 +30087,7 @@ var require_dcmjs_dimse_min = __commonJS({
30087
30087
  this.presentationContexts.length = 0;
30088
30088
  }
30089
30089
  addPresentationContextFromRequest(e3, t3) {
30090
- let s3 = t3 || d3.ImplicitVRLittleEndian;
30090
+ let s3 = t3 || d4.ImplicitVRLittleEndian;
30091
30091
  s3 = Array.isArray(s3) ? s3 : [s3];
30092
30092
  const r8 = this._sopClassFromRequest(e3);
30093
30093
  let a4;
@@ -30098,7 +30098,7 @@ var require_dcmjs_dimse_min = __commonJS({
30098
30098
  this.addTransferSyntaxToPresentationContext(a4, e4);
30099
30099
  });
30100
30100
  const t4 = e3.getDataset().getTransferSyntaxUid();
30101
- t4 !== d3.ImplicitVRLittleEndian && t4 !== d3.ExplicitVRLittleEndian && (a4 = this.findPresentationContextByAbstractSyntaxAndTransferSyntax(r8, t4), void 0 === a4 && (a4 = this.addPresentationContext(r8), this.addTransferSyntaxToPresentationContext(a4, t4)));
30101
+ t4 !== d4.ImplicitVRLittleEndian && t4 !== d4.ExplicitVRLittleEndian && (a4 = this.findPresentationContextByAbstractSyntaxAndTransferSyntax(r8, t4), void 0 === a4 && (a4 = this.addPresentationContext(r8), this.addTransferSyntaxToPresentationContext(a4, t4)));
30102
30102
  } else e3 instanceof n2 ? (a4 = this.addOrGetPresentationContext(r8), s3.forEach((e4) => {
30103
30103
  this.addTransferSyntaxToPresentationContext(a4, e4);
30104
30104
  }), true === e3.getAddStorageSopClassesToAssociation() && Object.keys(c2).forEach((e4) => {
@@ -30127,7 +30127,7 @@ var require_dcmjs_dimse_min = __commonJS({
30127
30127
  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) => {
30128
30128
  const s3 = this.getPresentationContext(t3.id);
30129
30129
  e3.push(` Presentation Context: ${t3.id} [${s3.getResultDescription()}]`), e3.push(` Abstract: ${this._uidNameFromValue([o2, c2], s3.getAbstractSyntaxUid()) || s3.getAbstractSyntaxUid()}`), s3.getTransferSyntaxUids().forEach((t4) => {
30130
- e3.push(` Transfer: ${this._uidNameFromValue(d3, t4) || t4}`);
30130
+ e3.push(` Transfer: ${this._uidNameFromValue(d4, t4) || t4}`);
30131
30131
  });
30132
30132
  }), e3.push(""), e3.join(g2);
30133
30133
  }
@@ -30188,7 +30188,7 @@ var require_dcmjs_dimse_min = __commonJS({
30188
30188
  "use strict";
30189
30189
  e2.exports = o;
30190
30190
  }, 825: (e2, t2, s2) => {
30191
- const { StorageClass: n2, TransferSyntax: i3 } = s2(492), r7 = s2(139), { readFile: a3, readFileSync: o2, writeFile: c2, writeFileSync: d3 } = s2(896), { EOL: u2 } = s2(857), h3 = s2(111), { DicomDict: m2, DicomMessage: g2, DicomMetaDictionary: l3, ReadBufferStream: p2, WriteBufferStream: R2 } = h3.data, S2 = h3.log;
30191
+ const { StorageClass: n2, TransferSyntax: i3 } = s2(492), r7 = s2(139), { readFile: a3, readFileSync: o2, writeFile: c2, writeFileSync: d4 } = s2(896), { EOL: u2 } = s2(857), h3 = s2(111), { DicomDict: m2, DicomMessage: g2, DicomMetaDictionary: l3, ReadBufferStream: p, WriteBufferStream: R2 } = h3.data, S2 = h3.log;
30192
30192
  class y3 {
30193
30193
  constructor(e3, t3, s3) {
30194
30194
  s3 = s3 || {}, s3 = { ignoreErrors: true, ...s3 }, S2.level = "error", this.transferSyntaxUid = t3 || i3.ImplicitVRLittleEndian, Buffer.isBuffer(e3) ? this.elements = this._fromElementsBuffer(e3, this.transferSyntaxUid, s3) : this.elements = e3 || {};
@@ -30231,7 +30231,7 @@ var require_dcmjs_dimse_min = __commonJS({
30231
30231
  const a4 = { _meta: { FileMetaInformationVersion: new Uint8Array([0, 1]).buffer, MediaStorageSOPClassUID: this.getElement("SOPClassUID") || n2.SecondaryCaptureImageStorage, MediaStorageSOPInstanceUID: this.getElement("SOPInstanceUID") || y3.generateDerivedUid(), TransferSyntaxUID: this.getTransferSyntaxUid(), ImplementationClassUID: r7.getImplementationClassUid(), ImplementationVersionName: r7.getImplementationVersion() }, ...this.getElements() }, o3 = l3.denaturalizeDataset(a4._meta), u3 = new m2(o3);
30232
30232
  u3.dict = s3 ? l3.denaturalizeDataset(a4, { ...l3.nameMap, ...s3 }) : l3.denaturalizeDataset(a4), t3 instanceof Function ? c2(e3, Buffer.from(u3.write(i4)), (e4) => {
30233
30233
  t3(e4 || void 0);
30234
- }) : d3(e3, Buffer.from(u3.write(i4)));
30234
+ }) : d4(e3, Buffer.from(u3.write(i4)));
30235
30235
  }
30236
30236
  static generateDerivedUid() {
30237
30237
  return l3.uid();
@@ -30246,7 +30246,7 @@ var require_dcmjs_dimse_min = __commonJS({
30246
30246
  return new y3(i4, n3);
30247
30247
  }
30248
30248
  _fromElementsBuffer(e3, t3, s3) {
30249
- const n3 = new p2(e3.buffer.slice(e3.byteOffset, e3.byteOffset + e3.byteLength)), r8 = t3 === i3.ImplicitVRLittleEndian ? i3.ImplicitVRLittleEndian : t3 === i3.ExplicitVRBigEndian ? i3.ExplicitVRBigEndian : i3.ExplicitVRLittleEndian, a4 = g2._read(n3, r8, s3);
30249
+ const n3 = new p(e3.buffer.slice(e3.byteOffset, e3.byteOffset + e3.byteLength)), r8 = t3 === i3.ImplicitVRLittleEndian ? i3.ImplicitVRLittleEndian : t3 === i3.ExplicitVRBigEndian ? i3.ExplicitVRBigEndian : i3.ExplicitVRLittleEndian, a4 = g2._read(n3, r8, s3);
30250
30250
  return l3.naturalizeDataset(a4);
30251
30251
  }
30252
30252
  }
@@ -30292,7 +30292,7 @@ var require_dcmjs_dimse_min = __commonJS({
30292
30292
  }
30293
30293
  };
30294
30294
  }, 940: (e2, t2, s2) => {
30295
- const { CommandFieldType: n2, Priority: i3, SopClass: r7, Status: a3 } = s2(492), o2 = s2(825), { Mixin: c2 } = s2(429), { EOL: d3 } = s2(857), u2 = s2(733), h3 = s2(111), { DicomMetaDictionary: m2 } = h3.data;
30295
+ const { CommandFieldType: n2, Priority: i3, SopClass: r7, Status: a3 } = s2(492), o2 = s2(825), { Mixin: c2 } = s2(429), { EOL: d4 } = s2(857), u2 = s2(733), h3 = s2(111), { DicomMetaDictionary: m2 } = h3.data;
30296
30296
  class g2 {
30297
30297
  constructor(e3, t3) {
30298
30298
  this.commandDataset = e3 || new o2(), this.dataset = t3;
@@ -30317,7 +30317,7 @@ var require_dcmjs_dimse_min = __commonJS({
30317
30317
  }
30318
30318
  toString(e3) {
30319
30319
  const t3 = e3 || {}, s3 = t3.includeCommandDataset || false, n3 = t3.includeDataset || false, i4 = [];
30320
- 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);
30320
+ 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(d4);
30321
30321
  }
30322
30322
  _typeToString(e3) {
30323
30323
  switch (e3) {
@@ -30435,7 +30435,7 @@ var require_dcmjs_dimse_min = __commonJS({
30435
30435
  return `${super.toString(e3)} [id: ${this.getMessageId() || ""}]`;
30436
30436
  }
30437
30437
  }
30438
- class p2 extends g2 {
30438
+ class p extends g2 {
30439
30439
  constructor(e3, t3, s3, i4, r8) {
30440
30440
  switch (super(new o2({ CommandField: e3, CommandDataSetType: s3 ? 514 : 257, Status: i4, ErrorComment: r8 })), e3) {
30441
30441
  case n2.NGetRequest:
@@ -30547,7 +30547,7 @@ var require_dcmjs_dimse_min = __commonJS({
30547
30547
  super(n2.CEchoRequest, r7.Verification, false);
30548
30548
  }
30549
30549
  }
30550
- class S2 extends p2 {
30550
+ class S2 extends p {
30551
30551
  constructor(e3, t3) {
30552
30552
  super(n2.CEchoResponse, r7.Verification, false, e3, t3);
30553
30553
  }
@@ -30592,7 +30592,7 @@ var require_dcmjs_dimse_min = __commonJS({
30592
30592
  return n3.setAffectedSopClassUid(r7.ModalityWorklistInformationModelFind), n3.setDataset(new o2(s3)), n3;
30593
30593
  }
30594
30594
  }
30595
- class f3 extends p2 {
30595
+ class f3 extends p {
30596
30596
  constructor(e3, t3) {
30597
30597
  super(n2.CFindResponse, r7.StudyRootQueryRetrieveInformationModelFind, false, e3, t3);
30598
30598
  }
@@ -30627,7 +30627,7 @@ var require_dcmjs_dimse_min = __commonJS({
30627
30627
  void 0 !== this.needsFullDatasetLoading && true === this.needsFullDatasetLoading && void 0 !== this.datasetOrFile && "" !== this.datasetOrFile.trim() && this.setDataset(o2.fromFile(this.datasetOrFile));
30628
30628
  }
30629
30629
  }
30630
- class C2 extends p2 {
30630
+ class C2 extends p {
30631
30631
  constructor(e3, t3) {
30632
30632
  super(n2.CStoreResponse, "", false, e3, t3);
30633
30633
  }
@@ -30660,7 +30660,7 @@ var require_dcmjs_dimse_min = __commonJS({
30660
30660
  return a4.setDataset(new o2(r8)), a4.getCommandDataset().setElement("MoveDestination", e3), a4;
30661
30661
  }
30662
30662
  }
30663
- class A2 extends p2 {
30663
+ class A2 extends p {
30664
30664
  constructor(e3, t3) {
30665
30665
  super(n2.CMoveResponse, r7.StudyRootQueryRetrieveInformationModelMove, false, e3, t3);
30666
30666
  }
@@ -30726,7 +30726,7 @@ var require_dcmjs_dimse_min = __commonJS({
30726
30726
  return r8.setDataset(new o2(i4)), r8;
30727
30727
  }
30728
30728
  }
30729
- class x extends p2 {
30729
+ class x extends p {
30730
30730
  constructor(e3, t3) {
30731
30731
  super(n2.CGetResponse, r7.StudyRootQueryRetrieveInformationModelGet, false, e3, t3);
30732
30732
  }
@@ -30768,7 +30768,7 @@ var require_dcmjs_dimse_min = __commonJS({
30768
30768
  super(n2.NCreateRequest, e3, false), this.setAffectedSopInstanceUid(t3), this.setMetaSopClassUid(s3);
30769
30769
  }
30770
30770
  }
30771
- class U extends p2 {
30771
+ class U extends p {
30772
30772
  constructor(e3, t3, s3, i4) {
30773
30773
  super(n2.NCreateResponse, e3, false, s3, i4), this.setAffectedSopInstanceUid(t3);
30774
30774
  }
@@ -30789,7 +30789,7 @@ var require_dcmjs_dimse_min = __commonJS({
30789
30789
  this.getCommandDataset().setElement("ActionTypeID", e3);
30790
30790
  }
30791
30791
  }
30792
- class D2 extends p2 {
30792
+ class D2 extends p {
30793
30793
  constructor(e3, t3, s3, i4, r8) {
30794
30794
  super(n2.NActionResponse, e3, false, i4, r8), this.setAffectedSopInstanceUid(t3), this.setActionTypeId(s3);
30795
30795
  }
@@ -30810,7 +30810,7 @@ var require_dcmjs_dimse_min = __commonJS({
30810
30810
  super(n2.NDeleteRequest, e3, false), this.setRequestedSopInstanceUid(t3), this.setMetaSopClassUid(s3);
30811
30811
  }
30812
30812
  }
30813
- class T extends p2 {
30813
+ class T extends p {
30814
30814
  constructor(e3, t3, s3, i4) {
30815
30815
  super(n2.NDeleteResponse, e3, false, s3, i4), this.setAffectedSopInstanceUid(t3);
30816
30816
  }
@@ -30831,7 +30831,7 @@ var require_dcmjs_dimse_min = __commonJS({
30831
30831
  this.getCommandDataset().setElement("EventTypeID", e3);
30832
30832
  }
30833
30833
  }
30834
- class O2 extends p2 {
30834
+ class O2 extends p {
30835
30835
  constructor(e3, t3, s3, i4, r8) {
30836
30836
  super(n2.NEventReportResponse, e3, false, i4, r8), this.setAffectedSopInstanceUid(t3), this.setEventTypeId(s3);
30837
30837
  }
@@ -30873,7 +30873,7 @@ var require_dcmjs_dimse_min = __commonJS({
30873
30873
  return "0".repeat(t3 - s3.length) + s3;
30874
30874
  }
30875
30875
  }
30876
- class M2 extends p2 {
30876
+ class M2 extends p {
30877
30877
  constructor(e3, t3, s3, i4) {
30878
30878
  super(n2.NGetResponse, e3, false, s3, i4), this.setAffectedSopInstanceUid(t3);
30879
30879
  }
@@ -30888,7 +30888,7 @@ var require_dcmjs_dimse_min = __commonJS({
30888
30888
  super(n2.NSetRequest, e3, false), this.setRequestedSopInstanceUid(t3), this.setMetaSopClassUid(s3);
30889
30889
  }
30890
30890
  }
30891
- class L2 extends p2 {
30891
+ class L2 extends p {
30892
30892
  constructor(e3, t3, s3, i4) {
30893
30893
  super(n2.NSetResponse, e3, false, s3, i4), this.setAffectedSopInstanceUid(t3);
30894
30894
  }
@@ -30913,9 +30913,9 @@ var require_dcmjs_dimse_min = __commonJS({
30913
30913
  return new F2(e3.getAffectedSopClassUid(), e3.getMessageId());
30914
30914
  }
30915
30915
  }
30916
- e2.exports = { CCancelRequest: F2, CEchoRequest: R2, CEchoResponse: S2, CFindRequest: y3, CFindResponse: f3, CGetRequest: v2, CGetResponse: x, CMoveRequest: P, CMoveResponse: A2, Command: g2, CStoreRequest: I2, CStoreResponse: C2, NActionRequest: q2, NActionResponse: D2, NCreateRequest: w2, NCreateResponse: U, NDeleteRequest: E2, NDeleteResponse: T, NEventReportRequest: b2, NEventReportResponse: O2, NGetRequest: N2, NGetResponse: M2, NSetRequest: B2, NSetResponse: L2, Request: l3, Response: p2 };
30916
+ e2.exports = { CCancelRequest: F2, CEchoRequest: R2, CEchoResponse: S2, CFindRequest: y3, CFindResponse: f3, CGetRequest: v2, CGetResponse: x, CMoveRequest: P, CMoveResponse: A2, Command: g2, CStoreRequest: I2, CStoreResponse: C2, NActionRequest: q2, NActionResponse: D2, NCreateRequest: w2, NCreateResponse: U, NDeleteRequest: E2, NDeleteResponse: T, NEventReportRequest: b2, NEventReportResponse: O2, NGetRequest: N2, NGetResponse: M2, NSetRequest: B2, NSetResponse: L2, Request: l3, Response: p };
30917
30917
  }, 942: (e2, t2, s2) => {
30918
- const { AbortReason: n2, AbortSource: i3, RawPduType: r7, RejectReason: a3, RejectResult: o2, RejectSource: c2, TransferSyntax: d3 } = s2(492), { SmartBuffer: u2 } = s2(766), { EOL: h3 } = s2(857);
30918
+ const { AbortReason: n2, AbortSource: i3, RawPduType: r7, RejectReason: a3, RejectResult: o2, RejectSource: c2, TransferSyntax: d4 } = s2(492), { SmartBuffer: u2 } = s2(766), { EOL: h3 } = s2(857);
30919
30919
  class m2 {
30920
30920
  constructor(e3) {
30921
30921
  if (this.m16 = [], this.m32 = [], Buffer.isBuffer(e3)) return this.buffer = u2.fromBuffer(e3, "ascii"), void (this.type = this.buffer.readUInt8());
@@ -31101,7 +31101,7 @@ var require_dcmjs_dimse_min = __commonJS({
31101
31101
  const e3 = new m2(r7.AAssociateAC);
31102
31102
  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) => {
31103
31103
  const s3 = this.association.getPresentationContext(t3.id);
31104
- 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() || d3.ImplicitVRLittleEndian), e3.writeLength16(), e3.writeLength16();
31104
+ 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() || d4.ImplicitVRLittleEndian), e3.writeLength16(), e3.writeLength16();
31105
31105
  }), 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;
31106
31106
  }
31107
31107
  read(e3) {
@@ -31343,13 +31343,13 @@ var require_dcmjs_dimse_min = __commonJS({
31343
31343
  return `(P-DATA-TF) [PDV count: ${this.getPdvCount()}, PDV length: ${this.getLengthOfPdvs()}]`;
31344
31344
  }
31345
31345
  }, Pdv: g2, RawPdu: m2 };
31346
- } }, d2 = {}, function e2(t2) {
31347
- var s2 = d2[t2];
31346
+ } }, d3 = {}, function e2(t2) {
31347
+ var s2 = d3[t2];
31348
31348
  if (void 0 !== s2) return s2.exports;
31349
- var n2 = d2[t2] = { exports: {} };
31349
+ var n2 = d3[t2] = { exports: {} };
31350
31350
  return c[t2](n2, n2.exports, e2), n2.exports;
31351
31351
  }(237);
31352
- var c, d2;
31352
+ var c, d3;
31353
31353
  });
31354
31354
  }
31355
31355
  });
@@ -31453,7 +31453,7 @@ var rr = class {
31453
31453
  return this.infixParselets[e.id === "Symbol" ? e.value : e.id];
31454
31454
  }
31455
31455
  };
31456
- var Ce = class {
31456
+ var Pe = class {
31457
31457
  constructor(e = 10) {
31458
31458
  this.max = e, this.cache = /* @__PURE__ */ new Map();
31459
31459
  }
@@ -31483,95 +31483,98 @@ var or = "not-modified";
31483
31483
  var ar = "not-found";
31484
31484
  var ur = "unauthorized";
31485
31485
  var ot = "accepted";
31486
- var vn = { resourceType: "OperationOutcome", id: ar, issue: [{ severity: "error", code: "not-found", details: { text: "Not found" } }] };
31487
- var Pe = { resourceType: "OperationOutcome", id: ur, issue: [{ severity: "error", code: "login", details: { text: "Unauthorized" } }] };
31488
- var Tn = { ...Pe, issue: [...Pe.issue, { severity: "error", code: "expired", details: { text: "Token expired" } }] };
31489
- var lr = { ...Pe, issue: [...Pe.issue, { severity: "error", code: "invalid", details: { text: "Token not issued for this audience" } }] };
31486
+ var xn = { resourceType: "OperationOutcome", id: ar, issue: [{ severity: "error", code: "not-found", details: { text: "Not found" } }] };
31487
+ var we = { resourceType: "OperationOutcome", id: ur, issue: [{ severity: "error", code: "login", details: { text: "Unauthorized" } }] };
31488
+ var vn = { ...we, issue: [...we.issue, { severity: "error", code: "expired", details: { text: "Token expired" } }] };
31489
+ var lr = { ...we, issue: [...we.issue, { severity: "error", code: "invalid", details: { text: "Token not issued for this audience" } }] };
31490
31490
  function b(r6, e) {
31491
31491
  return { resourceType: "OperationOutcome", issue: [{ severity: "error", code: "invalid", details: { text: r6 }, ...e ? { expression: [e] } : void 0 }] };
31492
31492
  }
31493
31493
  function y(r6) {
31494
31494
  return { resourceType: "OperationOutcome", issue: [{ severity: "error", code: "structure", details: { text: r6 } }] };
31495
31495
  }
31496
- function Sn(r6) {
31496
+ function Tn(r6) {
31497
31497
  return { resourceType: "OperationOutcome", issue: [{ severity: "error", code: "exception", details: { text: "Internal server error" }, diagnostics: r6.toString() }] };
31498
31498
  }
31499
- function we(r6) {
31499
+ function ao(r6) {
31500
+ return !r6 || typeof r6 != "object" ? false : r6 instanceof Error || typeof DOMException < "u" && r6 instanceof DOMException ? true : Object.prototype.toString.call(r6) === "[object Error]";
31501
+ }
31502
+ function Ae(r6) {
31500
31503
  return typeof r6 == "object" && r6 !== null && r6.resourceType === "OperationOutcome";
31501
31504
  }
31502
- function dr(r6) {
31505
+ function pr(r6) {
31503
31506
  return r6.id === nr || r6.id === it || r6.id === or || r6.id === ot;
31504
31507
  }
31505
- var p = class extends Error {
31508
+ var d = class extends Error {
31506
31509
  constructor(e, t) {
31507
- super(bn(e)), this.outcome = e, this.cause = t;
31510
+ super(Sn(e)), this.outcome = e, this.cause = t;
31508
31511
  }
31509
31512
  };
31510
31513
  function st(r6) {
31511
- return r6 instanceof p ? r6.outcome : we(r6) ? r6 : b(Ae(r6));
31514
+ return r6 instanceof d ? r6.outcome : Ae(r6) ? r6 : b(Oe(r6));
31512
31515
  }
31513
- function Ae(r6) {
31514
- return r6 ? typeof r6 == "string" ? r6 : r6 instanceof Error ? r6.message : we(r6) ? bn(r6) : typeof r6 == "object" && "code" in r6 && typeof r6.code == "string" ? r6.code : JSON.stringify(r6) : "Unknown error";
31516
+ function Oe(r6) {
31517
+ return r6 ? typeof r6 == "string" ? r6 : ao(r6) ? r6.message : Ae(r6) ? Sn(r6) : typeof r6 == "object" && "code" in r6 && typeof r6.code == "string" ? r6.code : JSON.stringify(r6) : "Unknown error";
31515
31518
  }
31516
- function bn(r6) {
31517
- let e = r6.issue?.map(so) ?? [];
31519
+ function Sn(r6) {
31520
+ let e = r6.issue?.map(co) ?? [];
31518
31521
  return e.length > 0 ? e.join("; ") : "Unknown error";
31519
31522
  }
31520
- function so(r6) {
31523
+ function co(r6) {
31521
31524
  let e;
31522
31525
  return r6.details?.text ? r6.diagnostics ? e = `${r6.details.text} (${r6.diagnostics})` : e = r6.details.text : r6.diagnostics ? e = r6.diagnostics : e = "Unknown error", r6.expression?.length && (e += ` (${r6.expression.join(", ")})`), e;
31523
31526
  }
31524
- function co(r6, e) {
31527
+ function lo(r6, e) {
31525
31528
  let t = e.max && e.max === Number.MAX_SAFE_INTEGER ? Number.POSITIVE_INFINITY : e.max;
31526
31529
  return { path: r6, description: "", type: e.type ?? [], min: e.min ?? 0, max: t ?? 1, isArray: !!t && t > 1, constraints: [] };
31527
31530
  }
31528
- function Cn(r6) {
31531
+ function Rn(r6) {
31529
31532
  let e = /* @__PURE__ */ Object.create(null);
31530
- for (let [t, n] of Object.entries(r6)) e[t] = { name: t, type: t, path: t, elements: Object.fromEntries(Object.entries(n.elements).map(([i2, o]) => [i2, co(i2, o)])), constraints: [], innerTypes: [] };
31533
+ for (let [t, n] of Object.entries(r6)) e[t] = { name: t, type: t, path: t, elements: Object.fromEntries(Object.entries(n.elements).map(([i2, o]) => [i2, lo(i2, o)])), constraints: [], innerTypes: [] };
31531
31534
  return e;
31532
31535
  }
31533
- var Pn = { 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" }] } } }, DataRequirementCodeFilter: { elements: { id: { type: [{ code: "string" }] }, extension: { max: 9007199254740991, type: [{ code: "Extension" }] }, path: { type: [{ code: "string" }] }, searchParam: { type: [{ code: "string" }] }, valueSet: { type: [{ code: "canonical", targetProfile: ["http://hl7.org/fhir/StructureDefinition/ValueSet"] }] }, code: { max: 9007199254740991, type: [{ code: "Coding" }] } } }, DataRequirementDateFilter: { elements: { id: { type: [{ code: "string" }] }, extension: { max: 9007199254740991, type: [{ code: "Extension" }] }, path: { type: [{ code: "string" }] }, searchParam: { type: [{ code: "string" }] }, "value[x]": { type: [{ code: "dateTime" }, { code: "Period" }, { code: "Duration" }] } } }, DataRequirementSort: { elements: { id: { type: [{ code: "string" }] }, extension: { max: 9007199254740991, type: [{ code: "Extension" }] }, path: { min: 1, type: [{ code: "string" }] }, direction: { min: 1, type: [{ code: "code" }] } } }, 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"] }] } } }, DosageDoseAndRate: { elements: { id: { type: [{ code: "string" }] }, extension: { max: 9007199254740991, type: [{ code: "Extension" }] }, type: { type: [{ code: "CodeableConcept" }] }, "dose[x]": { type: [{ code: "Range" }, { code: "Quantity", profile: ["http://hl7.org/fhir/StructureDefinition/SimpleQuantity"] }] }, "rate[x]": { type: [{ code: "Ratio" }, { code: "Range" }, { 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" }] } } }, ElementDefinitionSlicingDiscriminator: { elements: { id: { type: [{ code: "string" }] }, extension: { max: 9007199254740991, type: [{ code: "Extension" }] }, type: { min: 1, type: [{ code: "code" }] }, path: { min: 1, type: [{ code: "string" }] } } }, ElementDefinitionSlicing: { elements: { id: { type: [{ code: "string" }] }, extension: { max: 9007199254740991, type: [{ code: "Extension" }] }, discriminator: { max: 9007199254740991, type: [{ code: "ElementDefinitionSlicingDiscriminator" }] }, description: { type: [{ code: "string" }] }, ordered: { type: [{ code: "boolean" }] }, rules: { min: 1, type: [{ code: "code" }] } } }, ElementDefinitionBase: { elements: { id: { type: [{ code: "string" }] }, extension: { max: 9007199254740991, type: [{ code: "Extension" }] }, path: { min: 1, type: [{ code: "string" }] }, min: { min: 1, type: [{ code: "unsignedInt" }] }, max: { min: 1, type: [{ code: "string" }] } } }, ElementDefinitionType: { elements: { id: { type: [{ code: "string" }] }, extension: { max: 9007199254740991, type: [{ code: "Extension" }] }, code: { min: 1, type: [{ code: "uri" }] }, profile: { max: 9007199254740991, type: [{ code: "canonical", targetProfile: ["http://hl7.org/fhir/StructureDefinition/StructureDefinition", "http://hl7.org/fhir/StructureDefinition/ImplementationGuide"] }] }, targetProfile: { max: 9007199254740991, type: [{ code: "canonical", targetProfile: ["http://hl7.org/fhir/StructureDefinition/StructureDefinition", "http://hl7.org/fhir/StructureDefinition/ImplementationGuide"] }] }, aggregation: { max: 9007199254740991, type: [{ code: "code" }] }, versioning: { type: [{ code: "code" }] } } }, ElementDefinitionExample: { elements: { id: { type: [{ code: "string" }] }, extension: { max: 9007199254740991, type: [{ code: "Extension" }] }, label: { min: 1, type: [{ code: "string" }] }, "value[x]": { min: 1, 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" }] } } }, ElementDefinitionConstraint: { elements: { id: { type: [{ code: "string" }] }, extension: { max: 9007199254740991, type: [{ code: "Extension" }] }, key: { min: 1, type: [{ code: "id" }] }, requirements: { type: [{ code: "string" }] }, severity: { min: 1, type: [{ code: "code" }] }, human: { min: 1, type: [{ code: "string" }] }, expression: { type: [{ code: "string" }] }, xpath: { type: [{ code: "string" }] }, source: { type: [{ code: "canonical", targetProfile: ["http://hl7.org/fhir/StructureDefinition/StructureDefinition"] }] } } }, ElementDefinitionBinding: { elements: { id: { type: [{ code: "string" }] }, extension: { max: 9007199254740991, type: [{ code: "Extension" }] }, strength: { min: 1, type: [{ code: "code" }] }, description: { type: [{ code: "string" }] }, valueSet: { type: [{ code: "canonical", targetProfile: ["http://hl7.org/fhir/StructureDefinition/ValueSet"] }] } } }, ElementDefinitionMapping: { elements: { id: { type: [{ code: "string" }] }, extension: { max: 9007199254740991, type: [{ code: "Extension" }] }, identity: { min: 1, type: [{ code: "id" }] }, language: { type: [{ code: "code" }] }, map: { min: 1, type: [{ code: "string" }] }, comment: { type: [{ code: "string" }] } } }, 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" }] }, onBehalfOf: { type: [{ code: "Reference" }] }, account: { type: [{ code: "Reference" }] }, accounts: { max: 9007199254740991, 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" }] } } }, SubstanceAmountReferenceRange: { elements: { id: { type: [{ code: "string" }] }, extension: { max: 9007199254740991, type: [{ code: "Extension" }] }, lowLimit: { type: [{ code: "Quantity" }] }, highLimit: { type: [{ code: "Quantity" }] } } }, 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" }] } } }, TimingRepeat: { elements: { id: { type: [{ code: "string" }] }, extension: { max: 9007199254740991, type: [{ code: "Extension" }] }, "bounds[x]": { type: [{ code: "Duration" }, { code: "Range" }, { code: "Period" }] }, count: { type: [{ code: "positiveInt" }] }, countMax: { type: [{ code: "positiveInt" }] }, duration: { type: [{ code: "decimal" }] }, durationMax: { type: [{ code: "decimal" }] }, durationUnit: { type: [{ code: "code" }] }, frequency: { type: [{ code: "positiveInt" }] }, frequencyMax: { type: [{ code: "positiveInt" }] }, period: { type: [{ code: "decimal" }] }, periodMax: { type: [{ code: "decimal" }] }, periodUnit: { type: [{ code: "code" }] }, dayOfWeek: { max: 9007199254740991, type: [{ code: "code" }] }, timeOfDay: { max: 9007199254740991, type: [{ code: "time" }] }, when: { max: 9007199254740991, type: [{ code: "code" }] }, offset: { type: [{ code: "unsignedInt" }] } } }, 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" }] } } }, 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" }] } } } };
31536
+ var Cn = { 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" }] } } }, DataRequirementCodeFilter: { elements: { id: { type: [{ code: "string" }] }, extension: { max: 9007199254740991, type: [{ code: "Extension" }] }, path: { type: [{ code: "string" }] }, searchParam: { type: [{ code: "string" }] }, valueSet: { type: [{ code: "canonical", targetProfile: ["http://hl7.org/fhir/StructureDefinition/ValueSet"] }] }, code: { max: 9007199254740991, type: [{ code: "Coding" }] } } }, DataRequirementDateFilter: { elements: { id: { type: [{ code: "string" }] }, extension: { max: 9007199254740991, type: [{ code: "Extension" }] }, path: { type: [{ code: "string" }] }, searchParam: { type: [{ code: "string" }] }, "value[x]": { type: [{ code: "dateTime" }, { code: "Period" }, { code: "Duration" }] } } }, DataRequirementSort: { elements: { id: { type: [{ code: "string" }] }, extension: { max: 9007199254740991, type: [{ code: "Extension" }] }, path: { min: 1, type: [{ code: "string" }] }, direction: { min: 1, type: [{ code: "code" }] } } }, 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"] }] } } }, DosageDoseAndRate: { elements: { id: { type: [{ code: "string" }] }, extension: { max: 9007199254740991, type: [{ code: "Extension" }] }, type: { type: [{ code: "CodeableConcept" }] }, "dose[x]": { type: [{ code: "Range" }, { code: "Quantity", profile: ["http://hl7.org/fhir/StructureDefinition/SimpleQuantity"] }] }, "rate[x]": { type: [{ code: "Ratio" }, { code: "Range" }, { 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" }] } } }, ElementDefinitionSlicingDiscriminator: { elements: { id: { type: [{ code: "string" }] }, extension: { max: 9007199254740991, type: [{ code: "Extension" }] }, type: { min: 1, type: [{ code: "code" }] }, path: { min: 1, type: [{ code: "string" }] } } }, ElementDefinitionSlicing: { elements: { id: { type: [{ code: "string" }] }, extension: { max: 9007199254740991, type: [{ code: "Extension" }] }, discriminator: { max: 9007199254740991, type: [{ code: "ElementDefinitionSlicingDiscriminator" }] }, description: { type: [{ code: "string" }] }, ordered: { type: [{ code: "boolean" }] }, rules: { min: 1, type: [{ code: "code" }] } } }, ElementDefinitionBase: { elements: { id: { type: [{ code: "string" }] }, extension: { max: 9007199254740991, type: [{ code: "Extension" }] }, path: { min: 1, type: [{ code: "string" }] }, min: { min: 1, type: [{ code: "unsignedInt" }] }, max: { min: 1, type: [{ code: "string" }] } } }, ElementDefinitionType: { elements: { id: { type: [{ code: "string" }] }, extension: { max: 9007199254740991, type: [{ code: "Extension" }] }, code: { min: 1, type: [{ code: "uri" }] }, profile: { max: 9007199254740991, type: [{ code: "canonical", targetProfile: ["http://hl7.org/fhir/StructureDefinition/StructureDefinition", "http://hl7.org/fhir/StructureDefinition/ImplementationGuide"] }] }, targetProfile: { max: 9007199254740991, type: [{ code: "canonical", targetProfile: ["http://hl7.org/fhir/StructureDefinition/StructureDefinition", "http://hl7.org/fhir/StructureDefinition/ImplementationGuide"] }] }, aggregation: { max: 9007199254740991, type: [{ code: "code" }] }, versioning: { type: [{ code: "code" }] } } }, ElementDefinitionExample: { elements: { id: { type: [{ code: "string" }] }, extension: { max: 9007199254740991, type: [{ code: "Extension" }] }, label: { min: 1, type: [{ code: "string" }] }, "value[x]": { min: 1, 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" }] } } }, ElementDefinitionConstraint: { elements: { id: { type: [{ code: "string" }] }, extension: { max: 9007199254740991, type: [{ code: "Extension" }] }, key: { min: 1, type: [{ code: "id" }] }, requirements: { type: [{ code: "string" }] }, severity: { min: 1, type: [{ code: "code" }] }, human: { min: 1, type: [{ code: "string" }] }, expression: { type: [{ code: "string" }] }, xpath: { type: [{ code: "string" }] }, source: { type: [{ code: "canonical", targetProfile: ["http://hl7.org/fhir/StructureDefinition/StructureDefinition"] }] } } }, ElementDefinitionBinding: { elements: { id: { type: [{ code: "string" }] }, extension: { max: 9007199254740991, type: [{ code: "Extension" }] }, strength: { min: 1, type: [{ code: "code" }] }, description: { type: [{ code: "string" }] }, valueSet: { type: [{ code: "canonical", targetProfile: ["http://hl7.org/fhir/StructureDefinition/ValueSet"] }] } } }, ElementDefinitionMapping: { elements: { id: { type: [{ code: "string" }] }, extension: { max: 9007199254740991, type: [{ code: "Extension" }] }, identity: { min: 1, type: [{ code: "id" }] }, language: { type: [{ code: "code" }] }, map: { min: 1, type: [{ code: "string" }] }, comment: { type: [{ code: "string" }] } } }, 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" }] }, onBehalfOf: { type: [{ code: "Reference" }] }, account: { type: [{ code: "Reference" }] }, accounts: { max: 9007199254740991, 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" }] } } }, SubstanceAmountReferenceRange: { elements: { id: { type: [{ code: "string" }] }, extension: { max: 9007199254740991, type: [{ code: "Extension" }] }, lowLimit: { type: [{ code: "Quantity" }] }, highLimit: { type: [{ code: "Quantity" }] } } }, 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" }] } } }, TimingRepeat: { elements: { id: { type: [{ code: "string" }] }, extension: { max: 9007199254740991, type: [{ code: "Extension" }] }, "bounds[x]": { type: [{ code: "Duration" }, { code: "Range" }, { code: "Period" }] }, count: { type: [{ code: "positiveInt" }] }, countMax: { type: [{ code: "positiveInt" }] }, duration: { type: [{ code: "decimal" }] }, durationMax: { type: [{ code: "decimal" }] }, durationUnit: { type: [{ code: "code" }] }, frequency: { type: [{ code: "positiveInt" }] }, frequencyMax: { type: [{ code: "positiveInt" }] }, period: { type: [{ code: "decimal" }] }, periodMax: { type: [{ code: "decimal" }] }, periodUnit: { type: [{ code: "code" }] }, dayOfWeek: { max: 9007199254740991, type: [{ code: "code" }] }, timeOfDay: { max: 9007199254740991, type: [{ code: "time" }] }, when: { max: 9007199254740991, type: [{ code: "code" }] }, offset: { type: [{ code: "unsignedInt" }] } } }, 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" }] } } }, 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" }] } } } };
31534
31537
  function mr(r6) {
31535
31538
  return new fr(r6).parse();
31536
31539
  }
31537
- var fe = Cn(Pn);
31540
+ var fe = Rn(Cn);
31538
31541
  var yr = /* @__PURE__ */ Object.create(null);
31539
- var wn = /* @__PURE__ */ Object.create(null);
31540
- var lo = { "http://hl7.org/fhir/StructureDefinition/MoneyQuantity": "MoneyQuantity", "http://hl7.org/fhir/StructureDefinition/SimpleQuantity": "SimpleQuantity", "http://hl7.org/fhir/uv/sql-on-fhir/StructureDefinition/ViewDefinition": "ViewDefinition" };
31541
- function kn(r6) {
31542
+ var Pn = /* @__PURE__ */ Object.create(null);
31543
+ var fo = { "http://hl7.org/fhir/StructureDefinition/MoneyQuantity": "MoneyQuantity", "http://hl7.org/fhir/StructureDefinition/SimpleQuantity": "SimpleQuantity", "http://hl7.org/fhir/uv/sql-on-fhir/StructureDefinition/ViewDefinition": "ViewDefinition" };
31544
+ function In(r6) {
31542
31545
  let e;
31543
- return e = wn[r6], e || (e = wn[r6] = /* @__PURE__ */ Object.create(null)), e;
31546
+ return e = Pn[r6], e || (e = Pn[r6] = /* @__PURE__ */ Object.create(null)), e;
31544
31547
  }
31545
31548
  function gr(r6) {
31546
31549
  let t = (Array.isArray(r6) ? r6 : r6.entry?.map((n) => n.resource) ?? []).filter((n) => n?.resourceType === "StructureDefinition");
31547
- Fn(t);
31550
+ Ln(t);
31548
31551
  for (let n of t) xr(n);
31549
31552
  }
31550
31553
  function xr(r6) {
31551
31554
  if (!r6?.name) throw new Error("Failed loading StructureDefinition from bundle");
31552
31555
  if (r6.resourceType !== "StructureDefinition") return;
31553
- let e = mr(r6), t = lo[r6.url], n, i2;
31554
- t ? (n = fe, i2 = t) : r6.url === `http://hl7.org/fhir/StructureDefinition/${r6.type}` || r6.url === `https://medplum.com/fhir/StructureDefinition/${r6.type}` || r6.type?.startsWith("http://") || r6.type?.startsWith("https://") ? (n = fe, i2 = r6.type) : (n = kn(r6.url), i2 = r6.type), n[i2] = e;
31556
+ let e = mr(r6), t = fo[r6.url], n, i2;
31557
+ t ? (n = fe, i2 = t) : r6.url === `http://hl7.org/fhir/StructureDefinition/${r6.type}` || r6.url === `https://medplum.com/fhir/StructureDefinition/${r6.type}` || r6.type?.startsWith("http://") || r6.type?.startsWith("https://") ? (n = fe, i2 = r6.type) : (n = In(r6.url), i2 = r6.type), n[i2] = e;
31555
31558
  for (let o of e.innerTypes) o.parentType = e, n[o.name] = o;
31556
31559
  yr[r6.url] = e;
31557
31560
  }
31558
- function Vn(r6) {
31561
+ function Dn(r6) {
31559
31562
  return !!fe[r6];
31560
31563
  }
31561
- function Be(r6, e) {
31564
+ function We(r6, e) {
31562
31565
  if (e) {
31563
- let t = kn(e)[r6];
31566
+ let t = In(e)[r6];
31564
31567
  if (t) return t;
31565
31568
  }
31566
31569
  return fe[r6];
31567
31570
  }
31568
- function _n(r6) {
31571
+ function Mn(r6) {
31569
31572
  return !!yr[r6];
31570
31573
  }
31571
31574
  var fr = class {
31572
31575
  constructor(e) {
31573
31576
  if (!e.snapshot?.element || e.snapshot.element.length === 0) throw new Error(`No snapshot defined for StructureDefinition '${e.name}'`);
31574
- this.root = e.snapshot.element[0], this.elements = e.snapshot.element.slice(1), this.elementIndex = /* @__PURE__ */ Object.create(null), this.index = 0, this.resourceSchema = { name: e.name, path: this.root.path, title: e.title, type: e.type, url: e.url, version: e.version, kind: e.kind, description: mo(e), elements: {}, constraints: this.parseElementDefinition(this.root).constraints, innerTypes: [], summaryProperties: /* @__PURE__ */ new Set(), mandatoryProperties: /* @__PURE__ */ new Set() }, this.innerTypes = [];
31577
+ this.root = e.snapshot.element[0], this.elements = e.snapshot.element.slice(1), this.elementIndex = /* @__PURE__ */ Object.create(null), this.index = 0, this.resourceSchema = { name: e.name, path: this.root.path, title: e.title, type: e.type, url: e.url, version: e.version, kind: e.kind, description: go(e), elements: {}, constraints: this.parseElementDefinition(this.root).constraints, innerTypes: [], summaryProperties: /* @__PURE__ */ new Set(), mandatoryProperties: /* @__PURE__ */ new Set() }, this.innerTypes = [];
31575
31578
  }
31576
31579
  parse() {
31577
31580
  let e = this.next();
@@ -31579,7 +31582,7 @@ var fr = class {
31579
31582
  if (e.sliceName) this.parseSliceStart(e);
31580
31583
  else if (e.id?.includes(":")) {
31581
31584
  if (this.slicingContext?.current) {
31582
- let t = pr(e, this.slicingContext.path);
31585
+ let t = dr(e, this.slicingContext.path);
31583
31586
  this.slicingContext.current.elements[t] = this.parseElementDefinition(e);
31584
31587
  }
31585
31588
  } else {
@@ -31588,13 +31591,13 @@ var fr = class {
31588
31591
  let n = this.backboneContext;
31589
31592
  for (; n; ) {
31590
31593
  if (e.path?.startsWith(n.path + ".")) {
31591
- n.type.elements[pr(e, n.path)] = t;
31594
+ n.type.elements[dr(e, n.path)] = t;
31592
31595
  break;
31593
31596
  }
31594
31597
  n = n.parent;
31595
31598
  }
31596
31599
  if (!n) {
31597
- let i2 = pr(e, this.root.path);
31600
+ let i2 = dr(e, this.root.path);
31598
31601
  e.isSummary && this.resourceSchema.summaryProperties?.add(i2.replace("[x]", "")), t.min > 0 && this.resourceSchema.mandatoryProperties?.add(i2.replace("[x]", "")), this.resourceSchema.elements[i2] = t;
31599
31602
  }
31600
31603
  this.checkFieldExit(e);
@@ -31604,23 +31607,23 @@ var fr = class {
31604
31607
  return this.checkFieldExit(), this.innerTypes.length > 0 && (this.resourceSchema.innerTypes = this.innerTypes), this.resourceSchema;
31605
31608
  }
31606
31609
  checkFieldEnter(e, t) {
31607
- this.isInnerType(e) && this.enterInnerType(e), this.slicingContext && !Oe(this.slicingContext.path, e?.path) && (this.slicingContext = void 0), e.slicing && !this.slicingContext && this.enterSlice(e, t);
31610
+ this.isInnerType(e) && this.enterInnerType(e), this.slicingContext && !Ie(this.slicingContext.path, e?.path) && (this.slicingContext = void 0), e.slicing && !this.slicingContext && this.enterSlice(e, t);
31608
31611
  }
31609
31612
  enterInnerType(e) {
31610
- for (; this.backboneContext && !Oe(this.backboneContext?.path, e.path); ) this.innerTypes.push(this.backboneContext.type), this.backboneContext = this.backboneContext.parent;
31613
+ for (; this.backboneContext && !Ie(this.backboneContext?.path, e.path); ) this.innerTypes.push(this.backboneContext.type), this.backboneContext = this.backboneContext.parent;
31611
31614
  let t = hr(e);
31612
- this.backboneContext = { type: { name: t, type: t, path: e.path, title: e.label, description: e.definition, elements: {}, constraints: this.parseElementDefinition(e).constraints, innerTypes: [] }, path: e.path, parent: Oe(this.backboneContext?.path, e.path) ? this.backboneContext : this.backboneContext?.parent };
31615
+ this.backboneContext = { type: { name: t, type: t, path: e.path, title: e.label, description: e.definition, elements: {}, constraints: this.parseElementDefinition(e).constraints, innerTypes: [] }, path: e.path, parent: Ie(this.backboneContext?.path, e.path) ? this.backboneContext : this.backboneContext?.parent };
31613
31616
  }
31614
31617
  enterSlice(e, t) {
31615
- ho(e) && !this.peek()?.sliceName || (t.slicing = { discriminator: (e.slicing?.discriminator ?? []).map((n) => {
31618
+ yo(e) && !this.peek()?.sliceName || (t.slicing = { discriminator: (e.slicing?.discriminator ?? []).map((n) => {
31616
31619
  if (n.type !== "value" && n.type !== "pattern" && n.type !== "type") throw new Error(`Unsupported slicing discriminator type: ${n.type}`);
31617
31620
  return { path: n.path, type: n.type };
31618
31621
  }), slices: [], ordered: e.slicing?.ordered ?? false, rule: e.slicing?.rules }, this.slicingContext = { field: t.slicing, path: e.path ?? "" });
31619
31622
  }
31620
31623
  checkFieldExit(e = void 0) {
31621
- if (this.backboneContext && !Oe(this.backboneContext.path, e?.path)) if (this.backboneContext.parent) do
31624
+ if (this.backboneContext && !Ie(this.backboneContext.path, e?.path)) if (this.backboneContext.parent) do
31622
31625
  this.innerTypes.push(this.backboneContext.type), this.backboneContext = this.backboneContext.parent;
31623
- while (this.backboneContext && !Oe(this.backboneContext.path, e?.path));
31626
+ while (this.backboneContext && !Ie(this.backboneContext.path, e?.path));
31624
31627
  else this.innerTypes.push(this.backboneContext.type), this.backboneContext = void 0;
31625
31628
  }
31626
31629
  next() {
@@ -31639,7 +31642,7 @@ var fr = class {
31639
31642
  }
31640
31643
  isInnerType(e) {
31641
31644
  let t = this.peek();
31642
- return !!(Oe(e?.path, t?.path) && e.type?.some((n) => ["BackboneElement", "Element"].includes(n.code)));
31645
+ return !!(Ie(e?.path, t?.path) && e.type?.some((n) => ["BackboneElement", "Element"].includes(n.code)));
31643
31646
  }
31644
31647
  parseSliceStart(e) {
31645
31648
  if (!this.slicingContext) throw new Error(`Invalid slice start before discriminator: ${e.sliceName} (${e.id})`);
@@ -31652,34 +31655,34 @@ var fr = class {
31652
31655
  });
31653
31656
  }
31654
31657
  parseElementDefinition(e) {
31655
- let t = On(e.max), n = e.base?.max ? On(e.base.max) : t, i2 = { type: "ElementDefinition", value: e };
31656
- 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: In(C(i2, "fixed[x]")), pattern: In(C(i2, "pattern[x]")), binding: e.binding };
31658
+ let t = An(e.max), n = e.base?.max ? An(e.base.max) : t, i2 = { type: "ElementDefinition", value: e };
31659
+ 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: On(C(i2, "fixed[x]")), pattern: On(C(i2, "pattern[x]")), binding: e.binding };
31657
31660
  }
31658
31661
  };
31659
- function On(r6) {
31662
+ function An(r6) {
31660
31663
  return r6 === "*" ? Number.POSITIVE_INFINITY : Number.parseInt(r6, 10);
31661
31664
  }
31662
- function pr(r6, e = "") {
31663
- return fo(r6.path, e);
31665
+ function dr(r6, e = "") {
31666
+ return mo(r6.path, e);
31664
31667
  }
31665
- function fo(r6, e) {
31668
+ function mo(r6, e) {
31666
31669
  return r6 ? e && r6.startsWith(e) ? r6.substring(e.length + 1) : r6 : "";
31667
31670
  }
31668
- function Oe(r6, e) {
31671
+ function Ie(r6, e) {
31669
31672
  return !r6 || !e ? false : e.startsWith(r6 + ".") || e === r6;
31670
31673
  }
31671
- function In(r6) {
31674
+ function On(r6) {
31672
31675
  return Array.isArray(r6) && r6.length > 0 ? r6[0] : S(r6) ? void 0 : r6;
31673
31676
  }
31674
- function ho(r6) {
31677
+ function yo(r6) {
31675
31678
  let e = r6.slicing?.discriminator;
31676
31679
  return !!(r6.type?.some((t) => t.code === "Extension") && e?.length === 1 && e[0].type === "value" && e[0].path === "url");
31677
31680
  }
31678
- function mo(r6) {
31681
+ function go(r6) {
31679
31682
  let e = r6.description;
31680
31683
  return e?.startsWith(`Base StructureDefinition for ${r6.name} Type: `) && (e = e.substring(`Base StructureDefinition for ${r6.name} Type: `.length)), e;
31681
31684
  }
31682
- var xo = new Ce(1e3);
31685
+ var To = new Pe(1e3);
31683
31686
  var ut = { 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: /^[\r\n\t\u0020-\uFFFF]+$/, oid: /^urn:oid:[0-2](\.(0|[1-9]\d*))+$/, string: /^[\r\n\t\u0020-\uFFFF]+$/, 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: /.*/ };
31684
31687
  function h(r6) {
31685
31688
  return [{ type: l.boolean, value: r6 }];
@@ -31690,7 +31693,7 @@ function v(r6) {
31690
31693
  function _(r6) {
31691
31694
  return r6.length === 0 ? false : !!r6[0].value;
31692
31695
  }
31693
- function H(r6, e) {
31696
+ function G(r6, e) {
31694
31697
  if (r6.length !== 0) {
31695
31698
  if (r6.length === 1 && (!e || r6[0].type === e)) return r6[0];
31696
31699
  throw new Error(`Expected singleton of type ${e}, but found ${JSON.stringify(r6)}`);
@@ -31699,29 +31702,29 @@ function H(r6, e) {
31699
31702
  function C(r6, e, t) {
31700
31703
  if (!r6.value) return;
31701
31704
  let n = ft(r6.type, e, t?.profileUrl);
31702
- return n ? Co(r6, e, n) : Po(r6, e);
31705
+ return n ? wo(r6, e, n) : Ao(r6, e);
31703
31706
  }
31704
- function Co(r6, e, t) {
31707
+ function wo(r6, e, t) {
31705
31708
  let n = r6.value, i2 = t.type;
31706
31709
  if (!i2 || i2.length === 0) return;
31707
31710
  let o, s = "undefined", a2, c = t.path.lastIndexOf("."), u2 = t.path.substring(c + 1);
31708
- for (let d2 of i2) {
31709
- let m2 = u2.replace("[x]", I(d2.code));
31711
+ for (let p of i2) {
31712
+ let m2 = u2.replace("[x]", I(p.code));
31710
31713
  if (o = n[m2], a2 = n["_" + m2], o !== void 0 || a2 !== void 0) {
31711
- s = d2.code;
31714
+ s = p.code;
31712
31715
  break;
31713
31716
  }
31714
31717
  }
31715
31718
  if (a2) if (Array.isArray(o)) {
31716
31719
  o = o.slice();
31717
- for (let d2 = 0; d2 < Math.max(o.length, a2.length); d2++) o[d2] = qn(o[d2], a2[d2]);
31718
- } else o = qn(o, a2);
31719
- if (!S(o)) return (s === "Element" || s === "BackboneElement") && (s = t.type[0].code), Array.isArray(o) ? o.map((d2) => Nn(d2, s)) : Nn(o, s);
31720
+ for (let p = 0; p < Math.max(o.length, a2.length); p++) o[p] = Wn(o[p], a2[p]);
31721
+ } else o = Wn(o, a2);
31722
+ if (!S(o)) return (s === "Element" || s === "BackboneElement") && (s = t.type[0].code), Array.isArray(o) ? o.map((p) => Fn(p, s)) : Fn(o, s);
31720
31723
  }
31721
- function Nn(r6, e) {
31724
+ function Fn(r6, e) {
31722
31725
  return e === "Resource" && A(r6) && (e = r6.resourceType), { type: e, value: r6 };
31723
31726
  }
31724
- function Po(r6, e) {
31727
+ function Ao(r6, e) {
31725
31728
  let t = r6.value;
31726
31729
  if (!t || typeof t != "object") return;
31727
31730
  let n;
@@ -31748,7 +31751,7 @@ function lt(r6) {
31748
31751
  let e = [];
31749
31752
  for (let t of r6) {
31750
31753
  let n = false;
31751
- for (let i2 of e) if (_(je(t, i2))) {
31754
+ for (let i2 of e) if (_($e(t, i2))) {
31752
31755
  n = true;
31753
31756
  break;
31754
31757
  }
@@ -31756,31 +31759,31 @@ function lt(r6) {
31756
31759
  }
31757
31760
  return e;
31758
31761
  }
31759
- function jn(r6) {
31762
+ function qn(r6) {
31760
31763
  return h(!_(r6));
31761
31764
  }
31762
- function $n(r6, e) {
31763
- return r6.length === 0 || e.length === 0 ? [] : r6.length !== e.length ? h(false) : h(r6.every((t, n) => _(je(t, e[n]))));
31765
+ function jn(r6, e) {
31766
+ return r6.length === 0 || e.length === 0 ? [] : r6.length !== e.length ? h(false) : h(r6.every((t, n) => _($e(t, e[n]))));
31764
31767
  }
31765
- function Hn(r6, e) {
31766
- return r6.length === 0 || e.length === 0 ? [] : r6.length !== e.length ? h(true) : h(r6.some((t, n) => !_(je(t, e[n]))));
31768
+ function $n(r6, e) {
31769
+ return r6.length === 0 || e.length === 0 ? [] : r6.length !== e.length ? h(true) : h(r6.some((t, n) => !_($e(t, e[n]))));
31767
31770
  }
31768
- function je(r6, e) {
31771
+ function $e(r6, e) {
31769
31772
  let t = r6.value?.valueOf(), n = e.value?.valueOf();
31770
- return typeof t == "number" && typeof n == "number" ? h(Math.abs(t - n) < 1e-8) : k(t) && k(n) ? h(Qn(t, n)) : h(typeof t == "object" && typeof n == "object" ? wr(r6, e) : t === n);
31773
+ return typeof t == "number" && typeof n == "number" ? h(Math.abs(t - n) < 1e-8) : k(t) && k(n) ? h(Hn(t, n)) : h(typeof t == "object" && typeof n == "object" ? wr(r6, e) : t === n);
31771
31774
  }
31772
31775
  function Pr(r6, e) {
31773
- return r6.length === 0 && e.length === 0 ? h(true) : r6.length !== e.length ? h(false) : (r6.sort(Un), e.sort(Un), h(r6.every((t, n) => _(wo(t, e[n])))));
31776
+ return r6.length === 0 && e.length === 0 ? h(true) : r6.length !== e.length ? h(false) : (r6.sort(Nn), e.sort(Nn), h(r6.every((t, n) => _(Oo(t, e[n])))));
31774
31777
  }
31775
- function wo(r6, e) {
31778
+ function Oo(r6, e) {
31776
31779
  let { type: t, value: n } = r6, { type: i2, value: o } = e, s = n?.valueOf(), a2 = o?.valueOf();
31777
- return typeof s == "number" && typeof a2 == "number" ? h(Math.abs(s - a2) < 0.01) : k(s) && k(a2) ? h(Qn(s, a2)) : h(t === "Coding" && i2 === "Coding" ? typeof s != "object" || typeof a2 != "object" ? false : s.code === a2.code && s.system === a2.system : typeof s == "object" && typeof a2 == "object" ? wr({ ...s, id: void 0 }, { ...a2, id: void 0 }) : typeof s == "string" && typeof a2 == "string" ? s.toLowerCase() === a2.toLowerCase() : s === a2);
31780
+ return typeof s == "number" && typeof a2 == "number" ? h(Math.abs(s - a2) < 0.01) : k(s) && k(a2) ? h(Hn(s, a2)) : h(t === "Coding" && i2 === "Coding" ? typeof s != "object" || typeof a2 != "object" ? false : s.code === a2.code && s.system === a2.system : typeof s == "object" && typeof a2 == "object" ? wr({ ...s, id: void 0 }, { ...a2, id: void 0 }) : typeof s == "string" && typeof a2 == "string" ? s.toLowerCase() === a2.toLowerCase() : s === a2);
31778
31781
  }
31779
- function Un(r6, e) {
31782
+ function Nn(r6, e) {
31780
31783
  let t = r6.value?.valueOf(), n = e.value?.valueOf();
31781
31784
  return typeof t == "number" && typeof n == "number" ? t - n : typeof t == "string" && typeof n == "string" ? t.localeCompare(n) : 0;
31782
31785
  }
31783
- function dt(r6, e) {
31786
+ function pt(r6, e) {
31784
31787
  let { value: t } = r6;
31785
31788
  if (t == null) return false;
31786
31789
  let n = e;
@@ -31793,11 +31796,11 @@ function dt(r6, e) {
31793
31796
  case "Date":
31794
31797
  return Gn(t);
31795
31798
  case "DateTime":
31796
- return ke(t);
31799
+ return De(t);
31797
31800
  case "Time":
31798
31801
  return typeof t == "string" && !!/^T\d/.exec(t);
31799
31802
  case "Period":
31800
- return pt(t);
31803
+ return dt(t);
31801
31804
  case "Quantity":
31802
31805
  return k(t);
31803
31806
  default:
@@ -31807,16 +31810,16 @@ function dt(r6, e) {
31807
31810
  function Gn(r6) {
31808
31811
  return typeof r6 == "string" && !!ut.date.exec(r6);
31809
31812
  }
31810
- function ke(r6) {
31813
+ function De(r6) {
31811
31814
  return typeof r6 == "string" && !!ut.dateTime.exec(r6);
31812
31815
  }
31813
- function pt(r6) {
31814
- return !!(r6 && typeof r6 == "object" && ("start" in r6 && ke(r6.start) || "end" in r6 && ke(r6.end)));
31816
+ function dt(r6) {
31817
+ return !!(r6 && typeof r6 == "object" && ("start" in r6 && De(r6.start) || "end" in r6 && De(r6.end)));
31815
31818
  }
31816
31819
  function k(r6) {
31817
31820
  return !!(r6 && typeof r6 == "object" && "value" in r6 && typeof r6.value == "number");
31818
31821
  }
31819
- function Qn(r6, e) {
31822
+ function Hn(r6, e) {
31820
31823
  return Math.abs(r6.value - e.value) < 0.01 && (r6.unit === e.unit || r6.code === e.code || r6.unit === e.code || r6.code === e.unit);
31821
31824
  }
31822
31825
  function wr(r6, e) {
@@ -31824,67 +31827,67 @@ function wr(r6, e) {
31824
31827
  if (t.length !== n.length) return false;
31825
31828
  for (let i2 of t) {
31826
31829
  let o = r6[i2], s = e[i2];
31827
- if (Wn(o) && Wn(s)) {
31830
+ if (Bn(o) && Bn(s)) {
31828
31831
  if (!wr(o, s)) return false;
31829
31832
  } else if (o !== s) return false;
31830
31833
  }
31831
31834
  return true;
31832
31835
  }
31833
- function Wn(r6) {
31836
+ function Bn(r6) {
31834
31837
  return r6 !== null && typeof r6 == "object";
31835
31838
  }
31836
- function qn(r6, e) {
31839
+ function Wn(r6, e) {
31837
31840
  if (e) {
31838
31841
  if (typeof e != "object") throw new Error("Primitive extension must be an object");
31839
- return Ao(r6 ?? {}, e);
31842
+ return Io(r6 ?? {}, e);
31840
31843
  }
31841
31844
  return r6;
31842
31845
  }
31843
- function Ao(r6, e) {
31846
+ function Io(r6, e) {
31844
31847
  return delete e.__proto__, delete e.constructor, Object.assign(r6, e);
31845
31848
  }
31846
31849
  function kr(r6, e) {
31847
31850
  return A(r6, e) && "id" in r6 && typeof r6.id == "string";
31848
31851
  }
31849
31852
  function he(r6) {
31850
- let e = B(r6) ?? "undefined/undefined", t = Io(r6);
31853
+ let e = B(r6) ?? "undefined/undefined", t = Do(r6);
31851
31854
  return t === e ? { reference: e } : { reference: e, display: t };
31852
31855
  }
31853
31856
  function B(r6) {
31854
- if (Y(r6)) return r6.reference;
31857
+ if (X(r6)) return r6.reference;
31855
31858
  if (kr(r6)) return `${r6.resourceType}/${r6.id}`;
31856
31859
  }
31857
31860
  function me(r6) {
31858
- if (r6) return Y(r6) ? r6.reference.split("/")[1] : r6.id;
31861
+ if (r6) return X(r6) ? r6.reference.split("/")[1] : r6.id;
31859
31862
  }
31860
- function Oo(r6) {
31863
+ function ko(r6) {
31861
31864
  return r6.resourceType === "Patient" || r6.resourceType === "Practitioner" || r6.resourceType === "RelatedPerson";
31862
31865
  }
31863
- function Io(r6) {
31864
- if (Oo(r6)) {
31865
- let e = ko(r6);
31866
+ function Do(r6) {
31867
+ if (ko(r6)) {
31868
+ let e = Vo(r6);
31866
31869
  if (e) return e;
31867
31870
  }
31868
31871
  if (r6.resourceType === "Device") {
31869
- let e = Do(r6);
31872
+ let e = Mo(r6);
31870
31873
  if (e) return e;
31871
31874
  }
31872
- if (r6.resourceType === "MedicationRequest" && r6.medicationCodeableConcept) return $e(r6.medicationCodeableConcept);
31875
+ if (r6.resourceType === "MedicationRequest" && r6.medicationCodeableConcept) return Ge(r6.medicationCodeableConcept);
31873
31876
  if (r6.resourceType === "Subscription" && r6.criteria) return r6.criteria;
31874
31877
  if (r6.resourceType === "User" && r6.email) return r6.email;
31875
31878
  if ("name" in r6 && r6.name && typeof r6.name == "string") return r6.name;
31876
31879
  if ("code" in r6 && r6.code) {
31877
31880
  let e = r6.code;
31878
- if (Array.isArray(e) && (e = e[0]), Or(e)) return $e(e);
31879
- if (Bo(e)) return e.text;
31881
+ if (Array.isArray(e) && (e = e[0]), Or(e)) return Ge(e);
31882
+ if (qo(e)) return e.text;
31880
31883
  }
31881
31884
  return B(r6) ?? "";
31882
31885
  }
31883
- function ko(r6) {
31886
+ function Vo(r6) {
31884
31887
  let e = r6.name;
31885
31888
  if (e && e.length > 0) return He(e[0]);
31886
31889
  }
31887
- function Do(r6) {
31890
+ function Mo(r6) {
31888
31891
  let e = r6.deviceName;
31889
31892
  if (e && e.length > 0) return e[0].name;
31890
31893
  }
@@ -31893,12 +31896,12 @@ function ht(r6, e) {
31893
31896
  t.setUTCHours(0, 0, 0, 0);
31894
31897
  let n = e ? new Date(e) : /* @__PURE__ */ new Date();
31895
31898
  n.setUTCHours(0, 0, 0, 0);
31896
- let i2 = t.getUTCFullYear(), o = t.getUTCMonth(), s = t.getUTCDate(), a2 = n.getUTCFullYear(), c = n.getUTCMonth(), u2 = n.getUTCDate(), d2 = a2 - i2;
31897
- (c < o || c === o && u2 < s) && d2--;
31899
+ let i2 = t.getUTCFullYear(), o = t.getUTCMonth(), s = t.getUTCDate(), a2 = n.getUTCFullYear(), c = n.getUTCMonth(), u2 = n.getUTCDate(), p = a2 - i2;
31900
+ (c < o || c === o && u2 < s) && p--;
31898
31901
  let m2 = a2 * 12 + c - (i2 * 12 + o);
31899
31902
  u2 < s && m2--;
31900
31903
  let x = Math.floor((n.getTime() - t.getTime()) / (1e3 * 60 * 60 * 24));
31901
- return { years: d2, months: m2, days: x };
31904
+ return { years: p, months: m2, days: x };
31902
31905
  }
31903
31906
  function ne(r6, ...e) {
31904
31907
  let t = r6;
@@ -31910,9 +31913,9 @@ function mt(r6, e) {
31910
31913
  return JSON.stringify(t, null, e ? 2 : void 0) ?? "";
31911
31914
  }
31912
31915
  function Dr(r6) {
31913
- if (!(r6 == null || r6 === "")) return typeof r6 == "object" ? Array.isArray(r6) ? Mo(r6) : _o(r6) : r6;
31916
+ if (!(r6 == null || r6 === "")) return typeof r6 == "object" ? Array.isArray(r6) ? Lo(r6) : Fo(r6) : r6;
31914
31917
  }
31915
- function Mo(r6) {
31918
+ function Lo(r6) {
31916
31919
  let e = r6.length;
31917
31920
  if (e === 0) return;
31918
31921
  let t, n = 0;
@@ -31922,7 +31925,7 @@ function Mo(r6) {
31922
31925
  }
31923
31926
  if (n !== 0) return t ?? r6;
31924
31927
  }
31925
- function _o(r6) {
31928
+ function Fo(r6) {
31926
31929
  let e, t = 0;
31927
31930
  for (let n in r6) {
31928
31931
  let i2 = r6[n], o = Dr(i2);
@@ -31933,22 +31936,22 @@ function _o(r6) {
31933
31936
  function S(r6) {
31934
31937
  if (r6 == null) return true;
31935
31938
  let e = typeof r6;
31936
- return e === "string" || e === "object" ? !X(r6) : false;
31939
+ return e === "string" || e === "object" ? !Y(r6) : false;
31937
31940
  }
31938
- function X(r6) {
31941
+ function Y(r6) {
31939
31942
  if (r6 == null) return false;
31940
31943
  let e = typeof r6;
31941
31944
  return e === "string" && r6 !== "" || e === "object" && ("length" in r6 && r6.length > 0 || Object.keys(r6).length > 0);
31942
31945
  }
31943
31946
  function ie(r6, e, t) {
31944
- return r6 === e || S(r6) && S(e) ? true : S(r6) || S(e) ? false : Array.isArray(r6) && Array.isArray(e) ? Lo(r6, e) : Array.isArray(r6) || Array.isArray(e) ? false : E(r6) && E(e) ? Fo(r6, e, t) : (E(r6) || E(e), false);
31947
+ return r6 === e || S(r6) && S(e) ? true : S(r6) || S(e) ? false : Array.isArray(r6) && Array.isArray(e) ? No(r6, e) : Array.isArray(r6) || Array.isArray(e) ? false : E(r6) && E(e) ? Uo(r6, e, t) : (E(r6) || E(e), false);
31945
31948
  }
31946
- function Lo(r6, e) {
31949
+ function No(r6, e) {
31947
31950
  if (r6.length !== e.length) return false;
31948
31951
  for (let t = 0; t < r6.length; t++) if (!ie(r6[t], e[t])) return false;
31949
31952
  return true;
31950
31953
  }
31951
- function Fo(r6, e, t) {
31954
+ function Uo(r6, e, t) {
31952
31955
  let n = /* @__PURE__ */ new Set();
31953
31956
  Object.keys(r6).forEach((i2) => n.add(i2)), Object.keys(e).forEach((i2) => n.add(i2)), t === "meta" && (n.delete("versionId"), n.delete("lastUpdated"), n.delete("author"));
31954
31957
  for (let i2 of n) {
@@ -31960,7 +31963,7 @@ function Fo(r6, e, t) {
31960
31963
  function E(r6) {
31961
31964
  return r6 !== null && typeof r6 == "object";
31962
31965
  }
31963
- function Yn(r6) {
31966
+ function Kn(r6) {
31964
31967
  return r6.every(Vr);
31965
31968
  }
31966
31969
  function Vr(r6) {
@@ -31972,22 +31975,22 @@ function Ar(r6) {
31972
31975
  function Or(r6) {
31973
31976
  return E(r6) && "coding" in r6 && Array.isArray(r6.coding) && r6.coding.every(Ar);
31974
31977
  }
31975
- function Bo(r6) {
31978
+ function qo(r6) {
31976
31979
  return E(r6) && "text" in r6 && typeof r6.text == "string";
31977
31980
  }
31978
31981
  var Xn = [];
31979
31982
  for (let r6 = 0; r6 < 256; r6++) Xn.push(r6.toString(16).padStart(2, "0"));
31980
- function Zn(r6) {
31981
- let e = ti(r6), t = new Uint8Array(e), n = new Array(t.length);
31983
+ function Yn(r6) {
31984
+ let e = ei(r6), t = new Uint8Array(e), n = new Array(t.length);
31982
31985
  for (let i2 = 0; i2 < t.length; i2++) n[i2] = Xn[t[i2]];
31983
31986
  return n.join("");
31984
31987
  }
31985
- function ei(r6) {
31986
- let e = ti(r6), t = new Uint8Array(e), n = new Array(t.length);
31988
+ function Zn(r6) {
31989
+ let e = ei(r6), t = new Uint8Array(e), n = new Array(t.length);
31987
31990
  for (let i2 = 0; i2 < t.length; i2++) n[i2] = String.fromCharCode(t[i2]);
31988
31991
  return window.btoa(n.join(""));
31989
31992
  }
31990
- function ti(r6) {
31993
+ function ei(r6) {
31991
31994
  return ArrayBuffer.isView(r6) ? r6.buffer : r6;
31992
31995
  }
31993
31996
  function I(r6) {
@@ -32002,21 +32005,21 @@ function yt(r6) {
32002
32005
  function Fr(r6) {
32003
32006
  return r6.endsWith("/") ? r6 : r6 + "/";
32004
32007
  }
32005
- function Qo(r6) {
32008
+ function Jo(r6) {
32006
32009
  return r6.startsWith("/") ? r6.slice(1) : r6;
32007
32010
  }
32008
32011
  function W(r6, e) {
32009
- return new URL(Qo(e), Fr(r6.toString())).toString();
32012
+ return new URL(Jo(e), Fr(r6.toString())).toString();
32010
32013
  }
32011
- function oi(r6, e) {
32014
+ function ii(r6, e) {
32012
32015
  return W(r6, e).toString().replace("http://", "ws://").replace("https://", "wss://");
32013
32016
  }
32014
- function si(r6) {
32017
+ function oi(r6) {
32015
32018
  return typeof r6 == "object" && !Array.isArray(r6) && !(r6 instanceof URLSearchParams) && (r6 = Object.fromEntries(Object.entries(r6).filter((e) => e[1] !== void 0))), new URLSearchParams(r6).toString();
32016
32019
  }
32017
- var zo = /^(([a-zA-Z0-9]|[a-zA-Z0-9][a-zA-Z0-9\-_]*[a-zA-Z0-9])\.)*([A-Za-z0-9]|[A-Za-z0-9][A-Za-z0-9\-_]*[A-Za-z0-9])$/;
32018
- function El(r6) {
32019
- return zo.test(r6);
32020
+ var Ko = /^(([a-zA-Z0-9]|[a-zA-Z0-9][a-zA-Z0-9\-_]*[a-zA-Z0-9])\.)*([A-Za-z0-9]|[A-Za-z0-9][A-Za-z0-9\-_]*[A-Za-z0-9])$/;
32021
+ function Rl(r6) {
32022
+ return Ko.test(r6);
32020
32023
  }
32021
32024
  function He(r6, e) {
32022
32025
  if (!r6) return "";
@@ -32027,12 +32030,12 @@ function He(r6, e) {
32027
32030
  }
32028
32031
  return t.join(" ").trim();
32029
32032
  }
32030
- function $e(r6) {
32033
+ function Ge(r6) {
32031
32034
  if (!r6) return "";
32032
32035
  let e = ge(r6.text);
32033
- return e || (r6.coding ? r6.coding.map((t) => ai(t)).join(", ") : "");
32036
+ return e || (r6.coding ? r6.coding.map((t) => si(t)).join(", ") : "");
32034
32037
  }
32035
- function ai(r6, e) {
32038
+ function si(r6, e) {
32036
32039
  let t = ge(r6?.display);
32037
32040
  if (t) {
32038
32041
  let n = e ? ge(r6?.code) : void 0;
@@ -32044,32 +32047,32 @@ function ge(r6) {
32044
32047
  return typeof r6 == "string" ? r6 : void 0;
32045
32048
  }
32046
32049
  var l = { 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" };
32047
- function Fn(r6) {
32050
+ function Ln(r6) {
32048
32051
  let e = Array.isArray(r6) ? r6 : r6.entry?.map((t) => t.resource) ?? [];
32049
- for (let t of e) t?.resourceType === "StructureDefinition" && t.kind === "resource" && li(t.type);
32052
+ for (let t of e) t?.resourceType === "StructureDefinition" && t.kind === "resource" && ui(t.type);
32050
32053
  }
32051
- function li(r6) {
32054
+ function ui(r6) {
32052
32055
  let e = L.types[r6];
32053
- return e || (e = { searchParamsDetails: {} }, L.types[r6] = e), e.searchParams || (e.searchParams = { _id: { base: [r6], code: "_id", type: "token", expression: r6 + ".id" }, _lastUpdated: { base: [r6], code: "_lastUpdated", type: "date", expression: r6 + ".meta.lastUpdated" }, _compartment: { base: [r6], code: "_compartment", type: "reference", expression: r6 + ".meta.compartment" }, _profile: { base: [r6], code: "_profile", type: "uri", expression: r6 + ".meta.profile" }, _security: { base: [r6], code: "_security", type: "token", expression: r6 + ".meta.security" }, _source: { base: [r6], code: "_source", type: "uri", expression: r6 + ".meta.source" }, _tag: { base: [r6], code: "_tag", type: "token", expression: r6 + ".meta.tag" } }), e;
32056
+ return e || (e = { searchParamsDetails: {} }, L.types[r6] = e), !e.searchParams && r6 !== "Binary" && (e.searchParams = { _id: { base: [r6], code: "_id", type: "token", expression: r6 + ".id" }, _lastUpdated: { base: [r6], code: "_lastUpdated", type: "date", expression: r6 + ".meta.lastUpdated" }, _compartment: { base: [r6], code: "_compartment", type: "reference", expression: r6 + ".meta.compartment" }, _profile: { base: [r6], code: "_profile", type: "uri", expression: r6 + ".meta.profile" }, _security: { base: [r6], code: "_security", type: "token", expression: r6 + ".meta.security" }, _source: { base: [r6], code: "_source", type: "uri", expression: r6 + ".meta.source" }, _tag: { base: [r6], code: "_tag", type: "token", expression: r6 + ".meta.tag" } }), e;
32054
32057
  }
32055
32058
  function Br(r6) {
32056
32059
  for (let e of r6.base ?? []) {
32057
- let t = li(e);
32060
+ let t = ui(e);
32058
32061
  t.searchParams || (t.searchParams = {}), t.searchParams[r6.code] = r6;
32059
32062
  }
32060
32063
  }
32061
32064
  function hr(r6) {
32062
32065
  let e = r6.type?.[0]?.code;
32063
- return e === "BackboneElement" || e === "Element" ? os((r6.base?.path ?? r6.path)?.split(".")) : e;
32066
+ return e === "BackboneElement" || e === "Element" ? as((r6.base?.path ?? r6.path)?.split(".")) : e;
32064
32067
  }
32065
- function os(r6) {
32068
+ function as(r6) {
32066
32069
  return r6.length === 1 ? r6[0] : r6.map(I).join("");
32067
32070
  }
32068
32071
  function ft(r6, e, t) {
32069
- let n = Be(r6, t);
32070
- if (n) return us(n.elements, e);
32072
+ let n = We(r6, t);
32073
+ if (n) return ps(n.elements, e);
32071
32074
  }
32072
- function us(r6, e) {
32075
+ function ps(r6, e) {
32073
32076
  let t = r6[e] ?? r6[e + "[x]"];
32074
32077
  if (t) return t;
32075
32078
  for (let n = 0; n < e.length; n++) {
@@ -32083,11 +32086,11 @@ function us(r6, e) {
32083
32086
  function A(r6, e) {
32084
32087
  return !(!r6 || typeof r6 != "object" || !("resourceType" in r6) || e && r6.resourceType !== e);
32085
32088
  }
32086
- function Y(r6) {
32089
+ function X(r6) {
32087
32090
  return !!(r6 && typeof r6 == "object" && "reference" in r6 && typeof r6.reference == "string");
32088
32091
  }
32089
32092
  var L = { types: {} };
32090
- function Ve(r6) {
32093
+ function Me(r6) {
32091
32094
  if (r6.startsWith("T")) return r6 + "T00:00:00.000Z".substring(r6.length);
32092
32095
  if (r6.length <= 10) return r6;
32093
32096
  try {
@@ -32171,11 +32174,11 @@ var O = { empty: (r6, e) => h(e.length === 0 || e.every((t) => S(t.value))), has
32171
32174
  }, convertsToInteger: (r6, e) => e.length === 0 ? [] : h(O.toInteger(r6, e).length === 1), toDate: (r6, e) => {
32172
32175
  if (e.length === 0) return [];
32173
32176
  let [{ value: t }] = z(e, 1);
32174
- return typeof t == "string" && /^\d{4}(-\d{2}(-\d{2})?)?/.exec(t) ? [{ type: l.date, value: Ve(t) }] : [];
32177
+ return typeof t == "string" && /^\d{4}(-\d{2}(-\d{2})?)?/.exec(t) ? [{ type: l.date, value: Me(t) }] : [];
32175
32178
  }, convertsToDate: (r6, e) => e.length === 0 ? [] : h(O.toDate(r6, e).length === 1), toDateTime: (r6, e) => {
32176
32179
  if (e.length === 0) return [];
32177
32180
  let [{ value: t }] = z(e, 1);
32178
- return typeof t == "string" && /^\d{4}(-\d{2}(-\d{2})?)?/.exec(t) ? [{ type: l.dateTime, value: Ve(t) }] : [];
32181
+ return typeof t == "string" && /^\d{4}(-\d{2}(-\d{2})?)?/.exec(t) ? [{ type: l.dateTime, value: Me(t) }] : [];
32179
32182
  }, convertsToDateTime: (r6, e) => e.length === 0 ? [] : h(O.toDateTime(r6, e).length === 1), toDecimal: (r6, e) => {
32180
32183
  if (e.length === 0) return [];
32181
32184
  let [{ value: t }] = z(e, 1);
@@ -32193,7 +32196,7 @@ var O = { empty: (r6, e) => h(e.length === 0 || e.every((t) => S(t.value))), has
32193
32196
  let [{ value: t }] = z(e, 1);
32194
32197
  if (typeof t == "string") {
32195
32198
  let n = /^T?(\d{2}(:\d{2}(:\d{2})?)?)/.exec(t);
32196
- if (n) return [{ type: l.time, value: Ve("T" + n[1]) }];
32199
+ if (n) return [{ type: l.time, value: Me("T" + n[1]) }];
32197
32200
  }
32198
32201
  return [];
32199
32202
  }, convertsToTime: (r6, e) => e.length === 0 ? [] : h(O.toTime(r6, e).length === 1), indexOf: (r6, e, t) => F((n, i2) => n.indexOf(i2), r6, e, t), substring: (r6, e, t, n) => F((i2, o, s) => {
@@ -32214,7 +32217,7 @@ var O = { empty: (r6, e) => h(e.length === 0 || e.every((t) => S(t.value))), has
32214
32217
  return [{ type: l.Quantity, value: { value: c[a2], unit: a2 } }];
32215
32218
  }, is: (r6, e, t) => {
32216
32219
  let n = "";
32217
- return t instanceof q ? n = t.name : t instanceof ae && (n = t.left.name + "." + t.right.name), n ? e.map((i2) => ({ type: l.boolean, value: dt(i2, n) })) : [];
32220
+ return t instanceof q ? n = t.name : t instanceof ae && (n = t.left.name + "." + t.right.name), n ? e.map((i2) => ({ type: l.boolean, value: pt(i2, n) })) : [];
32218
32221
  }, not: (r6, e) => O.toBoolean(r6, e).map((t) => ({ type: l.boolean, value: !t.value })), resolve: (r6, e) => e.map((t) => {
32219
32222
  let n = t.value, i2;
32220
32223
  if (typeof n == "string") i2 = n;
@@ -32264,7 +32267,7 @@ function Q(r6, e, t, ...n) {
32264
32267
  if (t.length === 0) return [];
32265
32268
  let [{ value: i2 }] = z(t, 1), o = k(i2), s = o ? i2.value : i2;
32266
32269
  if (typeof s != "number") throw new Error("Math function cannot be called with non-number");
32267
- let a2 = r6(s, ...n.map((d2) => d2.eval(e, t)[0]?.value)), c = o ? l.Quantity : t[0].type, u2 = o ? { ...i2, value: a2 } : a2;
32270
+ let a2 = r6(s, ...n.map((p) => p.eval(e, t)[0]?.value)), c = o ? l.Quantity : t[0].type, u2 = o ? { ...i2, value: a2 } : a2;
32268
32271
  return [{ type: c, value: u2 }];
32269
32272
  }
32270
32273
  function z(r6, e) {
@@ -32378,8 +32381,8 @@ var St = class extends R {
32378
32381
  super("in", e, t);
32379
32382
  }
32380
32383
  eval(e, t) {
32381
- let n = H(this.left.eval(e, t)), i2 = this.right.eval(e, t);
32382
- return n ? h(i2.some((o) => je(n, o)[0].value)) : [];
32384
+ let n = G(this.left.eval(e, t)), i2 = this.right.eval(e, t);
32385
+ return n ? h(i2.some((o) => $e(n, o)[0].value)) : [];
32383
32386
  }
32384
32387
  };
32385
32388
  var ae = class extends te {
@@ -32408,7 +32411,7 @@ var bt = class extends R {
32408
32411
  }
32409
32412
  eval(e, t) {
32410
32413
  let n = this.left.eval(e, t), i2 = this.right.eval(e, t);
32411
- return $n(n, i2);
32414
+ return jn(n, i2);
32412
32415
  }
32413
32416
  };
32414
32417
  var Et = class extends R {
@@ -32417,7 +32420,7 @@ var Et = class extends R {
32417
32420
  }
32418
32421
  eval(e, t) {
32419
32422
  let n = this.left.eval(e, t), i2 = this.right.eval(e, t);
32420
- return Hn(n, i2);
32423
+ return $n(n, i2);
32421
32424
  }
32422
32425
  };
32423
32426
  var Rt = class extends R {
@@ -32435,7 +32438,7 @@ var Ct = class extends R {
32435
32438
  }
32436
32439
  eval(e, t) {
32437
32440
  let n = this.left.eval(e, t), i2 = this.right.eval(e, t);
32438
- return jn(Pr(n, i2));
32441
+ return qn(Pr(n, i2));
32439
32442
  }
32440
32443
  };
32441
32444
  var Te = class extends R {
@@ -32446,7 +32449,7 @@ var Te = class extends R {
32446
32449
  let n = this.left.eval(e, t);
32447
32450
  if (n.length !== 1) return [];
32448
32451
  let i2 = this.right.name;
32449
- return h(dt(n[0], i2));
32452
+ return h(pt(n[0], i2));
32450
32453
  }
32451
32454
  };
32452
32455
  var Pt = class extends R {
@@ -32454,7 +32457,7 @@ var Pt = class extends R {
32454
32457
  super("and", e, t);
32455
32458
  }
32456
32459
  eval(e, t) {
32457
- let n = H(this.left.eval(e, t), "boolean"), i2 = H(this.right.eval(e, t), "boolean");
32460
+ let n = G(this.left.eval(e, t), "boolean"), i2 = G(this.right.eval(e, t), "boolean");
32458
32461
  return n?.value === true && i2?.value === true ? h(true) : n?.value === false || i2?.value === false ? h(false) : [];
32459
32462
  }
32460
32463
  };
@@ -32463,7 +32466,7 @@ var wt = class extends R {
32463
32466
  super("or", e, t);
32464
32467
  }
32465
32468
  eval(e, t) {
32466
- let n = H(this.left.eval(e, t), "boolean"), i2 = H(this.right.eval(e, t), "boolean");
32469
+ let n = G(this.left.eval(e, t), "boolean"), i2 = G(this.right.eval(e, t), "boolean");
32467
32470
  return n?.value === false && i2?.value === false ? h(false) : n?.value || i2?.value ? h(true) : [];
32468
32471
  }
32469
32472
  };
@@ -32472,7 +32475,7 @@ var At = class extends R {
32472
32475
  super("xor", e, t);
32473
32476
  }
32474
32477
  eval(e, t) {
32475
- let n = H(this.left.eval(e, t), "boolean"), i2 = H(this.right.eval(e, t), "boolean");
32478
+ let n = G(this.left.eval(e, t), "boolean"), i2 = G(this.right.eval(e, t), "boolean");
32476
32479
  return !n || !i2 ? [] : h(n.value !== i2.value);
32477
32480
  }
32478
32481
  };
@@ -32481,7 +32484,7 @@ var Ot = class extends R {
32481
32484
  super("implies", e, t);
32482
32485
  }
32483
32486
  eval(e, t) {
32484
- let n = H(this.left.eval(e, t), "boolean"), i2 = H(this.right.eval(e, t), "boolean");
32487
+ let n = G(this.left.eval(e, t), "boolean"), i2 = G(this.right.eval(e, t), "boolean");
32485
32488
  return i2?.value === true || n?.value === false ? h(true) : !n || !i2 ? [] : h(false);
32486
32489
  }
32487
32490
  };
@@ -32514,39 +32517,39 @@ var Se = class {
32514
32517
  return `${this.left.toString()}[${this.expr.toString()}]`;
32515
32518
  }
32516
32519
  };
32517
- var Qe = ["!=", "!~", "<=", ">=", "{}", "->"];
32520
+ var ze = ["!=", "!~", "<=", ">=", "{}", "->"];
32518
32521
  var g = { 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 };
32519
- var ps = { parse(r6) {
32522
+ var hs = { parse(r6) {
32520
32523
  let e = r6.consumeAndParse();
32521
32524
  if (!r6.match(")")) throw new Error("Parse error: expected `)` got `" + r6.peek()?.value + "`");
32522
32525
  return e;
32523
32526
  } };
32524
- var fs2 = { parse(r6, e) {
32527
+ var ms = { parse(r6, e) {
32525
32528
  let t = r6.consumeAndParse();
32526
32529
  if (!r6.match("]")) throw new Error("Parse error: expected `]`");
32527
32530
  return new Se(e, t);
32528
32531
  }, precedence: g.Indexer };
32529
- var hs = { parse(r6, e) {
32532
+ var ys = { parse(r6, e) {
32530
32533
  if (!(e instanceof q)) throw new Error("Unexpected parentheses");
32531
32534
  let t = [];
32532
32535
  for (; !r6.match(")"); ) t.push(r6.consumeAndParse()), r6.match(",");
32533
32536
  return new ee(e.name, t);
32534
32537
  }, precedence: g.FunctionCall };
32535
- function ms(r6) {
32538
+ function gs(r6) {
32536
32539
  let e = r6.split(" "), t = parseFloat(e[0]), n = e[1];
32537
32540
  return n?.startsWith("'") && n.endsWith("'") ? n = n.substring(1, n.length - 1) : n = "{" + n + "}", { value: t, unit: n };
32538
32541
  }
32539
- function ze() {
32540
- return new nt().registerPrefix("String", { parse: (r6, e) => new N({ type: l.string, value: e.value }) }).registerPrefix("DateTime", { parse: (r6, e) => new N({ type: l.dateTime, value: Ve(e.value) }) }).registerPrefix("Quantity", { parse: (r6, e) => new N({ type: l.Quantity, value: ms(e.value) }) }).registerPrefix("Number", { parse: (r6, e) => new N({ type: e.value.includes(".") ? l.decimal : l.integer, value: parseFloat(e.value) }) }).registerPrefix("true", { parse: () => new N({ type: l.boolean, value: true }) }).registerPrefix("false", { parse: () => new N({ type: l.boolean, value: false }) }).registerPrefix("Symbol", { parse: (r6, e) => new q(e.value) }).registerPrefix("{}", { parse: () => new gt() }).registerPrefix("(", ps).registerInfix("[", fs2).registerInfix("(", hs).prefix("+", g.UnaryAdd, (r6, e) => new xt("+", e, (t) => t)).prefix("-", g.UnarySubtract, (r6, e) => new D("-", e, e, (t, n) => -n)).infixLeft(".", g.Dot, (r6, e, t) => new ae(r6, t)).infixLeft("/", g.Divide, (r6, e, t) => new D("/", r6, t, (n, i2) => n / i2)).infixLeft("*", g.Multiply, (r6, e, t) => new D("*", r6, t, (n, i2) => n * i2)).infixLeft("+", g.Add, (r6, e, t) => new D("+", r6, t, (n, i2) => n + i2)).infixLeft("-", g.Subtract, (r6, e, t) => new D("-", r6, t, (n, i2) => n - i2)).infixLeft("|", g.Union, (r6, e, t) => new ve(r6, t)).infixLeft("=", g.Equals, (r6, e, t) => new bt(r6, t)).infixLeft("!=", g.NotEquals, (r6, e, t) => new Et(r6, t)).infixLeft("~", g.Equivalent, (r6, e, t) => new Rt(r6, t)).infixLeft("!~", g.NotEquivalent, (r6, e, t) => new Ct(r6, t)).infixLeft("<", g.LessThan, (r6, e, t) => new D("<", r6, t, (n, i2) => n < i2)).infixLeft("<=", g.LessThanOrEquals, (r6, e, t) => new D("<=", r6, t, (n, i2) => n <= i2)).infixLeft(">", g.GreaterThan, (r6, e, t) => new D(">", r6, t, (n, i2) => n > i2)).infixLeft(">=", g.GreaterThanOrEquals, (r6, e, t) => new D(">=", r6, t, (n, i2) => n >= i2)).infixLeft("&", g.Ampersand, (r6, e, t) => new vt(r6, t)).infixLeft("and", g.And, (r6, e, t) => new Pt(r6, t)).infixLeft("as", g.As, (r6, e, t) => new ce(r6, t)).infixLeft("contains", g.Contains, (r6, e, t) => new Tt(r6, t)).infixLeft("div", g.Divide, (r6, e, t) => new D("div", r6, t, (n, i2) => n / i2 | 0)).infixLeft("in", g.In, (r6, e, t) => new St(r6, t)).infixLeft("is", g.Is, (r6, e, t) => new Te(r6, t)).infixLeft("mod", g.Modulo, (r6, e, t) => new D("mod", r6, t, (n, i2) => n % i2)).infixLeft("or", g.Or, (r6, e, t) => new wt(r6, t)).infixLeft("xor", g.Xor, (r6, e, t) => new At(r6, t)).infixLeft("implies", g.Implies, (r6, e, t) => new Ot(r6, t));
32542
+ function Je() {
32543
+ return new nt().registerPrefix("String", { parse: (r6, e) => new N({ type: l.string, value: e.value }) }).registerPrefix("DateTime", { parse: (r6, e) => new N({ type: l.dateTime, value: Me(e.value) }) }).registerPrefix("Quantity", { parse: (r6, e) => new N({ type: l.Quantity, value: gs(e.value) }) }).registerPrefix("Number", { parse: (r6, e) => new N({ type: e.value.includes(".") ? l.decimal : l.integer, value: parseFloat(e.value) }) }).registerPrefix("true", { parse: () => new N({ type: l.boolean, value: true }) }).registerPrefix("false", { parse: () => new N({ type: l.boolean, value: false }) }).registerPrefix("Symbol", { parse: (r6, e) => new q(e.value) }).registerPrefix("{}", { parse: () => new gt() }).registerPrefix("(", hs).registerInfix("[", ms).registerInfix("(", ys).prefix("+", g.UnaryAdd, (r6, e) => new xt("+", e, (t) => t)).prefix("-", g.UnarySubtract, (r6, e) => new D("-", e, e, (t, n) => -n)).infixLeft(".", g.Dot, (r6, e, t) => new ae(r6, t)).infixLeft("/", g.Divide, (r6, e, t) => new D("/", r6, t, (n, i2) => n / i2)).infixLeft("*", g.Multiply, (r6, e, t) => new D("*", r6, t, (n, i2) => n * i2)).infixLeft("+", g.Add, (r6, e, t) => new D("+", r6, t, (n, i2) => n + i2)).infixLeft("-", g.Subtract, (r6, e, t) => new D("-", r6, t, (n, i2) => n - i2)).infixLeft("|", g.Union, (r6, e, t) => new ve(r6, t)).infixLeft("=", g.Equals, (r6, e, t) => new bt(r6, t)).infixLeft("!=", g.NotEquals, (r6, e, t) => new Et(r6, t)).infixLeft("~", g.Equivalent, (r6, e, t) => new Rt(r6, t)).infixLeft("!~", g.NotEquivalent, (r6, e, t) => new Ct(r6, t)).infixLeft("<", g.LessThan, (r6, e, t) => new D("<", r6, t, (n, i2) => n < i2)).infixLeft("<=", g.LessThanOrEquals, (r6, e, t) => new D("<=", r6, t, (n, i2) => n <= i2)).infixLeft(">", g.GreaterThan, (r6, e, t) => new D(">", r6, t, (n, i2) => n > i2)).infixLeft(">=", g.GreaterThanOrEquals, (r6, e, t) => new D(">=", r6, t, (n, i2) => n >= i2)).infixLeft("&", g.Ampersand, (r6, e, t) => new vt(r6, t)).infixLeft("and", g.And, (r6, e, t) => new Pt(r6, t)).infixLeft("as", g.As, (r6, e, t) => new ce(r6, t)).infixLeft("contains", g.Contains, (r6, e, t) => new Tt(r6, t)).infixLeft("div", g.Divide, (r6, e, t) => new D("div", r6, t, (n, i2) => n / i2 | 0)).infixLeft("in", g.In, (r6, e, t) => new St(r6, t)).infixLeft("is", g.Is, (r6, e, t) => new Te(r6, t)).infixLeft("mod", g.Modulo, (r6, e, t) => new D("mod", r6, t, (n, i2) => n % i2)).infixLeft("or", g.Or, (r6, e, t) => new wt(r6, t)).infixLeft("xor", g.Xor, (r6, e, t) => new At(r6, t)).infixLeft("implies", g.Implies, (r6, e, t) => new Ot(r6, t));
32541
32544
  }
32542
- var ys = ze();
32545
+ var xs = Je();
32543
32546
  var f = { EQUALS: "eq", NOT_EQUALS: "ne", GREATER_THAN: "gt", LESS_THAN: "lt", GREATER_THAN_OR_EQUALS: "ge", LESS_THAN_OR_EQUALS: "le", STARTS_AFTER: "sa", ENDS_BEFORE: "eb", APPROXIMATELY: "ap", CONTAINS: "contains", STARTS_WITH: "sw", EXACT: "exact", TEXT: "text", NOT: "not", ABOVE: "above", BELOW: "below", IN: "in", NOT_IN: "not-in", OF_TYPE: "of-type", MISSING: "missing", PRESENT: "present", IDENTIFIER: "identifier", ITERATE: "iterate" };
32544
- var xi = { contains: f.CONTAINS, exact: f.EXACT, above: f.ABOVE, below: f.BELOW, text: f.TEXT, not: f.NOT, in: f.IN, "not-in": f.NOT_IN, "of-type": f.OF_TYPE, missing: f.MISSING, identifier: f.IDENTIFIER, iterate: f.ITERATE };
32547
+ var gi = { contains: f.CONTAINS, exact: f.EXACT, above: f.ABOVE, below: f.BELOW, text: f.TEXT, not: f.NOT, in: f.IN, "not-in": f.NOT_IN, "of-type": f.OF_TYPE, missing: f.MISSING, identifier: f.IDENTIFIER, iterate: f.ITERATE };
32545
32548
  var qr = { eq: f.EQUALS, ne: f.NOT_EQUALS, lt: f.LESS_THAN, le: f.LESS_THAN_OR_EQUALS, gt: f.GREATER_THAN, ge: f.GREATER_THAN_OR_EQUALS, sa: f.STARTS_AFTER, eb: f.ENDS_BEFORE, ap: f.APPROXIMATELY, sw: f.STARTS_WITH };
32546
- var Ps = [f.MISSING, f.PRESENT];
32547
- var Ke = { READ: "read", VREAD: "vread", UPDATE: "update", PATCH: "patch", DELETE: "delete", HISTORY: "history", HISTORY_INSTANCE: "history-instance", HISTORY_TYPE: "history-type", HISTORY_SYSTEM: "history-system", CREATE: "create", SEARCH: "search", SEARCH_TYPE: "search-type", SEARCH_SYSTEM: "search-system", SEARCH_COMPARTMENT: "search-compartment", CAPABILITIES: "capabilities", TRANSACTION: "transaction", BATCH: "batch", OPERATION: "operation" };
32548
- var Gs = [Ke.READ, Ke.VREAD, Ke.HISTORY, Ke.HISTORY_INSTANCE];
32549
- function Ks(r6) {
32549
+ var As = [f.MISSING, f.PRESENT];
32550
+ var be = { READ: "read", VREAD: "vread", UPDATE: "update", DELETE: "delete", HISTORY: "history", CREATE: "create", SEARCH: "search" };
32551
+ var zs = [be.READ, be.VREAD, be.HISTORY, be.SEARCH];
32552
+ function Xs(r6) {
32550
32553
  if (typeof window < "u") {
32551
32554
  let e = window.atob(r6), t = Uint8Array.from(e, (n) => n.charCodeAt(0));
32552
32555
  return new window.TextDecoder().decode(t);
@@ -32562,26 +32565,25 @@ function Ft(r6) {
32562
32565
  if (typeof Buffer < "u") return Buffer.from(r6, "utf8").toString("base64");
32563
32566
  throw new Error("Unable to encode base64");
32564
32567
  }
32565
- function Ti(r6) {
32566
- if (typeof Buffer < "u") return Buffer.from(r6, "base64url").toString("utf-8");
32568
+ function Si(r6) {
32567
32569
  r6 = r6.padEnd(r6.length + (4 - r6.length % 4) % 4, "=");
32568
32570
  let e = r6.replace(/-/g, "+").replace(/_/g, "/");
32569
- return Ks(e);
32571
+ return Xs(e);
32570
32572
  }
32571
- function Hr() {
32573
+ function $r() {
32572
32574
  let r6 = new Uint32Array(28);
32573
- return crypto.getRandomValues(r6), Zn(r6.buffer);
32575
+ return crypto.getRandomValues(r6), Yn(r6.buffer);
32574
32576
  }
32575
- async function Si(r6) {
32577
+ async function bi(r6) {
32576
32578
  return crypto.subtle.digest("SHA-256", new TextEncoder().encode(r6));
32577
32579
  }
32578
- function be() {
32580
+ function Ee() {
32579
32581
  return "xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g, (r6) => {
32580
32582
  let e = Math.random() * 16 | 0;
32581
32583
  return (r6 === "x" ? e : e & 3 | 8).toString(16);
32582
32584
  });
32583
32585
  }
32584
- var w = { 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", MULTIPART_FORM_DATA: "multipart/form-data", PNG: "image/png", SCIM_JSON: "application/scim+json", SVG: "image/svg+xml", TEXT: "text/plain", TYPESCRIPT: "text/typescript", PING: "x-application/ping", XML: "text/xml", CDA_XML: "application/cda+xml" };
32586
+ var w = { 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", JWT: "application/jwt", MULTIPART_FORM_DATA: "multipart/form-data", PNG: "image/png", SCIM_JSON: "application/scim+json", SVG: "image/svg+xml", TEXT: "text/plain", TYPESCRIPT: "text/typescript", PING: "x-application/ping", XML: "text/xml", CDA_XML: "application/cda+xml" };
32585
32587
  var Gr = class {
32586
32588
  constructor() {
32587
32589
  this.listeners = {};
@@ -32624,73 +32626,73 @@ var J = class {
32624
32626
  this.emitter.removeAllListeners();
32625
32627
  }
32626
32628
  };
32627
- var Qr = { "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" };
32628
- var ra = ["Patient", "Encounter", "ImagingStudy", "DiagnosticReport", "OperationOutcome", "Bundle"];
32629
- var zr = ["DiagnosticReport-update"];
32630
- function Ei(r6) {
32631
- return zr.includes(r6);
32632
- }
32629
+ var Hr = { "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" };
32630
+ var na = ["Patient", "Encounter", "ImagingStudy", "DiagnosticReport", "OperationOutcome", "Bundle"];
32631
+ var Qr = ["DiagnosticReport-update"];
32633
32632
  function Ri(r6) {
32634
- if (zr.includes(r6)) throw new p(y(`'context.version' is required for '${r6}'.`));
32635
- }
32636
- var na = { "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", reference: true }, patient: { resourceType: "Patient", optional: true, reference: true }, select: { resourceType: "*", reference: true, manyAllowed: true } }, "DiagnosticReport-update": { report: { resourceType: "DiagnosticReport", reference: true }, patient: { resourceType: "Patient", optional: true, reference: true }, updates: { resourceType: "Bundle" } }, syncerror: { operationoutcome: { resourceType: "OperationOutcome" } } };
32637
- function ia(r6) {
32638
- return ra.includes(r6);
32633
+ return Qr.includes(r6);
32639
32634
  }
32640
32635
  function Ci(r6) {
32636
+ if (Qr.includes(r6)) throw new d(y(`'context.version' is required for '${r6}'.`));
32637
+ }
32638
+ var ia = { "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", reference: true }, patient: { resourceType: "Patient", optional: true, reference: true }, select: { resourceType: "*", reference: true, manyAllowed: true } }, "DiagnosticReport-update": { report: { resourceType: "DiagnosticReport", reference: true }, patient: { resourceType: "Patient", optional: true, reference: true }, updates: { resourceType: "Bundle" } }, syncerror: { operationoutcome: { resourceType: "OperationOutcome" } } };
32639
+ function oa(r6) {
32640
+ return na.includes(r6);
32641
+ }
32642
+ function Pi(r6) {
32641
32643
  return !!r6.endpoint;
32642
32644
  }
32643
- function Jr(r6) {
32644
- if (!Ut(r6)) throw new p(y("subscriptionRequest must be an object conforming to SubscriptionRequest type."));
32645
+ function zr(r6) {
32646
+ if (!Ut(r6)) throw new d(y("subscriptionRequest must be an object conforming to SubscriptionRequest type."));
32645
32647
  let { channelType: e, mode: t, topic: n, events: i2 } = r6, o = { "hub.channel.type": e, "hub.mode": t, "hub.topic": n, "hub.events": i2.join(",") };
32646
- return Ci(r6) && (o.endpoint = r6.endpoint), new URLSearchParams(o).toString();
32648
+ return Pi(r6) && (o.endpoint = r6.endpoint), new URLSearchParams(o).toString();
32647
32649
  }
32648
32650
  function Ut(r6) {
32649
32651
  if (typeof r6 != "object") return false;
32650
32652
  let { channelType: e, mode: t, topic: n, events: i2 } = r6;
32651
32653
  if (!(e && t && n && i2) || typeof n != "string" || typeof i2 != "object" || !Array.isArray(i2) || i2.length < 1 || e !== "websocket" || t !== "subscribe" && t !== "unsubscribe") return false;
32652
- for (let o of i2) if (!Qr[o]) return false;
32653
- return !(Ci(r6) && !(typeof r6.endpoint == "string" && r6.endpoint.startsWith("ws")));
32654
+ for (let o of i2) if (!Hr[o]) return false;
32655
+ return !(Pi(r6) && !(typeof r6.endpoint == "string" && r6.endpoint.startsWith("ws")));
32654
32656
  }
32655
- function oa(r6, e, t, n) {
32656
- if (typeof e != "object") throw new p(y(`context[${t}] is invalid. Context must contain a single valid FHIR resource! Resource is not an object.`));
32657
- if (!(e.id && typeof e.id == "string")) throw new p(y(`context[${t}] is invalid. Resource must contain a valid string ID.`));
32658
- if (!e.resourceType) throw new p(y(`context[${t}] is invalid. Resource must contain a resource type. No resource type found.`));
32657
+ function sa(r6, e, t, n) {
32658
+ if (typeof e != "object") throw new d(y(`context[${t}] is invalid. Context must contain a single valid FHIR resource! Resource is not an object.`));
32659
+ if (!(e.id && typeof e.id == "string")) throw new d(y(`context[${t}] is invalid. Resource must contain a valid string ID.`));
32660
+ if (!e.resourceType) throw new d(y(`context[${t}] is invalid. Resource must contain a resource type. No resource type found.`));
32659
32661
  let i2 = n.resourceType;
32660
32662
  if (i2 !== "*") {
32661
- if (!ia(e.resourceType)) throw new p(y(`context[${t}] is invalid. Resource must contain a valid FHIRcast resource type. Resource type is not a known resource type.`));
32662
- if (i2 && e.resourceType !== i2) throw new p(y(`context[${t}] is invalid. context[${t}] for the '${r6}' event should contain resource of type ${i2}.`));
32663
+ if (!oa(e.resourceType)) throw new d(y(`context[${t}] is invalid. Resource must contain a valid FHIRcast resource type. Resource type is not a known resource type.`));
32664
+ if (i2 && e.resourceType !== i2) throw new d(y(`context[${t}] is invalid. context[${t}] for the '${r6}' event should contain resource of type ${i2}.`));
32663
32665
  }
32664
32666
  }
32665
- function sa(r6, e, t, n, i2) {
32667
+ function aa(r6, e, t, n, i2) {
32666
32668
  if (i2.set(e.key, (i2.get(e.key) ?? 0) + 1), n.reference) {
32667
- if (!Y(e.reference)) throw new p(y(`context[${t}] is invalid. Expected key '${e.key}' to be a reference.`));
32668
- } else oa(r6, e.resource, t, n);
32669
+ if (!X(e.reference)) throw new d(y(`context[${t}] is invalid. Expected key '${e.key}' to be a reference.`));
32670
+ } else sa(r6, e.resource, t, n);
32669
32671
  }
32670
- function aa(r6, e) {
32671
- let t = /* @__PURE__ */ new Map(), n = na[r6];
32672
+ function ca(r6, e) {
32673
+ let t = /* @__PURE__ */ new Map(), n = ia[r6];
32672
32674
  for (let i2 = 0; i2 < e.length; i2++) {
32673
32675
  let o = e[i2].key;
32674
- if (!n[o]) throw new p(y(`Key '${o}' not found for event '${r6}'. Make sure to add only valid keys.`));
32675
- sa(r6, e[i2], i2, n[o], t);
32676
+ if (!n[o]) throw new d(y(`Key '${o}' not found for event '${r6}'. Make sure to add only valid keys.`));
32677
+ aa(r6, e[i2], i2, n[o], t);
32676
32678
  }
32677
32679
  for (let [i2, o] of Object.entries(n)) {
32678
- if (!(o.optional || t.has(i2))) throw new p(y(`Missing required key '${i2}' on context for '${r6}' event.`));
32679
- if (!o.manyAllowed && (t.get(i2) ?? 0) > 1) throw new p(y(`${t.get(i2)} context entries with key '${i2}' found for the '${r6}' event when schema only allows for 1.`));
32680
+ if (!(o.optional || t.has(i2))) throw new d(y(`Missing required key '${i2}' on context for '${r6}' event.`));
32681
+ if (!o.manyAllowed && (t.get(i2) ?? 0) > 1) throw new d(y(`${t.get(i2)} context entries with key '${i2}' found for the '${r6}' event when schema only allows for 1.`));
32680
32682
  }
32681
32683
  }
32682
- function Kr(r6, e, t, n) {
32683
- if (!(r6 && typeof r6 == "string")) throw new p(y("Must provide a topic."));
32684
- if (!Qr[e]) throw new p(y(`Must provide a valid FHIRcast event name. Supported events: ${Object.keys(Qr).join(", ")}`));
32685
- if (typeof t != "object") throw new p(y("context must be a context object or array of context objects."));
32686
- if (zr.includes(e) && !n) throw new p(y(`The '${e}' event must contain a 'context.versionId'.`));
32684
+ function Jr(r6, e, t, n) {
32685
+ if (!(r6 && typeof r6 == "string")) throw new d(y("Must provide a topic."));
32686
+ if (!Hr[e]) throw new d(y(`Must provide a valid FHIRcast event name. Supported events: ${Object.keys(Hr).join(", ")}`));
32687
+ if (typeof t != "object") throw new d(y("context must be a context object or array of context objects."));
32688
+ if (Qr.includes(e) && !n) throw new d(y(`The '${e}' event must contain a 'context.versionId'.`));
32687
32689
  let i2 = Array.isArray(t) ? t : [t];
32688
- return aa(e, i2), { timestamp: (/* @__PURE__ */ new Date()).toISOString(), id: be(), event: { "hub.topic": r6, "hub.event": e, context: i2, ...n ? { "context.versionId": n } : {} } };
32690
+ return ca(e, i2), { timestamp: (/* @__PURE__ */ new Date()).toISOString(), id: Ee(), event: { "hub.topic": r6, "hub.event": e, context: i2, ...n ? { "context.versionId": n } : {} } };
32689
32691
  }
32690
32692
  var Nt = class extends J {
32691
32693
  constructor(e) {
32692
- if (super(), this.subRequest = e, !e.endpoint) throw new p(y("Subscription request should contain an endpoint."));
32693
- if (!Ut(e)) throw new p(y("Subscription request failed validation."));
32694
+ if (super(), this.subRequest = e, !e.endpoint) throw new d(y("Subscription request should contain an endpoint."));
32695
+ if (!Ut(e)) throw new d(y("Subscription request failed validation."));
32694
32696
  let t = new WebSocket(e.endpoint);
32695
32697
  t.addEventListener("open", () => {
32696
32698
  this.dispatchEvent({ type: "connect" }), t.addEventListener("message", (n) => {
@@ -32707,24 +32709,24 @@ var Nt = class extends J {
32707
32709
  this.websocket.close();
32708
32710
  }
32709
32711
  };
32710
- function ca(r6) {
32711
- return JSON.parse(Ti(r6));
32712
+ function ua(r6) {
32713
+ return JSON.parse(Si(r6));
32712
32714
  }
32713
- function Pi(r6) {
32715
+ function wi(r6) {
32714
32716
  return r6.split(".").length === 3;
32715
32717
  }
32716
32718
  function Bt(r6) {
32717
32719
  let [e, t, n] = r6.split(".");
32718
- return ca(t);
32720
+ return ua(t);
32719
32721
  }
32720
- function wi(r6) {
32722
+ function Ai(r6) {
32721
32723
  try {
32722
32724
  return typeof Bt(r6).login_id == "string";
32723
32725
  } catch {
32724
32726
  return false;
32725
32727
  }
32726
32728
  }
32727
- function Ai(r6) {
32729
+ function Oi(r6) {
32728
32730
  try {
32729
32731
  let t = Bt(r6).exp;
32730
32732
  return typeof t == "number" ? t * 1e3 : void 0;
@@ -32746,11 +32748,11 @@ var Wt = class {
32746
32748
  await this.medplum.delete(`keyvalue/v1/${e}`);
32747
32749
  }
32748
32750
  };
32749
- var Oi;
32750
- Oi = Symbol.toStringTag;
32751
+ var Ii;
32752
+ Ii = Symbol.toStringTag;
32751
32753
  var V = class {
32752
32754
  constructor(e) {
32753
- this[Oi] = "ReadablePromise";
32755
+ this[Ii] = "ReadablePromise";
32754
32756
  this.status = "pending";
32755
32757
  this.suspender = e.then((t) => (this.status = "success", this.response = t, t), (t) => {
32756
32758
  throw this.status = "error", this.error = t, t;
@@ -32782,9 +32784,9 @@ var V = class {
32782
32784
  return this.suspender.finally(e);
32783
32785
  }
32784
32786
  };
32785
- var Ye = class {
32787
+ var Xe = class {
32786
32788
  constructor(e) {
32787
- this.storage = e ?? (typeof localStorage < "u" ? localStorage : new Yr());
32789
+ this.storage = e ?? (typeof localStorage < "u" ? localStorage : new Kr());
32788
32790
  }
32789
32791
  clear() {
32790
32792
  this.storage.clear();
@@ -32803,7 +32805,7 @@ var Ye = class {
32803
32805
  this.setString(e, t ? mt(t) : void 0);
32804
32806
  }
32805
32807
  };
32806
- var Yr = class {
32808
+ var Kr = class {
32807
32809
  constructor() {
32808
32810
  this.data = /* @__PURE__ */ new Map();
32809
32811
  }
@@ -32826,15 +32828,15 @@ var Yr = class {
32826
32828
  return Array.from(this.data.keys())[e];
32827
32829
  }
32828
32830
  };
32829
- var Fe = { Event: typeof globalThis.Event < "u" ? globalThis.Event : void 0, ErrorEvent: void 0, CloseEvent: void 0 };
32830
- var ki = false;
32831
- function ua() {
32831
+ var Ne = { Event: typeof globalThis.Event < "u" ? globalThis.Event : void 0, ErrorEvent: void 0, CloseEvent: void 0 };
32832
+ var Di = false;
32833
+ function la() {
32832
32834
  if (typeof globalThis.Event > "u") throw new Error("Unable to lazy init events for ReconnectingWebSocket. globalThis.Event is not defined yet");
32833
- Fe.Event = globalThis.Event, Fe.ErrorEvent = class extends Event {
32835
+ Ne.Event = globalThis.Event, Ne.ErrorEvent = class extends Event {
32834
32836
  constructor(e, t) {
32835
32837
  super("error", t), this.message = e.message, this.error = e;
32836
32838
  }
32837
- }, Fe.CloseEvent = class extends Event {
32839
+ }, Ne.CloseEvent = class extends Event {
32838
32840
  constructor(t = 1e3, n = "", i2) {
32839
32841
  super("close", i2);
32840
32842
  this.wasClean = true;
@@ -32842,17 +32844,17 @@ function ua() {
32842
32844
  }
32843
32845
  };
32844
32846
  }
32845
- function la(r6, e) {
32847
+ function pa(r6, e) {
32846
32848
  if (!r6) throw new Error(e);
32847
32849
  }
32848
32850
  function qt(r6) {
32849
32851
  return new r6.constructor(r6.type, r6);
32850
32852
  }
32851
- var Ee = { maxReconnectionDelay: 1e4, minReconnectionDelay: 1e3 + Math.random() * 4e3, minUptime: 5e3, reconnectionDelayGrowFactor: 1.3, connectionTimeout: 4e3, maxRetries: 1 / 0, maxEnqueuedMessages: 1 / 0, startClosed: false, debug: false };
32852
- var Di = false;
32853
+ var Re = { maxReconnectionDelay: 1e4, minReconnectionDelay: 1e3 + Math.random() * 4e3, minUptime: 5e3, reconnectionDelayGrowFactor: 1.3, connectionTimeout: 4e3, maxRetries: 1 / 0, maxEnqueuedMessages: 1 / 0, startClosed: false, debug: false };
32854
+ var Vi = false;
32853
32855
  var jt = class r extends J {
32854
32856
  constructor(t, n, i2 = {}) {
32855
- ki || (ua(), ki = true);
32857
+ Di || (la(), Di = true);
32856
32858
  super();
32857
32859
  this._retryCount = -1;
32858
32860
  this._shouldReconnect = true;
@@ -32866,8 +32868,8 @@ var jt = class r extends J {
32866
32868
  this.onopen = null;
32867
32869
  this._handleOpen = (t2) => {
32868
32870
  this._debug("open event");
32869
- let { minUptime: n2 = Ee.minUptime } = this._options;
32870
- clearTimeout(this._connectTimeout), this._uptimeTimeout = setTimeout(() => this._acceptOpen(), n2), la(this._ws, "WebSocket is not defined"), this._ws.binaryType = this._binaryType, this._messageQueue.forEach((i3) => this._ws?.send(i3)), this._messageQueue = [], this.onopen && this.onopen(t2), this.dispatchEvent(qt(t2));
32871
+ let { minUptime: n2 = Re.minUptime } = this._options;
32872
+ clearTimeout(this._connectTimeout), this._uptimeTimeout = setTimeout(() => this._acceptOpen(), n2), pa(this._ws, "WebSocket is not defined"), this._ws.binaryType = this._binaryType, this._messageQueue.forEach((i3) => this._ws?.send(i3)), this._messageQueue = [], this.onopen && this.onopen(t2), this.dispatchEvent(qt(t2));
32871
32873
  };
32872
32874
  this._handleMessage = (t2) => {
32873
32875
  this._debug("message event"), this.onmessage && this.onmessage(t2), this.dispatchEvent(qt(t2));
@@ -32948,7 +32950,7 @@ var jt = class r extends J {
32948
32950
  send(t) {
32949
32951
  if (this._ws && this._ws.readyState === this.OPEN) this._debug("send", t), this._ws.send(t);
32950
32952
  else {
32951
- let { maxEnqueuedMessages: n = Ee.maxEnqueuedMessages } = this._options;
32953
+ let { maxEnqueuedMessages: n = Re.maxEnqueuedMessages } = this._options;
32952
32954
  this._messageQueue.length < n && (this._debug("enqueue", t), this._messageQueue.push(t));
32953
32955
  }
32954
32956
  }
@@ -32956,7 +32958,7 @@ var jt = class r extends J {
32956
32958
  this._options.debug && this._debugLogger("RWS>", ...t);
32957
32959
  }
32958
32960
  _getNextDelay() {
32959
- let { reconnectionDelayGrowFactor: t = Ee.reconnectionDelayGrowFactor, minReconnectionDelay: n = Ee.minReconnectionDelay, maxReconnectionDelay: i2 = Ee.maxReconnectionDelay } = this._options, o = 0;
32961
+ let { reconnectionDelayGrowFactor: t = Re.reconnectionDelayGrowFactor, minReconnectionDelay: n = Re.minReconnectionDelay, maxReconnectionDelay: i2 = Re.maxReconnectionDelay } = this._options, o = 0;
32960
32962
  return this._retryCount > 0 && (o = n * Math.pow(t, this._retryCount - 1), o > i2 && (o = i2)), this._debug("next delay", o), o;
32961
32963
  }
32962
32964
  _wait() {
@@ -32967,7 +32969,7 @@ var jt = class r extends J {
32967
32969
  _connect() {
32968
32970
  if (this._connectLock || !this._shouldReconnect) return;
32969
32971
  this._connectLock = true;
32970
- let { maxRetries: t = Ee.maxRetries, connectionTimeout: n = Ee.connectionTimeout } = this._options;
32972
+ let { maxRetries: t = Re.maxRetries, connectionTimeout: n = Re.connectionTimeout } = this._options;
32971
32973
  if (this._retryCount >= t) {
32972
32974
  this._debug("max retries reached", this._retryCount, ">=", t);
32973
32975
  return;
@@ -32977,21 +32979,21 @@ var jt = class r extends J {
32977
32979
  this._connectLock = false;
32978
32980
  return;
32979
32981
  }
32980
- !this._options.WebSocket && typeof WebSocket > "u" && !Di && (console.error("\u203C\uFE0F No WebSocket implementation available. You should define options.WebSocket."), Di = true);
32982
+ !this._options.WebSocket && typeof WebSocket > "u" && !Vi && (console.error("\u203C\uFE0F No WebSocket implementation available. You should define options.WebSocket."), Vi = true);
32981
32983
  let i2 = this._options.WebSocket || WebSocket;
32982
32984
  this._debug("connect", { url: this._url, protocols: this._protocols }), this._ws = this._protocols ? new i2(this._url, this._protocols) : new i2(this._url), this._ws.binaryType = this._binaryType, this._connectLock = false, this._addListeners(), this._connectTimeout = setTimeout(() => this._handleTimeout(), n);
32983
32985
  }).catch((i2) => {
32984
- this._connectLock = false, this._handleError(new Fe.ErrorEvent(Error(i2.message), this));
32986
+ this._connectLock = false, this._handleError(new Ne.ErrorEvent(Error(i2.message), this));
32985
32987
  });
32986
32988
  }
32987
32989
  _handleTimeout() {
32988
- this._debug("timeout event"), this._handleError(new Fe.ErrorEvent(Error("TIMEOUT"), this));
32990
+ this._debug("timeout event"), this._handleError(new Ne.ErrorEvent(Error("TIMEOUT"), this));
32989
32991
  }
32990
32992
  _disconnect(t = 1e3, n) {
32991
32993
  if (this._clearTimeouts(), !!this._ws) {
32992
32994
  this._removeListeners();
32993
32995
  try {
32994
- this._ws.close(t, n), this._handleClose(new Fe.CloseEvent(t, n, this));
32996
+ this._ws.close(t, n), this._handleClose(new Ne.CloseEvent(t, n, this));
32995
32997
  } catch {
32996
32998
  }
32997
32999
  }
@@ -33010,7 +33012,7 @@ var jt = class r extends J {
33010
33012
  }
33011
33013
  };
33012
33014
  var da = 5e3;
33013
- var Xe = class extends J {
33015
+ var Ye = class extends J {
33014
33016
  constructor(...e) {
33015
33017
  super(), this.criteria = new Set(e);
33016
33018
  }
@@ -33027,7 +33029,7 @@ var Xe = class extends J {
33027
33029
  var Xr = class {
33028
33030
  constructor(e, t) {
33029
33031
  this.connecting = false;
33030
- this.criteria = e, this.emitter = new Xe(e), this.refCount = 1, this.subscriptionProps = t ? { ...t } : void 0;
33032
+ this.criteria = e, this.emitter = new Ye(e), this.refCount = 1, this.subscriptionProps = t ? { ...t } : void 0;
33031
33033
  }
33032
33034
  clearAttachedSubscription() {
33033
33035
  this.subscriptionId = void 0, this.token = void 0;
@@ -33037,15 +33039,15 @@ var $t = class {
33037
33039
  constructor(e, t, n) {
33038
33040
  this.pingTimer = void 0;
33039
33041
  this.waitingForPong = false;
33040
- if (!(e instanceof Ht)) throw new p(y("First arg of constructor should be a `MedplumClient`"));
33042
+ if (!(e instanceof Gt)) throw new d(y("First arg of constructor should be a `MedplumClient`"));
33041
33043
  let i2;
33042
33044
  try {
33043
33045
  i2 = new URL(t).toString();
33044
33046
  } catch {
33045
- throw new p(y("Not a valid URL"));
33047
+ throw new d(y("Not a valid URL"));
33046
33048
  }
33047
33049
  let o = n?.ReconnectingWebSocket ? new n.ReconnectingWebSocket(i2, void 0, { debug: n?.debug, debugLogger: n?.debugLogger }) : new jt(i2, void 0, { debug: n?.debug, debugLogger: n?.debugLogger });
33048
- this.medplum = e, this.ws = o, this.masterSubEmitter = new Xe(), this.criteriaEntries = /* @__PURE__ */ new Map(), this.criteriaEntriesBySubscriptionId = /* @__PURE__ */ new Map(), this.wsClosed = false, this.pingIntervalMs = n?.pingIntervalMs ?? da, this.currentProfile = e.getProfile(), this.setupListeners();
33050
+ this.medplum = e, this.ws = o, this.masterSubEmitter = new Ye(), this.criteriaEntries = /* @__PURE__ */ new Map(), this.criteriaEntriesBySubscriptionId = /* @__PURE__ */ new Map(), this.wsClosed = false, this.pingIntervalMs = n?.pingIntervalMs ?? da, this.currentProfile = e.getProfile(), this.setupListeners();
33049
33051
  }
33050
33052
  setupListeners() {
33051
33053
  let e = this.ws;
@@ -33086,7 +33088,7 @@ var $t = class {
33086
33088
  for (let o of this.getAllCriteriaEmitters()) o.dispatchEvent({ ...i2 });
33087
33089
  }
33088
33090
  }), e.addEventListener("error", () => {
33089
- let t = { type: "error", payload: new p(Sn(new Error("WebSocket error"))) };
33091
+ let t = { type: "error", payload: new d(Tn(new Error("WebSocket error"))) };
33090
33092
  this.masterSubEmitter?.dispatchEvent(t);
33091
33093
  for (let n of this.getAllCriteriaEmitters()) n.dispatchEvent({ ...t });
33092
33094
  }), e.addEventListener("close", () => {
@@ -33125,8 +33127,8 @@ var $t = class {
33125
33127
  let t = e?.subscriptionId;
33126
33128
  t || (t = (await this.medplum.createResource({ ...e.subscriptionProps, resourceType: "Subscription", status: "active", reason: `WebSocket subscription for ${B(this.medplum.getProfile())}`, channel: { type: "websocket" }, criteria: e.criteria })).id);
33127
33129
  let { parameter: n } = await this.medplum.get(`fhir/R4/Subscription/${t}/$get-ws-binding-token`), i2 = n?.find((s) => s.name === "token")?.valueString, o = n?.find((s) => s.name === "websocket-url")?.valueUrl;
33128
- if (!i2) throw new p(y("Failed to get token"));
33129
- if (!o) throw new p(y("Failed to get URL from $get-ws-binding-token"));
33130
+ if (!i2) throw new d(y("Failed to get token"));
33131
+ if (!o) throw new d(y("Failed to get URL from $get-ws-binding-token"));
33130
33132
  return [t, i2];
33131
33133
  }
33132
33134
  maybeGetCriteriaEntry(e, t) {
@@ -33164,7 +33166,7 @@ var $t = class {
33164
33166
  let [t, n] = await this.getTokenForCriteria(e);
33165
33167
  e.subscriptionId = t, e.token = n, this.criteriaEntriesBySubscriptionId.set(t, e), this.ws.send(JSON.stringify({ type: "bind-with-token", payload: { token: n } }));
33166
33168
  } catch (t) {
33167
- console.error(Ae(t)), this.emitError(e, t), this.removeCriteriaEntry(e);
33169
+ console.error(Oe(t)), this.emitError(e, t), this.removeCriteriaEntry(e);
33168
33170
  }
33169
33171
  }
33170
33172
  }
@@ -33200,27 +33202,27 @@ var $t = class {
33200
33202
  return this.getAllCriteriaEmitters().length;
33201
33203
  }
33202
33204
  getMasterEmitter() {
33203
- return this.masterSubEmitter || (this.masterSubEmitter = new Xe(...Array.from(this.criteriaEntries.keys()))), this.masterSubEmitter;
33205
+ return this.masterSubEmitter || (this.masterSubEmitter = new Ye(...Array.from(this.criteriaEntries.keys()))), this.masterSubEmitter;
33204
33206
  }
33205
33207
  };
33206
- var Zr = "4.1.9-916e31cb9";
33207
- var ha = w.FHIR_JSON + ", */*; q=0.1";
33208
- var ma = "https://api.medplum.com/";
33209
- var ya = 1e3;
33210
- var ga = 6e4;
33211
- var xa = 0;
33212
- var va = 3e5;
33213
- var Ta = "Binary/";
33214
- var Vi = { resourceType: "Device", id: "system", deviceName: [{ type: "model-name", name: "System" }] };
33215
- var Ne = { ClientCredentials: "client_credentials", AuthorizationCode: "authorization_code", RefreshToken: "refresh_token", JwtBearer: "urn:ietf:params:oauth:grant-type:jwt-bearer", TokenExchange: "urn:ietf:params:oauth:grant-type:token-exchange" };
33216
- var Sa = { AccessToken: "urn:ietf:params:oauth:token-type:access_token", RefreshToken: "urn:ietf:params:oauth:token-type:refresh_token", IdToken: "urn:ietf:params:oauth:token-type:id_token", Saml1Token: "urn:ietf:params:oauth:token-type:saml1", Saml2Token: "urn:ietf:params:oauth:token-type:saml2" };
33217
- var ba = { JwtBearer: "urn:ietf:params:oauth:client-assertion-type:jwt-bearer" };
33218
- var Ht = class extends J {
33208
+ var Yr = "4.1.11-e00f5c4a8";
33209
+ var ma = w.FHIR_JSON + ", */*; q=0.1";
33210
+ var ya = "https://api.medplum.com/";
33211
+ var ga = 1e3;
33212
+ var xa = 6e4;
33213
+ var va = 0;
33214
+ var Ta = 3e5;
33215
+ var Sa = "Binary/";
33216
+ var Mi = { resourceType: "Device", id: "system", deviceName: [{ type: "model-name", name: "System" }] };
33217
+ var Ue = { ClientCredentials: "client_credentials", AuthorizationCode: "authorization_code", RefreshToken: "refresh_token", JwtBearer: "urn:ietf:params:oauth:grant-type:jwt-bearer", TokenExchange: "urn:ietf:params:oauth:grant-type:token-exchange" };
33218
+ var ba = { AccessToken: "urn:ietf:params:oauth:token-type:access_token", RefreshToken: "urn:ietf:params:oauth:token-type:refresh_token", IdToken: "urn:ietf:params:oauth:token-type:id_token", Saml1Token: "urn:ietf:params:oauth:token-type:saml1", Saml2Token: "urn:ietf:params:oauth:token-type:saml2" };
33219
+ var Ea = { JwtBearer: "urn:ietf:params:oauth:client-assertion-type:jwt-bearer" };
33220
+ var Gt = class extends J {
33219
33221
  constructor(t) {
33220
33222
  super();
33221
33223
  this.initComplete = true;
33222
33224
  if (t?.baseUrl && !t.baseUrl.startsWith("http")) throw new Error("Base URL must start with http or https");
33223
- this.options = t ?? {}, this.fetch = t?.fetch ?? Ea(), this.storage = t?.storage ?? new Ye(), this.createPdfImpl = t?.createPdf, this.baseUrl = Fr(t?.baseUrl ?? ma), this.fhirBaseUrl = W(this.baseUrl, t?.fhirUrlPath ?? "fhir/R4"), this.authorizeUrl = W(this.baseUrl, t?.authorizeUrl ?? "oauth2/authorize"), this.tokenUrl = W(this.baseUrl, t?.tokenUrl ?? "oauth2/token"), this.logoutUrl = W(this.baseUrl, t?.logoutUrl ?? "oauth2/logout"), this.fhircastHubUrl = W(this.baseUrl, t?.fhircastHubUrl ?? "fhircast/STU3"), this.clientId = t?.clientId ?? "", this.clientSecret = t?.clientSecret ?? "", this.credentialsInHeader = t?.authCredentialsMethod === "header", this.defaultHeaders = t?.defaultHeaders ?? {}, this.onUnauthenticated = t?.onUnauthenticated, this.refreshGracePeriod = t?.refreshGracePeriod ?? va, this.cacheTime = t?.cacheTime ?? (typeof window > "u" ? xa : ga), this.cacheTime > 0 ? this.requestCache = new Ce(t?.resourceCacheSize ?? ya) : this.requestCache = void 0, t?.autoBatchTime ? (this.autoBatchTime = t.autoBatchTime, this.autoBatchQueue = []) : (this.autoBatchTime = 0, this.autoBatchQueue = void 0), t?.accessToken && this.setAccessToken(t.accessToken), this.storage.getInitPromise === void 0 ? (t?.accessToken || this.attemptResumeActiveLogin().catch(console.error), this.initPromise = Promise.resolve(), this.dispatchEvent({ type: "storageInitialized" })) : (this.initComplete = false, this.initPromise = this.storage.getInitPromise(), this.initPromise.then(() => {
33225
+ this.options = t ?? {}, this.fetch = t?.fetch ?? Ra(), this.storage = t?.storage ?? new Xe(), this.createPdfImpl = t?.createPdf, this.baseUrl = Fr(t?.baseUrl ?? ya), this.fhirBaseUrl = W(this.baseUrl, t?.fhirUrlPath ?? "fhir/R4"), this.authorizeUrl = W(this.baseUrl, t?.authorizeUrl ?? "oauth2/authorize"), this.tokenUrl = W(this.baseUrl, t?.tokenUrl ?? "oauth2/token"), this.logoutUrl = W(this.baseUrl, t?.logoutUrl ?? "oauth2/logout"), this.fhircastHubUrl = W(this.baseUrl, t?.fhircastHubUrl ?? "fhircast/STU3"), this.clientId = t?.clientId ?? "", this.clientSecret = t?.clientSecret ?? "", this.credentialsInHeader = t?.authCredentialsMethod === "header", this.defaultHeaders = t?.defaultHeaders ?? {}, this.onUnauthenticated = t?.onUnauthenticated, this.refreshGracePeriod = t?.refreshGracePeriod ?? Ta, this.cacheTime = t?.cacheTime ?? (typeof window > "u" ? va : xa), this.cacheTime > 0 ? this.requestCache = new Pe(t?.resourceCacheSize ?? ga) : this.requestCache = void 0, t?.autoBatchTime ? (this.autoBatchTime = t.autoBatchTime, this.autoBatchQueue = []) : (this.autoBatchTime = 0, this.autoBatchQueue = void 0), t?.accessToken && this.setAccessToken(t.accessToken), this.storage.getInitPromise === void 0 ? (t?.accessToken || this.attemptResumeActiveLogin().catch(console.error), this.initPromise = Promise.resolve(), this.dispatchEvent({ type: "storageInitialized" })) : (this.initComplete = false, this.initPromise = this.storage.getInitPromise(), this.initPromise.then(() => {
33224
33226
  t?.accessToken || this.attemptResumeActiveLogin().catch(console.error), this.initComplete = true, this.dispatchEvent({ type: "storageInitialized" });
33225
33227
  }).catch((n) => {
33226
33228
  console.error(n), this.initComplete = true, this.dispatchEvent({ type: "storageInitFailed", payload: { error: n } });
@@ -33332,7 +33334,7 @@ var Ht = class extends J {
33332
33334
  }
33333
33335
  async exchangeExternalAccessToken(t, n) {
33334
33336
  if (n = n ?? this.clientId, !n) throw new Error("MedplumClient is missing clientId");
33335
- return this.fetchTokens({ grant_type: Ne.TokenExchange, subject_token_type: Sa.AccessToken, client_id: n, subject_token: t });
33337
+ return this.fetchTokens({ grant_type: Ue.TokenExchange, subject_token_type: ba.AccessToken, client_id: n, subject_token: t });
33336
33338
  }
33337
33339
  getExternalAuthRedirectUri(t, n, i2, o, s = true) {
33338
33340
  let a2 = new URL(t);
@@ -33349,7 +33351,7 @@ var Ht = class extends J {
33349
33351
  }
33350
33352
  fhirSearchUrl(t, n) {
33351
33353
  let i2 = this.fhirUrl(t);
33352
- return n && (i2.search = si(n)), i2;
33354
+ return n && (i2.search = oi(n)), i2;
33353
33355
  }
33354
33356
  search(t, n, i2) {
33355
33357
  let o = this.fhirSearchUrl(t, n), s = "search-" + o.toString(), a2 = this.getCacheEntry(s, i2);
@@ -33368,15 +33370,17 @@ var Ht = class extends J {
33368
33370
  searchResources(t, n, i2) {
33369
33371
  let s = "searchResources-" + this.fhirSearchUrl(t, n).toString(), a2 = this.getCacheEntry(s, i2);
33370
33372
  if (a2) return a2.value;
33371
- let c = new V(this.search(t, n, i2).then(Li));
33373
+ let c = new V(this.search(t, n, i2).then(Fi));
33372
33374
  return this.setCacheEntry(s, c), c;
33373
33375
  }
33374
33376
  async *searchResourcePages(t, n, i2) {
33375
33377
  let o = this.fhirSearchUrl(t, n);
33376
33378
  for (; o; ) {
33377
- let s = new URL(o).searchParams, a2 = await this.search(t, s, i2), c = a2.link?.find((u2) => u2.relation === "next");
33379
+ let s = new URL(o).searchParams;
33380
+ s.has("_count") || s.set("_count", "1000");
33381
+ let a2 = await this.search(t, s, i2), c = a2.link?.find((u2) => u2.relation === "next");
33378
33382
  if (!a2.entry?.length && !c) break;
33379
- yield Li(a2), o = c?.url ? new URL(c.url) : void 0;
33383
+ yield Fi(a2), o = c?.url ? new URL(c.url) : void 0;
33380
33384
  }
33381
33385
  }
33382
33386
  valueSetExpand(t, n) {
@@ -33390,7 +33394,7 @@ var Ht = class extends J {
33390
33394
  getCachedReference(t) {
33391
33395
  let n = t.reference;
33392
33396
  if (!n) return;
33393
- if (n === "system") return Vi;
33397
+ if (n === "system") return Mi;
33394
33398
  let [i2, o] = n.split("/");
33395
33399
  if (!(!i2 || !o)) return this.getCached(i2, o);
33396
33400
  }
@@ -33401,12 +33405,12 @@ var Ht = class extends J {
33401
33405
  readReference(t, n) {
33402
33406
  let i2 = t.reference;
33403
33407
  if (!i2) return new V(Promise.reject(new Error("Missing reference")));
33404
- if (i2 === "system") return new V(Promise.resolve(Vi));
33408
+ if (i2 === "system") return new V(Promise.resolve(Mi));
33405
33409
  let [o, s] = i2.split("/");
33406
33410
  return !o || !s ? new V(Promise.reject(new Error("Invalid reference"))) : this.readResource(o, s, n);
33407
33411
  }
33408
33412
  requestSchema(t) {
33409
- if (Vn(t)) return Promise.resolve();
33413
+ if (Dn(t)) return Promise.resolve();
33410
33414
  let n = t + "-requestSchema", i2 = this.getCacheEntry(n, void 0);
33411
33415
  if (i2) return i2.value;
33412
33416
  let o = new V((async () => {
@@ -33457,7 +33461,7 @@ var Ht = class extends J {
33457
33461
  return this.setCacheEntry(n, o), o;
33458
33462
  }
33459
33463
  requestProfileSchema(t, n) {
33460
- if (!n?.expandProfile && _n(t)) return Promise.resolve();
33464
+ if (!n?.expandProfile && Mn(t)) return Promise.resolve();
33461
33465
  let i2 = t + "-requestSchema" + (n?.expandProfile ? "-nested" : ""), o = this.getCacheEntry(i2, void 0);
33462
33466
  if (o) return o.value;
33463
33467
  let s = new V((async () => {
@@ -33504,10 +33508,10 @@ var Ht = class extends J {
33504
33508
  return s || (s = t), this.cacheResource(s), this.invalidateUrl(this.fhirUrl(t.resourceType, t.id, "_history")), this.invalidateSearches(t.resourceType), s;
33505
33509
  }
33506
33510
  async createAttachment(t, n, i2, o, s) {
33507
- let a2 = Fi(t, n, i2, o);
33511
+ let a2 = Ni(t, n, i2, o);
33508
33512
  if (a2.contentType === w.XML) {
33509
- let d2 = a2.data, m2;
33510
- d2 instanceof Blob ? m2 = await new Promise((x, U) => {
33513
+ let p = a2.data, m2;
33514
+ p instanceof Blob ? m2 = await new Promise((x, U) => {
33511
33515
  let $ = new FileReader();
33512
33516
  $.onload = () => {
33513
33517
  if (!$.result) {
@@ -33515,25 +33519,25 @@ var Ht = class extends J {
33515
33519
  return;
33516
33520
  }
33517
33521
  x($.result);
33518
- }, $.readAsText(d2, "utf-8");
33519
- }) : ArrayBuffer.isView(d2) ? m2 = new TextDecoder().decode(d2) : m2 = d2, m2.includes("<ClinicalDocument") && m2.includes("urn:hl7-org:v3") && (a2 = { ...a2, contentType: w.CDA_XML });
33522
+ }, $.readAsText(p, "utf-8");
33523
+ }) : ArrayBuffer.isView(p) ? m2 = new TextDecoder().decode(p) : m2 = p, m2.includes("<ClinicalDocument") && m2.includes("urn:hl7-org:v3") && (a2 = { ...a2, contentType: w.CDA_XML });
33520
33524
  }
33521
33525
  let c = s ?? (typeof n == "object" ? n : {}), u2 = await this.createBinary(a2, c);
33522
33526
  return { contentType: a2.contentType, url: u2.url, title: a2.filename };
33523
33527
  }
33524
33528
  createBinary(t, n, i2, o, s) {
33525
- let a2 = Fi(t, n, i2, o), c = s ?? (typeof n == "object" ? n : {}), { data: u2, contentType: d2, filename: m2, securityContext: x, onProgress: U } = a2, $ = this.fhirUrl("Binary");
33526
- return m2 && $.searchParams.set("_filename", m2), x?.reference && this.setRequestHeader(c, "X-Security-Context", x.reference), U ? this.uploadwithProgress($, u2, d2, U, c) : this.post($, u2, d2, c);
33529
+ let a2 = Ni(t, n, i2, o), c = s ?? (typeof n == "object" ? n : {}), { data: u2, contentType: p, filename: m2, securityContext: x, onProgress: U } = a2, $ = this.fhirUrl("Binary");
33530
+ return m2 && $.searchParams.set("_filename", m2), x?.reference && this.setRequestHeader(c, "X-Security-Context", x.reference), U ? this.uploadwithProgress($, u2, p, U, c) : this.post($, u2, p, c);
33527
33531
  }
33528
33532
  uploadwithProgress(t, n, i2, o, s) {
33529
33533
  return new Promise((a2, c) => {
33530
- let u2 = new XMLHttpRequest(), d2 = () => u2.abort();
33531
- s?.signal?.addEventListener("abort", d2);
33534
+ let u2 = new XMLHttpRequest(), p = () => u2.abort();
33535
+ s?.signal?.addEventListener("abort", p);
33532
33536
  let m2 = (x) => {
33533
- s?.signal?.removeEventListener("abort", d2), x instanceof Error ? c(x) : a2(x);
33537
+ s?.signal?.removeEventListener("abort", p), x instanceof Error ? c(x) : a2(x);
33534
33538
  };
33535
33539
  if (u2.responseType = "json", u2.onabort = () => m2(new DOMException("Request aborted", "AbortError")), u2.onerror = () => m2(new Error("Request error")), o && (u2.upload.onprogress = (x) => o(x), u2.upload.onload = (x) => o(x)), u2.onload = () => {
33536
- u2.status >= 200 && u2.status < 300 ? m2(u2.response) : m2(new p(st(u2.response || u2.statusText)));
33540
+ u2.status >= 200 && u2.status < 300 ? m2(u2.response) : m2(new d(st(u2.response || u2.statusText)));
33537
33541
  }, u2.open("POST", t), u2.withCredentials = true, u2.setRequestHeader("Authorization", "Bearer " + this.accessToken), u2.setRequestHeader("Cache-Control", "no-cache, no-store, max-age=0"), u2.setRequestHeader("Content-Type", i2), this.options.extendedMode !== false && u2.setRequestHeader("X-Medplum", "extended"), s?.headers) {
33538
33542
  let x = s.headers;
33539
33543
  for (let [U, $] of Object.entries(x)) u2.setRequestHeader(U, $);
@@ -33543,7 +33547,7 @@ var Ht = class extends J {
33543
33547
  }
33544
33548
  async createPdf(t, n, i2, o) {
33545
33549
  if (!this.createPdfImpl) throw new Error("PDF creation not enabled");
33546
- let s = Pa(t, n, i2, o), a2 = typeof n == "object" ? n : {}, { docDefinition: c, tableLayouts: u2, fonts: d2, ...m2 } = s, x = await this.createPdfImpl(c, u2, d2), U = { ...m2, data: x, contentType: "application/pdf" };
33550
+ let s = wa(t, n, i2, o), a2 = typeof n == "object" ? n : {}, { docDefinition: c, tableLayouts: u2, fonts: p, ...m2 } = s, x = await this.createPdfImpl(c, u2, p), U = { ...m2, data: x, contentType: "application/pdf" };
33547
33551
  return this.createBinary(U, a2);
33548
33552
  }
33549
33553
  createComment(t, n, i2) {
@@ -33605,7 +33609,7 @@ var Ht = class extends J {
33605
33609
  return this.accessTokenExpires !== void 0 && Date.now() < this.accessTokenExpires - (t ?? this.refreshGracePeriod);
33606
33610
  }
33607
33611
  setAccessToken(t, n) {
33608
- this.accessToken = t, this.refreshToken = n, this.accessTokenExpires = Ai(t), this.medplumServer = wi(t);
33612
+ this.accessToken = t, this.refreshToken = n, this.accessTokenExpires = Oi(t), this.medplumServer = Ai(t);
33609
33613
  }
33610
33614
  getLogins() {
33611
33615
  return this.storage.getObject("logins") ?? [];
@@ -33653,7 +33657,7 @@ var Ht = class extends J {
33653
33657
  async download(t, n = {}) {
33654
33658
  this.refreshPromise && await this.refreshPromise;
33655
33659
  let i2 = t.toString();
33656
- i2.startsWith(Ta) && (t = this.fhirUrl(i2));
33660
+ i2.startsWith(Sa) && (t = this.fhirUrl(i2));
33657
33661
  let o = n.headers;
33658
33662
  return o || (o = {}, n.headers = o), o.Accept || (o.Accept = "*/*"), this.addFetchOptionsDefaults(n), (await this.fetchWithRetry(t.toString(), n)).blob();
33659
33663
  }
@@ -33711,17 +33715,17 @@ var Ht = class extends J {
33711
33715
  if (s.status === 401) return this.handleUnauthenticated(t, n, i2);
33712
33716
  if (s.status === 204 || s.status === 304) return;
33713
33717
  let c = s.headers.get("content-type")?.includes("json");
33714
- if (s.status === 404 && !c) throw new p(vn);
33718
+ if (s.status === 404 && !c) throw new d(xn);
33715
33719
  let u2 = await this.parseBody(s, c);
33716
33720
  if (s.status === 200 && i2.followRedirectOnOk || s.status === 201 && i2.followRedirectOnCreated) {
33717
- let d2 = await _i(s, u2);
33718
- if (d2) return this.request("GET", d2, { ...i2, body: void 0 });
33721
+ let p = await Li(s, u2);
33722
+ if (p) return this.request("GET", p, { ...i2, body: void 0 });
33719
33723
  }
33720
33724
  if (s.status === 202 && i2.pollStatusOnAccepted) {
33721
- let m2 = await _i(s, u2) ?? o.statusUrl;
33725
+ let m2 = await Li(s, u2) ?? o.statusUrl;
33722
33726
  if (m2) return this.pollStatus(m2, i2, o);
33723
33727
  }
33724
- if (s.status >= 400) throw new p(st(u2));
33728
+ if (s.status >= 400) throw new d(st(u2));
33725
33729
  return u2;
33726
33730
  }
33727
33731
  async parseBody(t, n) {
@@ -33742,7 +33746,7 @@ var Ht = class extends J {
33742
33746
  for (let o = 0; o <= i2; o++) try {
33743
33747
  this.options.verbose && this.logRequest(t, n);
33744
33748
  let s = await this.fetch(t, n);
33745
- if (this.options.verbose && this.logResponse(s), this.setCurrentRateLimit(s), o >= i2 || !wa(s)) return s;
33749
+ if (this.options.verbose && this.logResponse(s), this.setCurrentRateLimit(s), o >= i2 || !Aa(s)) return s;
33746
33750
  let a2 = this.getRetryDelay(o), c = n.maxRetryTime ?? 2e3;
33747
33751
  if (a2 > c) return s;
33748
33752
  await _r(a2);
@@ -33770,7 +33774,7 @@ var Ht = class extends J {
33770
33774
  return t.split(/\s*;\s*/g).map((n) => {
33771
33775
  let i2 = n.split(/\s*,\s*/g);
33772
33776
  if (i2.length !== 3) throw new Error("Could not parse RateLimit header: " + t);
33773
- let o = i2[0].substring(1, i2[0].length - 1), s = i2.find((d2) => d2.startsWith("r=")), a2 = s ? parseInt(s.substring(2), 10) : NaN, c = i2.find((d2) => d2.startsWith("t=")), u2 = c ? parseInt(c.substring(2), 10) : NaN;
33777
+ let o = i2[0].substring(1, i2[0].length - 1), s = i2.find((p) => p.startsWith("r=")), a2 = s ? parseInt(s.substring(2), 10) : NaN, c = i2.find((p) => p.startsWith("t=")), u2 = c ? parseInt(c.substring(2), 10) : NaN;
33774
33778
  if (!o || Number.isNaN(a2) || Number.isNaN(u2)) throw new Error("Could not parse RateLimit header: " + t);
33775
33779
  return { name: o, remainingUnits: a2, secondsUntilReset: u2 };
33776
33780
  });
@@ -33797,20 +33801,20 @@ var Ht = class extends J {
33797
33801
  try {
33798
33802
  o.resolve(await this.request(o.method, W(this.fhirBaseUrl, o.url), o.options));
33799
33803
  } catch (s) {
33800
- o.reject(new p(st(s)));
33804
+ o.reject(new d(st(s)));
33801
33805
  }
33802
33806
  return;
33803
33807
  }
33804
33808
  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, n);
33805
33809
  for (let o = 0; o < t.length; o++) {
33806
33810
  let s = t[o], a2 = i2.entry?.[o];
33807
- a2?.response?.outcome && !dr(a2.response.outcome) ? s.reject(new p(a2.response.outcome)) : s.resolve(a2?.resource);
33811
+ a2?.response?.outcome && !pr(a2.response.outcome) ? s.reject(new d(a2.response.outcome)) : s.resolve(a2?.resource);
33808
33812
  }
33809
33813
  }
33810
33814
  addFetchOptionsDefaults(t) {
33811
33815
  Object.entries(this.defaultHeaders).forEach(([n, i2]) => {
33812
33816
  this.setRequestHeader(t, n, i2);
33813
- }), this.setRequestHeader(t, "Accept", ha, true), this.options.extendedMode !== false && this.setRequestHeader(t, "X-Medplum", "extended"), t.body && this.setRequestHeader(t, "Content-Type", w.FHIR_JSON, true), this.accessToken ? this.setRequestHeader(t, "Authorization", "Bearer " + this.accessToken) : this.basicAuth && this.setRequestHeader(t, "Authorization", "Basic " + this.basicAuth), t.cache || (t.cache = "no-cache"), t.credentials || (t.credentials = "include");
33817
+ }), this.setRequestHeader(t, "Accept", ma, true), this.options.extendedMode !== false && this.setRequestHeader(t, "X-Medplum", "extended"), t.body && this.setRequestHeader(t, "Content-Type", w.FHIR_JSON, true), this.accessToken ? this.setRequestHeader(t, "Authorization", "Bearer " + this.accessToken) : this.basicAuth && this.setRequestHeader(t, "Authorization", "Basic " + this.basicAuth), t.cache || (t.cache = "no-cache"), t.credentials || (t.credentials = "include");
33814
33818
  }
33815
33819
  setRequestContentType(t, n) {
33816
33820
  this.setRequestHeader(t, "Content-Type", n);
@@ -33824,22 +33828,22 @@ var Ht = class extends J {
33824
33828
  typeof n == "string" || typeof Blob < "u" && (n instanceof Blob || n?.constructor.name === "Blob") || typeof File < "u" && (n instanceof File || n?.constructor.name === "File") || typeof Uint8Array < "u" && (n instanceof Uint8Array || n?.constructor.name === "Uint8Array") ? t.body = n : n && (t.body = JSON.stringify(n));
33825
33829
  }
33826
33830
  handleUnauthenticated(t, n, i2) {
33827
- return this.refresh() ? this.request(t, n, i2) : (this.clear(), this.onUnauthenticated && this.onUnauthenticated(), Promise.reject(new p(Pe)));
33831
+ return this.refresh() ? this.request(t, n, i2) : (this.clear(), this.onUnauthenticated && this.onUnauthenticated(), Promise.reject(new d(we)));
33828
33832
  }
33829
33833
  async startPkce() {
33830
- let t = Hr();
33834
+ let t = $r();
33831
33835
  sessionStorage.setItem("pkceState", t);
33832
- let n = Hr().slice(0, 128);
33836
+ let n = $r().slice(0, 128);
33833
33837
  sessionStorage.setItem("codeVerifier", n);
33834
- let i2 = await Si(n), o = ei(i2).replaceAll("+", "-").replaceAll("/", "_").replaceAll("=", "");
33838
+ let i2 = await bi(n), o = Zn(i2).replaceAll("+", "-").replaceAll("/", "_").replaceAll("=", "");
33835
33839
  return sessionStorage.setItem("codeChallenge", o), { codeChallengeMethod: "S256", codeChallenge: o };
33836
33840
  }
33837
33841
  async requestAuthorization(t) {
33838
33842
  let n = await this.ensureCodeChallenge(t ?? {}), i2 = new URL(this.authorizeUrl);
33839
- 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 ?? Mi()), 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());
33843
+ 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 ?? _i()), 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());
33840
33844
  }
33841
33845
  processCode(t, n) {
33842
- let i2 = { grant_type: Ne.AuthorizationCode, code: t, client_id: n?.clientId ?? this.clientId ?? "", redirect_uri: n?.redirectUri ?? Mi() };
33846
+ let i2 = { grant_type: Ue.AuthorizationCode, code: t, client_id: n?.clientId ?? this.clientId ?? "", redirect_uri: n?.redirectUri ?? _i() };
33843
33847
  if (typeof sessionStorage < "u") {
33844
33848
  let o = sessionStorage.getItem("codeVerifier");
33845
33849
  o && (i2.code_verifier = o);
@@ -33851,38 +33855,38 @@ var Ht = class extends J {
33851
33855
  }
33852
33856
  refresh() {
33853
33857
  if (this.refreshPromise) return this.refreshPromise;
33854
- if (this.refreshToken) return this.refreshPromise = this.fetchTokens({ grant_type: Ne.RefreshToken, client_id: this.clientId ?? "", refresh_token: this.refreshToken }), this.refreshPromise;
33858
+ if (this.refreshToken) return this.refreshPromise = this.fetchTokens({ grant_type: Ue.RefreshToken, client_id: this.clientId ?? "", refresh_token: this.refreshToken }), this.refreshPromise;
33855
33859
  if (this.clientId && this.clientSecret) return this.refreshPromise = this.startClientLogin(this.clientId, this.clientSecret), this.refreshPromise;
33856
33860
  }
33857
33861
  async startClientLogin(t, n) {
33858
- return this.clientId = t, this.clientSecret = n, this.fetchTokens({ grant_type: Ne.ClientCredentials, client_id: t, client_secret: n });
33862
+ return this.clientId = t, this.clientSecret = n, this.fetchTokens({ grant_type: Ue.ClientCredentials, client_id: t, client_secret: n });
33859
33863
  }
33860
33864
  async startJwtBearerLogin(t, n, i2) {
33861
- return this.clientId = t, this.fetchTokens({ grant_type: Ne.JwtBearer, client_id: t, assertion: n, scope: i2 });
33865
+ return this.clientId = t, this.fetchTokens({ grant_type: Ue.JwtBearer, client_id: t, assertion: n, scope: i2 });
33862
33866
  }
33863
33867
  async startJwtAssertionLogin(t) {
33864
- return this.fetchTokens({ grant_type: Ne.ClientCredentials, client_assertion_type: ba.JwtBearer, client_assertion: t });
33868
+ return this.fetchTokens({ grant_type: Ue.ClientCredentials, client_assertion_type: Ea.JwtBearer, client_assertion: t });
33865
33869
  }
33866
33870
  setBasicAuth(t, n) {
33867
33871
  this.clientId = t, this.clientSecret = n, this.basicAuth = Ft(t + ":" + n);
33868
33872
  }
33869
33873
  async fhircastSubscribe(t, n) {
33870
- if (!(typeof t == "string" && t !== "")) throw new p(y("Invalid topic provided. Topic must be a valid string."));
33871
- if (!(typeof n == "object" && Array.isArray(n) && n.length > 0)) throw new p(y("Invalid events provided. Events must be an array of event names containing at least one event."));
33872
- let i2 = { channelType: "websocket", mode: "subscribe", topic: t, events: n }, s = (await this.post(this.fhircastHubUrl, Jr(i2), w.FORM_URL_ENCODED))["hub.channel.endpoint"];
33874
+ if (!(typeof t == "string" && t !== "")) throw new d(y("Invalid topic provided. Topic must be a valid string."));
33875
+ if (!(typeof n == "object" && Array.isArray(n) && n.length > 0)) throw new d(y("Invalid events provided. Events must be an array of event names containing at least one event."));
33876
+ let i2 = { channelType: "websocket", mode: "subscribe", topic: t, events: n }, s = (await this.post(this.fhircastHubUrl, zr(i2), w.FORM_URL_ENCODED))["hub.channel.endpoint"];
33873
33877
  if (!s) throw new Error("Invalid response!");
33874
33878
  return i2.endpoint = s, i2;
33875
33879
  }
33876
33880
  async fhircastUnsubscribe(t) {
33877
- if (!Ut(t)) throw new p(y("Invalid topic or subscriptionRequest. SubscriptionRequest must be an object."));
33878
- if (!(t.endpoint && typeof t.endpoint == "string" && t.endpoint.startsWith("ws"))) throw new p(y("Provided subscription request must have an endpoint in order to unsubscribe."));
33879
- t.mode = "unsubscribe", await this.post(this.fhircastHubUrl, Jr(t), w.FORM_URL_ENCODED);
33881
+ if (!Ut(t)) throw new d(y("Invalid topic or subscriptionRequest. SubscriptionRequest must be an object."));
33882
+ if (!(t.endpoint && typeof t.endpoint == "string" && t.endpoint.startsWith("ws"))) throw new d(y("Provided subscription request must have an endpoint in order to unsubscribe."));
33883
+ t.mode = "unsubscribe", await this.post(this.fhircastHubUrl, zr(t), w.FORM_URL_ENCODED);
33880
33884
  }
33881
33885
  fhircastConnect(t) {
33882
33886
  return new Nt(t);
33883
33887
  }
33884
33888
  async fhircastPublish(t, n, i2, o) {
33885
- return Ei(n) ? this.post(this.fhircastHubUrl, Kr(t, n, i2, o), w.JSON) : (Ri(n), this.post(this.fhircastHubUrl, Kr(t, n, i2), w.JSON));
33889
+ return Ri(n) ? this.post(this.fhircastHubUrl, Jr(t, n, i2, o), w.JSON) : (Ci(n), this.post(this.fhircastHubUrl, Jr(t, n, i2), w.JSON));
33886
33890
  }
33887
33891
  async fhircastGetContext(t) {
33888
33892
  return this.get(`${this.fhircastHubUrl}/${t}`, { cache: "no-cache" });
@@ -33903,9 +33907,9 @@ var Ht = class extends J {
33903
33907
  this.clearActiveLogin();
33904
33908
  try {
33905
33909
  let c = await s.json();
33906
- throw new p(b(c.error_description));
33910
+ throw new d(b(c.error_description));
33907
33911
  } catch (c) {
33908
- throw new p(b("Failed to fetch tokens"), c);
33912
+ throw new d(b("Failed to fetch tokens"), c);
33909
33913
  }
33910
33914
  }
33911
33915
  let a2 = await s.json();
@@ -33913,12 +33917,12 @@ var Ht = class extends J {
33913
33917
  }
33914
33918
  async verifyTokens(t) {
33915
33919
  let n = t.access_token;
33916
- if (Pi(n)) {
33920
+ if (wi(n)) {
33917
33921
  let i2 = Bt(n);
33918
- if (Date.now() >= i2.exp * 1e3) throw this.clearActiveLogin(), new p(Tn);
33922
+ if (Date.now() >= i2.exp * 1e3) throw this.clearActiveLogin(), new d(vn);
33919
33923
  if (i2.cid) {
33920
- if (i2.cid !== this.clientId) throw this.clearActiveLogin(), new p(lr);
33921
- } else if (this.clientId && i2.client_id !== this.clientId) throw this.clearActiveLogin(), new p(lr);
33924
+ if (i2.cid !== this.clientId) throw this.clearActiveLogin(), new d(lr);
33925
+ } else if (this.clientId && i2.client_id !== this.clientId) throw this.clearActiveLogin(), new d(lr);
33922
33926
  }
33923
33927
  return this.setActiveLogin({ accessToken: n, refreshToken: t.refresh_token, project: t.project, profile: t.profile });
33924
33928
  }
@@ -33938,7 +33942,7 @@ var Ht = class extends J {
33938
33942
  }
33939
33943
  }
33940
33944
  getSubscriptionManager() {
33941
- return this.subscriptionManager || (this.subscriptionManager = new $t(this, oi(this.baseUrl, "/ws/subscriptions-r4"))), this.subscriptionManager;
33945
+ return this.subscriptionManager || (this.subscriptionManager = new $t(this, ii(this.baseUrl, "/ws/subscriptions-r4"))), this.subscriptionManager;
33942
33946
  }
33943
33947
  subscribeToCriteria(t, n) {
33944
33948
  return this.getSubscriptionManager().addCriteria(t, n);
@@ -33950,47 +33954,47 @@ var Ht = class extends J {
33950
33954
  return this.getSubscriptionManager().getMasterEmitter();
33951
33955
  }
33952
33956
  };
33953
- function Ea() {
33957
+ function Ra() {
33954
33958
  if (!globalThis.fetch) throw new Error("Fetch not available in this environment");
33955
33959
  return globalThis.fetch.bind(globalThis);
33956
33960
  }
33957
- function Mi() {
33961
+ function _i() {
33958
33962
  return typeof window > "u" ? "" : window.location.protocol + "//" + window.location.host + "/";
33959
33963
  }
33960
- async function _i(r6, e) {
33964
+ async function Li(r6, e) {
33961
33965
  let t = r6.headers.get("content-location");
33962
33966
  if (t) return t;
33963
33967
  let n = r6.headers.get("location");
33964
33968
  if (n) return n;
33965
- if (we(e) && e.issue?.[0]?.diagnostics) return e.issue[0].diagnostics;
33969
+ if (Ae(e) && e.issue?.[0]?.diagnostics) return e.issue[0].diagnostics;
33966
33970
  }
33967
- function Li(r6) {
33971
+ function Fi(r6) {
33968
33972
  let e = r6.entry?.map((t) => t.resource) ?? [];
33969
33973
  return Object.assign(e, { bundle: r6 });
33970
33974
  }
33971
- function Ra(r6) {
33975
+ function Ca(r6) {
33972
33976
  return E(r6) && "data" in r6 && "contentType" in r6;
33973
33977
  }
33974
- function Fi(r6, e, t, n) {
33975
- return Ra(r6) ? r6 : { data: r6, filename: e, contentType: t, onProgress: n };
33978
+ function Ni(r6, e, t, n) {
33979
+ return Ca(r6) ? r6 : { data: r6, filename: e, contentType: t, onProgress: n };
33976
33980
  }
33977
- function Ca(r6) {
33981
+ function Pa(r6) {
33978
33982
  return E(r6) && "docDefinition" in r6;
33979
33983
  }
33980
- function Pa(r6, e, t, n) {
33981
- return Ca(r6) ? r6 : { docDefinition: r6, filename: e, tableLayouts: t, fonts: n };
33984
+ function wa(r6, e, t, n) {
33985
+ return Pa(r6) ? r6 : { docDefinition: r6, filename: e, tableLayouts: t, fonts: n };
33982
33986
  }
33983
- function wa(r6) {
33987
+ function Aa(r6) {
33984
33988
  return r6.status === 429 || r6.status >= 500;
33985
33989
  }
33986
- var Ba = [...Qe, "->", "<<", ">>", "=="];
33987
- var ja = ze().registerInfix("->", { precedence: g.Arrow }).registerInfix(";", { precedence: g.Semicolon });
33988
- var ac = " ".repeat(2);
33989
- var uc = [...Qe, "eq", "ne", "co"];
33990
- var lc = { eq: f.EXACT, ne: f.NOT_EQUALS, co: f.CONTAINS, sw: f.STARTS_WITH, ew: void 0, gt: f.GREATER_THAN, lt: f.LESS_THAN, ge: f.GREATER_THAN_OR_EQUALS, le: f.LESS_THAN_OR_EQUALS, ap: f.APPROXIMATELY, sa: f.STARTS_AFTER, eb: f.ENDS_BEFORE, pr: f.PRESENT, po: void 0, ss: void 0, sb: void 0, in: f.IN, ni: f.NOT_IN, re: f.EQUALS, identifier: f.IDENTIFIER };
33991
- var pc = ze();
33992
- var fc = { AA: "OK", AE: "Application Error", AR: "Application Reject", CA: "Commit Accept", CE: "Commit Error", CR: "Commit Reject" };
33993
- var de = class {
33990
+ var Wa = [...ze, "->", "<<", ">>", "=="];
33991
+ var $a = Je().registerInfix("->", { precedence: g.Arrow }).registerInfix(";", { precedence: g.Semicolon });
33992
+ var cc = " ".repeat(2);
33993
+ var lc = [...ze, "eq", "ne", "co"];
33994
+ var pc = { eq: f.EXACT, ne: f.NOT_EQUALS, co: f.CONTAINS, sw: f.STARTS_WITH, ew: void 0, gt: f.GREATER_THAN, lt: f.LESS_THAN, ge: f.GREATER_THAN_OR_EQUALS, le: f.LESS_THAN_OR_EQUALS, ap: f.APPROXIMATELY, sa: f.STARTS_AFTER, eb: f.ENDS_BEFORE, pr: f.PRESENT, po: void 0, ss: void 0, sb: void 0, in: f.IN, ni: f.NOT_IN, re: f.EQUALS, identifier: f.IDENTIFIER };
33995
+ var fc = Je();
33996
+ var hc = { AA: "OK", AE: "Application Error", AR: "Application Reject", CA: "Commit Accept", CE: "Commit Error", CR: "Commit Reject" };
33997
+ var pe = class {
33994
33998
  constructor(e = "\r", t = "|", n = "^", i2 = "~", o = "\\", s = "&") {
33995
33999
  this.segmentSeparator = e, this.fieldSeparator = t, this.componentSeparator = n, this.repetitionSeparator = i2, this.escapeCharacter = o, this.subcomponentSeparator = s;
33996
34000
  }
@@ -34001,8 +34005,8 @@ var de = class {
34001
34005
  return this.componentSeparator + this.repetitionSeparator + this.escapeCharacter + this.subcomponentSeparator;
34002
34006
  }
34003
34007
  };
34004
- var no = class r2 {
34005
- constructor(e, t = new de()) {
34008
+ var io = class r2 {
34009
+ constructor(e, t = new pe()) {
34006
34010
  this.context = t, this.segments = e;
34007
34011
  }
34008
34012
  get header() {
@@ -34024,8 +34028,8 @@ var no = class r2 {
34024
34028
  return this.segments.map((e) => e.toString()).join(this.context.segmentSeparator);
34025
34029
  }
34026
34030
  buildAck(e) {
34027
- let t = /* @__PURE__ */ new Date(), n = this.getSegment("MSH"), i2 = n?.getField(3)?.toString() ?? "", o = n?.getField(4)?.toString() ?? "", s = n?.getField(5)?.toString() ?? "", a2 = n?.getField(6)?.toString() ?? "", c = n?.getField(10)?.toString() ?? "", u2 = n?.getField(12)?.toString() ?? "2.5.1", d2 = e?.ackCode ?? "AA";
34028
- return new r2([new tt(["MSH", this.context.getMsh2(), s, a2, i2, o, mc(t), "", this.buildAckMessageType(n), t.getTime().toString(), "P", u2], this.context), new tt(["MSA", d2, c, fc[d2]], this.context), ...e?.errSegment ? [e.errSegment] : []]);
34031
+ let t = /* @__PURE__ */ new Date(), n = this.getSegment("MSH"), i2 = n?.getField(3)?.toString() ?? "", o = n?.getField(4)?.toString() ?? "", s = n?.getField(5)?.toString() ?? "", a2 = n?.getField(6)?.toString() ?? "", c = n?.getField(10)?.toString() ?? "", u2 = n?.getField(12)?.toString() ?? "2.5.1", p = e?.ackCode ?? "AA";
34032
+ return new r2([new tt(["MSH", this.context.getMsh2(), s, a2, i2, o, yc(t), "", this.buildAckMessageType(n), t.getTime().toString(), "P", u2], this.context), new tt(["MSA", p, c, hc[p]], this.context), ...e?.errSegment ? [e.errSegment] : []]);
34029
34033
  }
34030
34034
  buildAckMessageType(e) {
34031
34035
  let t = e?.getField(9), n = t?.getComponent(2), i2 = t?.getComponent(3), o = "ACK";
@@ -34036,7 +34040,7 @@ var no = class r2 {
34036
34040
  let n = new Error("Invalid HL7 message");
34037
34041
  throw n.type = "entity.parse.failed", n;
34038
34042
  }
34039
- let t = new de("\r", e.charAt(3), e.charAt(4), e.charAt(5), e.charAt(6), e.charAt(7));
34043
+ let t = new pe("\r", e.charAt(3), e.charAt(4), e.charAt(5), e.charAt(6), e.charAt(7));
34040
34044
  return new r2(e.split(/[\r\n]+/).map((n) => tt.parse(n, t)), t);
34041
34045
  }
34042
34046
  setSegment(e, t) {
@@ -34051,8 +34055,8 @@ var no = class r2 {
34051
34055
  }
34052
34056
  };
34053
34057
  var tt = class r3 {
34054
- constructor(e, t = new de()) {
34055
- this.context = t, Yn(e) ? this.fields = e.map((n) => K.parse(n, t)) : this.fields = e, this.name = this.fields[0].components[0][0];
34058
+ constructor(e, t = new pe()) {
34059
+ this.context = t, Kn(e) ? this.fields = e.map((n) => K.parse(n, t)) : this.fields = e, this.name = this.fields[0].components[0][0];
34056
34060
  }
34057
34061
  get(e) {
34058
34062
  return this.fields[e];
@@ -34071,7 +34075,7 @@ var tt = class r3 {
34071
34075
  toString() {
34072
34076
  return this.fields.map((e) => e.toString()).join(this.context.fieldSeparator);
34073
34077
  }
34074
- static parse(e, t = new de()) {
34078
+ static parse(e, t = new pe()) {
34075
34079
  return new r3(e.split(t.fieldSeparator).map((n) => K.parse(n, t)), t);
34076
34080
  }
34077
34081
  setField(e, t) {
@@ -34092,7 +34096,7 @@ var tt = class r3 {
34092
34096
  }
34093
34097
  };
34094
34098
  var K = class r4 {
34095
- constructor(e, t = new de()) {
34099
+ constructor(e, t = new pe()) {
34096
34100
  this.context = t, this.components = e;
34097
34101
  }
34098
34102
  get(e, t, n = 0) {
@@ -34105,7 +34109,7 @@ var K = class r4 {
34105
34109
  toString() {
34106
34110
  return this.components.map((e) => e.join(this.context.componentSeparator)).join(this.context.repetitionSeparator);
34107
34111
  }
34108
- static parse(e, t = new de()) {
34112
+ static parse(e, t = new pe()) {
34109
34113
  return new r4(e.split(t.repetitionSeparator).map((n) => n.split(t.componentSeparator)), t);
34110
34114
  }
34111
34115
  setComponent(e, t, n, i2 = 0) {
@@ -34120,14 +34124,14 @@ var K = class r4 {
34120
34124
  return true;
34121
34125
  }
34122
34126
  };
34123
- function mc(r6) {
34127
+ function yc(r6) {
34124
34128
  let e = r6 instanceof Date ? r6 : new Date(r6), n = e.toISOString().replace(/[-:T]/g, "").replace(/(\.\d+)?Z$/, ""), i2 = e.getUTCMilliseconds();
34125
34129
  return i2 > 0 && (n += "." + i2.toString()), n;
34126
34130
  }
34127
- var Ue = { NONE: 0, ERROR: 1, WARN: 2, INFO: 3, DEBUG: 4 };
34128
- var yc = ["NONE", "ERROR", "WARN", "INFO", "DEBUG"];
34129
- var io = class r5 {
34130
- constructor(e, t = {}, n = Ue.INFO, i2 = {}) {
34131
+ var Be = { NONE: 0, ERROR: 1, WARN: 2, INFO: 3, DEBUG: 4 };
34132
+ var gc = ["NONE", "ERROR", "WARN", "INFO", "DEBUG"];
34133
+ var oo = class r5 {
34134
+ constructor(e, t = {}, n = Be.INFO, i2 = {}) {
34131
34135
  this.write = e, this.metadata = t, this.level = n, this.options = i2, i2?.prefix && (this.prefix = i2.prefix), this.error = this.error.bind(this), this.warn = this.warn.bind(this), this.info = this.info.bind(this), this.debug = this.debug.bind(this), this.log = this.log.bind(this);
34132
34136
  }
34133
34137
  clone(e) {
@@ -34139,30 +34143,30 @@ var io = class r5 {
34139
34143
  return { write: e, metadata: t, level: n, options: i2 };
34140
34144
  }
34141
34145
  error(e, t) {
34142
- this.log(Ue.ERROR, e, t);
34146
+ this.log(Be.ERROR, e, t);
34143
34147
  }
34144
34148
  warn(e, t) {
34145
- this.log(Ue.WARN, e, t);
34149
+ this.log(Be.WARN, e, t);
34146
34150
  }
34147
34151
  info(e, t) {
34148
- this.log(Ue.INFO, e, t);
34152
+ this.log(Be.INFO, e, t);
34149
34153
  }
34150
34154
  debug(e, t) {
34151
- this.log(Ue.DEBUG, e, t);
34155
+ this.log(Be.DEBUG, e, t);
34152
34156
  }
34153
34157
  log(e, t, n) {
34154
34158
  e > this.level || (n instanceof Error && (n = { error: n.toString(), stack: n.stack?.split(`
34155
- `) }), this.write(JSON.stringify({ level: yc[e], timestamp: (/* @__PURE__ */ new Date()).toISOString(), msg: this.prefix ? `${this.prefix}${t}` : t, ...n, ...this.metadata })));
34159
+ `) }), this.write(JSON.stringify({ level: gc[e], timestamp: (/* @__PURE__ */ new Date()).toISOString(), msg: this.prefix ? `${this.prefix}${t}` : t, ...n, ...this.metadata })));
34156
34160
  }
34157
34161
  };
34158
- function qh(r6) {
34159
- let e = Ue[r6.toUpperCase()];
34162
+ function $h(r6) {
34163
+ let e = Be[r6.toUpperCase()];
34160
34164
  if (e === void 0) throw new Error(`Invalid log level: ${r6}`);
34161
34165
  return e;
34162
34166
  }
34163
- var Ec = "https://meta.medplum.com/releases";
34167
+ var Rc = "https://meta.medplum.com/releases";
34164
34168
  var tr = /* @__PURE__ */ new Map();
34165
- function Rc(r6) {
34169
+ function Cc(r6) {
34166
34170
  let e = r6;
34167
34171
  if (!e.tag_name) throw new Error("Manifest missing tag_name");
34168
34172
  let t = e.assets;
@@ -34172,40 +34176,40 @@ function Rc(r6) {
34172
34176
  if (!n.name) throw new Error("Asset missing name");
34173
34177
  }
34174
34178
  }
34175
- async function dn(r6, e, t) {
34179
+ async function ln(r6, e, t) {
34176
34180
  let n = tr.get(e ?? "latest");
34177
34181
  if (!n) {
34178
- let i2 = e ? `v${e}` : "latest", o = new URL(`${Ec}/${i2}.json`);
34179
- if (o.searchParams.set("a", r6), o.searchParams.set("c", Zr), t) for (let [c, u2] of Object.entries(t)) o.searchParams.set(c, u2);
34182
+ let i2 = e ? `v${e}` : "latest", o = new URL(`${Rc}/${i2}.json`);
34183
+ if (o.searchParams.set("a", r6), o.searchParams.set("c", Yr), t) for (let [c, u2] of Object.entries(t)) o.searchParams.set(c, u2);
34180
34184
  let s = await fetch(o.toString());
34181
34185
  if (s.status !== 200) {
34182
34186
  let c;
34183
34187
  try {
34184
34188
  c = (await s.json()).message;
34185
34189
  } catch (u2) {
34186
- console.error(`Failed to parse message from body: ${Ae(u2)}`);
34190
+ console.error(`Failed to parse message from body: ${Oe(u2)}`);
34187
34191
  }
34188
34192
  throw new Error(`Received status code ${s.status} while fetching manifest for version '${e ?? "latest"}'. Message: ${c}`);
34189
34193
  }
34190
34194
  let a2 = await s.json();
34191
- Rc(a2), n = a2, tr.set(e ?? "latest", n), e || tr.set(n.tag_name.slice(1), n);
34195
+ Cc(a2), n = a2, tr.set(e ?? "latest", n), e || tr.set(n.tag_name.slice(1), n);
34192
34196
  }
34193
34197
  return n;
34194
34198
  }
34195
- function Cc(r6) {
34199
+ function Pc(r6) {
34196
34200
  return /^\d+\.\d+\.\d+$/.test(r6);
34197
34201
  }
34198
- async function nm(r6, e) {
34199
- if (!Cc(e)) return false;
34202
+ async function om(r6, e) {
34203
+ if (!Pc(e)) return false;
34200
34204
  try {
34201
- await dn(r6, e);
34205
+ await ln(r6, e);
34202
34206
  } catch {
34203
34207
  return false;
34204
34208
  }
34205
34209
  return true;
34206
34210
  }
34207
- async function im(r6) {
34208
- let e = await dn(r6);
34211
+ async function sm(r6) {
34212
+ let e = await ln(r6);
34209
34213
  if (!e.tag_name.startsWith("v")) throw new Error(`Invalid release name found. Release tag '${e.tag_name}' did not start with 'v'`);
34210
34214
  return e.tag_name.slice(1);
34211
34215
  }
@@ -34240,7 +34244,7 @@ var l2 = class extends Event {
34240
34244
  super("close");
34241
34245
  }
34242
34246
  };
34243
- var d = class extends a {
34247
+ var d2 = class extends a {
34244
34248
  constructor(e, s = "utf-8", r6 = false) {
34245
34249
  super();
34246
34250
  this.chunks = [];
@@ -34248,7 +34252,7 @@ var d = class extends a {
34248
34252
  this.socket = e, this.encoding = s, this.enhancedMode = r6, e.on("data", (n) => {
34249
34253
  try {
34250
34254
  if (this.appendData(n), n.at(-2) === 28 && n.at(-1) === 13) {
34251
- let o = Buffer.concat(this.chunks), g2 = o.subarray(1, o.length - 2), E2 = import_iconv_lite.default.decode(g2, this.encoding), k2 = no.parse(E2);
34255
+ let o = Buffer.concat(this.chunks), g2 = o.subarray(1, o.length - 2), E2 = import_iconv_lite.default.decode(g2, this.encoding), k2 = io.parse(E2);
34252
34256
  this.dispatchEvent(new h2(this, k2)), this.resetBuffer();
34253
34257
  }
34254
34258
  } catch (o) {
@@ -34304,7 +34308,7 @@ var u = class extends a {
34304
34308
  })), this.socket.on("connect", () => {
34305
34309
  if (!this.socket) return;
34306
34310
  let s;
34307
- this.connection = s = new d(this.socket, this.encoding), this.socket.setTimeout(0), s.addEventListener("close", () => {
34311
+ this.connection = s = new d2(this.socket, this.encoding), this.socket.setTimeout(0), s.addEventListener("close", () => {
34308
34312
  this.socket = void 0, this.dispatchEvent(new l2());
34309
34313
  }), s.addEventListener("error", (r6) => {
34310
34314
  this.dispatchEvent(new i(r6.error));
@@ -34330,7 +34334,7 @@ var f2 = class {
34330
34334
  }
34331
34335
  start(t, e, s = false) {
34332
34336
  let r6 = import_node_net2.default.createServer((n) => {
34333
- let o = new d(n, e, s);
34337
+ let o = new d2(n, e, s);
34334
34338
  this.handler(o);
34335
34339
  });
34336
34340
  r6.listen(t), this.server = r6;
@@ -34523,7 +34527,7 @@ var AgentDicomChannel = class extends BaseChannel {
34523
34527
  });
34524
34528
  response2.setStatus(dimse.constants.Status.Success);
34525
34529
  } catch (err) {
34526
- DcmjsDimseScp.channel.log.error(`DICOM error: ${Ae(err)}`);
34530
+ DcmjsDimseScp.channel.log.error(`DICOM error: ${Oe(err)}`);
34527
34531
  response2.setStatus(dimse.constants.Status.ProcessingFailure);
34528
34532
  }
34529
34533
  return response2;
@@ -34599,7 +34603,7 @@ var AgentHl7Channel = class extends BaseChannel {
34599
34603
  sendToRemote(msg) {
34600
34604
  const connection = this.connections.get(msg.remote);
34601
34605
  if (connection) {
34602
- connection.hl7Connection.send(no.parse(msg.body));
34606
+ connection.hl7Connection.send(io.parse(msg.body));
34603
34607
  }
34604
34608
  }
34605
34609
  handleNewConnection(connection) {
@@ -34628,7 +34632,7 @@ var AgentHl7ChannelConnection = class {
34628
34632
  callback: `Agent/${this.channel.app.agentId}-${(0, import_node_crypto2.randomUUID)()}`
34629
34633
  });
34630
34634
  } catch (err) {
34631
- this.channel.log.error(`HL7 error: ${Ae(err)}`);
34635
+ this.channel.log.error(`HL7 error: ${Oe(err)}`);
34632
34636
  }
34633
34637
  }
34634
34638
  close() {
@@ -34648,7 +34652,7 @@ var UPGRADER_LOG_PATH = (0, import_node_path2.resolve)(
34648
34652
  );
34649
34653
  var RELEASES_PATH = (0, import_node_path2.resolve)(__dirname);
34650
34654
  async function downloadRelease(version, path3) {
34651
- const release = await dn("agent-upgrader", version);
34655
+ const release = await ln("agent-upgrader", version);
34652
34656
  const downloadUrl = parseDownloadUrl(release, (0, import_node_os2.platform)());
34653
34657
  const { body } = await fetch(downloadUrl);
34654
34658
  if (!body) {
@@ -34660,9 +34664,9 @@ async function downloadRelease(version, path3) {
34660
34664
  writeStream.once("close", resolve2);
34661
34665
  });
34662
34666
  }
34663
- function parseDownloadUrl(release, os2) {
34667
+ function parseDownloadUrl(release, os) {
34664
34668
  let endingToMatch;
34665
- switch (os2) {
34669
+ switch (os) {
34666
34670
  case "win32":
34667
34671
  endingToMatch = ".exe";
34668
34672
  break;
@@ -34670,14 +34674,14 @@ function parseDownloadUrl(release, os2) {
34670
34674
  endingToMatch = "linux";
34671
34675
  break;
34672
34676
  default:
34673
- throw new Error(`Unsupported platform: ${os2}`);
34677
+ throw new Error(`Unsupported platform: ${os}`);
34674
34678
  }
34675
34679
  for (const asset of release.assets) {
34676
34680
  if (asset.name.endsWith(endingToMatch)) {
34677
34681
  return asset.browser_download_url;
34678
34682
  }
34679
34683
  }
34680
- throw new Error(`No download URL found for release '${release.tag_name}' for ${os2}`);
34684
+ throw new Error(`No download URL found for release '${release.tag_name}' for ${os}`);
34681
34685
  }
34682
34686
  function getReleaseBinPath(version) {
34683
34687
  let binaryName;
@@ -34722,7 +34726,7 @@ var App = class _App {
34722
34726
  this.medplum = medplum;
34723
34727
  this.agentId = agentId;
34724
34728
  this.logLevel = logLevel;
34725
- this.log = new io((msg) => console.log(msg), void 0, logLevel);
34729
+ this.log = new oo((msg) => console.log(msg), void 0, logLevel);
34726
34730
  }
34727
34731
  async start() {
34728
34732
  this.log.info("Medplum service starting...");
@@ -34742,7 +34746,7 @@ var App = class _App {
34742
34746
  if ((0, import_node_fs3.existsSync)(UPGRADE_MANIFEST_PATH)) {
34743
34747
  const upgradeFile = (0, import_node_fs3.readFileSync)(UPGRADE_MANIFEST_PATH, { encoding: "utf-8" });
34744
34748
  const upgradeDetails = JSON.parse(upgradeFile);
34745
- if (upgradeDetails.targetVersion === Zr.split("-")[0]) {
34749
+ if (upgradeDetails.targetVersion === Yr.split("-")[0]) {
34746
34750
  await this.sendToWebSocket({
34747
34751
  type: "agent:upgrade:response",
34748
34752
  statusCode: 200,
@@ -34750,7 +34754,7 @@ var App = class _App {
34750
34754
  });
34751
34755
  this.log.info(`Successfully upgraded to version ${upgradeDetails.targetVersion}`);
34752
34756
  } else {
34753
- const errMsg = `Failed to upgrade to version ${upgradeDetails.targetVersion}. Agent still running with version ${Zr}`;
34757
+ const errMsg = `Failed to upgrade to version ${upgradeDetails.targetVersion}. Agent still running with version ${Yr}`;
34754
34758
  await this.sendToWebSocket({
34755
34759
  type: "agent:error",
34756
34760
  body: errMsg,
@@ -34825,7 +34829,7 @@ var App = class _App {
34825
34829
  break;
34826
34830
  case "agent:heartbeat:request":
34827
34831
  this.outstandingHeartbeats = 0;
34828
- await this.sendToWebSocket({ type: "agent:heartbeat:response", version: Zr });
34832
+ await this.sendToWebSocket({ type: "agent:heartbeat:response", version: Yr });
34829
34833
  break;
34830
34834
  case "agent:heartbeat:response":
34831
34835
  this.outstandingHeartbeats = 0;
@@ -34868,7 +34872,7 @@ var App = class _App {
34868
34872
  } catch (err) {
34869
34873
  await this.sendToWebSocket({
34870
34874
  type: "agent:error",
34871
- body: Ae(err),
34875
+ body: Oe(err),
34872
34876
  callback: command.callback
34873
34877
  });
34874
34878
  }
@@ -34883,7 +34887,7 @@ var App = class _App {
34883
34887
  this.log.error(`Unknown message type: ${command.type}`);
34884
34888
  }
34885
34889
  } catch (err) {
34886
- this.log.error(`WebSocket error on incoming message: ${Ae(err)}`);
34890
+ this.log.error(`WebSocket error on incoming message: ${Oe(err)}`);
34887
34891
  }
34888
34892
  });
34889
34893
  return new Promise((resolve2) => {
@@ -34955,7 +34959,7 @@ var App = class _App {
34955
34959
  try {
34956
34960
  await this.startOrReloadChannel(definition, endpoint);
34957
34961
  } catch (err) {
34958
- this.log.error(Ae(err));
34962
+ this.log.error(Oe(err));
34959
34963
  }
34960
34964
  }
34961
34965
  }
@@ -34981,7 +34985,7 @@ var App = class _App {
34981
34985
  parsedEndpoint = new URL(endpoint.address);
34982
34986
  } catch (err) {
34983
34987
  throw new Error(
34984
- `Error while validating endpoint address for channel '${channel.name}': ${Ae(err)}`
34988
+ `Error while validating endpoint address for channel '${channel.name}': ${Oe(err)}`
34985
34989
  );
34986
34990
  }
34987
34991
  if (seenPorts.has(parsedEndpoint.port)) {
@@ -35060,7 +35064,7 @@ var App = class _App {
35060
35064
  try {
35061
35065
  await this.sendToWebSocket(msg);
35062
35066
  } catch (err) {
35063
- this.log.error(`WebSocket error while attempting to send message: ${Ae(err)}`);
35067
+ this.log.error(`WebSocket error while attempting to send message: ${Oe(err)}`);
35064
35068
  this.webSocketQueue.unshift(msg);
35065
35069
  throw err;
35066
35070
  }
@@ -35097,7 +35101,7 @@ IPv6 is currently unsupported.`;
35097
35101
  this.log.error(errMsg);
35098
35102
  throw new Error(errMsg);
35099
35103
  }
35100
- if (!((0, import_node_net3.isIPv4)(message.remote) || El(message.remote))) {
35104
+ if (!((0, import_node_net3.isIPv4)(message.remote) || Rl(message.remote))) {
35101
35105
  const errMsg = `Attempted to ping an invalid host.
35102
35106
 
35103
35107
  "${message.remote}" is not a valid IPv4 address or a resolvable hostname.`;
@@ -35136,7 +35140,7 @@ ${result}`);
35136
35140
  body: result
35137
35141
  });
35138
35142
  } catch (err) {
35139
- this.log.error(`Error during ping attempt to ${message.remote ?? "NO_HOST_GIVEN"}: ${Ae(err)}`);
35143
+ this.log.error(`Error during ping attempt to ${message.remote ?? "NO_HOST_GIVEN"}: ${Oe(err)}`);
35140
35144
  this.addToWebSocketQueue({
35141
35145
  type: "agent:transmit:response",
35142
35146
  channel: message.channel,
@@ -35144,7 +35148,7 @@ ${result}`);
35144
35148
  remote: message.remote,
35145
35149
  callback: message.callback,
35146
35150
  statusCode: 400,
35147
- body: Ae(err)
35151
+ body: Oe(err)
35148
35152
  });
35149
35153
  }
35150
35154
  }
@@ -35160,7 +35164,7 @@ ${result}`);
35160
35164
  return;
35161
35165
  }
35162
35166
  let child;
35163
- if (message.version && !await nm("agent-upgrader", message.version)) {
35167
+ if (message.version && !await om("agent-upgrader", message.version)) {
35164
35168
  const versionTag = message.version ? `v${message.version}` : "latest";
35165
35169
  const errMsg = `Error during upgrading to version '${versionTag}'. '${message.version}' is not a valid version`;
35166
35170
  this.log.error(errMsg);
@@ -35171,8 +35175,8 @@ ${result}`);
35171
35175
  });
35172
35176
  return;
35173
35177
  }
35174
- const targetVersion = message.version ?? await im("agent-upgrader");
35175
- if (Zr.startsWith(targetVersion)) {
35178
+ const targetVersion = message.version ?? await sm("agent-upgrader");
35179
+ if (Yr.startsWith(targetVersion)) {
35176
35180
  if (!message?.force) {
35177
35181
  this.log.info(`Attempted to upgrade to version ${targetVersion}, but agent is already on that version`);
35178
35182
  await this.sendToWebSocket({
@@ -35182,7 +35186,7 @@ ${result}`);
35182
35186
  });
35183
35187
  return;
35184
35188
  }
35185
- this.log.info(`Forcing upgrade from ${Zr} to ${targetVersion}`);
35189
+ this.log.info(`Forcing upgrade from ${Yr} to ${targetVersion}`);
35186
35190
  }
35187
35191
  try {
35188
35192
  const command = __filename;
@@ -35204,11 +35208,11 @@ ${result}`);
35204
35208
  });
35205
35209
  });
35206
35210
  child.on("error", (err) => {
35207
- this.log.error(Ae(err));
35211
+ this.log.error(Oe(err));
35208
35212
  });
35209
35213
  } catch (err) {
35210
35214
  const versionTag = message.version ? `v${message.version}` : "latest";
35211
- const errMsg = `Error during upgrading to version '${versionTag}': ${Ae(err)}`;
35215
+ const errMsg = `Error during upgrading to version '${versionTag}': ${Oe(err)}`;
35212
35216
  this.log.error(errMsg);
35213
35217
  await this.sendToWebSocket({
35214
35218
  type: "agent:error",
@@ -35220,11 +35224,11 @@ ${result}`);
35220
35224
  try {
35221
35225
  await this.stop();
35222
35226
  this.log.info("Successfully stopped agent network services");
35223
- this.log.info("Writing upgrade manifest...", { previousVersion: Zr, targetVersion });
35227
+ this.log.info("Writing upgrade manifest...", { previousVersion: Yr, targetVersion });
35224
35228
  (0, import_node_fs3.writeFileSync)(
35225
35229
  UPGRADE_MANIFEST_PATH,
35226
35230
  JSON.stringify({
35227
- previousVersion: Zr,
35231
+ previousVersion: Yr,
35228
35232
  targetVersion,
35229
35233
  callback: message.callback ?? null
35230
35234
  }),
@@ -35234,7 +35238,7 @@ ${result}`);
35234
35238
  child.disconnect();
35235
35239
  } catch (err) {
35236
35240
  this.log.error(
35237
- `Error while stopping agent or messaging child process as part of upgrade: ${Ae(err)}`
35241
+ `Error while stopping agent or messaging child process as part of upgrade: ${Oe(err)}`
35238
35242
  );
35239
35243
  import_node_process.default.exit(1);
35240
35244
  }
@@ -35292,7 +35296,7 @@ ${result}`);
35292
35296
  });
35293
35297
  }
35294
35298
  }
35295
- client.sendAndWait(no.parse(message.body)).then((response2) => {
35299
+ client.sendAndWait(io.parse(message.body)).then((response2) => {
35296
35300
  this.log.info(`Response: ${response2.toString().replaceAll("\r", "\n")}`);
35297
35301
  this.addToWebSocketQueue({
35298
35302
  type: "agent:transmit:response",
@@ -35304,7 +35308,7 @@ ${result}`);
35304
35308
  body: response2.toString()
35305
35309
  });
35306
35310
  }).catch((err) => {
35307
- this.log.error(`HL7 error: ${Ae(err)}`);
35311
+ this.log.error(`HL7 error: ${Oe(err)}`);
35308
35312
  this.addToWebSocketQueue({
35309
35313
  type: "agent:transmit:response",
35310
35314
  channel: message.channel,
@@ -35312,7 +35316,7 @@ ${result}`);
35312
35316
  callback: message.callback,
35313
35317
  contentType: w.TEXT,
35314
35318
  statusCode: 400,
35315
- body: Ae(err)
35319
+ body: Oe(err)
35316
35320
  });
35317
35321
  if (client.keepAlive) {
35318
35322
  this.hl7Clients.delete(message.remote);
@@ -35359,19 +35363,19 @@ async function agentMain(argv) {
35359
35363
  process.exit(1);
35360
35364
  }
35361
35365
  const { baseUrl, clientId, clientSecret, agentId } = args;
35362
- const medplum = new Ht({ baseUrl, clientId });
35366
+ const medplum = new Gt({ baseUrl, clientId });
35363
35367
  let loggedIn = false;
35364
35368
  while (!loggedIn) {
35365
35369
  try {
35366
35370
  await medplum.startClientLogin(clientId, clientSecret);
35367
35371
  loggedIn = true;
35368
35372
  } catch (err) {
35369
- console.error("Failed to login", { err: Ae(err) });
35373
+ console.error("Failed to login", { err: Oe(err) });
35370
35374
  console.log("Retrying login in 10 seconds...");
35371
35375
  await _r(RETRY_WAIT_DURATION_MS);
35372
35376
  }
35373
35377
  }
35374
- const app = new App(medplum, agentId, qh(args.logLevel ?? "INFO"));
35378
+ const app = new App(medplum, agentId, $h(args.logLevel ?? "INFO"));
35375
35379
  await app.start();
35376
35380
  process.on("SIGINT", async () => {
35377
35381
  console.log("Gracefully shutting down from SIGINT (Ctrl-C)");
@@ -35396,7 +35400,7 @@ var import_node_os4 = require("node:os");
35396
35400
  var import_node_path3 = __toESM(require("node:path"));
35397
35401
  var import_node_process2 = __toESM(require("node:process"));
35398
35402
  var EXIT_SIGNALS = ["SIGINT", "SIGTERM", "SIGHUP"];
35399
- var pidLogger = new io((msg) => `[PID]: ${msg}`);
35403
+ var pidLogger = new oo((msg) => `[PID]: ${msg}`);
35400
35404
  var pidFilePaths = /* @__PURE__ */ new Set();
35401
35405
  var processExitListener = () => {
35402
35406
  removeAllPidFiles();
@@ -35498,7 +35502,7 @@ async function upgraderMain(argv) {
35498
35502
  if ((0, import_node_os5.platform)() !== "win32") {
35499
35503
  throw new Error(`Unsupported platform: ${(0, import_node_os5.platform)()}. Agent upgrader currently only supports Windows`);
35500
35504
  }
35501
- const globalLogger = new io((msg) => console.log(msg));
35505
+ const globalLogger = new oo((msg) => console.log(msg));
35502
35506
  if (!import_node_process3.default.send) {
35503
35507
  globalLogger.error("Upgrader not started as a child process with Node IPC enabled. Aborting...");
35504
35508
  import_node_process3.default.exit(1);
@@ -35511,10 +35515,10 @@ async function upgraderMain(argv) {
35511
35515
  });
35512
35516
  });
35513
35517
  import_node_process3.default.send({ type: "STARTED" });
35514
- if (argv[3] && !Cc(argv[3])) {
35518
+ if (argv[3] && !Pc(argv[3])) {
35515
35519
  throw new Error("Invalid version specified");
35516
35520
  }
35517
- const version = argv[3] ?? await im("agent-upgrader");
35521
+ const version = argv[3] ?? await sm("agent-upgrader");
35518
35522
  const binPath = getReleaseBinPath(version);
35519
35523
  if (!(0, import_node_fs6.existsSync)(binPath)) {
35520
35524
  globalLogger.info(`Could not find binary at "${binPath}". Downloading release from GitHub...`);
@@ -35537,7 +35541,7 @@ async function upgraderMain(argv) {
35537
35541
  (0, import_node_child_process2.spawnSync)(binPath, ["/S"]);
35538
35542
  globalLogger.info(`Agent version ${version} successfully installed`);
35539
35543
  } catch (err) {
35540
- globalLogger.error(`Error while attempting to run installer: ${Ae(err)}`);
35544
+ globalLogger.error(`Error while attempting to run installer: ${Oe(err)}`);
35541
35545
  globalLogger.error("Failed to run installer, attempting to restart agent service...");
35542
35546
  try {
35543
35547
  (0, import_node_child_process2.execSync)('net start "Medplum Agent"');