@medplum/agent 4.1.12 → 4.1.14

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 +608 -608
  2. package/package.json +5 -5
@@ -5406,7 +5406,7 @@ var require_sender = __commonJS({
5406
5406
  const perMessageDeflate = this._extensions[PerMessageDeflate.extensionName];
5407
5407
  this._bufferedBytes += options[kByteLength];
5408
5408
  this._state = DEFLATING;
5409
- perMessageDeflate.compress(data2, options.fin, (_2, buf) => {
5409
+ perMessageDeflate.compress(data2, options.fin, (_, buf) => {
5410
5410
  if (this._socket.destroyed) {
5411
5411
  const err = new Error(
5412
5412
  "The socket was closed while data was being compressed"
@@ -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 p = new (t.bind.apply(t, o))();
7582
- return r6 && _setPrototypeOf(p, r6.prototype), p;
7581
+ var p2 = new (t.bind.apply(t, o))();
7582
+ return r6 && _setPrototypeOf(p2, r6.prototype), p2;
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, p) {
7717
- _setPrototypeOf = Object.setPrototypeOf ? Object.setPrototypeOf.bind() : function _setPrototypeOf2(o2, p2) {
7718
- o2.__proto__ = p2;
7716
+ function _setPrototypeOf(o, p2) {
7717
+ _setPrototypeOf = Object.setPrototypeOf ? Object.setPrototypeOf.bind() : function _setPrototypeOf2(o2, p3) {
7718
+ o2.__proto__ = p3;
7719
7719
  return o2;
7720
7720
  };
7721
- return _setPrototypeOf(o, p);
7721
+ return _setPrototypeOf(o, p2);
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 p;
8675
+ let p2;
8676
8676
  let wsize = s.w_size;
8677
8677
  n = s.hash_size;
8678
- p = n;
8678
+ p2 = n;
8679
8679
  do {
8680
- m2 = s.head[--p];
8681
- s.head[p] = m2 >= wsize ? m2 - wsize : 0;
8680
+ m2 = s.head[--p2];
8681
+ s.head[p2] = m2 >= wsize ? m2 - wsize : 0;
8682
8682
  } while (--n);
8683
8683
  n = wsize;
8684
- p = n;
8684
+ p2 = n;
8685
8685
  do {
8686
- m2 = s.prev[--p];
8687
- s.prev[p] = m2 >= wsize ? m2 - wsize : 0;
8686
+ m2 = s.prev[--p2];
8687
+ s.prev[p2] = 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 p in source) {
9767
- if (_has(source, p)) {
9768
- obj[p] = source[p];
9766
+ for (const p2 in source) {
9767
+ if (_has(source, p2)) {
9768
+ obj[p2] = source[p2];
9769
9769
  }
9770
9770
  }
9771
9771
  }
@@ -13011,7 +13011,7 @@ var require_dcmjs = __commonJS({
13011
13011
  length: inputArray.length - (size - 1)
13012
13012
  },
13013
13013
  //get the appropriate length
13014
- function(_2, index) {
13014
+ function(_, index) {
13015
13015
  return inputArray.slice(index, index + size);
13016
13016
  }
13017
13017
  //create the windows
@@ -14034,10 +14034,10 @@ var require_dcmjs = __commonJS({
14034
14034
  while (1) {
14035
14035
  var g2 = stream.readUint16();
14036
14036
  if (g2 == 65534) {
14037
- var ge2 = stream.readUint16();
14037
+ var ge = stream.readUint16();
14038
14038
  var itemLength = stream.readUint32();
14039
14039
  stream.increment(-4);
14040
- if (ge2 == 57357) {
14040
+ if (ge == 57357) {
14041
14041
  if (itemLength === 0) {
14042
14042
  stack--;
14043
14043
  if (stack < 0) {
@@ -14050,7 +14050,7 @@ var require_dcmjs = __commonJS({
14050
14050
  } else {
14051
14051
  toRead += 2;
14052
14052
  }
14053
- } else if (ge2 == 57344) {
14053
+ } else if (ge == 57344) {
14054
14054
  toRead += 4;
14055
14055
  if (itemLength == 4294967295) {
14056
14056
  stack++;
@@ -15170,8 +15170,8 @@ var require_dcmjs = __commonJS({
15170
15170
  value: function rgb2XYZ(rgb) {
15171
15171
  var R2 = Colors2.invGammaCorrection(rgb[0]);
15172
15172
  var G2 = Colors2.invGammaCorrection(rgb[1]);
15173
- var B2 = Colors2.invGammaCorrection(rgb[2]);
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];
15173
+ var B = Colors2.invGammaCorrection(rgb[2]);
15174
+ return [0.41239558896741424 * R2 + 0.3575834307637148 * G2 + 0.18049264738170157 * B, 0.21258623078559555 * R2 + 0.7151703037034108 * G2 + 0.07220049864333623 * B, 0.019297215491746945 * R2 + 0.11918386458084854 * G2 + 0.9504971251315798 * B];
15175
15175
  }
15176
15176
  }, {
15177
15177
  key: "xyz2LAB",
@@ -15667,16 +15667,16 @@ var require_dcmjs = __commonJS({
15667
15667
  };
15668
15668
  ds.PerFrameFunctionalGroupsSequence.forEach(function(functionalGroup) {
15669
15669
  if (functionalGroup.FrameVOILUT) {
15670
- var wc = functionalGroup.FrameVOILUTSequence.WindowCenter;
15670
+ var wc2 = functionalGroup.FrameVOILUTSequence.WindowCenter;
15671
15671
  var ww = functionalGroup.FrameVOILUTSequence.WindowWidth;
15672
- if (functionalGroup.FrameVOILUTSequence && wc && ww) {
15673
- if (Array.isArray(wc)) {
15674
- wc = wc[0];
15672
+ if (functionalGroup.FrameVOILUTSequence && wc2 && ww) {
15673
+ if (Array.isArray(wc2)) {
15674
+ wc2 = wc2[0];
15675
15675
  }
15676
15676
  if (Array.isArray(ww)) {
15677
15677
  ww = ww[0];
15678
15678
  }
15679
- wcww.center += Number(wc);
15679
+ wcww.center += Number(wc2);
15680
15680
  wcww.width += Number(ww);
15681
15681
  wcww.count++;
15682
15682
  }
@@ -18026,17 +18026,17 @@ var require_dcmjs = __commonJS({
18026
18026
  if (shape === void 0) {
18027
18027
  shape = [data3.length];
18028
18028
  }
18029
- var d3 = shape.length;
18029
+ var d2 = shape.length;
18030
18030
  if (stride === void 0) {
18031
- stride = new Array(d3);
18032
- for (var i2 = d3 - 1, sz = 1; i2 >= 0; --i2) {
18031
+ stride = new Array(d2);
18032
+ for (var i2 = d2 - 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 < d3; ++i2) {
18039
+ for (var i2 = 0; i2 < d2; ++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 <= d3 + 1) {
18047
+ while (ctor_list.length <= d2 + 1) {
18048
18048
  ctor_list.push(compileConstructor(dtype, ctor_list.length - 1));
18049
18049
  }
18050
- var ctor = ctor_list[d3 + 1];
18050
+ var ctor = ctor_list[d2 + 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 p = 0; p < brushPixelData.length; p++) {
18212
- pixelData[pixelDataIndex] = brushPixelData[p];
18211
+ for (var p2 = 0; p2 < brushPixelData.length; p2++) {
18212
+ pixelData[pixelDataIndex] = brushPixelData[p2];
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 p = 0; p < cToolsPixelData.length; p++) {
18353
- if (pixelData2D.data[p]) {
18354
- cToolsPixelData[p] = 1;
18352
+ for (var p2 = 0; p2 < cToolsPixelData.length; p2++) {
18353
+ if (pixelData2D.data[p2]) {
18354
+ cToolsPixelData[p2] = 1;
18355
18355
  } else {
18356
- cToolsPixelData[p] = 0;
18356
+ cToolsPixelData[p2] = 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 p = next; p < next + N2; p++) {
18551
- pixelData[pixelDataIndex] = uInt8Frame[p];
18550
+ for (var p2 = next; p2 < next + N2; p2++) {
18551
+ pixelData[pixelDataIndex] = uInt8Frame[p2];
18552
18552
  pixelDataIndex++;
18553
18553
  }
18554
18554
  i2 += N2 + 1;
@@ -19469,7 +19469,7 @@ var require_dcmjs = __commonJS({
19469
19469
  var sharedImageOrientationPatient = SharedFunctionalGroupsSequence.PlaneOrientationSequence ? SharedFunctionalGroupsSequence.PlaneOrientationSequence.ImageOrientationPatient : void 0;
19470
19470
  var sliceLength = Columns * Rows;
19471
19471
  var arrayBufferLength = sliceLength * imageIds.length * 2;
19472
- var M2 = 1;
19472
+ var M3 = 1;
19473
19473
  var m2 = 0;
19474
19474
  var tempBuffer = labelmapBufferArray[m2].slice(0);
19475
19475
  var tempSegmentsOnFrame = cloneDeep(segmentsOnFrameArray[m2]);
@@ -19518,10 +19518,10 @@ var require_dcmjs = __commonJS({
19518
19518
  if (data3[j]) {
19519
19519
  if (labelmap2DView[j] !== 0) {
19520
19520
  m2++;
19521
- if (m2 >= M2) {
19521
+ if (m2 >= M3) {
19522
19522
  labelmapBufferArray[m2] = new ArrayBuffer(arrayBufferLength);
19523
19523
  segmentsOnFrameArray[m2] = [];
19524
- M2++;
19524
+ M3++;
19525
19525
  }
19526
19526
  tempBuffer = labelmapBufferArray[m2].slice(0);
19527
19527
  tempSegmentsOnFrame = cloneDeep(segmentsOnFrameArray[m2]);
@@ -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, d3, t) {
20747
+ function hermite(out, a2, b2, c, d2, 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 + 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;
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;
20756
20756
  return out;
20757
20757
  }
20758
- function bezier(out, a2, b2, c, d3, t) {
20758
+ function bezier(out, a2, b2, c, d2, 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 + 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;
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;
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 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);
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);
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 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);
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);
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 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];
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];
20848
20848
  out[0] = r6[0] + b2[0];
20849
20849
  out[1] = r6[1] + b2[1];
20850
20850
  out[2] = r6[2] + b2[2];
@@ -25673,19 +25673,19 @@ var require_proxy = __commonJS({
25673
25673
  setPrototypeOf() {
25674
25674
  throw Error("Cannot set prototype of Proxies created by ts-mixer");
25675
25675
  },
25676
- getOwnPropertyDescriptor(_2, prop) {
25676
+ getOwnPropertyDescriptor(_, prop) {
25677
25677
  return Object.getOwnPropertyDescriptor((0, exports2.getIngredientWithProp)(prop, ingredients) || {}, prop);
25678
25678
  },
25679
25679
  defineProperty() {
25680
25680
  throw new Error("Cannot define new properties on Proxies created by ts-mixer");
25681
25681
  },
25682
- has(_2, prop) {
25682
+ has(_, prop) {
25683
25683
  return (0, exports2.getIngredientWithProp)(prop, ingredients) !== void 0 || prototype[prop] !== void 0;
25684
25684
  },
25685
- get(_2, prop) {
25685
+ get(_, prop) {
25686
25686
  return ((0, exports2.getIngredientWithProp)(prop, ingredients) || prototype)[prop];
25687
25687
  },
25688
- set(_2, prop, val) {
25688
+ set(_, prop, val) {
25689
25689
  const ingredientWithProp = (0, exports2.getIngredientWithProp)(prop, ingredients);
25690
25690
  if (ingredientWithProp === void 0)
25691
25691
  throw new Error("Cannot set new properties on Proxies created by ts-mixer");
@@ -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, d22) => {
25780
+ var mergePropertyAndMethodDecorators = (d1, d2) => {
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 = 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 : {})
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 : {})
25785
25785
  };
25786
25786
  };
25787
- var mergeDecorators = (d1, d22) => {
25788
- var _a, _b, _c, _d, _e, _f;
25787
+ var mergeDecorators = (d1, d2) => {
25788
+ var _a, _b, _c, _d, _e2, _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 = 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 : {})
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((_e2 = d1 === null || d1 === void 0 ? void 0 : d1.instance) !== null && _e2 !== void 0 ? _e2 : {}, (_f = d2 === null || d2 === void 0 ? void 0 : d2.instance) !== null && _f !== void 0 ? _f : {})
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, d22) => mergeDecorators(d1, d22));
25820
+ return decoratorsForClassChain.reduce((d1, d2) => mergeDecorators(d1, d2));
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, d22) => mergeDecorators(d1, d22));
25829
+ return classDecorators.reduce((d1, d2) => mergeDecorators(d1, d2));
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: d3, DicomMetaDictionary: p, 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: d2, DicomMetaDictionary: p2, 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 ? 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();
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();
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") || 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);
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);
26205
26205
  }
26206
26206
  _getElement(e2) {
26207
26207
  return this.elements[e2];
26208
26208
  }
26209
26209
  _fromP10Buffer(e2, t2) {
26210
- const r7 = d3.readFile(e2, t2), s2 = p.naturalizeDataset(r7.meta).TransferSyntaxUID, o2 = p.naturalizeDataset(r7.dict);
26210
+ const r7 = d2.readFile(e2, t2), s2 = p2.naturalizeDataset(r7.meta).TransferSyntaxUID, o2 = p2.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 = d3._read(s2, o2, r7);
26215
- this.elements = p.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 = d2._read(s2, o2, r7);
26215
+ this.elements = p2.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 d3(e3) {
26249
+ function d2(e3) {
26250
26250
  return function() {
26251
26251
  typeof console !== t2 && (c.call(this), this[e3].apply(this, arguments));
26252
26252
  };
26253
26253
  }
26254
- function p(e3, t3, r8) {
26255
- return l3(e3) || d3.apply(this, arguments);
26254
+ function p2(e3, t3, r8) {
26255
+ return l3(e3) || d2.apply(this, arguments);
26256
26256
  }
26257
26257
  function h3(e3, r8) {
26258
- var n2, a3, l4, d4 = this, h4 = "loglevel";
26258
+ var n2, a3, l4, d3 = 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 === d4.levels[e4] && (e4 = void 0), e4;
26284
+ return void 0 === d3.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 !== d4.levels[t3.toUpperCase()] && (t3 = d4.levels[t3.toUpperCase()]), "number" == typeof t3 && t3 >= 0 && t3 <= d4.levels.SILENT) return t3;
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;
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), d4.name = e3, d4.levels = { TRACE: 0, DEBUG: 1, INFO: 2, WARN: 3, ERROR: 4, SILENT: 5 }, d4.methodFactory = r8 || p, d4.getLevel = function() {
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() {
26305
26305
  return null != l4 ? l4 : null != a3 ? a3 : n2;
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();
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();
26318
26318
  }, n2 = f3(i2 ? i2.getLevel() : "WARN");
26319
26319
  var w2 = u2();
26320
- null != w2 && (l4 = f3(w2)), c.call(d4);
26320
+ null != w2 && (l4 = f3(w2)), c.call(d3);
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: 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;
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;
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: 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) };
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), _ = 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: _, 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), d3 = r6(234), p = 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), d2 = r6(234), p2 = r6(25), h3 = r6(984);
26429
26429
  class m2 {
26430
26430
  encode(e2, t2, r7 = {}) {
26431
26431
  throw new Error("encode should be implemented");
@@ -26434,7 +26434,7 @@ var require_dcmjs_codecs_min = __commonJS({
26434
26434
  throw new Error("decode should be implemented");
26435
26435
  }
26436
26436
  static getCodec(e2) {
26437
- const t2 = { [a2.ImplicitVRLittleEndian]: u2, [a2.ExplicitVRLittleEndian]: g2, [a2.ExplicitVRBigEndian]: f3, [a2.RleLossless]: w2, [a2.JpegBaselineProcess1]: y3, [a2.JpegLosslessProcess14V1]: x, [a2.JpegLsLossless]: b2, [a2.JpegLsLossy]: _2, [a2.Jpeg2000Lossless]: A2, [a2.Jpeg2000Lossy]: S2, [a2.HtJpeg2000Lossless]: E2, [a2.HtJpeg2000LosslessRpcl]: v2, [a2.HtJpeg2000Lossy]: B2 }[e2];
26437
+ const t2 = { [a2.ImplicitVRLittleEndian]: u2, [a2.ExplicitVRLittleEndian]: g2, [a2.ExplicitVRBigEndian]: f3, [a2.RleLossless]: w2, [a2.JpegBaselineProcess1]: y3, [a2.JpegLosslessProcess14V1]: x, [a2.JpegLsLossless]: b2, [a2.JpegLsLossy]: _, [a2.Jpeg2000Lossless]: A2, [a2.Jpeg2000Lossy]: S2, [a2.HtJpeg2000Lossless]: E2, [a2.HtJpeg2000LosslessRpcl]: v2, [a2.HtJpeg2000Lossy]: B }[e2];
26438
26438
  if (!t2) throw new Error(`Codec for transfer syntax UID ${e2} is not implemented`);
26439
26439
  return new t2();
26440
26440
  }
@@ -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 = d3.fromDicomElements(e2);
26446
+ const c2 = d2.fromDicomElements(e2);
26447
26447
  c2.setDecodedBuffer(i4);
26448
- const m3 = p[r7](c2, s2);
26448
+ const m3 = p2[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 = d3.fromDicomElements(e2);
26457
+ const i4 = o2.getFrameBuffer(t3), c2 = d2.fromDicomElements(e2);
26458
26458
  c2.setEncodedBuffer(i4);
26459
- const m3 = p[r7](c2, s2);
26459
+ const m3 = p2[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
  }
@@ -26578,7 +26578,7 @@ var require_dcmjs_codecs_min = __commonJS({
26578
26578
  return super.decode(e2, t2, r7);
26579
26579
  }
26580
26580
  }
26581
- class _2 extends C2 {
26581
+ class _ extends C2 {
26582
26582
  encode(e2, t2, r7 = {}) {
26583
26583
  return r7.lossy = true, super.encode(e2, t2, r7);
26584
26584
  }
@@ -26642,7 +26642,7 @@ var require_dcmjs_codecs_min = __commonJS({
26642
26642
  return super.decode(e2, t2, "decodeHtJpeg2000", r7);
26643
26643
  }
26644
26644
  }
26645
- class B2 extends I2 {
26645
+ class B extends I2 {
26646
26646
  encode(e2, t2, r7 = {}) {
26647
26647
  return r7.lossy = true, super.encode(e2, t2, "encodeHtJpeg2000", r7);
26648
26648
  }
@@ -26650,7 +26650,7 @@ var require_dcmjs_codecs_min = __commonJS({
26650
26650
  return super.decode(e2, t2, "decodeHtJpeg2000", r7);
26651
26651
  }
26652
26652
  }
26653
- e.exports = { Codec: m2, ExplicitVRBigEndianCodec: f3, ExplicitVRLittleEndianCodec: g2, HtJpeg2000LosslessCodec: E2, HtJpeg2000LosslessRpclCodec: v2, HtJpeg2000LossyCodec: B2, ImplicitVRLittleEndianCodec: u2, Jpeg2000LosslessCodec: A2, Jpeg2000LossyCodec: S2, JpegBaselineProcess1Codec: y3, JpegLosslessProcess14V1Codec: x, JpegLsLosslessCodec: b2, JpegLsLossyCodec: _2, RleLosslessCodec: w2 };
26653
+ e.exports = { Codec: m2, ExplicitVRBigEndianCodec: f3, ExplicitVRLittleEndianCodec: g2, HtJpeg2000LosslessCodec: E2, HtJpeg2000LosslessRpclCodec: v2, HtJpeg2000LossyCodec: B, ImplicitVRLittleEndianCodec: u2, Jpeg2000LosslessCodec: A2, Jpeg2000LossyCodec: S2, JpegBaselineProcess1Codec: y3, JpegLosslessProcess14V1Codec: x, JpegLsLosslessCodec: b2, JpegLsLossyCodec: _, RleLosslessCodec: w2 };
26654
26654
  }, 492: (e) => {
26655
26655
  const t = { ImplicitVRLittleEndian: "1.2.840.10008.1.2", ExplicitVRLittleEndian: "1.2.840.10008.1.2.1", ExplicitVRBigEndian: "1.2.840.10008.1.2.2", RleLossless: "1.2.840.10008.1.2.5", JpegBaselineProcess1: "1.2.840.10008.1.2.4.50", JpegLosslessProcess14V1: "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" };
26656
26656
  Object.freeze(t);
@@ -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 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 };
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 };
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"), d3 = -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"), d2 = -1 !== o3.template.indexOf("%n");
26833
26833
  return function() {
26834
- for (var t4 = "", n3 = arguments.length, p = Array(n3), h3 = 0; h3 < n3; h3++) p[h3] = arguments[h3];
26834
+ for (var t4 = "", n3 = arguments.length, p2 = Array(n3), h3 = 0; h3 < n3; h3++) p2[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)), d3 && (t4 = t4.replace(/%n/, g2))), p.length && "string" == typeof p[0] ? p[0] = t4 + " " + p[0] : p.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)), d2 && (t4 = t4.replace(/%n/, g2))), p2.length && "string" == typeof p2[0] ? p2[0] = t4 + " " + p2[0] : p2.unshift(t4);
26838
26838
  }
26839
- s3.apply(void 0, p);
26839
+ s3.apply(void 0, p2);
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 d4 = new i3(e3.getElements(), e3.getTransferSyntaxUid());
29271
- return d4.transcode(t3, s3), new o2(d4.getElements(), d4.getTransferSyntaxUid());
29270
+ const d3 = new i3(e3.getElements(), e3.getTransferSyntaxUid());
29271
+ return d3.transcode(t3, s3), new o2(d3.getElements(), d3.getTransferSyntaxUid());
29272
29272
  }
29273
29273
  static _transferSyntaxDescriptionFromValue(e3) {
29274
29274
  const t3 = Object.keys(a3).find((t4) => a3[t4] === e3);
@@ -29305,7 +29305,7 @@ 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: 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) };
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: U2, NSetRequest: q2, NSetResponse: D2 } = s2(940), { AbortReason: E2, AbortSource: T, CommandFieldType: b2, PresentationContextResult: O2, Priority: N2, RawPduType: M3, RejectReason: B, RejectResult: L2, RejectSource: F2, SopClass: k2, Status: $, StorageClass: j, TransferSyntax: V2, Uid: _, 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: M3, RejectReason: B, RejectResult: L2, RejectSource: F2, SopClass: k2, Status: $, StorageClass: j, TransferSyntax: V2, Uid: _, 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: d3, CFindResponse: h3, CGetResponse: g2, CMoveResponse: p2, CStoreResponse: S2, NActionResponse: f3, NCreateResponse: C2, NDeleteResponse: A2, NEventReportResponse: x, NGetResponse: U2, NSetResponse: D2 }, Scp: r7, Server: a3, Statistics: J2, Transcoding: X2, version: s2(837) };
29309
29309
  e2.exports = H;
29310
29310
  }, 278: (e2) => {
29311
29311
  "use strict";
@@ -29314,7 +29314,7 @@ 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: 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);
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: U2, NActionRequest: q2, NActionResponse: D2, NCreateRequest: E2, NCreateResponse: T, NDeleteRequest: b2, NDeleteResponse: O2, NEventReportRequest: N2, NEventReportResponse: M3, NGetRequest: B, NGetResponse: L2, NSetRequest: F2, NSetResponse: k2, Response: $ } = s2(940), j = s2(825), V2 = s2(139), _ = s2(906), G2 = s2(73), z2 = s2(547), { SmartBuffer: Q2 } = s2(766), { EOL: W2 } = s2(857), J2 = s2(733), X2 = s2(235);
29318
29318
  class H extends J2 {
29319
29319
  constructor() {
29320
29320
  super();
@@ -29350,7 +29350,7 @@ var require_dcmjs_dimse_min = __commonJS({
29350
29350
  }
29351
29351
  e2.exports = class extends J2 {
29352
29352
  constructor(e3, t3) {
29353
- super(), this.messageId = 0, this.socket = e3, this.requests = [], this.pending = [], this.dimseStream = void 0, this.dimseStoreStream = void 0, this.dimse = void 0, t3 = t3 || {}, this.connectTimeout = t3.connectTimeout || 18e4, this.associationTimeout = t3.associationTimeout || 6e4, this.pduTimeout = t3.pduTimeout || 6e4, this.logCommandDatasets = t3.logCommandDatasets || false, this.logDatasets = t3.logDatasets || false, this.datasetReadOptions = t3.datasetReadOptions || {}, this.datasetWriteOptions = t3.datasetWriteOptions || {}, this.datasetNameMap = t3.datasetNameMap || {}, this.datasetTranscodeOptions = t3.datasetTranscodeOptions || {}, this.logId = "", this.connected = false, this.connectedTime = void 0, this.lastPduTime = void 0, this.timeoutIntervalId = void 0, this.statistics = new _2(), this._wrapSocket();
29353
+ super(), this.messageId = 0, this.socket = e3, this.requests = [], this.pending = [], this.dimseStream = void 0, this.dimseStoreStream = void 0, this.dimse = void 0, t3 = t3 || {}, this.connectTimeout = t3.connectTimeout || 18e4, this.associationTimeout = t3.associationTimeout || 6e4, this.pduTimeout = t3.pduTimeout || 6e4, this.logCommandDatasets = t3.logCommandDatasets || false, this.logDatasets = t3.logDatasets || false, this.datasetReadOptions = t3.datasetReadOptions || {}, this.datasetWriteOptions = t3.datasetWriteOptions || {}, this.datasetNameMap = t3.datasetNameMap || {}, this.datasetTranscodeOptions = t3.datasetTranscodeOptions || {}, this.logId = "", this.connected = false, this.connectedTime = void 0, this.lastPduTime = void 0, this.timeoutIntervalId = void 0, this.statistics = new _(), this._wrapSocket();
29354
29354
  }
29355
29355
  sendAssociationRequest(e3) {
29356
29356
  this.association = e3;
@@ -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 d4().write();
29370
+ const e3 = new d3().write();
29371
29371
  z2.info(`${this.logId} -> Association release request`), this._sendPdu(e3);
29372
29372
  }
29373
29373
  sendAssociationReleaseResponse() {
@@ -29488,7 +29488,7 @@ var require_dcmjs_dimse_min = __commonJS({
29488
29488
  break;
29489
29489
  }
29490
29490
  case l3.AReleaseRQ:
29491
- new d4().read(t3), z2.info(`${this.logId} <- Association release request`), this.emit("associationReleaseRequested");
29491
+ new d3().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");
@@ -29532,7 +29532,7 @@ var require_dcmjs_dimse_min = __commonJS({
29532
29532
  this.dimse = Object.assign(new w2(), e5);
29533
29533
  break;
29534
29534
  case g2.CStoreResponse:
29535
- this.dimse = Object.assign(new U(), e5);
29535
+ this.dimse = Object.assign(new U2(), e5);
29536
29536
  break;
29537
29537
  case g2.CMoveRequest:
29538
29538
  this.dimse = Object.assign(new A2(), e5);
@@ -29568,10 +29568,10 @@ var require_dcmjs_dimse_min = __commonJS({
29568
29568
  this.dimse = Object.assign(new N2(), e5);
29569
29569
  break;
29570
29570
  case g2.NEventReportResponse:
29571
- this.dimse = Object.assign(new M2(), e5);
29571
+ this.dimse = Object.assign(new M3(), e5);
29572
29572
  break;
29573
29573
  case g2.NGetRequest:
29574
- this.dimse = Object.assign(new B2(), e5);
29574
+ this.dimse = Object.assign(new B(), e5);
29575
29575
  break;
29576
29576
  case g2.NGetResponse:
29577
29577
  this.dimse = Object.assign(new L2(), e5);
@@ -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() !== p.Pending && s3.raiseDoneEvent());
29609
+ s3 && (s3.raiseResponseEvent(e4), e4.getStatus() !== p2.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) => {
@@ -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), d4 = 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), d3 = 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 d4();
29677
+ super(), this.requests = [], this.additionalPresentationContexts = [], this.network = void 0, this.statistics = new d3();
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 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]);
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]);
29695
29695
  }), this.additionalPresentationContexts.forEach((e4) => {
29696
- const t4 = e4.addAsNew ? d5.addPresentationContext(e4.context.getAbstractSyntaxUid()) : d5.addOrGetPresentationContext(e4.context.getAbstractSyntaxUid());
29696
+ const t4 = e4.addAsNew ? d4.addPresentationContext(e4.context.getAbstractSyntaxUid()) : d4.addOrGetPresentationContext(e4.context.getAbstractSyntaxUid());
29697
29697
  e4.context.getTransferSyntaxUids().forEach((e5) => {
29698
- d5.addTransferSyntaxToPresentationContext(t4, e5);
29698
+ d4.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 }), 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", () => {
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", () => {
29709
29709
  this.emit("associationReleased"), l3.end();
29710
- }), p.on("associationRejected", (e4) => {
29710
+ }), p2.on("associationRejected", (e4) => {
29711
29711
  this.emit("associationRejected", e4), l3.end();
29712
- }), p.on("done", () => {
29713
- setTimeout(() => p.sendAssociationReleaseRequest(), this.associationLingerTimeout);
29714
- }), p.on("cStoreRequest", (e4, t4) => {
29712
+ }), p2.on("done", () => {
29713
+ setTimeout(() => p2.sendAssociationReleaseRequest(), this.associationLingerTimeout);
29714
+ }), p2.on("cStoreRequest", (e4, t4) => {
29715
29715
  this.emit("cStoreRequest", e4, t4);
29716
- }), p.on("nEventReportRequest", (e4, t4) => {
29716
+ }), p2.on("nEventReportRequest", (e4, t4) => {
29717
29717
  this.emit("nEventReportRequest", e4, t4);
29718
- }), p.on("networkError", (e4) => {
29718
+ }), p2.on("networkError", (e4) => {
29719
29719
  l3.end(), this.emit("networkError", e4);
29720
- }), p.on("close", () => {
29721
- this.statistics.addFromOtherStatistics(p.getStatistics()), this.network = void 0, this.emit("closed");
29722
- }), this.network = p;
29720
+ }), p2.on("close", () => {
29721
+ this.statistics.addFromOtherStatistics(p2.getStatistics()), this.network = void 0, this.emit("closed");
29722
+ }), this.network = p2;
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 d4 = { NoReasonGiven: 1, ApplicationContextNotSupported: 2, CallingAeNotRecognized: 3, CalledAeNotRecognized: 7, ProtocolVersionNotSupported: 2, TemporaryCongestion: 1, LocalLimitExceeded: 2 };
29757
- Object.freeze(d4);
29756
+ const d3 = { NoReasonGiven: 1, ApplicationContextNotSupported: 2, CallingAeNotRecognized: 3, CalledAeNotRecognized: 7, ProtocolVersionNotSupported: 2, TemporaryCongestion: 1, LocalLimitExceeded: 2 };
29757
+ Object.freeze(d3);
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 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];
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];
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: d4, RejectResult: o2, RejectSource: c2, SopClass: l3, Status: h3, StorageClass: g2, TranscodableTransferSyntaxes: R2, TransferSyntax: p, 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: d3, RejectResult: o2, RejectSource: c2, SopClass: l3, Status: h3, StorageClass: g2, TranscodableTransferSyntaxes: R2, TransferSyntax: p2, 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: 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);
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);
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(d4.fromRequest(e3));
29838
+ R2.error("nCreateRequest method must be implemented"), t3(d3.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 p();
29863
+ super(), this.scp = { class: e3 }, this.server = void 0, this.clients = [], this.statistics = new p2();
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: d4, 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: d3, 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 || d4.ImplicitVRLittleEndian;
30090
+ let s3 = t3 || d3.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 !== d4.ImplicitVRLittleEndian && t4 !== d4.ExplicitVRLittleEndian && (a4 = this.findPresentationContextByAbstractSyntaxAndTransferSyntax(r8, t4), void 0 === a4 && (a4 = this.addPresentationContext(r8), this.addTransferSyntaxToPresentationContext(a4, t4)));
30101
+ t4 !== d3.ImplicitVRLittleEndian && t4 !== d3.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(d4, t4) || t4}`);
30130
+ e3.push(` Transfer: ${this._uidNameFromValue(d3, 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: 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;
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;
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
- }) : d4(e3, Buffer.from(u3.write(i4)));
30234
+ }) : d3(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 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);
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);
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: d4 } = 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: d3 } = 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(d4);
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);
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 p extends g2 {
30438
+ class p2 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 p {
30550
+ class S2 extends p2 {
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 p {
30595
+ class f3 extends p2 {
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 p {
30630
+ class C2 extends p2 {
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 p {
30663
+ class A2 extends p2 {
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 p {
30729
+ class x extends p2 {
30730
30730
  constructor(e3, t3) {
30731
30731
  super(n2.CGetResponse, r7.StudyRootQueryRetrieveInformationModelGet, false, e3, t3);
30732
30732
  }
@@ -30768,13 +30768,13 @@ 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 p {
30771
+ class U2 extends p2 {
30772
30772
  constructor(e3, t3, s3, i4) {
30773
30773
  super(n2.NCreateResponse, e3, false, s3, i4), this.setAffectedSopInstanceUid(t3);
30774
30774
  }
30775
30775
  static fromRequest(e3) {
30776
30776
  if (!(e3 instanceof w2)) throw new Error("Request should be an instance of NCreateRequest");
30777
- const t3 = new U(e3.getAffectedSopClassUid(), e3.getAffectedSopInstanceUid(), a3.ProcessingFailure);
30777
+ const t3 = new U2(e3.getAffectedSopClassUid(), e3.getAffectedSopInstanceUid(), a3.ProcessingFailure);
30778
30778
  return t3.setMessageIdBeingRespondedTo(e3.getMessageId()), t3;
30779
30779
  }
30780
30780
  }
@@ -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 p {
30792
+ class D2 extends p2 {
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 p {
30813
+ class T extends p2 {
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 p {
30834
+ class O2 extends p2 {
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,27 +30873,27 @@ var require_dcmjs_dimse_min = __commonJS({
30873
30873
  return "0".repeat(t3 - s3.length) + s3;
30874
30874
  }
30875
30875
  }
30876
- class M2 extends p {
30876
+ class M3 extends p2 {
30877
30877
  constructor(e3, t3, s3, i4) {
30878
30878
  super(n2.NGetResponse, e3, false, s3, i4), this.setAffectedSopInstanceUid(t3);
30879
30879
  }
30880
30880
  static fromRequest(e3) {
30881
30881
  if (!(e3 instanceof N2)) throw new Error("Request should be an instance of NGetRequest");
30882
- const t3 = new M2(e3.getRequestedSopClassUid(), e3.getRequestedSopInstanceUid(), a3.ProcessingFailure);
30882
+ const t3 = new M3(e3.getRequestedSopClassUid(), e3.getRequestedSopInstanceUid(), a3.ProcessingFailure);
30883
30883
  return t3.setMessageIdBeingRespondedTo(e3.getMessageId()), t3;
30884
30884
  }
30885
30885
  }
30886
- class B2 extends l3 {
30886
+ class B extends l3 {
30887
30887
  constructor(e3, t3, s3) {
30888
30888
  super(n2.NSetRequest, e3, false), this.setRequestedSopInstanceUid(t3), this.setMetaSopClassUid(s3);
30889
30889
  }
30890
30890
  }
30891
- class L2 extends p {
30891
+ class L2 extends p2 {
30892
30892
  constructor(e3, t3, s3, i4) {
30893
30893
  super(n2.NSetResponse, e3, false, s3, i4), this.setAffectedSopInstanceUid(t3);
30894
30894
  }
30895
30895
  static fromRequest(e3) {
30896
- if (!(e3 instanceof B2)) throw new Error("Request should be an instance of NSetRequest");
30896
+ if (!(e3 instanceof B)) throw new Error("Request should be an instance of NSetRequest");
30897
30897
  const t3 = new L2(e3.getRequestedSopClassUid(), e3.getRequestedSopInstanceUid(), a3.ProcessingFailure);
30898
30898
  return t3.setMessageIdBeingRespondedTo(e3.getMessageId()), t3;
30899
30899
  }
@@ -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: p };
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: U2, NDeleteRequest: E2, NDeleteResponse: T, NEventReportRequest: b2, NEventReportResponse: O2, NGetRequest: N2, NGetResponse: M3, NSetRequest: B, NSetResponse: L2, Request: l3, Response: p2 };
30917
30917
  }, 942: (e2, t2, s2) => {
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);
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);
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() || d4.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() || d3.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
- } }, d3 = {}, function e2(t2) {
31347
- var s2 = d3[t2];
31346
+ } }, d2 = {}, function e2(t2) {
31347
+ var s2 = d2[t2];
31348
31348
  if (void 0 !== s2) return s2.exports;
31349
- var n2 = d3[t2] = { exports: {} };
31349
+ var n2 = d2[t2] = { exports: {} };
31350
31350
  return c[t2](n2, n2.exports, e2), n2.exports;
31351
31351
  }(237);
31352
- var c, d3;
31352
+ var c, d2;
31353
31353
  });
31354
31354
  }
31355
31355
  });
@@ -31370,7 +31370,7 @@ var rt = class {
31370
31370
  return `${this.operator}(${this.child.toString()})`;
31371
31371
  }
31372
31372
  };
31373
- var te = class {
31373
+ var re = class {
31374
31374
  constructor(e, t, n) {
31375
31375
  this.operator = e, this.left = t, this.right = n;
31376
31376
  }
@@ -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 Pe = class {
31456
+ var we = class {
31457
31457
  constructor(e = 10) {
31458
31458
  this.max = e, this.cache = /* @__PURE__ */ new Map();
31459
31459
  }
@@ -31484,9 +31484,9 @@ var ar = "not-found";
31484
31484
  var ur = "unauthorized";
31485
31485
  var ot = "accepted";
31486
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" } }] };
31487
+ var Ae = { resourceType: "OperationOutcome", id: ur, issue: [{ severity: "error", code: "login", details: { text: "Unauthorized" } }] };
31488
+ var vn = { ...Ae, issue: [...Ae.issue, { severity: "error", code: "expired", details: { text: "Token expired" } }] };
31489
+ var lr = { ...Ae, issue: [...Ae.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
  }
@@ -31496,77 +31496,77 @@ function y(r6) {
31496
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 ao(r6) {
31499
+ function lo(r6) {
31500
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
31501
  }
31502
- function Ae(r6) {
31502
+ function Oe(r6) {
31503
31503
  return typeof r6 == "object" && r6 !== null && r6.resourceType === "OperationOutcome";
31504
31504
  }
31505
- function pr(r6) {
31505
+ function dr(r6) {
31506
31506
  return r6.id === nr || r6.id === it || r6.id === or || r6.id === ot;
31507
31507
  }
31508
- var d = class extends Error {
31508
+ var p = class extends Error {
31509
31509
  constructor(e, t) {
31510
31510
  super(Sn(e)), this.outcome = e, this.cause = t;
31511
31511
  }
31512
31512
  };
31513
31513
  function st(r6) {
31514
- return r6 instanceof d ? r6.outcome : Ae(r6) ? r6 : b(Oe(r6));
31514
+ return r6 instanceof p ? r6.outcome : Oe(r6) ? r6 : b(Ie(r6));
31515
31515
  }
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";
31516
+ function Ie(r6) {
31517
+ return r6 ? typeof r6 == "string" ? r6 : lo(r6) ? r6.message : Oe(r6) ? Sn(r6) : typeof r6 == "object" && "code" in r6 && typeof r6.code == "string" ? r6.code : JSON.stringify(r6) : "Unknown error";
31518
31518
  }
31519
31519
  function Sn(r6) {
31520
- let e = r6.issue?.map(co) ?? [];
31520
+ let e = r6.issue?.map(po) ?? [];
31521
31521
  return e.length > 0 ? e.join("; ") : "Unknown error";
31522
31522
  }
31523
- function co(r6) {
31523
+ function po(r6) {
31524
31524
  let e;
31525
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;
31526
31526
  }
31527
- function lo(r6, e) {
31527
+ function ho(r6, e) {
31528
31528
  let t = e.max && e.max === Number.MAX_SAFE_INTEGER ? Number.POSITIVE_INFINITY : e.max;
31529
31529
  return { path: r6, description: "", type: e.type ?? [], min: e.min ?? 0, max: t ?? 1, isArray: !!t && t > 1, constraints: [] };
31530
31530
  }
31531
31531
  function Rn(r6) {
31532
31532
  let e = /* @__PURE__ */ Object.create(null);
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: [] };
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, ho(i2, o)])), constraints: [], innerTypes: [] };
31534
31534
  return e;
31535
31535
  }
31536
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" }] } } } };
31537
31537
  function mr(r6) {
31538
31538
  return new fr(r6).parse();
31539
31539
  }
31540
- var fe = Rn(Cn);
31540
+ var he = Rn(Cn);
31541
31541
  var yr = /* @__PURE__ */ Object.create(null);
31542
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" };
31543
+ var yo = { "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
31544
  function In(r6) {
31545
31545
  let e;
31546
31546
  return e = Pn[r6], e || (e = Pn[r6] = /* @__PURE__ */ Object.create(null)), e;
31547
31547
  }
31548
31548
  function gr(r6) {
31549
31549
  let t = (Array.isArray(r6) ? r6 : r6.entry?.map((n) => n.resource) ?? []).filter((n) => n?.resourceType === "StructureDefinition");
31550
- Ln(t);
31550
+ Fn(t);
31551
31551
  for (let n of t) xr(n);
31552
31552
  }
31553
31553
  function xr(r6) {
31554
31554
  if (!r6?.name) throw new Error("Failed loading StructureDefinition from bundle");
31555
31555
  if (r6.resourceType !== "StructureDefinition") return;
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;
31556
+ let e = mr(r6), t = yo[r6.url], n, i2;
31557
+ t ? (n = he, 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 = he, i2 = r6.type) : (n = In(r6.url), i2 = r6.type), n[i2] = e;
31558
31558
  for (let o of e.innerTypes) o.parentType = e, n[o.name] = o;
31559
31559
  yr[r6.url] = e;
31560
31560
  }
31561
31561
  function Dn(r6) {
31562
- return !!fe[r6];
31562
+ return !!he[r6];
31563
31563
  }
31564
31564
  function We(r6, e) {
31565
31565
  if (e) {
31566
31566
  let t = In(e)[r6];
31567
31567
  if (t) return t;
31568
31568
  }
31569
- return fe[r6];
31569
+ return he[r6];
31570
31570
  }
31571
31571
  function Mn(r6) {
31572
31572
  return !!yr[r6];
@@ -31574,7 +31574,7 @@ function Mn(r6) {
31574
31574
  var fr = class {
31575
31575
  constructor(e) {
31576
31576
  if (!e.snapshot?.element || e.snapshot.element.length === 0) throw new Error(`No snapshot defined for StructureDefinition '${e.name}'`);
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 = [];
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: To(e), elements: {}, constraints: this.parseElementDefinition(this.root).constraints, innerTypes: [], summaryProperties: /* @__PURE__ */ new Set(), mandatoryProperties: /* @__PURE__ */ new Set() }, this.innerTypes = [];
31578
31578
  }
31579
31579
  parse() {
31580
31580
  let e = this.next();
@@ -31582,7 +31582,7 @@ var fr = class {
31582
31582
  if (e.sliceName) this.parseSliceStart(e);
31583
31583
  else if (e.id?.includes(":")) {
31584
31584
  if (this.slicingContext?.current) {
31585
- let t = dr(e, this.slicingContext.path);
31585
+ let t = pr(e, this.slicingContext.path);
31586
31586
  this.slicingContext.current.elements[t] = this.parseElementDefinition(e);
31587
31587
  }
31588
31588
  } else {
@@ -31591,13 +31591,13 @@ var fr = class {
31591
31591
  let n = this.backboneContext;
31592
31592
  for (; n; ) {
31593
31593
  if (e.path?.startsWith(n.path + ".")) {
31594
- n.type.elements[dr(e, n.path)] = t;
31594
+ n.type.elements[pr(e, n.path)] = t;
31595
31595
  break;
31596
31596
  }
31597
31597
  n = n.parent;
31598
31598
  }
31599
31599
  if (!n) {
31600
- let i2 = dr(e, this.root.path);
31600
+ let i2 = pr(e, this.root.path);
31601
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;
31602
31602
  }
31603
31603
  this.checkFieldExit(e);
@@ -31607,23 +31607,23 @@ var fr = class {
31607
31607
  return this.checkFieldExit(), this.innerTypes.length > 0 && (this.resourceSchema.innerTypes = this.innerTypes), this.resourceSchema;
31608
31608
  }
31609
31609
  checkFieldEnter(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);
31610
+ this.isInnerType(e) && this.enterInnerType(e), this.slicingContext && !ke(this.slicingContext.path, e?.path) && (this.slicingContext = void 0), e.slicing && !this.slicingContext && this.enterSlice(e, t);
31611
31611
  }
31612
31612
  enterInnerType(e) {
31613
- for (; this.backboneContext && !Ie(this.backboneContext?.path, e.path); ) this.innerTypes.push(this.backboneContext.type), this.backboneContext = this.backboneContext.parent;
31613
+ for (; this.backboneContext && !ke(this.backboneContext?.path, e.path); ) this.innerTypes.push(this.backboneContext.type), this.backboneContext = this.backboneContext.parent;
31614
31614
  let t = hr(e);
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 };
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: ke(this.backboneContext?.path, e.path) ? this.backboneContext : this.backboneContext?.parent };
31616
31616
  }
31617
31617
  enterSlice(e, t) {
31618
- yo(e) && !this.peek()?.sliceName || (t.slicing = { discriminator: (e.slicing?.discriminator ?? []).map((n) => {
31618
+ vo(e) && !this.peek()?.sliceName || (t.slicing = { discriminator: (e.slicing?.discriminator ?? []).map((n) => {
31619
31619
  if (n.type !== "value" && n.type !== "pattern" && n.type !== "type") throw new Error(`Unsupported slicing discriminator type: ${n.type}`);
31620
31620
  return { path: n.path, type: n.type };
31621
31621
  }), slices: [], ordered: e.slicing?.ordered ?? false, rule: e.slicing?.rules }, this.slicingContext = { field: t.slicing, path: e.path ?? "" });
31622
31622
  }
31623
31623
  checkFieldExit(e = void 0) {
31624
- if (this.backboneContext && !Ie(this.backboneContext.path, e?.path)) if (this.backboneContext.parent) do
31624
+ if (this.backboneContext && !ke(this.backboneContext.path, e?.path)) if (this.backboneContext.parent) do
31625
31625
  this.innerTypes.push(this.backboneContext.type), this.backboneContext = this.backboneContext.parent;
31626
- while (this.backboneContext && !Ie(this.backboneContext.path, e?.path));
31626
+ while (this.backboneContext && !ke(this.backboneContext.path, e?.path));
31627
31627
  else this.innerTypes.push(this.backboneContext.type), this.backboneContext = void 0;
31628
31628
  }
31629
31629
  next() {
@@ -31642,7 +31642,7 @@ var fr = class {
31642
31642
  }
31643
31643
  isInnerType(e) {
31644
31644
  let t = this.peek();
31645
- return !!(Ie(e?.path, t?.path) && e.type?.some((n) => ["BackboneElement", "Element"].includes(n.code)));
31645
+ return !!(ke(e?.path, t?.path) && e.type?.some((n) => ["BackboneElement", "Element"].includes(n.code)));
31646
31646
  }
31647
31647
  parseSliceStart(e) {
31648
31648
  if (!this.slicingContext) throw new Error(`Invalid slice start before discriminator: ${e.sliceName} (${e.id})`);
@@ -31651,7 +31651,7 @@ var fr = class {
31651
31651
  parseElementDefinitionType(e) {
31652
31652
  return (e.type ?? []).map((t) => {
31653
31653
  let n;
31654
- return (t.code === "BackboneElement" || t.code === "Element") && (n = hr(e)), n || (n = ne(t, "http://hl7.org/fhir/StructureDefinition/structuredefinition-fhir-type")?.valueUrl), n || (n = t.code ?? ""), { code: n, targetProfile: t.targetProfile, profile: t.profile };
31654
+ return (t.code === "BackboneElement" || t.code === "Element") && (n = hr(e)), n || (n = ie(t, "http://hl7.org/fhir/StructureDefinition/structuredefinition-fhir-type")?.valueUrl), n || (n = t.code ?? ""), { code: n, targetProfile: t.targetProfile, profile: t.profile };
31655
31655
  });
31656
31656
  }
31657
31657
  parseElementDefinition(e) {
@@ -31662,27 +31662,27 @@ var fr = class {
31662
31662
  function An(r6) {
31663
31663
  return r6 === "*" ? Number.POSITIVE_INFINITY : Number.parseInt(r6, 10);
31664
31664
  }
31665
- function dr(r6, e = "") {
31666
- return mo(r6.path, e);
31665
+ function pr(r6, e = "") {
31666
+ return xo(r6.path, e);
31667
31667
  }
31668
- function mo(r6, e) {
31668
+ function xo(r6, e) {
31669
31669
  return r6 ? e && r6.startsWith(e) ? r6.substring(e.length + 1) : r6 : "";
31670
31670
  }
31671
- function Ie(r6, e) {
31671
+ function ke(r6, e) {
31672
31672
  return !r6 || !e ? false : e.startsWith(r6 + ".") || e === r6;
31673
31673
  }
31674
31674
  function On(r6) {
31675
31675
  return Array.isArray(r6) && r6.length > 0 ? r6[0] : S(r6) ? void 0 : r6;
31676
31676
  }
31677
- function yo(r6) {
31677
+ function vo(r6) {
31678
31678
  let e = r6.slicing?.discriminator;
31679
31679
  return !!(r6.type?.some((t) => t.code === "Extension") && e?.length === 1 && e[0].type === "value" && e[0].path === "url");
31680
31680
  }
31681
- function go(r6) {
31681
+ function To(r6) {
31682
31682
  let e = r6.description;
31683
31683
  return e?.startsWith(`Base StructureDefinition for ${r6.name} Type: `) && (e = e.substring(`Base StructureDefinition for ${r6.name} Type: `.length)), e;
31684
31684
  }
31685
- var To = new Pe(1e3);
31685
+ var Eo = new we(1e3);
31686
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: /.*/ };
31687
31687
  function h(r6) {
31688
31688
  return [{ type: l.boolean, value: r6 }];
@@ -31690,7 +31690,7 @@ function h(r6) {
31690
31690
  function v(r6) {
31691
31691
  return r6 == null ? { type: "undefined", value: void 0 } : Number.isSafeInteger(r6) ? { type: l.integer, value: r6 } : typeof r6 == "number" ? { type: l.decimal, value: r6 } : typeof r6 == "boolean" ? { type: l.boolean, value: r6 } : typeof r6 == "string" ? { type: l.string, value: r6 } : k(r6) ? { type: l.Quantity, value: r6 } : A(r6) ? { type: r6.resourceType, value: r6 } : Or(r6) ? { type: l.CodeableConcept, value: r6 } : Ar(r6) ? { type: l.Coding, value: r6 } : { type: l.BackboneElement, value: r6 };
31692
31692
  }
31693
- function _(r6) {
31693
+ function F(r6) {
31694
31694
  return r6.length === 0 ? false : !!r6[0].value;
31695
31695
  }
31696
31696
  function G(r6, e) {
@@ -31702,29 +31702,29 @@ function G(r6, e) {
31702
31702
  function C(r6, e, t) {
31703
31703
  if (!r6.value) return;
31704
31704
  let n = ft(r6.type, e, t?.profileUrl);
31705
- return n ? wo(r6, e, n) : Ao(r6, e);
31705
+ return n ? Io(r6, e, n) : ko(r6, e);
31706
31706
  }
31707
- function wo(r6, e, t) {
31707
+ function Io(r6, e, t) {
31708
31708
  let n = r6.value, i2 = t.type;
31709
31709
  if (!i2 || i2.length === 0) return;
31710
31710
  let o, s = "undefined", a2, c = t.path.lastIndexOf("."), u2 = t.path.substring(c + 1);
31711
- for (let p of i2) {
31712
- let m2 = u2.replace("[x]", I(p.code));
31711
+ for (let d2 of i2) {
31712
+ let m2 = u2.replace("[x]", I(d2.code));
31713
31713
  if (o = n[m2], a2 = n["_" + m2], o !== void 0 || a2 !== void 0) {
31714
- s = p.code;
31714
+ s = d2.code;
31715
31715
  break;
31716
31716
  }
31717
31717
  }
31718
31718
  if (a2) if (Array.isArray(o)) {
31719
31719
  o = o.slice();
31720
- for (let p = 0; p < Math.max(o.length, a2.length); p++) o[p] = Wn(o[p], a2[p]);
31720
+ for (let d2 = 0; d2 < Math.max(o.length, a2.length); d2++) o[d2] = Wn(o[d2], a2[d2]);
31721
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);
31722
+ if (!S(o)) return (s === "Element" || s === "BackboneElement") && (s = t.type[0].code), Array.isArray(o) ? o.map((d2) => Ln(d2, s)) : Ln(o, s);
31723
31723
  }
31724
- function Fn(r6, e) {
31724
+ function Ln(r6, e) {
31725
31725
  return e === "Resource" && A(r6) && (e = r6.resourceType), { type: e, value: r6 };
31726
31726
  }
31727
- function Ao(r6, e) {
31727
+ function ko(r6, e) {
31728
31728
  let t = r6.value;
31729
31729
  if (!t || typeof t != "object") return;
31730
31730
  let n;
@@ -31751,7 +31751,7 @@ function lt(r6) {
31751
31751
  let e = [];
31752
31752
  for (let t of r6) {
31753
31753
  let n = false;
31754
- for (let i2 of e) if (_($e(t, i2))) {
31754
+ for (let i2 of e) if (F($e(t, i2))) {
31755
31755
  n = true;
31756
31756
  break;
31757
31757
  }
@@ -31760,22 +31760,22 @@ function lt(r6) {
31760
31760
  return e;
31761
31761
  }
31762
31762
  function qn(r6) {
31763
- return h(!_(r6));
31763
+ return h(!F(r6));
31764
31764
  }
31765
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]))));
31766
+ return r6.length === 0 || e.length === 0 ? [] : r6.length !== e.length ? h(false) : h(r6.every((t, n) => F($e(t, e[n]))));
31767
31767
  }
31768
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]))));
31769
+ return r6.length === 0 || e.length === 0 ? [] : r6.length !== e.length ? h(true) : h(r6.some((t, n) => !F($e(t, e[n]))));
31770
31770
  }
31771
31771
  function $e(r6, e) {
31772
31772
  let t = r6.value?.valueOf(), n = e.value?.valueOf();
31773
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);
31774
31774
  }
31775
31775
  function Pr(r6, e) {
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])))));
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) => F(Do(t, e[n])))));
31777
31777
  }
31778
- function Oo(r6, e) {
31778
+ function Do(r6, e) {
31779
31779
  let { type: t, value: n } = r6, { type: i2, value: o } = e, s = n?.valueOf(), a2 = o?.valueOf();
31780
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);
31781
31781
  }
@@ -31783,7 +31783,7 @@ function Nn(r6, e) {
31783
31783
  let t = r6.value?.valueOf(), n = e.value?.valueOf();
31784
31784
  return typeof t == "number" && typeof n == "number" ? t - n : typeof t == "string" && typeof n == "string" ? t.localeCompare(n) : 0;
31785
31785
  }
31786
- function pt(r6, e) {
31786
+ function dt(r6, e) {
31787
31787
  let { value: t } = r6;
31788
31788
  if (t == null) return false;
31789
31789
  let n = e;
@@ -31796,11 +31796,11 @@ function pt(r6, e) {
31796
31796
  case "Date":
31797
31797
  return Gn(t);
31798
31798
  case "DateTime":
31799
- return De(t);
31799
+ return Ve(t);
31800
31800
  case "Time":
31801
31801
  return typeof t == "string" && !!/^T\d/.exec(t);
31802
31802
  case "Period":
31803
- return dt(t);
31803
+ return pt(t);
31804
31804
  case "Quantity":
31805
31805
  return k(t);
31806
31806
  default:
@@ -31810,11 +31810,11 @@ function pt(r6, e) {
31810
31810
  function Gn(r6) {
31811
31811
  return typeof r6 == "string" && !!ut.date.exec(r6);
31812
31812
  }
31813
- function De(r6) {
31813
+ function Ve(r6) {
31814
31814
  return typeof r6 == "string" && !!ut.dateTime.exec(r6);
31815
31815
  }
31816
- function dt(r6) {
31817
- return !!(r6 && typeof r6 == "object" && ("start" in r6 && De(r6.start) || "end" in r6 && De(r6.end)));
31816
+ function pt(r6) {
31817
+ return !!(r6 && typeof r6 == "object" && ("start" in r6 && Ve(r6.start) || "end" in r6 && Ve(r6.end)));
31818
31818
  }
31819
31819
  function k(r6) {
31820
31820
  return !!(r6 && typeof r6 == "object" && "value" in r6 && typeof r6.value == "number");
@@ -31839,37 +31839,37 @@ function Bn(r6) {
31839
31839
  function Wn(r6, e) {
31840
31840
  if (e) {
31841
31841
  if (typeof e != "object") throw new Error("Primitive extension must be an object");
31842
- return Io(r6 ?? {}, e);
31842
+ return Vo(r6 ?? {}, e);
31843
31843
  }
31844
31844
  return r6;
31845
31845
  }
31846
- function Io(r6, e) {
31846
+ function Vo(r6, e) {
31847
31847
  return delete e.__proto__, delete e.constructor, Object.assign(r6, e);
31848
31848
  }
31849
31849
  function kr(r6, e) {
31850
31850
  return A(r6, e) && "id" in r6 && typeof r6.id == "string";
31851
31851
  }
31852
- function he(r6) {
31853
- let e = B(r6) ?? "undefined/undefined", t = Do(r6);
31852
+ function me(r6) {
31853
+ let e = W(r6) ?? "undefined/undefined", t = _o(r6);
31854
31854
  return t === e ? { reference: e } : { reference: e, display: t };
31855
31855
  }
31856
- function B(r6) {
31857
- if (X(r6)) return r6.reference;
31856
+ function W(r6) {
31857
+ if (Y(r6)) return r6.reference;
31858
31858
  if (kr(r6)) return `${r6.resourceType}/${r6.id}`;
31859
31859
  }
31860
- function me(r6) {
31861
- if (r6) return X(r6) ? r6.reference.split("/")[1] : r6.id;
31860
+ function ye(r6) {
31861
+ if (r6) return Y(r6) ? r6.reference.split("/")[1] : r6.id;
31862
31862
  }
31863
- function ko(r6) {
31863
+ function Mo(r6) {
31864
31864
  return r6.resourceType === "Patient" || r6.resourceType === "Practitioner" || r6.resourceType === "RelatedPerson";
31865
31865
  }
31866
- function Do(r6) {
31867
- if (ko(r6)) {
31868
- let e = Vo(r6);
31866
+ function _o(r6) {
31867
+ if (Mo(r6)) {
31868
+ let e = Fo(r6);
31869
31869
  if (e) return e;
31870
31870
  }
31871
31871
  if (r6.resourceType === "Device") {
31872
- let e = Mo(r6);
31872
+ let e = Lo(r6);
31873
31873
  if (e) return e;
31874
31874
  }
31875
31875
  if (r6.resourceType === "MedicationRequest" && r6.medicationCodeableConcept) return Ge(r6.medicationCodeableConcept);
@@ -31879,15 +31879,15 @@ function Do(r6) {
31879
31879
  if ("code" in r6 && r6.code) {
31880
31880
  let e = r6.code;
31881
31881
  if (Array.isArray(e) && (e = e[0]), Or(e)) return Ge(e);
31882
- if (qo(e)) return e.text;
31882
+ if (Go(e)) return e.text;
31883
31883
  }
31884
- return B(r6) ?? "";
31884
+ return W(r6) ?? "";
31885
31885
  }
31886
- function Vo(r6) {
31886
+ function Fo(r6) {
31887
31887
  let e = r6.name;
31888
31888
  if (e && e.length > 0) return He(e[0]);
31889
31889
  }
31890
- function Mo(r6) {
31890
+ function Lo(r6) {
31891
31891
  let e = r6.deviceName;
31892
31892
  if (e && e.length > 0) return e[0].name;
31893
31893
  }
@@ -31896,14 +31896,14 @@ function ht(r6, e) {
31896
31896
  t.setUTCHours(0, 0, 0, 0);
31897
31897
  let n = e ? new Date(e) : /* @__PURE__ */ new Date();
31898
31898
  n.setUTCHours(0, 0, 0, 0);
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--;
31899
+ let i2 = t.getUTCFullYear(), o = t.getUTCMonth(), s = t.getUTCDate(), a2 = n.getUTCFullYear(), c = n.getUTCMonth(), u2 = n.getUTCDate(), d2 = a2 - i2;
31900
+ (c < o || c === o && u2 < s) && d2--;
31901
31901
  let m2 = a2 * 12 + c - (i2 * 12 + o);
31902
31902
  u2 < s && m2--;
31903
31903
  let x = Math.floor((n.getTime() - t.getTime()) / (1e3 * 60 * 60 * 24));
31904
- return { years: p, months: m2, days: x };
31904
+ return { years: d2, months: m2, days: x };
31905
31905
  }
31906
- function ne(r6, ...e) {
31906
+ function ie(r6, ...e) {
31907
31907
  let t = r6;
31908
31908
  for (let n = 0; n < e.length && t; n++) t = t?.extension?.find((i2) => i2.url === e[n]);
31909
31909
  return t;
@@ -31913,9 +31913,9 @@ function mt(r6, e) {
31913
31913
  return JSON.stringify(t, null, e ? 2 : void 0) ?? "";
31914
31914
  }
31915
31915
  function Dr(r6) {
31916
- if (!(r6 == null || r6 === "")) return typeof r6 == "object" ? Array.isArray(r6) ? Lo(r6) : Fo(r6) : r6;
31916
+ if (!(r6 == null || r6 === "")) return typeof r6 == "object" ? Array.isArray(r6) ? Uo(r6) : Bo(r6) : r6;
31917
31917
  }
31918
- function Lo(r6) {
31918
+ function Uo(r6) {
31919
31919
  let e = r6.length;
31920
31920
  if (e === 0) return;
31921
31921
  let t, n = 0;
@@ -31925,7 +31925,7 @@ function Lo(r6) {
31925
31925
  }
31926
31926
  if (n !== 0) return t ?? r6;
31927
31927
  }
31928
- function Fo(r6) {
31928
+ function Bo(r6) {
31929
31929
  let e, t = 0;
31930
31930
  for (let n in r6) {
31931
31931
  let i2 = r6[n], o = Dr(i2);
@@ -31936,27 +31936,27 @@ function Fo(r6) {
31936
31936
  function S(r6) {
31937
31937
  if (r6 == null) return true;
31938
31938
  let e = typeof r6;
31939
- return e === "string" || e === "object" ? !Y(r6) : false;
31939
+ return e === "string" || e === "object" ? !Z(r6) : false;
31940
31940
  }
31941
- function Y(r6) {
31941
+ function Z(r6) {
31942
31942
  if (r6 == null) return false;
31943
31943
  let e = typeof r6;
31944
31944
  return e === "string" && r6 !== "" || e === "object" && ("length" in r6 && r6.length > 0 || Object.keys(r6).length > 0);
31945
31945
  }
31946
- function ie(r6, e, t) {
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);
31946
+ function oe(r6, e, t) {
31947
+ return r6 === e || S(r6) && S(e) ? true : S(r6) || S(e) ? false : Array.isArray(r6) && Array.isArray(e) ? Wo(r6, e) : Array.isArray(r6) || Array.isArray(e) ? false : E(r6) && E(e) ? qo(r6, e, t) : (E(r6) || E(e), false);
31948
31948
  }
31949
- function No(r6, e) {
31949
+ function Wo(r6, e) {
31950
31950
  if (r6.length !== e.length) return false;
31951
- for (let t = 0; t < r6.length; t++) if (!ie(r6[t], e[t])) return false;
31951
+ for (let t = 0; t < r6.length; t++) if (!oe(r6[t], e[t])) return false;
31952
31952
  return true;
31953
31953
  }
31954
- function Uo(r6, e, t) {
31954
+ function qo(r6, e, t) {
31955
31955
  let n = /* @__PURE__ */ new Set();
31956
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"));
31957
31957
  for (let i2 of n) {
31958
31958
  let o = r6[i2], s = e[i2];
31959
- if (!ie(o, s, i2)) return false;
31959
+ if (!oe(o, s, i2)) return false;
31960
31960
  }
31961
31961
  return true;
31962
31962
  }
@@ -31975,7 +31975,7 @@ function Ar(r6) {
31975
31975
  function Or(r6) {
31976
31976
  return E(r6) && "coding" in r6 && Array.isArray(r6.coding) && r6.coding.every(Ar);
31977
31977
  }
31978
- function qo(r6) {
31978
+ function Go(r6) {
31979
31979
  return E(r6) && "text" in r6 && typeof r6.text == "string";
31980
31980
  }
31981
31981
  var Xn = [];
@@ -32002,52 +32002,52 @@ var _r = (r6) => new Promise((e) => {
32002
32002
  function yt(r6) {
32003
32003
  return r6.sort((e, t) => e.localeCompare(t));
32004
32004
  }
32005
- function Fr(r6) {
32005
+ function Lr(r6) {
32006
32006
  return r6.endsWith("/") ? r6 : r6 + "/";
32007
32007
  }
32008
- function Jo(r6) {
32008
+ function Yo(r6) {
32009
32009
  return r6.startsWith("/") ? r6.slice(1) : r6;
32010
32010
  }
32011
- function W(r6, e) {
32012
- return new URL(Jo(e), Fr(r6.toString())).toString();
32011
+ function q(r6, e) {
32012
+ return new URL(Yo(e), Lr(r6.toString())).toString();
32013
32013
  }
32014
32014
  function ii(r6, e) {
32015
- return W(r6, e).toString().replace("http://", "ws://").replace("https://", "wss://");
32015
+ return q(r6, e).toString().replace("http://", "ws://").replace("https://", "wss://");
32016
32016
  }
32017
32017
  function oi(r6) {
32018
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();
32019
32019
  }
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
+ 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])$/;
32021
+ function Pl(r6) {
32022
+ return Zo.test(r6);
32023
32023
  }
32024
32024
  function He(r6, e) {
32025
32025
  if (!r6) return "";
32026
32026
  let t = [];
32027
32027
  if (r6.prefix && e?.prefix !== false && t.push(...r6.prefix), r6.given && t.push(...r6.given), r6.family && t.push(r6.family), r6.suffix && e?.suffix !== false && t.push(...r6.suffix), r6.use && (e?.all || e?.use) && t.push("[" + r6.use + "]"), t.length === 0) {
32028
- let n = ge(r6.text);
32028
+ let n = xe(r6.text);
32029
32029
  if (n) return n;
32030
32030
  }
32031
32031
  return t.join(" ").trim();
32032
32032
  }
32033
32033
  function Ge(r6) {
32034
32034
  if (!r6) return "";
32035
- let e = ge(r6.text);
32035
+ let e = xe(r6.text);
32036
32036
  return e || (r6.coding ? r6.coding.map((t) => si(t)).join(", ") : "");
32037
32037
  }
32038
32038
  function si(r6, e) {
32039
- let t = ge(r6?.display);
32039
+ let t = xe(r6?.display);
32040
32040
  if (t) {
32041
- let n = e ? ge(r6?.code) : void 0;
32041
+ let n = e ? xe(r6?.code) : void 0;
32042
32042
  return `${t}${n ? " (" + n + ")" : ""}`;
32043
32043
  }
32044
- return ge(r6?.code) ?? "";
32044
+ return xe(r6?.code) ?? "";
32045
32045
  }
32046
- function ge(r6) {
32046
+ function xe(r6) {
32047
32047
  return typeof r6 == "string" ? r6 : void 0;
32048
32048
  }
32049
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" };
32050
- function Ln(r6) {
32050
+ function Fn(r6) {
32051
32051
  let e = Array.isArray(r6) ? r6 : r6.entry?.map((t) => t.resource) ?? [];
32052
32052
  for (let t of e) t?.resourceType === "StructureDefinition" && t.kind === "resource" && ui(t.type);
32053
32053
  }
@@ -32063,16 +32063,16 @@ function Br(r6) {
32063
32063
  }
32064
32064
  function hr(r6) {
32065
32065
  let e = r6.type?.[0]?.code;
32066
- return e === "BackboneElement" || e === "Element" ? as((r6.base?.path ?? r6.path)?.split(".")) : e;
32066
+ return e === "BackboneElement" || e === "Element" ? ls((r6.base?.path ?? r6.path)?.split(".")) : e;
32067
32067
  }
32068
- function as(r6) {
32068
+ function ls(r6) {
32069
32069
  return r6.length === 1 ? r6[0] : r6.map(I).join("");
32070
32070
  }
32071
32071
  function ft(r6, e, t) {
32072
32072
  let n = We(r6, t);
32073
- if (n) return ps(n.elements, e);
32073
+ if (n) return hs(n.elements, e);
32074
32074
  }
32075
- function ps(r6, e) {
32075
+ function hs(r6, e) {
32076
32076
  let t = r6[e] ?? r6[e + "[x]"];
32077
32077
  if (t) return t;
32078
32078
  for (let n = 0; n < e.length; n++) {
@@ -32086,11 +32086,11 @@ function ps(r6, e) {
32086
32086
  function A(r6, e) {
32087
32087
  return !(!r6 || typeof r6 != "object" || !("resourceType" in r6) || e && r6.resourceType !== e);
32088
32088
  }
32089
- function X(r6) {
32089
+ function Y(r6) {
32090
32090
  return !!(r6 && typeof r6 == "object" && "reference" in r6 && typeof r6.reference == "string");
32091
32091
  }
32092
32092
  var L = { types: {} };
32093
- function Me(r6) {
32093
+ function _e(r6) {
32094
32094
  if (r6.startsWith("T")) return r6 + "T00:00:00.000Z".substring(r6.length);
32095
32095
  if (r6.length <= 10) return r6;
32096
32096
  try {
@@ -32099,8 +32099,8 @@ function Me(r6) {
32099
32099
  return r6;
32100
32100
  }
32101
32101
  }
32102
- var Z = () => [];
32103
- var O = { empty: (r6, e) => h(e.length === 0 || e.every((t) => S(t.value))), hasValue: (r6, e) => h(e.length !== 0), exists: (r6, e, t) => t ? h(e.filter((n) => _(t.eval(r6, [n]))).length > 0) : h(e.length > 0 && e.every((n) => !S(n.value))), all: (r6, e, t) => h(e.every((n) => _(t.eval(r6, [n])))), allTrue: (r6, e) => {
32102
+ var ee = () => [];
32103
+ var O = { empty: (r6, e) => h(e.length === 0 || e.every((t) => S(t.value))), hasValue: (r6, e) => h(e.length !== 0), exists: (r6, e, t) => t ? h(e.filter((n) => F(t.eval(r6, [n]))).length > 0) : h(e.length > 0 && e.every((n) => !S(n.value))), all: (r6, e, t) => h(e.every((n) => F(t.eval(r6, [n])))), allTrue: (r6, e) => {
32104
32104
  for (let t of e) if (!t.value) return h(false);
32105
32105
  return h(true);
32106
32106
  }, anyTrue: (r6, e) => {
@@ -32114,16 +32114,16 @@ var O = { empty: (r6, e) => h(e.length === 0 || e.every((t) => S(t.value))), has
32114
32114
  return h(false);
32115
32115
  }, subsetOf: (r6, e, t) => {
32116
32116
  if (e.length === 0) return h(true);
32117
- let n = t.eval(r6, xe(r6));
32117
+ let n = t.eval(r6, ve(r6));
32118
32118
  return n.length === 0 ? h(false) : h(e.every((i2) => n.some((o) => o.value === i2.value)));
32119
32119
  }, supersetOf: (r6, e, t) => {
32120
- let n = t.eval(r6, xe(r6));
32120
+ let n = t.eval(r6, ve(r6));
32121
32121
  return n.length === 0 ? h(true) : e.length === 0 ? h(false) : h(n.every((i2) => e.some((o) => o.value === i2.value)));
32122
32122
  }, count: (r6, e) => [{ type: l.integer, value: e.length }], distinct: (r6, e) => {
32123
32123
  let t = [];
32124
32124
  for (let n of e) t.some((i2) => i2.value === n.value) || t.push(n);
32125
32125
  return t;
32126
- }, isDistinct: (r6, e) => h(e.length === O.distinct(r6, e).length), where: (r6, e, t) => e.filter((n) => _(t.eval(r6, [n]))), select: (r6, e, t) => e.map((n) => t.eval({ parent: r6, variables: { $this: n } }, [n])).flat(), repeat: Z, ofType: (r6, e, t) => e.filter((n) => n.type === t.name), single: (r6, e) => {
32126
+ }, isDistinct: (r6, e) => h(e.length === O.distinct(r6, e).length), where: (r6, e, t) => e.filter((n) => F(t.eval(r6, [n]))), select: (r6, e, t) => e.map((n) => t.eval({ parent: r6, variables: { $this: n } }, [n])).flat(), repeat: ee, ofType: (r6, e, t) => e.filter((n) => n.type === t.name), single: (r6, e) => {
32127
32127
  if (e.length > 1) throw new Error("Expected input length one for single()");
32128
32128
  return e.length === 0 ? [] : e.slice(0, 1);
32129
32129
  }, first: (r6, e) => e.length === 0 ? [] : e.slice(0, 1), last: (r6, e) => e.length === 0 ? [] : e.slice(e.length - 1, e.length), tail: (r6, e) => e.length === 0 ? [] : e.slice(1, e.length), skip: (r6, e, t) => {
@@ -32136,26 +32136,26 @@ var O = { empty: (r6, e) => h(e.length === 0 || e.every((t) => S(t.value))), has
32136
32136
  return n >= e.length ? e : n <= 0 ? [] : e.slice(0, n);
32137
32137
  }, intersect: (r6, e, t) => {
32138
32138
  if (!t) return e;
32139
- let n = t.eval(r6, xe(r6)), i2 = [];
32139
+ let n = t.eval(r6, ve(r6)), i2 = [];
32140
32140
  for (let o of e) !i2.some((s) => s.value === o.value) && n.some((s) => s.value === o.value) && i2.push(o);
32141
32141
  return i2;
32142
32142
  }, exclude: (r6, e, t) => {
32143
32143
  if (!t) return e;
32144
- let n = t.eval(r6, xe(r6)), i2 = [];
32144
+ let n = t.eval(r6, ve(r6)), i2 = [];
32145
32145
  for (let o of e) n.some((s) => s.value === o.value) || i2.push(o);
32146
32146
  return i2;
32147
32147
  }, union: (r6, e, t) => {
32148
32148
  if (!t) return e;
32149
- let n = t.eval(r6, xe(r6));
32149
+ let n = t.eval(r6, ve(r6));
32150
32150
  return lt([...e, ...n]);
32151
32151
  }, combine: (r6, e, t) => {
32152
32152
  if (!t) return e;
32153
- let n = t.eval(r6, xe(r6));
32153
+ let n = t.eval(r6, ve(r6));
32154
32154
  return [...e, ...n];
32155
32155
  }, htmlChecks: (r6, e, t) => [v(true)], iif: (r6, e, t, n, i2) => {
32156
32156
  let o = t.eval(r6, e);
32157
32157
  if (o.length > 1 || o.length === 1 && typeof o[0].value != "boolean") throw new Error("Expected criterion to evaluate to a Boolean");
32158
- return _(o) ? n.eval(r6, e) : i2 ? i2.eval(r6, e) : [];
32158
+ return F(o) ? n.eval(r6, e) : i2 ? i2.eval(r6, e) : [];
32159
32159
  }, toBoolean: (r6, e) => {
32160
32160
  if (e.length === 0) return [];
32161
32161
  let [{ value: t }] = z(e, 1);
@@ -32174,11 +32174,11 @@ var O = { empty: (r6, e) => h(e.length === 0 || e.every((t) => S(t.value))), has
32174
32174
  }, convertsToInteger: (r6, e) => e.length === 0 ? [] : h(O.toInteger(r6, e).length === 1), toDate: (r6, e) => {
32175
32175
  if (e.length === 0) return [];
32176
32176
  let [{ value: t }] = z(e, 1);
32177
- return typeof t == "string" && /^\d{4}(-\d{2}(-\d{2})?)?/.exec(t) ? [{ type: l.date, value: Me(t) }] : [];
32177
+ return typeof t == "string" && /^\d{4}(-\d{2}(-\d{2})?)?/.exec(t) ? [{ type: l.date, value: _e(t) }] : [];
32178
32178
  }, convertsToDate: (r6, e) => e.length === 0 ? [] : h(O.toDate(r6, e).length === 1), toDateTime: (r6, e) => {
32179
32179
  if (e.length === 0) return [];
32180
32180
  let [{ value: t }] = z(e, 1);
32181
- return typeof t == "string" && /^\d{4}(-\d{2}(-\d{2})?)?/.exec(t) ? [{ type: l.dateTime, value: Me(t) }] : [];
32181
+ return typeof t == "string" && /^\d{4}(-\d{2}(-\d{2})?)?/.exec(t) ? [{ type: l.dateTime, value: _e(t) }] : [];
32182
32182
  }, convertsToDateTime: (r6, e) => e.length === 0 ? [] : h(O.toDateTime(r6, e).length === 1), toDecimal: (r6, e) => {
32183
32183
  if (e.length === 0) return [];
32184
32184
  let [{ value: t }] = z(e, 1);
@@ -32196,17 +32196,17 @@ var O = { empty: (r6, e) => h(e.length === 0 || e.every((t) => S(t.value))), has
32196
32196
  let [{ value: t }] = z(e, 1);
32197
32197
  if (typeof t == "string") {
32198
32198
  let n = /^T?(\d{2}(:\d{2}(:\d{2})?)?)/.exec(t);
32199
- if (n) return [{ type: l.time, value: Me("T" + n[1]) }];
32199
+ if (n) return [{ type: l.time, value: _e("T" + n[1]) }];
32200
32200
  }
32201
32201
  return [];
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) => {
32202
+ }, convertsToTime: (r6, e) => e.length === 0 ? [] : h(O.toTime(r6, e).length === 1), indexOf: (r6, e, t) => N((n, i2) => n.indexOf(i2), r6, e, t), substring: (r6, e, t, n) => N((i2, o, s) => {
32203
32203
  let a2 = o, c = s ? a2 + s : i2.length;
32204
32204
  return a2 < 0 || a2 >= i2.length ? void 0 : i2.substring(a2, c);
32205
- }, r6, e, t, n), startsWith: (r6, e, t) => F((n, i2) => n.startsWith(i2), r6, e, t), endsWith: (r6, e, t) => F((n, i2) => n.endsWith(i2), r6, e, t), contains: (r6, e, t) => F((n, i2) => n.includes(i2), r6, e, t), upper: (r6, e) => F((t) => t.toUpperCase(), r6, e), lower: (r6, e) => F((t) => t.toLowerCase(), r6, e), replace: (r6, e, t, n) => F((i2, o, s) => i2.replaceAll(o, s), r6, e, t, n), matches: (r6, e, t) => F((n, i2) => !!new RegExp(i2).exec(n), r6, e, t), replaceMatches: (r6, e, t, n) => F((i2, o, s) => i2.replaceAll(new RegExp(o, "g"), s), r6, e, t, n), length: (r6, e) => F((t) => t.length, r6, e), toChars: (r6, e) => F((t) => t ? t.split("") : void 0, r6, e), encode: Z, decode: Z, escape: Z, unescape: Z, trim: Z, split: Z, join: (r6, e, t) => {
32206
- let n = t?.eval(r6, xe(r6))[0]?.value ?? "";
32205
+ }, r6, e, t, n), startsWith: (r6, e, t) => N((n, i2) => n.startsWith(i2), r6, e, t), endsWith: (r6, e, t) => N((n, i2) => n.endsWith(i2), r6, e, t), contains: (r6, e, t) => N((n, i2) => n.includes(i2), r6, e, t), upper: (r6, e) => N((t) => t.toUpperCase(), r6, e), lower: (r6, e) => N((t) => t.toLowerCase(), r6, e), replace: (r6, e, t, n) => N((i2, o, s) => i2.replaceAll(o, s), r6, e, t, n), matches: (r6, e, t) => N((n, i2) => !!new RegExp(i2).exec(n), r6, e, t), replaceMatches: (r6, e, t, n) => N((i2, o, s) => i2.replaceAll(new RegExp(o, "g"), s), r6, e, t, n), length: (r6, e) => N((t) => t.length, r6, e), toChars: (r6, e) => N((t) => t ? t.split("") : void 0, r6, e), encode: ee, decode: ee, escape: ee, unescape: ee, trim: ee, split: ee, join: (r6, e, t) => {
32206
+ let n = t?.eval(r6, ve(r6))[0]?.value ?? "";
32207
32207
  if (typeof n != "string") throw new Error("Separator must be a string.");
32208
32208
  return [{ type: l.string, value: e.map((i2) => i2.value?.toString() ?? "").join(n) }];
32209
- }, abs: (r6, e) => Q(Math.abs, r6, e), ceiling: (r6, e) => Q(Math.ceil, r6, e), exp: (r6, e) => Q(Math.exp, r6, e), floor: (r6, e) => Q(Math.floor, r6, e), ln: (r6, e) => Q(Math.log, r6, e), log: (r6, e, t) => Q((n, i2) => Math.log(n) / Math.log(i2), r6, e, t), power: (r6, e, t) => Q(Math.pow, r6, e, t), round: (r6, e) => Q(Math.round, r6, e), sqrt: (r6, e) => Q(Math.sqrt, r6, e), truncate: (r6, e) => Q((t) => t | 0, r6, e), children: Z, descendants: Z, trace: (r6, e, t) => e, now: () => [{ type: l.dateTime, value: (/* @__PURE__ */ new Date()).toISOString() }], timeOfDay: () => [{ type: l.time, value: (/* @__PURE__ */ new Date()).toISOString().substring(11) }], today: () => [{ type: l.date, value: (/* @__PURE__ */ new Date()).toISOString().substring(0, 10) }], between: (r6, e, t, n, i2) => {
32209
+ }, abs: (r6, e) => Q(Math.abs, r6, e), ceiling: (r6, e) => Q(Math.ceil, r6, e), exp: (r6, e) => Q(Math.exp, r6, e), floor: (r6, e) => Q(Math.floor, r6, e), ln: (r6, e) => Q(Math.log, r6, e), log: (r6, e, t) => Q((n, i2) => Math.log(n) / Math.log(i2), r6, e, t), power: (r6, e, t) => Q(Math.pow, r6, e, t), round: (r6, e) => Q(Math.round, r6, e), sqrt: (r6, e) => Q(Math.sqrt, r6, e), truncate: (r6, e) => Q((t) => t | 0, r6, e), children: ee, descendants: ee, trace: (r6, e, t) => e, now: () => [{ type: l.dateTime, value: (/* @__PURE__ */ new Date()).toISOString() }], timeOfDay: () => [{ type: l.time, value: (/* @__PURE__ */ new Date()).toISOString().substring(11) }], today: () => [{ type: l.date, value: (/* @__PURE__ */ new Date()).toISOString().substring(0, 10) }], between: (r6, e, t, n, i2) => {
32210
32210
  let o = O.toDateTime(r6, t.eval(r6, e));
32211
32211
  if (o.length === 0) throw new Error("Invalid start date");
32212
32212
  let s = O.toDateTime(r6, n.eval(r6, e));
@@ -32217,7 +32217,7 @@ var O = { empty: (r6, e) => h(e.length === 0 || e.every((t) => S(t.value))), has
32217
32217
  return [{ type: l.Quantity, value: { value: c[a2], unit: a2 } }];
32218
32218
  }, is: (r6, e, t) => {
32219
32219
  let 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) })) : [];
32220
+ return t instanceof V ? n = t.name : t instanceof J && (n = t.left.name + "." + t.right.name), n ? e.map((i2) => ({ type: l.boolean, value: dt(i2, n) })) : [];
32221
32221
  }, not: (r6, e) => O.toBoolean(r6, e).map((t) => ({ type: l.boolean, value: !t.value })), resolve: (r6, e) => e.map((t) => {
32222
32222
  let n = t.value, i2;
32223
32223
  if (typeof n == "string") i2 = n;
@@ -32247,16 +32247,16 @@ var O = { empty: (r6, e) => h(e.length === 0 || e.every((t) => S(t.value))), has
32247
32247
  let n = e[0].value;
32248
32248
  if (!n?.reference) return [];
32249
32249
  let i2 = "";
32250
- return t instanceof q && (i2 = t.name), i2 && !n.reference.startsWith(i2 + "/") ? [] : [{ type: l.id, value: me(n) }];
32250
+ return t instanceof V && (i2 = t.name), i2 && !n.reference.startsWith(i2 + "/") ? [] : [{ type: l.id, value: ye(n) }];
32251
32251
  }, extension: (r6, e, t) => {
32252
32252
  let n = t.eval(r6, e)[0].value, i2 = e?.[0]?.value;
32253
32253
  if (i2) {
32254
- let o = ne(i2, n);
32254
+ let o = ie(i2, n);
32255
32255
  if (o) return [{ type: l.Extension, value: o }];
32256
32256
  }
32257
32257
  return [];
32258
32258
  } };
32259
- function F(r6, e, t, ...n) {
32259
+ function N(r6, e, t, ...n) {
32260
32260
  if (t.length === 0) return [];
32261
32261
  let [{ value: i2 }] = z(t, 1);
32262
32262
  if (typeof i2 != "string") throw new Error("String function cannot be called with non-string");
@@ -32267,7 +32267,7 @@ function Q(r6, e, t, ...n) {
32267
32267
  if (t.length === 0) return [];
32268
32268
  let [{ value: i2 }] = z(t, 1), o = k(i2), s = o ? i2.value : i2;
32269
32269
  if (typeof s != "number") throw new Error("Math function cannot be called with non-number");
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;
32270
+ 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;
32271
32271
  return [{ type: c, value: u2 }];
32272
32272
  }
32273
32273
  function z(r6, e) {
@@ -32275,12 +32275,12 @@ function z(r6, e) {
32275
32275
  for (let t of r6) if (t == null) throw new Error("Expected non-null argument");
32276
32276
  return r6;
32277
32277
  }
32278
- function xe(r6) {
32278
+ function ve(r6) {
32279
32279
  let e = r6;
32280
32280
  for (; e.parent?.variables.$this; ) e = e.parent;
32281
32281
  return [e.variables.$this];
32282
32282
  }
32283
- var N = class {
32283
+ var U = class {
32284
32284
  constructor(e) {
32285
32285
  this.value = e;
32286
32286
  }
@@ -32292,7 +32292,7 @@ var N = class {
32292
32292
  return typeof e == "string" ? `'${e}'` : e.toString();
32293
32293
  }
32294
32294
  };
32295
- var q = class {
32295
+ var V = class {
32296
32296
  constructor(e) {
32297
32297
  this.name = e;
32298
32298
  }
@@ -32335,7 +32335,7 @@ var xt = class extends rt {
32335
32335
  return this.operator + this.child.toString();
32336
32336
  }
32337
32337
  };
32338
- var ce = class extends te {
32338
+ var ue = class extends re {
32339
32339
  constructor(e, t) {
32340
32340
  super("as", e, t);
32341
32341
  }
@@ -32343,7 +32343,7 @@ var ce = class extends te {
32343
32343
  return O.ofType(e, this.left.eval(e, t), this.right);
32344
32344
  }
32345
32345
  };
32346
- var R = class extends te {
32346
+ var R = class extends re {
32347
32347
  };
32348
32348
  var D = class extends R {
32349
32349
  constructor(e, t, n, i2) {
@@ -32358,7 +32358,7 @@ var D = class extends R {
32358
32358
  return typeof u2 == "boolean" ? h(u2) : k(o) ? [{ type: l.Quantity, value: { ...o, value: u2 } }] : [v(u2)];
32359
32359
  }
32360
32360
  };
32361
- var vt = class extends te {
32361
+ var vt = class extends re {
32362
32362
  constructor(e, t) {
32363
32363
  super("&", e, t);
32364
32364
  }
@@ -32385,7 +32385,7 @@ var St = class extends R {
32385
32385
  return n ? h(i2.some((o) => $e(n, o)[0].value)) : [];
32386
32386
  }
32387
32387
  };
32388
- var ae = class extends te {
32388
+ var J = class extends re {
32389
32389
  constructor(e, t) {
32390
32390
  super(".", e, t);
32391
32391
  }
@@ -32396,7 +32396,7 @@ var ae = class extends te {
32396
32396
  return `${this.left.toString()}.${this.right.toString()}`;
32397
32397
  }
32398
32398
  };
32399
- var ve = class extends te {
32399
+ var Te = class extends re {
32400
32400
  constructor(e, t) {
32401
32401
  super("|", e, t);
32402
32402
  }
@@ -32441,7 +32441,7 @@ var Ct = class extends R {
32441
32441
  return qn(Pr(n, i2));
32442
32442
  }
32443
32443
  };
32444
- var Te = class extends R {
32444
+ var Se = class extends R {
32445
32445
  constructor(e, t) {
32446
32446
  super("is", e, t);
32447
32447
  }
@@ -32449,7 +32449,7 @@ var Te = class extends R {
32449
32449
  let n = this.left.eval(e, t);
32450
32450
  if (n.length !== 1) return [];
32451
32451
  let i2 = this.right.name;
32452
- return h(pt(n[0], i2));
32452
+ return h(dt(n[0], i2));
32453
32453
  }
32454
32454
  };
32455
32455
  var Pt = class extends R {
@@ -32488,7 +32488,7 @@ var Ot = class extends R {
32488
32488
  return i2?.value === true || n?.value === false ? h(true) : !n || !i2 ? [] : h(false);
32489
32489
  }
32490
32490
  };
32491
- var ee = class {
32491
+ var te = class {
32492
32492
  constructor(e, t) {
32493
32493
  this.name = e, this.args = t;
32494
32494
  }
@@ -32501,7 +32501,7 @@ var ee = class {
32501
32501
  return `${this.name}(${this.args.map((e) => e.toString()).join(", ")})`;
32502
32502
  }
32503
32503
  };
32504
- var Se = class {
32504
+ var be = class {
32505
32505
  constructor(e, t) {
32506
32506
  this.left = e, this.expr = t;
32507
32507
  }
@@ -32519,37 +32519,37 @@ var Se = class {
32519
32519
  };
32520
32520
  var ze = ["!=", "!~", "<=", ">=", "{}", "->"];
32521
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 };
32522
- var hs = { parse(r6) {
32522
+ var gs = { parse(r6) {
32523
32523
  let e = r6.consumeAndParse();
32524
32524
  if (!r6.match(")")) throw new Error("Parse error: expected `)` got `" + r6.peek()?.value + "`");
32525
32525
  return e;
32526
32526
  } };
32527
- var ms = { parse(r6, e) {
32527
+ var xs = { parse(r6, e) {
32528
32528
  let t = r6.consumeAndParse();
32529
32529
  if (!r6.match("]")) throw new Error("Parse error: expected `]`");
32530
- return new Se(e, t);
32530
+ return new be(e, t);
32531
32531
  }, precedence: g.Indexer };
32532
- var ys = { parse(r6, e) {
32533
- if (!(e instanceof q)) throw new Error("Unexpected parentheses");
32532
+ var vs = { parse(r6, e) {
32533
+ if (!(e instanceof V)) throw new Error("Unexpected parentheses");
32534
32534
  let t = [];
32535
32535
  for (; !r6.match(")"); ) t.push(r6.consumeAndParse()), r6.match(",");
32536
- return new ee(e.name, t);
32536
+ return new te(e.name, t);
32537
32537
  }, precedence: g.FunctionCall };
32538
- function gs(r6) {
32538
+ function Ts(r6) {
32539
32539
  let e = r6.split(" "), t = parseFloat(e[0]), n = e[1];
32540
32540
  return n?.startsWith("'") && n.endsWith("'") ? n = n.substring(1, n.length - 1) : n = "{" + n + "}", { value: t, unit: n };
32541
32541
  }
32542
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));
32543
+ return new nt().registerPrefix("String", { parse: (r6, e) => new U({ type: l.string, value: e.value }) }).registerPrefix("DateTime", { parse: (r6, e) => new U({ type: l.dateTime, value: _e(e.value) }) }).registerPrefix("Quantity", { parse: (r6, e) => new U({ type: l.Quantity, value: Ts(e.value) }) }).registerPrefix("Number", { parse: (r6, e) => new U({ type: e.value.includes(".") ? l.decimal : l.integer, value: parseFloat(e.value) }) }).registerPrefix("true", { parse: () => new U({ type: l.boolean, value: true }) }).registerPrefix("false", { parse: () => new U({ type: l.boolean, value: false }) }).registerPrefix("Symbol", { parse: (r6, e) => new V(e.value) }).registerPrefix("{}", { parse: () => new gt() }).registerPrefix("(", gs).registerInfix("[", xs).registerInfix("(", vs).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 J(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 Te(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 ue(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 Se(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));
32544
32544
  }
32545
- var xs = Je();
32545
+ var Ss = Je();
32546
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" };
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 };
32547
+ var Ti = { 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 };
32548
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 };
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) {
32549
+ var Is = [f.MISSING, f.PRESENT];
32550
+ var Ee = { READ: "read", VREAD: "vread", UPDATE: "update", DELETE: "delete", HISTORY: "history", CREATE: "create", SEARCH: "search" };
32551
+ var Ks = [Ee.READ, Ee.VREAD, Ee.HISTORY, Ee.SEARCH];
32552
+ function Zs(r6) {
32553
32553
  if (typeof window < "u") {
32554
32554
  let e = window.atob(r6), t = Uint8Array.from(e, (n) => n.charCodeAt(0));
32555
32555
  return new window.TextDecoder().decode(t);
@@ -32557,7 +32557,7 @@ function Xs(r6) {
32557
32557
  if (typeof Buffer < "u") return Buffer.from(r6, "base64").toString("utf-8");
32558
32558
  throw new Error("Unable to decode base64");
32559
32559
  }
32560
- function Ft(r6) {
32560
+ function Lt(r6) {
32561
32561
  if (typeof window < "u") {
32562
32562
  let e = new window.TextEncoder().encode(r6), t = String.fromCharCode.apply(null, e);
32563
32563
  return window.btoa(t);
@@ -32565,19 +32565,19 @@ function Ft(r6) {
32565
32565
  if (typeof Buffer < "u") return Buffer.from(r6, "utf8").toString("base64");
32566
32566
  throw new Error("Unable to encode base64");
32567
32567
  }
32568
- function Si(r6) {
32568
+ function Ri(r6) {
32569
32569
  r6 = r6.padEnd(r6.length + (4 - r6.length % 4) % 4, "=");
32570
32570
  let e = r6.replace(/-/g, "+").replace(/_/g, "/");
32571
- return Xs(e);
32571
+ return Zs(e);
32572
32572
  }
32573
32573
  function $r() {
32574
32574
  let r6 = new Uint32Array(28);
32575
32575
  return crypto.getRandomValues(r6), Yn(r6.buffer);
32576
32576
  }
32577
- async function bi(r6) {
32577
+ async function Ci(r6) {
32578
32578
  return crypto.subtle.digest("SHA-256", new TextEncoder().encode(r6));
32579
32579
  }
32580
- function Ee() {
32580
+ function Re() {
32581
32581
  return "xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g, (r6) => {
32582
32582
  let e = Math.random() * 16 | 0;
32583
32583
  return (r6 === "x" ? e : e & 3 | 8).toString(16);
@@ -32609,7 +32609,7 @@ var Gr = class {
32609
32609
  this.listeners = {};
32610
32610
  }
32611
32611
  };
32612
- var J = class {
32612
+ var K = class {
32613
32613
  constructor() {
32614
32614
  this.emitter = new Gr();
32615
32615
  }
@@ -32627,72 +32627,72 @@ var J = class {
32627
32627
  }
32628
32628
  };
32629
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"];
32630
+ var oa = ["Patient", "Encounter", "ImagingStudy", "DiagnosticReport", "OperationOutcome", "Bundle"];
32631
32631
  var Qr = ["DiagnosticReport-update"];
32632
- function Ri(r6) {
32632
+ function wi(r6) {
32633
32633
  return Qr.includes(r6);
32634
32634
  }
32635
- function Ci(r6) {
32636
- if (Qr.includes(r6)) throw new d(y(`'context.version' is required for '${r6}'.`));
32635
+ function Ai(r6) {
32636
+ if (Qr.includes(r6)) throw new p(y(`'context.version' is required for '${r6}'.`));
32637
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);
32638
+ var sa = { "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 aa(r6) {
32640
+ return oa.includes(r6);
32641
32641
  }
32642
- function Pi(r6) {
32642
+ function Oi(r6) {
32643
32643
  return !!r6.endpoint;
32644
32644
  }
32645
32645
  function zr(r6) {
32646
- if (!Ut(r6)) throw new d(y("subscriptionRequest must be an object conforming to SubscriptionRequest type."));
32646
+ if (!Ut(r6)) throw new p(y("subscriptionRequest must be an object conforming to SubscriptionRequest type."));
32647
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(",") };
32648
- return Pi(r6) && (o.endpoint = r6.endpoint), new URLSearchParams(o).toString();
32648
+ return Oi(r6) && (o.endpoint = r6.endpoint), new URLSearchParams(o).toString();
32649
32649
  }
32650
32650
  function Ut(r6) {
32651
32651
  if (typeof r6 != "object") return false;
32652
32652
  let { channelType: e, mode: t, topic: n, events: i2 } = r6;
32653
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;
32654
32654
  for (let o of i2) if (!Hr[o]) return false;
32655
- return !(Pi(r6) && !(typeof r6.endpoint == "string" && r6.endpoint.startsWith("ws")));
32655
+ return !(Oi(r6) && !(typeof r6.endpoint == "string" && r6.endpoint.startsWith("ws")));
32656
32656
  }
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.`));
32657
+ function ca(r6, e, t, n) {
32658
+ 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.`));
32659
+ if (!(e.id && typeof e.id == "string")) throw new p(y(`context[${t}] is invalid. Resource must contain a valid string ID.`));
32660
+ if (!e.resourceType) throw new p(y(`context[${t}] is invalid. Resource must contain a resource type. No resource type found.`));
32661
32661
  let i2 = n.resourceType;
32662
32662
  if (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
+ if (!aa(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.`));
32664
+ 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}.`));
32665
32665
  }
32666
32666
  }
32667
- function aa(r6, e, t, n, i2) {
32667
+ function ua(r6, e, t, n, i2) {
32668
32668
  if (i2.set(e.key, (i2.get(e.key) ?? 0) + 1), n.reference) {
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
+ if (!Y(e.reference)) throw new p(y(`context[${t}] is invalid. Expected key '${e.key}' to be a reference.`));
32670
+ } else ca(r6, e.resource, t, n);
32671
32671
  }
32672
- function ca(r6, e) {
32673
- let t = /* @__PURE__ */ new Map(), n = ia[r6];
32672
+ function la(r6, e) {
32673
+ let t = /* @__PURE__ */ new Map(), n = sa[r6];
32674
32674
  for (let i2 = 0; i2 < e.length; i2++) {
32675
32675
  let o = e[i2].key;
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
+ if (!n[o]) throw new p(y(`Key '${o}' not found for event '${r6}'. Make sure to add only valid keys.`));
32677
+ ua(r6, e[i2], i2, n[o], t);
32678
32678
  }
32679
32679
  for (let [i2, o] of Object.entries(n)) {
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
+ if (!(o.optional || t.has(i2))) throw new p(y(`Missing required key '${i2}' on context for '${r6}' event.`));
32681
+ 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.`));
32682
32682
  }
32683
32683
  }
32684
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'.`));
32685
+ if (!(r6 && typeof r6 == "string")) throw new p(y("Must provide a topic."));
32686
+ if (!Hr[e]) throw new p(y(`Must provide a valid FHIRcast event name. Supported events: ${Object.keys(Hr).join(", ")}`));
32687
+ if (typeof t != "object") throw new p(y("context must be a context object or array of context objects."));
32688
+ if (Qr.includes(e) && !n) throw new p(y(`The '${e}' event must contain a 'context.versionId'.`));
32689
32689
  let i2 = Array.isArray(t) ? t : [t];
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 } : {} } };
32690
+ return la(e, i2), { timestamp: (/* @__PURE__ */ new Date()).toISOString(), id: Re(), event: { "hub.topic": r6, "hub.event": e, context: i2, ...n ? { "context.versionId": n } : {} } };
32691
32691
  }
32692
- var Nt = class extends J {
32692
+ var Nt = class extends K {
32693
32693
  constructor(e) {
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
+ if (super(), this.subRequest = e, !e.endpoint) throw new p(y("Subscription request should contain an endpoint."));
32695
+ if (!Ut(e)) throw new p(y("Subscription request failed validation."));
32696
32696
  let t = new WebSocket(e.endpoint);
32697
32697
  t.addEventListener("open", () => {
32698
32698
  this.dispatchEvent({ type: "connect" }), t.addEventListener("message", (n) => {
@@ -32709,24 +32709,24 @@ var Nt = class extends J {
32709
32709
  this.websocket.close();
32710
32710
  }
32711
32711
  };
32712
- function ua(r6) {
32713
- return JSON.parse(Si(r6));
32712
+ function da(r6) {
32713
+ return JSON.parse(Ri(r6));
32714
32714
  }
32715
- function wi(r6) {
32715
+ function Ii(r6) {
32716
32716
  return r6.split(".").length === 3;
32717
32717
  }
32718
32718
  function Bt(r6) {
32719
32719
  let [e, t, n] = r6.split(".");
32720
- return ua(t);
32720
+ return da(t);
32721
32721
  }
32722
- function Ai(r6) {
32722
+ function ki(r6) {
32723
32723
  try {
32724
32724
  return typeof Bt(r6).login_id == "string";
32725
32725
  } catch {
32726
32726
  return false;
32727
32727
  }
32728
32728
  }
32729
- function Oi(r6) {
32729
+ function Di(r6) {
32730
32730
  try {
32731
32731
  let t = Bt(r6).exp;
32732
32732
  return typeof t == "number" ? t * 1e3 : void 0;
@@ -32748,11 +32748,11 @@ var Wt = class {
32748
32748
  await this.medplum.delete(`keyvalue/v1/${e}`);
32749
32749
  }
32750
32750
  };
32751
- var Ii;
32752
- Ii = Symbol.toStringTag;
32753
- var V = class {
32751
+ var Vi;
32752
+ Vi = Symbol.toStringTag;
32753
+ var M = class {
32754
32754
  constructor(e) {
32755
- this[Ii] = "ReadablePromise";
32755
+ this[Vi] = "ReadablePromise";
32756
32756
  this.status = "pending";
32757
32757
  this.suspender = e.then((t) => (this.status = "success", this.response = t, t), (t) => {
32758
32758
  throw this.status = "error", this.error = t, t;
@@ -32829,8 +32829,8 @@ var Kr = class {
32829
32829
  }
32830
32830
  };
32831
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
+ var _i = false;
32833
+ function pa() {
32834
32834
  if (typeof globalThis.Event > "u") throw new Error("Unable to lazy init events for ReconnectingWebSocket. globalThis.Event is not defined yet");
32835
32835
  Ne.Event = globalThis.Event, Ne.ErrorEvent = class extends Event {
32836
32836
  constructor(e, t) {
@@ -32844,17 +32844,17 @@ function la() {
32844
32844
  }
32845
32845
  };
32846
32846
  }
32847
- function pa(r6, e) {
32847
+ function fa(r6, e) {
32848
32848
  if (!r6) throw new Error(e);
32849
32849
  }
32850
32850
  function qt(r6) {
32851
32851
  return new r6.constructor(r6.type, r6);
32852
32852
  }
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;
32855
- var jt = class r extends J {
32853
+ var Ce = { 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 Fi = false;
32855
+ var jt = class r extends K {
32856
32856
  constructor(t, n, i2 = {}) {
32857
- Di || (la(), Di = true);
32857
+ _i || (pa(), _i = true);
32858
32858
  super();
32859
32859
  this._retryCount = -1;
32860
32860
  this._shouldReconnect = true;
@@ -32868,8 +32868,8 @@ var jt = class r extends J {
32868
32868
  this.onopen = null;
32869
32869
  this._handleOpen = (t2) => {
32870
32870
  this._debug("open event");
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
+ let { minUptime: n2 = Ce.minUptime } = this._options;
32872
+ clearTimeout(this._connectTimeout), this._uptimeTimeout = setTimeout(() => this._acceptOpen(), n2), fa(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));
32873
32873
  };
32874
32874
  this._handleMessage = (t2) => {
32875
32875
  this._debug("message event"), this.onmessage && this.onmessage(t2), this.dispatchEvent(qt(t2));
@@ -32950,7 +32950,7 @@ var jt = class r extends J {
32950
32950
  send(t) {
32951
32951
  if (this._ws && this._ws.readyState === this.OPEN) this._debug("send", t), this._ws.send(t);
32952
32952
  else {
32953
- let { maxEnqueuedMessages: n = Re.maxEnqueuedMessages } = this._options;
32953
+ let { maxEnqueuedMessages: n = Ce.maxEnqueuedMessages } = this._options;
32954
32954
  this._messageQueue.length < n && (this._debug("enqueue", t), this._messageQueue.push(t));
32955
32955
  }
32956
32956
  }
@@ -32958,7 +32958,7 @@ var jt = class r extends J {
32958
32958
  this._options.debug && this._debugLogger("RWS>", ...t);
32959
32959
  }
32960
32960
  _getNextDelay() {
32961
- let { reconnectionDelayGrowFactor: t = Re.reconnectionDelayGrowFactor, minReconnectionDelay: n = Re.minReconnectionDelay, maxReconnectionDelay: i2 = Re.maxReconnectionDelay } = this._options, o = 0;
32961
+ let { reconnectionDelayGrowFactor: t = Ce.reconnectionDelayGrowFactor, minReconnectionDelay: n = Ce.minReconnectionDelay, maxReconnectionDelay: i2 = Ce.maxReconnectionDelay } = this._options, o = 0;
32962
32962
  return this._retryCount > 0 && (o = n * Math.pow(t, this._retryCount - 1), o > i2 && (o = i2)), this._debug("next delay", o), o;
32963
32963
  }
32964
32964
  _wait() {
@@ -32969,7 +32969,7 @@ var jt = class r extends J {
32969
32969
  _connect() {
32970
32970
  if (this._connectLock || !this._shouldReconnect) return;
32971
32971
  this._connectLock = true;
32972
- let { maxRetries: t = Re.maxRetries, connectionTimeout: n = Re.connectionTimeout } = this._options;
32972
+ let { maxRetries: t = Ce.maxRetries, connectionTimeout: n = Ce.connectionTimeout } = this._options;
32973
32973
  if (this._retryCount >= t) {
32974
32974
  this._debug("max retries reached", this._retryCount, ">=", t);
32975
32975
  return;
@@ -32979,7 +32979,7 @@ var jt = class r extends J {
32979
32979
  this._connectLock = false;
32980
32980
  return;
32981
32981
  }
32982
- !this._options.WebSocket && typeof WebSocket > "u" && !Vi && (console.error("\u203C\uFE0F No WebSocket implementation available. You should define options.WebSocket."), Vi = true);
32982
+ !this._options.WebSocket && typeof WebSocket > "u" && !Fi && (console.error("\u203C\uFE0F No WebSocket implementation available. You should define options.WebSocket."), Fi = true);
32983
32983
  let i2 = this._options.WebSocket || WebSocket;
32984
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);
32985
32985
  }).catch((i2) => {
@@ -33011,8 +33011,8 @@ var jt = class r extends J {
33011
33011
  clearTimeout(this._connectTimeout), clearTimeout(this._uptimeTimeout);
33012
33012
  }
33013
33013
  };
33014
- var da = 5e3;
33015
- var Ye = class extends J {
33014
+ var ha = 5e3;
33015
+ var Ye = class extends K {
33016
33016
  constructor(...e) {
33017
33017
  super(), this.criteria = new Set(e);
33018
33018
  }
@@ -33039,15 +33039,15 @@ var $t = class {
33039
33039
  constructor(e, t, n) {
33040
33040
  this.pingTimer = void 0;
33041
33041
  this.waitingForPong = false;
33042
- if (!(e instanceof Gt)) throw new d(y("First arg of constructor should be a `MedplumClient`"));
33042
+ if (!(e instanceof Gt)) throw new p(y("First arg of constructor should be a `MedplumClient`"));
33043
33043
  let i2;
33044
33044
  try {
33045
33045
  i2 = new URL(t).toString();
33046
33046
  } catch {
33047
- throw new d(y("Not a valid URL"));
33047
+ throw new p(y("Not a valid URL"));
33048
33048
  }
33049
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 });
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();
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 ?? ha, this.currentProfile = e.getProfile(), this.setupListeners();
33051
33051
  }
33052
33052
  setupListeners() {
33053
33053
  let e = this.ws;
@@ -33064,7 +33064,7 @@ var $t = class {
33064
33064
  return;
33065
33065
  }
33066
33066
  if (o.type === "handshake") {
33067
- let a2 = me(o.subscription), c = { type: "connect", payload: { subscriptionId: a2 } };
33067
+ let a2 = ye(o.subscription), c = { type: "connect", payload: { subscriptionId: a2 } };
33068
33068
  this.masterSubEmitter?.dispatchEvent(c);
33069
33069
  let u2 = this.criteriaEntriesBySubscriptionId.get(a2);
33070
33070
  if (!u2) {
@@ -33075,7 +33075,7 @@ var $t = class {
33075
33075
  return;
33076
33076
  }
33077
33077
  this.masterSubEmitter?.dispatchEvent({ type: "message", payload: i2 });
33078
- let s = this.criteriaEntriesBySubscriptionId.get(me(o.subscription));
33078
+ let s = this.criteriaEntriesBySubscriptionId.get(ye(o.subscription));
33079
33079
  if (!s) {
33080
33080
  console.warn("Received notification for criteria the SubscriptionManager is not listening for");
33081
33081
  return;
@@ -33088,7 +33088,7 @@ var $t = class {
33088
33088
  for (let o of this.getAllCriteriaEmitters()) o.dispatchEvent({ ...i2 });
33089
33089
  }
33090
33090
  }), e.addEventListener("error", () => {
33091
- let t = { type: "error", payload: new d(Tn(new Error("WebSocket error"))) };
33091
+ let t = { type: "error", payload: new p(Tn(new Error("WebSocket error"))) };
33092
33092
  this.masterSubEmitter?.dispatchEvent(t);
33093
33093
  for (let n of this.getAllCriteriaEmitters()) n.dispatchEvent({ ...t });
33094
33094
  }), e.addEventListener("close", () => {
@@ -33125,17 +33125,17 @@ var $t = class {
33125
33125
  }
33126
33126
  async getTokenForCriteria(e) {
33127
33127
  let t = e?.subscriptionId;
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);
33128
+ t || (t = (await this.medplum.createResource({ ...e.subscriptionProps, resourceType: "Subscription", status: "active", reason: `WebSocket subscription for ${W(this.medplum.getProfile())}`, channel: { type: "websocket" }, criteria: e.criteria })).id);
33129
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;
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
+ if (!i2) throw new p(y("Failed to get token"));
33131
+ if (!o) throw new p(y("Failed to get URL from $get-ws-binding-token"));
33132
33132
  return [t, i2];
33133
33133
  }
33134
33134
  maybeGetCriteriaEntry(e, t) {
33135
33135
  let n = this.criteriaEntries.get(e);
33136
33136
  if (n) {
33137
33137
  if (!t) return n.bareCriteria;
33138
- for (let i2 of n.criteriaWithProps) if (ie(t, i2.subscriptionProps)) return i2;
33138
+ for (let i2 of n.criteriaWithProps) if (oe(t, i2.subscriptionProps)) return i2;
33139
33139
  }
33140
33140
  }
33141
33141
  getAllCriteriaEmitters() {
@@ -33156,7 +33156,7 @@ var $t = class {
33156
33156
  let s = this.criteriaEntries.get(t);
33157
33157
  n ? s.criteriaWithProps = s.criteriaWithProps.filter((a2) => {
33158
33158
  let c = a2.subscriptionProps;
33159
- return !ie(n, c);
33159
+ return !oe(n, c);
33160
33160
  }) : s.bareCriteria = void 0, !s.bareCriteria && s.criteriaWithProps.length === 0 && (this.criteriaEntries.delete(t), this.masterSubEmitter?._removeCriteria(t)), i2 && this.criteriaEntriesBySubscriptionId.delete(i2), o && this.ws.readyState === WebSocket.OPEN && this.ws.send(JSON.stringify({ type: "unbind-from-token", payload: { token: o } }));
33161
33161
  }
33162
33162
  async subscribeToCriteria(e) {
@@ -33166,7 +33166,7 @@ var $t = class {
33166
33166
  let [t, n] = await this.getTokenForCriteria(e);
33167
33167
  e.subscriptionId = t, e.token = n, this.criteriaEntriesBySubscriptionId.set(t, e), this.ws.send(JSON.stringify({ type: "bind-with-token", payload: { token: n } }));
33168
33168
  } catch (t) {
33169
- console.error(Oe(t)), this.emitError(e, t), this.removeCriteriaEntry(e);
33169
+ console.error(Ie(t)), this.emitError(e, t), this.removeCriteriaEntry(e);
33170
33170
  }
33171
33171
  }
33172
33172
  }
@@ -33205,24 +33205,24 @@ var $t = class {
33205
33205
  return this.masterSubEmitter || (this.masterSubEmitter = new Ye(...Array.from(this.criteriaEntries.keys()))), this.masterSubEmitter;
33206
33206
  }
33207
33207
  };
33208
- var Yr = "4.1.12-66f0d5588";
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" }] };
33208
+ var Yr = "4.1.14-8896f73";
33209
+ var ga = w.FHIR_JSON + ", */*; q=0.1";
33210
+ var xa = "https://api.medplum.com/";
33211
+ var va = 1e3;
33212
+ var Ta = 6e4;
33213
+ var Sa = 0;
33214
+ var ba = 3e5;
33215
+ var Ea = "Binary/";
33216
+ var Li = { resourceType: "Device", id: "system", deviceName: [{ type: "model-name", name: "System" }] };
33217
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 {
33218
+ var Ra = { 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 Ca = { JwtBearer: "urn:ietf:params:oauth:client-assertion-type:jwt-bearer" };
33220
+ var Gt = class extends K {
33221
33221
  constructor(t) {
33222
33222
  super();
33223
33223
  this.initComplete = true;
33224
33224
  if (t?.baseUrl && !t.baseUrl.startsWith("http")) throw new Error("Base URL must start with http or https");
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(() => {
33225
+ this.options = t ?? {}, this.fetch = t?.fetch ?? Pa(), this.storage = t?.storage ?? new Xe(), this.createPdfImpl = t?.createPdf, this.baseUrl = Lr(t?.baseUrl ?? xa), this.fhirBaseUrl = q(this.baseUrl, t?.fhirUrlPath ?? "fhir/R4"), this.authorizeUrl = q(this.baseUrl, t?.authorizeUrl ?? "oauth2/authorize"), this.tokenUrl = q(this.baseUrl, t?.tokenUrl ?? "oauth2/token"), this.logoutUrl = q(this.baseUrl, t?.logoutUrl ?? "oauth2/logout"), this.fhircastHubUrl = q(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 ?? ba, this.cacheTime = t?.cacheTime ?? (typeof window > "u" ? Sa : Ta), this.cacheTime > 0 ? this.requestCache = new we(t?.resourceCacheSize ?? va) : 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(() => {
33226
33226
  t?.accessToken || this.attemptResumeActiveLogin().catch(console.error), this.initComplete = true, this.dispatchEvent({ type: "storageInitialized" });
33227
33227
  }).catch((n) => {
33228
33228
  console.error(n), this.initComplete = true, this.dispatchEvent({ type: "storageInitFailed", payload: { error: n } });
@@ -33269,7 +33269,7 @@ var Gt = class extends J {
33269
33269
  this.requestCache?.clear();
33270
33270
  }
33271
33271
  invalidateSearches(t) {
33272
- let n = W(this.fhirBaseUrl, t);
33272
+ let n = q(this.fhirBaseUrl, t);
33273
33273
  if (this.requestCache) for (let i2 of this.requestCache.keys()) (i2.endsWith(n) || i2.includes(n + "?")) && this.requestCache.delete(i2);
33274
33274
  }
33275
33275
  get(t, n = {}) {
@@ -33280,7 +33280,7 @@ var Gt = class extends J {
33280
33280
  t.startsWith(this.fhirBaseUrl) && this.autoBatchQueue && !n.disableAutoBatch ? o = new Promise((a2, c) => {
33281
33281
  this.autoBatchQueue.push({ method: "GET", url: t.replace(this.fhirBaseUrl, ""), options: n, resolve: a2, reject: c }), this.autoBatchTimerId || (this.autoBatchTimerId = setTimeout(() => this.executeAutoBatch(), this.autoBatchTime));
33282
33282
  }) : o = this.request("GET", t, n);
33283
- let s = new V(o);
33283
+ let s = new M(o);
33284
33284
  return this.setCacheEntry(t, s), s;
33285
33285
  }
33286
33286
  post(t, n, i2, o = {}) {
@@ -33334,7 +33334,7 @@ var Gt = class extends J {
33334
33334
  }
33335
33335
  async exchangeExternalAccessToken(t, n) {
33336
33336
  if (n = n ?? this.clientId, !n) throw new Error("MedplumClient is missing clientId");
33337
- return this.fetchTokens({ grant_type: Ue.TokenExchange, subject_token_type: ba.AccessToken, client_id: n, subject_token: t });
33337
+ return this.fetchTokens({ grant_type: Ue.TokenExchange, subject_token_type: Ra.AccessToken, client_id: n, subject_token: t });
33338
33338
  }
33339
33339
  getExternalAuthRedirectUri(t, n, i2, o, s = true) {
33340
33340
  let a2 = new URL(t);
@@ -33347,7 +33347,7 @@ var Gt = class extends J {
33347
33347
  return a2.toString();
33348
33348
  }
33349
33349
  fhirUrl(...t) {
33350
- return new URL(W(this.fhirBaseUrl, t.join("/")));
33350
+ return new URL(q(this.fhirBaseUrl, t.join("/")));
33351
33351
  }
33352
33352
  fhirSearchUrl(t, n) {
33353
33353
  let i2 = this.fhirUrl(t);
@@ -33364,13 +33364,13 @@ var Gt = class extends J {
33364
33364
  o.searchParams.set("_count", "1"), o.searchParams.sort();
33365
33365
  let s = "searchOne-" + o.toString(), a2 = this.getCacheEntry(s, i2);
33366
33366
  if (a2) return a2.value;
33367
- let c = new V(this.search(t, o.searchParams, i2).then((u2) => u2.entry?.[0]?.resource));
33367
+ let c = new M(this.search(t, o.searchParams, i2).then((u2) => u2.entry?.[0]?.resource));
33368
33368
  return this.setCacheEntry(s, c), c;
33369
33369
  }
33370
33370
  searchResources(t, n, i2) {
33371
33371
  let s = "searchResources-" + this.fhirSearchUrl(t, n).toString(), a2 = this.getCacheEntry(s, i2);
33372
33372
  if (a2) return a2.value;
33373
- let c = new V(this.search(t, n, i2).then(Fi));
33373
+ let c = new M(this.search(t, n, i2).then(Bi));
33374
33374
  return this.setCacheEntry(s, c), c;
33375
33375
  }
33376
33376
  async *searchResourcePages(t, n, i2) {
@@ -33380,7 +33380,7 @@ var Gt = class extends J {
33380
33380
  s.has("_count") || s.set("_count", "1000");
33381
33381
  let a2 = await this.search(t, s, i2), c = a2.link?.find((u2) => u2.relation === "next");
33382
33382
  if (!a2.entry?.length && !c) break;
33383
- yield Fi(a2), o = c?.url ? new URL(c.url) : void 0;
33383
+ yield Bi(a2), o = c?.url ? new URL(c.url) : void 0;
33384
33384
  }
33385
33385
  }
33386
33386
  valueSetExpand(t, n) {
@@ -33394,7 +33394,7 @@ var Gt = class extends J {
33394
33394
  getCachedReference(t) {
33395
33395
  let n = t.reference;
33396
33396
  if (!n) return;
33397
- if (n === "system") return Mi;
33397
+ if (n === "system") return Li;
33398
33398
  let [i2, o] = n.split("/");
33399
33399
  if (!(!i2 || !o)) return this.getCached(i2, o);
33400
33400
  }
@@ -33404,16 +33404,16 @@ var Gt = class extends J {
33404
33404
  }
33405
33405
  readReference(t, n) {
33406
33406
  let i2 = t.reference;
33407
- if (!i2) return new V(Promise.reject(new Error("Missing reference")));
33408
- if (i2 === "system") return new V(Promise.resolve(Mi));
33407
+ if (!i2) return new M(Promise.reject(new Error("Missing reference")));
33408
+ if (i2 === "system") return new M(Promise.resolve(Li));
33409
33409
  let [o, s] = i2.split("/");
33410
- return !o || !s ? new V(Promise.reject(new Error("Invalid reference"))) : this.readResource(o, s, n);
33410
+ return !o || !s ? new M(Promise.reject(new Error("Invalid reference"))) : this.readResource(o, s, n);
33411
33411
  }
33412
33412
  requestSchema(t) {
33413
33413
  if (Dn(t)) return Promise.resolve();
33414
33414
  let n = t + "-requestSchema", i2 = this.getCacheEntry(n, void 0);
33415
33415
  if (i2) return i2.value;
33416
- let o = new V((async () => {
33416
+ let o = new M((async () => {
33417
33417
  let s = `{
33418
33418
  StructureDefinitionList(_filter: "name eq ${t}") {
33419
33419
  resourceType,
@@ -33464,7 +33464,7 @@ var Gt = class extends J {
33464
33464
  if (!n?.expandProfile && Mn(t)) return Promise.resolve();
33465
33465
  let i2 = t + "-requestSchema" + (n?.expandProfile ? "-nested" : ""), o = this.getCacheEntry(i2, void 0);
33466
33466
  if (o) return o.value;
33467
- let s = new V((async () => {
33467
+ let s = new M((async () => {
33468
33468
  if (n?.expandProfile) {
33469
33469
  let a2 = this.fhirUrl("StructureDefinition", "$expand-profile");
33470
33470
  a2.search = new URLSearchParams({ url: t }).toString();
@@ -33508,51 +33508,51 @@ var Gt = class extends J {
33508
33508
  return s || (s = t), this.cacheResource(s), this.invalidateUrl(this.fhirUrl(t.resourceType, t.id, "_history")), this.invalidateSearches(t.resourceType), s;
33509
33509
  }
33510
33510
  async createAttachment(t, n, i2, o, s) {
33511
- let a2 = Ni(t, n, i2, o);
33511
+ let a2 = Wi(t, n, i2, o);
33512
33512
  if (a2.contentType === w.XML) {
33513
- let p = a2.data, m2;
33514
- p instanceof Blob ? m2 = await new Promise((x, U) => {
33513
+ let d2 = a2.data, m2;
33514
+ d2 instanceof Blob ? m2 = await new Promise((x, B) => {
33515
33515
  let $ = new FileReader();
33516
33516
  $.onload = () => {
33517
33517
  if (!$.result) {
33518
- U(new Error("Failed to load file"));
33518
+ B(new Error("Failed to load file"));
33519
33519
  return;
33520
33520
  }
33521
33521
  x($.result);
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 });
33522
+ }, $.readAsText(d2, "utf-8");
33523
+ }) : 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 });
33524
33524
  }
33525
33525
  let c = s ?? (typeof n == "object" ? n : {}), u2 = await this.createBinary(a2, c);
33526
33526
  return { contentType: a2.contentType, url: u2.url, title: a2.filename };
33527
33527
  }
33528
33528
  createBinary(t, n, i2, o, s) {
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);
33529
+ let a2 = Wi(t, n, i2, o), c = s ?? (typeof n == "object" ? n : {}), { data: u2, contentType: d2, filename: m2, securityContext: x, onProgress: B } = a2, $ = this.fhirUrl("Binary");
33530
+ return m2 && $.searchParams.set("_filename", m2), x?.reference && this.setRequestHeader(c, "X-Security-Context", x.reference), B ? this.uploadwithProgress($, u2, d2, B, c) : this.post($, u2, d2, c);
33531
33531
  }
33532
33532
  uploadwithProgress(t, n, i2, o, s) {
33533
33533
  return new Promise((a2, c) => {
33534
- let u2 = new XMLHttpRequest(), p = () => u2.abort();
33535
- s?.signal?.addEventListener("abort", p);
33534
+ let u2 = new XMLHttpRequest(), d2 = () => u2.abort();
33535
+ s?.signal?.addEventListener("abort", d2);
33536
33536
  let m2 = (x) => {
33537
- s?.signal?.removeEventListener("abort", p), x instanceof Error ? c(x) : a2(x);
33537
+ s?.signal?.removeEventListener("abort", d2), x instanceof Error ? c(x) : a2(x);
33538
33538
  };
33539
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 = () => {
33540
- u2.status >= 200 && u2.status < 300 ? m2(u2.response) : m2(new d(st(u2.response || u2.statusText)));
33540
+ u2.status >= 200 && u2.status < 300 ? m2(u2.response) : m2(new p(st(u2.response || u2.statusText)));
33541
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) {
33542
33542
  let x = s.headers;
33543
- for (let [U, $] of Object.entries(x)) u2.setRequestHeader(U, $);
33543
+ for (let [B, $] of Object.entries(x)) u2.setRequestHeader(B, $);
33544
33544
  }
33545
33545
  u2.send(n);
33546
33546
  });
33547
33547
  }
33548
33548
  async createPdf(t, n, i2, o) {
33549
33549
  if (!this.createPdfImpl) throw new Error("PDF creation not enabled");
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" };
33551
- return this.createBinary(U, a2);
33550
+ let s = Oa(t, n, i2, o), a2 = typeof n == "object" ? n : {}, { docDefinition: c, tableLayouts: u2, fonts: d2, ...m2 } = s, x = await this.createPdfImpl(c, u2, d2), B = { ...m2, data: x, contentType: "application/pdf" };
33551
+ return this.createBinary(B, a2);
33552
33552
  }
33553
33553
  createComment(t, n, i2) {
33554
33554
  let o = this.getProfile(), s, a2;
33555
- return t.resourceType === "Encounter" && (s = he(t), a2 = t.subject), t.resourceType === "ServiceRequest" && (s = t.encounter, a2 = t.subject), t.resourceType === "Patient" && (a2 = he(t)), this.createResource({ resourceType: "Communication", status: "completed", basedOn: [he(t)], encounter: s, subject: a2, sender: o ? he(o) : void 0, sent: (/* @__PURE__ */ new Date()).toISOString(), payload: [{ contentString: n }] }, i2);
33555
+ return t.resourceType === "Encounter" && (s = me(t), a2 = t.subject), t.resourceType === "ServiceRequest" && (s = t.encounter, a2 = t.subject), t.resourceType === "Patient" && (a2 = me(t)), this.createResource({ resourceType: "Communication", status: "completed", basedOn: [me(t)], encounter: s, subject: a2, sender: o ? me(o) : void 0, sent: (/* @__PURE__ */ new Date()).toISOString(), payload: [{ contentString: n }] }, i2);
33556
33556
  }
33557
33557
  async updateResource(t, n) {
33558
33558
  if (!t.resourceType) throw new Error("Missing resourceType");
@@ -33594,13 +33594,13 @@ var Gt = class extends J {
33594
33594
  return this.get(`${this.fhirUrl(t, n)}/$graph?graph=${i2}`, o);
33595
33595
  }
33596
33596
  pushToAgent(t, n, i2, o, s, a2) {
33597
- return this.post(this.fhirUrl("Agent", me(t), "$push"), { destination: typeof n == "string" ? n : B(n), body: i2, contentType: o, waitForResponse: s }, w.FHIR_JSON, a2);
33597
+ return this.post(this.fhirUrl("Agent", ye(t), "$push"), { destination: typeof n == "string" ? n : W(n), body: i2, contentType: o, waitForResponse: s }, w.FHIR_JSON, a2);
33598
33598
  }
33599
33599
  getActiveLogin() {
33600
33600
  return this.storage.getObject("activeLogin");
33601
33601
  }
33602
33602
  async setActiveLogin(t) {
33603
- (!this.sessionDetails?.profile || B(this.sessionDetails.profile) !== t.profile?.reference) && this.clearActiveLogin(), this.setAccessToken(t.accessToken, t.refreshToken), this.storage.setObject("activeLogin", t), this.addLogin(t), this.refreshPromise = void 0, await this.refreshProfile();
33603
+ (!this.sessionDetails?.profile || W(this.sessionDetails.profile) !== t.profile?.reference) && this.clearActiveLogin(), this.setAccessToken(t.accessToken, t.refreshToken), this.storage.setObject("activeLogin", t), this.addLogin(t), this.refreshPromise = void 0, await this.refreshProfile();
33604
33604
  }
33605
33605
  getAccessToken() {
33606
33606
  return this.accessToken;
@@ -33609,7 +33609,7 @@ var Gt = class extends J {
33609
33609
  return this.accessTokenExpires !== void 0 && Date.now() < this.accessTokenExpires - (t ?? this.refreshGracePeriod);
33610
33610
  }
33611
33611
  setAccessToken(t, n) {
33612
- this.accessToken = t, this.refreshToken = n, this.accessTokenExpires = Oi(t), this.medplumServer = Ai(t);
33612
+ this.accessToken = t, this.refreshToken = n, this.accessTokenExpires = Di(t), this.medplumServer = ki(t);
33613
33613
  }
33614
33614
  getLogins() {
33615
33615
  return this.storage.getObject("logins") ?? [];
@@ -33657,13 +33657,13 @@ var Gt = class extends J {
33657
33657
  async download(t, n = {}) {
33658
33658
  this.refreshPromise && await this.refreshPromise;
33659
33659
  let i2 = t.toString();
33660
- i2.startsWith(Sa) && (t = this.fhirUrl(i2));
33660
+ i2.startsWith(Ea) && (t = this.fhirUrl(i2));
33661
33661
  let o = n.headers;
33662
33662
  return o || (o = {}, n.headers = o), o.Accept || (o.Accept = "*/*"), this.addFetchOptionsDefaults(n), (await this.fetchWithRetry(t.toString(), n)).blob();
33663
33663
  }
33664
33664
  async createMedia(t, n) {
33665
33665
  let { additionalFields: i2, ...o } = t, s = await this.createResource({ resourceType: "Media", status: "preparation", content: { contentType: t.contentType }, ...i2 });
33666
- o.securityContext || (o.securityContext = he(s));
33666
+ o.securityContext || (o.securityContext = me(s));
33667
33667
  let a2 = await this.createAttachment(o, n);
33668
33668
  return this.updateResource({ ...s, status: "completed", content: a2 });
33669
33669
  }
@@ -33672,7 +33672,7 @@ var Gt = class extends J {
33672
33672
  }
33673
33673
  async createDocumentReference(t, n) {
33674
33674
  let { additionalFields: i2, ...o } = t, s = await this.createResource({ resourceType: "DocumentReference", status: "current", content: [{ attachment: { contentType: t.contentType } }], ...i2 });
33675
- o.securityContext || (o.securityContext = he(s));
33675
+ o.securityContext || (o.securityContext = me(s));
33676
33676
  let a2 = await this.createAttachment(o, n);
33677
33677
  return this.updateResource({ ...s, content: [{ attachment: a2 }] });
33678
33678
  }
@@ -33689,7 +33689,7 @@ var Gt = class extends J {
33689
33689
  return this.keyValueClient || (this.keyValueClient = new Wt(this)), this.keyValueClient;
33690
33690
  }
33691
33691
  getBundle(t, n) {
33692
- return new V((async () => {
33692
+ return new M((async () => {
33693
33693
  let i2 = await this.get(t, n);
33694
33694
  if (i2.entry) for (let o of i2.entry) this.cacheResource(o.resource);
33695
33695
  return i2;
@@ -33704,7 +33704,7 @@ var Gt = class extends J {
33704
33704
  this.requestCache && this.requestCache.set(t, { requestTime: Date.now(), value: n });
33705
33705
  }
33706
33706
  cacheResource(t) {
33707
- t?.id && !t.meta?.tag?.some((n) => n.code === "SUBSETTED") && this.setCacheEntry(this.fhirUrl(t.resourceType, t.id).toString(), new V(Promise.resolve(t)));
33707
+ t?.id && !t.meta?.tag?.some((n) => n.code === "SUBSETTED") && this.setCacheEntry(this.fhirUrl(t.resourceType, t.id).toString(), new M(Promise.resolve(t)));
33708
33708
  }
33709
33709
  deleteCacheEntry(t) {
33710
33710
  this.requestCache && this.requestCache.delete(t);
@@ -33715,17 +33715,17 @@ var Gt = class extends J {
33715
33715
  if (s.status === 401) return this.handleUnauthenticated(t, n, i2);
33716
33716
  if (s.status === 204 || s.status === 304) return;
33717
33717
  let c = s.headers.get("content-type")?.includes("json");
33718
- if (s.status === 404 && !c) throw new d(xn);
33718
+ if (s.status === 404 && !c) throw new p(xn);
33719
33719
  let u2 = await this.parseBody(s, c);
33720
33720
  if (s.status === 200 && i2.followRedirectOnOk || s.status === 201 && i2.followRedirectOnCreated) {
33721
- let p = await Li(s, u2);
33722
- if (p) return this.request("GET", p, { ...i2, body: void 0 });
33721
+ let d2 = await Ui(s, u2);
33722
+ if (d2) return this.request("GET", d2, { ...i2, body: void 0 });
33723
33723
  }
33724
33724
  if (s.status === 202 && i2.pollStatusOnAccepted) {
33725
- let m2 = await Li(s, u2) ?? o.statusUrl;
33725
+ let m2 = await Ui(s, u2) ?? o.statusUrl;
33726
33726
  if (m2) return this.pollStatus(m2, i2, o);
33727
33727
  }
33728
- if (s.status >= 400) throw new d(st(u2));
33728
+ if (s.status >= 400) throw new p(st(u2));
33729
33729
  return u2;
33730
33730
  }
33731
33731
  async parseBody(t, n) {
@@ -33741,12 +33741,12 @@ var Gt = class extends J {
33741
33741
  }
33742
33742
  }
33743
33743
  async fetchWithRetry(t, n) {
33744
- t.startsWith("http") || (t = W(this.baseUrl, t));
33744
+ t.startsWith("http") || (t = q(this.baseUrl, t));
33745
33745
  let i2 = n?.maxRetries ?? 2;
33746
33746
  for (let o = 0; o <= i2; o++) try {
33747
33747
  this.options.verbose && this.logRequest(t, n);
33748
33748
  let s = await this.fetch(t, n);
33749
- if (this.options.verbose && this.logResponse(s), this.setCurrentRateLimit(s), o >= i2 || !Aa(s)) return s;
33749
+ if (this.options.verbose && this.logResponse(s), this.setCurrentRateLimit(s), o >= i2 || !Ia(s)) return s;
33750
33750
  let a2 = this.getRetryDelay(o), c = n.maxRetryTime ?? 2e3;
33751
33751
  if (a2 > c) return s;
33752
33752
  await _r(a2);
@@ -33774,7 +33774,7 @@ var Gt = class extends J {
33774
33774
  return t.split(/\s*;\s*/g).map((n) => {
33775
33775
  let i2 = n.split(/\s*,\s*/g);
33776
33776
  if (i2.length !== 3) throw new Error("Could not parse RateLimit header: " + t);
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;
33777
+ 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;
33778
33778
  if (!o || Number.isNaN(a2) || Number.isNaN(u2)) throw new Error("Could not parse RateLimit header: " + t);
33779
33779
  return { name: o, remainingUnits: a2, secondsUntilReset: u2 };
33780
33780
  });
@@ -33799,22 +33799,22 @@ var Gt = class extends J {
33799
33799
  if (this.autoBatchQueue.length = 0, this.autoBatchTimerId = void 0, t.length === 1) {
33800
33800
  let o = t[0];
33801
33801
  try {
33802
- o.resolve(await this.request(o.method, W(this.fhirBaseUrl, o.url), o.options));
33802
+ o.resolve(await this.request(o.method, q(this.fhirBaseUrl, o.url), o.options));
33803
33803
  } catch (s) {
33804
- o.reject(new d(st(s)));
33804
+ o.reject(new p(st(s)));
33805
33805
  }
33806
33806
  return;
33807
33807
  }
33808
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);
33809
33809
  for (let o = 0; o < t.length; o++) {
33810
33810
  let s = t[o], a2 = i2.entry?.[o];
33811
- a2?.response?.outcome && !pr(a2.response.outcome) ? s.reject(new d(a2.response.outcome)) : s.resolve(a2?.resource);
33811
+ a2?.response?.outcome && !dr(a2.response.outcome) ? s.reject(new p(a2.response.outcome)) : s.resolve(a2?.resource);
33812
33812
  }
33813
33813
  }
33814
33814
  addFetchOptionsDefaults(t) {
33815
33815
  Object.entries(this.defaultHeaders).forEach(([n, i2]) => {
33816
33816
  this.setRequestHeader(t, n, i2);
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");
33817
+ }), this.setRequestHeader(t, "Accept", ga, 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");
33818
33818
  }
33819
33819
  setRequestContentType(t, n) {
33820
33820
  this.setRequestHeader(t, "Content-Type", n);
@@ -33828,22 +33828,22 @@ var Gt = class extends J {
33828
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));
33829
33829
  }
33830
33830
  handleUnauthenticated(t, n, i2) {
33831
- return this.refresh() ? this.request(t, n, i2) : (this.clear(), this.onUnauthenticated && this.onUnauthenticated(), Promise.reject(new d(we)));
33831
+ return this.refresh() ? this.request(t, n, i2) : (this.clear(), this.onUnauthenticated && this.onUnauthenticated(), Promise.reject(new p(Ae)));
33832
33832
  }
33833
33833
  async startPkce() {
33834
33834
  let t = $r();
33835
33835
  sessionStorage.setItem("pkceState", t);
33836
33836
  let n = $r().slice(0, 128);
33837
33837
  sessionStorage.setItem("codeVerifier", n);
33838
- let i2 = await bi(n), o = Zn(i2).replaceAll("+", "-").replaceAll("/", "_").replaceAll("=", "");
33838
+ let i2 = await Ci(n), o = Zn(i2).replaceAll("+", "-").replaceAll("/", "_").replaceAll("=", "");
33839
33839
  return sessionStorage.setItem("codeChallenge", o), { codeChallengeMethod: "S256", codeChallenge: o };
33840
33840
  }
33841
33841
  async requestAuthorization(t) {
33842
33842
  let n = await this.ensureCodeChallenge(t ?? {}), i2 = new URL(this.authorizeUrl);
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());
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 ?? Ni()), 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());
33844
33844
  }
33845
33845
  processCode(t, n) {
33846
- let i2 = { grant_type: Ue.AuthorizationCode, code: t, client_id: n?.clientId ?? this.clientId ?? "", redirect_uri: n?.redirectUri ?? _i() };
33846
+ let i2 = { grant_type: Ue.AuthorizationCode, code: t, client_id: n?.clientId ?? this.clientId ?? "", redirect_uri: n?.redirectUri ?? Ni() };
33847
33847
  if (typeof sessionStorage < "u") {
33848
33848
  let o = sessionStorage.getItem("codeVerifier");
33849
33849
  o && (i2.code_verifier = o);
@@ -33865,28 +33865,28 @@ var Gt = class extends J {
33865
33865
  return this.clientId = t, this.fetchTokens({ grant_type: Ue.JwtBearer, client_id: t, assertion: n, scope: i2 });
33866
33866
  }
33867
33867
  async startJwtAssertionLogin(t) {
33868
- return this.fetchTokens({ grant_type: Ue.ClientCredentials, client_assertion_type: Ea.JwtBearer, client_assertion: t });
33868
+ return this.fetchTokens({ grant_type: Ue.ClientCredentials, client_assertion_type: Ca.JwtBearer, client_assertion: t });
33869
33869
  }
33870
33870
  setBasicAuth(t, n) {
33871
- this.clientId = t, this.clientSecret = n, this.basicAuth = Ft(t + ":" + n);
33871
+ this.clientId = t, this.clientSecret = n, this.basicAuth = Lt(t + ":" + n);
33872
33872
  }
33873
33873
  async fhircastSubscribe(t, n) {
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."));
33874
+ if (!(typeof t == "string" && t !== "")) throw new p(y("Invalid topic provided. Topic must be a valid string."));
33875
+ 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."));
33876
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"];
33877
33877
  if (!s) throw new Error("Invalid response!");
33878
33878
  return i2.endpoint = s, i2;
33879
33879
  }
33880
33880
  async fhircastUnsubscribe(t) {
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."));
33881
+ if (!Ut(t)) throw new p(y("Invalid topic or subscriptionRequest. SubscriptionRequest must be an object."));
33882
+ 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."));
33883
33883
  t.mode = "unsubscribe", await this.post(this.fhircastHubUrl, zr(t), w.FORM_URL_ENCODED);
33884
33884
  }
33885
33885
  fhircastConnect(t) {
33886
33886
  return new Nt(t);
33887
33887
  }
33888
33888
  async fhircastPublish(t, n, i2, o) {
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));
33889
+ return wi(n) ? this.post(this.fhircastHubUrl, Jr(t, n, i2, o), w.JSON) : (Ai(n), this.post(this.fhircastHubUrl, Jr(t, n, i2), w.JSON));
33890
33890
  }
33891
33891
  async fhircastGetContext(t) {
33892
33892
  return this.get(`${this.fhircastHubUrl}/${t}`, { cache: "no-cache" });
@@ -33896,7 +33896,7 @@ var Gt = class extends J {
33896
33896
  }
33897
33897
  async fetchTokens(t) {
33898
33898
  let n = new URLSearchParams(t), i2 = { ...this.defaultHeaders, "Content-Type": w.FORM_URL_ENCODED };
33899
- this.basicAuth && (i2.Authorization = `Basic ${this.basicAuth}`), this.credentialsInHeader && (n.delete("client_id"), n.delete("client_secret"), !this.basicAuth && t.client_id && t.client_secret && (i2.Authorization = `Basic ${Ft(t.client_id + ":" + t.client_secret)}`));
33899
+ this.basicAuth && (i2.Authorization = `Basic ${this.basicAuth}`), this.credentialsInHeader && (n.delete("client_id"), n.delete("client_secret"), !this.basicAuth && t.client_id && t.client_secret && (i2.Authorization = `Basic ${Lt(t.client_id + ":" + t.client_secret)}`));
33900
33900
  let o = { method: "POST", headers: i2, body: n.toString(), credentials: "include" }, s;
33901
33901
  try {
33902
33902
  s = await this.fetchWithRetry(this.tokenUrl, o);
@@ -33907,9 +33907,9 @@ var Gt = class extends J {
33907
33907
  this.clearActiveLogin();
33908
33908
  try {
33909
33909
  let c = await s.json();
33910
- throw new d(b(c.error_description));
33910
+ throw new p(b(c.error_description));
33911
33911
  } catch (c) {
33912
- throw new d(b("Failed to fetch tokens"), c);
33912
+ throw new p(b("Failed to fetch tokens"), c);
33913
33913
  }
33914
33914
  }
33915
33915
  let a2 = await s.json();
@@ -33917,12 +33917,12 @@ var Gt = class extends J {
33917
33917
  }
33918
33918
  async verifyTokens(t) {
33919
33919
  let n = t.access_token;
33920
- if (wi(n)) {
33920
+ if (Ii(n)) {
33921
33921
  let i2 = Bt(n);
33922
- if (Date.now() >= i2.exp * 1e3) throw this.clearActiveLogin(), new d(vn);
33922
+ if (Date.now() >= i2.exp * 1e3) throw this.clearActiveLogin(), new p(vn);
33923
33923
  if (i2.cid) {
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);
33924
+ if (i2.cid !== this.clientId) throw this.clearActiveLogin(), new p(lr);
33925
+ } else if (this.clientId && i2.client_id !== this.clientId) throw this.clearActiveLogin(), new p(lr);
33926
33926
  }
33927
33927
  return this.setActiveLogin({ accessToken: n, refreshToken: t.refresh_token, project: t.project, profile: t.profile });
33928
33928
  }
@@ -33954,46 +33954,46 @@ var Gt = class extends J {
33954
33954
  return this.getSubscriptionManager().getMasterEmitter();
33955
33955
  }
33956
33956
  };
33957
- function Ra() {
33957
+ function Pa() {
33958
33958
  if (!globalThis.fetch) throw new Error("Fetch not available in this environment");
33959
33959
  return globalThis.fetch.bind(globalThis);
33960
33960
  }
33961
- function _i() {
33961
+ function Ni() {
33962
33962
  return typeof window > "u" ? "" : window.location.protocol + "//" + window.location.host + "/";
33963
33963
  }
33964
- async function Li(r6, e) {
33964
+ async function Ui(r6, e) {
33965
33965
  let t = r6.headers.get("content-location");
33966
33966
  if (t) return t;
33967
33967
  let n = r6.headers.get("location");
33968
33968
  if (n) return n;
33969
- if (Ae(e) && e.issue?.[0]?.diagnostics) return e.issue[0].diagnostics;
33969
+ if (Oe(e) && e.issue?.[0]?.diagnostics) return e.issue[0].diagnostics;
33970
33970
  }
33971
- function Fi(r6) {
33971
+ function Bi(r6) {
33972
33972
  let e = r6.entry?.map((t) => t.resource) ?? [];
33973
33973
  return Object.assign(e, { bundle: r6 });
33974
33974
  }
33975
- function Ca(r6) {
33975
+ function wa(r6) {
33976
33976
  return E(r6) && "data" in r6 && "contentType" in r6;
33977
33977
  }
33978
- function Ni(r6, e, t, n) {
33979
- return Ca(r6) ? r6 : { data: r6, filename: e, contentType: t, onProgress: n };
33978
+ function Wi(r6, e, t, n) {
33979
+ return wa(r6) ? r6 : { data: r6, filename: e, contentType: t, onProgress: n };
33980
33980
  }
33981
- function Pa(r6) {
33981
+ function Aa(r6) {
33982
33982
  return E(r6) && "docDefinition" in r6;
33983
33983
  }
33984
- function wa(r6, e, t, n) {
33985
- return Pa(r6) ? r6 : { docDefinition: r6, filename: e, tableLayouts: t, fonts: n };
33984
+ function Oa(r6, e, t, n) {
33985
+ return Aa(r6) ? r6 : { docDefinition: r6, filename: e, tableLayouts: t, fonts: n };
33986
33986
  }
33987
- function Aa(r6) {
33987
+ function Ia(r6) {
33988
33988
  return r6.status === 429 || r6.status >= 500;
33989
33989
  }
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" };
33990
+ var ja = [...ze, "->", "<<", ">>", "=="];
33991
+ var Ha = Je().registerInfix("->", { precedence: g.Arrow }).registerInfix(";", { precedence: g.Semicolon });
33992
+ var lc = " ".repeat(2);
33993
+ var pc = [...ze, "eq", "ne", "co"];
33994
+ var fc = { 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 mc = Je();
33996
+ var yc = { AA: "OK", AE: "Application Error", AR: "Application Reject", CA: "Commit Accept", CE: "Commit Error", CR: "Commit Reject" };
33997
33997
  var pe = class {
33998
33998
  constructor(e = "\r", t = "|", n = "^", i2 = "~", o = "\\", s = "&") {
33999
33999
  this.segmentSeparator = e, this.fieldSeparator = t, this.componentSeparator = n, this.repetitionSeparator = i2, this.escapeCharacter = o, this.subcomponentSeparator = s;
@@ -34005,7 +34005,7 @@ var pe = class {
34005
34005
  return this.componentSeparator + this.repetitionSeparator + this.escapeCharacter + this.subcomponentSeparator;
34006
34006
  }
34007
34007
  };
34008
- var io = class r2 {
34008
+ var ao = class r2 {
34009
34009
  constructor(e, t = new pe()) {
34010
34010
  this.context = t, this.segments = e;
34011
34011
  }
@@ -34028,8 +34028,8 @@ var io = class r2 {
34028
34028
  return this.segments.map((e) => e.toString()).join(this.context.segmentSeparator);
34029
34029
  }
34030
34030
  buildAck(e) {
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] : []]);
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", d2 = e?.ackCode ?? "AA";
34032
+ return new r2([new tt(["MSH", this.context.getMsh2(), s, a2, i2, o, xc(t), "", this.buildAckMessageType(n), t.getTime().toString(), "P", u2], this.context), new tt(["MSA", d2, c, yc[d2]], this.context), ...e?.errSegment ? [e.errSegment] : []]);
34033
34033
  }
34034
34034
  buildAckMessageType(e) {
34035
34035
  let t = e?.getField(9), n = t?.getComponent(2), i2 = t?.getComponent(3), o = "ACK";
@@ -34056,15 +34056,15 @@ var io = class r2 {
34056
34056
  };
34057
34057
  var tt = class r3 {
34058
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];
34059
+ this.context = t, Kn(e) ? this.fields = e.map((n) => X.parse(n, t)) : this.fields = e, this.name = this.fields[0].components[0][0];
34060
34060
  }
34061
34061
  get(e) {
34062
34062
  return this.fields[e];
34063
34063
  }
34064
34064
  getField(e) {
34065
34065
  if (this.name === "MSH") {
34066
- if (e === 1) return new K([[this.context.getMsh1()]], this.context);
34067
- if (e === 2) return new K([[this.context.getMsh2()]], this.context);
34066
+ if (e === 1) return new X([[this.context.getMsh1()]], this.context);
34067
+ if (e === 2) return new X([[this.context.getMsh2()]], this.context);
34068
34068
  if (e > 2) return this.fields[e - 1];
34069
34069
  }
34070
34070
  return this.fields[e];
@@ -34076,26 +34076,26 @@ var tt = class r3 {
34076
34076
  return this.fields.map((e) => e.toString()).join(this.context.fieldSeparator);
34077
34077
  }
34078
34078
  static parse(e, t = new pe()) {
34079
- return new r3(e.split(t.fieldSeparator).map((n) => K.parse(n, t)), t);
34079
+ return new r3(e.split(t.fieldSeparator).map((n) => X.parse(n, t)), t);
34080
34080
  }
34081
34081
  setField(e, t) {
34082
34082
  if (this.name === "MSH") {
34083
34083
  if (e === 1 || e === 2) return false;
34084
34084
  if (e > 2) {
34085
34085
  let n = e - 1;
34086
- for (; this.fields.length <= n; ) this.fields.push(new K([[""]], this.context));
34087
- return this.fields[n] = typeof t == "string" ? K.parse(t, this.context) : t, true;
34086
+ for (; this.fields.length <= n; ) this.fields.push(new X([[""]], this.context));
34087
+ return this.fields[n] = typeof t == "string" ? X.parse(t, this.context) : t, true;
34088
34088
  }
34089
34089
  }
34090
- for (; this.fields.length <= e; ) this.fields.push(new K([[""]], this.context));
34091
- return this.fields[e] = typeof t == "string" ? K.parse(t, this.context) : t, true;
34090
+ for (; this.fields.length <= e; ) this.fields.push(new X([[""]], this.context));
34091
+ return this.fields[e] = typeof t == "string" ? X.parse(t, this.context) : t, true;
34092
34092
  }
34093
34093
  setComponent(e, t, n, i2, o = 0) {
34094
34094
  let s = this.getField(e);
34095
34095
  return s ? s.setComponent(t, n, i2, o) : false;
34096
34096
  }
34097
34097
  };
34098
- var K = class r4 {
34098
+ var X = class r4 {
34099
34099
  constructor(e, t = new pe()) {
34100
34100
  this.context = t, this.components = e;
34101
34101
  }
@@ -34124,13 +34124,13 @@ var K = class r4 {
34124
34124
  return true;
34125
34125
  }
34126
34126
  };
34127
- function yc(r6) {
34127
+ function xc(r6) {
34128
34128
  let e = r6 instanceof Date ? r6 : new Date(r6), n = e.toISOString().replace(/[-:T]/g, "").replace(/(\.\d+)?Z$/, ""), i2 = e.getUTCMilliseconds();
34129
34129
  return i2 > 0 && (n += "." + i2.toString()), n;
34130
34130
  }
34131
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 {
34132
+ var vc = ["NONE", "ERROR", "WARN", "INFO", "DEBUG"];
34133
+ var co = class r5 {
34134
34134
  constructor(e, t = {}, n = Be.INFO, i2 = {}) {
34135
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);
34136
34136
  }
@@ -34156,17 +34156,17 @@ var oo = class r5 {
34156
34156
  }
34157
34157
  log(e, t, n) {
34158
34158
  e > this.level || (n instanceof Error && (n = { error: n.toString(), stack: n.stack?.split(`
34159
- `) }), this.write(JSON.stringify({ level: gc[e], timestamp: (/* @__PURE__ */ new Date()).toISOString(), msg: this.prefix ? `${this.prefix}${t}` : t, ...n, ...this.metadata })));
34159
+ `) }), this.write(JSON.stringify({ level: vc[e], timestamp: (/* @__PURE__ */ new Date()).toISOString(), msg: this.prefix ? `${this.prefix}${t}` : t, ...n, ...this.metadata })));
34160
34160
  }
34161
34161
  };
34162
- function $h(r6) {
34162
+ function Kh(r6) {
34163
34163
  let e = Be[r6.toUpperCase()];
34164
34164
  if (e === void 0) throw new Error(`Invalid log level: ${r6}`);
34165
34165
  return e;
34166
34166
  }
34167
- var Rc = "https://meta.medplum.com/releases";
34167
+ var Pc = "https://meta.medplum.com/releases";
34168
34168
  var tr = /* @__PURE__ */ new Map();
34169
- function Cc(r6) {
34169
+ function wc(r6) {
34170
34170
  let e = r6;
34171
34171
  if (!e.tag_name) throw new Error("Manifest missing tag_name");
34172
34172
  let t = e.assets;
@@ -34179,7 +34179,7 @@ function Cc(r6) {
34179
34179
  async function ln(r6, e, t) {
34180
34180
  let n = tr.get(e ?? "latest");
34181
34181
  if (!n) {
34182
- let i2 = e ? `v${e}` : "latest", o = new URL(`${Rc}/${i2}.json`);
34182
+ let i2 = e ? `v${e}` : "latest", o = new URL(`${Pc}/${i2}.json`);
34183
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);
34184
34184
  let s = await fetch(o.toString());
34185
34185
  if (s.status !== 200) {
@@ -34187,20 +34187,20 @@ async function ln(r6, e, t) {
34187
34187
  try {
34188
34188
  c = (await s.json()).message;
34189
34189
  } catch (u2) {
34190
- console.error(`Failed to parse message from body: ${Oe(u2)}`);
34190
+ console.error(`Failed to parse message from body: ${Ie(u2)}`);
34191
34191
  }
34192
34192
  throw new Error(`Received status code ${s.status} while fetching manifest for version '${e ?? "latest"}'. Message: ${c}`);
34193
34193
  }
34194
34194
  let a2 = await s.json();
34195
- Cc(a2), n = a2, tr.set(e ?? "latest", n), e || tr.set(n.tag_name.slice(1), n);
34195
+ wc(a2), n = a2, tr.set(e ?? "latest", n), e || tr.set(n.tag_name.slice(1), n);
34196
34196
  }
34197
34197
  return n;
34198
34198
  }
34199
- function Pc(r6) {
34199
+ function Ac(r6) {
34200
34200
  return /^\d+\.\d+\.\d+$/.test(r6);
34201
34201
  }
34202
- async function om(r6, e) {
34203
- if (!Pc(e)) return false;
34202
+ async function dm(r6, e) {
34203
+ if (!Ac(e)) return false;
34204
34204
  try {
34205
34205
  await ln(r6, e);
34206
34206
  } catch {
@@ -34208,7 +34208,7 @@ async function om(r6, e) {
34208
34208
  }
34209
34209
  return true;
34210
34210
  }
34211
- async function sm(r6) {
34211
+ async function pm(r6) {
34212
34212
  let e = await ln(r6);
34213
34213
  if (!e.tag_name.startsWith("v")) throw new Error(`Invalid release name found. Release tag '${e.tag_name}' did not start with 'v'`);
34214
34214
  return e.tag_name.slice(1);
@@ -34244,7 +34244,7 @@ var l2 = class extends Event {
34244
34244
  super("close");
34245
34245
  }
34246
34246
  };
34247
- var d2 = class extends a {
34247
+ var d = class extends a {
34248
34248
  constructor(e, s = "utf-8", r6 = false) {
34249
34249
  super();
34250
34250
  this.chunks = [];
@@ -34252,7 +34252,7 @@ var d2 = class extends a {
34252
34252
  this.socket = e, this.encoding = s, this.enhancedMode = r6, e.on("data", (n) => {
34253
34253
  try {
34254
34254
  if (this.appendData(n), n.at(-2) === 28 && n.at(-1) === 13) {
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);
34255
+ let o = Buffer.concat(this.chunks), g2 = o.subarray(1, o.length - 2), E2 = import_iconv_lite.default.decode(g2, this.encoding), k2 = ao.parse(E2);
34256
34256
  this.dispatchEvent(new h2(this, k2)), this.resetBuffer();
34257
34257
  }
34258
34258
  } catch (o) {
@@ -34308,7 +34308,7 @@ var u = class extends a {
34308
34308
  })), this.socket.on("connect", () => {
34309
34309
  if (!this.socket) return;
34310
34310
  let s;
34311
- this.connection = s = new d2(this.socket, this.encoding), this.socket.setTimeout(0), s.addEventListener("close", () => {
34311
+ this.connection = s = new d(this.socket, this.encoding), this.socket.setTimeout(0), s.addEventListener("close", () => {
34312
34312
  this.socket = void 0, this.dispatchEvent(new l2());
34313
34313
  }), s.addEventListener("error", (r6) => {
34314
34314
  this.dispatchEvent(new i(r6.error));
@@ -34334,7 +34334,7 @@ var f2 = class {
34334
34334
  }
34335
34335
  start(t, e, s = false) {
34336
34336
  let r6 = import_node_net2.default.createServer((n) => {
34337
- let o = new d2(n, e, s);
34337
+ let o = new d(n, e, s);
34338
34338
  this.handler(o);
34339
34339
  });
34340
34340
  r6.listen(t), this.server = r6;
@@ -34514,7 +34514,7 @@ var AgentDicomChannel = class extends BaseChannel {
34514
34514
  calledAeTitle: this.association?.getCalledAeTitle()
34515
34515
  },
34516
34516
  dataset: dicomJson,
34517
- binary: binary ? he(binary) : void 0
34517
+ binary: binary ? me(binary) : void 0
34518
34518
  };
34519
34519
  App.instance.addToWebSocketQueue({
34520
34520
  type: "agent:transmit:request",
@@ -34527,7 +34527,7 @@ var AgentDicomChannel = class extends BaseChannel {
34527
34527
  });
34528
34528
  response2.setStatus(dimse.constants.Status.Success);
34529
34529
  } catch (err) {
34530
- DcmjsDimseScp.channel.log.error(`DICOM error: ${Oe(err)}`);
34530
+ DcmjsDimseScp.channel.log.error(`DICOM error: ${Ie(err)}`);
34531
34531
  response2.setStatus(dimse.constants.Status.ProcessingFailure);
34532
34532
  }
34533
34533
  return response2;
@@ -34603,7 +34603,7 @@ var AgentHl7Channel = class extends BaseChannel {
34603
34603
  sendToRemote(msg) {
34604
34604
  const connection = this.connections.get(msg.remote);
34605
34605
  if (connection) {
34606
- connection.hl7Connection.send(io.parse(msg.body));
34606
+ connection.hl7Connection.send(ao.parse(msg.body));
34607
34607
  }
34608
34608
  }
34609
34609
  handleNewConnection(connection) {
@@ -34632,7 +34632,7 @@ var AgentHl7ChannelConnection = class {
34632
34632
  callback: `Agent/${this.channel.app.agentId}-${(0, import_node_crypto2.randomUUID)()}`
34633
34633
  });
34634
34634
  } catch (err) {
34635
- this.channel.log.error(`HL7 error: ${Oe(err)}`);
34635
+ this.channel.log.error(`HL7 error: ${Ie(err)}`);
34636
34636
  }
34637
34637
  }
34638
34638
  close() {
@@ -34726,7 +34726,7 @@ var App = class _App {
34726
34726
  this.medplum = medplum;
34727
34727
  this.agentId = agentId;
34728
34728
  this.logLevel = logLevel;
34729
- this.log = new oo((msg) => console.log(msg), void 0, logLevel);
34729
+ this.log = new co((msg) => console.log(msg), void 0, logLevel);
34730
34730
  }
34731
34731
  async start() {
34732
34732
  this.log.info("Medplum service starting...");
@@ -34872,7 +34872,7 @@ var App = class _App {
34872
34872
  } catch (err) {
34873
34873
  await this.sendToWebSocket({
34874
34874
  type: "agent:error",
34875
- body: Oe(err),
34875
+ body: Ie(err),
34876
34876
  callback: command.callback
34877
34877
  });
34878
34878
  }
@@ -34887,7 +34887,7 @@ var App = class _App {
34887
34887
  this.log.error(`Unknown message type: ${command.type}`);
34888
34888
  }
34889
34889
  } catch (err) {
34890
- this.log.error(`WebSocket error on incoming message: ${Oe(err)}`);
34890
+ this.log.error(`WebSocket error on incoming message: ${Ie(err)}`);
34891
34891
  }
34892
34892
  });
34893
34893
  return new Promise((resolve2) => {
@@ -34959,7 +34959,7 @@ var App = class _App {
34959
34959
  try {
34960
34960
  await this.startOrReloadChannel(definition, endpoint);
34961
34961
  } catch (err) {
34962
- this.log.error(Oe(err));
34962
+ this.log.error(Ie(err));
34963
34963
  }
34964
34964
  }
34965
34965
  }
@@ -34985,7 +34985,7 @@ var App = class _App {
34985
34985
  parsedEndpoint = new URL(endpoint.address);
34986
34986
  } catch (err) {
34987
34987
  throw new Error(
34988
- `Error while validating endpoint address for channel '${channel.name}': ${Oe(err)}`
34988
+ `Error while validating endpoint address for channel '${channel.name}': ${Ie(err)}`
34989
34989
  );
34990
34990
  }
34991
34991
  if (seenPorts.has(parsedEndpoint.port)) {
@@ -35064,7 +35064,7 @@ var App = class _App {
35064
35064
  try {
35065
35065
  await this.sendToWebSocket(msg);
35066
35066
  } catch (err) {
35067
- this.log.error(`WebSocket error while attempting to send message: ${Oe(err)}`);
35067
+ this.log.error(`WebSocket error while attempting to send message: ${Ie(err)}`);
35068
35068
  this.webSocketQueue.unshift(msg);
35069
35069
  throw err;
35070
35070
  }
@@ -35101,7 +35101,7 @@ IPv6 is currently unsupported.`;
35101
35101
  this.log.error(errMsg);
35102
35102
  throw new Error(errMsg);
35103
35103
  }
35104
- if (!((0, import_node_net3.isIPv4)(message.remote) || Rl(message.remote))) {
35104
+ if (!((0, import_node_net3.isIPv4)(message.remote) || Pl(message.remote))) {
35105
35105
  const errMsg = `Attempted to ping an invalid host.
35106
35106
 
35107
35107
  "${message.remote}" is not a valid IPv4 address or a resolvable hostname.`;
@@ -35140,7 +35140,7 @@ ${result}`);
35140
35140
  body: result
35141
35141
  });
35142
35142
  } catch (err) {
35143
- this.log.error(`Error during ping attempt to ${message.remote ?? "NO_HOST_GIVEN"}: ${Oe(err)}`);
35143
+ this.log.error(`Error during ping attempt to ${message.remote ?? "NO_HOST_GIVEN"}: ${Ie(err)}`);
35144
35144
  this.addToWebSocketQueue({
35145
35145
  type: "agent:transmit:response",
35146
35146
  channel: message.channel,
@@ -35148,7 +35148,7 @@ ${result}`);
35148
35148
  remote: message.remote,
35149
35149
  callback: message.callback,
35150
35150
  statusCode: 400,
35151
- body: Oe(err)
35151
+ body: Ie(err)
35152
35152
  });
35153
35153
  }
35154
35154
  }
@@ -35164,7 +35164,7 @@ ${result}`);
35164
35164
  return;
35165
35165
  }
35166
35166
  let child;
35167
- if (message.version && !await om("agent-upgrader", message.version)) {
35167
+ if (message.version && !await dm("agent-upgrader", message.version)) {
35168
35168
  const versionTag = message.version ? `v${message.version}` : "latest";
35169
35169
  const errMsg = `Error during upgrading to version '${versionTag}'. '${message.version}' is not a valid version`;
35170
35170
  this.log.error(errMsg);
@@ -35175,7 +35175,7 @@ ${result}`);
35175
35175
  });
35176
35176
  return;
35177
35177
  }
35178
- const targetVersion = message.version ?? await sm("agent-upgrader");
35178
+ const targetVersion = message.version ?? await pm("agent-upgrader");
35179
35179
  if (Yr.startsWith(targetVersion)) {
35180
35180
  if (!message?.force) {
35181
35181
  this.log.info(`Attempted to upgrade to version ${targetVersion}, but agent is already on that version`);
@@ -35208,11 +35208,11 @@ ${result}`);
35208
35208
  });
35209
35209
  });
35210
35210
  child.on("error", (err) => {
35211
- this.log.error(Oe(err));
35211
+ this.log.error(Ie(err));
35212
35212
  });
35213
35213
  } catch (err) {
35214
35214
  const versionTag = message.version ? `v${message.version}` : "latest";
35215
- const errMsg = `Error during upgrading to version '${versionTag}': ${Oe(err)}`;
35215
+ const errMsg = `Error during upgrading to version '${versionTag}': ${Ie(err)}`;
35216
35216
  this.log.error(errMsg);
35217
35217
  await this.sendToWebSocket({
35218
35218
  type: "agent:error",
@@ -35238,7 +35238,7 @@ ${result}`);
35238
35238
  child.disconnect();
35239
35239
  } catch (err) {
35240
35240
  this.log.error(
35241
- `Error while stopping agent or messaging child process as part of upgrade: ${Oe(err)}`
35241
+ `Error while stopping agent or messaging child process as part of upgrade: ${Ie(err)}`
35242
35242
  );
35243
35243
  import_node_process.default.exit(1);
35244
35244
  }
@@ -35296,7 +35296,7 @@ ${result}`);
35296
35296
  });
35297
35297
  }
35298
35298
  }
35299
- client.sendAndWait(io.parse(message.body)).then((response2) => {
35299
+ client.sendAndWait(ao.parse(message.body)).then((response2) => {
35300
35300
  this.log.info(`Response: ${response2.toString().replaceAll("\r", "\n")}`);
35301
35301
  this.addToWebSocketQueue({
35302
35302
  type: "agent:transmit:response",
@@ -35308,7 +35308,7 @@ ${result}`);
35308
35308
  body: response2.toString()
35309
35309
  });
35310
35310
  }).catch((err) => {
35311
- this.log.error(`HL7 error: ${Oe(err)}`);
35311
+ this.log.error(`HL7 error: ${Ie(err)}`);
35312
35312
  this.addToWebSocketQueue({
35313
35313
  type: "agent:transmit:response",
35314
35314
  channel: message.channel,
@@ -35316,7 +35316,7 @@ ${result}`);
35316
35316
  callback: message.callback,
35317
35317
  contentType: w.TEXT,
35318
35318
  statusCode: 400,
35319
- body: Oe(err)
35319
+ body: Ie(err)
35320
35320
  });
35321
35321
  if (client.keepAlive) {
35322
35322
  this.hl7Clients.delete(message.remote);
@@ -35370,12 +35370,12 @@ async function agentMain(argv) {
35370
35370
  await medplum.startClientLogin(clientId, clientSecret);
35371
35371
  loggedIn = true;
35372
35372
  } catch (err) {
35373
- console.error("Failed to login", { err: Oe(err) });
35373
+ console.error("Failed to login", { err: Ie(err) });
35374
35374
  console.log("Retrying login in 10 seconds...");
35375
35375
  await _r(RETRY_WAIT_DURATION_MS);
35376
35376
  }
35377
35377
  }
35378
- const app = new App(medplum, agentId, $h(args.logLevel ?? "INFO"));
35378
+ const app = new App(medplum, agentId, Kh(args.logLevel ?? "INFO"));
35379
35379
  await app.start();
35380
35380
  process.on("SIGINT", async () => {
35381
35381
  console.log("Gracefully shutting down from SIGINT (Ctrl-C)");
@@ -35400,7 +35400,7 @@ var import_node_os4 = require("node:os");
35400
35400
  var import_node_path3 = __toESM(require("node:path"));
35401
35401
  var import_node_process2 = __toESM(require("node:process"));
35402
35402
  var EXIT_SIGNALS = ["SIGINT", "SIGTERM", "SIGHUP"];
35403
- var pidLogger = new oo((msg) => `[PID]: ${msg}`);
35403
+ var pidLogger = new co((msg) => `[PID]: ${msg}`);
35404
35404
  var pidFilePaths = /* @__PURE__ */ new Set();
35405
35405
  var processExitListener = () => {
35406
35406
  removeAllPidFiles();
@@ -35502,7 +35502,7 @@ async function upgraderMain(argv) {
35502
35502
  if ((0, import_node_os5.platform)() !== "win32") {
35503
35503
  throw new Error(`Unsupported platform: ${(0, import_node_os5.platform)()}. Agent upgrader currently only supports Windows`);
35504
35504
  }
35505
- const globalLogger = new oo((msg) => console.log(msg));
35505
+ const globalLogger = new co((msg) => console.log(msg));
35506
35506
  if (!import_node_process3.default.send) {
35507
35507
  globalLogger.error("Upgrader not started as a child process with Node IPC enabled. Aborting...");
35508
35508
  import_node_process3.default.exit(1);
@@ -35515,10 +35515,10 @@ async function upgraderMain(argv) {
35515
35515
  });
35516
35516
  });
35517
35517
  import_node_process3.default.send({ type: "STARTED" });
35518
- if (argv[3] && !Pc(argv[3])) {
35518
+ if (argv[3] && !Ac(argv[3])) {
35519
35519
  throw new Error("Invalid version specified");
35520
35520
  }
35521
- const version = argv[3] ?? await sm("agent-upgrader");
35521
+ const version = argv[3] ?? await pm("agent-upgrader");
35522
35522
  const binPath = getReleaseBinPath(version);
35523
35523
  if (!(0, import_node_fs6.existsSync)(binPath)) {
35524
35524
  globalLogger.info(`Could not find binary at "${binPath}". Downloading release from GitHub...`);
@@ -35541,7 +35541,7 @@ async function upgraderMain(argv) {
35541
35541
  (0, import_node_child_process2.spawnSync)(binPath, ["/S"]);
35542
35542
  globalLogger.info(`Agent version ${version} successfully installed`);
35543
35543
  } catch (err) {
35544
- globalLogger.error(`Error while attempting to run installer: ${Oe(err)}`);
35544
+ globalLogger.error(`Error while attempting to run installer: ${Ie(err)}`);
35545
35545
  globalLogger.error("Failed to run installer, attempting to restart agent service...");
35546
35546
  try {
35547
35547
  (0, import_node_child_process2.execSync)('net start "Medplum Agent"');