@medplum/agent 5.0.15 → 5.1.0

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 +337 -337
  2. package/package.json +5 -5
@@ -16094,8 +16094,8 @@ var require_dcmjs = __commonJS({
16094
16094
  key: "writeBytes",
16095
16095
  value: function writeBytes(stream, value, writeOptions) {
16096
16096
  var _this8 = this;
16097
- var val = Array.isArray(value) ? value.map(function(ds) {
16098
- return _this8.convertToString(ds);
16097
+ var val = Array.isArray(value) ? value.map(function(ds2) {
16098
+ return _this8.convertToString(ds2);
16099
16099
  }) : [this.convertToString(value)];
16100
16100
  return _get(_getPrototypeOf(DecimalString2.prototype), "writeBytes", this).call(this, stream, val, writeOptions);
16101
16101
  }
@@ -16217,8 +16217,8 @@ var require_dcmjs = __commonJS({
16217
16217
  key: "writeBytes",
16218
16218
  value: function writeBytes(stream, value, writeOptions) {
16219
16219
  var _this11 = this;
16220
- var val = Array.isArray(value) ? value.map(function(is) {
16221
- return _this11.convertToString(is);
16220
+ var val = Array.isArray(value) ? value.map(function(is2) {
16221
+ return _this11.convertToString(is2);
16222
16222
  }) : [this.convertToString(value)];
16223
16223
  return _get(_getPrototypeOf(IntegerString2.prototype), "writeBytes", this).call(this, stream, val, writeOptions);
16224
16224
  }
@@ -16974,7 +16974,7 @@ var require_dcmjs = __commonJS({
16974
16974
  }
16975
16975
  }, {
16976
16976
  key: "is",
16977
- value: function is(t) {
16977
+ value: function is2(t) {
16978
16978
  return this.value == t;
16979
16979
  }
16980
16980
  /**
@@ -18408,8 +18408,8 @@ var require_dcmjs = __commonJS({
18408
18408
  }, {
18409
18409
  key: "isMultiframeDataset",
18410
18410
  value: function isMultiframeDataset() {
18411
- var ds = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : this.dataset;
18412
- var sopClassUID = ds.SOPClassUID.replace(/[^0-9.]/g, "");
18411
+ var ds2 = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : this.dataset;
18412
+ var sopClassUID = ds2.SOPClassUID.replace(/[^0-9.]/g, "");
18413
18413
  return Normalizer2.isMultiframeSOPClassUID(sopClassUID);
18414
18414
  }
18415
18415
  }, {
@@ -18449,16 +18449,16 @@ var require_dcmjs = __commonJS({
18449
18449
  }
18450
18450
  this.derivation = new DerivedImage(this.datasets);
18451
18451
  this.dataset = this.derivation.dataset;
18452
- var ds = this.dataset;
18452
+ var ds2 = this.dataset;
18453
18453
  var referenceDataset = this.datasets[0];
18454
- ds.NumberOfFrames = this.datasets.length;
18455
- ds.SOPClassUID = referenceDataset.SOPClassUID;
18456
- ds.Rows = referenceDataset.Rows;
18457
- ds.Columns = referenceDataset.Columns;
18458
- ds.BitsAllocated = referenceDataset.BitsAllocated;
18459
- ds.PixelRepresentation = referenceDataset.PixelRepresentation;
18460
- ds.RescaleSlope = referenceDataset.RescaleSlope || "1";
18461
- ds.RescaleIntercept = referenceDataset.RescaleIntercept || "0";
18454
+ ds2.NumberOfFrames = this.datasets.length;
18455
+ ds2.SOPClassUID = referenceDataset.SOPClassUID;
18456
+ ds2.Rows = referenceDataset.Rows;
18457
+ ds2.Columns = referenceDataset.Columns;
18458
+ ds2.BitsAllocated = referenceDataset.BitsAllocated;
18459
+ ds2.PixelRepresentation = referenceDataset.PixelRepresentation;
18460
+ ds2.RescaleSlope = referenceDataset.RescaleSlope || "1";
18461
+ ds2.RescaleIntercept = referenceDataset.RescaleIntercept || "0";
18462
18462
  var referencePosition = referenceDataset.ImagePositionPatient;
18463
18463
  var rowVector = referenceDataset.ImageOrientationPatient.slice(0, 3);
18464
18464
  var columnVector = referenceDataset.ImageOrientationPatient.slice(3, 6);
@@ -18473,43 +18473,43 @@ var require_dcmjs = __commonJS({
18473
18473
  distanceDatasetPairs.sort(function(a, b3) {
18474
18474
  return b3[0] - a[0];
18475
18475
  });
18476
- if (ds.BitsAllocated !== 16) {
18476
+ if (ds2.BitsAllocated !== 16) {
18477
18477
  log2.error("Only works with 16 bit data, not " + String(this.dataset.BitsAllocated));
18478
18478
  }
18479
18479
  if (referenceDataset._vrMap && !referenceDataset._vrMap.PixelData) {
18480
18480
  log2.warn("No vr map given for pixel data, using OW");
18481
- ds._vrMap = {
18481
+ ds2._vrMap = {
18482
18482
  PixelData: "OW"
18483
18483
  };
18484
18484
  } else {
18485
- ds._vrMap = {
18485
+ ds2._vrMap = {
18486
18486
  PixelData: referenceDataset._vrMap.PixelData
18487
18487
  };
18488
18488
  }
18489
18489
  var frameSize = referenceDataset.PixelData.byteLength;
18490
- ds.PixelData = new ArrayBuffer(ds.NumberOfFrames * frameSize);
18490
+ ds2.PixelData = new ArrayBuffer(ds2.NumberOfFrames * frameSize);
18491
18491
  var frame = 0;
18492
18492
  distanceDatasetPairs.forEach(function(pair) {
18493
18493
  var dataset = pair[1];
18494
18494
  var pixels = new Uint16Array(dataset.PixelData);
18495
- var frameView = new Uint16Array(ds.PixelData, frame * frameSize, frameSize / 2);
18495
+ var frameView = new Uint16Array(ds2.PixelData, frame * frameSize, frameSize / 2);
18496
18496
  try {
18497
18497
  frameView.set(pixels);
18498
18498
  } catch (e) {
18499
18499
  if (e instanceof RangeError) {
18500
- var message2 = "Error inserting pixels in PixelData\n" + "frameSize ".concat(frameSize, "\n") + "NumberOfFrames ".concat(ds.NumberOfFrames, "\n") + "pair ".concat(pair, "\n") + "dataset PixelData size ".concat(dataset.PixelData.length);
18500
+ var message2 = "Error inserting pixels in PixelData\n" + "frameSize ".concat(frameSize, "\n") + "NumberOfFrames ".concat(ds2.NumberOfFrames, "\n") + "pair ".concat(pair, "\n") + "dataset PixelData size ".concat(dataset.PixelData.length);
18501
18501
  log2.error(message2);
18502
18502
  }
18503
18503
  }
18504
18504
  frame++;
18505
18505
  });
18506
- if (ds.NumberOfFrames < 2) {
18506
+ if (ds2.NumberOfFrames < 2) {
18507
18507
  log2.error("Cannot populate shared groups uniquely without multiple frames");
18508
18508
  }
18509
18509
  var _distanceDatasetPairs = _slicedToArray(distanceDatasetPairs[0], 2), distance0 = _distanceDatasetPairs[0], dataset0 = _distanceDatasetPairs[1];
18510
18510
  var distance1 = distanceDatasetPairs[1][0];
18511
18511
  var SpacingBetweenSlices = Math.abs(distance1 - distance0);
18512
- ds.SharedFunctionalGroupsSequence = {
18512
+ ds2.SharedFunctionalGroupsSequence = {
18513
18513
  PlaneOrientationSequence: {
18514
18514
  ImageOrientationPatient: dataset0.ImageOrientationPatient
18515
18515
  },
@@ -18519,14 +18519,14 @@ var require_dcmjs = __commonJS({
18519
18519
  SliceThickness: SpacingBetweenSlices
18520
18520
  }
18521
18521
  };
18522
- ds.ReferencedSeriesSequence = {
18522
+ ds2.ReferencedSeriesSequence = {
18523
18523
  SeriesInstanceUID: dataset0.SeriesInstanceUID,
18524
18524
  ReferencedInstanceSequence: []
18525
18525
  };
18526
- ds.PerFrameFunctionalGroupsSequence = [];
18526
+ ds2.PerFrameFunctionalGroupsSequence = [];
18527
18527
  distanceDatasetPairs.forEach(function(pair) {
18528
18528
  var dataset = pair[1];
18529
- ds.PerFrameFunctionalGroupsSequence.push({
18529
+ ds2.PerFrameFunctionalGroupsSequence.push({
18530
18530
  PlanePositionSequence: {
18531
18531
  ImagePositionPatient: dataset.ImagePositionPatient
18532
18532
  },
@@ -18535,7 +18535,7 @@ var require_dcmjs = __commonJS({
18535
18535
  WindowWidth: dataset.WindowWidth
18536
18536
  }
18537
18537
  });
18538
- ds.ReferencedSeriesSequence.ReferencedInstanceSequence.push({
18538
+ ds2.ReferencedSeriesSequence.ReferencedInstanceSequence.push({
18539
18539
  ReferencedSOPClassUID: dataset.SOPClassUID,
18540
18540
  ReferencedSOPInstanceUID: dataset.SOPInstanceUID
18541
18541
  });
@@ -18555,29 +18555,29 @@ var require_dcmjs = __commonJS({
18555
18555
  }, {
18556
18556
  key: "normalizeMultiframe",
18557
18557
  value: function normalizeMultiframe() {
18558
- var ds = this.dataset;
18559
- if (!ds.NumberOfFrames) {
18558
+ var ds2 = this.dataset;
18559
+ if (!ds2.NumberOfFrames) {
18560
18560
  log2.error("Missing number or frames not supported");
18561
18561
  return;
18562
18562
  }
18563
- if (!ds.PixelRepresentation) {
18564
- ds.PixelRepresentation = 1;
18563
+ if (!ds2.PixelRepresentation) {
18564
+ ds2.PixelRepresentation = 1;
18565
18565
  }
18566
- if (!ds.StudyID || ds.StudyID === "") {
18567
- ds.StudyID = "No Study ID";
18566
+ if (!ds2.StudyID || ds2.StudyID === "") {
18567
+ ds2.StudyID = "No Study ID";
18568
18568
  }
18569
18569
  var validLateralities = ["R", "L"];
18570
- if (validLateralities.indexOf(ds.Laterality) === -1) {
18571
- delete ds.Laterality;
18570
+ if (validLateralities.indexOf(ds2.Laterality) === -1) {
18571
+ delete ds2.Laterality;
18572
18572
  }
18573
- if (!ds.PresentationLUTShape) {
18574
- ds.PresentationLUTShape = "IDENTITY";
18573
+ if (!ds2.PresentationLUTShape) {
18574
+ ds2.PresentationLUTShape = "IDENTITY";
18575
18575
  }
18576
- if (!ds.SharedFunctionalGroupsSequence) {
18576
+ if (!ds2.SharedFunctionalGroupsSequence) {
18577
18577
  log2.error("Can only process multiframe data with SharedFunctionalGroupsSequence");
18578
18578
  }
18579
- if (ds.BodyPartExamined === "PROSTATE") {
18580
- ds.SharedFunctionalGroupsSequence.FrameAnatomySequence = {
18579
+ if (ds2.BodyPartExamined === "PROSTATE") {
18580
+ ds2.SharedFunctionalGroupsSequence.FrameAnatomySequence = {
18581
18581
  AnatomicRegionSequence: {
18582
18582
  CodeValue: "T-9200B",
18583
18583
  CodingSchemeDesignator: "SRT",
@@ -18586,17 +18586,17 @@ var require_dcmjs = __commonJS({
18586
18586
  FrameLaterality: "U"
18587
18587
  };
18588
18588
  }
18589
- var rescaleIntercept = ds.RescaleIntercept || 0;
18590
- var rescaleSlope = ds.RescaleSlope || 1;
18591
- ds.SharedFunctionalGroupsSequence.PixelValueTransformationSequence = {
18589
+ var rescaleIntercept = ds2.RescaleIntercept || 0;
18590
+ var rescaleSlope = ds2.RescaleSlope || 1;
18591
+ ds2.SharedFunctionalGroupsSequence.PixelValueTransformationSequence = {
18592
18592
  RescaleIntercept: rescaleIntercept,
18593
18593
  RescaleSlope: rescaleSlope,
18594
18594
  RescaleType: "US"
18595
18595
  };
18596
18596
  var frameNumber = 1;
18597
18597
  this.datasets.forEach(function(dataset) {
18598
- if (ds.NumberOfFrames === 1) ds.PerFrameFunctionalGroupsSequence = [ds.PerFrameFunctionalGroupsSequence];
18599
- ds.PerFrameFunctionalGroupsSequence[frameNumber - 1].FrameContentSequence = {
18598
+ if (ds2.NumberOfFrames === 1) ds2.PerFrameFunctionalGroupsSequence = [ds2.PerFrameFunctionalGroupsSequence];
18599
+ ds2.PerFrameFunctionalGroupsSequence[frameNumber - 1].FrameContentSequence = {
18600
18600
  FrameAcquisitionDuration: 0,
18601
18601
  StackID: 1,
18602
18602
  InStackPositionNumber: frameNumber,
@@ -18604,30 +18604,30 @@ var require_dcmjs = __commonJS({
18604
18604
  };
18605
18605
  var frameTime = dataset.AcquisitionDate + dataset.AcquisitionTime;
18606
18606
  if (!isNaN(frameTime)) {
18607
- var frameContentSequence = ds.PerFrameFunctionalGroupsSequence[frameNumber - 1].FrameContentSequence;
18607
+ var frameContentSequence = ds2.PerFrameFunctionalGroupsSequence[frameNumber - 1].FrameContentSequence;
18608
18608
  frameContentSequence.FrameAcquisitionDateTime = frameTime;
18609
18609
  frameContentSequence.FrameReferenceDateTime = frameTime;
18610
18610
  }
18611
18611
  frameNumber++;
18612
18612
  });
18613
- if (ds.WindowCenter && ds.WindowWidth) {
18614
- if (!Array.isArray(ds.WindowCenter)) {
18615
- ds.WindowCenter = [ds.WindowCenter];
18613
+ if (ds2.WindowCenter && ds2.WindowWidth) {
18614
+ if (!Array.isArray(ds2.WindowCenter)) {
18615
+ ds2.WindowCenter = [ds2.WindowCenter];
18616
18616
  }
18617
- if (!Array.isArray(ds.WindowWidth)) {
18618
- ds.WindowWidth = [ds.WindowWidth];
18617
+ if (!Array.isArray(ds2.WindowWidth)) {
18618
+ ds2.WindowWidth = [ds2.WindowWidth];
18619
18619
  }
18620
18620
  }
18621
- if (!ds.WindowCenter || !ds.WindowWidth) {
18622
- ds.WindowCenter = [];
18623
- ds.WindowWidth = [];
18624
- if (ds.PerFrameFunctionalGroupsSequence) {
18621
+ if (!ds2.WindowCenter || !ds2.WindowWidth) {
18622
+ ds2.WindowCenter = [];
18623
+ ds2.WindowWidth = [];
18624
+ if (ds2.PerFrameFunctionalGroupsSequence) {
18625
18625
  var wcww = {
18626
18626
  center: 0,
18627
18627
  width: 0,
18628
18628
  count: 0
18629
18629
  };
18630
- ds.PerFrameFunctionalGroupsSequence.forEach(function(functionalGroup) {
18630
+ ds2.PerFrameFunctionalGroupsSequence.forEach(function(functionalGroup) {
18631
18631
  if (functionalGroup.FrameVOILUT) {
18632
18632
  var wc = functionalGroup.FrameVOILUTSequence.WindowCenter;
18633
18633
  var ww = functionalGroup.FrameVOILUTSequence.WindowWidth;
@@ -18645,16 +18645,16 @@ var require_dcmjs = __commonJS({
18645
18645
  }
18646
18646
  });
18647
18647
  if (wcww.count > 0) {
18648
- ds.WindowCenter.push(String(wcww.center / wcww.count));
18649
- ds.WindowWidth.push(String(wcww.width / wcww.count));
18648
+ ds2.WindowCenter.push(String(wcww.center / wcww.count));
18649
+ ds2.WindowWidth.push(String(wcww.width / wcww.count));
18650
18650
  }
18651
18651
  }
18652
18652
  }
18653
- if (ds.WindowCenter.length === 0) {
18654
- ds.WindowCenter = [300];
18653
+ if (ds2.WindowCenter.length === 0) {
18654
+ ds2.WindowCenter = [300];
18655
18655
  }
18656
- if (ds.WindowWidth.length === 0) {
18657
- ds.WindowWidth = [500];
18656
+ if (ds2.WindowWidth.length === 0) {
18657
+ ds2.WindowWidth = [500];
18658
18658
  }
18659
18659
  }
18660
18660
  }], [{
@@ -18700,12 +18700,12 @@ var require_dcmjs = __commonJS({
18700
18700
  key: "normalizeMultiframe",
18701
18701
  value: function normalizeMultiframe() {
18702
18702
  _get(_getPrototypeOf(MRImageNormalizer2.prototype), "normalizeMultiframe", this).call(this);
18703
- var ds = this.dataset;
18704
- if (!ds.ImageType || !ds.ImageType.constructor || ds.ImageType.constructor.name != "Array" || ds.ImageType.length != 4) {
18705
- ds.ImageType = ["ORIGINAL", "PRIMARY", "OTHER", "NONE"];
18703
+ var ds2 = this.dataset;
18704
+ if (!ds2.ImageType || !ds2.ImageType.constructor || ds2.ImageType.constructor.name != "Array" || ds2.ImageType.length != 4) {
18705
+ ds2.ImageType = ["ORIGINAL", "PRIMARY", "OTHER", "NONE"];
18706
18706
  }
18707
- ds.SharedFunctionalGroupsSequence.MRImageFrameTypeSequence = {
18708
- FrameType: ds.ImageType,
18707
+ ds2.SharedFunctionalGroupsSequence.MRImageFrameTypeSequence = {
18708
+ FrameType: ds2.ImageType,
18709
18709
  PixelPresentation: "MONOCHROME",
18710
18710
  VolumetricProperties: "VOLUME",
18711
18711
  VolumeBasedCalculationTechnique: "NONE",
@@ -18830,9 +18830,9 @@ var require_dcmjs = __commonJS({
18830
18830
  key: "normalize",
18831
18831
  value: function normalize3() {
18832
18832
  _get(_getPrototypeOf(PMImageNormalizer2.prototype), "normalize", this).call(this);
18833
- var ds = this.datasets[0];
18834
- if (ds.BitsAllocated !== 32) {
18835
- log2.error("Only works with 32 bit data, not " + String(ds.BitsAllocated));
18833
+ var ds2 = this.datasets[0];
18834
+ if (ds2.BitsAllocated !== 32) {
18835
+ log2.error("Only works with 32 bit data, not " + String(ds2.BitsAllocated));
18836
18836
  }
18837
18837
  }
18838
18838
  }]);
@@ -29204,17 +29204,17 @@ var require_decorator = __commonJS({
29204
29204
  return mergedObject;
29205
29205
  };
29206
29206
  var mergePropertyAndMethodDecorators = (d1, d2) => {
29207
- var _a2, _b, _c2, _d;
29207
+ var _a2, _b, _c, _d;
29208
29208
  return {
29209
29209
  property: mergeObjectsOfDecorators((_a2 = d1 === null || d1 === void 0 ? void 0 : d1.property) !== null && _a2 !== void 0 ? _a2 : {}, (_b = d2 === null || d2 === void 0 ? void 0 : d2.property) !== null && _b !== void 0 ? _b : {}),
29210
- method: mergeObjectsOfDecorators((_c2 = d1 === null || d1 === void 0 ? void 0 : d1.method) !== null && _c2 !== void 0 ? _c2 : {}, (_d = d2 === null || d2 === void 0 ? void 0 : d2.method) !== null && _d !== void 0 ? _d : {})
29210
+ 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 : {})
29211
29211
  };
29212
29212
  };
29213
29213
  var mergeDecorators = (d1, d2) => {
29214
- var _a2, _b, _c2, _d, _e2, _f;
29214
+ var _a2, _b, _c, _d, _e2, _f;
29215
29215
  return {
29216
29216
  class: (0, util_1.unique)([...(_a2 = d1 === null || d1 === void 0 ? void 0 : d1.class) !== null && _a2 !== void 0 ? _a2 : [], ...(_b = d2 === null || d2 === void 0 ? void 0 : d2.class) !== null && _b !== void 0 ? _b : []]),
29217
- static: mergePropertyAndMethodDecorators((_c2 = d1 === null || d1 === void 0 ? void 0 : d1.static) !== null && _c2 !== void 0 ? _c2 : {}, (_d = d2 === null || d2 === void 0 ? void 0 : d2.static) !== null && _d !== void 0 ? _d : {}),
29217
+ 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 : {}),
29218
29218
  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 : {})
29219
29219
  };
29220
29220
  };
@@ -29275,7 +29275,7 @@ var require_decorator = __commonJS({
29275
29275
  return decorator(clazz);
29276
29276
  });
29277
29277
  var decorateMember = (decorator) => ((object, key, ...otherArgs) => {
29278
- var _a2, _b, _c2;
29278
+ var _a2, _b, _c;
29279
29279
  const decoratorTargetType = typeof object === "function" ? "static" : "instance";
29280
29280
  const decoratorType = typeof object[key] === "function" ? "method" : "property";
29281
29281
  const clazz = decoratorTargetType === "static" ? object : object.constructor;
@@ -29284,7 +29284,7 @@ var require_decorator = __commonJS({
29284
29284
  decoratorsForClass[decoratorTargetType] = decoratorsForTargetType;
29285
29285
  let decoratorsForType = (_b = decoratorsForTargetType === null || decoratorsForTargetType === void 0 ? void 0 : decoratorsForTargetType[decoratorType]) !== null && _b !== void 0 ? _b : {};
29286
29286
  decoratorsForTargetType[decoratorType] = decoratorsForType;
29287
- let decoratorsForKey = (_c2 = decoratorsForType === null || decoratorsForType === void 0 ? void 0 : decoratorsForType[key]) !== null && _c2 !== void 0 ? _c2 : [];
29287
+ let decoratorsForKey = (_c = decoratorsForType === null || decoratorsForType === void 0 ? void 0 : decoratorsForType[key]) !== null && _c !== void 0 ? _c : [];
29288
29288
  decoratorsForType[key] = decoratorsForKey;
29289
29289
  decoratorsForKey.push(decorator);
29290
29290
  return decorator(object, key, ...otherArgs);
@@ -29310,7 +29310,7 @@ var require_mixins = __commonJS({
29310
29310
  var decorator_1 = require_decorator();
29311
29311
  var mixin_tracking_1 = require_mixin_tracking();
29312
29312
  function Mixin(...constructors) {
29313
- var _a2, _b, _c2;
29313
+ var _a2, _b, _c;
29314
29314
  const prototypes = constructors.map((constructor) => constructor.prototype);
29315
29315
  const initFunctionName = settings_1.settings.initFunction;
29316
29316
  if (initFunctionName !== null) {
@@ -29340,7 +29340,7 @@ var require_mixins = __commonJS({
29340
29340
  }
29341
29341
  }
29342
29342
  applyPropAndMethodDecorators((_b = classDecorators === null || classDecorators === void 0 ? void 0 : classDecorators.static) !== null && _b !== void 0 ? _b : {}, DecoratedMixedClass);
29343
- applyPropAndMethodDecorators((_c2 = classDecorators === null || classDecorators === void 0 ? void 0 : classDecorators.instance) !== null && _c2 !== void 0 ? _c2 : {}, DecoratedMixedClass.prototype);
29343
+ applyPropAndMethodDecorators((_c = classDecorators === null || classDecorators === void 0 ? void 0 : classDecorators.instance) !== null && _c !== void 0 ? _c : {}, DecoratedMixedClass.prototype);
29344
29344
  }
29345
29345
  (0, mixin_tracking_1.registerMixins)(DecoratedMixedClass, constructors);
29346
29346
  return DecoratedMixedClass;
@@ -35798,8 +35798,8 @@ var require_dcmjs2 = __commonJS({
35798
35798
  key: "writeBytes",
35799
35799
  value: function writeBytes(stream, value, writeOptions) {
35800
35800
  var _this8 = this;
35801
- var val = Array.isArray(value) ? value.map(function(ds) {
35802
- return _this8.convertToString(ds);
35801
+ var val = Array.isArray(value) ? value.map(function(ds2) {
35802
+ return _this8.convertToString(ds2);
35803
35803
  }) : [this.convertToString(value)];
35804
35804
  return _get(_getPrototypeOf(DecimalString2.prototype), "writeBytes", this).call(this, stream, val, writeOptions);
35805
35805
  }
@@ -35921,8 +35921,8 @@ var require_dcmjs2 = __commonJS({
35921
35921
  key: "writeBytes",
35922
35922
  value: function writeBytes(stream, value, writeOptions) {
35923
35923
  var _this13 = this;
35924
- var val = Array.isArray(value) ? value.map(function(is) {
35925
- return _this13.convertToString(is);
35924
+ var val = Array.isArray(value) ? value.map(function(is2) {
35925
+ return _this13.convertToString(is2);
35926
35926
  }) : [this.convertToString(value)];
35927
35927
  return _get(_getPrototypeOf(IntegerString2.prototype), "writeBytes", this).call(this, stream, val, writeOptions);
35928
35928
  }
@@ -36678,7 +36678,7 @@ var require_dcmjs2 = __commonJS({
36678
36678
  }
36679
36679
  }, {
36680
36680
  key: "is",
36681
- value: function is(t) {
36681
+ value: function is2(t) {
36682
36682
  return this.value == t;
36683
36683
  }
36684
36684
  }, {
@@ -37572,8 +37572,8 @@ var require_dcmjs2 = __commonJS({
37572
37572
  }, {
37573
37573
  key: "isMultiframeDataset",
37574
37574
  value: function isMultiframeDataset() {
37575
- var ds = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : this.dataset;
37576
- var sopClassUID = ds.SOPClassUID.replace(/[^0-9.]/g, "");
37575
+ var ds2 = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : this.dataset;
37576
+ var sopClassUID = ds2.SOPClassUID.replace(/[^0-9.]/g, "");
37577
37577
  return Normalizer2.isMultiframeSOPClassUID(sopClassUID);
37578
37578
  }
37579
37579
  }, {
@@ -37613,16 +37613,16 @@ var require_dcmjs2 = __commonJS({
37613
37613
  }
37614
37614
  this.derivation = new DerivedImage(this.datasets);
37615
37615
  this.dataset = this.derivation.dataset;
37616
- var ds = this.dataset;
37616
+ var ds2 = this.dataset;
37617
37617
  var referenceDataset = this.datasets[0];
37618
- ds.NumberOfFrames = this.datasets.length;
37619
- ds.SOPClassUID = referenceDataset.SOPClassUID;
37620
- ds.Rows = referenceDataset.Rows;
37621
- ds.Columns = referenceDataset.Columns;
37622
- ds.BitsAllocated = referenceDataset.BitsAllocated;
37623
- ds.PixelRepresentation = referenceDataset.PixelRepresentation;
37624
- ds.RescaleSlope = referenceDataset.RescaleSlope || "1";
37625
- ds.RescaleIntercept = referenceDataset.RescaleIntercept || "0";
37618
+ ds2.NumberOfFrames = this.datasets.length;
37619
+ ds2.SOPClassUID = referenceDataset.SOPClassUID;
37620
+ ds2.Rows = referenceDataset.Rows;
37621
+ ds2.Columns = referenceDataset.Columns;
37622
+ ds2.BitsAllocated = referenceDataset.BitsAllocated;
37623
+ ds2.PixelRepresentation = referenceDataset.PixelRepresentation;
37624
+ ds2.RescaleSlope = referenceDataset.RescaleSlope || "1";
37625
+ ds2.RescaleIntercept = referenceDataset.RescaleIntercept || "0";
37626
37626
  var referencePosition = referenceDataset.ImagePositionPatient;
37627
37627
  var rowVector = referenceDataset.ImageOrientationPatient.slice(0, 3);
37628
37628
  var columnVector = referenceDataset.ImageOrientationPatient.slice(3, 6);
@@ -37637,43 +37637,43 @@ var require_dcmjs2 = __commonJS({
37637
37637
  distanceDatasetPairs.sort(function(a, b3) {
37638
37638
  return b3[0] - a[0];
37639
37639
  });
37640
- if (ds.BitsAllocated !== 16) {
37640
+ if (ds2.BitsAllocated !== 16) {
37641
37641
  log2.error("Only works with 16 bit data, not " + String(this.dataset.BitsAllocated));
37642
37642
  }
37643
37643
  if (referenceDataset._vrMap && !referenceDataset._vrMap.PixelData) {
37644
37644
  log2.warn("No vr map given for pixel data, using OW");
37645
- ds._vrMap = {
37645
+ ds2._vrMap = {
37646
37646
  PixelData: "OW"
37647
37647
  };
37648
37648
  } else {
37649
- ds._vrMap = {
37649
+ ds2._vrMap = {
37650
37650
  PixelData: referenceDataset._vrMap.PixelData
37651
37651
  };
37652
37652
  }
37653
37653
  var frameSize = referenceDataset.PixelData.byteLength;
37654
- ds.PixelData = new ArrayBuffer(ds.NumberOfFrames * frameSize);
37654
+ ds2.PixelData = new ArrayBuffer(ds2.NumberOfFrames * frameSize);
37655
37655
  var frame = 0;
37656
37656
  distanceDatasetPairs.forEach(function(pair) {
37657
37657
  var dataset = pair[1];
37658
37658
  var pixels = new Uint16Array(dataset.PixelData);
37659
- var frameView = new Uint16Array(ds.PixelData, frame * frameSize, frameSize / 2);
37659
+ var frameView = new Uint16Array(ds2.PixelData, frame * frameSize, frameSize / 2);
37660
37660
  try {
37661
37661
  frameView.set(pixels);
37662
37662
  } catch (e) {
37663
37663
  if (e instanceof RangeError) {
37664
- var message2 = "Error inserting pixels in PixelData\n" + "frameSize ".concat(frameSize, "\n") + "NumberOfFrames ".concat(ds.NumberOfFrames, "\n") + "pair ".concat(pair, "\n") + "dataset PixelData size ".concat(dataset.PixelData.length);
37664
+ var message2 = "Error inserting pixels in PixelData\n" + "frameSize ".concat(frameSize, "\n") + "NumberOfFrames ".concat(ds2.NumberOfFrames, "\n") + "pair ".concat(pair, "\n") + "dataset PixelData size ".concat(dataset.PixelData.length);
37665
37665
  log2.error(message2);
37666
37666
  }
37667
37667
  }
37668
37668
  frame++;
37669
37669
  });
37670
- if (ds.NumberOfFrames < 2) {
37670
+ if (ds2.NumberOfFrames < 2) {
37671
37671
  log2.error("Cannot populate shared groups uniquely without multiple frames");
37672
37672
  }
37673
37673
  var _distanceDatasetPairs = _slicedToArray(distanceDatasetPairs[0], 2), distance0 = _distanceDatasetPairs[0], dataset0 = _distanceDatasetPairs[1];
37674
37674
  var distance1 = distanceDatasetPairs[1][0];
37675
37675
  var SpacingBetweenSlices = Math.abs(distance1 - distance0);
37676
- ds.SharedFunctionalGroupsSequence = {
37676
+ ds2.SharedFunctionalGroupsSequence = {
37677
37677
  PlaneOrientationSequence: {
37678
37678
  ImageOrientationPatient: dataset0.ImageOrientationPatient
37679
37679
  },
@@ -37683,14 +37683,14 @@ var require_dcmjs2 = __commonJS({
37683
37683
  SliceThickness: SpacingBetweenSlices
37684
37684
  }
37685
37685
  };
37686
- ds.ReferencedSeriesSequence = {
37686
+ ds2.ReferencedSeriesSequence = {
37687
37687
  SeriesInstanceUID: dataset0.SeriesInstanceUID,
37688
37688
  ReferencedInstanceSequence: []
37689
37689
  };
37690
- ds.PerFrameFunctionalGroupsSequence = [];
37690
+ ds2.PerFrameFunctionalGroupsSequence = [];
37691
37691
  distanceDatasetPairs.forEach(function(pair) {
37692
37692
  var dataset = pair[1];
37693
- ds.PerFrameFunctionalGroupsSequence.push({
37693
+ ds2.PerFrameFunctionalGroupsSequence.push({
37694
37694
  PlanePositionSequence: {
37695
37695
  ImagePositionPatient: dataset.ImagePositionPatient
37696
37696
  },
@@ -37699,7 +37699,7 @@ var require_dcmjs2 = __commonJS({
37699
37699
  WindowWidth: dataset.WindowWidth
37700
37700
  }
37701
37701
  });
37702
- ds.ReferencedSeriesSequence.ReferencedInstanceSequence.push({
37702
+ ds2.ReferencedSeriesSequence.ReferencedInstanceSequence.push({
37703
37703
  ReferencedSOPClassUID: dataset.SOPClassUID,
37704
37704
  ReferencedSOPInstanceUID: dataset.SOPInstanceUID
37705
37705
  });
@@ -37719,29 +37719,29 @@ var require_dcmjs2 = __commonJS({
37719
37719
  }, {
37720
37720
  key: "normalizeMultiframe",
37721
37721
  value: function normalizeMultiframe() {
37722
- var ds = this.dataset;
37723
- if (!ds.NumberOfFrames) {
37722
+ var ds2 = this.dataset;
37723
+ if (!ds2.NumberOfFrames) {
37724
37724
  log2.error("Missing number or frames not supported");
37725
37725
  return;
37726
37726
  }
37727
- if (!ds.PixelRepresentation) {
37728
- ds.PixelRepresentation = 1;
37727
+ if (!ds2.PixelRepresentation) {
37728
+ ds2.PixelRepresentation = 1;
37729
37729
  }
37730
- if (!ds.StudyID || ds.StudyID === "") {
37731
- ds.StudyID = "No Study ID";
37730
+ if (!ds2.StudyID || ds2.StudyID === "") {
37731
+ ds2.StudyID = "No Study ID";
37732
37732
  }
37733
37733
  var validLateralities = ["R", "L"];
37734
- if (validLateralities.indexOf(ds.Laterality) === -1) {
37735
- delete ds.Laterality;
37734
+ if (validLateralities.indexOf(ds2.Laterality) === -1) {
37735
+ delete ds2.Laterality;
37736
37736
  }
37737
- if (!ds.PresentationLUTShape) {
37738
- ds.PresentationLUTShape = "IDENTITY";
37737
+ if (!ds2.PresentationLUTShape) {
37738
+ ds2.PresentationLUTShape = "IDENTITY";
37739
37739
  }
37740
- if (!ds.SharedFunctionalGroupsSequence) {
37740
+ if (!ds2.SharedFunctionalGroupsSequence) {
37741
37741
  log2.error("Can only process multiframe data with SharedFunctionalGroupsSequence");
37742
37742
  }
37743
- if (ds.BodyPartExamined === "PROSTATE") {
37744
- ds.SharedFunctionalGroupsSequence.FrameAnatomySequence = {
37743
+ if (ds2.BodyPartExamined === "PROSTATE") {
37744
+ ds2.SharedFunctionalGroupsSequence.FrameAnatomySequence = {
37745
37745
  AnatomicRegionSequence: {
37746
37746
  CodeValue: "T-9200B",
37747
37747
  CodingSchemeDesignator: "SRT",
@@ -37750,17 +37750,17 @@ var require_dcmjs2 = __commonJS({
37750
37750
  FrameLaterality: "U"
37751
37751
  };
37752
37752
  }
37753
- var rescaleIntercept = ds.RescaleIntercept || 0;
37754
- var rescaleSlope = ds.RescaleSlope || 1;
37755
- ds.SharedFunctionalGroupsSequence.PixelValueTransformationSequence = {
37753
+ var rescaleIntercept = ds2.RescaleIntercept || 0;
37754
+ var rescaleSlope = ds2.RescaleSlope || 1;
37755
+ ds2.SharedFunctionalGroupsSequence.PixelValueTransformationSequence = {
37756
37756
  RescaleIntercept: rescaleIntercept,
37757
37757
  RescaleSlope: rescaleSlope,
37758
37758
  RescaleType: "US"
37759
37759
  };
37760
37760
  var frameNumber = 1;
37761
37761
  this.datasets.forEach(function(dataset) {
37762
- if (ds.NumberOfFrames === 1) ds.PerFrameFunctionalGroupsSequence = [ds.PerFrameFunctionalGroupsSequence];
37763
- ds.PerFrameFunctionalGroupsSequence[frameNumber - 1].FrameContentSequence = {
37762
+ if (ds2.NumberOfFrames === 1) ds2.PerFrameFunctionalGroupsSequence = [ds2.PerFrameFunctionalGroupsSequence];
37763
+ ds2.PerFrameFunctionalGroupsSequence[frameNumber - 1].FrameContentSequence = {
37764
37764
  FrameAcquisitionDuration: 0,
37765
37765
  StackID: 1,
37766
37766
  InStackPositionNumber: frameNumber,
@@ -37768,30 +37768,30 @@ var require_dcmjs2 = __commonJS({
37768
37768
  };
37769
37769
  var frameTime = dataset.AcquisitionDate + dataset.AcquisitionTime;
37770
37770
  if (!isNaN(frameTime)) {
37771
- var frameContentSequence = ds.PerFrameFunctionalGroupsSequence[frameNumber - 1].FrameContentSequence;
37771
+ var frameContentSequence = ds2.PerFrameFunctionalGroupsSequence[frameNumber - 1].FrameContentSequence;
37772
37772
  frameContentSequence.FrameAcquisitionDateTime = frameTime;
37773
37773
  frameContentSequence.FrameReferenceDateTime = frameTime;
37774
37774
  }
37775
37775
  frameNumber++;
37776
37776
  });
37777
- if (ds.WindowCenter && ds.WindowWidth) {
37778
- if (!Array.isArray(ds.WindowCenter)) {
37779
- ds.WindowCenter = [ds.WindowCenter];
37777
+ if (ds2.WindowCenter && ds2.WindowWidth) {
37778
+ if (!Array.isArray(ds2.WindowCenter)) {
37779
+ ds2.WindowCenter = [ds2.WindowCenter];
37780
37780
  }
37781
- if (!Array.isArray(ds.WindowWidth)) {
37782
- ds.WindowWidth = [ds.WindowWidth];
37781
+ if (!Array.isArray(ds2.WindowWidth)) {
37782
+ ds2.WindowWidth = [ds2.WindowWidth];
37783
37783
  }
37784
37784
  }
37785
- if (!ds.WindowCenter || !ds.WindowWidth) {
37786
- ds.WindowCenter = [];
37787
- ds.WindowWidth = [];
37788
- if (ds.PerFrameFunctionalGroupsSequence) {
37785
+ if (!ds2.WindowCenter || !ds2.WindowWidth) {
37786
+ ds2.WindowCenter = [];
37787
+ ds2.WindowWidth = [];
37788
+ if (ds2.PerFrameFunctionalGroupsSequence) {
37789
37789
  var wcww = {
37790
37790
  center: 0,
37791
37791
  width: 0,
37792
37792
  count: 0
37793
37793
  };
37794
- ds.PerFrameFunctionalGroupsSequence.forEach(function(functionalGroup) {
37794
+ ds2.PerFrameFunctionalGroupsSequence.forEach(function(functionalGroup) {
37795
37795
  if (functionalGroup.FrameVOILUT) {
37796
37796
  var wc = functionalGroup.FrameVOILUTSequence.WindowCenter;
37797
37797
  var ww = functionalGroup.FrameVOILUTSequence.WindowWidth;
@@ -37809,16 +37809,16 @@ var require_dcmjs2 = __commonJS({
37809
37809
  }
37810
37810
  });
37811
37811
  if (wcww.count > 0) {
37812
- ds.WindowCenter.push(String(wcww.center / wcww.count));
37813
- ds.WindowWidth.push(String(wcww.width / wcww.count));
37812
+ ds2.WindowCenter.push(String(wcww.center / wcww.count));
37813
+ ds2.WindowWidth.push(String(wcww.width / wcww.count));
37814
37814
  }
37815
37815
  }
37816
37816
  }
37817
- if (ds.WindowCenter.length === 0) {
37818
- ds.WindowCenter = [300];
37817
+ if (ds2.WindowCenter.length === 0) {
37818
+ ds2.WindowCenter = [300];
37819
37819
  }
37820
- if (ds.WindowWidth.length === 0) {
37821
- ds.WindowWidth = [500];
37820
+ if (ds2.WindowWidth.length === 0) {
37821
+ ds2.WindowWidth = [500];
37822
37822
  }
37823
37823
  }
37824
37824
  }], [{
@@ -37864,12 +37864,12 @@ var require_dcmjs2 = __commonJS({
37864
37864
  key: "normalizeMultiframe",
37865
37865
  value: function normalizeMultiframe() {
37866
37866
  _get(_getPrototypeOf(MRImageNormalizer2.prototype), "normalizeMultiframe", this).call(this);
37867
- var ds = this.dataset;
37868
- if (!ds.ImageType || !ds.ImageType.constructor || ds.ImageType.constructor.name != "Array" || ds.ImageType.length != 4) {
37869
- ds.ImageType = ["ORIGINAL", "PRIMARY", "OTHER", "NONE"];
37867
+ var ds2 = this.dataset;
37868
+ if (!ds2.ImageType || !ds2.ImageType.constructor || ds2.ImageType.constructor.name != "Array" || ds2.ImageType.length != 4) {
37869
+ ds2.ImageType = ["ORIGINAL", "PRIMARY", "OTHER", "NONE"];
37870
37870
  }
37871
- ds.SharedFunctionalGroupsSequence.MRImageFrameTypeSequence = {
37872
- FrameType: ds.ImageType,
37871
+ ds2.SharedFunctionalGroupsSequence.MRImageFrameTypeSequence = {
37872
+ FrameType: ds2.ImageType,
37873
37873
  PixelPresentation: "MONOCHROME",
37874
37874
  VolumetricProperties: "VOLUME",
37875
37875
  VolumeBasedCalculationTechnique: "NONE",
@@ -37994,9 +37994,9 @@ var require_dcmjs2 = __commonJS({
37994
37994
  key: "normalize",
37995
37995
  value: function normalize3() {
37996
37996
  _get(_getPrototypeOf(PMImageNormalizer2.prototype), "normalize", this).call(this);
37997
- var ds = this.datasets[0];
37998
- if (ds.BitsAllocated !== 32) {
37999
- log2.error("Only works with 32 bit data, not " + String(ds.BitsAllocated));
37997
+ var ds2 = this.datasets[0];
37998
+ if (ds2.BitsAllocated !== 32) {
37999
+ log2.error("Only works with 32 bit data, not " + String(ds2.BitsAllocated));
38000
38000
  }
38001
38001
  }
38002
38002
  }]);
@@ -51817,7 +51817,7 @@ var require_has_flag = __commonJS({
51817
51817
  var require_supports_colors = __commonJS({
51818
51818
  "../../node_modules/@colors/colors/lib/system/supports-colors.js"(exports2, module2) {
51819
51819
  "use strict";
51820
- var os2 = require("os");
51820
+ var os = require("os");
51821
51821
  var hasFlag = require_has_flag();
51822
51822
  var env = process.env;
51823
51823
  var forceColor = void 0;
@@ -51855,7 +51855,7 @@ var require_supports_colors = __commonJS({
51855
51855
  }
51856
51856
  var min = forceColor ? 1 : 0;
51857
51857
  if (process.platform === "win32") {
51858
- var osRelease = os2.release().split(".");
51858
+ var osRelease = os.release().split(".");
51859
51859
  if (Number(process.versions.node.split(".")[0]) >= 8 && Number(osRelease[0]) >= 10 && Number(osRelease[2]) >= 10586) {
51860
51860
  return Number(osRelease[2]) >= 14931 ? 3 : 2;
51861
51861
  }
@@ -56351,9 +56351,9 @@ var require_stream_readable = __commonJS({
56351
56351
  return from(Readable2, iterable, opts);
56352
56352
  };
56353
56353
  }
56354
- function indexOf(xs2, x3) {
56355
- for (var i = 0, l2 = xs2.length; i < l2; i++) {
56356
- if (xs2[i] === x3) return i;
56354
+ function indexOf(xs, x3) {
56355
+ for (var i = 0, l2 = xs.length; i < l2; i++) {
56356
+ if (xs[i] === x3) return i;
56357
56357
  }
56358
56358
  return -1;
56359
56359
  }
@@ -57115,7 +57115,7 @@ var require_winston_transport = __commonJS({
57115
57115
  var require_console = __commonJS({
57116
57116
  "../../node_modules/winston/lib/winston/transports/console.js"(exports2, module2) {
57117
57117
  "use strict";
57118
- var os2 = require("os");
57118
+ var os = require("os");
57119
57119
  var { LEVEL, MESSAGE } = require_triple_beam();
57120
57120
  var TransportStream = require_winston_transport();
57121
57121
  module2.exports = class Console extends TransportStream {
@@ -57129,7 +57129,7 @@ var require_console = __commonJS({
57129
57129
  this.name = options.name || "console";
57130
57130
  this.stderrLevels = this._stringArrayToSet(options.stderrLevels);
57131
57131
  this.consoleWarnLevels = this._stringArrayToSet(options.consoleWarnLevels);
57132
- this.eol = typeof options.eol === "string" ? options.eol : os2.EOL;
57132
+ this.eol = typeof options.eol === "string" ? options.eol : os.EOL;
57133
57133
  this.forceConsole = options.forceConsole || false;
57134
57134
  this._consoleLog = console.log.bind(console);
57135
57135
  this._consoleWarn = console.warn.bind(console);
@@ -59939,7 +59939,7 @@ var require_file = __commonJS({
59939
59939
  var { Stream, PassThrough } = require_readable();
59940
59940
  var TransportStream = require_winston_transport();
59941
59941
  var debug = require_node2()("winston:file");
59942
- var os2 = require("os");
59942
+ var os = require("os");
59943
59943
  var tailFile = require_tail_file();
59944
59944
  module2.exports = class File extends TransportStream {
59945
59945
  /**
@@ -59977,7 +59977,7 @@ var require_file = __commonJS({
59977
59977
  this.rotationFormat = options.rotationFormat || false;
59978
59978
  this.zippedArchive = options.zippedArchive || false;
59979
59979
  this.maxFiles = options.maxFiles || null;
59980
- this.eol = typeof options.eol === "string" ? options.eol : os2.EOL;
59980
+ this.eol = typeof options.eol === "string" ? options.eol : os.EOL;
59981
59981
  this.tailable = options.tailable || false;
59982
59982
  this.lazy = options.lazy || false;
59983
59983
  this._size = 0;
@@ -60780,7 +60780,7 @@ var require_stream3 = __commonJS({
60780
60780
  "use strict";
60781
60781
  var isStream = require_is_stream();
60782
60782
  var { MESSAGE } = require_triple_beam();
60783
- var os2 = require("os");
60783
+ var os = require("os");
60784
60784
  var TransportStream = require_winston_transport();
60785
60785
  module2.exports = class Stream extends TransportStream {
60786
60786
  /**
@@ -60796,7 +60796,7 @@ var require_stream3 = __commonJS({
60796
60796
  this._stream = options.stream;
60797
60797
  this._stream.setMaxListeners(Infinity);
60798
60798
  this.isObjectMode = options.stream._writableState.objectMode;
60799
- this.eol = typeof options.eol === "string" ? options.eol : os2.EOL;
60799
+ this.eol = typeof options.eol === "string" ? options.eol : os.EOL;
60800
60800
  }
60801
60801
  /**
60802
60802
  * Core logging method exposed to Winston.
@@ -61180,7 +61180,7 @@ var require_exception_stream = __commonJS({
61180
61180
  var require_exception_handler = __commonJS({
61181
61181
  "../../node_modules/winston/lib/winston/exception-handler.js"(exports2, module2) {
61182
61182
  "use strict";
61183
- var os2 = require("os");
61183
+ var os = require("os");
61184
61184
  var asyncForEach = require_forEach();
61185
61185
  var debug = require_node2()("winston:exception");
61186
61186
  var once = require_one_time();
@@ -61275,8 +61275,8 @@ var require_exception_handler = __commonJS({
61275
61275
  */
61276
61276
  getOsInfo() {
61277
61277
  return {
61278
- loadavg: os2.loadavg(),
61279
- uptime: os2.uptime()
61278
+ loadavg: os.loadavg(),
61279
+ uptime: os.uptime()
61280
61280
  };
61281
61281
  }
61282
61282
  /**
@@ -61418,7 +61418,7 @@ var require_rejection_stream = __commonJS({
61418
61418
  var require_rejection_handler = __commonJS({
61419
61419
  "../../node_modules/winston/lib/winston/rejection-handler.js"(exports2, module2) {
61420
61420
  "use strict";
61421
- var os2 = require("os");
61421
+ var os = require("os");
61422
61422
  var asyncForEach = require_forEach();
61423
61423
  var debug = require_node2()("winston:rejection");
61424
61424
  var once = require_one_time();
@@ -61515,8 +61515,8 @@ var require_rejection_handler = __commonJS({
61515
61515
  */
61516
61516
  getOsInfo() {
61517
61517
  return {
61518
- loadavg: os2.loadavg(),
61519
- uptime: os2.uptime()
61518
+ loadavg: os.loadavg(),
61519
+ uptime: os.uptime()
61520
61520
  };
61521
61521
  }
61522
61522
  /**
@@ -66870,15 +66870,15 @@ var require_FileStreamRotator = __commonJS({
66870
66870
  };
66871
66871
  FileStreamRotator.parseFileSize = function(size) {
66872
66872
  if (size && typeof size == "string") {
66873
- var _s = size.toLowerCase().match(/^((?:0\.)?\d+)([kmg])$/);
66874
- if (_s) {
66875
- switch (_s[2]) {
66873
+ var _s2 = size.toLowerCase().match(/^((?:0\.)?\d+)([kmg])$/);
66874
+ if (_s2) {
66875
+ switch (_s2[2]) {
66876
66876
  case "k":
66877
- return _s[1] * 1024;
66877
+ return _s2[1] * 1024;
66878
66878
  case "m":
66879
- return _s[1] * 1024 * 1024;
66879
+ return _s2[1] * 1024 * 1024;
66880
66880
  case "g":
66881
- return _s[1] * 1024 * 1024 * 1024;
66881
+ return _s2[1] * 1024 * 1024 * 1024;
66882
66882
  }
66883
66883
  }
66884
66884
  }
@@ -67272,7 +67272,7 @@ var require_daily_rotate_file = __commonJS({
67272
67272
  "../../node_modules/winston-daily-rotate-file/daily-rotate-file.js"(exports2, module2) {
67273
67273
  "use strict";
67274
67274
  var fs3 = require("fs");
67275
- var os2 = require("os");
67275
+ var os = require("os");
67276
67276
  var path4 = require("path");
67277
67277
  var util = require("util");
67278
67278
  var zlib = require("zlib");
@@ -67283,7 +67283,7 @@ var require_daily_rotate_file = __commonJS({
67283
67283
  var loggerDefaults = {
67284
67284
  json: false,
67285
67285
  colorize: false,
67286
- eol: os2.EOL,
67286
+ eol: os.EOL,
67287
67287
  logstash: null,
67288
67288
  prettyPrint: false,
67289
67289
  label: null,
@@ -67591,7 +67591,7 @@ module.exports = __toCommonJS(main_exports);
67591
67591
  var Oo = Object.defineProperty;
67592
67592
  var Io = (r6, e, t) => e in r6 ? Oo(r6, e, { enumerable: true, configurable: true, writable: true, value: t }) : r6[e] = t;
67593
67593
  var c = (r6, e, t) => Io(r6, typeof e != "symbol" ? e + "" : e, t);
67594
- var pt = class {
67594
+ var lt = class {
67595
67595
  constructor(e, t) {
67596
67596
  c(this, "operator");
67597
67597
  c(this, "child");
@@ -67612,7 +67612,7 @@ var ce = class {
67612
67612
  return `(${this.left.toString()} ${this.operator} ${this.right.toString()})`;
67613
67613
  }
67614
67614
  };
67615
- var dt = class {
67615
+ var pt = class {
67616
67616
  constructor() {
67617
67617
  c(this, "prefixParselets", {});
67618
67618
  c(this, "infixParselets", {});
@@ -67716,12 +67716,12 @@ var Ve = class {
67716
67716
  return this.cache.keys().next().value;
67717
67717
  }
67718
67718
  };
67719
- var ft = "http://hl7.org";
67720
- var mt = "created";
67719
+ var dt = "http://hl7.org";
67720
+ var ft = "created";
67721
67721
  var mr = "not-modified";
67722
67722
  var yr = "not-found";
67723
67723
  var xr = "unauthorized";
67724
- var ht = "accepted";
67724
+ var mt = "accepted";
67725
67725
  var Vn = { resourceType: "OperationOutcome", id: yr, issue: [{ severity: "error", code: "not-found", details: { text: "Not found" } }] };
67726
67726
  var Me = { resourceType: "OperationOutcome", id: xr, issue: [{ severity: "error", code: "login", details: { text: "Unauthorized" } }] };
67727
67727
  var Mn = { ...Me, issue: [...Me.issue, { severity: "error", code: "expired", details: { text: "Token expired" } }] };
@@ -67742,7 +67742,7 @@ function Ge(r6) {
67742
67742
  return typeof r6 == "object" && r6 !== null && r6.resourceType === "OperationOutcome";
67743
67743
  }
67744
67744
  function br(r6) {
67745
- return r6.id === "ok" || r6.id === mt || r6.id === mr || r6.id === ht;
67745
+ return r6.id === "ok" || r6.id === ft || r6.id === mr || r6.id === mt;
67746
67746
  }
67747
67747
  var f = class extends Error {
67748
67748
  constructor(t, n) {
@@ -67751,7 +67751,7 @@ var f = class extends Error {
67751
67751
  this.name = "OperationOutcomeError", this.outcome = t;
67752
67752
  }
67753
67753
  };
67754
- function yt(r6) {
67754
+ function ht(r6) {
67755
67755
  return r6 instanceof f ? r6.outcome : Ge(r6) ? r6 : R(_e(r6));
67756
67756
  }
67757
67757
  function _e(r6) {
@@ -67940,7 +67940,7 @@ function Bo(r6, e, t) {
67940
67940
  return r6 === void 0 ? { type: "undefined", value: void 0, path: `${n}${t}` } : Array.isArray(r6) ? r6.map((i, o2) => ({ ...i, path: `${n}${t}[${o2}]` })) : { ...r6, path: `${n}${t}` };
67941
67941
  }
67942
67942
  var qo = new Ve(1e3);
67943
- var ze = { 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: /.*/ };
67943
+ var xt = { 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: /.*/ };
67944
67944
  function h(r6) {
67945
67945
  return [{ type: d.boolean, value: r6 }];
67946
67946
  }
@@ -67959,9 +67959,9 @@ function J(r6, e) {
67959
67959
  function V(r6, e, t) {
67960
67960
  if (!r6.value) return;
67961
67961
  let n = Et(r6.type, e, t?.profileUrl);
67962
- return n ? Ko(r6, e, n) : Yo(r6, e);
67962
+ return n ? Yo(r6, e, n) : Xo(r6, e);
67963
67963
  }
67964
- function Ko(r6, e, t) {
67964
+ function Yo(r6, e, t) {
67965
67965
  let n = r6.value, i = t.type;
67966
67966
  if (!i || i.length === 0) return;
67967
67967
  let o2, s = "undefined", a, u2 = t.path.lastIndexOf("."), l2 = t.path.substring(u2 + 1);
@@ -67984,7 +67984,7 @@ function Ko(r6, e, t) {
67984
67984
  function Yn(r6, e) {
67985
67985
  return e === "Resource" && k(r6) && (e = r6.resourceType), { type: e, value: r6 };
67986
67986
  }
67987
- function Yo(r6, e) {
67987
+ function Xo(r6, e) {
67988
67988
  let t = r6.value;
67989
67989
  if (!t || typeof t != "object") return;
67990
67990
  let n;
@@ -68011,7 +68011,7 @@ function Tt(r6) {
68011
68011
  let e = [];
68012
68012
  for (let t of r6) {
68013
68013
  let n = false;
68014
- for (let i of e) if (U(Ke(t, i))) {
68014
+ for (let i of e) if (U(Je(t, i))) {
68015
68015
  n = true;
68016
68016
  break;
68017
68017
  }
@@ -68023,19 +68023,19 @@ function ei(r6) {
68023
68023
  return h(!U(r6));
68024
68024
  }
68025
68025
  function ti(r6, e) {
68026
- return r6.length === 0 || e.length === 0 ? [] : r6.length !== e.length ? h(false) : h(r6.every((t, n) => U(Ke(t, e[n]))));
68026
+ return r6.length === 0 || e.length === 0 ? [] : r6.length !== e.length ? h(false) : h(r6.every((t, n) => U(Je(t, e[n]))));
68027
68027
  }
68028
68028
  function ri(r6, e) {
68029
- return r6.length === 0 || e.length === 0 ? [] : r6.length !== e.length ? h(true) : h(r6.some((t, n) => !U(Ke(t, e[n]))));
68029
+ return r6.length === 0 || e.length === 0 ? [] : r6.length !== e.length ? h(true) : h(r6.some((t, n) => !U(Je(t, e[n]))));
68030
68030
  }
68031
- function Ke(r6, e) {
68031
+ function Je(r6, e) {
68032
68032
  let t = r6.value?.valueOf(), n = e.value?.valueOf();
68033
68033
  return typeof t == "number" && typeof n == "number" ? h(Math.abs(t - n) < 1e-8) : I(t) && I(n) ? h(oi(t, n)) : h(typeof t == "object" && typeof n == "object" ? Br(r6, e) : t === n);
68034
68034
  }
68035
68035
  function Ur(r6, e) {
68036
- return r6.length === 0 && e.length === 0 ? h(true) : r6.length !== e.length ? h(false) : (r6.sort(Xn), e.sort(Xn), h(r6.every((t, n) => U(Xo(t, e[n])))));
68036
+ return r6.length === 0 && e.length === 0 ? h(true) : r6.length !== e.length ? h(false) : (r6.sort(Xn), e.sort(Xn), h(r6.every((t, n) => U(Zo(t, e[n])))));
68037
68037
  }
68038
- function Xo(r6, e) {
68038
+ function Zo(r6, e) {
68039
68039
  let { type: t, value: n } = r6, { type: i, value: o2 } = e, s = n?.valueOf(), a = o2?.valueOf();
68040
68040
  return typeof s == "number" && typeof a == "number" ? h(Math.abs(s - a) < 0.01) : I(s) && I(a) ? h(oi(s, a)) : h(t === "Coding" && i === "Coding" ? typeof s != "object" || typeof a != "object" ? false : s.code === a.code && s.system === a.system : typeof s == "object" && typeof a == "object" ? Br({ ...s, id: void 0 }, { ...a, id: void 0 }) : typeof s == "string" && typeof a == "string" ? s.toLowerCase() === a.toLowerCase() : s === a);
68041
68041
  }
@@ -68068,10 +68068,10 @@ function bt(r6, e) {
68068
68068
  }
68069
68069
  }
68070
68070
  function ni(r6) {
68071
- return typeof r6 == "string" && !!ze.date.exec(r6);
68071
+ return typeof r6 == "string" && !!xt.date.exec(r6);
68072
68072
  }
68073
68073
  function Ue(r6) {
68074
- return typeof r6 == "string" && !!ze.dateTime.exec(r6);
68074
+ return typeof r6 == "string" && !!xt.dateTime.exec(r6);
68075
68075
  }
68076
68076
  function ii(r6) {
68077
68077
  return !!(r6 && typeof r6 == "object" && ("start" in r6 && Ue(r6.start) || "end" in r6 && Ue(r6.end)));
@@ -68099,55 +68099,55 @@ function Zn(r6) {
68099
68099
  function Nr(r6, e) {
68100
68100
  if (e) {
68101
68101
  if (typeof e != "object") throw new Error("Primitive extension must be an object");
68102
- return Zo(r6 ?? {}, e);
68102
+ return es(r6 ?? {}, e);
68103
68103
  }
68104
68104
  return r6;
68105
68105
  }
68106
- function Zo(r6, e) {
68106
+ function es(r6, e) {
68107
68107
  return delete e.__proto__, delete e.constructor, Object.assign(r6, e);
68108
68108
  }
68109
- function Xe(r6, e) {
68109
+ function Ye(r6, e) {
68110
68110
  return k(r6, e) && "id" in r6 && typeof r6.id == "string";
68111
68111
  }
68112
68112
  function be(r6) {
68113
- let e = A(r6) ?? "undefined/undefined", t = ts(r6);
68113
+ let e = A(r6) ?? "undefined/undefined", t = rs(r6);
68114
68114
  return t === e ? { reference: e } : { reference: e, display: t };
68115
68115
  }
68116
68116
  function A(r6) {
68117
68117
  if (H(r6)) return r6.reference;
68118
- if (Xe(r6)) return `${r6.resourceType}/${r6.id}`;
68118
+ if (Ye(r6)) return `${r6.resourceType}/${r6.id}`;
68119
68119
  }
68120
68120
  function Se(r6) {
68121
68121
  if (r6) return H(r6) ? r6.reference.split("/")[1] : r6.id;
68122
68122
  }
68123
- function es(r6) {
68123
+ function ts(r6) {
68124
68124
  return r6.resourceType === "Patient" || r6.resourceType === "Practitioner" || r6.resourceType === "RelatedPerson";
68125
68125
  }
68126
- function ts(r6) {
68127
- if (es(r6)) {
68128
- let e = rs(r6);
68126
+ function rs(r6) {
68127
+ if (ts(r6)) {
68128
+ let e = ns(r6);
68129
68129
  if (e) return e;
68130
68130
  }
68131
68131
  if (r6.resourceType === "Device") {
68132
- let e = ns(r6);
68132
+ let e = is(r6);
68133
68133
  if (e) return e;
68134
68134
  }
68135
- if (r6.resourceType === "MedicationRequest" && r6.medicationCodeableConcept) return Ye(r6.medicationCodeableConcept);
68135
+ if (r6.resourceType === "MedicationRequest" && r6.medicationCodeableConcept) return Ke(r6.medicationCodeableConcept);
68136
68136
  if (r6.resourceType === "Subscription" && r6.criteria) return r6.criteria;
68137
68137
  if (r6.resourceType === "User" && r6.email) return r6.email;
68138
68138
  if ("name" in r6 && r6.name && typeof r6.name == "string") return r6.name;
68139
68139
  if ("code" in r6 && r6.code) {
68140
68140
  let e = r6.code;
68141
- if (Array.isArray(e) && (e = e[0]), Wr(e)) return Ye(e);
68142
- if (ps(e)) return e.text;
68141
+ if (Array.isArray(e) && (e = e[0]), Wr(e)) return Ke(e);
68142
+ if (ds(e)) return e.text;
68143
68143
  }
68144
68144
  return A(r6) ?? "";
68145
68145
  }
68146
- function rs(r6) {
68146
+ function ns(r6) {
68147
68147
  let e = r6.name;
68148
- if (e && e.length > 0) return et(e[0]);
68148
+ if (e && e.length > 0) return Ze(e[0]);
68149
68149
  }
68150
- function ns(r6) {
68150
+ function is(r6) {
68151
68151
  let e = r6.deviceName;
68152
68152
  if (e && e.length > 0) return e[0].name;
68153
68153
  }
@@ -68173,9 +68173,9 @@ function Ct(r6, e) {
68173
68173
  return JSON.stringify(t, null, e ? 2 : void 0) ?? "";
68174
68174
  }
68175
68175
  function Hr(r6) {
68176
- if (!(r6 == null || r6 === "")) return typeof r6 == "object" ? Array.isArray(r6) ? os(r6) : ss(r6) : r6;
68176
+ if (!(r6 == null || r6 === "")) return typeof r6 == "object" ? Array.isArray(r6) ? ss(r6) : as(r6) : r6;
68177
68177
  }
68178
- function os(r6) {
68178
+ function ss(r6) {
68179
68179
  let e = r6.length;
68180
68180
  if (e === 0) return;
68181
68181
  let t, n = 0;
@@ -68185,7 +68185,7 @@ function os(r6) {
68185
68185
  }
68186
68186
  if (n !== 0) return t ?? r6;
68187
68187
  }
68188
- function ss(r6) {
68188
+ function as(r6) {
68189
68189
  let e, t = 0;
68190
68190
  for (let n in r6) {
68191
68191
  let i = r6[n], o2 = Hr(i);
@@ -68204,14 +68204,14 @@ function re(r6) {
68204
68204
  return e === "string" && r6 !== "" || e === "object" && ("length" in r6 && r6.length > 0 || Object.keys(r6).length > 0);
68205
68205
  }
68206
68206
  function pe(r6, e, t) {
68207
- return r6 === e || C(r6) && C(e) ? true : C(r6) || C(e) ? false : Array.isArray(r6) && Array.isArray(e) ? as(r6, e) : Array.isArray(r6) || Array.isArray(e) ? false : E(r6) && E(e) ? cs(r6, e, t) : (E(r6) || E(e), false);
68207
+ return r6 === e || C(r6) && C(e) ? true : C(r6) || C(e) ? false : Array.isArray(r6) && Array.isArray(e) ? cs(r6, e) : Array.isArray(r6) || Array.isArray(e) ? false : E(r6) && E(e) ? us(r6, e, t) : (E(r6) || E(e), false);
68208
68208
  }
68209
- function as(r6, e) {
68209
+ function cs(r6, e) {
68210
68210
  if (r6.length !== e.length) return false;
68211
68211
  for (let t = 0; t < r6.length; t++) if (!pe(r6[t], e[t])) return false;
68212
68212
  return true;
68213
68213
  }
68214
- function cs(r6, e, t) {
68214
+ function us(r6, e, t) {
68215
68215
  let n = /* @__PURE__ */ new Set();
68216
68216
  for (let i of Object.keys(r6)) n.add(i);
68217
68217
  for (let i of Object.keys(e)) n.add(i);
@@ -68237,7 +68237,7 @@ function qr(r6) {
68237
68237
  function Wr(r6) {
68238
68238
  return E(r6) && "coding" in r6 && Array.isArray(r6.coding) && r6.coding.every(qr);
68239
68239
  }
68240
- function ps(r6) {
68240
+ function ds(r6) {
68241
68241
  return E(r6) && "text" in r6 && typeof r6.text == "string";
68242
68242
  }
68243
68243
  var li = [];
@@ -68265,7 +68265,7 @@ var Qr = (r6, e) => new Promise((t, n) => {
68265
68265
  clearTimeout(i), n(e.signal?.reason);
68266
68266
  }, { once: true });
68267
68267
  });
68268
- function Ze(r6, e, t) {
68268
+ function Xe(r6, e, t) {
68269
68269
  let n = [];
68270
68270
  for (let i = 0; i < t - 1; i++) {
68271
68271
  let o2 = r6.indexOf(e);
@@ -68280,11 +68280,11 @@ function Pt(r6) {
68280
68280
  function zr(r6) {
68281
68281
  return r6.endsWith("/") ? r6 : r6 + "/";
68282
68282
  }
68283
- function xs(r6) {
68283
+ function vs(r6) {
68284
68284
  return r6.startsWith("/") ? r6.slice(1) : r6;
68285
68285
  }
68286
68286
  function G(r6, e) {
68287
- return new URL(xs(e), zr(r6.toString())).toString();
68287
+ return new URL(vs(e), zr(r6.toString())).toString();
68288
68288
  }
68289
68289
  function gi(r6, e) {
68290
68290
  return G(r6, e).toString().replace("http://", "ws://").replace("https://", "wss://");
@@ -68292,12 +68292,12 @@ function gi(r6, e) {
68292
68292
  function xi(r6) {
68293
68293
  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();
68294
68294
  }
68295
- var vs = /^(([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])$/;
68296
- function Zl(r6) {
68297
- return vs.test(r6);
68295
+ var Ts = /^(([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])$/;
68296
+ function ep(r6) {
68297
+ return Ts.test(r6);
68298
68298
  }
68299
68299
  var g = Object.freeze([]);
68300
- function et(r6, e) {
68300
+ function Ze(r6, e) {
68301
68301
  if (!r6) return "";
68302
68302
  let t = [];
68303
68303
  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) {
@@ -68306,7 +68306,7 @@ function et(r6, e) {
68306
68306
  }
68307
68307
  return t.join(" ").trim();
68308
68308
  }
68309
- function Ye(r6) {
68309
+ function Ke(r6) {
68310
68310
  if (!r6) return "";
68311
68311
  let e = Re(r6.text);
68312
68312
  return e || (r6.coding ? r6.coding.map((t) => Ti(t)).join(", ") : "");
@@ -68339,16 +68339,16 @@ function Kr(r6) {
68339
68339
  }
68340
68340
  function Rr(r6) {
68341
68341
  let e = r6.type?.[0]?.code;
68342
- return e === "BackboneElement" || e === "Element" ? Is((r6.base?.path ?? r6.path)?.split(".")) : e;
68342
+ return e === "BackboneElement" || e === "Element" ? ks((r6.base?.path ?? r6.path)?.split(".")) : e;
68343
68343
  }
68344
- function Is(r6) {
68344
+ function ks(r6) {
68345
68345
  return r6.length === 1 ? r6[0] : r6.map(M).join("");
68346
68346
  }
68347
68347
  function Et(r6, e, t) {
68348
68348
  let n = Qe(r6, t);
68349
- if (n) return Ms(n.elements, e);
68349
+ if (n) return _s(n.elements, e);
68350
68350
  }
68351
- function Ms(r6, e) {
68351
+ function _s(r6, e) {
68352
68352
  let t = r6[e] ?? r6[e + "[x]"];
68353
68353
  if (t) return t;
68354
68354
  for (let n = 0; n < e.length; n++) {
@@ -68606,7 +68606,7 @@ var wt = class {
68606
68606
  return "{}";
68607
68607
  }
68608
68608
  };
68609
- var Ot = class extends pt {
68609
+ var Ot = class extends lt {
68610
68610
  constructor(t, n, i) {
68611
68611
  super(t, n);
68612
68612
  c(this, "impl");
@@ -68668,7 +68668,7 @@ var Dt = class extends w {
68668
68668
  }
68669
68669
  eval(e, t) {
68670
68670
  let n = J(this.left.eval(e, t)), i = this.right.eval(e, t);
68671
- return n ? h(i.some((o2) => Ke(n, o2)[0].value)) : [];
68671
+ return n ? h(i.some((o2) => Je(n, o2)[0].value)) : [];
68672
68672
  }
68673
68673
  };
68674
68674
  var Z = class extends ce {
@@ -68807,39 +68807,39 @@ var we = class {
68807
68807
  return `${this.left.toString()}[${this.expr.toString()}]`;
68808
68808
  }
68809
68809
  };
68810
- var rt = ["!=", "!~", "<=", ">=", "{}", "->"];
68810
+ var tt = ["!=", "!~", "<=", ">=", "{}", "->"];
68811
68811
  var v = { 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 };
68812
- var Ns = { parse(r6) {
68812
+ var Us = { parse(r6) {
68813
68813
  let e = r6.consumeAndParse();
68814
68814
  if (!r6.match(")")) throw new Error("Parse error: expected `)` got `" + r6.peek()?.value + "`");
68815
68815
  return e;
68816
68816
  } };
68817
- var Us = { parse(r6, e) {
68817
+ var Bs = { parse(r6, e) {
68818
68818
  let t = r6.consumeAndParse();
68819
68819
  if (!r6.match("]")) throw new Error("Parse error: expected `]`");
68820
68820
  return new we(e, t);
68821
68821
  }, precedence: v.Indexer };
68822
- var Bs = { parse(r6, e) {
68822
+ var qs = { parse(r6, e) {
68823
68823
  if (!(e instanceof L)) throw new Error("Unexpected parentheses");
68824
68824
  let t = [];
68825
68825
  for (; !r6.match(")"); ) t.push(r6.consumeAndParse()), r6.match(",");
68826
68826
  return new ie(e.name, t);
68827
68827
  }, precedence: v.FunctionCall };
68828
- function qs(r6) {
68828
+ function Ws(r6) {
68829
68829
  let e = r6.split(" "), t = Number.parseFloat(e[0]), n = e[1];
68830
68830
  return n?.startsWith("'") && n.endsWith("'") ? n = n.substring(1, n.length - 1) : n = "{" + n + "}", { value: t, unit: n };
68831
68831
  }
68832
- function nt() {
68833
- return new dt().registerPrefix("String", { parse: (r6, e) => new W({ type: d.string, value: e.value }) }).registerPrefix("DateTime", { parse: (r6, e) => new W({ type: d.dateTime, value: qe(e.value) }) }).registerPrefix("Quantity", { parse: (r6, e) => new W({ type: d.Quantity, value: qs(e.value) }) }).registerPrefix("Number", { parse: (r6, e) => new W({ type: e.value.includes(".") ? d.decimal : d.integer, value: Number.parseFloat(e.value) }) }).registerPrefix("true", { parse: () => new W({ type: d.boolean, value: true }) }).registerPrefix("false", { parse: () => new W({ type: d.boolean, value: false }) }).registerPrefix("Symbol", { parse: (r6, e) => new L(e.value) }).registerPrefix("{}", { parse: () => new wt() }).registerPrefix("(", Ns).registerInfix("[", Us).registerInfix("(", Bs).prefix("+", v.UnaryAdd, (r6, e) => new Ot("+", e, (t) => t)).prefix("-", v.UnarySubtract, (r6, e) => new _("-", e, e, (t, n) => -n)).infixLeft(".", v.Dot, (r6, e, t) => new Z(r6, t)).infixLeft("/", v.Divide, (r6, e, t) => new _("/", r6, t, (n, i) => n / i)).infixLeft("*", v.Multiply, (r6, e, t) => new _("*", r6, t, (n, i) => n * i)).infixLeft("+", v.Add, (r6, e, t) => new _("+", r6, t, (n, i) => n + i)).infixLeft("-", v.Subtract, (r6, e, t) => new _("-", r6, t, (n, i) => n - i)).infixLeft("|", v.Union, (r6, e, t) => new Pe(r6, t)).infixLeft("=", v.Equals, (r6, e, t) => new Vt(r6, t)).infixLeft("!=", v.NotEquals, (r6, e, t) => new Mt(r6, t)).infixLeft("~", v.Equivalent, (r6, e, t) => new _t(r6, t)).infixLeft("!~", v.NotEquivalent, (r6, e, t) => new Lt(r6, t)).infixLeft("<", v.LessThan, (r6, e, t) => new _("<", r6, t, (n, i) => n < i)).infixLeft("<=", v.LessThanOrEquals, (r6, e, t) => new _("<=", r6, t, (n, i) => n <= i)).infixLeft(">", v.GreaterThan, (r6, e, t) => new _(">", r6, t, (n, i) => n > i)).infixLeft(">=", v.GreaterThanOrEquals, (r6, e, t) => new _(">=", r6, t, (n, i) => n >= i)).infixLeft("&", v.Ampersand, (r6, e, t) => new It(r6, t)).infixLeft("and", v.And, (r6, e, t) => new Ft(r6, t)).infixLeft("as", v.As, (r6, e, t) => new he(r6, t)).infixLeft("contains", v.Contains, (r6, e, t) => new kt(r6, t)).infixLeft("div", v.Divide, (r6, e, t) => new _("div", r6, t, (n, i) => Math.trunc(n / i))).infixLeft("in", v.In, (r6, e, t) => new Dt(r6, t)).infixLeft("is", v.Is, (r6, e, t) => new Ae(r6, t)).infixLeft("mod", v.Modulo, (r6, e, t) => new _("mod", r6, t, (n, i) => n % i)).infixLeft("or", v.Or, (r6, e, t) => new Nt(r6, t)).infixLeft("xor", v.Xor, (r6, e, t) => new Ut(r6, t)).infixLeft("implies", v.Implies, (r6, e, t) => new Bt(r6, t));
68832
+ function rt() {
68833
+ return new pt().registerPrefix("String", { parse: (r6, e) => new W({ type: d.string, value: e.value }) }).registerPrefix("DateTime", { parse: (r6, e) => new W({ type: d.dateTime, value: qe(e.value) }) }).registerPrefix("Quantity", { parse: (r6, e) => new W({ type: d.Quantity, value: Ws(e.value) }) }).registerPrefix("Number", { parse: (r6, e) => new W({ type: e.value.includes(".") ? d.decimal : d.integer, value: Number.parseFloat(e.value) }) }).registerPrefix("true", { parse: () => new W({ type: d.boolean, value: true }) }).registerPrefix("false", { parse: () => new W({ type: d.boolean, value: false }) }).registerPrefix("Symbol", { parse: (r6, e) => new L(e.value) }).registerPrefix("{}", { parse: () => new wt() }).registerPrefix("(", Us).registerInfix("[", Bs).registerInfix("(", qs).prefix("+", v.UnaryAdd, (r6, e) => new Ot("+", e, (t) => t)).prefix("-", v.UnarySubtract, (r6, e) => new _("-", e, e, (t, n) => -n)).infixLeft(".", v.Dot, (r6, e, t) => new Z(r6, t)).infixLeft("/", v.Divide, (r6, e, t) => new _("/", r6, t, (n, i) => n / i)).infixLeft("*", v.Multiply, (r6, e, t) => new _("*", r6, t, (n, i) => n * i)).infixLeft("+", v.Add, (r6, e, t) => new _("+", r6, t, (n, i) => n + i)).infixLeft("-", v.Subtract, (r6, e, t) => new _("-", r6, t, (n, i) => n - i)).infixLeft("|", v.Union, (r6, e, t) => new Pe(r6, t)).infixLeft("=", v.Equals, (r6, e, t) => new Vt(r6, t)).infixLeft("!=", v.NotEquals, (r6, e, t) => new Mt(r6, t)).infixLeft("~", v.Equivalent, (r6, e, t) => new _t(r6, t)).infixLeft("!~", v.NotEquivalent, (r6, e, t) => new Lt(r6, t)).infixLeft("<", v.LessThan, (r6, e, t) => new _("<", r6, t, (n, i) => n < i)).infixLeft("<=", v.LessThanOrEquals, (r6, e, t) => new _("<=", r6, t, (n, i) => n <= i)).infixLeft(">", v.GreaterThan, (r6, e, t) => new _(">", r6, t, (n, i) => n > i)).infixLeft(">=", v.GreaterThanOrEquals, (r6, e, t) => new _(">=", r6, t, (n, i) => n >= i)).infixLeft("&", v.Ampersand, (r6, e, t) => new It(r6, t)).infixLeft("and", v.And, (r6, e, t) => new Ft(r6, t)).infixLeft("as", v.As, (r6, e, t) => new he(r6, t)).infixLeft("contains", v.Contains, (r6, e, t) => new kt(r6, t)).infixLeft("div", v.Divide, (r6, e, t) => new _("div", r6, t, (n, i) => Math.trunc(n / i))).infixLeft("in", v.In, (r6, e, t) => new Dt(r6, t)).infixLeft("is", v.Is, (r6, e, t) => new Ae(r6, t)).infixLeft("mod", v.Modulo, (r6, e, t) => new _("mod", r6, t, (n, i) => n % i)).infixLeft("or", v.Or, (r6, e, t) => new Nt(r6, t)).infixLeft("xor", v.Xor, (r6, e, t) => new Ut(r6, t)).infixLeft("implies", v.Implies, (r6, e, t) => new Bt(r6, t));
68834
68834
  }
68835
- var Ws = nt();
68835
+ var js = rt();
68836
68836
  var m = { 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" };
68837
68837
  var Yr = { contains: m.CONTAINS, exact: m.EXACT, above: m.ABOVE, below: m.BELOW, text: m.TEXT, not: m.NOT, in: m.IN, "not-in": m.NOT_IN, "of-type": m.OF_TYPE, missing: m.MISSING, identifier: m.IDENTIFIER, iterate: m.ITERATE };
68838
68838
  var Xr = { eq: m.EQUALS, ne: m.NOT_EQUALS, lt: m.LESS_THAN, le: m.LESS_THAN_OR_EQUALS, gt: m.GREATER_THAN, ge: m.GREATER_THAN_OR_EQUALS, sa: m.STARTS_AFTER, eb: m.ENDS_BEFORE, ap: m.APPROXIMATELY, sw: m.STARTS_WITH };
68839
- var Ks = [m.MISSING, m.PRESENT];
68839
+ var Ys = [m.MISSING, m.PRESENT];
68840
68840
  var Ie = { READ: "read", VREAD: "vread", UPDATE: "update", DELETE: "delete", HISTORY: "history", CREATE: "create", SEARCH: "search" };
68841
- var ga = [Ie.READ, Ie.VREAD, Ie.HISTORY, Ie.SEARCH];
68842
- var kd = { FIRST: "first", APPLICATION: "application" };
68841
+ var xa = [Ie.READ, Ie.VREAD, Ie.HISTORY, Ie.SEARCH];
68842
+ var Dd = { FIRST: "first", APPLICATION: "application" };
68843
68843
  function j() {
68844
68844
  return typeof window < "u";
68845
68845
  }
@@ -68859,7 +68859,7 @@ var oe = { assign(r6) {
68859
68859
  }, getOrigin() {
68860
68860
  return j() ? globalThis.location.protocol + "//" + globalThis.location.host + "/" : "";
68861
68861
  } };
68862
- function Ta(r6) {
68862
+ function ba(r6) {
68863
68863
  if (j()) {
68864
68864
  let t = window.atob(r6), n = Uint8Array.from(t, (i) => i.codePointAt(0));
68865
68865
  return new window.TextDecoder().decode(n);
@@ -68880,7 +68880,7 @@ function $t(r6) {
68880
68880
  function Li(r6) {
68881
68881
  r6 = r6.padEnd(r6.length + (4 - r6.length % 4) % 4, "=");
68882
68882
  let e = r6.replaceAll("-", "+").replaceAll("_", "/");
68883
- return Ta(e);
68883
+ return ba(e);
68884
68884
  }
68885
68885
  function en() {
68886
68886
  let r6 = new Uint32Array(28);
@@ -68946,7 +68946,7 @@ var ee = class {
68946
68946
  }
68947
68947
  };
68948
68948
  var rn = { "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" };
68949
- var ka = ["Patient", "Encounter", "ImagingStudy", "DiagnosticReport", "OperationOutcome", "Bundle"];
68949
+ var Da = ["Patient", "Encounter", "ImagingStudy", "DiagnosticReport", "OperationOutcome", "Bundle"];
68950
68950
  var nn = ["DiagnosticReport-update"];
68951
68951
  function Ui(r6) {
68952
68952
  return nn.includes(r6);
@@ -68954,9 +68954,9 @@ function Ui(r6) {
68954
68954
  function Bi(r6) {
68955
68955
  if (nn.includes(r6)) throw new f(x(`'context.version' is required for '${r6}'.`));
68956
68956
  }
68957
- var Da = { "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" } } };
68958
- function Va(r6) {
68959
- return ka.includes(r6);
68957
+ var Va = { "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" } } };
68958
+ function Ma(r6) {
68959
+ return Da.includes(r6);
68960
68960
  }
68961
68961
  function qi(r6) {
68962
68962
  return !!r6.endpoint;
@@ -68973,27 +68973,27 @@ function Gt(r6) {
68973
68973
  for (let o2 of i) if (!rn[o2]) return false;
68974
68974
  return !(qi(r6) && !(typeof r6.endpoint == "string" && r6.endpoint.startsWith("ws")));
68975
68975
  }
68976
- function Ma(r6, e, t, n) {
68976
+ function _a(r6, e, t, n) {
68977
68977
  if (typeof e != "object") throw new f(x(`context[${t}] is invalid. Context must contain a single valid FHIR resource! Resource is not an object.`));
68978
68978
  if (!(e.id && typeof e.id == "string")) throw new f(x(`context[${t}] is invalid. Resource must contain a valid string ID.`));
68979
68979
  if (!e.resourceType) throw new f(x(`context[${t}] is invalid. Resource must contain a resource type. No resource type found.`));
68980
68980
  let i = n.resourceType;
68981
68981
  if (i !== "*") {
68982
- if (!Va(e.resourceType)) throw new f(x(`context[${t}] is invalid. Resource must contain a valid FHIRcast resource type. Resource type is not a known resource type.`));
68982
+ if (!Ma(e.resourceType)) throw new f(x(`context[${t}] is invalid. Resource must contain a valid FHIRcast resource type. Resource type is not a known resource type.`));
68983
68983
  if (i && e.resourceType !== i) throw new f(x(`context[${t}] is invalid. context[${t}] for the '${r6}' event should contain resource of type ${i}.`));
68984
68984
  }
68985
68985
  }
68986
- function _a(r6, e, t, n, i) {
68986
+ function La(r6, e, t, n, i) {
68987
68987
  if (i.set(e.key, (i.get(e.key) ?? 0) + 1), n.reference) {
68988
68988
  if (!H(e.reference)) throw new f(x(`context[${t}] is invalid. Expected key '${e.key}' to be a reference.`));
68989
- } else Ma(r6, e.resource, t, n);
68989
+ } else _a(r6, e.resource, t, n);
68990
68990
  }
68991
- function La(r6, e) {
68992
- let t = /* @__PURE__ */ new Map(), n = Da[r6];
68991
+ function Fa(r6, e) {
68992
+ let t = /* @__PURE__ */ new Map(), n = Va[r6];
68993
68993
  for (let i = 0; i < e.length; i++) {
68994
68994
  let o2 = e[i].key;
68995
68995
  if (!n[o2]) throw new f(x(`Key '${o2}' not found for event '${r6}'. Make sure to add only valid keys.`));
68996
- _a(r6, e[i], i, n[o2], t);
68996
+ La(r6, e[i], i, n[o2], t);
68997
68997
  }
68998
68998
  for (let [i, o2] of Object.entries(n)) {
68999
68999
  if (!(o2.optional || t.has(i))) throw new f(x(`Missing required key '${i}' on context for '${r6}' event.`));
@@ -69006,7 +69006,7 @@ function sn(r6, e, t, n) {
69006
69006
  if (typeof t != "object") throw new f(x("context must be a context object or array of context objects."));
69007
69007
  if (nn.includes(e) && !n) throw new f(x(`The '${e}' event must contain a 'context.versionId'.`));
69008
69008
  let i = Array.isArray(t) ? t : [t];
69009
- return La(e, i), { timestamp: (/* @__PURE__ */ new Date()).toISOString(), id: se(), event: { "hub.topic": r6, "hub.event": e, context: i, ...n ? { "context.versionId": n } : {} } };
69009
+ return Fa(e, i), { timestamp: (/* @__PURE__ */ new Date()).toISOString(), id: se(), event: { "hub.topic": r6, "hub.event": e, context: i, ...n ? { "context.versionId": n } : {} } };
69010
69010
  }
69011
69011
  var Ht = class extends ee {
69012
69012
  constructor(t) {
@@ -69031,7 +69031,7 @@ var Ht = class extends ee {
69031
69031
  this.websocket.close();
69032
69032
  }
69033
69033
  };
69034
- function Fa(r6) {
69034
+ function Na(r6) {
69035
69035
  return JSON.parse(Li(r6));
69036
69036
  }
69037
69037
  function Wi(r6) {
@@ -69039,7 +69039,7 @@ function Wi(r6) {
69039
69039
  }
69040
69040
  function Qt(r6) {
69041
69041
  let [e, t, n] = r6.split(".");
69042
- return Fa(t);
69042
+ return Na(t);
69043
69043
  }
69044
69044
  function ji(r6) {
69045
69045
  try {
@@ -69110,7 +69110,7 @@ var F = class {
69110
69110
  return this.suspender.finally(e);
69111
69111
  }
69112
69112
  };
69113
- var st = class {
69113
+ var ot = class {
69114
69114
  constructor(e, t = "") {
69115
69115
  c(this, "storage");
69116
69116
  c(this, "prefix", "");
@@ -69164,7 +69164,7 @@ var an = class {
69164
69164
  };
69165
69165
  var je = { Event: typeof globalThis.Event < "u" ? globalThis.Event : void 0, ErrorEvent: void 0, CloseEvent: void 0 };
69166
69166
  var Qi = false;
69167
- function Na() {
69167
+ function Ua() {
69168
69168
  if (typeof globalThis.Event > "u") throw new Error("Unable to lazy init events for ReconnectingWebSocket. globalThis.Event is not defined yet");
69169
69169
  je.Event = globalThis.Event, je.ErrorEvent = class extends Event {
69170
69170
  constructor(t, n) {
@@ -69183,7 +69183,7 @@ function Na() {
69183
69183
  }
69184
69184
  };
69185
69185
  }
69186
- function Ua(r6, e) {
69186
+ function Ba(r6, e) {
69187
69187
  if (!r6) throw new Error(e);
69188
69188
  }
69189
69189
  function Jt(r6) {
@@ -69193,7 +69193,7 @@ var ke = { maxReconnectionDelay: 1e4, minReconnectionDelay: 1e3 + Math.random()
69193
69193
  var zi = false;
69194
69194
  var Kt = class r extends ee {
69195
69195
  constructor(t, n, i = {}) {
69196
- Qi || (Na(), Qi = true);
69196
+ Qi || (Ua(), Qi = true);
69197
69197
  super();
69198
69198
  c(this, "_ws");
69199
69199
  c(this, "_retryCount", -1);
@@ -69215,7 +69215,7 @@ var Kt = class r extends ee {
69215
69215
  c(this, "_handleOpen", (t2) => {
69216
69216
  this._debug("open event");
69217
69217
  let { minUptime: n2 = ke.minUptime } = this._options;
69218
- clearTimeout(this._connectTimeout), this._uptimeTimeout = setTimeout(() => this._acceptOpen(), n2), Ua(this._ws, "WebSocket is not defined"), this._ws.binaryType = this._binaryType, this._messageQueue.forEach((i2) => this._ws?.send(i2)), this._messageQueue = [], this.onopen && this.onopen(t2), this.dispatchEvent(Jt(t2));
69218
+ clearTimeout(this._connectTimeout), this._uptimeTimeout = setTimeout(() => this._acceptOpen(), n2), Ba(this._ws, "WebSocket is not defined"), this._ws.binaryType = this._binaryType, this._messageQueue.forEach((i2) => this._ws?.send(i2)), this._messageQueue = [], this.onopen && this.onopen(t2), this.dispatchEvent(Jt(t2));
69219
69219
  });
69220
69220
  c(this, "_handleMessage", (t2) => {
69221
69221
  this._debug("message event"), this.onmessage && this.onmessage(t2), this.dispatchEvent(Jt(t2));
@@ -69357,8 +69357,8 @@ var Kt = class r extends ee {
69357
69357
  clearTimeout(this._connectTimeout), clearTimeout(this._uptimeTimeout);
69358
69358
  }
69359
69359
  };
69360
- var Ba = [WebSocket.CLOSING, WebSocket.CLOSED];
69361
- var at = class extends ee {
69360
+ var qa = [WebSocket.CLOSING, WebSocket.CLOSED];
69361
+ var st = class extends ee {
69362
69362
  constructor(...t) {
69363
69363
  super();
69364
69364
  c(this, "criteria");
@@ -69384,7 +69384,7 @@ var cn = class {
69384
69384
  c(this, "token");
69385
69385
  c(this, "tokenExpiry");
69386
69386
  c(this, "connecting", false);
69387
- this.criteria = e, this.emitter = new at(e), this.refCount = 1, this.subscriptionProps = t ? { ...t } : void 0;
69387
+ this.criteria = e, this.emitter = new st(e), this.refCount = 1, this.subscriptionProps = t ? { ...t } : void 0;
69388
69388
  }
69389
69389
  clearAttachedSubscription() {
69390
69390
  this.subscriptionId = void 0, this.token = void 0, this.tokenExpiry = void 0;
@@ -69411,7 +69411,7 @@ var Yt = class {
69411
69411
  throw new f(x("Not a valid URL"));
69412
69412
  }
69413
69413
  let o2 = n?.ReconnectingWebSocket ? new n.ReconnectingWebSocket(i, void 0, { debug: n?.debug, debugLogger: n?.debugLogger }) : new Kt(i, void 0, { debug: n?.debug, debugLogger: n?.debugLogger });
69414
- this.medplum = e, this.ws = o2, this.masterSubEmitter = new at(), this.criteriaEntries = /* @__PURE__ */ new Map(), this.criteriaEntriesBySubscriptionId = /* @__PURE__ */ new Map(), this.wsClosed = false, this.pingIntervalMs = n?.pingIntervalMs ?? 5e3, this.currentProfile = e.getProfile(), this.setupListeners();
69414
+ this.medplum = e, this.ws = o2, this.masterSubEmitter = new st(), this.criteriaEntries = /* @__PURE__ */ new Map(), this.criteriaEntriesBySubscriptionId = /* @__PURE__ */ new Map(), this.wsClosed = false, this.pingIntervalMs = n?.pingIntervalMs ?? 5e3, this.currentProfile = e.getProfile(), this.setupListeners();
69415
69415
  }
69416
69416
  setupListeners() {
69417
69417
  let e = this.ws;
@@ -69578,10 +69578,10 @@ var Yt = class {
69578
69578
  return this.getAllCriteriaEmitters().length;
69579
69579
  }
69580
69580
  getMasterEmitter() {
69581
- return this.masterSubEmitter || (this.masterSubEmitter = new at(...Array.from(this.criteriaEntries.keys()))), this.masterSubEmitter;
69581
+ return this.masterSubEmitter || (this.masterSubEmitter = new st(...Array.from(this.criteriaEntries.keys()))), this.masterSubEmitter;
69582
69582
  }
69583
69583
  async reconnectIfNeeded() {
69584
- Ba.includes(this.getWebSocket().readyState) && await new Promise((e) => {
69584
+ qa.includes(this.getWebSocket().readyState) && await new Promise((e) => {
69585
69585
  let t = () => {
69586
69586
  this.getWebSocket().removeEventListener("open", t), e();
69587
69587
  };
@@ -69589,18 +69589,18 @@ var Yt = class {
69589
69589
  });
69590
69590
  }
69591
69591
  };
69592
- var un = "5.0.15-b702e04";
69593
- var ja = O.FHIR_JSON + ", */*; q=0.1";
69594
- var $a = "https://api.medplum.com/";
69595
- var Ha = 1e3;
69596
- var Ga = 6e4;
69597
- var Qa = 0;
69598
- var za = 3e5;
69599
- var Ja = "Binary/";
69592
+ var un = "5.1.0-cc87b44";
69593
+ var $a = O.FHIR_JSON + ", */*; q=0.1";
69594
+ var Ha = "https://api.medplum.com/";
69595
+ var Ga = 1e3;
69596
+ var Qa = 6e4;
69597
+ var za = 0;
69598
+ var Ja = 3e5;
69599
+ var Ka = "Binary/";
69600
69600
  var Ji = { resourceType: "Device", id: "system", deviceName: [{ type: "model-name", name: "System" }] };
69601
69601
  var $e = { 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" };
69602
- var Ka = { 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" };
69603
- var Ya = { JwtBearer: "urn:ietf:params:oauth:client-assertion-type:jwt-bearer" };
69602
+ var Ya = { 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" };
69603
+ var Xa = { JwtBearer: "urn:ietf:params:oauth:client-assertion-type:jwt-bearer" };
69604
69604
  var Xt = class extends ee {
69605
69605
  constructor(t) {
69606
69606
  super();
@@ -69640,7 +69640,7 @@ var Xt = class extends ee {
69640
69640
  c(this, "keyValueClient");
69641
69641
  c(this, "logLevel");
69642
69642
  if (t?.baseUrl && !t.baseUrl.startsWith("http")) throw new Error("Base URL must start with http or https");
69643
- this.options = t ?? {}, this.fetch = t?.fetch ?? Xa(), this.storage = t?.storage ?? new st(void 0, t?.storagePrefix), this.createPdfImpl = t?.createPdf, this.baseUrl = zr(t?.baseUrl ?? $a), this.fhirBaseUrl = G(this.baseUrl, t?.fhirUrlPath ?? "fhir/R4"), this.authorizeUrl = G(this.baseUrl, t?.authorizeUrl ?? "oauth2/authorize"), this.tokenUrl = G(this.baseUrl, t?.tokenUrl ?? "oauth2/token"), this.logoutUrl = G(this.baseUrl, t?.logoutUrl ?? "oauth2/logout"), this.fhircastHubUrl = G(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 ?? za, this.logLevel = this.initializeLogLevel(t), this.cacheTime = t?.cacheTime ?? (j() ? Ga : Qa), this.cacheTime > 0 ? this.requestCache = new Ve(t?.resourceCacheSize ?? Ha) : 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(() => {
69643
+ this.options = t ?? {}, this.fetch = t?.fetch ?? Za(), this.storage = t?.storage ?? new ot(void 0, t?.storagePrefix), this.createPdfImpl = t?.createPdf, this.baseUrl = zr(t?.baseUrl ?? Ha), this.fhirBaseUrl = G(this.baseUrl, t?.fhirUrlPath ?? "fhir/R4"), this.authorizeUrl = G(this.baseUrl, t?.authorizeUrl ?? "oauth2/authorize"), this.tokenUrl = G(this.baseUrl, t?.tokenUrl ?? "oauth2/token"), this.logoutUrl = G(this.baseUrl, t?.logoutUrl ?? "oauth2/logout"), this.fhircastHubUrl = G(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 ?? Ja, this.logLevel = this.initializeLogLevel(t), this.cacheTime = t?.cacheTime ?? (j() ? Qa : za), this.cacheTime > 0 ? this.requestCache = new Ve(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(() => {
69644
69644
  t?.accessToken || this.attemptResumeActiveLogin().catch(console.error), this.initComplete = true, this.dispatchEvent({ type: "storageInitialized" });
69645
69645
  }).catch((n) => {
69646
69646
  console.error(n), this.initComplete = true, this.dispatchEvent({ type: "storageInitFailed", payload: { error: n } });
@@ -69755,7 +69755,7 @@ var Xt = class extends ee {
69755
69755
  }
69756
69756
  async exchangeExternalAccessToken(t, n, i) {
69757
69757
  if (n = n ?? this.clientId, !n) throw new Error("MedplumClient is missing clientId");
69758
- let o2 = { grant_type: $e.TokenExchange, subject_token_type: Ka.AccessToken, client_id: n, subject_token: t };
69758
+ let o2 = { grant_type: $e.TokenExchange, subject_token_type: Ya.AccessToken, client_id: n, subject_token: t };
69759
69759
  return i && (o2.membership_id = i), this.fetchTokens(o2);
69760
69760
  }
69761
69761
  getExternalAuthRedirectUri(t, n, i, o2, s = true) {
@@ -69963,7 +69963,7 @@ var Xt = class extends ee {
69963
69963
  s?.signal?.removeEventListener("abort", p), T instanceof Error ? u2(T) : a(T);
69964
69964
  };
69965
69965
  if (l2.responseType = "json", l2.onabort = () => y2(new DOMException("Request aborted", "AbortError")), l2.onerror = () => y2(new Error("Request error")), o2 && (l2.upload.onprogress = (T) => o2(T), l2.upload.onload = (T) => o2(T)), l2.onload = () => {
69966
- l2.status >= 200 && l2.status < 300 ? y2(l2.response) : y2(new f(yt(l2.response || l2.statusText)));
69966
+ l2.status >= 200 && l2.status < 300 ? y2(l2.response) : y2(new f(ht(l2.response || l2.statusText)));
69967
69967
  }, l2.open("POST", t), l2.withCredentials = true, l2.setRequestHeader("Authorization", "Bearer " + this.accessToken), l2.setRequestHeader("Cache-Control", "no-cache, no-store, max-age=0"), l2.setRequestHeader("Content-Type", i), this.options.extendedMode !== false && l2.setRequestHeader("X-Medplum", "extended"), s?.headers) {
69968
69968
  let T = s.headers;
69969
69969
  for (let [$, Q2] of Object.entries(T)) l2.setRequestHeader($, Q2);
@@ -69973,7 +69973,7 @@ var Xt = class extends ee {
69973
69973
  }
69974
69974
  async createPdf(t, n, i, o2) {
69975
69975
  if (!this.createPdfImpl) throw new Error("PDF creation not enabled");
69976
- let s = tc(t, n, i, o2), a = typeof n == "object" ? n : {}, { docDefinition: u2, tableLayouts: l2, fonts: p, ...y2 } = s, T = await this.createPdfImpl(u2, l2, p), $ = { ...y2, data: T, contentType: "application/pdf" };
69976
+ let s = rc(t, n, i, o2), a = typeof n == "object" ? n : {}, { docDefinition: u2, tableLayouts: l2, fonts: p, ...y2 } = s, T = await this.createPdfImpl(u2, l2, p), $ = { ...y2, data: T, contentType: "application/pdf" };
69977
69977
  return this.createBinary($, a);
69978
69978
  }
69979
69979
  createComment(t, n, i) {
@@ -70090,7 +70090,7 @@ var Xt = class extends ee {
70090
70090
  async download(t, n = {}) {
70091
70091
  this.refreshPromise && await this.refreshPromise;
70092
70092
  let i = t.toString();
70093
- i.startsWith(Ja) && (t = this.fhirUrl(i));
70093
+ i.startsWith(Ka) && (t = this.fhirUrl(i));
70094
70094
  let o2 = n.headers;
70095
70095
  return o2 || (o2 = {}, n.headers = o2), o2.Accept || (o2.Accept = "*/*"), this.addFetchOptionsDefaults(n), (await this.fetchWithRetry(t.toString(), n)).blob();
70096
70096
  }
@@ -70163,7 +70163,7 @@ var Xt = class extends ee {
70163
70163
  let y2 = await Ki(s, l2) ?? o2.statusUrl;
70164
70164
  if (y2) return this.pollStatus(y2, i, o2);
70165
70165
  }
70166
- if (s.status >= 400) throw new f(yt(l2));
70166
+ if (s.status >= 400) throw new f(ht(l2));
70167
70167
  return l2;
70168
70168
  }
70169
70169
  async parseBody(t, n) {
@@ -70184,7 +70184,7 @@ var Xt = class extends ee {
70184
70184
  for (let o2 = 0; o2 <= i; o2++) try {
70185
70185
  this.logLevel !== "none" && this.logRequest(t, n);
70186
70186
  let s = await this.fetch(t, n);
70187
- if (this.logLevel !== "none" && this.logResponse(s), this.setCurrentRateLimit(s), o2 >= i || !rc(s)) return s;
70187
+ if (this.logLevel !== "none" && this.logResponse(s), this.setCurrentRateLimit(s), o2 >= i || !nc(s)) return s;
70188
70188
  let a = this.getRetryDelay(o2), u2 = n.maxRetryTime ?? 2e3;
70189
70189
  if (a > u2) return s;
70190
70190
  await Qr(a, { signal: n.signal });
@@ -70240,7 +70240,7 @@ var Xt = class extends ee {
70240
70240
  try {
70241
70241
  o2.resolve(await this.request(o2.method, G(this.fhirBaseUrl, o2.url), o2.options));
70242
70242
  } catch (s) {
70243
- o2.reject(new f(yt(s)));
70243
+ o2.reject(new f(ht(s)));
70244
70244
  }
70245
70245
  return;
70246
70246
  }
@@ -70253,7 +70253,7 @@ var Xt = class extends ee {
70253
70253
  addFetchOptionsDefaults(t) {
70254
70254
  Object.entries(this.defaultHeaders).forEach(([n, i]) => {
70255
70255
  this.setRequestHeader(t, n, i);
70256
- }), this.setRequestHeader(t, "Accept", ja, true), this.options.extendedMode !== false && this.setRequestHeader(t, "X-Medplum", "extended"), t.body && this.setRequestHeader(t, "Content-Type", O.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");
70256
+ }), this.setRequestHeader(t, "Accept", $a, true), this.options.extendedMode !== false && this.setRequestHeader(t, "X-Medplum", "extended"), t.body && this.setRequestHeader(t, "Content-Type", O.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");
70257
70257
  }
70258
70258
  setRequestContentType(t, n) {
70259
70259
  this.setRequestHeader(t, "Content-Type", n);
@@ -70319,7 +70319,7 @@ var Xt = class extends ee {
70319
70319
  return this.clientId = t, this.fetchTokens({ grant_type: $e.JwtBearer, client_id: t, assertion: n, scope: i });
70320
70320
  }
70321
70321
  async startJwtAssertionLogin(t) {
70322
- return this.fetchTokens({ grant_type: $e.ClientCredentials, client_assertion_type: Ya.JwtBearer, client_assertion: t });
70322
+ return this.fetchTokens({ grant_type: $e.ClientCredentials, client_assertion_type: Xa.JwtBearer, client_assertion: t });
70323
70323
  }
70324
70324
  setBasicAuth(t, n) {
70325
70325
  this.clientId = t, this.clientSecret = n, this.basicAuth = $t(t + ":" + n);
@@ -70417,7 +70417,7 @@ var Xt = class extends ee {
70417
70417
  return this.getSubscriptionManager().getMasterEmitter();
70418
70418
  }
70419
70419
  };
70420
- function Xa() {
70420
+ function Za() {
70421
70421
  if (!globalThis.fetch) throw new Error("Fetch not available in this environment");
70422
70422
  return globalThis.fetch.bind(globalThis);
70423
70423
  }
@@ -70432,28 +70432,28 @@ function Yi(r6) {
70432
70432
  let e = r6.entry?.map((t) => t.resource) ?? [];
70433
70433
  return Object.assign(e, { bundle: r6 });
70434
70434
  }
70435
- function Za(r6) {
70435
+ function ec(r6) {
70436
70436
  return E(r6) && "data" in r6 && "contentType" in r6;
70437
70437
  }
70438
70438
  function Xi(r6, e, t, n) {
70439
- return Za(r6) ? r6 : { data: r6, filename: e, contentType: t, onProgress: n };
70439
+ return ec(r6) ? r6 : { data: r6, filename: e, contentType: t, onProgress: n };
70440
70440
  }
70441
- function ec(r6) {
70441
+ function tc(r6) {
70442
70442
  return E(r6) && "docDefinition" in r6;
70443
70443
  }
70444
- function tc(r6, e, t, n) {
70445
- return ec(r6) ? r6 : { docDefinition: r6, filename: e, tableLayouts: t, fonts: n };
70444
+ function rc(r6, e, t, n) {
70445
+ return tc(r6) ? r6 : { docDefinition: r6, filename: e, tableLayouts: t, fonts: n };
70446
70446
  }
70447
- function rc(r6) {
70447
+ function nc(r6) {
70448
70448
  return r6.status === 429 || r6.status >= 500;
70449
70449
  }
70450
- var mc = [...rt, "->", "<<", ">>", "=="];
70451
- var gc = nt().registerInfix("->", { precedence: v.Arrow }).registerInfix(";", { precedence: v.Semicolon });
70452
- var _c = " ".repeat(2);
70453
- var Fc = [...rt, "eq", "ne", "co"];
70454
- var Nc = { eq: m.EXACT, ne: m.NOT_EQUALS, co: m.CONTAINS, sw: m.STARTS_WITH, ew: void 0, gt: m.GREATER_THAN, lt: m.LESS_THAN, ge: m.GREATER_THAN_OR_EQUALS, le: m.LESS_THAN_OR_EQUALS, ap: m.APPROXIMATELY, sa: m.STARTS_AFTER, eb: m.ENDS_BEFORE, pr: m.PRESENT, po: void 0, ss: void 0, sb: void 0, in: m.IN, ni: m.NOT_IN, re: m.EQUALS, identifier: m.IDENTIFIER };
70455
- var Bc = nt();
70456
- var qc = { AA: "OK", AE: "Application Error", AR: "Application Reject", CA: "Commit Accept", CE: "Commit Error", CR: "Commit Reject" };
70450
+ var hc = [...tt, "->", "<<", ">>", "=="];
70451
+ var xc = rt().registerInfix("->", { precedence: v.Arrow }).registerInfix(";", { precedence: v.Semicolon });
70452
+ var Lc = " ".repeat(2);
70453
+ var Nc = [...tt, "eq", "ne", "co"];
70454
+ var Uc = { eq: m.EXACT, ne: m.NOT_EQUALS, co: m.CONTAINS, sw: m.STARTS_WITH, ew: void 0, gt: m.GREATER_THAN, lt: m.LESS_THAN, ge: m.GREATER_THAN_OR_EQUALS, le: m.LESS_THAN_OR_EQUALS, ap: m.APPROXIMATELY, sa: m.STARTS_AFTER, eb: m.ENDS_BEFORE, pr: m.PRESENT, po: void 0, ss: void 0, sb: void 0, in: m.IN, ni: m.NOT_IN, re: m.EQUALS, identifier: m.IDENTIFIER };
70455
+ var qc = rt();
70456
+ var Wc = { AA: "OK", AE: "Application Error", AR: "Application Reject", CA: "Commit Accept", CE: "Commit Error", CR: "Commit Reject" };
70457
70457
  var xe = class {
70458
70458
  constructor(e = "\r", t = "|", n = "^", i = "~", o2 = "\\", s = "&") {
70459
70459
  c(this, "segmentSeparator");
@@ -70497,7 +70497,7 @@ var vo = class r2 {
70497
70497
  }
70498
70498
  buildAck(e) {
70499
70499
  let t = /* @__PURE__ */ new Date(), n = this.getSegment("MSH"), i = n?.getField(3)?.toString() ?? "", o2 = n?.getField(4)?.toString() ?? "", s = n?.getField(5)?.toString() ?? "", a = n?.getField(6)?.toString() ?? "", u2 = n?.getField(10)?.toString() ?? "", l2 = n?.getField(12)?.toString() ?? "2.5.1", p = e?.ackCode ?? "AA";
70500
- return new r2([new lt(["MSH", this.context.getMsh2(), s, a, i, o2, jc(t), "", this.buildAckMessageType(n), t.getTime().toString(), "P", l2], this.context), new lt(["MSA", p, u2, qc[p]], this.context), ...e?.errSegment ? [e.errSegment] : []]);
70500
+ return new r2([new ut(["MSH", this.context.getMsh2(), s, a, i, o2, $c(t), "", this.buildAckMessageType(n), t.getTime().toString(), "P", l2], this.context), new ut(["MSA", p, u2, Wc[p]], this.context), ...e?.errSegment ? [e.errSegment] : []]);
70501
70501
  }
70502
70502
  buildAckMessageType(e) {
70503
70503
  let t = e?.getField(9), n = t?.getComponent(2), i = t?.getComponent(3), o2 = "ACK";
@@ -70509,7 +70509,7 @@ var vo = class r2 {
70509
70509
  throw n.type = "entity.parse.failed", n;
70510
70510
  }
70511
70511
  let t = new xe("\r", e.charAt(3), e.charAt(4), e.charAt(5), e.charAt(6), e.charAt(7));
70512
- return new r2(e.split(/[\r\n]+/).map((n) => lt.parse(n, t)), t);
70512
+ return new r2(e.split(/[\r\n]+/).map((n) => ut.parse(n, t)), t);
70513
70513
  }
70514
70514
  setSegment(e, t) {
70515
70515
  if (t.name === "MSH") {
@@ -70522,7 +70522,7 @@ var vo = class r2 {
70522
70522
  return n === 0 && t.name !== "MSH" ? false : n !== -1 ? (this.segments[n] = t, true) : false;
70523
70523
  }
70524
70524
  };
70525
- var lt = class r3 {
70525
+ var ut = class r3 {
70526
70526
  constructor(e, t = new xe()) {
70527
70527
  c(this, "context");
70528
70528
  c(this, "name");
@@ -70597,12 +70597,12 @@ var te = class r4 {
70597
70597
  return true;
70598
70598
  }
70599
70599
  };
70600
- function jc(r6) {
70600
+ function $c(r6) {
70601
70601
  let e = r6 instanceof Date ? r6 : new Date(r6), n = e.toISOString().replaceAll(/[-:T]/g, "").replace(/(\.\d+)?Z$/, ""), i = e.getUTCMilliseconds();
70602
70602
  return i > 0 && (n += "." + i.toString()), n;
70603
70603
  }
70604
70604
  var He = { NONE: 0, ERROR: 1, WARN: 2, INFO: 3, DEBUG: 4 };
70605
- var $c = ["NONE", "ERROR", "WARN", "INFO", "DEBUG"];
70605
+ var Hc = ["NONE", "ERROR", "WARN", "INFO", "DEBUG"];
70606
70606
  var To = class r5 {
70607
70607
  constructor(e, t = {}, n = He.INFO, i = {}) {
70608
70608
  c(this, "write");
@@ -70640,10 +70640,10 @@ var To = class r5 {
70640
70640
  i = { ...n };
70641
70641
  for (let [o2, s] of Object.entries(i)) s instanceof Error && (i[o2] = cr(s));
70642
70642
  }
70643
- this.write(JSON.stringify({ level: $c[e], timestamp: (/* @__PURE__ */ new Date()).toISOString(), msg: this.prefix ? `${this.prefix}${t}` : t, ...i, ...this.metadata }));
70643
+ this.write(JSON.stringify({ level: Hc[e], timestamp: (/* @__PURE__ */ new Date()).toISOString(), msg: this.prefix ? `${this.prefix}${t}` : t, ...i, ...this.metadata }));
70644
70644
  }
70645
70645
  };
70646
- function vh(r6) {
70646
+ function Th(r6) {
70647
70647
  let e = He[r6.toUpperCase()];
70648
70648
  if (e === void 0) throw new Error(`Invalid log level: ${r6}`);
70649
70649
  return e;
@@ -70661,10 +70661,10 @@ function cr(r6, e = 0, t = 10) {
70661
70661
  }
70662
70662
  return n;
70663
70663
  }
70664
- var Sn = `${ft}/fhir/StructureDefinition/patient-preferredPharmacy`;
70665
- var iu = "https://meta.medplum.com/releases";
70664
+ var Sn = `${dt}/fhir/StructureDefinition/patient-preferredPharmacy`;
70665
+ var ou = "https://meta.medplum.com/releases";
70666
70666
  var pr = /* @__PURE__ */ new Map();
70667
- function ou(r6) {
70667
+ function su(r6) {
70668
70668
  let e = r6;
70669
70669
  if (!e.tag_name) throw new Error("Manifest missing tag_name");
70670
70670
  let t = e.assets;
@@ -70677,7 +70677,7 @@ function ou(r6) {
70677
70677
  async function Rn(r6, e, t) {
70678
70678
  let n = pr.get(e ?? "latest");
70679
70679
  if (!n) {
70680
- let i = e ? `v${e}` : "latest", o2 = new URL(`${iu}/${i}.json`);
70680
+ let i = e ? `v${e}` : "latest", o2 = new URL(`${ou}/${i}.json`);
70681
70681
  if (o2.searchParams.set("a", r6), o2.searchParams.set("c", un), t) for (let [u2, l2] of Object.entries(t)) o2.searchParams.set(u2, l2);
70682
70682
  let s = await fetch(o2.toString());
70683
70683
  if (s.status !== 200) {
@@ -70690,15 +70690,15 @@ async function Rn(r6, e, t) {
70690
70690
  throw new Error(`Received status code ${s.status} while fetching manifest for version '${e ?? "latest"}'. Message: ${u2}`);
70691
70691
  }
70692
70692
  let a = await s.json();
70693
- ou(a), n = a, pr.set(e ?? "latest", n), e || pr.set(n.tag_name.slice(1), n);
70693
+ su(a), n = a, pr.set(e ?? "latest", n), e || pr.set(n.tag_name.slice(1), n);
70694
70694
  }
70695
70695
  return n;
70696
70696
  }
70697
- function su(r6) {
70697
+ function au(r6) {
70698
70698
  return /^\d+\.\d+\.\d+(-[0-9a-z]{7})?$/.test(r6);
70699
70699
  }
70700
- async function ty(r6, e) {
70701
- if (!su(e)) return false;
70700
+ async function ry(r6, e) {
70701
+ if (!au(e)) return false;
70702
70702
  try {
70703
70703
  await Rn(r6, e);
70704
70704
  } catch {
@@ -70706,7 +70706,7 @@ async function ty(r6, e) {
70706
70706
  }
70707
70707
  return true;
70708
70708
  }
70709
- async function ry(r6) {
70709
+ async function ny(r6) {
70710
70710
  let e = await Rn(r6);
70711
70711
  if (!e.tag_name.startsWith("v")) throw new Error(`Invalid release name found. Release tag '${e.tag_name}' did not start with 'v'`);
70712
70712
  return e.tag_name.slice(1);
@@ -70804,7 +70804,7 @@ var g2 = class extends m2 {
70804
70804
  return;
70805
70805
  }
70806
70806
  let p = c2.message.getSegment("MSA")?.getField(1)?.toString()?.toUpperCase();
70807
- p && (h2.returnAck === kd.APPLICATION && p === "CA" || (h2.resolve(c2.message), this.pendingMessages.delete(a)));
70807
+ p && (h2.returnAck === Dd.APPLICATION && p === "CA" || (h2.resolve(c2.message), this.pendingMessages.delete(a)));
70808
70808
  });
70809
70809
  }
70810
70810
  isClosed() {
@@ -70857,7 +70857,7 @@ var g2 = class extends m2 {
70857
70857
  let r6;
70858
70858
  t?.timeoutMs && (r6 = setTimeout(() => {
70859
70859
  this.pendingMessages.delete(c2), n(new f({ resourceType: "OperationOutcome", issue: [{ severity: "error", code: "timeout", details: { text: "Client timeout" }, diagnostics: `Request timed out after waiting ${t.timeoutMs} milliseconds for response` }] }));
70860
- }, t.timeoutMs)), this.pendingMessages.set(c2, { message: e, resolve: s, reject: n, returnAck: t?.returnAck ?? kd.APPLICATION, timer: r6 }), this.sendImpl(e);
70860
+ }, t.timeoutMs)), this.pendingMessages.set(c2, { message: e, resolve: s, reject: n, returnAck: t?.returnAck ?? Dd.APPLICATION, timer: r6 }), this.sendImpl(e);
70861
70861
  });
70862
70862
  }
70863
70863
  async close() {
@@ -72243,7 +72243,7 @@ function cleanupLoggerConfig(config, configPathRoot = "config") {
72243
72243
  warnings.push(`${configPathRoot}.filesToKeep must be a valid integer`);
72244
72244
  config.filesToKeep = void 0;
72245
72245
  }
72246
- if (typeof config.logLevel !== "undefined" && !(typeof config.logLevel === "number" && $c[config.logLevel] !== void 0)) {
72246
+ if (typeof config.logLevel !== "undefined" && !(typeof config.logLevel === "number" && Hc[config.logLevel] !== void 0)) {
72247
72247
  warnings.push(`${configPathRoot}.logLevel must be a valid log level between LogLevel.NONE and LogLevel.DEBUG`);
72248
72248
  config.logLevel = void 0;
72249
72249
  }
@@ -72281,14 +72281,14 @@ function parseLoggerConfigFromArgs(args) {
72281
72281
  if (!propName.startsWith("logger.") || propVal === void 0) {
72282
72282
  continue;
72283
72283
  }
72284
- const [_2, configType, settingName] = Ze(propName, ".", 3);
72284
+ const [_2, configType, settingName] = Xe(propName, ".", 3);
72285
72285
  if (!LOGGER_CONFIG_KEYS.includes(settingName)) {
72286
72286
  warnings.push(`${propName} is not a valid setting name`);
72287
72287
  }
72288
72288
  let configValue;
72289
72289
  if (settingName === "logLevel") {
72290
72290
  try {
72291
- configValue = vh(propVal);
72291
+ configValue = Th(propVal);
72292
72292
  } catch (err) {
72293
72293
  warnings.push(`Error while parsing ${propName}: ${_e(err)}`);
72294
72294
  }
@@ -72623,9 +72623,9 @@ async function downloadRelease(version, path4) {
72623
72623
  writeStream.once("close", resolve2);
72624
72624
  });
72625
72625
  }
72626
- function parseDownloadUrl(release, os2) {
72626
+ function parseDownloadUrl(release, os) {
72627
72627
  let endingToMatch;
72628
- switch (os2) {
72628
+ switch (os) {
72629
72629
  case "win32":
72630
72630
  endingToMatch = ".exe";
72631
72631
  break;
@@ -72633,14 +72633,14 @@ function parseDownloadUrl(release, os2) {
72633
72633
  endingToMatch = "linux";
72634
72634
  break;
72635
72635
  default:
72636
- throw new Error(`Unsupported platform: ${os2}`);
72636
+ throw new Error(`Unsupported platform: ${os}`);
72637
72637
  }
72638
72638
  for (const asset of release.assets) {
72639
72639
  if (asset.name.endsWith(endingToMatch)) {
72640
72640
  return asset.browser_download_url;
72641
72641
  }
72642
72642
  }
72643
- throw new Error(`No download URL found for release '${release.tag_name}' for ${os2}`);
72643
+ throw new Error(`No download URL found for release '${release.tag_name}' for ${os}`);
72644
72644
  }
72645
72645
  function getReleaseBinPath(version) {
72646
72646
  let binaryName;
@@ -73215,7 +73215,7 @@ IPv6 is currently unsupported.`;
73215
73215
  this.log.error(errMsg);
73216
73216
  throw new Error(errMsg);
73217
73217
  }
73218
- if (!((0, import_node_net4.isIPv4)(message.remote) || Zl(message.remote))) {
73218
+ if (!((0, import_node_net4.isIPv4)(message.remote) || ep(message.remote))) {
73219
73219
  const errMsg = `Attempted to ping an invalid host.
73220
73220
 
73221
73221
  "${message.remote}" is not a valid IPv4 address or a resolvable hostname.`;
@@ -73290,7 +73290,7 @@ ${result}`);
73290
73290
  return;
73291
73291
  }
73292
73292
  let child;
73293
- if (message.version && !await ty("agent-upgrader", message.version)) {
73293
+ if (message.version && !await ry("agent-upgrader", message.version)) {
73294
73294
  const versionTag = message.version ? `v${message.version}` : "latest";
73295
73295
  const errMsg = `Error during upgrading to version '${versionTag}'. '${message.version}' is not a valid version`;
73296
73296
  this.log.error(errMsg);
@@ -73301,7 +73301,7 @@ ${result}`);
73301
73301
  });
73302
73302
  return;
73303
73303
  }
73304
- const targetVersion = message.version ?? await ry("agent-upgrader");
73304
+ const targetVersion = message.version ?? await ny("agent-upgrader");
73305
73305
  if (un.startsWith(targetVersion)) {
73306
73306
  if (!message?.force) {
73307
73307
  this.log.info(`Attempted to upgrade to version ${targetVersion}, but agent is already on that version`);
@@ -73467,7 +73467,7 @@ ${result}`);
73467
73467
  } catch (err) {
73468
73468
  this.log.warn(`${_e(err)} - falling back to default return ACK behavior of 'first'.`);
73469
73469
  }
73470
- const returnAck = msgReturnAck ?? defaultReturnAck ?? kd.FIRST;
73470
+ const returnAck = msgReturnAck ?? defaultReturnAck ?? Dd.FIRST;
73471
73471
  let pool;
73472
73472
  if (this.hl7Clients.has(message.remote)) {
73473
73473
  pool = this.hl7Clients.get(message.remote);
@@ -73565,10 +73565,10 @@ ${result}`);
73565
73565
  }
73566
73566
  const normalizedValue = rawValue.toLowerCase();
73567
73567
  if (normalizedValue === "application") {
73568
- return kd.APPLICATION;
73568
+ return Dd.APPLICATION;
73569
73569
  }
73570
73570
  if (normalizedValue === "first") {
73571
- return kd.FIRST;
73571
+ return Dd.FIRST;
73572
73572
  }
73573
73573
  throw new Error(`Invalid value for returnAck; expected: 'first' or 'application', received: ${rawValue}`);
73574
73574
  }
@@ -73631,7 +73631,7 @@ async function agentMain(argv) {
73631
73631
  for (const warning of warnings) {
73632
73632
  mainLogger.warn(warning);
73633
73633
  }
73634
- const app = new App(medplum, agentId, args.logLevel ? vh(args.logLevel) : void 0, {
73634
+ const app = new App(medplum, agentId, args.logLevel ? Th(args.logLevel) : void 0, {
73635
73635
  mainLogger,
73636
73636
  channelLogger
73637
73637
  });
@@ -73673,10 +73673,10 @@ async function upgraderMain(argv) {
73673
73673
  rejectOnTimeout = () => reject(new Error("Timed out while waiting for IPC to disconnect"));
73674
73674
  import_node_process3.default.once("disconnect", resolve2);
73675
73675
  });
73676
- if (argv[3] && !su(argv[3])) {
73676
+ if (argv[3] && !au(argv[3])) {
73677
73677
  throw new Error("Invalid version specified");
73678
73678
  }
73679
- const version = argv[3] ?? await ry("agent-upgrader");
73679
+ const version = argv[3] ?? await ny("agent-upgrader");
73680
73680
  const binPath = getReleaseBinPath(version);
73681
73681
  if (!(0, import_node_fs6.existsSync)(binPath)) {
73682
73682
  globalLogger.info(`Could not find binary at "${binPath}". Downloading release from GitHub...`);