@medplum/agent 5.1.23 → 5.1.24

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 +791 -744
  2. package/package.json +5 -5
@@ -17,13 +17,13 @@ var __export = (target, all) => {
17
17
  for (var name in all)
18
18
  __defProp(target, name, { get: all[name], enumerable: true });
19
19
  };
20
- var __copyProps = (to, from, except, desc) => {
20
+ var __copyProps = (to2, from, except, desc) => {
21
21
  if (from && typeof from === "object" || typeof from === "function") {
22
22
  for (let key of __getOwnPropNames(from))
23
- if (!__hasOwnProp.call(to, key) && key !== except)
24
- __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
23
+ if (!__hasOwnProp.call(to2, key) && key !== except)
24
+ __defProp(to2, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
25
25
  }
26
- return to;
26
+ return to2;
27
27
  };
28
28
  var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
29
29
  // If the importer is in node compatibility mode or this is not an ESM
@@ -4512,8 +4512,8 @@ var require_gt = __commonJS({
4512
4512
  "node_modules/semver/functions/gt.js"(exports2, module2) {
4513
4513
  "use strict";
4514
4514
  var compare = require_compare();
4515
- var gt2 = (a, b2, loose) => compare(a, b2, loose) > 0;
4516
- module2.exports = gt2;
4515
+ var gt = (a, b2, loose) => compare(a, b2, loose) > 0;
4516
+ module2.exports = gt;
4517
4517
  }
4518
4518
  });
4519
4519
 
@@ -4522,8 +4522,8 @@ var require_lt = __commonJS({
4522
4522
  "node_modules/semver/functions/lt.js"(exports2, module2) {
4523
4523
  "use strict";
4524
4524
  var compare = require_compare();
4525
- var lt3 = (a, b2, loose) => compare(a, b2, loose) < 0;
4526
- module2.exports = lt3;
4525
+ var lt4 = (a, b2, loose) => compare(a, b2, loose) < 0;
4526
+ module2.exports = lt4;
4527
4527
  }
4528
4528
  });
4529
4529
 
@@ -4573,9 +4573,9 @@ var require_cmp = __commonJS({
4573
4573
  "use strict";
4574
4574
  var eq = require_eq();
4575
4575
  var neq = require_neq();
4576
- var gt2 = require_gt();
4576
+ var gt = require_gt();
4577
4577
  var gte = require_gte();
4578
- var lt3 = require_lt();
4578
+ var lt4 = require_lt();
4579
4579
  var lte = require_lte();
4580
4580
  var cmp = (a, op, b2, loose) => {
4581
4581
  switch (op) {
@@ -4602,11 +4602,11 @@ var require_cmp = __commonJS({
4602
4602
  case "!=":
4603
4603
  return neq(a, b2, loose);
4604
4604
  case ">":
4605
- return gt2(a, b2, loose);
4605
+ return gt(a, b2, loose);
4606
4606
  case ">=":
4607
4607
  return gte(a, b2, loose);
4608
4608
  case "<":
4609
- return lt3(a, b2, loose);
4609
+ return lt4(a, b2, loose);
4610
4610
  case "<=":
4611
4611
  return lte(a, b2, loose);
4612
4612
  default:
@@ -5018,8 +5018,8 @@ var require_range = __commonJS({
5018
5018
  }
5019
5019
  const xM = isX(M3);
5020
5020
  const xm = xM || isX(m3);
5021
- const xp = xm || isX(p3);
5022
- const anyX = xp;
5021
+ const xp2 = xm || isX(p3);
5022
+ const anyX = xp2;
5023
5023
  if (gtlt === "=" && anyX) {
5024
5024
  gtlt = "";
5025
5025
  }
@@ -5059,7 +5059,7 @@ var require_range = __commonJS({
5059
5059
  ret = `${gtlt + M3}.${m3}.${p3}${pr2}`;
5060
5060
  } else if (xm) {
5061
5061
  ret = `>=${M3}.0.0${pr2} <${+M3 + 1}.0.0-0`;
5062
- } else if (xp) {
5062
+ } else if (xp2) {
5063
5063
  ret = `>=${M3}.${m3}.0${pr2} <${M3}.${+m3 + 1}.0-0`;
5064
5064
  }
5065
5065
  debug("xRange return", ret);
@@ -5074,7 +5074,7 @@ var require_range = __commonJS({
5074
5074
  debug("replaceGTE0", comp, options);
5075
5075
  return comp.trim().replace(re2[options.includePrerelease ? t6.GTE0PRE : t6.GTE0], "");
5076
5076
  };
5077
- var hyphenReplace = (incPr) => ($0, from, fM, fm, fp, fpr, fb, to, tM, tm, tp, tpr) => {
5077
+ var hyphenReplace = (incPr) => ($0, from, fM, fm, fp, fpr, fb, to2, tM, tm, tp, tpr) => {
5078
5078
  if (isX(fM)) {
5079
5079
  from = "";
5080
5080
  } else if (isX(fm)) {
@@ -5087,19 +5087,19 @@ var require_range = __commonJS({
5087
5087
  from = `>=${from}${incPr ? "-0" : ""}`;
5088
5088
  }
5089
5089
  if (isX(tM)) {
5090
- to = "";
5090
+ to2 = "";
5091
5091
  } else if (isX(tm)) {
5092
- to = `<${+tM + 1}.0.0-0`;
5092
+ to2 = `<${+tM + 1}.0.0-0`;
5093
5093
  } else if (isX(tp)) {
5094
- to = `<${tM}.${+tm + 1}.0-0`;
5094
+ to2 = `<${tM}.${+tm + 1}.0-0`;
5095
5095
  } else if (tpr) {
5096
- to = `<=${tM}.${tm}.${tp}-${tpr}`;
5096
+ to2 = `<=${tM}.${tm}.${tp}-${tpr}`;
5097
5097
  } else if (incPr) {
5098
- to = `<${tM}.${tm}.${+tp + 1}-0`;
5098
+ to2 = `<${tM}.${tm}.${+tp + 1}-0`;
5099
5099
  } else {
5100
- to = `<=${to}`;
5100
+ to2 = `<=${to2}`;
5101
5101
  }
5102
- return `${from} ${to}`.trim();
5102
+ return `${from} ${to2}`.trim();
5103
5103
  };
5104
5104
  var testSet = (set4, version, options) => {
5105
5105
  for (let i = 0; i < set4.length; i++) {
@@ -5331,7 +5331,7 @@ var require_min_version = __commonJS({
5331
5331
  "use strict";
5332
5332
  var SemVer = require_semver();
5333
5333
  var Range = require_range();
5334
- var gt2 = require_gt();
5334
+ var gt = require_gt();
5335
5335
  var minVersion = (range, loose) => {
5336
5336
  range = new Range(range, loose);
5337
5337
  let minver = new SemVer("0.0.0");
@@ -5359,7 +5359,7 @@ var require_min_version = __commonJS({
5359
5359
  /* fallthrough */
5360
5360
  case "":
5361
5361
  case ">=":
5362
- if (!setMin || gt2(compver, setMin)) {
5362
+ if (!setMin || gt(compver, setMin)) {
5363
5363
  setMin = compver;
5364
5364
  }
5365
5365
  break;
@@ -5371,7 +5371,7 @@ var require_min_version = __commonJS({
5371
5371
  throw new Error(`Unexpected operation: ${comparator.operator}`);
5372
5372
  }
5373
5373
  });
5374
- if (setMin && (!minver || gt2(minver, setMin))) {
5374
+ if (setMin && (!minver || gt(minver, setMin))) {
5375
5375
  minver = setMin;
5376
5376
  }
5377
5377
  }
@@ -5409,8 +5409,8 @@ var require_outside = __commonJS({
5409
5409
  var { ANY } = Comparator;
5410
5410
  var Range = require_range();
5411
5411
  var satisfies = require_satisfies();
5412
- var gt2 = require_gt();
5413
- var lt3 = require_lt();
5412
+ var gt = require_gt();
5413
+ var lt4 = require_lt();
5414
5414
  var lte = require_lte();
5415
5415
  var gte = require_gte();
5416
5416
  var outside = (version, range, hilo, options) => {
@@ -5419,16 +5419,16 @@ var require_outside = __commonJS({
5419
5419
  let gtfn, ltefn, ltfn, comp, ecomp;
5420
5420
  switch (hilo) {
5421
5421
  case ">":
5422
- gtfn = gt2;
5422
+ gtfn = gt;
5423
5423
  ltefn = lte;
5424
- ltfn = lt3;
5424
+ ltfn = lt4;
5425
5425
  comp = ">";
5426
5426
  ecomp = ">=";
5427
5427
  break;
5428
5428
  case "<":
5429
- gtfn = lt3;
5429
+ gtfn = lt4;
5430
5430
  ltefn = gte;
5431
- ltfn = gt2;
5431
+ ltfn = gt;
5432
5432
  comp = "<";
5433
5433
  ecomp = "<=";
5434
5434
  break;
@@ -5606,12 +5606,12 @@ var require_subset = __commonJS({
5606
5606
  }
5607
5607
  }
5608
5608
  const eqSet = /* @__PURE__ */ new Set();
5609
- let gt2, lt3;
5609
+ let gt, lt4;
5610
5610
  for (const c2 of sub2) {
5611
5611
  if (c2.operator === ">" || c2.operator === ">=") {
5612
- gt2 = higherGT(gt2, c2, options);
5612
+ gt = higherGT(gt, c2, options);
5613
5613
  } else if (c2.operator === "<" || c2.operator === "<=") {
5614
- lt3 = lowerLT(lt3, c2, options);
5614
+ lt4 = lowerLT(lt4, c2, options);
5615
5615
  } else {
5616
5616
  eqSet.add(c2.semver);
5617
5617
  }
@@ -5620,19 +5620,19 @@ var require_subset = __commonJS({
5620
5620
  return null;
5621
5621
  }
5622
5622
  let gtltComp;
5623
- if (gt2 && lt3) {
5624
- gtltComp = compare(gt2.semver, lt3.semver, options);
5623
+ if (gt && lt4) {
5624
+ gtltComp = compare(gt.semver, lt4.semver, options);
5625
5625
  if (gtltComp > 0) {
5626
5626
  return null;
5627
- } else if (gtltComp === 0 && (gt2.operator !== ">=" || lt3.operator !== "<=")) {
5627
+ } else if (gtltComp === 0 && (gt.operator !== ">=" || lt4.operator !== "<=")) {
5628
5628
  return null;
5629
5629
  }
5630
5630
  }
5631
5631
  for (const eq of eqSet) {
5632
- if (gt2 && !satisfies(eq, String(gt2), options)) {
5632
+ if (gt && !satisfies(eq, String(gt), options)) {
5633
5633
  return null;
5634
5634
  }
5635
- if (lt3 && !satisfies(eq, String(lt3), options)) {
5635
+ if (lt4 && !satisfies(eq, String(lt4), options)) {
5636
5636
  return null;
5637
5637
  }
5638
5638
  for (const c2 of dom) {
@@ -5644,52 +5644,52 @@ var require_subset = __commonJS({
5644
5644
  }
5645
5645
  let higher, lower;
5646
5646
  let hasDomLT, hasDomGT;
5647
- let needDomLTPre = lt3 && !options.includePrerelease && lt3.semver.prerelease.length ? lt3.semver : false;
5648
- let needDomGTPre = gt2 && !options.includePrerelease && gt2.semver.prerelease.length ? gt2.semver : false;
5649
- if (needDomLTPre && needDomLTPre.prerelease.length === 1 && lt3.operator === "<" && needDomLTPre.prerelease[0] === 0) {
5647
+ let needDomLTPre = lt4 && !options.includePrerelease && lt4.semver.prerelease.length ? lt4.semver : false;
5648
+ let needDomGTPre = gt && !options.includePrerelease && gt.semver.prerelease.length ? gt.semver : false;
5649
+ if (needDomLTPre && needDomLTPre.prerelease.length === 1 && lt4.operator === "<" && needDomLTPre.prerelease[0] === 0) {
5650
5650
  needDomLTPre = false;
5651
5651
  }
5652
5652
  for (const c2 of dom) {
5653
5653
  hasDomGT = hasDomGT || c2.operator === ">" || c2.operator === ">=";
5654
5654
  hasDomLT = hasDomLT || c2.operator === "<" || c2.operator === "<=";
5655
- if (gt2) {
5655
+ if (gt) {
5656
5656
  if (needDomGTPre) {
5657
5657
  if (c2.semver.prerelease && c2.semver.prerelease.length && c2.semver.major === needDomGTPre.major && c2.semver.minor === needDomGTPre.minor && c2.semver.patch === needDomGTPre.patch) {
5658
5658
  needDomGTPre = false;
5659
5659
  }
5660
5660
  }
5661
5661
  if (c2.operator === ">" || c2.operator === ">=") {
5662
- higher = higherGT(gt2, c2, options);
5663
- if (higher === c2 && higher !== gt2) {
5662
+ higher = higherGT(gt, c2, options);
5663
+ if (higher === c2 && higher !== gt) {
5664
5664
  return false;
5665
5665
  }
5666
- } else if (gt2.operator === ">=" && !c2.test(gt2.semver)) {
5666
+ } else if (gt.operator === ">=" && !c2.test(gt.semver)) {
5667
5667
  return false;
5668
5668
  }
5669
5669
  }
5670
- if (lt3) {
5670
+ if (lt4) {
5671
5671
  if (needDomLTPre) {
5672
5672
  if (c2.semver.prerelease && c2.semver.prerelease.length && c2.semver.major === needDomLTPre.major && c2.semver.minor === needDomLTPre.minor && c2.semver.patch === needDomLTPre.patch) {
5673
5673
  needDomLTPre = false;
5674
5674
  }
5675
5675
  }
5676
5676
  if (c2.operator === "<" || c2.operator === "<=") {
5677
- lower = lowerLT(lt3, c2, options);
5678
- if (lower === c2 && lower !== lt3) {
5677
+ lower = lowerLT(lt4, c2, options);
5678
+ if (lower === c2 && lower !== lt4) {
5679
5679
  return false;
5680
5680
  }
5681
- } else if (lt3.operator === "<=" && !c2.test(lt3.semver)) {
5681
+ } else if (lt4.operator === "<=" && !c2.test(lt4.semver)) {
5682
5682
  return false;
5683
5683
  }
5684
5684
  }
5685
- if (!c2.operator && (lt3 || gt2) && gtltComp !== 0) {
5685
+ if (!c2.operator && (lt4 || gt) && gtltComp !== 0) {
5686
5686
  return false;
5687
5687
  }
5688
5688
  }
5689
- if (gt2 && hasDomLT && !lt3 && gtltComp !== 0) {
5689
+ if (gt && hasDomLT && !lt4 && gtltComp !== 0) {
5690
5690
  return false;
5691
5691
  }
5692
- if (lt3 && hasDomGT && !gt2 && gtltComp !== 0) {
5692
+ if (lt4 && hasDomGT && !gt && gtltComp !== 0) {
5693
5693
  return false;
5694
5694
  }
5695
5695
  if (needDomGTPre || needDomLTPre) {
@@ -5738,8 +5738,8 @@ var require_semver2 = __commonJS({
5738
5738
  var compareBuild = require_compare_build();
5739
5739
  var sort = require_sort();
5740
5740
  var rsort = require_rsort();
5741
- var gt2 = require_gt();
5742
- var lt3 = require_lt();
5741
+ var gt = require_gt();
5742
+ var lt4 = require_lt();
5743
5743
  var eq = require_eq();
5744
5744
  var neq = require_neq();
5745
5745
  var gte = require_gte();
@@ -5777,8 +5777,8 @@ var require_semver2 = __commonJS({
5777
5777
  compareBuild,
5778
5778
  sort,
5779
5779
  rsort,
5780
- gt: gt2,
5781
- lt: lt3,
5780
+ gt,
5781
+ lt: lt4,
5782
5782
  eq,
5783
5783
  neq,
5784
5784
  gte,
@@ -10860,10 +10860,10 @@ var require_dcmjs = __commonJS({
10860
10860
  throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
10861
10861
  }
10862
10862
  function _createForOfIteratorHelper2(o2, allowArrayLike) {
10863
- var it2 = typeof Symbol !== "undefined" && o2[Symbol.iterator] || o2["@@iterator"];
10864
- if (!it2) {
10865
- if (Array.isArray(o2) || (it2 = _unsupportedIterableToArray2(o2)) || allowArrayLike) {
10866
- if (it2) o2 = it2;
10863
+ var it = typeof Symbol !== "undefined" && o2[Symbol.iterator] || o2["@@iterator"];
10864
+ if (!it) {
10865
+ if (Array.isArray(o2) || (it = _unsupportedIterableToArray2(o2)) || allowArrayLike) {
10866
+ if (it) o2 = it;
10867
10867
  var i = 0;
10868
10868
  var F2 = function() {
10869
10869
  };
@@ -10889,10 +10889,10 @@ var require_dcmjs = __commonJS({
10889
10889
  var normalCompletion = true, didErr = false, err3;
10890
10890
  return {
10891
10891
  s: function() {
10892
- it2 = it2.call(o2);
10892
+ it = it.call(o2);
10893
10893
  },
10894
10894
  n: function() {
10895
- var step = it2.next();
10895
+ var step = it.next();
10896
10896
  normalCompletion = step.done;
10897
10897
  return step;
10898
10898
  },
@@ -10902,7 +10902,7 @@ var require_dcmjs = __commonJS({
10902
10902
  },
10903
10903
  f: function() {
10904
10904
  try {
10905
- if (!normalCompletion && it2.return != null) it2.return();
10905
+ if (!normalCompletion && it.return != null) it.return();
10906
10906
  } finally {
10907
10907
  if (didErr) throw err3;
10908
10908
  }
@@ -17346,8 +17346,8 @@ var require_dcmjs = __commonJS({
17346
17346
  key: "writeBytes",
17347
17347
  value: function writeBytes(stream, value, writeOptions) {
17348
17348
  var _this11 = this;
17349
- var val = Array.isArray(value) ? value.map(function(is) {
17350
- return _this11.convertToString(is);
17349
+ var val = Array.isArray(value) ? value.map(function(is2) {
17350
+ return _this11.convertToString(is2);
17351
17351
  }) : [this.convertToString(value)];
17352
17352
  return _get2(_getPrototypeOf2(IntegerString3.prototype), "writeBytes", this).call(this, stream, val, writeOptions);
17353
17353
  }
@@ -18653,10 +18653,10 @@ var require_dcmjs = __commonJS({
18653
18653
  var elem = parseInt(hex8.slice(4, 8), 16);
18654
18654
  if (!Number.isFinite(group) || !Number.isFinite(elem)) return void 0;
18655
18655
  var _initPacked = initPacked2(), groups = _initPacked.groups, groupStart = _initPacked.groupStart, elems = _initPacked.elems, vrCode = _initPacked.vrCode, vmCode = _initPacked.vmCode, nameOff = _initPacked.nameOff, nameLen = _initPacked.nameLen;
18656
- var gi = _ensureGroupIndex2(groups).get(group);
18657
- if (gi === void 0) return void 0;
18658
- var start = groupStart[gi];
18659
- var end = gi + 1 < groupStart.length ? groupStart[gi + 1] : elems.length;
18656
+ var gi2 = _ensureGroupIndex2(groups).get(group);
18657
+ if (gi2 === void 0) return void 0;
18658
+ var start = groupStart[gi2];
18659
+ var end = gi2 + 1 < groupStart.length ? groupStart[gi2 + 1] : elems.length;
18660
18660
  var ei = _binSearchU162(elems, start, end, elem);
18661
18661
  if (ei < 0) return void 0;
18662
18662
  var vr = vrTable$12[vrCode[ei]];
@@ -18693,10 +18693,10 @@ var require_dcmjs = __commonJS({
18693
18693
  function getAllStandardTagEntries2() {
18694
18694
  var out = [];
18695
18695
  var _initPacked2 = initPacked2(), groups = _initPacked2.groups, groupStart = _initPacked2.groupStart, elems = _initPacked2.elems, vrCode = _initPacked2.vrCode, vmCode = _initPacked2.vmCode, nameOff = _initPacked2.nameOff, nameLen = _initPacked2.nameLen;
18696
- for (var gi = 0; gi < groups.length; gi++) {
18697
- var group = groups[gi];
18698
- var start = groupStart[gi];
18699
- var end = gi + 1 < groupStart.length ? groupStart[gi + 1] : elems.length;
18696
+ for (var gi2 = 0; gi2 < groups.length; gi2++) {
18697
+ var group = groups[gi2];
18698
+ var start = groupStart[gi2];
18699
+ var end = gi2 + 1 < groupStart.length ? groupStart[gi2 + 1] : elems.length;
18700
18700
  var gHex = _pad42(group.toString(16).toUpperCase());
18701
18701
  for (var ei = start; ei < end; ei++) {
18702
18702
  var elem = elems[ei];
@@ -18741,9 +18741,9 @@ var require_dcmjs = __commonJS({
18741
18741
  return k.slice(1, 5) + k.slice(6, 10);
18742
18742
  }
18743
18743
  var dictionary2 = new Proxy(/* @__PURE__ */ Object.create(null), {
18744
- get: function get3(_t2, prop) {
18744
+ get: function get3(_t, prop) {
18745
18745
  if (typeof prop !== "string") return void 0;
18746
- if (Object.prototype.hasOwnProperty.call(_t2, prop)) return _t2[prop];
18746
+ if (Object.prototype.hasOwnProperty.call(_t, prop)) return _t[prop];
18747
18747
  if (cache2.has(prop)) return cache2.get(prop);
18748
18748
  if (prop.length === 11 && prop[0] === "(" && prop[5] === "," && prop[10] === ")") {
18749
18749
  var hex8 = _toHex8FromParenKey2(prop);
@@ -18786,7 +18786,7 @@ var require_dcmjs = __commonJS({
18786
18786
  }
18787
18787
  return void 0;
18788
18788
  },
18789
- has: function has2(_t2, prop) {
18789
+ has: function has2(_t, prop) {
18790
18790
  if (typeof prop !== "string") return false;
18791
18791
  if (cache2.has(prop)) return true;
18792
18792
  if (prop.length === 11 && prop[0] === "(" && prop[5] === "," && prop[10] === ")") {
@@ -19241,7 +19241,7 @@ var require_dcmjs = __commonJS({
19241
19241
  }
19242
19242
  }, {
19243
19243
  key: "is",
19244
- value: function is(t6) {
19244
+ value: function is2(t6) {
19245
19245
  return this.value == t6;
19246
19246
  }
19247
19247
  /**
@@ -26522,8 +26522,8 @@ var require_dcmjs = __commonJS({
26522
26522
  key: "getCornerstoneLabelFromDefaultState",
26523
26523
  value: function getCornerstoneLabelFromDefaultState(defaultState) {
26524
26524
  var _defaultState$finding = defaultState.findingSites, findingSites = _defaultState$finding === void 0 ? [] : _defaultState$finding, finding = defaultState.finding;
26525
- var freeTextLabel = findingSites.find(function(fs4) {
26526
- return isFreeTextCodeValue3(fs4.CodeValue) || isLegacyFreeTextCodeValue3(fs4.CodeValue);
26525
+ var freeTextLabel = findingSites.find(function(fs3) {
26526
+ return isFreeTextCodeValue3(fs3.CodeValue) || isLegacyFreeTextCodeValue3(fs3.CodeValue);
26527
26527
  });
26528
26528
  if (freeTextLabel) {
26529
26529
  return freeTextLabel.CodeMeaning;
@@ -34392,8 +34392,8 @@ var require_util = __commonJS({
34392
34392
  };
34393
34393
  exports2.nearestCommonProto = nearestCommonProto;
34394
34394
  var hardMixProtos = (ingredients, constructor, exclude = []) => {
34395
- var _a2;
34396
- const base = (_a2 = (0, exports2.nearestCommonProto)(...ingredients)) !== null && _a2 !== void 0 ? _a2 : Object.prototype;
34395
+ var _a;
34396
+ const base = (_a = (0, exports2.nearestCommonProto)(...ingredients)) !== null && _a !== void 0 ? _a : Object.prototype;
34397
34397
  const mixedProto = Object.create(base);
34398
34398
  const visitedProtos = (0, exports2.protoChain)(base);
34399
34399
  for (let prototype of ingredients) {
@@ -34523,8 +34523,8 @@ var require_mixin_tracking = __commonJS({
34523
34523
  frontier.forEach((item) => visited.add(item));
34524
34524
  const newFrontier = /* @__PURE__ */ new Set();
34525
34525
  frontier.forEach((item) => {
34526
- var _a2;
34527
- const itemConstituents = (_a2 = mixins.get(item)) !== null && _a2 !== void 0 ? _a2 : (0, util_1.protoChain)(item.prototype).map((proto) => proto.constructor).filter((item2) => item2 !== null);
34526
+ var _a;
34527
+ const itemConstituents = (_a = mixins.get(item)) !== null && _a !== void 0 ? _a : (0, util_1.protoChain)(item.prototype).map((proto) => proto.constructor).filter((item2) => item2 !== null);
34528
34528
  if (itemConstituents)
34529
34529
  itemConstituents.forEach((constituent) => {
34530
34530
  if (!visited.has(constituent) && !frontier.has(constituent))
@@ -34548,37 +34548,37 @@ var require_decorator = __commonJS({
34548
34548
  var util_1 = require_util();
34549
34549
  var mixin_tracking_1 = require_mixin_tracking();
34550
34550
  var mergeObjectsOfDecorators = (o1, o2) => {
34551
- var _a2, _b;
34551
+ var _a, _b;
34552
34552
  const allKeys = (0, util_1.unique)([...Object.getOwnPropertyNames(o1), ...Object.getOwnPropertyNames(o2)]);
34553
34553
  const mergedObject = {};
34554
34554
  for (let key of allKeys)
34555
- mergedObject[key] = (0, util_1.unique)([...(_a2 = o1 === null || o1 === void 0 ? void 0 : o1[key]) !== null && _a2 !== void 0 ? _a2 : [], ...(_b = o2 === null || o2 === void 0 ? void 0 : o2[key]) !== null && _b !== void 0 ? _b : []]);
34555
+ mergedObject[key] = (0, util_1.unique)([...(_a = o1 === null || o1 === void 0 ? void 0 : o1[key]) !== null && _a !== void 0 ? _a : [], ...(_b = o2 === null || o2 === void 0 ? void 0 : o2[key]) !== null && _b !== void 0 ? _b : []]);
34556
34556
  return mergedObject;
34557
34557
  };
34558
34558
  var mergePropertyAndMethodDecorators = (d1, d2) => {
34559
- var _a2, _b, _c2, _d;
34559
+ var _a, _b, _c2, _d;
34560
34560
  return {
34561
- 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 : {}),
34561
+ property: mergeObjectsOfDecorators((_a = d1 === null || d1 === void 0 ? void 0 : d1.property) !== null && _a !== void 0 ? _a : {}, (_b = d2 === null || d2 === void 0 ? void 0 : d2.property) !== null && _b !== void 0 ? _b : {}),
34562
34562
  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 : {})
34563
34563
  };
34564
34564
  };
34565
34565
  var mergeDecorators = (d1, d2) => {
34566
- var _a2, _b, _c2, _d, _e2, _f;
34566
+ var _a, _b, _c2, _d, _e2, _f;
34567
34567
  return {
34568
- 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 : []]),
34568
+ class: (0, util_1.unique)([...(_a = d1 === null || d1 === void 0 ? void 0 : d1.class) !== null && _a !== void 0 ? _a : [], ...(_b = d2 === null || d2 === void 0 ? void 0 : d2.class) !== null && _b !== void 0 ? _b : []]),
34569
34569
  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 : {}),
34570
34570
  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 : {})
34571
34571
  };
34572
34572
  };
34573
34573
  var decorators = /* @__PURE__ */ new Map();
34574
34574
  var findAllConstituentClasses = (...classes) => {
34575
- var _a2;
34575
+ var _a;
34576
34576
  const allClasses = /* @__PURE__ */ new Set();
34577
34577
  const frontier = /* @__PURE__ */ new Set([...classes]);
34578
34578
  while (frontier.size > 0) {
34579
34579
  for (let clazz of frontier) {
34580
34580
  const protoChainClasses = (0, util_1.protoChain)(clazz.prototype).map((proto) => proto.constructor);
34581
- const mixinClasses = (_a2 = (0, mixin_tracking_1.getMixinsForClass)(clazz)) !== null && _a2 !== void 0 ? _a2 : [];
34581
+ const mixinClasses = (_a = (0, mixin_tracking_1.getMixinsForClass)(clazz)) !== null && _a !== void 0 ? _a : [];
34582
34582
  const potentiallyNewClasses = [...protoChainClasses, ...mixinClasses];
34583
34583
  const newClasses = potentiallyNewClasses.filter((c2) => !allClasses.has(c2));
34584
34584
  for (let newClass of newClasses)
@@ -34627,12 +34627,12 @@ var require_decorator = __commonJS({
34627
34627
  return decorator(clazz);
34628
34628
  });
34629
34629
  var decorateMember = (decorator) => ((object, key, ...otherArgs) => {
34630
- var _a2, _b, _c2;
34630
+ var _a, _b, _c2;
34631
34631
  const decoratorTargetType = typeof object === "function" ? "static" : "instance";
34632
34632
  const decoratorType = typeof object[key] === "function" ? "method" : "property";
34633
34633
  const clazz = decoratorTargetType === "static" ? object : object.constructor;
34634
34634
  const decoratorsForClass = (0, exports2.getDecoratorsForClass)(clazz);
34635
- const decoratorsForTargetType = (_a2 = decoratorsForClass === null || decoratorsForClass === void 0 ? void 0 : decoratorsForClass[decoratorTargetType]) !== null && _a2 !== void 0 ? _a2 : {};
34635
+ const decoratorsForTargetType = (_a = decoratorsForClass === null || decoratorsForClass === void 0 ? void 0 : decoratorsForClass[decoratorTargetType]) !== null && _a !== void 0 ? _a : {};
34636
34636
  decoratorsForClass[decoratorTargetType] = decoratorsForTargetType;
34637
34637
  let decoratorsForType = (_b = decoratorsForTargetType === null || decoratorsForTargetType === void 0 ? void 0 : decoratorsForTargetType[decoratorType]) !== null && _b !== void 0 ? _b : {};
34638
34638
  decoratorsForTargetType[decoratorType] = decoratorsForType;
@@ -34662,7 +34662,7 @@ var require_mixins = __commonJS({
34662
34662
  var decorator_1 = require_decorator();
34663
34663
  var mixin_tracking_1 = require_mixin_tracking();
34664
34664
  function Mixin(...constructors) {
34665
- var _a2, _b, _c2;
34665
+ var _a, _b, _c2;
34666
34666
  const prototypes = constructors.map((constructor) => constructor.prototype);
34667
34667
  const initFunctionName = settings_1.settings.initFunction;
34668
34668
  if (initFunctionName !== null) {
@@ -34685,7 +34685,7 @@ var require_mixins = __commonJS({
34685
34685
  let DecoratedMixedClass = MixedClass;
34686
34686
  if (settings_1.settings.decoratorInheritance !== "none") {
34687
34687
  const classDecorators = settings_1.settings.decoratorInheritance === "deep" ? (0, decorator_1.deepDecoratorSearch)(...constructors) : (0, decorator_1.directDecoratorSearch)(...constructors);
34688
- for (let decorator of (_a2 = classDecorators === null || classDecorators === void 0 ? void 0 : classDecorators.class) !== null && _a2 !== void 0 ? _a2 : []) {
34688
+ for (let decorator of (_a = classDecorators === null || classDecorators === void 0 ? void 0 : classDecorators.class) !== null && _a !== void 0 ? _a : []) {
34689
34689
  const result = decorator(DecoratedMixedClass);
34690
34690
  if (result) {
34691
34691
  DecoratedMixedClass = result;
@@ -39005,8 +39005,8 @@ var require_fecha_umd = __commonJS({
39005
39005
  for (var _i = 1; _i < arguments.length; _i++) {
39006
39006
  args[_i - 1] = arguments[_i];
39007
39007
  }
39008
- for (var _a2 = 0, args_1 = args; _a2 < args_1.length; _a2++) {
39009
- var obj = args_1[_a2];
39008
+ for (var _a = 0, args_1 = args; _a < args_1.length; _a++) {
39009
+ var obj = args_1[_a];
39010
39010
  for (var key in obj) {
39011
39011
  origObj[key] = obj[key];
39012
39012
  }
@@ -39327,7 +39327,7 @@ var require_fecha_umd = __commonJS({
39327
39327
  }
39328
39328
  var combinedI18nSettings = assign2(assign2({}, globalI18n), i18n);
39329
39329
  for (var i = 1; i < matches.length; i++) {
39330
- var _a2 = parseInfo[i - 1], field = _a2[0], parser = _a2[2];
39330
+ var _a = parseInfo[i - 1], field = _a[0], parser = _a[2];
39331
39331
  var value = parser ? parser(matches[i], combinedI18nSettings) : +matches[i];
39332
39332
  if (value == null) {
39333
39333
  return null;
@@ -41542,9 +41542,9 @@ var require_stream_readable = __commonJS({
41542
41542
  return from(Readable2, iterable, opts);
41543
41543
  };
41544
41544
  }
41545
- function indexOf(xs2, x3) {
41546
- for (var i = 0, l = xs2.length; i < l; i++) {
41547
- if (xs2[i] === x3) return i;
41545
+ function indexOf(xs, x3) {
41546
+ for (var i = 0, l = xs.length; i < l; i++) {
41547
+ if (xs[i] === x3) return i;
41548
41548
  }
41549
41549
  return -1;
41550
41550
  }
@@ -42956,14 +42956,14 @@ var require_stream_transform = __commonJS({
42956
42956
  var Duplex = require_stream_duplex();
42957
42957
  require_inherits()(Transform, Duplex);
42958
42958
  function afterTransform(er2, data2) {
42959
- var ts2 = this._transformState;
42960
- ts2.transforming = false;
42961
- var cb = ts2.writecb;
42959
+ var ts = this._transformState;
42960
+ ts.transforming = false;
42961
+ var cb = ts.writecb;
42962
42962
  if (cb === null) {
42963
42963
  return this.emit("error", new ERR_MULTIPLE_CALLBACK());
42964
42964
  }
42965
- ts2.writechunk = null;
42966
- ts2.writecb = null;
42965
+ ts.writechunk = null;
42966
+ ts.writecb = null;
42967
42967
  if (data2 != null)
42968
42968
  this.push(data2);
42969
42969
  cb(er2);
@@ -43010,22 +43010,22 @@ var require_stream_transform = __commonJS({
43010
43010
  cb(new ERR_METHOD_NOT_IMPLEMENTED("_transform()"));
43011
43011
  };
43012
43012
  Transform.prototype._write = function(chunk, encoding, cb) {
43013
- var ts2 = this._transformState;
43014
- ts2.writecb = cb;
43015
- ts2.writechunk = chunk;
43016
- ts2.writeencoding = encoding;
43017
- if (!ts2.transforming) {
43013
+ var ts = this._transformState;
43014
+ ts.writecb = cb;
43015
+ ts.writechunk = chunk;
43016
+ ts.writeencoding = encoding;
43017
+ if (!ts.transforming) {
43018
43018
  var rs2 = this._readableState;
43019
- if (ts2.needTransform || rs2.needReadable || rs2.length < rs2.highWaterMark) this._read(rs2.highWaterMark);
43019
+ if (ts.needTransform || rs2.needReadable || rs2.length < rs2.highWaterMark) this._read(rs2.highWaterMark);
43020
43020
  }
43021
43021
  };
43022
43022
  Transform.prototype._read = function(n) {
43023
- var ts2 = this._transformState;
43024
- if (ts2.writechunk !== null && !ts2.transforming) {
43025
- ts2.transforming = true;
43026
- this._transform(ts2.writechunk, ts2.writeencoding, ts2.afterTransform);
43023
+ var ts = this._transformState;
43024
+ if (ts.writechunk !== null && !ts.transforming) {
43025
+ ts.transforming = true;
43026
+ this._transform(ts.writechunk, ts.writeencoding, ts.afterTransform);
43027
43027
  } else {
43028
- ts2.needTransform = true;
43028
+ ts.needTransform = true;
43029
43029
  }
43030
43030
  };
43031
43031
  Transform.prototype._destroy = function(err2, cb) {
@@ -43111,8 +43111,8 @@ var require_pipeline = __commonJS({
43111
43111
  function call(fn2) {
43112
43112
  fn2();
43113
43113
  }
43114
- function pipe(from, to) {
43115
- return from.pipe(to);
43114
+ function pipe(from, to2) {
43115
+ return from.pipe(to2);
43116
43116
  }
43117
43117
  function popCallback(streams) {
43118
43118
  if (!streams.length) return noop;
@@ -44377,9 +44377,9 @@ var require_index_cjs = __commonJS({
44377
44377
  }
44378
44378
  return graph;
44379
44379
  }
44380
- function link(from, to) {
44380
+ function link(from, to2) {
44381
44381
  return function(args) {
44382
- return to(from(args));
44382
+ return to2(from(args));
44383
44383
  };
44384
44384
  }
44385
44385
  function wrapConversion(toModel, graph) {
@@ -45027,7 +45027,7 @@ var require_node2 = __commonJS({
45027
45027
  var require_tail_file = __commonJS({
45028
45028
  "../../node_modules/winston/lib/winston/tail-file.js"(exports2, module2) {
45029
45029
  "use strict";
45030
- var fs4 = require("fs");
45030
+ var fs3 = require("fs");
45031
45031
  var { StringDecoder } = require("string_decoder");
45032
45032
  var { Stream } = require_readable();
45033
45033
  function noop() {
@@ -45048,7 +45048,7 @@ var require_tail_file = __commonJS({
45048
45048
  stream.emit("end");
45049
45049
  stream.emit("close");
45050
45050
  };
45051
- fs4.open(options.file, "a+", "0644", (err2, fd) => {
45051
+ fs3.open(options.file, "a+", "0644", (err2, fd) => {
45052
45052
  if (err2) {
45053
45053
  if (!iter) {
45054
45054
  stream.emit("error", err2);
@@ -45060,10 +45060,10 @@ var require_tail_file = __commonJS({
45060
45060
  }
45061
45061
  (function read() {
45062
45062
  if (stream.destroyed) {
45063
- fs4.close(fd, noop);
45063
+ fs3.close(fd, noop);
45064
45064
  return;
45065
45065
  }
45066
- return fs4.read(fd, buffer2, 0, buffer2.length, pos, (error, bytes) => {
45066
+ return fs3.read(fd, buffer2, 0, buffer2.length, pos, (error, bytes) => {
45067
45067
  if (error) {
45068
45068
  if (!iter) {
45069
45069
  stream.emit("error", error);
@@ -45122,7 +45122,7 @@ var require_tail_file = __commonJS({
45122
45122
  var require_file = __commonJS({
45123
45123
  "../../node_modules/winston/lib/winston/transports/file.js"(exports2, module2) {
45124
45124
  "use strict";
45125
- var fs4 = require("fs");
45125
+ var fs3 = require("fs");
45126
45126
  var path4 = require("path");
45127
45127
  var asyncSeries = require_series();
45128
45128
  var zlib = require("zlib");
@@ -45327,7 +45327,7 @@ var require_file = __commonJS({
45327
45327
  let buff = "";
45328
45328
  let results = [];
45329
45329
  let row = 0;
45330
- const stream = fs4.createReadStream(file, {
45330
+ const stream = fs3.createReadStream(file, {
45331
45331
  encoding: "utf8"
45332
45332
  });
45333
45333
  stream.on("error", (err2) => {
@@ -45479,7 +45479,7 @@ var require_file = __commonJS({
45479
45479
  stat(callback) {
45480
45480
  const target = this._getFile();
45481
45481
  const fullpath = path4.join(this.dirname, target);
45482
- fs4.stat(fullpath, (err2, stat) => {
45482
+ fs3.stat(fullpath, (err2, stat) => {
45483
45483
  if (err2 && err2.code === "ENOENT") {
45484
45484
  debug("ENOENT\xA0ok", fullpath);
45485
45485
  this.filename = target;
@@ -45584,7 +45584,7 @@ var require_file = __commonJS({
45584
45584
  _createStream(source) {
45585
45585
  const fullpath = path4.join(this.dirname, this.filename);
45586
45586
  debug("create stream start", fullpath, this.options);
45587
- const dest = fs4.createWriteStream(fullpath, this.options).on("error", (err2) => debug(err2)).on("close", () => debug("close", dest.path, dest.bytesWritten)).on("open", () => {
45587
+ const dest = fs3.createWriteStream(fullpath, this.options).on("error", (err2) => debug(err2)).on("close", () => debug("close", dest.path, dest.bytesWritten)).on("open", () => {
45588
45588
  debug("file open ok", fullpath);
45589
45589
  this.emit("open", fullpath);
45590
45590
  source.pipe(dest);
@@ -45663,7 +45663,7 @@ var require_file = __commonJS({
45663
45663
  const isZipped = this.zippedArchive ? ".gz" : "";
45664
45664
  const filePath = `${basename}${isOldest}${ext}${isZipped}`;
45665
45665
  const target = path4.join(this.dirname, filePath);
45666
- fs4.unlink(target, callback);
45666
+ fs3.unlink(target, callback);
45667
45667
  }
45668
45668
  /**
45669
45669
  * Roll files forward based on integer, up to maxFiles. e.g. if base if
@@ -45686,17 +45686,17 @@ var require_file = __commonJS({
45686
45686
  tasks.push(function(i, cb) {
45687
45687
  let fileName = `${basename}${i - 1}${ext}${isZipped}`;
45688
45688
  const tmppath = path4.join(this.dirname, fileName);
45689
- fs4.exists(tmppath, (exists) => {
45689
+ fs3.exists(tmppath, (exists) => {
45690
45690
  if (!exists) {
45691
45691
  return cb(null);
45692
45692
  }
45693
45693
  fileName = `${basename}${i}${ext}${isZipped}`;
45694
- fs4.rename(tmppath, path4.join(this.dirname, fileName), cb);
45694
+ fs3.rename(tmppath, path4.join(this.dirname, fileName), cb);
45695
45695
  });
45696
45696
  }.bind(this, x3));
45697
45697
  }
45698
45698
  asyncSeries(tasks, () => {
45699
- fs4.rename(
45699
+ fs3.rename(
45700
45700
  path4.join(this.dirname, `${basename}${ext}${isZipped}`),
45701
45701
  path4.join(this.dirname, `${basename}1${ext}${isZipped}`),
45702
45702
  callback
@@ -45712,22 +45712,22 @@ var require_file = __commonJS({
45712
45712
  * @private
45713
45713
  */
45714
45714
  _compressFile(src, dest, callback) {
45715
- fs4.access(src, fs4.F_OK, (err2) => {
45715
+ fs3.access(src, fs3.F_OK, (err2) => {
45716
45716
  if (err2) {
45717
45717
  return callback();
45718
45718
  }
45719
45719
  var gzip2 = zlib.createGzip();
45720
- var inp = fs4.createReadStream(src);
45721
- var out = fs4.createWriteStream(dest);
45720
+ var inp = fs3.createReadStream(src);
45721
+ var out = fs3.createWriteStream(dest);
45722
45722
  out.on("finish", () => {
45723
- fs4.unlink(src, callback);
45723
+ fs3.unlink(src, callback);
45724
45724
  });
45725
45725
  inp.pipe(gzip2).pipe(out);
45726
45726
  });
45727
45727
  }
45728
45728
  _createLogDirIfNotExist(dirPath) {
45729
- if (!fs4.existsSync(dirPath)) {
45730
- fs4.mkdirSync(dirPath, { recursive: true });
45729
+ if (!fs3.existsSync(dirPath)) {
45730
+ fs3.mkdirSync(dirPath, { recursive: true });
45731
45731
  }
45732
45732
  }
45733
45733
  };
@@ -48145,48 +48145,48 @@ var require_moment = __commonJS({
48145
48145
  return m3;
48146
48146
  }
48147
48147
  var momentProperties = hooks.momentProperties = [], updateInProgress = false;
48148
- function copyConfig(to2, from2) {
48148
+ function copyConfig(to3, from2) {
48149
48149
  var i, prop, val, momentPropertiesLen = momentProperties.length;
48150
48150
  if (!isUndefined(from2._isAMomentObject)) {
48151
- to2._isAMomentObject = from2._isAMomentObject;
48151
+ to3._isAMomentObject = from2._isAMomentObject;
48152
48152
  }
48153
48153
  if (!isUndefined(from2._i)) {
48154
- to2._i = from2._i;
48154
+ to3._i = from2._i;
48155
48155
  }
48156
48156
  if (!isUndefined(from2._f)) {
48157
- to2._f = from2._f;
48157
+ to3._f = from2._f;
48158
48158
  }
48159
48159
  if (!isUndefined(from2._l)) {
48160
- to2._l = from2._l;
48160
+ to3._l = from2._l;
48161
48161
  }
48162
48162
  if (!isUndefined(from2._strict)) {
48163
- to2._strict = from2._strict;
48163
+ to3._strict = from2._strict;
48164
48164
  }
48165
48165
  if (!isUndefined(from2._tzm)) {
48166
- to2._tzm = from2._tzm;
48166
+ to3._tzm = from2._tzm;
48167
48167
  }
48168
48168
  if (!isUndefined(from2._isUTC)) {
48169
- to2._isUTC = from2._isUTC;
48169
+ to3._isUTC = from2._isUTC;
48170
48170
  }
48171
48171
  if (!isUndefined(from2._offset)) {
48172
- to2._offset = from2._offset;
48172
+ to3._offset = from2._offset;
48173
48173
  }
48174
48174
  if (!isUndefined(from2._pf)) {
48175
- to2._pf = getParsingFlags(from2);
48175
+ to3._pf = getParsingFlags(from2);
48176
48176
  }
48177
48177
  if (!isUndefined(from2._locale)) {
48178
- to2._locale = from2._locale;
48178
+ to3._locale = from2._locale;
48179
48179
  }
48180
48180
  if (momentPropertiesLen > 0) {
48181
48181
  for (i = 0; i < momentPropertiesLen; i++) {
48182
48182
  prop = momentProperties[i];
48183
48183
  val = from2[prop];
48184
48184
  if (!isUndefined(val)) {
48185
- to2[prop] = val;
48185
+ to3[prop] = val;
48186
48186
  }
48187
48187
  }
48188
48188
  }
48189
- return to2;
48189
+ return to3;
48190
48190
  }
48191
48191
  function Moment(config) {
48192
48192
  copyConfig(this, config);
@@ -50693,8 +50693,8 @@ var require_moment = __commonJS({
50693
50693
  return this.clone().endOf(units).valueOf() < localInput.valueOf();
50694
50694
  }
50695
50695
  }
50696
- function isBetween(from2, to2, units, inclusivity) {
50697
- var localFrom = isMoment(from2) ? from2 : createLocal(from2), localTo = isMoment(to2) ? to2 : createLocal(to2);
50696
+ function isBetween(from2, to3, units, inclusivity) {
50697
+ var localFrom = isMoment(from2) ? from2 : createLocal(from2), localTo = isMoment(to3) ? to3 : createLocal(to3);
50698
50698
  if (!(this.isValid() && localFrom.isValid() && localTo.isValid())) {
50699
50699
  return false;
50700
50700
  }
@@ -50840,7 +50840,7 @@ var require_moment = __commonJS({
50840
50840
  function fromNow(withoutSuffix) {
50841
50841
  return this.from(createLocal(), withoutSuffix);
50842
50842
  }
50843
- function to(time, withoutSuffix) {
50843
+ function to2(time, withoutSuffix) {
50844
50844
  if (this.isValid() && (isMoment(time) && time.isValid() || createLocal(time).isValid())) {
50845
50845
  return createDuration({ from: this, to: time }).locale(this.locale()).humanize(!withoutSuffix);
50846
50846
  } else {
@@ -51449,7 +51449,7 @@ var require_moment = __commonJS({
51449
51449
  proto.format = format;
51450
51450
  proto.from = from;
51451
51451
  proto.fromNow = fromNow;
51452
- proto.to = to;
51452
+ proto.to = to2;
51453
51453
  proto.toNow = toNow;
51454
51454
  proto.get = stringGet;
51455
51455
  proto.invalidAt = invalidAt;
@@ -52011,7 +52011,7 @@ var require_moment = __commonJS({
52011
52011
  var require_FileStreamRotator = __commonJS({
52012
52012
  "../../node_modules/file-stream-rotator/FileStreamRotator.js"(exports2, module2) {
52013
52013
  "use strict";
52014
- var fs4 = require("fs");
52014
+ var fs3 = require("fs");
52015
52015
  var path4 = require("path");
52016
52016
  var moment = require_moment();
52017
52017
  var crypto2 = require("crypto");
@@ -52106,10 +52106,10 @@ var require_FileStreamRotator = __commonJS({
52106
52106
  try {
52107
52107
  if (audit_file) {
52108
52108
  var full_path = path4.resolve(audit_file);
52109
- _rtn = JSON.parse(fs4.readFileSync(full_path, { encoding: "utf-8" }));
52109
+ _rtn = JSON.parse(fs3.readFileSync(full_path, { encoding: "utf-8" }));
52110
52110
  } else {
52111
52111
  var full_path = path4.resolve(baseLog + "/.audit.json");
52112
- _rtn = JSON.parse(fs4.readFileSync(full_path, { encoding: "utf-8" }));
52112
+ _rtn = JSON.parse(fs3.readFileSync(full_path, { encoding: "utf-8" }));
52113
52113
  }
52114
52114
  } catch (e) {
52115
52115
  if (e.code !== "ENOENT") {
@@ -52135,7 +52135,7 @@ var require_FileStreamRotator = __commonJS({
52135
52135
  FileStreamRotator.writeAuditLog = function(audit, verbose) {
52136
52136
  try {
52137
52137
  mkDirForFile(audit.auditLog);
52138
- fs4.writeFileSync(audit.auditLog, JSON.stringify(audit, null, 4));
52138
+ fs3.writeFileSync(audit.auditLog, JSON.stringify(audit, null, 4));
52139
52139
  } catch (e) {
52140
52140
  if (verbose) {
52141
52141
  console.error(/* @__PURE__ */ new Date(), "[FileStreamRotator] Failed to store log audit at:", audit.auditLog, "Error:", e);
@@ -52145,8 +52145,8 @@ var require_FileStreamRotator = __commonJS({
52145
52145
  function removeFile(file, verbose) {
52146
52146
  if (file.hash === crypto2.createHash(file.hashType).update(file.name + "LOG_FILE" + file.date).digest("hex")) {
52147
52147
  try {
52148
- if (fs4.existsSync(file.name)) {
52149
- fs4.unlinkSync(file.name);
52148
+ if (fs3.existsSync(file.name)) {
52149
+ fs3.unlinkSync(file.name);
52150
52150
  }
52151
52151
  } catch (e) {
52152
52152
  if (verbose) {
@@ -52161,15 +52161,15 @@ var require_FileStreamRotator = __commonJS({
52161
52161
  let logfileName = path4.basename(logfile);
52162
52162
  let current = logPath + "/" + symLinkName;
52163
52163
  try {
52164
- let stats = fs4.lstatSync(current);
52164
+ let stats = fs3.lstatSync(current);
52165
52165
  if (stats.isSymbolicLink()) {
52166
- fs4.unlinkSync(current);
52167
- fs4.symlinkSync(logfileName, current);
52166
+ fs3.unlinkSync(current);
52167
+ fs3.symlinkSync(logfileName, current);
52168
52168
  }
52169
52169
  } catch (err2) {
52170
52170
  if (err2 && err2.code == "ENOENT") {
52171
52171
  try {
52172
- fs4.symlinkSync(logfileName, current);
52172
+ fs3.symlinkSync(logfileName, current);
52173
52173
  } catch (e) {
52174
52174
  if (verbose) {
52175
52175
  console.error(/* @__PURE__ */ new Date(), "[FileStreamRotator] Could not create symlink file: ", current, " -> ", logfileName);
@@ -52181,11 +52181,11 @@ var require_FileStreamRotator = __commonJS({
52181
52181
  function createLogWatcher(logfile, verbose, cb) {
52182
52182
  if (!logfile) return null;
52183
52183
  try {
52184
- let stats = fs4.lstatSync(logfile);
52185
- return fs4.watch(logfile, function(event, filename) {
52184
+ let stats = fs3.lstatSync(logfile);
52185
+ return fs3.watch(logfile, function(event, filename) {
52186
52186
  if (event == "rename") {
52187
52187
  try {
52188
- let stats2 = fs4.lstatSync(logfile);
52188
+ let stats2 = fs3.lstatSync(logfile);
52189
52189
  } catch (err2) {
52190
52190
  cb(err2, logfile);
52191
52191
  }
@@ -52301,13 +52301,13 @@ var require_FileStreamRotator = __commonJS({
52301
52301
  if (fileCount == 0 && t_log == logfile) {
52302
52302
  t_log += options.extension;
52303
52303
  }
52304
- while (f = fs4.existsSync(t_log)) {
52304
+ while (f = fs3.existsSync(t_log)) {
52305
52305
  lastLogFile = t_log;
52306
52306
  fileCount++;
52307
52307
  t_log = logfile + "." + fileCount + options.extension;
52308
52308
  }
52309
52309
  if (lastLogFile) {
52310
- var lastLogFileStats = fs4.statSync(lastLogFile);
52310
+ var lastLogFileStats = fs3.statSync(lastLogFile);
52311
52311
  if (lastLogFileStats.size < fileSize) {
52312
52312
  t_log = lastLogFile;
52313
52313
  fileCount--;
@@ -52323,7 +52323,7 @@ var require_FileStreamRotator = __commonJS({
52323
52323
  }
52324
52324
  mkDirForFile(logfile);
52325
52325
  var file_options = options.file_options || { flags: "a" };
52326
- var rotateStream = fs4.createWriteStream(logfile, file_options);
52326
+ var rotateStream = fs3.createWriteStream(logfile, file_options);
52327
52327
  if (curDate && frequencyMetaData && staticFrequency.indexOf(frequencyMetaData.type) > -1 || fileSize > 0) {
52328
52328
  if (self2.verbose) {
52329
52329
  console.log(/* @__PURE__ */ new Date(), "[FileStreamRotator] Rotating file: ", frequencyMetaData ? frequencyMetaData.type : "", fileSize ? "size: " + fileSize : "");
@@ -52362,12 +52362,12 @@ var require_FileStreamRotator = __commonJS({
52362
52362
  });
52363
52363
  stream.on("createLog", function(file) {
52364
52364
  try {
52365
- let stats = fs4.lstatSync(file);
52365
+ let stats = fs3.lstatSync(file);
52366
52366
  } catch (err2) {
52367
52367
  if (rotateStream && rotateStream.end == "function") {
52368
52368
  rotateStream.end();
52369
52369
  }
52370
- rotateStream = fs4.createWriteStream(file, file_options);
52370
+ rotateStream = fs3.createWriteStream(file, file_options);
52371
52371
  stream.emit("new", file);
52372
52372
  BubbleEvents(rotateStream, stream);
52373
52373
  }
@@ -52399,7 +52399,7 @@ var require_FileStreamRotator = __commonJS({
52399
52399
  rotateStream.destroy();
52400
52400
  }
52401
52401
  mkDirForFile(logfile);
52402
- rotateStream = fs4.createWriteStream(newLogfile, file_options);
52402
+ rotateStream = fs3.createWriteStream(newLogfile, file_options);
52403
52403
  stream.emit("new", newLogfile);
52404
52404
  stream.emit("rotate", oldFile, newLogfile);
52405
52405
  BubbleEvents(rotateStream, stream);
@@ -52427,9 +52427,9 @@ var require_FileStreamRotator = __commonJS({
52427
52427
  _path.split(path4.sep).reduce(
52428
52428
  function(fullPath, folder) {
52429
52429
  fullPath += folder + path4.sep;
52430
- if (!fs4.existsSync(fullPath)) {
52430
+ if (!fs3.existsSync(fullPath)) {
52431
52431
  try {
52432
- fs4.mkdirSync(fullPath);
52432
+ fs3.mkdirSync(fullPath);
52433
52433
  } catch (e) {
52434
52434
  if (e.code !== "EEXIST") {
52435
52435
  throw e;
@@ -52462,7 +52462,7 @@ var require_FileStreamRotator = __commonJS({
52462
52462
  var require_daily_rotate_file = __commonJS({
52463
52463
  "../../node_modules/winston-daily-rotate-file/daily-rotate-file.js"(exports2, module2) {
52464
52464
  "use strict";
52465
- var fs4 = require("fs");
52465
+ var fs3 = require("fs");
52466
52466
  var os = require("os");
52467
52467
  var path4 = require("path");
52468
52468
  var util = require("util");
@@ -52554,7 +52554,7 @@ var require_daily_rotate_file = __commonJS({
52554
52554
  if (options.zippedArchive) {
52555
52555
  const gzName = params.name + ".gz";
52556
52556
  try {
52557
- fs4.unlinkSync(gzName);
52557
+ fs3.unlinkSync(gzName);
52558
52558
  } catch (err2) {
52559
52559
  if (err2.code !== "ENOENT") {
52560
52560
  err2.message = `Error occurred while removing ${gzName}: ${err2.message}`;
@@ -52570,7 +52570,7 @@ var require_daily_rotate_file = __commonJS({
52570
52570
  if (options.zippedArchive) {
52571
52571
  this.logStream.on("rotate", (oldFile) => {
52572
52572
  try {
52573
- if (!fs4.existsSync(oldFile)) {
52573
+ if (!fs3.existsSync(oldFile)) {
52574
52574
  return;
52575
52575
  }
52576
52576
  } catch (err2) {
@@ -52579,7 +52579,7 @@ var require_daily_rotate_file = __commonJS({
52579
52579
  return;
52580
52580
  }
52581
52581
  try {
52582
- if (fs4.existsSync(`${oldFile}.gz`)) {
52582
+ if (fs3.existsSync(`${oldFile}.gz`)) {
52583
52583
  return;
52584
52584
  }
52585
52585
  } catch (err2) {
@@ -52588,19 +52588,19 @@ var require_daily_rotate_file = __commonJS({
52588
52588
  return;
52589
52589
  }
52590
52590
  const gzip2 = zlib.createGzip();
52591
- const inp = fs4.createReadStream(oldFile);
52591
+ const inp = fs3.createReadStream(oldFile);
52592
52592
  inp.on("error", (err2) => {
52593
52593
  err2.message = `Error occurred while reading ${oldFile}: ${err2.message}`;
52594
52594
  this.emit("error", err2);
52595
52595
  });
52596
- const out = fs4.createWriteStream(oldFile + ".gz");
52596
+ const out = fs3.createWriteStream(oldFile + ".gz");
52597
52597
  out.on("error", (err2) => {
52598
52598
  err2.message = `Error occurred while writing ${oldFile}.gz: ${err2.message}`;
52599
52599
  this.emit("error", err2);
52600
52600
  });
52601
52601
  inp.pipe(gzip2).pipe(out).on("finish", () => {
52602
52602
  try {
52603
- fs4.unlinkSync(oldFile);
52603
+ fs3.unlinkSync(oldFile);
52604
52604
  } catch (err2) {
52605
52605
  if (err2.code !== "ENOENT") {
52606
52606
  err2.message = `Error occurred while removing ${oldFile}: ${err2.message}`;
@@ -52665,7 +52665,7 @@ var require_daily_rotate_file = __commonJS({
52665
52665
  options.order = options.order || "desc";
52666
52666
  const logFiles = (() => {
52667
52667
  const fileRegex = new RegExp(this.filename.replace("%DATE%", ".*"), "i");
52668
- return fs4.readdirSync(this.dirname).filter((file) => path4.basename(file).match(fileRegex));
52668
+ return fs3.readdirSync(this.dirname).filter((file) => path4.basename(file).match(fileRegex));
52669
52669
  })();
52670
52670
  if (logFiles.length === 0 && callback) {
52671
52671
  callback(null, results);
@@ -52679,14 +52679,14 @@ var require_daily_rotate_file = __commonJS({
52679
52679
  let stream;
52680
52680
  if (file.endsWith(".gz")) {
52681
52681
  stream = new PassThrough();
52682
- const inp = fs4.createReadStream(logFile);
52682
+ const inp = fs3.createReadStream(logFile);
52683
52683
  inp.on("error", (err2) => {
52684
52684
  err2.message = `Error occurred while reading ${logFile}: ${err2.message}`;
52685
52685
  stream.emit("error", err2);
52686
52686
  });
52687
52687
  inp.pipe(zlib.createGunzip()).pipe(stream);
52688
52688
  } else {
52689
- stream = fs4.createReadStream(logFile, {
52689
+ stream = fs3.createReadStream(logFile, {
52690
52690
  encoding: "utf8"
52691
52691
  });
52692
52692
  }
@@ -52779,9 +52779,9 @@ __export(main_exports, {
52779
52779
  module.exports = __toCommonJS(main_exports);
52780
52780
 
52781
52781
  // ../core/dist/esm/index.mjs
52782
- var fs2 = Object.defineProperty;
52783
- var ms = (t6, e, r) => e in t6 ? fs2(t6, e, { enumerable: true, configurable: true, writable: true, value: r }) : t6[e] = r;
52784
- var c = (t6, e, r) => ms(t6, typeof e != "symbol" ? e + "" : e, r);
52782
+ var ms = Object.defineProperty;
52783
+ var hs = (t6, e, r) => e in t6 ? ms(t6, e, { enumerable: true, configurable: true, writable: true, value: r }) : t6[e] = r;
52784
+ var c = (t6, e, r) => hs(t6, typeof e != "symbol" ? e + "" : e, r);
52785
52785
  var Z = class {
52786
52786
  constructor(e = 10) {
52787
52787
  c(this, "max");
@@ -52808,7 +52808,7 @@ var Z = class {
52808
52808
  return this.cache.keys().next().value;
52809
52809
  }
52810
52810
  };
52811
- var Et = class {
52811
+ var Pt = class {
52812
52812
  constructor(e, r) {
52813
52813
  c(this, "operator");
52814
52814
  c(this, "child");
@@ -52829,7 +52829,7 @@ var A = class {
52829
52829
  return `(${this.left.toString()} ${this.operator} ${this.right.toString()})`;
52830
52830
  }
52831
52831
  };
52832
- var Rt = class {
52832
+ var Ct = class {
52833
52833
  constructor() {
52834
52834
  c(this, "prefixParselets", {});
52835
52835
  c(this, "infixParselets", {});
@@ -52853,10 +52853,10 @@ var Rt = class {
52853
52853
  }, precedence: r });
52854
52854
  }
52855
52855
  construct(e) {
52856
- return new Ar(e, this.prefixParselets, this.infixParselets);
52856
+ return new wr(e, this.prefixParselets, this.infixParselets);
52857
52857
  }
52858
52858
  };
52859
- var Ar = class {
52859
+ var wr = class {
52860
52860
  constructor(e, r, n) {
52861
52861
  c(this, "tokens");
52862
52862
  c(this, "prefixParselets");
@@ -52910,101 +52910,101 @@ var Ar = class {
52910
52910
  function ce(t6) {
52911
52911
  if (t6 !== void 0) return Array.isArray(t6) ? t6 : [t6];
52912
52912
  }
52913
- var Pt = "http://hl7.org";
52914
- var Ct = "ok";
52915
- var At = "created";
52916
- var Or = "not-modified";
52917
- var kr = "not-found";
52918
- var Dr = "unauthorized";
52919
- var wt = "accepted";
52920
- var ci = { resourceType: "OperationOutcome", id: kr, issue: [{ severity: "error", code: "not-found", details: { text: "Not found" } }] };
52921
- var Qe = { resourceType: "OperationOutcome", id: Dr, issue: [{ severity: "error", code: "login", details: { text: "Unauthorized" } }] };
52922
- var ui = { ...Qe, issue: [...Qe.issue, { severity: "error", code: "expired", details: { text: "Token expired" } }] };
52923
- var Mr = { ...Qe, issue: [...Qe.issue, { severity: "error", code: "invalid", details: { text: "Token not issued for this audience" } }] };
52913
+ var At = "http://hl7.org";
52914
+ var wt = "ok";
52915
+ var Ot = "created";
52916
+ var Ir = "not-modified";
52917
+ var Vr = "not-found";
52918
+ var Mr = "unauthorized";
52919
+ var It = "accepted";
52920
+ var ui = { resourceType: "OperationOutcome", id: Vr, issue: [{ severity: "error", code: "not-found", details: { text: "Not found" } }] };
52921
+ var Qe = { resourceType: "OperationOutcome", id: Mr, issue: [{ severity: "error", code: "login", details: { text: "Unauthorized" } }] };
52922
+ var li = { ...Qe, issue: [...Qe.issue, { severity: "error", code: "expired", details: { text: "Token expired" } }] };
52923
+ var _r = { ...Qe, issue: [...Qe.issue, { severity: "error", code: "invalid", details: { text: "Token not issued for this audience" } }] };
52924
52924
  function w(t6, e) {
52925
52925
  return { resourceType: "OperationOutcome", issue: [{ severity: "error", code: "invalid", details: { text: t6 }, ...e ? { expression: ce(e) } : void 0 }] };
52926
52926
  }
52927
52927
  function T(t6, e, r, n) {
52928
52928
  return { resourceType: "OperationOutcome", issue: [{ severity: "error", code: r ?? "structure", details: { text: t6 }, ...e ? { expression: e } : void 0, ...n ? { diagnostics: n } : void 0 }] };
52929
52929
  }
52930
- function _r(t6) {
52930
+ function Lr(t6) {
52931
52931
  return !t6 || typeof t6 != "object" ? false : t6 instanceof Error || typeof DOMException < "u" && t6 instanceof DOMException ? true : Object.prototype.toString.call(t6) === "[object Error]";
52932
52932
  }
52933
- function ot(t6) {
52933
+ function st(t6) {
52934
52934
  return typeof t6 == "object" && t6 !== null && t6.resourceType === "OperationOutcome";
52935
52935
  }
52936
- function Lr(t6) {
52937
- return t6.id === Ct || t6.id === At || t6.id === Or || t6.id === wt;
52936
+ function Nr(t6) {
52937
+ return t6.id === wt || t6.id === Ot || t6.id === Ir || t6.id === It;
52938
52938
  }
52939
52939
  var m = class extends Error {
52940
52940
  constructor(r, n) {
52941
- super(li(r), n);
52941
+ super(di(r), n);
52942
52942
  c(this, "outcome");
52943
52943
  this.name = "OperationOutcomeError", this.outcome = r;
52944
52944
  }
52945
52945
  };
52946
- function Ot(t6) {
52947
- return t6 instanceof m ? t6.outcome : ot(t6) ? t6 : w(Ie(t6));
52946
+ function kt(t6) {
52947
+ return t6 instanceof m ? t6.outcome : st(t6) ? t6 : w(Ie(t6));
52948
52948
  }
52949
52949
  function Ie(t6) {
52950
- return t6 ? typeof t6 == "string" ? t6 : _r(t6) ? t6.message : ot(t6) ? li(t6) : typeof t6 == "object" && "code" in t6 && typeof t6.code == "string" ? t6.code : JSON.stringify(t6) : "Unknown error";
52950
+ return t6 ? typeof t6 == "string" ? t6 : Lr(t6) ? t6.message : st(t6) ? di(t6) : typeof t6 == "object" && "code" in t6 && typeof t6.code == "string" ? t6.code : JSON.stringify(t6) : "Unknown error";
52951
52951
  }
52952
- function li(t6) {
52953
- let e = t6.issue?.map(gs) ?? [];
52952
+ function di(t6) {
52953
+ let e = t6.issue?.map(ys) ?? [];
52954
52954
  return e.length > 0 ? e.join("; ") : "Unknown error";
52955
52955
  }
52956
- function gs(t6) {
52956
+ function ys(t6) {
52957
52957
  let e;
52958
52958
  return t6.details?.text ? t6.diagnostics ? e = `${t6.details.text} (${t6.diagnostics})` : e = t6.details.text : t6.diagnostics ? e = t6.diagnostics : e = "Unknown error", t6.expression?.length && (e += ` (${t6.expression.join(", ")})`), e;
52959
52959
  }
52960
- function xs(t6, e) {
52960
+ function vs(t6, e) {
52961
52961
  let r = e.max && e.max === Number.MAX_SAFE_INTEGER ? Number.POSITIVE_INFINITY : e.max;
52962
52962
  return { path: t6, description: "", type: e.type ?? [], min: e.min ?? 0, max: r ?? 1, isArray: !!r && r > 1, constraints: [] };
52963
52963
  }
52964
- function fi(t6) {
52964
+ function mi(t6) {
52965
52965
  let e = /* @__PURE__ */ Object.create(null);
52966
- for (let [r, n] of Object.entries(t6)) e[r] = { name: r, type: r, path: r, elements: Object.fromEntries(Object.entries(n.elements).map(([i, o2]) => [i, xs(i, o2)])), constraints: [], innerTypes: [] };
52966
+ for (let [r, n] of Object.entries(t6)) e[r] = { name: r, type: r, path: r, elements: Object.fromEntries(Object.entries(n.elements).map(([i, o2]) => [i, vs(i, o2)])), constraints: [], innerTypes: [] };
52967
52967
  return e;
52968
52968
  }
52969
- var mi = { Element: { elements: { id: { type: [{ code: "string" }] }, extension: { max: 9007199254740991, type: [{ code: "Extension" }] } } }, BackboneElement: { elements: { id: { type: [{ code: "string" }] }, extension: { max: 9007199254740991, type: [{ code: "Extension" }] }, modifierExtension: { max: 9007199254740991, type: [{ code: "Extension" }] } } }, Address: { elements: { id: { type: [{ code: "string" }] }, extension: { max: 9007199254740991, type: [{ code: "Extension" }] }, use: { type: [{ code: "code" }] }, type: { type: [{ code: "code" }] }, text: { type: [{ code: "string" }] }, line: { max: 9007199254740991, type: [{ code: "string" }] }, city: { type: [{ code: "string" }] }, district: { type: [{ code: "string" }] }, state: { type: [{ code: "string" }] }, postalCode: { type: [{ code: "string" }] }, country: { type: [{ code: "string" }] }, period: { type: [{ code: "Period" }] } } }, Age: { elements: { id: { type: [{ code: "string" }] }, extension: { max: 9007199254740991, type: [{ code: "Extension" }] }, value: { type: [{ code: "decimal" }] }, comparator: { type: [{ code: "code" }] }, unit: { type: [{ code: "string" }] }, system: { type: [{ code: "uri" }] }, code: { type: [{ code: "code" }] } } }, Annotation: { elements: { id: { type: [{ code: "string" }] }, extension: { max: 9007199254740991, type: [{ code: "Extension" }] }, "author[x]": { type: [{ code: "Reference", targetProfile: ["http://hl7.org/fhir/StructureDefinition/Practitioner", "http://hl7.org/fhir/StructureDefinition/Patient", "http://hl7.org/fhir/StructureDefinition/RelatedPerson", "http://hl7.org/fhir/StructureDefinition/Organization"] }, { code: "string" }] }, time: { type: [{ code: "dateTime" }] }, text: { min: 1, type: [{ code: "markdown" }] } } }, Attachment: { elements: { id: { type: [{ code: "string" }] }, extension: { max: 9007199254740991, type: [{ code: "Extension" }] }, contentType: { type: [{ code: "code" }] }, language: { type: [{ code: "code" }] }, data: { type: [{ code: "base64Binary" }] }, url: { type: [{ code: "url" }] }, size: { type: [{ code: "unsignedInt" }] }, hash: { type: [{ code: "base64Binary" }] }, title: { type: [{ code: "string" }] }, creation: { type: [{ code: "dateTime" }] } } }, CodeableConcept: { elements: { id: { type: [{ code: "string" }] }, extension: { max: 9007199254740991, type: [{ code: "Extension" }] }, coding: { max: 9007199254740991, type: [{ code: "Coding" }] }, text: { type: [{ code: "string" }] } } }, Coding: { elements: { id: { type: [{ code: "string" }] }, extension: { max: 9007199254740991, type: [{ code: "Extension" }] }, system: { type: [{ code: "uri" }] }, version: { type: [{ code: "string" }] }, code: { type: [{ code: "code" }] }, display: { type: [{ code: "string" }] }, userSelected: { type: [{ code: "boolean" }] } } }, ContactDetail: { elements: { id: { type: [{ code: "string" }] }, extension: { max: 9007199254740991, type: [{ code: "Extension" }] }, name: { type: [{ code: "string" }] }, telecom: { max: 9007199254740991, type: [{ code: "ContactPoint" }] } } }, ContactPoint: { elements: { id: { type: [{ code: "string" }] }, extension: { max: 9007199254740991, type: [{ code: "Extension" }] }, system: { type: [{ code: "code" }] }, value: { type: [{ code: "string" }] }, use: { type: [{ code: "code" }] }, rank: { type: [{ code: "positiveInt" }] }, period: { type: [{ code: "Period" }] } } }, Contributor: { elements: { id: { type: [{ code: "string" }] }, extension: { max: 9007199254740991, type: [{ code: "Extension" }] }, type: { min: 1, type: [{ code: "code" }] }, name: { min: 1, type: [{ code: "string" }] }, contact: { max: 9007199254740991, type: [{ code: "ContactDetail" }] } } }, Count: { elements: { id: { type: [{ code: "string" }] }, extension: { max: 9007199254740991, type: [{ code: "Extension" }] }, value: { type: [{ code: "decimal" }] }, comparator: { type: [{ code: "code" }] }, unit: { type: [{ code: "string" }] }, system: { type: [{ code: "uri" }] }, code: { type: [{ code: "code" }] } } }, DataRequirement: { elements: { id: { type: [{ code: "string" }] }, extension: { max: 9007199254740991, type: [{ code: "Extension" }] }, type: { min: 1, type: [{ code: "code" }] }, profile: { max: 9007199254740991, type: [{ code: "canonical", targetProfile: ["http://hl7.org/fhir/StructureDefinition/StructureDefinition"] }] }, "subject[x]": { type: [{ code: "CodeableConcept" }, { code: "Reference", targetProfile: ["http://hl7.org/fhir/StructureDefinition/Group"] }] }, mustSupport: { max: 9007199254740991, type: [{ code: "string" }] }, codeFilter: { max: 9007199254740991, type: [{ code: "DataRequirementCodeFilter" }] }, dateFilter: { max: 9007199254740991, type: [{ code: "DataRequirementDateFilter" }] }, limit: { type: [{ code: "positiveInt" }] }, sort: { max: 9007199254740991, type: [{ code: "DataRequirementSort" }] } } }, DataRequirementCodeFilter: { elements: { id: { type: [{ code: "string" }] }, extension: { max: 9007199254740991, type: [{ code: "Extension" }] }, path: { type: [{ code: "string" }] }, searchParam: { type: [{ code: "string" }] }, valueSet: { type: [{ code: "canonical", targetProfile: ["http://hl7.org/fhir/StructureDefinition/ValueSet"] }] }, code: { max: 9007199254740991, type: [{ code: "Coding" }] } } }, DataRequirementDateFilter: { elements: { id: { type: [{ code: "string" }] }, extension: { max: 9007199254740991, type: [{ code: "Extension" }] }, path: { type: [{ code: "string" }] }, searchParam: { type: [{ code: "string" }] }, "value[x]": { type: [{ code: "dateTime" }, { code: "Period" }, { code: "Duration" }] } } }, DataRequirementSort: { elements: { id: { type: [{ code: "string" }] }, extension: { max: 9007199254740991, type: [{ code: "Extension" }] }, path: { min: 1, type: [{ code: "string" }] }, direction: { min: 1, type: [{ code: "code" }] } } }, Distance: { elements: { id: { type: [{ code: "string" }] }, extension: { max: 9007199254740991, type: [{ code: "Extension" }] }, value: { type: [{ code: "decimal" }] }, comparator: { type: [{ code: "code" }] }, unit: { type: [{ code: "string" }] }, system: { type: [{ code: "uri" }] }, code: { type: [{ code: "code" }] } } }, Dosage: { elements: { id: { type: [{ code: "string" }] }, extension: { max: 9007199254740991, type: [{ code: "Extension" }] }, modifierExtension: { max: 9007199254740991, type: [{ code: "Extension" }] }, sequence: { type: [{ code: "integer" }] }, text: { type: [{ code: "string" }] }, additionalInstruction: { max: 9007199254740991, type: [{ code: "CodeableConcept" }] }, patientInstruction: { type: [{ code: "string" }] }, timing: { type: [{ code: "Timing" }] }, "asNeeded[x]": { type: [{ code: "boolean" }, { code: "CodeableConcept" }] }, site: { type: [{ code: "CodeableConcept" }] }, route: { type: [{ code: "CodeableConcept" }] }, method: { type: [{ code: "CodeableConcept" }] }, doseAndRate: { max: 9007199254740991, type: [{ code: "DosageDoseAndRate" }] }, maxDosePerPeriod: { type: [{ code: "Ratio" }] }, maxDosePerAdministration: { type: [{ code: "Quantity", profile: ["http://hl7.org/fhir/StructureDefinition/SimpleQuantity"] }] }, maxDosePerLifetime: { type: [{ code: "Quantity", profile: ["http://hl7.org/fhir/StructureDefinition/SimpleQuantity"] }] } } }, DosageDoseAndRate: { elements: { id: { type: [{ code: "string" }] }, extension: { max: 9007199254740991, type: [{ code: "Extension" }] }, type: { type: [{ code: "CodeableConcept" }] }, "dose[x]": { type: [{ code: "Range" }, { code: "Quantity", profile: ["http://hl7.org/fhir/StructureDefinition/SimpleQuantity"] }] }, "rate[x]": { type: [{ code: "Ratio" }, { code: "Range" }, { code: "Quantity", profile: ["http://hl7.org/fhir/StructureDefinition/SimpleQuantity"] }] } } }, Duration: { elements: { id: { type: [{ code: "string" }] }, extension: { max: 9007199254740991, type: [{ code: "Extension" }] }, value: { type: [{ code: "decimal" }] }, comparator: { type: [{ code: "code" }] }, unit: { type: [{ code: "string" }] }, system: { type: [{ code: "uri" }] }, code: { type: [{ code: "code" }] } } }, ElementDefinition: { elements: { id: { type: [{ code: "string" }] }, extension: { max: 9007199254740991, type: [{ code: "Extension" }] }, modifierExtension: { max: 9007199254740991, type: [{ code: "Extension" }] }, path: { min: 1, type: [{ code: "string" }] }, representation: { max: 9007199254740991, type: [{ code: "code" }] }, sliceName: { type: [{ code: "string" }] }, sliceIsConstraining: { type: [{ code: "boolean" }] }, label: { type: [{ code: "string" }] }, code: { max: 9007199254740991, type: [{ code: "Coding" }] }, slicing: { type: [{ code: "ElementDefinitionSlicing" }] }, short: { type: [{ code: "string" }] }, definition: { type: [{ code: "markdown" }] }, comment: { type: [{ code: "markdown" }] }, requirements: { type: [{ code: "markdown" }] }, alias: { max: 9007199254740991, type: [{ code: "string" }] }, min: { type: [{ code: "unsignedInt" }] }, max: { type: [{ code: "string" }] }, base: { type: [{ code: "ElementDefinitionBase" }] }, contentReference: { type: [{ code: "uri" }] }, type: { max: 9007199254740991, type: [{ code: "ElementDefinitionType" }] }, "defaultValue[x]": { type: [{ code: "base64Binary" }, { code: "boolean" }, { code: "canonical" }, { code: "code" }, { code: "date" }, { code: "dateTime" }, { code: "decimal" }, { code: "id" }, { code: "instant" }, { code: "integer" }, { code: "markdown" }, { code: "oid" }, { code: "positiveInt" }, { code: "string" }, { code: "time" }, { code: "unsignedInt" }, { code: "uri" }, { code: "url" }, { code: "uuid" }, { code: "Address" }, { code: "Age" }, { code: "Annotation" }, { code: "Attachment" }, { code: "CodeableConcept" }, { code: "Coding" }, { code: "ContactPoint" }, { code: "Count" }, { code: "Distance" }, { code: "Duration" }, { code: "HumanName" }, { code: "Identifier" }, { code: "Money" }, { code: "Period" }, { code: "Quantity" }, { code: "Range" }, { code: "Ratio" }, { code: "Reference" }, { code: "SampledData" }, { code: "Signature" }, { code: "Timing" }, { code: "ContactDetail" }, { code: "Contributor" }, { code: "DataRequirement" }, { code: "Expression" }, { code: "ParameterDefinition" }, { code: "RelatedArtifact" }, { code: "TriggerDefinition" }, { code: "UsageContext" }, { code: "Dosage" }, { code: "Meta" }] }, meaningWhenMissing: { type: [{ code: "markdown" }] }, orderMeaning: { type: [{ code: "string" }] }, "fixed[x]": { type: [{ code: "base64Binary" }, { code: "boolean" }, { code: "canonical" }, { code: "code" }, { code: "date" }, { code: "dateTime" }, { code: "decimal" }, { code: "id" }, { code: "instant" }, { code: "integer" }, { code: "markdown" }, { code: "oid" }, { code: "positiveInt" }, { code: "string" }, { code: "time" }, { code: "unsignedInt" }, { code: "uri" }, { code: "url" }, { code: "uuid" }, { code: "Address" }, { code: "Age" }, { code: "Annotation" }, { code: "Attachment" }, { code: "CodeableConcept" }, { code: "Coding" }, { code: "ContactPoint" }, { code: "Count" }, { code: "Distance" }, { code: "Duration" }, { code: "HumanName" }, { code: "Identifier" }, { code: "Money" }, { code: "Period" }, { code: "Quantity" }, { code: "Range" }, { code: "Ratio" }, { code: "Reference" }, { code: "SampledData" }, { code: "Signature" }, { code: "Timing" }, { code: "ContactDetail" }, { code: "Contributor" }, { code: "DataRequirement" }, { code: "Expression" }, { code: "ParameterDefinition" }, { code: "RelatedArtifact" }, { code: "TriggerDefinition" }, { code: "UsageContext" }, { code: "Dosage" }, { code: "Meta" }] }, "pattern[x]": { type: [{ code: "base64Binary" }, { code: "boolean" }, { code: "canonical" }, { code: "code" }, { code: "date" }, { code: "dateTime" }, { code: "decimal" }, { code: "id" }, { code: "instant" }, { code: "integer" }, { code: "markdown" }, { code: "oid" }, { code: "positiveInt" }, { code: "string" }, { code: "time" }, { code: "unsignedInt" }, { code: "uri" }, { code: "url" }, { code: "uuid" }, { code: "Address" }, { code: "Age" }, { code: "Annotation" }, { code: "Attachment" }, { code: "CodeableConcept" }, { code: "Coding" }, { code: "ContactPoint" }, { code: "Count" }, { code: "Distance" }, { code: "Duration" }, { code: "HumanName" }, { code: "Identifier" }, { code: "Money" }, { code: "Period" }, { code: "Quantity" }, { code: "Range" }, { code: "Ratio" }, { code: "Reference" }, { code: "SampledData" }, { code: "Signature" }, { code: "Timing" }, { code: "ContactDetail" }, { code: "Contributor" }, { code: "DataRequirement" }, { code: "Expression" }, { code: "ParameterDefinition" }, { code: "RelatedArtifact" }, { code: "TriggerDefinition" }, { code: "UsageContext" }, { code: "Dosage" }, { code: "Meta" }] }, example: { max: 9007199254740991, type: [{ code: "ElementDefinitionExample" }] }, "minValue[x]": { type: [{ code: "date" }, { code: "dateTime" }, { code: "instant" }, { code: "time" }, { code: "decimal" }, { code: "integer" }, { code: "positiveInt" }, { code: "unsignedInt" }, { code: "Quantity" }] }, "maxValue[x]": { type: [{ code: "date" }, { code: "dateTime" }, { code: "instant" }, { code: "time" }, { code: "decimal" }, { code: "integer" }, { code: "positiveInt" }, { code: "unsignedInt" }, { code: "Quantity" }] }, maxLength: { type: [{ code: "integer" }] }, condition: { max: 9007199254740991, type: [{ code: "id" }] }, constraint: { max: 9007199254740991, type: [{ code: "ElementDefinitionConstraint" }] }, mustSupport: { type: [{ code: "boolean" }] }, isModifier: { type: [{ code: "boolean" }] }, isModifierReason: { type: [{ code: "string" }] }, isSummary: { type: [{ code: "boolean" }] }, binding: { type: [{ code: "ElementDefinitionBinding" }] }, mapping: { max: 9007199254740991, type: [{ code: "ElementDefinitionMapping" }] } } }, ElementDefinitionSlicingDiscriminator: { elements: { id: { type: [{ code: "string" }] }, extension: { max: 9007199254740991, type: [{ code: "Extension" }] }, type: { min: 1, type: [{ code: "code" }] }, path: { min: 1, type: [{ code: "string" }] } } }, ElementDefinitionSlicing: { elements: { id: { type: [{ code: "string" }] }, extension: { max: 9007199254740991, type: [{ code: "Extension" }] }, discriminator: { max: 9007199254740991, type: [{ code: "ElementDefinitionSlicingDiscriminator" }] }, description: { type: [{ code: "string" }] }, ordered: { type: [{ code: "boolean" }] }, rules: { min: 1, type: [{ code: "code" }] } } }, ElementDefinitionBase: { elements: { id: { type: [{ code: "string" }] }, extension: { max: 9007199254740991, type: [{ code: "Extension" }] }, path: { min: 1, type: [{ code: "string" }] }, min: { min: 1, type: [{ code: "unsignedInt" }] }, max: { min: 1, type: [{ code: "string" }] } } }, ElementDefinitionType: { elements: { id: { type: [{ code: "string" }] }, extension: { max: 9007199254740991, type: [{ code: "Extension" }] }, code: { min: 1, type: [{ code: "uri" }] }, profile: { max: 9007199254740991, type: [{ code: "canonical", targetProfile: ["http://hl7.org/fhir/StructureDefinition/StructureDefinition", "http://hl7.org/fhir/StructureDefinition/ImplementationGuide"] }] }, targetProfile: { max: 9007199254740991, type: [{ code: "canonical", targetProfile: ["http://hl7.org/fhir/StructureDefinition/StructureDefinition", "http://hl7.org/fhir/StructureDefinition/ImplementationGuide"] }] }, aggregation: { max: 9007199254740991, type: [{ code: "code" }] }, versioning: { type: [{ code: "code" }] } } }, ElementDefinitionExample: { elements: { id: { type: [{ code: "string" }] }, extension: { max: 9007199254740991, type: [{ code: "Extension" }] }, label: { min: 1, type: [{ code: "string" }] }, "value[x]": { min: 1, type: [{ code: "base64Binary" }, { code: "boolean" }, { code: "canonical" }, { code: "code" }, { code: "date" }, { code: "dateTime" }, { code: "decimal" }, { code: "id" }, { code: "instant" }, { code: "integer" }, { code: "markdown" }, { code: "oid" }, { code: "positiveInt" }, { code: "string" }, { code: "time" }, { code: "unsignedInt" }, { code: "uri" }, { code: "url" }, { code: "uuid" }, { code: "Address" }, { code: "Age" }, { code: "Annotation" }, { code: "Attachment" }, { code: "CodeableConcept" }, { code: "Coding" }, { code: "ContactPoint" }, { code: "Count" }, { code: "Distance" }, { code: "Duration" }, { code: "HumanName" }, { code: "Identifier" }, { code: "Money" }, { code: "Period" }, { code: "Quantity" }, { code: "Range" }, { code: "Ratio" }, { code: "Reference" }, { code: "SampledData" }, { code: "Signature" }, { code: "Timing" }, { code: "ContactDetail" }, { code: "Contributor" }, { code: "DataRequirement" }, { code: "Expression" }, { code: "ParameterDefinition" }, { code: "RelatedArtifact" }, { code: "TriggerDefinition" }, { code: "UsageContext" }, { code: "Dosage" }, { code: "Meta" }] } } }, ElementDefinitionConstraint: { elements: { id: { type: [{ code: "string" }] }, extension: { max: 9007199254740991, type: [{ code: "Extension" }] }, key: { min: 1, type: [{ code: "id" }] }, requirements: { type: [{ code: "string" }] }, severity: { min: 1, type: [{ code: "code" }] }, human: { min: 1, type: [{ code: "string" }] }, expression: { type: [{ code: "string" }] }, xpath: { type: [{ code: "string" }] }, source: { type: [{ code: "canonical", targetProfile: ["http://hl7.org/fhir/StructureDefinition/StructureDefinition"] }] } } }, ElementDefinitionBinding: { elements: { id: { type: [{ code: "string" }] }, extension: { max: 9007199254740991, type: [{ code: "Extension" }] }, strength: { min: 1, type: [{ code: "code" }] }, description: { type: [{ code: "string" }] }, valueSet: { type: [{ code: "canonical", targetProfile: ["http://hl7.org/fhir/StructureDefinition/ValueSet"] }] } } }, ElementDefinitionMapping: { elements: { id: { type: [{ code: "string" }] }, extension: { max: 9007199254740991, type: [{ code: "Extension" }] }, identity: { min: 1, type: [{ code: "id" }] }, language: { type: [{ code: "code" }] }, map: { min: 1, type: [{ code: "string" }] }, comment: { type: [{ code: "string" }] } } }, Expression: { elements: { id: { type: [{ code: "string" }] }, extension: { max: 9007199254740991, type: [{ code: "Extension" }] }, description: { type: [{ code: "string" }] }, name: { type: [{ code: "id" }] }, language: { min: 1, type: [{ code: "code" }] }, expression: { type: [{ code: "string" }] }, reference: { type: [{ code: "uri" }] } } }, Extension: { elements: { id: { type: [{ code: "string" }] }, extension: { max: 9007199254740991, type: [{ code: "Extension" }] }, url: { min: 1, type: [{ code: "uri" }] }, "value[x]": { type: [{ code: "base64Binary" }, { code: "boolean" }, { code: "canonical" }, { code: "code" }, { code: "date" }, { code: "dateTime" }, { code: "decimal" }, { code: "id" }, { code: "instant" }, { code: "integer" }, { code: "markdown" }, { code: "oid" }, { code: "positiveInt" }, { code: "string" }, { code: "time" }, { code: "unsignedInt" }, { code: "uri" }, { code: "url" }, { code: "uuid" }, { code: "Address" }, { code: "Age" }, { code: "Annotation" }, { code: "Attachment" }, { code: "CodeableConcept" }, { code: "Coding" }, { code: "ContactPoint" }, { code: "Count" }, { code: "Distance" }, { code: "Duration" }, { code: "HumanName" }, { code: "Identifier" }, { code: "Money" }, { code: "Period" }, { code: "Quantity" }, { code: "Range" }, { code: "Ratio" }, { code: "Reference" }, { code: "SampledData" }, { code: "Signature" }, { code: "Timing" }, { code: "ContactDetail" }, { code: "Contributor" }, { code: "DataRequirement" }, { code: "Expression" }, { code: "ParameterDefinition" }, { code: "RelatedArtifact" }, { code: "TriggerDefinition" }, { code: "UsageContext" }, { code: "Dosage" }, { code: "Meta" }] } } }, HumanName: { elements: { id: { type: [{ code: "string" }] }, extension: { max: 9007199254740991, type: [{ code: "Extension" }] }, use: { type: [{ code: "code" }] }, text: { type: [{ code: "string" }] }, family: { type: [{ code: "string" }] }, given: { max: 9007199254740991, type: [{ code: "string" }] }, prefix: { max: 9007199254740991, type: [{ code: "string" }] }, suffix: { max: 9007199254740991, type: [{ code: "string" }] }, period: { type: [{ code: "Period" }] } } }, Identifier: { elements: { id: { type: [{ code: "string" }] }, extension: { max: 9007199254740991, type: [{ code: "Extension" }] }, use: { type: [{ code: "code" }] }, type: { type: [{ code: "CodeableConcept" }] }, system: { type: [{ code: "uri" }] }, value: { type: [{ code: "string" }] }, period: { type: [{ code: "Period" }] }, assigner: { type: [{ code: "Reference", targetProfile: ["http://hl7.org/fhir/StructureDefinition/Organization"] }] } } }, MarketingStatus: { elements: { id: { type: [{ code: "string" }] }, extension: { max: 9007199254740991, type: [{ code: "Extension" }] }, modifierExtension: { max: 9007199254740991, type: [{ code: "Extension" }] }, country: { min: 1, type: [{ code: "CodeableConcept" }] }, jurisdiction: { type: [{ code: "CodeableConcept" }] }, status: { min: 1, type: [{ code: "CodeableConcept" }] }, dateRange: { min: 1, type: [{ code: "Period" }] }, restoreDate: { type: [{ code: "dateTime" }] } } }, Meta: { elements: { id: { type: [{ code: "string" }] }, extension: { max: 9007199254740991, type: [{ code: "Extension" }] }, versionId: { type: [{ code: "id" }] }, lastUpdated: { type: [{ code: "instant" }] }, source: { type: [{ code: "uri" }] }, profile: { max: 9007199254740991, type: [{ code: "canonical", targetProfile: ["http://hl7.org/fhir/StructureDefinition/StructureDefinition"] }] }, security: { max: 9007199254740991, type: [{ code: "Coding" }] }, tag: { max: 9007199254740991, type: [{ code: "Coding" }] }, project: { type: [{ code: "uri" }] }, author: { type: [{ code: "Reference" }] }, onBehalfOf: { type: [{ code: "Reference" }] }, account: { type: [{ code: "Reference" }] }, accounts: { max: 9007199254740991, type: [{ code: "Reference" }] }, compartment: { max: 9007199254740991, type: [{ code: "Reference" }] } } }, Money: { elements: { id: { type: [{ code: "string" }] }, extension: { max: 9007199254740991, type: [{ code: "Extension" }] }, value: { type: [{ code: "decimal" }] }, currency: { type: [{ code: "code" }] } } }, Narrative: { elements: { id: { type: [{ code: "string" }] }, extension: { max: 9007199254740991, type: [{ code: "Extension" }] }, status: { min: 1, type: [{ code: "code" }] }, div: { min: 1, type: [{ code: "xhtml" }] } } }, ParameterDefinition: { elements: { id: { type: [{ code: "string" }] }, extension: { max: 9007199254740991, type: [{ code: "Extension" }] }, name: { type: [{ code: "code" }] }, use: { min: 1, type: [{ code: "code" }] }, min: { type: [{ code: "integer" }] }, max: { type: [{ code: "string" }] }, documentation: { type: [{ code: "string" }] }, type: { min: 1, type: [{ code: "code" }] }, profile: { type: [{ code: "canonical", targetProfile: ["http://hl7.org/fhir/StructureDefinition/StructureDefinition"] }] } } }, Period: { elements: { id: { type: [{ code: "string" }] }, extension: { max: 9007199254740991, type: [{ code: "Extension" }] }, start: { type: [{ code: "dateTime" }] }, end: { type: [{ code: "dateTime" }] } } }, Population: { elements: { id: { type: [{ code: "string" }] }, extension: { max: 9007199254740991, type: [{ code: "Extension" }] }, modifierExtension: { max: 9007199254740991, type: [{ code: "Extension" }] }, "age[x]": { type: [{ code: "Range" }, { code: "CodeableConcept" }] }, gender: { type: [{ code: "CodeableConcept" }] }, race: { type: [{ code: "CodeableConcept" }] }, physiologicalCondition: { type: [{ code: "CodeableConcept" }] } } }, ProdCharacteristic: { elements: { id: { type: [{ code: "string" }] }, extension: { max: 9007199254740991, type: [{ code: "Extension" }] }, modifierExtension: { max: 9007199254740991, type: [{ code: "Extension" }] }, height: { type: [{ code: "Quantity" }] }, width: { type: [{ code: "Quantity" }] }, depth: { type: [{ code: "Quantity" }] }, weight: { type: [{ code: "Quantity" }] }, nominalVolume: { type: [{ code: "Quantity" }] }, externalDiameter: { type: [{ code: "Quantity" }] }, shape: { type: [{ code: "string" }] }, color: { max: 9007199254740991, type: [{ code: "string" }] }, imprint: { max: 9007199254740991, type: [{ code: "string" }] }, image: { max: 9007199254740991, type: [{ code: "Attachment" }] }, scoring: { type: [{ code: "CodeableConcept" }] } } }, ProductShelfLife: { elements: { id: { type: [{ code: "string" }] }, extension: { max: 9007199254740991, type: [{ code: "Extension" }] }, modifierExtension: { max: 9007199254740991, type: [{ code: "Extension" }] }, identifier: { type: [{ code: "Identifier" }] }, type: { min: 1, type: [{ code: "CodeableConcept" }] }, period: { min: 1, type: [{ code: "Quantity" }] }, specialPrecautionsForStorage: { max: 9007199254740991, type: [{ code: "CodeableConcept" }] } } }, Quantity: { elements: { id: { type: [{ code: "string" }] }, extension: { max: 9007199254740991, type: [{ code: "Extension" }] }, value: { type: [{ code: "decimal" }] }, comparator: { type: [{ code: "code" }] }, unit: { type: [{ code: "string" }] }, system: { type: [{ code: "uri" }] }, code: { type: [{ code: "code" }] } } }, Range: { elements: { id: { type: [{ code: "string" }] }, extension: { max: 9007199254740991, type: [{ code: "Extension" }] }, low: { type: [{ code: "Quantity", profile: ["http://hl7.org/fhir/StructureDefinition/SimpleQuantity"] }] }, high: { type: [{ code: "Quantity", profile: ["http://hl7.org/fhir/StructureDefinition/SimpleQuantity"] }] } } }, Ratio: { elements: { id: { type: [{ code: "string" }] }, extension: { max: 9007199254740991, type: [{ code: "Extension" }] }, numerator: { type: [{ code: "Quantity" }] }, denominator: { type: [{ code: "Quantity" }] } } }, Reference: { elements: { id: { type: [{ code: "string" }] }, extension: { max: 9007199254740991, type: [{ code: "Extension" }] }, reference: { type: [{ code: "string" }] }, type: { type: [{ code: "uri" }] }, identifier: { type: [{ code: "Identifier" }] }, display: { type: [{ code: "string" }] } } }, RelatedArtifact: { elements: { id: { type: [{ code: "string" }] }, extension: { max: 9007199254740991, type: [{ code: "Extension" }] }, type: { min: 1, type: [{ code: "code" }] }, label: { type: [{ code: "string" }] }, display: { type: [{ code: "string" }] }, citation: { type: [{ code: "markdown" }] }, url: { type: [{ code: "url" }] }, document: { type: [{ code: "Attachment" }] }, resource: { type: [{ code: "canonical", targetProfile: ["http://hl7.org/fhir/StructureDefinition/Resource"] }] } } }, SampledData: { elements: { id: { type: [{ code: "string" }] }, extension: { max: 9007199254740991, type: [{ code: "Extension" }] }, origin: { min: 1, type: [{ code: "Quantity", profile: ["http://hl7.org/fhir/StructureDefinition/SimpleQuantity"] }] }, period: { min: 1, type: [{ code: "decimal" }] }, factor: { type: [{ code: "decimal" }] }, lowerLimit: { type: [{ code: "decimal" }] }, upperLimit: { type: [{ code: "decimal" }] }, dimensions: { min: 1, type: [{ code: "positiveInt" }] }, data: { type: [{ code: "string" }] } } }, Signature: { elements: { id: { type: [{ code: "string" }] }, extension: { max: 9007199254740991, type: [{ code: "Extension" }] }, type: { min: 1, max: 9007199254740991, type: [{ code: "Coding" }] }, when: { min: 1, type: [{ code: "instant" }] }, who: { min: 1, type: [{ code: "Reference", targetProfile: ["http://hl7.org/fhir/StructureDefinition/Practitioner", "http://hl7.org/fhir/StructureDefinition/PractitionerRole", "http://hl7.org/fhir/StructureDefinition/RelatedPerson", "http://hl7.org/fhir/StructureDefinition/Patient", "http://hl7.org/fhir/StructureDefinition/Device", "http://hl7.org/fhir/StructureDefinition/Organization"] }] }, onBehalfOf: { type: [{ code: "Reference", targetProfile: ["http://hl7.org/fhir/StructureDefinition/Practitioner", "http://hl7.org/fhir/StructureDefinition/PractitionerRole", "http://hl7.org/fhir/StructureDefinition/RelatedPerson", "http://hl7.org/fhir/StructureDefinition/Patient", "http://hl7.org/fhir/StructureDefinition/Device", "http://hl7.org/fhir/StructureDefinition/Organization"] }] }, targetFormat: { type: [{ code: "code" }] }, sigFormat: { type: [{ code: "code" }] }, data: { type: [{ code: "base64Binary" }] } } }, SubstanceAmount: { elements: { id: { type: [{ code: "string" }] }, extension: { max: 9007199254740991, type: [{ code: "Extension" }] }, modifierExtension: { max: 9007199254740991, type: [{ code: "Extension" }] }, "amount[x]": { type: [{ code: "Quantity" }, { code: "Range" }, { code: "string" }] }, amountType: { type: [{ code: "CodeableConcept" }] }, amountText: { type: [{ code: "string" }] }, referenceRange: { type: [{ code: "SubstanceAmountReferenceRange" }] } } }, SubstanceAmountReferenceRange: { elements: { id: { type: [{ code: "string" }] }, extension: { max: 9007199254740991, type: [{ code: "Extension" }] }, lowLimit: { type: [{ code: "Quantity" }] }, highLimit: { type: [{ code: "Quantity" }] } } }, Timing: { elements: { id: { type: [{ code: "string" }] }, extension: { max: 9007199254740991, type: [{ code: "Extension" }] }, modifierExtension: { max: 9007199254740991, type: [{ code: "Extension" }] }, event: { max: 9007199254740991, type: [{ code: "dateTime" }] }, repeat: { type: [{ code: "TimingRepeat" }] }, code: { type: [{ code: "CodeableConcept" }] } } }, TimingRepeat: { elements: { id: { type: [{ code: "string" }] }, extension: { max: 9007199254740991, type: [{ code: "Extension" }] }, "bounds[x]": { type: [{ code: "Duration" }, { code: "Range" }, { code: "Period" }] }, count: { type: [{ code: "positiveInt" }] }, countMax: { type: [{ code: "positiveInt" }] }, duration: { type: [{ code: "decimal" }] }, durationMax: { type: [{ code: "decimal" }] }, durationUnit: { type: [{ code: "code" }] }, frequency: { type: [{ code: "positiveInt" }] }, frequencyMax: { type: [{ code: "positiveInt" }] }, period: { type: [{ code: "decimal" }] }, periodMax: { type: [{ code: "decimal" }] }, periodUnit: { type: [{ code: "code" }] }, dayOfWeek: { max: 9007199254740991, type: [{ code: "code" }] }, timeOfDay: { max: 9007199254740991, type: [{ code: "time" }] }, when: { max: 9007199254740991, type: [{ code: "code" }] }, offset: { type: [{ code: "unsignedInt" }] } } }, TriggerDefinition: { elements: { id: { type: [{ code: "string" }] }, extension: { max: 9007199254740991, type: [{ code: "Extension" }] }, type: { min: 1, type: [{ code: "code" }] }, name: { type: [{ code: "string" }] }, "timing[x]": { type: [{ code: "Timing" }, { code: "Reference", targetProfile: ["http://hl7.org/fhir/StructureDefinition/Schedule"] }, { code: "date" }, { code: "dateTime" }] }, data: { max: 9007199254740991, type: [{ code: "DataRequirement" }] }, condition: { type: [{ code: "Expression" }] } } }, UsageContext: { elements: { id: { type: [{ code: "string" }] }, extension: { max: 9007199254740991, type: [{ code: "Extension" }] }, code: { min: 1, type: [{ code: "Coding" }] }, "value[x]": { min: 1, type: [{ code: "CodeableConcept" }, { code: "Quantity" }, { code: "Range" }, { code: "Reference", targetProfile: ["http://hl7.org/fhir/StructureDefinition/PlanDefinition", "http://hl7.org/fhir/StructureDefinition/ResearchStudy", "http://hl7.org/fhir/StructureDefinition/InsurancePlan", "http://hl7.org/fhir/StructureDefinition/HealthcareService", "http://hl7.org/fhir/StructureDefinition/Group", "http://hl7.org/fhir/StructureDefinition/Location", "http://hl7.org/fhir/StructureDefinition/Organization"] }] } } }, MoneyQuantity: { elements: { id: { type: [{ code: "string" }] }, extension: { max: 9007199254740991, type: [{ code: "Extension" }] }, value: { type: [{ code: "decimal" }] }, comparator: { type: [{ code: "code" }] }, unit: { type: [{ code: "string" }] }, system: { type: [{ code: "uri" }] }, code: { type: [{ code: "code" }] } } }, SimpleQuantity: { elements: { id: { type: [{ code: "string" }] }, extension: { max: 9007199254740991, type: [{ code: "Extension" }] }, value: { type: [{ code: "decimal" }] }, comparator: { max: 0, type: [{ code: "code" }] }, unit: { type: [{ code: "string" }] }, system: { type: [{ code: "uri" }] }, code: { type: [{ code: "code" }] } } }, IdentityProvider: { elements: { authorizeUrl: { min: 1, type: [{ code: "string" }] }, tokenUrl: { min: 1, type: [{ code: "string" }] }, tokenAuthMethod: { type: [{ code: "code" }] }, userInfoUrl: { min: 1, type: [{ code: "string" }] }, userInfoMode: { type: [{ code: "code" }] }, userInfoApiKey: { type: [{ code: "string" }] }, clientId: { min: 1, type: [{ code: "string" }] }, clientSecret: { min: 1, type: [{ code: "string" }] }, usePkce: { type: [{ code: "boolean" }] }, useSubject: { type: [{ code: "boolean" }] }, identitySource: { type: [{ code: "code" }] }, identityMappingMode: { type: [{ code: "code" }] } } } };
52970
- function Br(t6) {
52971
- return new Fr(t6).parse();
52969
+ var hi = { Element: { elements: { id: { type: [{ code: "string" }] }, extension: { max: 9007199254740991, type: [{ code: "Extension" }] } } }, BackboneElement: { elements: { id: { type: [{ code: "string" }] }, extension: { max: 9007199254740991, type: [{ code: "Extension" }] }, modifierExtension: { max: 9007199254740991, type: [{ code: "Extension" }] } } }, Address: { elements: { id: { type: [{ code: "string" }] }, extension: { max: 9007199254740991, type: [{ code: "Extension" }] }, use: { type: [{ code: "code" }] }, type: { type: [{ code: "code" }] }, text: { type: [{ code: "string" }] }, line: { max: 9007199254740991, type: [{ code: "string" }] }, city: { type: [{ code: "string" }] }, district: { type: [{ code: "string" }] }, state: { type: [{ code: "string" }] }, postalCode: { type: [{ code: "string" }] }, country: { type: [{ code: "string" }] }, period: { type: [{ code: "Period" }] } } }, Age: { elements: { id: { type: [{ code: "string" }] }, extension: { max: 9007199254740991, type: [{ code: "Extension" }] }, value: { type: [{ code: "decimal" }] }, comparator: { type: [{ code: "code" }] }, unit: { type: [{ code: "string" }] }, system: { type: [{ code: "uri" }] }, code: { type: [{ code: "code" }] } } }, Annotation: { elements: { id: { type: [{ code: "string" }] }, extension: { max: 9007199254740991, type: [{ code: "Extension" }] }, "author[x]": { type: [{ code: "Reference", targetProfile: ["http://hl7.org/fhir/StructureDefinition/Practitioner", "http://hl7.org/fhir/StructureDefinition/Patient", "http://hl7.org/fhir/StructureDefinition/RelatedPerson", "http://hl7.org/fhir/StructureDefinition/Organization"] }, { code: "string" }] }, time: { type: [{ code: "dateTime" }] }, text: { min: 1, type: [{ code: "markdown" }] } } }, Attachment: { elements: { id: { type: [{ code: "string" }] }, extension: { max: 9007199254740991, type: [{ code: "Extension" }] }, contentType: { type: [{ code: "code" }] }, language: { type: [{ code: "code" }] }, data: { type: [{ code: "base64Binary" }] }, url: { type: [{ code: "url" }] }, size: { type: [{ code: "unsignedInt" }] }, hash: { type: [{ code: "base64Binary" }] }, title: { type: [{ code: "string" }] }, creation: { type: [{ code: "dateTime" }] } } }, CodeableConcept: { elements: { id: { type: [{ code: "string" }] }, extension: { max: 9007199254740991, type: [{ code: "Extension" }] }, coding: { max: 9007199254740991, type: [{ code: "Coding" }] }, text: { type: [{ code: "string" }] } } }, Coding: { elements: { id: { type: [{ code: "string" }] }, extension: { max: 9007199254740991, type: [{ code: "Extension" }] }, system: { type: [{ code: "uri" }] }, version: { type: [{ code: "string" }] }, code: { type: [{ code: "code" }] }, display: { type: [{ code: "string" }] }, userSelected: { type: [{ code: "boolean" }] } } }, ContactDetail: { elements: { id: { type: [{ code: "string" }] }, extension: { max: 9007199254740991, type: [{ code: "Extension" }] }, name: { type: [{ code: "string" }] }, telecom: { max: 9007199254740991, type: [{ code: "ContactPoint" }] } } }, ContactPoint: { elements: { id: { type: [{ code: "string" }] }, extension: { max: 9007199254740991, type: [{ code: "Extension" }] }, system: { type: [{ code: "code" }] }, value: { type: [{ code: "string" }] }, use: { type: [{ code: "code" }] }, rank: { type: [{ code: "positiveInt" }] }, period: { type: [{ code: "Period" }] } } }, Contributor: { elements: { id: { type: [{ code: "string" }] }, extension: { max: 9007199254740991, type: [{ code: "Extension" }] }, type: { min: 1, type: [{ code: "code" }] }, name: { min: 1, type: [{ code: "string" }] }, contact: { max: 9007199254740991, type: [{ code: "ContactDetail" }] } } }, Count: { elements: { id: { type: [{ code: "string" }] }, extension: { max: 9007199254740991, type: [{ code: "Extension" }] }, value: { type: [{ code: "decimal" }] }, comparator: { type: [{ code: "code" }] }, unit: { type: [{ code: "string" }] }, system: { type: [{ code: "uri" }] }, code: { type: [{ code: "code" }] } } }, DataRequirement: { elements: { id: { type: [{ code: "string" }] }, extension: { max: 9007199254740991, type: [{ code: "Extension" }] }, type: { min: 1, type: [{ code: "code" }] }, profile: { max: 9007199254740991, type: [{ code: "canonical", targetProfile: ["http://hl7.org/fhir/StructureDefinition/StructureDefinition"] }] }, "subject[x]": { type: [{ code: "CodeableConcept" }, { code: "Reference", targetProfile: ["http://hl7.org/fhir/StructureDefinition/Group"] }] }, mustSupport: { max: 9007199254740991, type: [{ code: "string" }] }, codeFilter: { max: 9007199254740991, type: [{ code: "DataRequirementCodeFilter" }] }, dateFilter: { max: 9007199254740991, type: [{ code: "DataRequirementDateFilter" }] }, limit: { type: [{ code: "positiveInt" }] }, sort: { max: 9007199254740991, type: [{ code: "DataRequirementSort" }] } } }, DataRequirementCodeFilter: { elements: { id: { type: [{ code: "string" }] }, extension: { max: 9007199254740991, type: [{ code: "Extension" }] }, path: { type: [{ code: "string" }] }, searchParam: { type: [{ code: "string" }] }, valueSet: { type: [{ code: "canonical", targetProfile: ["http://hl7.org/fhir/StructureDefinition/ValueSet"] }] }, code: { max: 9007199254740991, type: [{ code: "Coding" }] } } }, DataRequirementDateFilter: { elements: { id: { type: [{ code: "string" }] }, extension: { max: 9007199254740991, type: [{ code: "Extension" }] }, path: { type: [{ code: "string" }] }, searchParam: { type: [{ code: "string" }] }, "value[x]": { type: [{ code: "dateTime" }, { code: "Period" }, { code: "Duration" }] } } }, DataRequirementSort: { elements: { id: { type: [{ code: "string" }] }, extension: { max: 9007199254740991, type: [{ code: "Extension" }] }, path: { min: 1, type: [{ code: "string" }] }, direction: { min: 1, type: [{ code: "code" }] } } }, Distance: { elements: { id: { type: [{ code: "string" }] }, extension: { max: 9007199254740991, type: [{ code: "Extension" }] }, value: { type: [{ code: "decimal" }] }, comparator: { type: [{ code: "code" }] }, unit: { type: [{ code: "string" }] }, system: { type: [{ code: "uri" }] }, code: { type: [{ code: "code" }] } } }, Dosage: { elements: { id: { type: [{ code: "string" }] }, extension: { max: 9007199254740991, type: [{ code: "Extension" }] }, modifierExtension: { max: 9007199254740991, type: [{ code: "Extension" }] }, sequence: { type: [{ code: "integer" }] }, text: { type: [{ code: "string" }] }, additionalInstruction: { max: 9007199254740991, type: [{ code: "CodeableConcept" }] }, patientInstruction: { type: [{ code: "string" }] }, timing: { type: [{ code: "Timing" }] }, "asNeeded[x]": { type: [{ code: "boolean" }, { code: "CodeableConcept" }] }, site: { type: [{ code: "CodeableConcept" }] }, route: { type: [{ code: "CodeableConcept" }] }, method: { type: [{ code: "CodeableConcept" }] }, doseAndRate: { max: 9007199254740991, type: [{ code: "DosageDoseAndRate" }] }, maxDosePerPeriod: { type: [{ code: "Ratio" }] }, maxDosePerAdministration: { type: [{ code: "Quantity", profile: ["http://hl7.org/fhir/StructureDefinition/SimpleQuantity"] }] }, maxDosePerLifetime: { type: [{ code: "Quantity", profile: ["http://hl7.org/fhir/StructureDefinition/SimpleQuantity"] }] } } }, DosageDoseAndRate: { elements: { id: { type: [{ code: "string" }] }, extension: { max: 9007199254740991, type: [{ code: "Extension" }] }, type: { type: [{ code: "CodeableConcept" }] }, "dose[x]": { type: [{ code: "Range" }, { code: "Quantity", profile: ["http://hl7.org/fhir/StructureDefinition/SimpleQuantity"] }] }, "rate[x]": { type: [{ code: "Ratio" }, { code: "Range" }, { code: "Quantity", profile: ["http://hl7.org/fhir/StructureDefinition/SimpleQuantity"] }] } } }, Duration: { elements: { id: { type: [{ code: "string" }] }, extension: { max: 9007199254740991, type: [{ code: "Extension" }] }, value: { type: [{ code: "decimal" }] }, comparator: { type: [{ code: "code" }] }, unit: { type: [{ code: "string" }] }, system: { type: [{ code: "uri" }] }, code: { type: [{ code: "code" }] } } }, ElementDefinition: { elements: { id: { type: [{ code: "string" }] }, extension: { max: 9007199254740991, type: [{ code: "Extension" }] }, modifierExtension: { max: 9007199254740991, type: [{ code: "Extension" }] }, path: { min: 1, type: [{ code: "string" }] }, representation: { max: 9007199254740991, type: [{ code: "code" }] }, sliceName: { type: [{ code: "string" }] }, sliceIsConstraining: { type: [{ code: "boolean" }] }, label: { type: [{ code: "string" }] }, code: { max: 9007199254740991, type: [{ code: "Coding" }] }, slicing: { type: [{ code: "ElementDefinitionSlicing" }] }, short: { type: [{ code: "string" }] }, definition: { type: [{ code: "markdown" }] }, comment: { type: [{ code: "markdown" }] }, requirements: { type: [{ code: "markdown" }] }, alias: { max: 9007199254740991, type: [{ code: "string" }] }, min: { type: [{ code: "unsignedInt" }] }, max: { type: [{ code: "string" }] }, base: { type: [{ code: "ElementDefinitionBase" }] }, contentReference: { type: [{ code: "uri" }] }, type: { max: 9007199254740991, type: [{ code: "ElementDefinitionType" }] }, "defaultValue[x]": { type: [{ code: "base64Binary" }, { code: "boolean" }, { code: "canonical" }, { code: "code" }, { code: "date" }, { code: "dateTime" }, { code: "decimal" }, { code: "id" }, { code: "instant" }, { code: "integer" }, { code: "markdown" }, { code: "oid" }, { code: "positiveInt" }, { code: "string" }, { code: "time" }, { code: "unsignedInt" }, { code: "uri" }, { code: "url" }, { code: "uuid" }, { code: "Address" }, { code: "Age" }, { code: "Annotation" }, { code: "Attachment" }, { code: "CodeableConcept" }, { code: "Coding" }, { code: "ContactPoint" }, { code: "Count" }, { code: "Distance" }, { code: "Duration" }, { code: "HumanName" }, { code: "Identifier" }, { code: "Money" }, { code: "Period" }, { code: "Quantity" }, { code: "Range" }, { code: "Ratio" }, { code: "Reference" }, { code: "SampledData" }, { code: "Signature" }, { code: "Timing" }, { code: "ContactDetail" }, { code: "Contributor" }, { code: "DataRequirement" }, { code: "Expression" }, { code: "ParameterDefinition" }, { code: "RelatedArtifact" }, { code: "TriggerDefinition" }, { code: "UsageContext" }, { code: "Dosage" }, { code: "Meta" }] }, meaningWhenMissing: { type: [{ code: "markdown" }] }, orderMeaning: { type: [{ code: "string" }] }, "fixed[x]": { type: [{ code: "base64Binary" }, { code: "boolean" }, { code: "canonical" }, { code: "code" }, { code: "date" }, { code: "dateTime" }, { code: "decimal" }, { code: "id" }, { code: "instant" }, { code: "integer" }, { code: "markdown" }, { code: "oid" }, { code: "positiveInt" }, { code: "string" }, { code: "time" }, { code: "unsignedInt" }, { code: "uri" }, { code: "url" }, { code: "uuid" }, { code: "Address" }, { code: "Age" }, { code: "Annotation" }, { code: "Attachment" }, { code: "CodeableConcept" }, { code: "Coding" }, { code: "ContactPoint" }, { code: "Count" }, { code: "Distance" }, { code: "Duration" }, { code: "HumanName" }, { code: "Identifier" }, { code: "Money" }, { code: "Period" }, { code: "Quantity" }, { code: "Range" }, { code: "Ratio" }, { code: "Reference" }, { code: "SampledData" }, { code: "Signature" }, { code: "Timing" }, { code: "ContactDetail" }, { code: "Contributor" }, { code: "DataRequirement" }, { code: "Expression" }, { code: "ParameterDefinition" }, { code: "RelatedArtifact" }, { code: "TriggerDefinition" }, { code: "UsageContext" }, { code: "Dosage" }, { code: "Meta" }] }, "pattern[x]": { type: [{ code: "base64Binary" }, { code: "boolean" }, { code: "canonical" }, { code: "code" }, { code: "date" }, { code: "dateTime" }, { code: "decimal" }, { code: "id" }, { code: "instant" }, { code: "integer" }, { code: "markdown" }, { code: "oid" }, { code: "positiveInt" }, { code: "string" }, { code: "time" }, { code: "unsignedInt" }, { code: "uri" }, { code: "url" }, { code: "uuid" }, { code: "Address" }, { code: "Age" }, { code: "Annotation" }, { code: "Attachment" }, { code: "CodeableConcept" }, { code: "Coding" }, { code: "ContactPoint" }, { code: "Count" }, { code: "Distance" }, { code: "Duration" }, { code: "HumanName" }, { code: "Identifier" }, { code: "Money" }, { code: "Period" }, { code: "Quantity" }, { code: "Range" }, { code: "Ratio" }, { code: "Reference" }, { code: "SampledData" }, { code: "Signature" }, { code: "Timing" }, { code: "ContactDetail" }, { code: "Contributor" }, { code: "DataRequirement" }, { code: "Expression" }, { code: "ParameterDefinition" }, { code: "RelatedArtifact" }, { code: "TriggerDefinition" }, { code: "UsageContext" }, { code: "Dosage" }, { code: "Meta" }] }, example: { max: 9007199254740991, type: [{ code: "ElementDefinitionExample" }] }, "minValue[x]": { type: [{ code: "date" }, { code: "dateTime" }, { code: "instant" }, { code: "time" }, { code: "decimal" }, { code: "integer" }, { code: "positiveInt" }, { code: "unsignedInt" }, { code: "Quantity" }] }, "maxValue[x]": { type: [{ code: "date" }, { code: "dateTime" }, { code: "instant" }, { code: "time" }, { code: "decimal" }, { code: "integer" }, { code: "positiveInt" }, { code: "unsignedInt" }, { code: "Quantity" }] }, maxLength: { type: [{ code: "integer" }] }, condition: { max: 9007199254740991, type: [{ code: "id" }] }, constraint: { max: 9007199254740991, type: [{ code: "ElementDefinitionConstraint" }] }, mustSupport: { type: [{ code: "boolean" }] }, isModifier: { type: [{ code: "boolean" }] }, isModifierReason: { type: [{ code: "string" }] }, isSummary: { type: [{ code: "boolean" }] }, binding: { type: [{ code: "ElementDefinitionBinding" }] }, mapping: { max: 9007199254740991, type: [{ code: "ElementDefinitionMapping" }] } } }, ElementDefinitionSlicingDiscriminator: { elements: { id: { type: [{ code: "string" }] }, extension: { max: 9007199254740991, type: [{ code: "Extension" }] }, type: { min: 1, type: [{ code: "code" }] }, path: { min: 1, type: [{ code: "string" }] } } }, ElementDefinitionSlicing: { elements: { id: { type: [{ code: "string" }] }, extension: { max: 9007199254740991, type: [{ code: "Extension" }] }, discriminator: { max: 9007199254740991, type: [{ code: "ElementDefinitionSlicingDiscriminator" }] }, description: { type: [{ code: "string" }] }, ordered: { type: [{ code: "boolean" }] }, rules: { min: 1, type: [{ code: "code" }] } } }, ElementDefinitionBase: { elements: { id: { type: [{ code: "string" }] }, extension: { max: 9007199254740991, type: [{ code: "Extension" }] }, path: { min: 1, type: [{ code: "string" }] }, min: { min: 1, type: [{ code: "unsignedInt" }] }, max: { min: 1, type: [{ code: "string" }] } } }, ElementDefinitionType: { elements: { id: { type: [{ code: "string" }] }, extension: { max: 9007199254740991, type: [{ code: "Extension" }] }, code: { min: 1, type: [{ code: "uri" }] }, profile: { max: 9007199254740991, type: [{ code: "canonical", targetProfile: ["http://hl7.org/fhir/StructureDefinition/StructureDefinition", "http://hl7.org/fhir/StructureDefinition/ImplementationGuide"] }] }, targetProfile: { max: 9007199254740991, type: [{ code: "canonical", targetProfile: ["http://hl7.org/fhir/StructureDefinition/StructureDefinition", "http://hl7.org/fhir/StructureDefinition/ImplementationGuide"] }] }, aggregation: { max: 9007199254740991, type: [{ code: "code" }] }, versioning: { type: [{ code: "code" }] } } }, ElementDefinitionExample: { elements: { id: { type: [{ code: "string" }] }, extension: { max: 9007199254740991, type: [{ code: "Extension" }] }, label: { min: 1, type: [{ code: "string" }] }, "value[x]": { min: 1, type: [{ code: "base64Binary" }, { code: "boolean" }, { code: "canonical" }, { code: "code" }, { code: "date" }, { code: "dateTime" }, { code: "decimal" }, { code: "id" }, { code: "instant" }, { code: "integer" }, { code: "markdown" }, { code: "oid" }, { code: "positiveInt" }, { code: "string" }, { code: "time" }, { code: "unsignedInt" }, { code: "uri" }, { code: "url" }, { code: "uuid" }, { code: "Address" }, { code: "Age" }, { code: "Annotation" }, { code: "Attachment" }, { code: "CodeableConcept" }, { code: "Coding" }, { code: "ContactPoint" }, { code: "Count" }, { code: "Distance" }, { code: "Duration" }, { code: "HumanName" }, { code: "Identifier" }, { code: "Money" }, { code: "Period" }, { code: "Quantity" }, { code: "Range" }, { code: "Ratio" }, { code: "Reference" }, { code: "SampledData" }, { code: "Signature" }, { code: "Timing" }, { code: "ContactDetail" }, { code: "Contributor" }, { code: "DataRequirement" }, { code: "Expression" }, { code: "ParameterDefinition" }, { code: "RelatedArtifact" }, { code: "TriggerDefinition" }, { code: "UsageContext" }, { code: "Dosage" }, { code: "Meta" }] } } }, ElementDefinitionConstraint: { elements: { id: { type: [{ code: "string" }] }, extension: { max: 9007199254740991, type: [{ code: "Extension" }] }, key: { min: 1, type: [{ code: "id" }] }, requirements: { type: [{ code: "string" }] }, severity: { min: 1, type: [{ code: "code" }] }, human: { min: 1, type: [{ code: "string" }] }, expression: { type: [{ code: "string" }] }, xpath: { type: [{ code: "string" }] }, source: { type: [{ code: "canonical", targetProfile: ["http://hl7.org/fhir/StructureDefinition/StructureDefinition"] }] } } }, ElementDefinitionBinding: { elements: { id: { type: [{ code: "string" }] }, extension: { max: 9007199254740991, type: [{ code: "Extension" }] }, strength: { min: 1, type: [{ code: "code" }] }, description: { type: [{ code: "string" }] }, valueSet: { type: [{ code: "canonical", targetProfile: ["http://hl7.org/fhir/StructureDefinition/ValueSet"] }] } } }, ElementDefinitionMapping: { elements: { id: { type: [{ code: "string" }] }, extension: { max: 9007199254740991, type: [{ code: "Extension" }] }, identity: { min: 1, type: [{ code: "id" }] }, language: { type: [{ code: "code" }] }, map: { min: 1, type: [{ code: "string" }] }, comment: { type: [{ code: "string" }] } } }, Expression: { elements: { id: { type: [{ code: "string" }] }, extension: { max: 9007199254740991, type: [{ code: "Extension" }] }, description: { type: [{ code: "string" }] }, name: { type: [{ code: "id" }] }, language: { min: 1, type: [{ code: "code" }] }, expression: { type: [{ code: "string" }] }, reference: { type: [{ code: "uri" }] } } }, Extension: { elements: { id: { type: [{ code: "string" }] }, extension: { max: 9007199254740991, type: [{ code: "Extension" }] }, url: { min: 1, type: [{ code: "uri" }] }, "value[x]": { type: [{ code: "base64Binary" }, { code: "boolean" }, { code: "canonical" }, { code: "code" }, { code: "date" }, { code: "dateTime" }, { code: "decimal" }, { code: "id" }, { code: "instant" }, { code: "integer" }, { code: "markdown" }, { code: "oid" }, { code: "positiveInt" }, { code: "string" }, { code: "time" }, { code: "unsignedInt" }, { code: "uri" }, { code: "url" }, { code: "uuid" }, { code: "Address" }, { code: "Age" }, { code: "Annotation" }, { code: "Attachment" }, { code: "CodeableConcept" }, { code: "Coding" }, { code: "ContactPoint" }, { code: "Count" }, { code: "Distance" }, { code: "Duration" }, { code: "HumanName" }, { code: "Identifier" }, { code: "Money" }, { code: "Period" }, { code: "Quantity" }, { code: "Range" }, { code: "Ratio" }, { code: "Reference" }, { code: "SampledData" }, { code: "Signature" }, { code: "Timing" }, { code: "ContactDetail" }, { code: "Contributor" }, { code: "DataRequirement" }, { code: "Expression" }, { code: "ParameterDefinition" }, { code: "RelatedArtifact" }, { code: "TriggerDefinition" }, { code: "UsageContext" }, { code: "Dosage" }, { code: "Meta" }] } } }, HumanName: { elements: { id: { type: [{ code: "string" }] }, extension: { max: 9007199254740991, type: [{ code: "Extension" }] }, use: { type: [{ code: "code" }] }, text: { type: [{ code: "string" }] }, family: { type: [{ code: "string" }] }, given: { max: 9007199254740991, type: [{ code: "string" }] }, prefix: { max: 9007199254740991, type: [{ code: "string" }] }, suffix: { max: 9007199254740991, type: [{ code: "string" }] }, period: { type: [{ code: "Period" }] } } }, Identifier: { elements: { id: { type: [{ code: "string" }] }, extension: { max: 9007199254740991, type: [{ code: "Extension" }] }, use: { type: [{ code: "code" }] }, type: { type: [{ code: "CodeableConcept" }] }, system: { type: [{ code: "uri" }] }, value: { type: [{ code: "string" }] }, period: { type: [{ code: "Period" }] }, assigner: { type: [{ code: "Reference", targetProfile: ["http://hl7.org/fhir/StructureDefinition/Organization"] }] } } }, MarketingStatus: { elements: { id: { type: [{ code: "string" }] }, extension: { max: 9007199254740991, type: [{ code: "Extension" }] }, modifierExtension: { max: 9007199254740991, type: [{ code: "Extension" }] }, country: { min: 1, type: [{ code: "CodeableConcept" }] }, jurisdiction: { type: [{ code: "CodeableConcept" }] }, status: { min: 1, type: [{ code: "CodeableConcept" }] }, dateRange: { min: 1, type: [{ code: "Period" }] }, restoreDate: { type: [{ code: "dateTime" }] } } }, Meta: { elements: { id: { type: [{ code: "string" }] }, extension: { max: 9007199254740991, type: [{ code: "Extension" }] }, versionId: { type: [{ code: "id" }] }, lastUpdated: { type: [{ code: "instant" }] }, source: { type: [{ code: "uri" }] }, profile: { max: 9007199254740991, type: [{ code: "canonical", targetProfile: ["http://hl7.org/fhir/StructureDefinition/StructureDefinition"] }] }, security: { max: 9007199254740991, type: [{ code: "Coding" }] }, tag: { max: 9007199254740991, type: [{ code: "Coding" }] }, project: { type: [{ code: "uri" }] }, author: { type: [{ code: "Reference" }] }, onBehalfOf: { type: [{ code: "Reference" }] }, account: { type: [{ code: "Reference" }] }, accounts: { max: 9007199254740991, type: [{ code: "Reference" }] }, compartment: { max: 9007199254740991, type: [{ code: "Reference" }] } } }, Money: { elements: { id: { type: [{ code: "string" }] }, extension: { max: 9007199254740991, type: [{ code: "Extension" }] }, value: { type: [{ code: "decimal" }] }, currency: { type: [{ code: "code" }] } } }, Narrative: { elements: { id: { type: [{ code: "string" }] }, extension: { max: 9007199254740991, type: [{ code: "Extension" }] }, status: { min: 1, type: [{ code: "code" }] }, div: { min: 1, type: [{ code: "xhtml" }] } } }, ParameterDefinition: { elements: { id: { type: [{ code: "string" }] }, extension: { max: 9007199254740991, type: [{ code: "Extension" }] }, name: { type: [{ code: "code" }] }, use: { min: 1, type: [{ code: "code" }] }, min: { type: [{ code: "integer" }] }, max: { type: [{ code: "string" }] }, documentation: { type: [{ code: "string" }] }, type: { min: 1, type: [{ code: "code" }] }, profile: { type: [{ code: "canonical", targetProfile: ["http://hl7.org/fhir/StructureDefinition/StructureDefinition"] }] } } }, Period: { elements: { id: { type: [{ code: "string" }] }, extension: { max: 9007199254740991, type: [{ code: "Extension" }] }, start: { type: [{ code: "dateTime" }] }, end: { type: [{ code: "dateTime" }] } } }, Population: { elements: { id: { type: [{ code: "string" }] }, extension: { max: 9007199254740991, type: [{ code: "Extension" }] }, modifierExtension: { max: 9007199254740991, type: [{ code: "Extension" }] }, "age[x]": { type: [{ code: "Range" }, { code: "CodeableConcept" }] }, gender: { type: [{ code: "CodeableConcept" }] }, race: { type: [{ code: "CodeableConcept" }] }, physiologicalCondition: { type: [{ code: "CodeableConcept" }] } } }, ProdCharacteristic: { elements: { id: { type: [{ code: "string" }] }, extension: { max: 9007199254740991, type: [{ code: "Extension" }] }, modifierExtension: { max: 9007199254740991, type: [{ code: "Extension" }] }, height: { type: [{ code: "Quantity" }] }, width: { type: [{ code: "Quantity" }] }, depth: { type: [{ code: "Quantity" }] }, weight: { type: [{ code: "Quantity" }] }, nominalVolume: { type: [{ code: "Quantity" }] }, externalDiameter: { type: [{ code: "Quantity" }] }, shape: { type: [{ code: "string" }] }, color: { max: 9007199254740991, type: [{ code: "string" }] }, imprint: { max: 9007199254740991, type: [{ code: "string" }] }, image: { max: 9007199254740991, type: [{ code: "Attachment" }] }, scoring: { type: [{ code: "CodeableConcept" }] } } }, ProductShelfLife: { elements: { id: { type: [{ code: "string" }] }, extension: { max: 9007199254740991, type: [{ code: "Extension" }] }, modifierExtension: { max: 9007199254740991, type: [{ code: "Extension" }] }, identifier: { type: [{ code: "Identifier" }] }, type: { min: 1, type: [{ code: "CodeableConcept" }] }, period: { min: 1, type: [{ code: "Quantity" }] }, specialPrecautionsForStorage: { max: 9007199254740991, type: [{ code: "CodeableConcept" }] } } }, Quantity: { elements: { id: { type: [{ code: "string" }] }, extension: { max: 9007199254740991, type: [{ code: "Extension" }] }, value: { type: [{ code: "decimal" }] }, comparator: { type: [{ code: "code" }] }, unit: { type: [{ code: "string" }] }, system: { type: [{ code: "uri" }] }, code: { type: [{ code: "code" }] } } }, Range: { elements: { id: { type: [{ code: "string" }] }, extension: { max: 9007199254740991, type: [{ code: "Extension" }] }, low: { type: [{ code: "Quantity", profile: ["http://hl7.org/fhir/StructureDefinition/SimpleQuantity"] }] }, high: { type: [{ code: "Quantity", profile: ["http://hl7.org/fhir/StructureDefinition/SimpleQuantity"] }] } } }, Ratio: { elements: { id: { type: [{ code: "string" }] }, extension: { max: 9007199254740991, type: [{ code: "Extension" }] }, numerator: { type: [{ code: "Quantity" }] }, denominator: { type: [{ code: "Quantity" }] } } }, Reference: { elements: { id: { type: [{ code: "string" }] }, extension: { max: 9007199254740991, type: [{ code: "Extension" }] }, reference: { type: [{ code: "string" }] }, type: { type: [{ code: "uri" }] }, identifier: { type: [{ code: "Identifier" }] }, display: { type: [{ code: "string" }] } } }, RelatedArtifact: { elements: { id: { type: [{ code: "string" }] }, extension: { max: 9007199254740991, type: [{ code: "Extension" }] }, type: { min: 1, type: [{ code: "code" }] }, label: { type: [{ code: "string" }] }, display: { type: [{ code: "string" }] }, citation: { type: [{ code: "markdown" }] }, url: { type: [{ code: "url" }] }, document: { type: [{ code: "Attachment" }] }, resource: { type: [{ code: "canonical", targetProfile: ["http://hl7.org/fhir/StructureDefinition/Resource"] }] } } }, SampledData: { elements: { id: { type: [{ code: "string" }] }, extension: { max: 9007199254740991, type: [{ code: "Extension" }] }, origin: { min: 1, type: [{ code: "Quantity", profile: ["http://hl7.org/fhir/StructureDefinition/SimpleQuantity"] }] }, period: { min: 1, type: [{ code: "decimal" }] }, factor: { type: [{ code: "decimal" }] }, lowerLimit: { type: [{ code: "decimal" }] }, upperLimit: { type: [{ code: "decimal" }] }, dimensions: { min: 1, type: [{ code: "positiveInt" }] }, data: { type: [{ code: "string" }] } } }, Signature: { elements: { id: { type: [{ code: "string" }] }, extension: { max: 9007199254740991, type: [{ code: "Extension" }] }, type: { min: 1, max: 9007199254740991, type: [{ code: "Coding" }] }, when: { min: 1, type: [{ code: "instant" }] }, who: { min: 1, type: [{ code: "Reference", targetProfile: ["http://hl7.org/fhir/StructureDefinition/Practitioner", "http://hl7.org/fhir/StructureDefinition/PractitionerRole", "http://hl7.org/fhir/StructureDefinition/RelatedPerson", "http://hl7.org/fhir/StructureDefinition/Patient", "http://hl7.org/fhir/StructureDefinition/Device", "http://hl7.org/fhir/StructureDefinition/Organization"] }] }, onBehalfOf: { type: [{ code: "Reference", targetProfile: ["http://hl7.org/fhir/StructureDefinition/Practitioner", "http://hl7.org/fhir/StructureDefinition/PractitionerRole", "http://hl7.org/fhir/StructureDefinition/RelatedPerson", "http://hl7.org/fhir/StructureDefinition/Patient", "http://hl7.org/fhir/StructureDefinition/Device", "http://hl7.org/fhir/StructureDefinition/Organization"] }] }, targetFormat: { type: [{ code: "code" }] }, sigFormat: { type: [{ code: "code" }] }, data: { type: [{ code: "base64Binary" }] } } }, SubstanceAmount: { elements: { id: { type: [{ code: "string" }] }, extension: { max: 9007199254740991, type: [{ code: "Extension" }] }, modifierExtension: { max: 9007199254740991, type: [{ code: "Extension" }] }, "amount[x]": { type: [{ code: "Quantity" }, { code: "Range" }, { code: "string" }] }, amountType: { type: [{ code: "CodeableConcept" }] }, amountText: { type: [{ code: "string" }] }, referenceRange: { type: [{ code: "SubstanceAmountReferenceRange" }] } } }, SubstanceAmountReferenceRange: { elements: { id: { type: [{ code: "string" }] }, extension: { max: 9007199254740991, type: [{ code: "Extension" }] }, lowLimit: { type: [{ code: "Quantity" }] }, highLimit: { type: [{ code: "Quantity" }] } } }, Timing: { elements: { id: { type: [{ code: "string" }] }, extension: { max: 9007199254740991, type: [{ code: "Extension" }] }, modifierExtension: { max: 9007199254740991, type: [{ code: "Extension" }] }, event: { max: 9007199254740991, type: [{ code: "dateTime" }] }, repeat: { type: [{ code: "TimingRepeat" }] }, code: { type: [{ code: "CodeableConcept" }] } } }, TimingRepeat: { elements: { id: { type: [{ code: "string" }] }, extension: { max: 9007199254740991, type: [{ code: "Extension" }] }, "bounds[x]": { type: [{ code: "Duration" }, { code: "Range" }, { code: "Period" }] }, count: { type: [{ code: "positiveInt" }] }, countMax: { type: [{ code: "positiveInt" }] }, duration: { type: [{ code: "decimal" }] }, durationMax: { type: [{ code: "decimal" }] }, durationUnit: { type: [{ code: "code" }] }, frequency: { type: [{ code: "positiveInt" }] }, frequencyMax: { type: [{ code: "positiveInt" }] }, period: { type: [{ code: "decimal" }] }, periodMax: { type: [{ code: "decimal" }] }, periodUnit: { type: [{ code: "code" }] }, dayOfWeek: { max: 9007199254740991, type: [{ code: "code" }] }, timeOfDay: { max: 9007199254740991, type: [{ code: "time" }] }, when: { max: 9007199254740991, type: [{ code: "code" }] }, offset: { type: [{ code: "unsignedInt" }] } } }, TriggerDefinition: { elements: { id: { type: [{ code: "string" }] }, extension: { max: 9007199254740991, type: [{ code: "Extension" }] }, type: { min: 1, type: [{ code: "code" }] }, name: { type: [{ code: "string" }] }, "timing[x]": { type: [{ code: "Timing" }, { code: "Reference", targetProfile: ["http://hl7.org/fhir/StructureDefinition/Schedule"] }, { code: "date" }, { code: "dateTime" }] }, data: { max: 9007199254740991, type: [{ code: "DataRequirement" }] }, condition: { type: [{ code: "Expression" }] } } }, UsageContext: { elements: { id: { type: [{ code: "string" }] }, extension: { max: 9007199254740991, type: [{ code: "Extension" }] }, code: { min: 1, type: [{ code: "Coding" }] }, "value[x]": { min: 1, type: [{ code: "CodeableConcept" }, { code: "Quantity" }, { code: "Range" }, { code: "Reference", targetProfile: ["http://hl7.org/fhir/StructureDefinition/PlanDefinition", "http://hl7.org/fhir/StructureDefinition/ResearchStudy", "http://hl7.org/fhir/StructureDefinition/InsurancePlan", "http://hl7.org/fhir/StructureDefinition/HealthcareService", "http://hl7.org/fhir/StructureDefinition/Group", "http://hl7.org/fhir/StructureDefinition/Location", "http://hl7.org/fhir/StructureDefinition/Organization"] }] } } }, MoneyQuantity: { elements: { id: { type: [{ code: "string" }] }, extension: { max: 9007199254740991, type: [{ code: "Extension" }] }, value: { type: [{ code: "decimal" }] }, comparator: { type: [{ code: "code" }] }, unit: { type: [{ code: "string" }] }, system: { type: [{ code: "uri" }] }, code: { type: [{ code: "code" }] } } }, SimpleQuantity: { elements: { id: { type: [{ code: "string" }] }, extension: { max: 9007199254740991, type: [{ code: "Extension" }] }, value: { type: [{ code: "decimal" }] }, comparator: { max: 0, type: [{ code: "code" }] }, unit: { type: [{ code: "string" }] }, system: { type: [{ code: "uri" }] }, code: { type: [{ code: "code" }] } } }, IdentityProvider: { elements: { authorizeUrl: { min: 1, type: [{ code: "string" }] }, tokenUrl: { min: 1, type: [{ code: "string" }] }, tokenAuthMethod: { type: [{ code: "code" }] }, userInfoUrl: { min: 1, type: [{ code: "string" }] }, userInfoMode: { type: [{ code: "code" }] }, userInfoApiKey: { type: [{ code: "string" }] }, clientId: { min: 1, type: [{ code: "string" }] }, clientSecret: { min: 1, type: [{ code: "string" }] }, usePkce: { type: [{ code: "boolean" }] }, useSubject: { type: [{ code: "boolean" }] }, identitySource: { type: [{ code: "code" }] }, identityMappingMode: { type: [{ code: "code" }] } } } };
52970
+ function Wr(t6) {
52971
+ return new Ur(t6).parse();
52972
52972
  }
52973
- var Ve = fi(mi);
52974
- var Wr = /* @__PURE__ */ Object.create(null);
52975
- var hi = /* @__PURE__ */ Object.create(null);
52976
- var Ts = { "http://hl7.org/fhir/StructureDefinition/MoneyQuantity": "MoneyQuantity", "http://hl7.org/fhir/StructureDefinition/SimpleQuantity": "SimpleQuantity", "http://hl7.org/fhir/uv/sql-on-fhir/StructureDefinition/ViewDefinition": "ViewDefinition" };
52977
- function vi(t6) {
52973
+ var Ve = mi(hi);
52974
+ var qr = /* @__PURE__ */ Object.create(null);
52975
+ var gi = /* @__PURE__ */ Object.create(null);
52976
+ var Ss = { "http://hl7.org/fhir/StructureDefinition/MoneyQuantity": "MoneyQuantity", "http://hl7.org/fhir/StructureDefinition/SimpleQuantity": "SimpleQuantity", "http://hl7.org/fhir/uv/sql-on-fhir/StructureDefinition/ViewDefinition": "ViewDefinition" };
52977
+ function Ti(t6) {
52978
52978
  let e;
52979
- return e = hi[t6], e || (e = hi[t6] = /* @__PURE__ */ Object.create(null)), e;
52979
+ return e = gi[t6], e || (e = gi[t6] = /* @__PURE__ */ Object.create(null)), e;
52980
52980
  }
52981
- function qr(t6) {
52981
+ function $r(t6) {
52982
52982
  let r = (Array.isArray(t6) ? t6 : t6.entry?.map((n) => n.resource) ?? []).filter((n) => n?.resourceType === "StructureDefinition");
52983
- Ri(r);
52984
- for (let n of r) $r(n);
52983
+ Pi(r);
52984
+ for (let n of r) jr(n);
52985
52985
  }
52986
- function $r(t6) {
52986
+ function jr(t6) {
52987
52987
  if (!t6?.name) throw new Error("Failed loading StructureDefinition from bundle");
52988
52988
  if (t6.resourceType !== "StructureDefinition") return;
52989
- let e = Br(t6), r = Ts[t6.url], n, i;
52990
- r ? (n = Ve, i = r) : t6.url === `http://hl7.org/fhir/StructureDefinition/${t6.type}` || t6.url === `https://medplum.com/fhir/StructureDefinition/${t6.type}` || t6.type?.startsWith("http://") || t6.type?.startsWith("https://") ? (n = Ve, i = t6.type) : (n = vi(t6.url), i = t6.type), n[i] = e;
52989
+ let e = Wr(t6), r = Ss[t6.url], n, i;
52990
+ r ? (n = Ve, i = r) : t6.url === `http://hl7.org/fhir/StructureDefinition/${t6.type}` || t6.url === `https://medplum.com/fhir/StructureDefinition/${t6.type}` || t6.type?.startsWith("http://") || t6.type?.startsWith("https://") ? (n = Ve, i = t6.type) : (n = Ti(t6.url), i = t6.type), n[i] = e;
52991
52991
  for (let o2 of e.innerTypes) o2.parentType = e, n[o2.name] = o2;
52992
- Wr[t6.url] = e;
52992
+ qr[t6.url] = e;
52993
52993
  }
52994
- function Si(t6) {
52994
+ function bi(t6) {
52995
52995
  return !!Ve[t6];
52996
52996
  }
52997
52997
  function De(t6, e) {
52998
52998
  if (e) {
52999
- let r = vi(e)[t6];
52999
+ let r = Ti(e)[t6];
53000
53000
  if (r) return r;
53001
53001
  }
53002
53002
  return Ve[t6];
53003
53003
  }
53004
- function bi(t6) {
53005
- return !!Wr[t6];
53004
+ function Ei(t6) {
53005
+ return !!qr[t6];
53006
53006
  }
53007
- var Fr = class {
53007
+ var Ur = class {
53008
53008
  constructor(e) {
53009
53009
  c(this, "root");
53010
53010
  c(this, "elements");
@@ -53015,7 +53015,7 @@ var Fr = class {
53015
53015
  c(this, "innerTypes");
53016
53016
  c(this, "backboneContext");
53017
53017
  if (!e.snapshot?.element || e.snapshot.element.length === 0) throw new Error(`No snapshot defined for StructureDefinition '${e.name}'`);
53018
- this.root = e.snapshot.element[0], this.elements = e.snapshot.element.slice(1), this.elementIndex = /* @__PURE__ */ Object.create(null), this.index = 0, this.resourceSchema = { name: e.name, path: this.root.path, title: e.title, type: e.type, url: e.url, version: e.version, kind: e.kind, description: Rs(e), elements: {}, constraints: this.parseElementDefinition(this.root).constraints, innerTypes: [], summaryProperties: /* @__PURE__ */ new Set(), mandatoryProperties: /* @__PURE__ */ new Set() }, this.innerTypes = [];
53018
+ this.root = e.snapshot.element[0], this.elements = e.snapshot.element.slice(1), this.elementIndex = /* @__PURE__ */ Object.create(null), this.index = 0, this.resourceSchema = { name: e.name, path: this.root.path, title: e.title, type: e.type, url: e.url, version: e.version, kind: e.kind, description: Ps(e), elements: {}, constraints: this.parseElementDefinition(this.root).constraints, innerTypes: [], summaryProperties: /* @__PURE__ */ new Set(), mandatoryProperties: /* @__PURE__ */ new Set() }, this.innerTypes = [];
53019
53019
  }
53020
53020
  parse() {
53021
53021
  let e = this.next();
@@ -53023,7 +53023,7 @@ var Fr = class {
53023
53023
  if (e.sliceName) this.parseSliceStart(e);
53024
53024
  else if (e.id?.includes(":")) {
53025
53025
  if (this.slicingContext?.current) {
53026
- let r = Nr(e, this.slicingContext.path);
53026
+ let r = Fr(e, this.slicingContext.path);
53027
53027
  this.slicingContext.current.elements[r] = this.parseElementDefinition(e);
53028
53028
  }
53029
53029
  } else {
@@ -53032,13 +53032,13 @@ var Fr = class {
53032
53032
  let n = this.backboneContext;
53033
53033
  for (; n; ) {
53034
53034
  if (e.path?.startsWith(n.path + ".")) {
53035
- n.type.elements[Nr(e, n.path)] = r;
53035
+ n.type.elements[Fr(e, n.path)] = r;
53036
53036
  break;
53037
53037
  }
53038
53038
  n = n.parent;
53039
53039
  }
53040
53040
  if (!n) {
53041
- let i = Nr(e, this.root.path);
53041
+ let i = Fr(e, this.root.path);
53042
53042
  e.isSummary && this.resourceSchema.summaryProperties?.add(i.replace("[x]", "")), r.min > 0 && this.resourceSchema.mandatoryProperties?.add(i.replace("[x]", "")), this.resourceSchema.elements[i] = r;
53043
53043
  }
53044
53044
  this.checkFieldExit(e);
@@ -53052,11 +53052,11 @@ var Fr = class {
53052
53052
  }
53053
53053
  enterInnerType(e) {
53054
53054
  for (; this.backboneContext && !ze(this.backboneContext?.path, e.path); ) this.innerTypes.push(this.backboneContext.type), this.backboneContext = this.backboneContext.parent;
53055
- let r = Ur(e);
53055
+ let r = Br(e);
53056
53056
  this.backboneContext = { type: { name: r, type: r, path: e.path, title: e.label, description: e.definition, elements: {}, constraints: this.parseElementDefinition(e).constraints, innerTypes: [] }, path: e.path, parent: ze(this.backboneContext?.path, e.path) ? this.backboneContext : this.backboneContext?.parent };
53057
53057
  }
53058
53058
  enterSlice(e, r) {
53059
- Es(e) && !this.peek()?.sliceName || (r.slicing = { discriminator: (e.slicing?.discriminator ?? []).map((n) => {
53059
+ Rs(e) && !this.peek()?.sliceName || (r.slicing = { discriminator: (e.slicing?.discriminator ?? []).map((n) => {
53060
53060
  if (n.type !== "value" && n.type !== "pattern" && n.type !== "type") throw new Error(`Unsupported slicing discriminator type: ${n.type}`);
53061
53061
  return { path: n.path, type: n.type };
53062
53062
  }), slices: [], ordered: e.slicing?.ordered ?? false, rule: e.slicing?.rules }, this.slicingContext = { field: r.slicing, path: e.path ?? "" });
@@ -53092,52 +53092,52 @@ var Fr = class {
53092
53092
  parseElementDefinitionType(e) {
53093
53093
  return (e.type ?? []).map((r) => {
53094
53094
  let n;
53095
- return (r.code === "BackboneElement" || r.code === "Element") && (n = Ur(e)), n || (n = ye(r, "http://hl7.org/fhir/StructureDefinition/structuredefinition-fhir-type")?.valueUrl), n || (n = r.code ?? ""), { code: n, targetProfile: r.targetProfile, profile: r.profile };
53095
+ return (r.code === "BackboneElement" || r.code === "Element") && (n = Br(e)), n || (n = ye(r, "http://hl7.org/fhir/StructureDefinition/structuredefinition-fhir-type")?.valueUrl), n || (n = r.code ?? ""), { code: n, targetProfile: r.targetProfile, profile: r.profile };
53096
53096
  });
53097
53097
  }
53098
53098
  parseElementDefinition(e) {
53099
- let r = yi(e.max), n = e.base?.max ? yi(e.base.max) : r, i = { type: "ElementDefinition", value: e };
53100
- return { description: e.definition || "", path: e.path || e.base?.path || "", min: e.min ?? 0, max: r, isArray: n > 1, constraints: (e.constraint ?? []).map((o2) => ({ key: o2.key ?? "", severity: o2.severity ?? "error", expression: o2.expression ?? "", description: o2.human ?? "" })), type: this.parseElementDefinitionType(e), fixed: xi(F(i, "fixed[x]")), pattern: xi(F(i, "pattern[x]")), binding: e.binding };
53099
+ let r = xi(e.max), n = e.base?.max ? xi(e.base.max) : r, i = { type: "ElementDefinition", value: e };
53100
+ return { description: e.definition || "", path: e.path || e.base?.path || "", min: e.min ?? 0, max: r, isArray: n > 1, constraints: (e.constraint ?? []).map((o2) => ({ key: o2.key ?? "", severity: o2.severity ?? "error", expression: o2.expression ?? "", description: o2.human ?? "" })), type: this.parseElementDefinitionType(e), fixed: vi(U(i, "fixed[x]")), pattern: vi(U(i, "pattern[x]")), binding: e.binding };
53101
53101
  }
53102
53102
  };
53103
- function yi(t6) {
53103
+ function xi(t6) {
53104
53104
  return t6 === "*" ? Number.POSITIVE_INFINITY : Number.parseInt(t6, 10);
53105
53105
  }
53106
- function Nr(t6, e = "") {
53107
- return bs(t6.path, e);
53106
+ function Fr(t6, e = "") {
53107
+ return Es(t6.path, e);
53108
53108
  }
53109
- function bs(t6, e) {
53109
+ function Es(t6, e) {
53110
53110
  return t6 ? e && t6.startsWith(e) ? t6.substring(e.length + 1) : t6 : "";
53111
53111
  }
53112
53112
  function ze(t6, e) {
53113
53113
  return !t6 || !e ? false : e.startsWith(t6 + ".") || e === t6;
53114
53114
  }
53115
- function xi(t6) {
53115
+ function vi(t6) {
53116
53116
  return Array.isArray(t6) && t6.length > 0 ? t6[0] : O(t6) ? void 0 : t6;
53117
53117
  }
53118
- function Es(t6) {
53118
+ function Rs(t6) {
53119
53119
  let e = t6.slicing?.discriminator;
53120
53120
  return !!(t6.type?.some((r) => r.code === "Extension") && e?.length === 1 && e[0].type === "value" && e[0].path === "url");
53121
53121
  }
53122
- function Rs(t6) {
53122
+ function Ps(t6) {
53123
53123
  let e = t6.description;
53124
53124
  return e?.startsWith(`Base StructureDefinition for ${t6.name} Type: `) && (e = e.substring(`Base StructureDefinition for ${t6.name} Type: `.length)), e;
53125
53125
  }
53126
- function zr(t6, e, r) {
53126
+ function Jr(t6, e, r) {
53127
53127
  let n = t6.path;
53128
- return Ps(F(t6, e, r), n, e);
53128
+ return Cs(U(t6, e, r), n, e);
53129
53129
  }
53130
- function Ps(t6, e, r) {
53130
+ function Cs(t6, e, r) {
53131
53131
  let n = e ? e + "." : "";
53132
53132
  return t6 === void 0 ? { type: "undefined", value: void 0, path: `${n}${r}` } : Array.isArray(t6) ? t6.map((i, o2) => ({ ...i, path: `${n}${r}[${o2}]` })) : { ...t6, path: `${n}${r}` };
53133
53133
  }
53134
- var Cs = new Z(1e3);
53135
- var Vt = { 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: /.*/ };
53134
+ var As = new Z(1e3);
53135
+ var Mt = { 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: /.*/ };
53136
53136
  function y(t6) {
53137
53137
  return [{ type: p.boolean, value: t6 }];
53138
53138
  }
53139
53139
  function E(t6) {
53140
- return t6 == null ? { type: "undefined", value: void 0 } : Number.isSafeInteger(t6) ? { type: p.integer, value: t6 } : typeof t6 == "number" ? { type: p.decimal, value: t6 } : typeof t6 == "boolean" ? { type: p.boolean, value: t6 } : typeof t6 == "string" ? { type: p.string, value: t6 } : _(t6) ? { type: p.Quantity, value: t6 } : D(t6) ? { type: t6.resourceType, value: t6 } : nn(t6) ? { type: p.CodeableConcept, value: t6 } : rn(t6) ? { type: p.Coding, value: t6 } : { type: p.BackboneElement, value: t6 };
53140
+ return t6 == null ? { type: "undefined", value: void 0 } : Number.isSafeInteger(t6) ? { type: p.integer, value: t6 } : typeof t6 == "number" ? { type: p.decimal, value: t6 } : typeof t6 == "boolean" ? { type: p.boolean, value: t6 } : typeof t6 == "string" ? { type: p.string, value: t6 } : _(t6) ? { type: p.Quantity, value: t6 } : D(t6) ? { type: t6.resourceType, value: t6 } : on(t6) ? { type: p.CodeableConcept, value: t6 } : nn(t6) ? { type: p.Coding, value: t6 } : { type: p.BackboneElement, value: t6 };
53141
53141
  }
53142
53142
  function H(t6) {
53143
53143
  return t6.length === 0 ? false : !!t6[0].value;
@@ -53145,39 +53145,42 @@ function H(t6) {
53145
53145
  function L(t6, e) {
53146
53146
  if (t6.length !== 0) {
53147
53147
  if (t6.length === 1 && (!e || t6[0].type === e)) return t6[0];
53148
- throw new Error(`Expected singleton of type ${e}, but found ${JSON.stringify(t6)}`);
53148
+ {
53149
+ let r = e ? ` of type ${e}` : "";
53150
+ throw new Error(`Expected singleton${r}, but found ${JSON.stringify(t6)}`);
53151
+ }
53149
53152
  }
53150
53153
  }
53151
- function F(t6, e, r) {
53154
+ function U(t6, e, r) {
53152
53155
  if (!t6.value) return;
53153
- let n = Nt(t6.type, e, r?.profileUrl);
53154
- return n ? Ls(t6, e, n) : Ns(t6, e);
53156
+ let n = Ft(t6.type, e, r?.profileUrl);
53157
+ return n ? Ns(t6, e, n) : Fs(t6, e);
53155
53158
  }
53156
- function Ls(t6, e, r) {
53159
+ function Ns(t6, e, r) {
53157
53160
  let n = t6.value, i = r.type;
53158
53161
  if (!i || i.length === 0) return;
53159
53162
  let o2, s = "undefined", a, u2 = r.path.lastIndexOf("."), l = r.path.substring(u2 + 1), d = l, f = false;
53160
53163
  l.endsWith("[x]") && (d = l.substring(0, l.length - 3), f = true);
53161
53164
  for (let h of i) {
53162
53165
  let b2 = d;
53163
- if (f && (b2 += U(h.code)), o2 = n[b2], a = n["_" + b2], o2 !== void 0 || a !== void 0) {
53166
+ if (f && (b2 += B(h.code)), o2 = n[b2], a = n["_" + b2], o2 !== void 0 || a !== void 0) {
53164
53167
  s = h.code;
53165
53168
  break;
53166
53169
  }
53167
53170
  }
53168
53171
  if (a) if (Array.isArray(o2)) {
53169
53172
  o2 = o2.slice();
53170
- for (let h = 0; h < Math.max(o2.length, a.length); h++) o2[h] = Zr(o2[h], a[h]);
53173
+ for (let h = 0; h < Math.max(o2.length, a.length); h++) o2[h] = en(o2[h], a[h]);
53171
53174
  } else if (!o2 && Array.isArray(a)) {
53172
53175
  o2 = a.slice();
53173
- for (let h = 0; h < a.length; h++) o2[h] = Zr(void 0, a[h]);
53174
- } else o2 = Zr(o2, a);
53175
- if (!O(o2)) return (s === "Element" || s === "BackboneElement") && (s = r.type[0].code), Array.isArray(o2) ? o2.map((h) => Pi(h, s)) : Pi(o2, s);
53176
+ for (let h = 0; h < a.length; h++) o2[h] = en(void 0, a[h]);
53177
+ } else o2 = en(o2, a);
53178
+ if (!O(o2)) return (s === "Element" || s === "BackboneElement") && (s = r.type[0].code), Array.isArray(o2) ? o2.map((h) => Ci(h, s)) : Ci(o2, s);
53176
53179
  }
53177
- function Pi(t6, e) {
53180
+ function Ci(t6, e) {
53178
53181
  return e === "Resource" && D(t6) && (e = t6.resourceType), { type: e, value: t6 };
53179
53182
  }
53180
- function Ns(t6, e) {
53183
+ function Fs(t6, e) {
53181
53184
  let r = t6.value;
53182
53185
  if (!r || typeof r != "object") return;
53183
53186
  let n;
@@ -53187,7 +53190,7 @@ function Ns(t6, e) {
53187
53190
  } else {
53188
53191
  let i = e.endsWith("[x]") ? e.substring(0, e.length - 3) : e;
53189
53192
  for (let o2 of Object.values(p)) {
53190
- let s = i + U(o2);
53193
+ let s = i + B(o2);
53191
53194
  if (s in r) {
53192
53195
  let a = r[s];
53193
53196
  Array.isArray(a) ? n = a.map((u2) => ({ type: o2, value: u2 })) : n = { type: o2, value: a };
@@ -53200,11 +53203,11 @@ function Ns(t6, e) {
53200
53203
  } else if (O(n)) return;
53201
53204
  return n;
53202
53205
  }
53203
- function Mt(t6) {
53206
+ function Lt(t6) {
53204
53207
  let e = [];
53205
53208
  for (let r of t6) {
53206
53209
  let n = false;
53207
- for (let i of e) if (H(at(r, i))) {
53210
+ for (let i of e) if (H(ct(r, i))) {
53208
53211
  n = true;
53209
53212
  break;
53210
53213
  }
@@ -53212,31 +53215,31 @@ function Mt(t6) {
53212
53215
  }
53213
53216
  return e;
53214
53217
  }
53215
- function wi(t6) {
53218
+ function Oi(t6) {
53216
53219
  return y(!H(t6));
53217
53220
  }
53218
- function Oi(t6, e) {
53219
- return t6.length === 0 || e.length === 0 ? [] : t6.length !== e.length ? y(false) : y(t6.every((r, n) => H(at(r, e[n]))));
53220
- }
53221
53221
  function Ii(t6, e) {
53222
- return t6.length === 0 || e.length === 0 ? [] : t6.length !== e.length ? y(true) : y(t6.some((r, n) => !H(at(r, e[n]))));
53222
+ return t6.length === 0 || e.length === 0 ? [] : t6.length !== e.length ? y(false) : y(t6.every((r, n) => H(ct(r, e[n]))));
53223
53223
  }
53224
- function at(t6, e) {
53224
+ function ki(t6, e) {
53225
+ return t6.length === 0 || e.length === 0 ? [] : t6.length !== e.length ? y(true) : y(t6.some((r, n) => !H(ct(r, e[n]))));
53226
+ }
53227
+ function ct(t6, e) {
53225
53228
  let r = t6.value?.valueOf(), n = e.value?.valueOf();
53226
- return typeof r == "number" && typeof n == "number" ? y(Math.abs(r - n) < 1e-8) : _(r) && _(n) ? y(Di(r, n)) : y(typeof r == "object" && typeof n == "object" ? tn(t6, e) : r === n);
53229
+ return typeof r == "number" && typeof n == "number" ? y(Math.abs(r - n) < 1e-8) : _(r) && _(n) ? y(Mi(r, n)) : y(typeof r == "object" && typeof n == "object" ? rn(t6, e) : r === n);
53227
53230
  }
53228
- function en(t6, e) {
53229
- return t6.length === 0 && e.length === 0 ? y(true) : t6.length !== e.length ? y(false) : (t6.sort(Ci), e.sort(Ci), y(t6.every((r, n) => H(Fs(r, e[n])))));
53231
+ function tn(t6, e) {
53232
+ return t6.length === 0 && e.length === 0 ? y(true) : t6.length !== e.length ? y(false) : (t6.sort(Ai), e.sort(Ai), y(t6.every((r, n) => H(Us(r, e[n])))));
53230
53233
  }
53231
- function Fs(t6, e) {
53234
+ function Us(t6, e) {
53232
53235
  let { type: r, value: n } = t6, { type: i, value: o2 } = e, s = n?.valueOf(), a = o2?.valueOf();
53233
- return typeof s == "number" && typeof a == "number" ? y(Math.abs(s - a) < 0.01) : _(s) && _(a) ? y(Di(s, a)) : y(r === "Coding" && i === "Coding" ? typeof s != "object" || typeof a != "object" ? false : s.code === a.code && s.system === a.system : typeof s == "object" && typeof a == "object" ? tn({ ...s, id: void 0 }, { ...a, id: void 0 }) : typeof s == "string" && typeof a == "string" ? s.toLowerCase() === a.toLowerCase() : s === a);
53236
+ return typeof s == "number" && typeof a == "number" ? y(Math.abs(s - a) < 0.01) : _(s) && _(a) ? y(Mi(s, a)) : y(r === "Coding" && i === "Coding" ? typeof s != "object" || typeof a != "object" ? false : s.code === a.code && s.system === a.system : typeof s == "object" && typeof a == "object" ? rn({ ...s, id: void 0 }, { ...a, id: void 0 }) : typeof s == "string" && typeof a == "string" ? s.toLowerCase() === a.toLowerCase() : s === a);
53234
53237
  }
53235
- function Ci(t6, e) {
53238
+ function Ai(t6, e) {
53236
53239
  let r = t6.value?.valueOf(), n = e.value?.valueOf();
53237
53240
  return typeof r == "number" && typeof n == "number" ? r - n : typeof r == "string" && typeof n == "string" ? r.localeCompare(n) : 0;
53238
53241
  }
53239
- function _t(t6, e) {
53242
+ function Xe(t6, e) {
53240
53243
  let { value: r } = t6;
53241
53244
  if (r == null) return false;
53242
53245
  let n = e;
@@ -53247,83 +53250,83 @@ function _t(t6, e) {
53247
53250
  case "Integer":
53248
53251
  return typeof r == "number";
53249
53252
  case "Date":
53250
- return ki(r);
53253
+ return Vi(r);
53251
53254
  case "DateTime":
53252
53255
  return Ye(r);
53253
53256
  case "Time":
53254
53257
  return typeof r == "string" && !!/^T\d/.exec(r);
53255
53258
  case "Period":
53256
- return Vi(r);
53259
+ return Di(r);
53257
53260
  case "Quantity":
53258
53261
  return _(r);
53259
53262
  default:
53260
53263
  return t6.type === n || typeof r == "object" && r?.resourceType === n;
53261
53264
  }
53262
53265
  }
53263
- function ki(t6) {
53264
- return typeof t6 == "string" && !!Vt.date.exec(t6);
53266
+ function Vi(t6) {
53267
+ return typeof t6 == "string" && !!Mt.date.exec(t6);
53265
53268
  }
53266
53269
  function Ye(t6) {
53267
- return typeof t6 == "string" && !!Vt.dateTime.exec(t6);
53270
+ return typeof t6 == "string" && !!Mt.dateTime.exec(t6);
53268
53271
  }
53269
- function Vi(t6) {
53272
+ function Di(t6) {
53270
53273
  return !!(t6 && typeof t6 == "object" && ("start" in t6 && Ye(t6.start) || "end" in t6 && Ye(t6.end)));
53271
53274
  }
53272
53275
  function _(t6) {
53273
53276
  return !!(t6 && typeof t6 == "object" && "value" in t6 && typeof t6.value == "number");
53274
53277
  }
53275
- function Di(t6, e) {
53278
+ function Mi(t6, e) {
53276
53279
  return Math.abs(t6.value - e.value) < 0.01 && (t6.unit === e.unit || t6.code === e.code || t6.unit === e.code || t6.code === e.unit);
53277
53280
  }
53278
- function tn(t6, e) {
53281
+ function rn(t6, e) {
53279
53282
  let r = Object.keys(t6), n = Object.keys(e);
53280
53283
  if (r.length !== n.length) return false;
53281
53284
  for (let i of r) {
53282
53285
  let o2 = t6[i], s = e[i];
53283
- if (Ai(o2) && Ai(s)) {
53284
- if (!tn(o2, s)) return false;
53286
+ if (wi(o2) && wi(s)) {
53287
+ if (!rn(o2, s)) return false;
53285
53288
  } else if (o2 !== s) return false;
53286
53289
  }
53287
53290
  return true;
53288
53291
  }
53289
- function Ai(t6) {
53292
+ function wi(t6) {
53290
53293
  return t6 !== null && typeof t6 == "object";
53291
53294
  }
53292
- function Zr(t6, e) {
53295
+ function en(t6, e) {
53293
53296
  if (e) {
53294
53297
  if (typeof e != "object") throw new Error("Primitive extension must be an object");
53295
- return Us(t6 ?? {}, e);
53298
+ return Bs(t6 ?? {}, e);
53296
53299
  }
53297
53300
  return t6;
53298
53301
  }
53299
- function Us(t6, e) {
53302
+ function Bs(t6, e) {
53300
53303
  return delete e.__proto__, delete e.constructor, Object.assign(t6, e);
53301
53304
  }
53302
- function ct(t6, e) {
53305
+ function ut(t6, e) {
53303
53306
  return D(t6, e) && "id" in t6 && typeof t6.id == "string";
53304
53307
  }
53305
53308
  function Me(t6) {
53306
- let e = V(t6) ?? "undefined/undefined", r = Ws(t6);
53309
+ let e = V(t6) ?? "undefined/undefined", r = qs(t6);
53307
53310
  return r === e ? { reference: e } : { reference: e, display: r };
53308
53311
  }
53309
53312
  function V(t6) {
53310
53313
  if (Y(t6)) return t6.reference;
53311
- if (ct(t6)) return `${t6.resourceType}/${t6.id}`;
53314
+ if (ut(t6)) return `${t6.resourceType}/${t6.id}`;
53312
53315
  }
53313
53316
  function _e(t6) {
53314
53317
  if (t6) return Y(t6) ? t6.reference.split("/")[1] : t6.id;
53315
53318
  }
53316
- function Bs(t6) {
53319
+ function Ws(t6) {
53317
53320
  return t6.resourceType === "Patient" || t6.resourceType === "Practitioner" || t6.resourceType === "RelatedPerson";
53318
53321
  }
53319
- function Ws(t6) {
53320
- if (Bs(t6)) {
53321
- let e = qs(t6);
53322
+ function qs(t6) {
53323
+ if (Ws(t6)) {
53324
+ let e = $s(t6);
53322
53325
  if (e) return e;
53323
53326
  }
53324
53327
  if (t6.resourceType === "Appointment" && t6.serviceType?.[0]) return ve(t6.serviceType[0]);
53325
53328
  if (t6.resourceType === "Device") {
53326
- let e = $s(t6);
53329
+ let e = js(t6);
53327
53330
  if (e) return e;
53328
53331
  }
53329
53332
  if (t6.resourceType === "DocumentReference") {
@@ -53332,26 +53335,26 @@ function Ws(t6) {
53332
53335
  }
53333
53336
  if (t6.resourceType === "MedicationRequest" && t6.medicationCodeableConcept) return ve(t6.medicationCodeableConcept);
53334
53337
  if (t6.resourceType === "MedicationStatement" && t6.medicationCodeableConcept) return ve(t6.medicationCodeableConcept);
53335
- if (t6.resourceType === "Slot" && (t6.start || t6.end)) return `${Xe(t6.start)} - ${Xe(t6.end)}`;
53338
+ if (t6.resourceType === "Slot" && (t6.start || t6.end)) return `${Ze(t6.start)} - ${Ze(t6.end)}`;
53336
53339
  if (t6.resourceType === "Subscription" && t6.criteria) return t6.criteria;
53337
53340
  if (t6.resourceType === "User" && t6.email) return t6.email;
53338
53341
  if ("name" in t6 && t6.name && typeof t6.name == "string") return t6.name;
53339
53342
  if ("code" in t6 && t6.code) {
53340
53343
  let e = t6.code;
53341
- if (Array.isArray(e) && (e = e[0]), nn(e)) return ve(e);
53342
- if (Ys(e)) return e.text;
53344
+ if (Array.isArray(e) && (e = e[0]), on(e)) return ve(e);
53345
+ if (Xs(e)) return e.text;
53343
53346
  }
53344
53347
  return V(t6) ?? "";
53345
53348
  }
53346
- function qs(t6) {
53349
+ function $s(t6) {
53347
53350
  let e = t6.name;
53348
- if (e && e.length > 0) return ut(e[0]);
53351
+ if (e && e.length > 0) return lt(e[0]);
53349
53352
  }
53350
- function $s(t6) {
53353
+ function js(t6) {
53351
53354
  let e = t6.deviceName;
53352
53355
  if (e && e.length > 0) return e[0].name;
53353
53356
  }
53354
- function Ft(t6, e) {
53357
+ function Ut(t6, e) {
53355
53358
  let r = new Date(t6);
53356
53359
  r.setUTCHours(0, 0, 0, 0);
53357
53360
  let n = e ? new Date(e) : /* @__PURE__ */ new Date();
@@ -53368,27 +53371,27 @@ function ye(t6, ...e) {
53368
53371
  for (let n = 0; n < e.length && r; n++) r = r?.extension?.find((i) => i.url === e[n]);
53369
53372
  return r;
53370
53373
  }
53371
- function Ut(t6, e) {
53372
- let r = un(t6);
53374
+ function Bt(t6, e) {
53375
+ let r = ln(t6);
53373
53376
  return JSON.stringify(r, null, e ? 2 : void 0) ?? "";
53374
53377
  }
53375
- function un(t6) {
53376
- if (!(t6 == null || t6 === "")) return typeof t6 == "object" ? Array.isArray(t6) ? js(t6) : Hs(t6) : t6;
53378
+ function ln(t6) {
53379
+ if (!(t6 == null || t6 === "")) return typeof t6 == "object" ? Array.isArray(t6) ? Hs(t6) : Gs(t6) : t6;
53377
53380
  }
53378
- function js(t6) {
53381
+ function Hs(t6) {
53379
53382
  let e = t6.length;
53380
53383
  if (e === 0) return;
53381
53384
  let r, n = 0;
53382
53385
  for (let i = 0; i < e; i++) {
53383
- let o2 = t6[i], s = un(o2);
53386
+ let o2 = t6[i], s = ln(o2);
53384
53387
  s !== o2 && !r && (r = Array.from(t6)), s === void 0 ? r && (r[i] = null) : (r && (r[i] = s), n++);
53385
53388
  }
53386
53389
  if (n !== 0) return r ?? t6;
53387
53390
  }
53388
- function Hs(t6) {
53391
+ function Gs(t6) {
53389
53392
  let e, r = 0;
53390
53393
  for (let n in t6) {
53391
- let i = t6[n], o2 = un(i);
53394
+ let i = t6[n], o2 = ln(i);
53392
53395
  o2 !== i && !e && (e = { ...t6 }), o2 === void 0 ? e && delete e[n] : (e && (e[n] = o2), r++);
53393
53396
  }
53394
53397
  if (r !== 0) return e ?? t6;
@@ -53404,14 +53407,14 @@ function ue(t6) {
53404
53407
  return e === "string" && t6 !== "" || e === "object" && ("length" in t6 && t6.length > 0 || Object.keys(t6).length > 0);
53405
53408
  }
53406
53409
  function xe(t6, e, r) {
53407
- return t6 === e || O(t6) && O(e) ? true : O(t6) || O(e) ? false : Array.isArray(t6) && Array.isArray(e) ? Gs(t6, e) : Array.isArray(t6) || Array.isArray(e) ? false : P(t6) && P(e) ? Qs(t6, e, r) : (P(t6) || P(e), false);
53410
+ return t6 === e || O(t6) && O(e) ? true : O(t6) || O(e) ? false : Array.isArray(t6) && Array.isArray(e) ? Qs(t6, e) : Array.isArray(t6) || Array.isArray(e) ? false : P(t6) && P(e) ? zs(t6, e, r) : (P(t6) || P(e), false);
53408
53411
  }
53409
- function Gs(t6, e) {
53412
+ function Qs(t6, e) {
53410
53413
  if (t6.length !== e.length) return false;
53411
53414
  for (let r = 0; r < t6.length; r++) if (!xe(t6[r], e[r])) return false;
53412
53415
  return true;
53413
53416
  }
53414
- function Qs(t6, e, r) {
53417
+ function zs(t6, e, r) {
53415
53418
  let n = /* @__PURE__ */ new Set();
53416
53419
  for (let i of Object.keys(t6)) n.add(i);
53417
53420
  for (let i of Object.keys(e)) n.add(i);
@@ -53425,41 +53428,41 @@ function Qs(t6, e, r) {
53425
53428
  function P(t6) {
53426
53429
  return t6 !== null && typeof t6 == "object";
53427
53430
  }
53428
- function rn(t6) {
53431
+ function nn(t6) {
53429
53432
  return P(t6) && "code" in t6 && typeof t6.code == "string";
53430
53433
  }
53431
- function nn(t6) {
53432
- return P(t6) && "coding" in t6 && Array.isArray(t6.coding) && t6.coding.every(rn);
53434
+ function on(t6) {
53435
+ return P(t6) && "coding" in t6 && Array.isArray(t6.coding) && t6.coding.every(nn);
53433
53436
  }
53434
- function Ys(t6) {
53437
+ function Xs(t6) {
53435
53438
  return P(t6) && "text" in t6 && typeof t6.text == "string";
53436
53439
  }
53437
- var Ni = [];
53438
- for (let t6 = 0; t6 < 256; t6++) Ni.push(t6.toString(16).padStart(2, "0"));
53439
- function Fi(t6) {
53440
- let e = Bi(t6), r = new Uint8Array(e), n = new Array(r.length);
53441
- for (let i = 0; i < r.length; i++) n[i] = Ni[r[i]];
53440
+ var Fi = [];
53441
+ for (let t6 = 0; t6 < 256; t6++) Fi.push(t6.toString(16).padStart(2, "0"));
53442
+ function Ui(t6) {
53443
+ let e = Wi(t6), r = new Uint8Array(e), n = new Array(r.length);
53444
+ for (let i = 0; i < r.length; i++) n[i] = Fi[r[i]];
53442
53445
  return n.join("");
53443
53446
  }
53444
- function Ui(t6) {
53445
- let e = Bi(t6), r = new Uint8Array(e), n = new Array(r.length);
53447
+ function Bi(t6) {
53448
+ let e = Wi(t6), r = new Uint8Array(e), n = new Array(r.length);
53446
53449
  for (let i = 0; i < r.length; i++) n[i] = String.fromCodePoint(r[i]);
53447
53450
  return window.btoa(n.join(""));
53448
53451
  }
53449
- function Bi(t6) {
53452
+ function Wi(t6) {
53450
53453
  return ArrayBuffer.isView(t6) ? t6.buffer : t6;
53451
53454
  }
53452
- function U(t6) {
53455
+ function B(t6) {
53453
53456
  return t6 ? t6.charAt(0).toUpperCase() + t6.substring(1) : "";
53454
53457
  }
53455
- var dn = (t6, e) => new Promise((r, n) => {
53458
+ var pn = (t6, e) => new Promise((r, n) => {
53456
53459
  e?.signal?.throwIfAborted();
53457
53460
  let i = setTimeout(r, t6);
53458
53461
  e?.signal?.addEventListener("abort", () => {
53459
53462
  clearTimeout(i), n(e.signal?.reason);
53460
53463
  }, { once: true });
53461
53464
  });
53462
- function Ze(t6, e, r) {
53465
+ function et(t6, e, r) {
53463
53466
  let n = [];
53464
53467
  for (let i = 0; i < r - 1; i++) {
53465
53468
  let o2 = t6.indexOf(e);
@@ -53468,30 +53471,30 @@ function Ze(t6, e, r) {
53468
53471
  }
53469
53472
  return n.push(t6), n;
53470
53473
  }
53471
- function Bt(t6) {
53474
+ function Wt(t6) {
53472
53475
  return t6.sort((e, r) => e.localeCompare(r));
53473
53476
  }
53474
- function pn(t6) {
53477
+ function fn(t6) {
53475
53478
  return t6.endsWith("/") ? t6 : t6 + "/";
53476
53479
  }
53477
- function ia(t6) {
53480
+ function oa(t6) {
53478
53481
  return t6.startsWith("/") ? t6.slice(1) : t6;
53479
53482
  }
53480
- function W(t6, e) {
53481
- return new URL(ia(e), pn(t6.toString())).toString();
53483
+ function q(t6, e) {
53484
+ return new URL(oa(e), fn(t6.toString())).toString();
53482
53485
  }
53483
- function ji(t6, e) {
53484
- return W(t6, e).toString().replace("http://", "ws://").replace("https://", "wss://");
53486
+ function Hi(t6, e) {
53487
+ return q(t6, e).toString().replace("http://", "ws://").replace("https://", "wss://");
53485
53488
  }
53486
- function Hi(t6) {
53489
+ function Gi(t6) {
53487
53490
  return typeof t6 == "object" && !Array.isArray(t6) && !(t6 instanceof URLSearchParams) && (t6 = Object.fromEntries(Object.entries(t6).filter((e) => e[1] !== void 0))), new URLSearchParams(t6).toString();
53488
53491
  }
53489
- var oa = /^(([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])$/;
53490
- function yp(t6) {
53491
- return oa.test(t6);
53492
+ var sa = /^(([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])$/;
53493
+ function xp(t6) {
53494
+ return sa.test(t6);
53492
53495
  }
53493
53496
  var x = Object.freeze([]);
53494
- function ut(t6, e) {
53497
+ function lt(t6, e) {
53495
53498
  if (!t6) return "";
53496
53499
  let r = [];
53497
53500
  if (t6.prefix && e?.prefix !== false && r.push(...t6.prefix), t6.given && r.push(...t6.given), t6.family && r.push(t6.family), t6.suffix && e?.suffix !== false && r.push(...t6.suffix), t6.use && (e?.all || e?.use) && r.push("[" + t6.use + "]"), r.length === 0) {
@@ -53500,20 +53503,20 @@ function ut(t6, e) {
53500
53503
  }
53501
53504
  return r.join(" ").trim();
53502
53505
  }
53503
- function Wt(t6) {
53506
+ function qt(t6) {
53504
53507
  return t6 instanceof Date && !Number.isNaN(t6.getTime());
53505
53508
  }
53506
- function Xe(t6, e, r) {
53509
+ function Ze(t6, e, r) {
53507
53510
  if (!t6) return "";
53508
53511
  let n = new Date(t6);
53509
- return Wt(n) ? n.toLocaleString(e, r) : "";
53512
+ return qt(n) ? n.toLocaleString(e, r) : "";
53510
53513
  }
53511
53514
  function ve(t6) {
53512
53515
  if (!t6) return "";
53513
53516
  let e = Ne(t6.text);
53514
- return e || (t6.coding ? t6.coding.map((r) => Qi(r)).join(", ") : "");
53517
+ return e || (t6.coding ? t6.coding.map((r) => zi(r)).join(", ") : "");
53515
53518
  }
53516
- function Qi(t6, e) {
53519
+ function zi(t6, e) {
53517
53520
  let r = Ne(t6?.display);
53518
53521
  if (r) {
53519
53522
  let n = e ? Ne(t6?.code) : void 0;
@@ -53525,32 +53528,32 @@ function Ne(t6) {
53525
53528
  return typeof t6 == "string" ? t6 : void 0;
53526
53529
  }
53527
53530
  var p = { Address: "Address", Age: "Age", Annotation: "Annotation", Attachment: "Attachment", BackboneElement: "BackboneElement", CodeableConcept: "CodeableConcept", Coding: "Coding", ContactDetail: "ContactDetail", ContactPoint: "ContactPoint", Contributor: "Contributor", Count: "Count", DataRequirement: "DataRequirement", Distance: "Distance", Dosage: "Dosage", Duration: "Duration", Element: "Element", ElementDefinition: "ElementDefinition", Expression: "Expression", Extension: "Extension", HumanName: "HumanName", Identifier: "Identifier", MarketingStatus: "MarketingStatus", Meta: "Meta", Money: "Money", MoneyQuantity: "MoneyQuantity", Narrative: "Narrative", ParameterDefinition: "ParameterDefinition", Period: "Period", Population: "Population", ProdCharacteristic: "ProdCharacteristic", ProductShelfLife: "ProductShelfLife", Quantity: "Quantity", Range: "Range", Ratio: "Ratio", Reference: "Reference", RelatedArtifact: "RelatedArtifact", SampledData: "SampledData", Signature: "Signature", SimpleQuantity: "SimpleQuantity", SubstanceAmount: "SubstanceAmount", SystemString: "http://hl7.org/fhirpath/System.String", Timing: "Timing", TriggerDefinition: "TriggerDefinition", UsageContext: "UsageContext", base64Binary: "base64Binary", boolean: "boolean", canonical: "canonical", code: "code", date: "date", dateTime: "dateTime", decimal: "decimal", id: "id", instant: "instant", integer: "integer", markdown: "markdown", oid: "oid", positiveInt: "positiveInt", string: "string", time: "time", unsignedInt: "unsignedInt", uri: "uri", url: "url", uuid: "uuid", xhtml: "xhtml" };
53528
- function Ri(t6) {
53531
+ function Pi(t6) {
53529
53532
  let e = Array.isArray(t6) ? t6 : t6.entry?.map((r) => r.resource) ?? [];
53530
- for (let r of e) r?.resourceType === "StructureDefinition" && r.kind === "resource" && Ki(r.type);
53533
+ for (let r of e) r?.resourceType === "StructureDefinition" && r.kind === "resource" && Yi(r.type);
53531
53534
  }
53532
- function Ki(t6) {
53535
+ function Yi(t6) {
53533
53536
  let e = G.types[t6];
53534
53537
  return e || (e = { searchParamsDetails: {} }, G.types[t6] = e), !e.searchParams && t6 !== "Binary" && (e.searchParams = { _id: { base: [t6], code: "_id", type: "token", expression: t6 + ".id" }, _lastUpdated: { base: [t6], code: "_lastUpdated", type: "date", expression: t6 + ".meta.lastUpdated" }, _compartment: { base: [t6], code: "_compartment", type: "reference", expression: t6 + ".meta.compartment" }, _profile: { base: [t6], code: "_profile", type: "uri", expression: t6 + ".meta.profile" }, _security: { base: [t6], code: "_security", type: "token", expression: t6 + ".meta.security" }, _source: { base: [t6], code: "_source", type: "uri", expression: t6 + ".meta.source" }, _tag: { base: [t6], code: "_tag", type: "token", expression: t6 + ".meta.tag" }, _project: { base: [t6], code: "_project", type: "token", expression: t6 + ".meta.project" } }), e;
53535
53538
  }
53536
- function fn(t6) {
53539
+ function mn(t6) {
53537
53540
  for (let e of t6.base ?? x) {
53538
- let r = Ki(e);
53541
+ let r = Yi(e);
53539
53542
  r.searchParams || (r.searchParams = {}), r.searchParams[t6.code] = t6;
53540
53543
  }
53541
53544
  }
53542
- function Ur(t6) {
53545
+ function Br(t6) {
53543
53546
  let e = t6.type?.[0]?.code;
53544
- return e === "BackboneElement" || e === "Element" ? ga((t6.base?.path ?? t6.path)?.split(".")) : e;
53547
+ return e === "BackboneElement" || e === "Element" ? ya((t6.base?.path ?? t6.path)?.split(".")) : e;
53545
53548
  }
53546
- function ga(t6) {
53547
- return t6.length === 1 ? t6[0] : t6.map(U).join("");
53549
+ function ya(t6) {
53550
+ return t6.length === 1 ? t6[0] : t6.map(B).join("");
53548
53551
  }
53549
- function Nt(t6, e, r) {
53552
+ function Ft(t6, e, r) {
53550
53553
  let n = De(t6, r);
53551
- if (n) return Yi(n.elements, e);
53554
+ if (n) return Xi(n.elements, e);
53552
53555
  }
53553
- function Yi(t6, e) {
53556
+ function Xi(t6, e) {
53554
53557
  let r = t6[e] ?? t6[e + "[x]"];
53555
53558
  if (r) return r;
53556
53559
  for (let n = 0; n < e.length; n++) {
@@ -53568,7 +53571,7 @@ function Y(t6, e) {
53568
53571
  return t6 && typeof t6 == "object" && "reference" in t6 && typeof t6.reference == "string" ? e ? t6.reference.match(new RegExp(`^${e}(/|\\?)`)) !== null : true : false;
53569
53572
  }
53570
53573
  var G = { types: {} };
53571
- function et(t6) {
53574
+ function tt(t6) {
53572
53575
  if (t6.startsWith("T")) return t6 + "T00:00:00.000Z".substring(t6.length);
53573
53576
  if (t6.length <= 10) return t6;
53574
53577
  try {
@@ -53578,6 +53581,9 @@ function et(t6) {
53578
53581
  }
53579
53582
  }
53580
53583
  var de = () => [];
53584
+ function dt(t6) {
53585
+ return t6 instanceof F ? t6.name : t6 instanceof ie && t6.left instanceof F && t6.right instanceof F ? t6.left.name + "." + t6.right.name : "";
53586
+ }
53581
53587
  var N = { empty: (t6, e) => y(e.every((r) => O(r.value))), hasValue: (t6, e) => y(e.length !== 0), exists: (t6, e, r) => r ? y(e.some((n) => H(r.eval(t6, [n])))) : y(e.length > 0 && e.every((n) => !O(n.value))), all: (t6, e, r) => y(e.every((n) => H(r.eval(t6, [n])))), allTrue: (t6, e) => {
53582
53588
  for (let r of e) if (!r.value) return y(false);
53583
53589
  return y(true);
@@ -53601,7 +53607,10 @@ var N = { empty: (t6, e) => y(e.every((r) => O(r.value))), hasValue: (t6, e) =>
53601
53607
  let r = [];
53602
53608
  for (let n of e) r.some((i) => i.value === n.value) || r.push(n);
53603
53609
  return r;
53604
- }, isDistinct: (t6, e) => y(e.length === N.distinct(t6, e).length), where: (t6, e, r) => e.filter((n) => H(r.eval(t6, [n]))), select: (t6, e, r) => e.flatMap((n) => r.eval({ parent: t6, variables: { $this: n } }, [n])), repeat: de, ofType: (t6, e, r) => e.filter((n) => n.type === r.name), single: (t6, e) => {
53610
+ }, isDistinct: (t6, e) => y(e.length === N.distinct(t6, e).length), where: (t6, e, r) => e.filter((n) => H(r.eval(t6, [n]))), select: (t6, e, r) => e.flatMap((n) => r.eval({ parent: t6, variables: { $this: n } }, [n])), repeat: de, ofType: (t6, e, r) => {
53611
+ let n = dt(r);
53612
+ return n ? e.filter((i) => Xe(i, n)) : [];
53613
+ }, single: (t6, e) => {
53605
53614
  if (e.length > 1) throw new Error("Expected input length one for single()");
53606
53615
  return e.length === 0 ? [] : e.slice(0, 1);
53607
53616
  }, first: (t6, e) => e.length === 0 ? [] : e.slice(0, 1), last: (t6, e) => e.length === 0 ? [] : e.slice(-1, e.length), tail: (t6, e) => e.length === 0 ? [] : e.slice(1, e.length), skip: (t6, e, r) => {
@@ -53625,7 +53634,7 @@ var N = { empty: (t6, e) => y(e.every((r) => O(r.value))), hasValue: (t6, e) =>
53625
53634
  }, union: (t6, e, r) => {
53626
53635
  if (!r) return e;
53627
53636
  let n = r.eval(t6, Fe(t6));
53628
- return Mt([...e, ...n]);
53637
+ return Lt([...e, ...n]);
53629
53638
  }, combine: (t6, e, r) => {
53630
53639
  if (!r) return e;
53631
53640
  let n = r.eval(t6, Fe(t6));
@@ -53652,11 +53661,11 @@ var N = { empty: (t6, e) => y(e.every((r) => O(r.value))), hasValue: (t6, e) =>
53652
53661
  }, convertsToInteger: (t6, e) => e.length === 0 ? [] : y(N.toInteger(t6, e).length === 1), toDate: (t6, e) => {
53653
53662
  if (e.length === 0) return [];
53654
53663
  let [{ value: r }] = ne(e, 1);
53655
- return typeof r == "string" && /^\d{4}(-\d{2}(-\d{2})?)?/.exec(r) ? [{ type: p.date, value: et(r) }] : [];
53664
+ return typeof r == "string" && /^\d{4}(-\d{2}(-\d{2})?)?/.exec(r) ? [{ type: p.date, value: tt(r) }] : [];
53656
53665
  }, convertsToDate: (t6, e) => e.length === 0 ? [] : y(N.toDate(t6, e).length === 1), toDateTime: (t6, e) => {
53657
53666
  if (e.length === 0) return [];
53658
53667
  let [{ value: r }] = ne(e, 1);
53659
- return typeof r == "string" && /^\d{4}(-\d{2}(-\d{2})?)?/.exec(r) ? [{ type: p.dateTime, value: et(r) }] : [];
53668
+ return typeof r == "string" && /^\d{4}(-\d{2}(-\d{2})?)?/.exec(r) ? [{ type: p.dateTime, value: tt(r) }] : [];
53660
53669
  }, convertsToDateTime: (t6, e) => e.length === 0 ? [] : y(N.toDateTime(t6, e).length === 1), toDecimal: (t6, e) => {
53661
53670
  if (e.length === 0) return [];
53662
53671
  let [{ value: r }] = ne(e, 1);
@@ -53674,7 +53683,7 @@ var N = { empty: (t6, e) => y(e.every((r) => O(r.value))), hasValue: (t6, e) =>
53674
53683
  let [{ value: r }] = ne(e, 1);
53675
53684
  if (typeof r == "string") {
53676
53685
  let n = /^T?(\d{2}(:\d{2}(:\d{2})?)?)/.exec(r);
53677
- if (n) return [{ type: p.time, value: et("T" + n[1]) }];
53686
+ if (n) return [{ type: p.time, value: tt("T" + n[1]) }];
53678
53687
  }
53679
53688
  return [];
53680
53689
  }, convertsToTime: (t6, e) => e.length === 0 ? [] : y(N.toTime(t6, e).length === 1), indexOf: (t6, e, r) => Q((n, i) => n.indexOf(i), t6, e, r), substring: (t6, e, r, n) => Q((i, o2, s) => {
@@ -53695,11 +53704,11 @@ var N = { empty: (t6, e) => y(e.every((r) => O(r.value))), hasValue: (t6, e) =>
53695
53704
  if (s.length === 0) throw new Error("Invalid end date");
53696
53705
  let a = i.eval(t6, e)[0]?.value;
53697
53706
  if (a !== "years" && a !== "months" && a !== "days") throw new Error("Invalid units");
53698
- let u2 = Ft(o2[0].value, s[0].value);
53707
+ let u2 = Ut(o2[0].value, s[0].value);
53699
53708
  return [{ type: p.Quantity, value: { value: u2[a], unit: a } }];
53700
53709
  }, is: (t6, e, r) => {
53701
- let n = "";
53702
- return r instanceof q ? n = r.name : r instanceof ie && (n = r.left.name + "." + r.right.name), n ? e.map((i) => ({ type: p.boolean, value: _t(i, n) })) : [];
53710
+ let n = dt(r);
53711
+ return n ? e.map((i) => ({ type: p.boolean, value: Xe(i, n) })) : [];
53703
53712
  }, not: (t6, e) => N.toBoolean(t6, e).map((r) => ({ type: p.boolean, value: !r.value })), resolve: (t6, e) => e.map((r) => {
53704
53713
  let n = r.value, i;
53705
53714
  if (typeof n == "string") i = n;
@@ -53718,8 +53727,10 @@ var N = { empty: (t6, e) => y(e.every((r) => O(r.value))), hasValue: (t6, e) =>
53718
53727
  }
53719
53728
  return { type: p.BackboneElement, value: void 0 };
53720
53729
  }).filter((r) => !!r.value), as: (t6, e, r) => {
53721
- let n = r.name, i = L(e, n);
53722
- return i ? [i] : [];
53730
+ let n = dt(r);
53731
+ if (!n) throw new Error(`Expected a valid type identifier as the right operand of 'as', but found ${r.toString()}`);
53732
+ let i = L(e);
53733
+ return i && Xe(i, n) ? [i] : [];
53723
53734
  }, type: (t6, e) => e.map(({ value: r }) => typeof r == "boolean" ? { type: p.BackboneElement, value: { namespace: "System", name: "Boolean" } } : typeof r == "number" ? { type: p.BackboneElement, value: { namespace: "System", name: "Integer" } } : D(r) ? { type: p.BackboneElement, value: { namespace: "FHIR", name: r.resourceType } } : { type: p.BackboneElement, value: null }), conformsTo: (t6, e, r) => {
53724
53735
  let n = r.eval(t6, e)[0].value;
53725
53736
  if (!n.startsWith("http://hl7.org/fhir/StructureDefinition/")) throw new Error("Expected a StructureDefinition URL");
@@ -53732,7 +53743,7 @@ var N = { empty: (t6, e) => y(e.every((r) => O(r.value))), hasValue: (t6, e) =>
53732
53743
  let n = e[0].value;
53733
53744
  if (!n?.reference) return [];
53734
53745
  let i = "";
53735
- return r instanceof q && (i = r.name), i && !n.reference.startsWith(i + "/") ? [] : [{ type: p.id, value: _e(n) }];
53746
+ return r instanceof F && (i = r.name), i && !n.reference.startsWith(i + "/") ? [] : [{ type: p.id, value: _e(n) }];
53736
53747
  }, extension: (t6, e, r) => {
53737
53748
  let n = r.eval(t6, e)[0].value, i = e?.[0]?.value;
53738
53749
  if (i) {
@@ -53778,7 +53789,7 @@ var z = class {
53778
53789
  return typeof e == "string" ? `'${e}'` : e.toString();
53779
53790
  }
53780
53791
  };
53781
- var q = class {
53792
+ var F = class {
53782
53793
  constructor(e) {
53783
53794
  c(this, "name");
53784
53795
  this.name = e;
@@ -53797,13 +53808,13 @@ var q = class {
53797
53808
  }
53798
53809
  evalValue(e) {
53799
53810
  let r = e.value;
53800
- if (!(!r || typeof r != "object")) return D(r, this.name) ? ("path" in e || (e.path = r.resourceType), e) : zr(e, this.name);
53811
+ if (!(!r || typeof r != "object")) return D(r, this.name) ? ("path" in e || (e.path = r.resourceType), e) : Jr(e, this.name);
53801
53812
  }
53802
53813
  toString() {
53803
53814
  return this.name;
53804
53815
  }
53805
53816
  };
53806
- var qt = class {
53817
+ var $t = class {
53807
53818
  eval() {
53808
53819
  return [];
53809
53820
  }
@@ -53811,7 +53822,7 @@ var qt = class {
53811
53822
  return "{}";
53812
53823
  }
53813
53824
  };
53814
- var $t = class extends Et {
53825
+ var jt = class extends Pt {
53815
53826
  constructor(r, n, i) {
53816
53827
  super(r, n);
53817
53828
  c(this, "impl");
@@ -53832,7 +53843,7 @@ var Ee = class extends A {
53832
53843
  return N.as(e, this.left.eval(e, r), this.right);
53833
53844
  }
53834
53845
  };
53835
- var B = class extends A {
53846
+ var W = class extends A {
53836
53847
  constructor(r, n, i, o2) {
53837
53848
  super(r, n, i);
53838
53849
  c(this, "impl");
@@ -53845,19 +53856,19 @@ var B = class extends A {
53845
53856
  return typeof d == "boolean" ? y(d) : _(s) ? [{ type: p.Quantity, value: { ...s, value: d } }] : [E(d)];
53846
53857
  }
53847
53858
  };
53848
- var eo = Object.freeze({ type: "string", value: "" });
53849
- var jt = class extends A {
53859
+ var to = Object.freeze({ type: "string", value: "" });
53860
+ var Ht = class extends A {
53850
53861
  constructor(e, r) {
53851
53862
  super("&", e, r);
53852
53863
  }
53853
53864
  eval(e, r) {
53854
- let n = L(this.left.eval(e, r)) ?? eo, i = L(this.right.eval(e, r)) ?? eo;
53865
+ let n = L(this.left.eval(e, r)) ?? to, i = L(this.right.eval(e, r)) ?? to;
53855
53866
  if (typeof n.value != "string") throw new Error(`Expected string operand for &, but got ${n.type}`);
53856
53867
  if (typeof i.value != "string") throw new Error(`Expected string operand for &, but got ${i.type}`);
53857
53868
  return [{ type: p.string, value: n.value + i.value }];
53858
53869
  }
53859
53870
  };
53860
- var Ht = class extends A {
53871
+ var Gt = class extends A {
53861
53872
  constructor(e, r) {
53862
53873
  super("contains", e, r);
53863
53874
  }
@@ -53866,13 +53877,13 @@ var Ht = class extends A {
53866
53877
  return y(n.some((o2) => o2.value === i[0].value));
53867
53878
  }
53868
53879
  };
53869
- var Gt = class extends A {
53880
+ var Qt = class extends A {
53870
53881
  constructor(e, r) {
53871
53882
  super("in", e, r);
53872
53883
  }
53873
53884
  eval(e, r) {
53874
53885
  let n = L(this.left.eval(e, r)), i = this.right.eval(e, r);
53875
- return n ? y(i.some((o2) => at(n, o2)[0].value)) : [];
53886
+ return n ? y(i.some((o2) => ct(n, o2)[0].value)) : [];
53876
53887
  }
53877
53888
  };
53878
53889
  var ie = class extends A {
@@ -53892,43 +53903,43 @@ var Ue = class extends A {
53892
53903
  }
53893
53904
  eval(e, r) {
53894
53905
  let n = this.left.eval(e, r), i = this.right.eval(e, r);
53895
- return Mt([...n, ...i]);
53906
+ return Lt([...n, ...i]);
53896
53907
  }
53897
53908
  };
53898
- var Qt = class extends A {
53909
+ var zt = class extends A {
53899
53910
  constructor(e, r) {
53900
53911
  super("=", e, r);
53901
53912
  }
53902
53913
  eval(e, r) {
53903
53914
  let n = this.left.eval(e, r), i = this.right.eval(e, r);
53904
- return Oi(n, i);
53915
+ return Ii(n, i);
53905
53916
  }
53906
53917
  };
53907
- var zt = class extends A {
53918
+ var Jt = class extends A {
53908
53919
  constructor(e, r) {
53909
53920
  super("!=", e, r);
53910
53921
  }
53911
53922
  eval(e, r) {
53912
53923
  let n = this.left.eval(e, r), i = this.right.eval(e, r);
53913
- return Ii(n, i);
53924
+ return ki(n, i);
53914
53925
  }
53915
53926
  };
53916
- var Jt = class extends A {
53927
+ var Kt = class extends A {
53917
53928
  constructor(e, r) {
53918
53929
  super("~", e, r);
53919
53930
  }
53920
53931
  eval(e, r) {
53921
53932
  let n = this.left.eval(e, r), i = this.right.eval(e, r);
53922
- return en(n, i);
53933
+ return tn(n, i);
53923
53934
  }
53924
53935
  };
53925
- var Kt = class extends A {
53936
+ var Yt = class extends A {
53926
53937
  constructor(e, r) {
53927
53938
  super("!~", e, r);
53928
53939
  }
53929
53940
  eval(e, r) {
53930
53941
  let n = this.left.eval(e, r), i = this.right.eval(e, r);
53931
- return wi(en(n, i));
53942
+ return Oi(tn(n, i));
53932
53943
  }
53933
53944
  };
53934
53945
  var Be = class extends A {
@@ -53938,11 +53949,11 @@ var Be = class extends A {
53938
53949
  eval(e, r) {
53939
53950
  let n = this.left.eval(e, r);
53940
53951
  if (n.length !== 1) return [];
53941
- let i = this.right.name;
53942
- return y(_t(n[0], i));
53952
+ let i = dt(this.right);
53953
+ return i ? y(Xe(n[0], i)) : [];
53943
53954
  }
53944
53955
  };
53945
- var Yt = class extends A {
53956
+ var Xt = class extends A {
53946
53957
  constructor(e, r) {
53947
53958
  super("and", e, r);
53948
53959
  }
@@ -53951,7 +53962,7 @@ var Yt = class extends A {
53951
53962
  return n?.value === true && i?.value === true ? y(true) : n?.value === false || i?.value === false ? y(false) : [];
53952
53963
  }
53953
53964
  };
53954
- var Xt = class extends A {
53965
+ var Zt = class extends A {
53955
53966
  constructor(e, r) {
53956
53967
  super("or", e, r);
53957
53968
  }
@@ -53960,7 +53971,7 @@ var Xt = class extends A {
53960
53971
  return n?.value === false && i?.value === false ? y(false) : n?.value || i?.value ? y(true) : [];
53961
53972
  }
53962
53973
  };
53963
- var Zt = class extends A {
53974
+ var er = class extends A {
53964
53975
  constructor(e, r) {
53965
53976
  super("xor", e, r);
53966
53977
  }
@@ -53969,7 +53980,7 @@ var Zt = class extends A {
53969
53980
  return !n || !i ? [] : y(n.value !== i.value);
53970
53981
  }
53971
53982
  };
53972
- var er = class extends A {
53983
+ var tr = class extends A {
53973
53984
  constructor(e, r) {
53974
53985
  super("implies", e, r);
53975
53986
  }
@@ -54011,44 +54022,44 @@ var We = class {
54011
54022
  return `${this.left.toString()}[${this.expr.toString()}]`;
54012
54023
  }
54013
54024
  };
54014
- var dt = ["!=", "!~", "<=", ">=", "{}", "->"];
54025
+ var ft = ["!=", "!~", "<=", ">=", "{}", "->"];
54015
54026
  var S = { 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 };
54016
- var Ea = { parse(t6) {
54027
+ var Ra = { parse(t6) {
54017
54028
  let e = t6.consumeAndParse();
54018
54029
  if (!t6.match(")")) throw new Error("Parse error: expected `)` got `" + t6.peek()?.value + "`");
54019
54030
  return e;
54020
54031
  } };
54021
- var Ra = { parse(t6, e) {
54032
+ var Pa = { parse(t6, e) {
54022
54033
  let r = t6.consumeAndParse();
54023
54034
  if (!t6.match("]")) throw new Error("Parse error: expected `]`");
54024
54035
  return new We(e, r);
54025
54036
  }, precedence: S.Indexer };
54026
- var Pa = { parse(t6, e) {
54027
- if (!(e instanceof q)) throw new Error("Unexpected parentheses");
54037
+ var Ca = { parse(t6, e) {
54038
+ if (!(e instanceof F)) throw new Error("Unexpected parentheses");
54028
54039
  let r = [];
54029
54040
  for (; !t6.match(")"); ) r.push(t6.consumeAndParse()), t6.match(",");
54030
54041
  return new oe(e.name, r);
54031
54042
  }, precedence: S.FunctionCall };
54032
- function Ca(t6) {
54043
+ function Aa(t6) {
54033
54044
  let e = t6.split(" "), r = Number.parseFloat(e[0]), n = e[1];
54034
54045
  return n?.startsWith("'") && n.endsWith("'") ? n = n.substring(1, n.length - 1) : n = "{" + n + "}", { value: r, unit: n };
54035
54046
  }
54036
- function pt() {
54037
- return new Rt().registerPrefix("String", { parse: (t6, e) => new z({ type: p.string, value: e.value }) }).registerPrefix("DateTime", { parse: (t6, e) => new z({ type: p.dateTime, value: et(e.value) }) }).registerPrefix("Quantity", { parse: (t6, e) => new z({ type: p.Quantity, value: Ca(e.value) }) }).registerPrefix("Number", { parse: (t6, e) => new z({ type: e.value.includes(".") ? p.decimal : p.integer, value: Number.parseFloat(e.value) }) }).registerPrefix("true", { parse: () => new z({ type: p.boolean, value: true }) }).registerPrefix("false", { parse: () => new z({ type: p.boolean, value: false }) }).registerPrefix("Symbol", { parse: (t6, e) => new q(e.value) }).registerPrefix("{}", { parse: () => new qt() }).registerPrefix("(", Ea).registerInfix("[", Ra).registerInfix("(", Pa).prefix("+", S.UnaryAdd, (t6, e) => new $t("+", e, (r) => r)).prefix("-", S.UnarySubtract, (t6, e) => new B("-", e, e, (r, n) => -n)).infixLeft(".", S.Dot, (t6, e, r) => new ie(t6, r)).infixLeft("/", S.Divide, (t6, e, r) => new B("/", t6, r, (n, i) => n / i)).infixLeft("*", S.Multiply, (t6, e, r) => new B("*", t6, r, (n, i) => n * i)).infixLeft("+", S.Add, (t6, e, r) => new B("+", t6, r, (n, i) => n + i)).infixLeft("-", S.Subtract, (t6, e, r) => new B("-", t6, r, (n, i) => n - i)).infixLeft("|", S.Union, (t6, e, r) => new Ue(t6, r)).infixLeft("=", S.Equals, (t6, e, r) => new Qt(t6, r)).infixLeft("!=", S.NotEquals, (t6, e, r) => new zt(t6, r)).infixLeft("~", S.Equivalent, (t6, e, r) => new Jt(t6, r)).infixLeft("!~", S.NotEquivalent, (t6, e, r) => new Kt(t6, r)).infixLeft("<", S.LessThan, (t6, e, r) => new B("<", t6, r, (n, i) => n < i)).infixLeft("<=", S.LessThanOrEquals, (t6, e, r) => new B("<=", t6, r, (n, i) => n <= i)).infixLeft(">", S.GreaterThan, (t6, e, r) => new B(">", t6, r, (n, i) => n > i)).infixLeft(">=", S.GreaterThanOrEquals, (t6, e, r) => new B(">=", t6, r, (n, i) => n >= i)).infixLeft("&", S.Ampersand, (t6, e, r) => new jt(t6, r)).infixLeft("and", S.And, (t6, e, r) => new Yt(t6, r)).infixLeft("as", S.As, (t6, e, r) => new Ee(t6, r)).infixLeft("contains", S.Contains, (t6, e, r) => new Ht(t6, r)).infixLeft("div", S.Divide, (t6, e, r) => new B("div", t6, r, (n, i) => Math.trunc(n / i))).infixLeft("in", S.In, (t6, e, r) => new Gt(t6, r)).infixLeft("is", S.Is, (t6, e, r) => new Be(t6, r)).infixLeft("mod", S.Modulo, (t6, e, r) => new B("mod", t6, r, (n, i) => n % i)).infixLeft("or", S.Or, (t6, e, r) => new Xt(t6, r)).infixLeft("xor", S.Xor, (t6, e, r) => new Zt(t6, r)).infixLeft("implies", S.Implies, (t6, e, r) => new er(t6, r));
54047
+ function mt() {
54048
+ return new Ct().registerPrefix("String", { parse: (t6, e) => new z({ type: p.string, value: e.value }) }).registerPrefix("DateTime", { parse: (t6, e) => new z({ type: p.dateTime, value: tt(e.value) }) }).registerPrefix("Quantity", { parse: (t6, e) => new z({ type: p.Quantity, value: Aa(e.value) }) }).registerPrefix("Number", { parse: (t6, e) => new z({ type: e.value.includes(".") ? p.decimal : p.integer, value: Number.parseFloat(e.value) }) }).registerPrefix("true", { parse: () => new z({ type: p.boolean, value: true }) }).registerPrefix("false", { parse: () => new z({ type: p.boolean, value: false }) }).registerPrefix("Symbol", { parse: (t6, e) => new F(e.value) }).registerPrefix("{}", { parse: () => new $t() }).registerPrefix("(", Ra).registerInfix("[", Pa).registerInfix("(", Ca).prefix("+", S.UnaryAdd, (t6, e) => new jt("+", e, (r) => r)).prefix("-", S.UnarySubtract, (t6, e) => new W("-", e, e, (r, n) => -n)).infixLeft(".", S.Dot, (t6, e, r) => new ie(t6, r)).infixLeft("/", S.Divide, (t6, e, r) => new W("/", t6, r, (n, i) => n / i)).infixLeft("*", S.Multiply, (t6, e, r) => new W("*", t6, r, (n, i) => n * i)).infixLeft("+", S.Add, (t6, e, r) => new W("+", t6, r, (n, i) => n + i)).infixLeft("-", S.Subtract, (t6, e, r) => new W("-", t6, r, (n, i) => n - i)).infixLeft("|", S.Union, (t6, e, r) => new Ue(t6, r)).infixLeft("=", S.Equals, (t6, e, r) => new zt(t6, r)).infixLeft("!=", S.NotEquals, (t6, e, r) => new Jt(t6, r)).infixLeft("~", S.Equivalent, (t6, e, r) => new Kt(t6, r)).infixLeft("!~", S.NotEquivalent, (t6, e, r) => new Yt(t6, r)).infixLeft("<", S.LessThan, (t6, e, r) => new W("<", t6, r, (n, i) => n < i)).infixLeft("<=", S.LessThanOrEquals, (t6, e, r) => new W("<=", t6, r, (n, i) => n <= i)).infixLeft(">", S.GreaterThan, (t6, e, r) => new W(">", t6, r, (n, i) => n > i)).infixLeft(">=", S.GreaterThanOrEquals, (t6, e, r) => new W(">=", t6, r, (n, i) => n >= i)).infixLeft("&", S.Ampersand, (t6, e, r) => new Ht(t6, r)).infixLeft("and", S.And, (t6, e, r) => new Xt(t6, r)).infixLeft("as", S.As, (t6, e, r) => new Ee(t6, r)).infixLeft("contains", S.Contains, (t6, e, r) => new Gt(t6, r)).infixLeft("div", S.Divide, (t6, e, r) => new W("div", t6, r, (n, i) => Math.trunc(n / i))).infixLeft("in", S.In, (t6, e, r) => new Qt(t6, r)).infixLeft("is", S.Is, (t6, e, r) => new Be(t6, r)).infixLeft("mod", S.Modulo, (t6, e, r) => new W("mod", t6, r, (n, i) => n % i)).infixLeft("or", S.Or, (t6, e, r) => new Zt(t6, r)).infixLeft("xor", S.Xor, (t6, e, r) => new er(t6, r)).infixLeft("implies", S.Implies, (t6, e, r) => new tr(t6, r));
54038
54049
  }
54039
- var Aa = pt();
54050
+ var wa = mt();
54040
54051
  var g = { 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" };
54041
- var mn = { contains: g.CONTAINS, exact: g.EXACT, above: g.ABOVE, below: g.BELOW, text: g.TEXT, not: g.NOT, in: g.IN, "not-in": g.NOT_IN, "of-type": g.OF_TYPE, missing: g.MISSING, identifier: g.IDENTIFIER, iterate: g.ITERATE };
54042
- var hn = { eq: g.EQUALS, ne: g.NOT_EQUALS, lt: g.LESS_THAN, le: g.LESS_THAN_OR_EQUALS, gt: g.GREATER_THAN, ge: g.GREATER_THAN_OR_EQUALS, sa: g.STARTS_AFTER, eb: g.ENDS_BEFORE, ap: g.APPROXIMATELY, sw: g.STARTS_WITH };
54043
- var _a = [g.MISSING, g.PRESENT];
54044
- var ja = new Z(1e3);
54052
+ var hn = { contains: g.CONTAINS, exact: g.EXACT, above: g.ABOVE, below: g.BELOW, text: g.TEXT, not: g.NOT, in: g.IN, "not-in": g.NOT_IN, "of-type": g.OF_TYPE, missing: g.MISSING, identifier: g.IDENTIFIER, iterate: g.ITERATE };
54053
+ var gn = { eq: g.EQUALS, ne: g.NOT_EQUALS, lt: g.LESS_THAN, le: g.LESS_THAN_OR_EQUALS, gt: g.GREATER_THAN, ge: g.GREATER_THAN_OR_EQUALS, sa: g.STARTS_AFTER, eb: g.ENDS_BEFORE, ap: g.APPROXIMATELY, sw: g.STARTS_WITH };
54054
+ var La = [g.MISSING, g.PRESENT];
54055
+ var Ha = new Z(1e3);
54045
54056
  var $e = { READ: "read", VREAD: "vread", UPDATE: "update", DELETE: "delete", HISTORY: "history", CREATE: "create", SEARCH: "search" };
54046
- var nc = [$e.READ, $e.VREAD, $e.HISTORY, $e.SEARCH];
54047
- var Xf = { FIRST: "first", APPLICATION: "application" };
54057
+ var ic = [$e.READ, $e.VREAD, $e.HISTORY, $e.SEARCH];
54058
+ var Zf = { FIRST: "first", APPLICATION: "application" };
54048
54059
  function X() {
54049
54060
  return typeof window < "u";
54050
54061
  }
54051
- function gn() {
54062
+ function yn() {
54052
54063
  return typeof Buffer < "u" ? Buffer : void 0;
54053
54064
  }
54054
54065
  var pe = { assign(t6) {
@@ -54064,34 +54075,34 @@ var pe = { assign(t6) {
54064
54075
  }, getOrigin() {
54065
54076
  return X() ? globalThis.location.protocol + "//" + globalThis.location.host + "/" : "";
54066
54077
  } };
54067
- function sc(t6) {
54078
+ function ac(t6) {
54068
54079
  if (X()) {
54069
54080
  let r = window.atob(t6), n = Uint8Array.from(r, (i) => i.codePointAt(0));
54070
54081
  return new window.TextDecoder().decode(n);
54071
54082
  }
54072
- let e = gn();
54083
+ let e = yn();
54073
54084
  if (e) return e.from(t6, "base64").toString("utf-8");
54074
54085
  throw new Error("Unable to decode base64");
54075
54086
  }
54076
- function ir(t6) {
54087
+ function or(t6) {
54077
54088
  if (X()) {
54078
54089
  let r = new window.TextEncoder().encode(t6), n = String.fromCodePoint.apply(null, r);
54079
54090
  return window.btoa(n);
54080
54091
  }
54081
- let e = gn();
54092
+ let e = yn();
54082
54093
  if (e) return e.from(t6, "utf8").toString("base64");
54083
54094
  throw new Error("Unable to encode base64");
54084
54095
  }
54085
- function or(t6) {
54096
+ function sr(t6) {
54086
54097
  t6 = t6.padEnd(t6.length + (4 - t6.length % 4) % 4, "=");
54087
54098
  let e = t6.replaceAll("-", "+").replaceAll("_", "/");
54088
- return sc(e);
54099
+ return ac(e);
54089
54100
  }
54090
- function yn() {
54101
+ function xn() {
54091
54102
  let t6 = new Uint32Array(28);
54092
- return crypto.getRandomValues(t6), Fi(t6.buffer);
54103
+ return crypto.getRandomValues(t6), Ui(t6.buffer);
54093
54104
  }
54094
- async function mo(t6) {
54105
+ async function ho(t6) {
54095
54106
  return crypto.subtle.digest("SHA-256", new TextEncoder().encode(t6));
54096
54107
  }
54097
54108
  function se() {
@@ -54101,7 +54112,7 @@ function se() {
54101
54112
  });
54102
54113
  }
54103
54114
  var M = { CSS: "text/css", DICOM: "application/dicom", FAVICON: "image/vnd.microsoft.icon", FHIR_JSON: "application/fhir+json", FORM_URL_ENCODED: "application/x-www-form-urlencoded", HL7_V2: "x-application/hl7-v2+er7", HTML: "text/html", JAVASCRIPT: "text/javascript", JOSE: "application/jose", JSON: "application/json", JSON_PATCH: "application/json-patch+json", JWT: "application/jwt", MULTIPART_FORM_DATA: "multipart/form-data", PNG: "image/png", SCIM_JSON: "application/scim+json", SVG: "image/svg+xml", TEXT: "text/plain", TYPESCRIPT: "text/typescript", PING: "x-application/ping", XML: "text/xml", CDA_XML: "application/cda+xml", OCTET_STREAM: "application/octet-stream" };
54104
- var xn = class {
54115
+ var vn = class {
54105
54116
  constructor() {
54106
54117
  c(this, "listeners");
54107
54118
  this.listeners = {};
@@ -54132,7 +54143,7 @@ var xn = class {
54132
54143
  };
54133
54144
  var ae = class {
54134
54145
  constructor() {
54135
- c(this, "emitter", new xn());
54146
+ c(this, "emitter", new vn());
54136
54147
  }
54137
54148
  dispatchEvent(e) {
54138
54149
  this.emitter.dispatchEvent(e);
@@ -54150,76 +54161,76 @@ var ae = class {
54150
54161
  return this.emitter.listenerCount(e);
54151
54162
  }
54152
54163
  };
54153
- var vn = { "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" };
54154
- var yc = ["Patient", "Encounter", "ImagingStudy", "DiagnosticReport", "OperationOutcome", "Bundle"];
54155
- var Tn = ["DiagnosticReport-update"];
54156
- function go(t6) {
54157
- return Tn.includes(t6);
54158
- }
54164
+ var Tn = { "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" };
54165
+ var xc = ["Patient", "Encounter", "ImagingStudy", "DiagnosticReport", "OperationOutcome", "Bundle"];
54166
+ var Sn = ["DiagnosticReport-update"];
54159
54167
  function yo(t6) {
54160
- if (Tn.includes(t6)) throw new m(T(`'context.version' is required for '${t6}'.`));
54161
- }
54162
- var xc = { "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" } } };
54163
- function vc(t6) {
54164
- return yc.includes(t6);
54168
+ return Sn.includes(t6);
54165
54169
  }
54166
54170
  function xo(t6) {
54171
+ if (Sn.includes(t6)) throw new m(T(`'context.version' is required for '${t6}'.`));
54172
+ }
54173
+ var vc = { "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" } } };
54174
+ function Tc(t6) {
54175
+ return xc.includes(t6);
54176
+ }
54177
+ function vo(t6) {
54167
54178
  return !!t6.endpoint;
54168
54179
  }
54169
- function Sn(t6) {
54170
- if (!ar(t6)) throw new m(T("subscriptionRequest must be an object conforming to SubscriptionRequest type."));
54180
+ function bn(t6) {
54181
+ if (!cr(t6)) throw new m(T("subscriptionRequest must be an object conforming to SubscriptionRequest type."));
54171
54182
  let { channelType: e, mode: r, topic: n, events: i } = t6, o2 = { "hub.channel.type": e, "hub.mode": r, "hub.topic": n, "hub.events": i.join(",") };
54172
- return xo(t6) && (o2.endpoint = t6.endpoint), new URLSearchParams(o2).toString();
54183
+ return vo(t6) && (o2.endpoint = t6.endpoint), new URLSearchParams(o2).toString();
54173
54184
  }
54174
- function ar(t6) {
54185
+ function cr(t6) {
54175
54186
  if (typeof t6 != "object") return false;
54176
54187
  let { channelType: e, mode: r, topic: n, events: i } = t6;
54177
54188
  if (!(e && r && n && i) || typeof n != "string" || typeof i != "object" || !Array.isArray(i) || i.length < 1 || e !== "websocket" || r !== "subscribe" && r !== "unsubscribe") return false;
54178
- for (let o2 of i) if (!vn[o2]) return false;
54179
- return !(xo(t6) && !(typeof t6.endpoint == "string" && t6.endpoint.startsWith("ws")));
54189
+ for (let o2 of i) if (!Tn[o2]) return false;
54190
+ return !(vo(t6) && !(typeof t6.endpoint == "string" && t6.endpoint.startsWith("ws")));
54180
54191
  }
54181
- function Tc(t6, e, r, n) {
54192
+ function Sc(t6, e, r, n) {
54182
54193
  if (typeof e != "object") throw new m(T(`context[${r}] is invalid. Context must contain a single valid FHIR resource! Resource is not an object.`));
54183
54194
  if (!(e.id && typeof e.id == "string")) throw new m(T(`context[${r}] is invalid. Resource must contain a valid string ID.`));
54184
54195
  if (!e.resourceType) throw new m(T(`context[${r}] is invalid. Resource must contain a resource type. No resource type found.`));
54185
54196
  let i = n.resourceType;
54186
54197
  if (i !== "*") {
54187
- if (!vc(e.resourceType)) throw new m(T(`context[${r}] is invalid. Resource must contain a valid FHIRcast resource type. Resource type is not a known resource type.`));
54198
+ if (!Tc(e.resourceType)) throw new m(T(`context[${r}] is invalid. Resource must contain a valid FHIRcast resource type. Resource type is not a known resource type.`));
54188
54199
  if (i && e.resourceType !== i) throw new m(T(`context[${r}] is invalid. context[${r}] for the '${t6}' event should contain resource of type ${i}.`));
54189
54200
  }
54190
54201
  }
54191
- function Sc(t6, e, r, n, i) {
54202
+ function bc(t6, e, r, n, i) {
54192
54203
  if (i.set(e.key, (i.get(e.key) ?? 0) + 1), n.reference) {
54193
54204
  if (!Y(e.reference)) throw new m(T(`context[${r}] is invalid. Expected key '${e.key}' to be a reference.`));
54194
- } else Tc(t6, e.resource, r, n);
54205
+ } else Sc(t6, e.resource, r, n);
54195
54206
  }
54196
- function bc(t6, e) {
54197
- let r = /* @__PURE__ */ new Map(), n = xc[t6];
54207
+ function Ec(t6, e) {
54208
+ let r = /* @__PURE__ */ new Map(), n = vc[t6];
54198
54209
  for (let i = 0; i < e.length; i++) {
54199
54210
  let o2 = e[i].key;
54200
54211
  if (!n[o2]) throw new m(T(`Key '${o2}' not found for event '${t6}'. Make sure to add only valid keys.`));
54201
- Sc(t6, e[i], i, n[o2], r);
54212
+ bc(t6, e[i], i, n[o2], r);
54202
54213
  }
54203
54214
  for (let [i, o2] of Object.entries(n)) {
54204
54215
  if (!(o2.optional || r.has(i))) throw new m(T(`Missing required key '${i}' on context for '${t6}' event.`));
54205
54216
  if (!o2.manyAllowed && (r.get(i) ?? 0) > 1) throw new m(T(`${r.get(i)} context entries with key '${i}' found for the '${t6}' event when schema only allows for 1.`));
54206
54217
  }
54207
54218
  }
54208
- function bn(t6, e, r, n) {
54219
+ function En(t6, e, r, n) {
54209
54220
  if (!(t6 && typeof t6 == "string")) throw new m(T("Must provide a topic."));
54210
- if (!vn[e]) throw new m(T(`Must provide a valid FHIRcast event name. Supported events: ${Object.keys(vn).join(", ")}`));
54221
+ if (!Tn[e]) throw new m(T(`Must provide a valid FHIRcast event name. Supported events: ${Object.keys(Tn).join(", ")}`));
54211
54222
  if (typeof r != "object") throw new m(T("context must be a context object or array of context objects."));
54212
- if (Tn.includes(e) && !n) throw new m(T(`The '${e}' event must contain a 'context.versionId'.`));
54223
+ if (Sn.includes(e) && !n) throw new m(T(`The '${e}' event must contain a 'context.versionId'.`));
54213
54224
  let i = Array.isArray(r) ? r : [r];
54214
- return bc(e, i), { timestamp: (/* @__PURE__ */ new Date()).toISOString(), id: se(), event: { "hub.topic": t6, "hub.event": e, context: i, ...n ? { "context.versionId": n } : {} } };
54225
+ return Ec(e, i), { timestamp: (/* @__PURE__ */ new Date()).toISOString(), id: se(), event: { "hub.topic": t6, "hub.event": e, context: i, ...n ? { "context.versionId": n } : {} } };
54215
54226
  }
54216
- var sr = class extends ae {
54227
+ var ar = class extends ae {
54217
54228
  constructor(r) {
54218
54229
  super();
54219
54230
  c(this, "subRequest");
54220
54231
  c(this, "websocket");
54221
54232
  if (this.subRequest = r, !r.endpoint) throw new m(T("Subscription request should contain an endpoint."));
54222
- if (!ar(r)) throw new m(T("Subscription request failed validation."));
54233
+ if (!cr(r)) throw new m(T("Subscription request failed validation."));
54223
54234
  let n = new WebSocket(r.endpoint);
54224
54235
  n.addEventListener("open", () => {
54225
54236
  this.dispatchEvent({ type: "connect" }), n.addEventListener("message", (i) => {
@@ -54236,32 +54247,32 @@ var sr = class extends ae {
54236
54247
  this.websocket.close();
54237
54248
  }
54238
54249
  };
54239
- function Ec(t6) {
54240
- return JSON.parse(or(t6));
54250
+ function Rc(t6) {
54251
+ return JSON.parse(sr(t6));
54241
54252
  }
54242
- function vo(t6) {
54253
+ function To(t6) {
54243
54254
  return t6.split(".").length === 3;
54244
54255
  }
54245
- function cr(t6) {
54256
+ function ur(t6) {
54246
54257
  let [e, r, n] = t6.split(".");
54247
- return Ec(r);
54258
+ return Rc(r);
54248
54259
  }
54249
- function To(t6) {
54260
+ function So(t6) {
54250
54261
  try {
54251
- return typeof cr(t6).login_id == "string";
54262
+ return typeof ur(t6).login_id == "string";
54252
54263
  } catch {
54253
54264
  return false;
54254
54265
  }
54255
54266
  }
54256
- function So(t6) {
54267
+ function bo(t6) {
54257
54268
  try {
54258
- let r = cr(t6).exp;
54269
+ let r = ur(t6).exp;
54259
54270
  return typeof r == "number" ? r * 1e3 : void 0;
54260
54271
  } catch {
54261
54272
  return;
54262
54273
  }
54263
54274
  }
54264
- var ur = class {
54275
+ var lr = class {
54265
54276
  constructor(e) {
54266
54277
  c(this, "medplum");
54267
54278
  this.medplum = e;
@@ -54276,11 +54287,11 @@ var ur = class {
54276
54287
  await this.medplum.delete(`keyvalue/v1/${e}`);
54277
54288
  }
54278
54289
  };
54279
- var bo;
54280
- bo = Symbol.toStringTag;
54290
+ var Eo;
54291
+ Eo = Symbol.toStringTag;
54281
54292
  var $ = class {
54282
54293
  constructor(e) {
54283
- c(this, bo, "ReadablePromise");
54294
+ c(this, Eo, "ReadablePromise");
54284
54295
  c(this, "suspender");
54285
54296
  c(this, "status", "pending");
54286
54297
  c(this, "response");
@@ -54315,11 +54326,11 @@ var $ = class {
54315
54326
  return this.suspender.finally(e);
54316
54327
  }
54317
54328
  };
54318
- var ht = class {
54329
+ var yt = class {
54319
54330
  constructor(e, r = "") {
54320
54331
  c(this, "storage");
54321
54332
  c(this, "prefix", "");
54322
- this.storage = e ?? globalThis.localStorage ?? new En(), this.prefix = r;
54333
+ this.storage = e ?? globalThis.localStorage ?? new Rn(), this.prefix = r;
54323
54334
  }
54324
54335
  makeKey(e) {
54325
54336
  return this.prefix + e;
@@ -54340,10 +54351,10 @@ var ht = class {
54340
54351
  return r ? JSON.parse(r) : void 0;
54341
54352
  }
54342
54353
  setObject(e, r) {
54343
- this.setString(e, r ? Ut(r) : void 0);
54354
+ this.setString(e, r ? Bt(r) : void 0);
54344
54355
  }
54345
54356
  };
54346
- var En = class {
54357
+ var Rn = class {
54347
54358
  constructor() {
54348
54359
  c(this, "data");
54349
54360
  this.data = /* @__PURE__ */ new Map();
@@ -54368,8 +54379,8 @@ var En = class {
54368
54379
  }
54369
54380
  };
54370
54381
  var J = { Event: typeof globalThis.Event < "u" ? globalThis.Event : void 0, ErrorEvent: void 0, CloseEvent: void 0 };
54371
- var Ro = false;
54372
- function Rc() {
54382
+ var Po = false;
54383
+ function Pc() {
54373
54384
  if (typeof globalThis.Event > "u") throw new Error("Unable to lazy init events for ReconnectingWebSocket. globalThis.Event is not defined yet");
54374
54385
  J.Event = globalThis.Event, J.ErrorEvent = class extends Event {
54375
54386
  constructor(r, n) {
@@ -54388,12 +54399,12 @@ function Rc() {
54388
54399
  }
54389
54400
  };
54390
54401
  }
54391
- function Pc(t6, e) {
54402
+ function Cc(t6, e) {
54392
54403
  if (!t6) throw new Error(e);
54393
54404
  }
54394
- function Cc() {
54405
+ function Ac() {
54395
54406
  }
54396
- function lr(t6) {
54407
+ function dr(t6) {
54397
54408
  if (t6 instanceof J.CloseEvent) {
54398
54409
  let e = t6;
54399
54410
  return new J.CloseEvent(e.code, e.reason, void 0);
@@ -54404,15 +54415,15 @@ function lr(t6) {
54404
54415
  }
54405
54416
  return new t6.constructor(t6.type, t6);
54406
54417
  }
54407
- function Ac(t6, e) {
54418
+ function wc(t6, e) {
54408
54419
  let r = t6;
54409
54420
  return r.error instanceof Error ? new J.ErrorEvent(r.error, e) : new J.ErrorEvent(new Error(r.message || "WebSocket error"), e);
54410
54421
  }
54411
54422
  var je = { maxReconnectionDelay: 1e4, minReconnectionDelay: 1e3 + Math.random() * 4e3, minUptime: 5e3, reconnectionDelayGrowFactor: 1.3, connectionTimeout: 4e3, maxRetries: 1 / 0, maxEnqueuedMessages: 1 / 0, startClosed: false, debug: false };
54412
- var Po = false;
54413
- var dr = class t extends ae {
54423
+ var Co = false;
54424
+ var pr = class t extends ae {
54414
54425
  constructor(r, n, i = {}) {
54415
- Ro || (Rc(), Ro = true);
54426
+ Po || (Pc(), Po = true);
54416
54427
  super();
54417
54428
  c(this, "_ws");
54418
54429
  c(this, "_retryCount", -1);
@@ -54434,17 +54445,17 @@ var dr = class t extends ae {
54434
54445
  c(this, "_handleOpen", (r2) => {
54435
54446
  this._debug("open event");
54436
54447
  let { minUptime: n2 = je.minUptime } = this._options;
54437
- clearTimeout(this._connectTimeout), this._uptimeTimeout = setTimeout(() => this._acceptOpen(), n2), Pc(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(r2), this.dispatchEvent(lr(r2));
54448
+ clearTimeout(this._connectTimeout), this._uptimeTimeout = setTimeout(() => this._acceptOpen(), n2), Cc(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(r2), this.dispatchEvent(dr(r2));
54438
54449
  });
54439
54450
  c(this, "_handleMessage", (r2) => {
54440
- this._debug("message event"), this.onmessage && this.onmessage(r2), this.dispatchEvent(lr(r2));
54451
+ this._debug("message event"), this.onmessage && this.onmessage(r2), this.dispatchEvent(dr(r2));
54441
54452
  });
54442
54453
  c(this, "_handleError", (r2) => {
54443
- let n2 = Ac(r2, this);
54444
- this._debug("error event", n2.message), this._disconnect(void 0, n2.message === "TIMEOUT" ? "timeout" : void 0), this.onerror && this.onerror(n2), this._debug("exec error listeners"), this.dispatchEvent(lr(n2)), this._connect();
54454
+ let n2 = wc(r2, this);
54455
+ this._debug("error event", n2.message), this._disconnect(void 0, n2.message === "TIMEOUT" ? "timeout" : void 0), this.onerror && this.onerror(n2), this._debug("exec error listeners"), this.dispatchEvent(dr(n2)), this._connect();
54445
54456
  });
54446
54457
  c(this, "_handleClose", (r2) => {
54447
- this._debug("close event"), this._clearTimeouts(), this._shouldReconnect && this._connect(), this.onclose && this.onclose(r2), this.dispatchEvent(lr(r2));
54458
+ this._debug("close event"), this._clearTimeouts(), this._shouldReconnect && this._connect(), this.onclose && this.onclose(r2), this.dispatchEvent(dr(r2));
54448
54459
  });
54449
54460
  this._url = r, this._protocols = n, this._options = i, this._options.startClosed && (this._shouldReconnect = false), this._options.binaryType ? this._binaryType = this._options.binaryType : this._binaryType = "blob", this._options.debugLogger && (this._debugLogger = this._options.debugLogger), this._connect();
54450
54461
  }
@@ -54545,7 +54556,7 @@ var dr = class t extends ae {
54545
54556
  this._connectLock = false;
54546
54557
  return;
54547
54558
  }
54548
- !this._options.WebSocket && typeof WebSocket > "u" && !Po && (console.error("\u203C\uFE0F No WebSocket implementation available. You should define options.WebSocket."), Po = true);
54559
+ !this._options.WebSocket && typeof WebSocket > "u" && !Co && (console.error("\u203C\uFE0F No WebSocket implementation available. You should define options.WebSocket."), Co = true);
54549
54560
  let i = this._options.WebSocket || WebSocket;
54550
54561
  this._debug("connect", { url: this._url, protocols: this._protocols }), this._ws = this._protocols ? new i(this._url, this._protocols) : new i(this._url), this._ws.binaryType = this._binaryType, this._connectLock = false, this._addListeners(), this._connectTimeout = setTimeout(() => this._handleTimeout(), n);
54551
54562
  }).catch((i) => {
@@ -54558,7 +54569,7 @@ var dr = class t extends ae {
54558
54569
  _disconnect(r = 1e3, n) {
54559
54570
  if (this._clearTimeouts(), !this._ws) return;
54560
54571
  let i = this._ws;
54561
- this._removeListeners(), i.addEventListener("error", Cc);
54572
+ this._removeListeners(), i.addEventListener("error", Ac);
54562
54573
  try {
54563
54574
  i.close(r, n), this._handleClose(new J.CloseEvent(r, n, this));
54564
54575
  } catch {
@@ -54577,8 +54588,8 @@ var dr = class t extends ae {
54577
54588
  clearTimeout(this._connectTimeout), clearTimeout(this._uptimeTimeout);
54578
54589
  }
54579
54590
  };
54580
- var wc = [WebSocket.CLOSING, WebSocket.CLOSED];
54581
- var yt = class extends ae {
54591
+ var Oc = [WebSocket.CLOSING, WebSocket.CLOSED];
54592
+ var vt = class extends ae {
54582
54593
  constructor(...r) {
54583
54594
  super();
54584
54595
  c(this, "criteria");
@@ -54594,7 +54605,7 @@ var yt = class extends ae {
54594
54605
  this.criteria.delete(r);
54595
54606
  }
54596
54607
  };
54597
- var Rn = class {
54608
+ var Pn = class {
54598
54609
  constructor(e, r) {
54599
54610
  c(this, "criteria");
54600
54611
  c(this, "emitter");
@@ -54606,13 +54617,13 @@ var Rn = class {
54606
54617
  c(this, "state", "idle");
54607
54618
  c(this, "generation", 0);
54608
54619
  c(this, "lastUnrefTime");
54609
- this.criteria = e, this.emitter = new yt(e), this.refCount = 1, this.subscriptionProps = r ? { ...r } : void 0;
54620
+ this.criteria = e, this.emitter = new vt(e), this.refCount = 1, this.subscriptionProps = r ? { ...r } : void 0;
54610
54621
  }
54611
54622
  nextGeneration() {
54612
54623
  return ++this.generation;
54613
54624
  }
54614
54625
  };
54615
- var pr = class {
54626
+ var fr = class {
54616
54627
  constructor(e, r, n) {
54617
54628
  c(this, "medplum");
54618
54629
  c(this, "ws");
@@ -54625,15 +54636,15 @@ var pr = class {
54625
54636
  c(this, "pingIntervalMs");
54626
54637
  c(this, "waitingForPong", false);
54627
54638
  c(this, "currentProfile");
54628
- if (!(e instanceof fr)) throw new m(T("First arg of constructor should be a `MedplumClient`"));
54639
+ if (!(e instanceof mr)) throw new m(T("First arg of constructor should be a `MedplumClient`"));
54629
54640
  let i;
54630
54641
  try {
54631
54642
  i = new URL(r).toString();
54632
54643
  } catch {
54633
54644
  throw new m(T("Not a valid URL"));
54634
54645
  }
54635
- let o2 = n?.ReconnectingWebSocket ? new n.ReconnectingWebSocket(i, void 0, { debug: n?.debug, debugLogger: n?.debugLogger }) : new dr(i, void 0, { debug: n?.debug, debugLogger: n?.debugLogger });
54636
- this.medplum = e, this.ws = o2, this.masterSubEmitter = new yt(), this.criteriaEntries = /* @__PURE__ */ new Map(), this.criteriaEntriesBySubscriptionId = /* @__PURE__ */ new Map(), this.wsClosed = false, this.pingIntervalMs = n?.pingIntervalMs ?? 5e3, this.currentProfile = e.getProfile(), this.setupListeners();
54646
+ let o2 = n?.ReconnectingWebSocket ? new n.ReconnectingWebSocket(i, void 0, { debug: n?.debug, debugLogger: n?.debugLogger }) : new pr(i, void 0, { debug: n?.debug, debugLogger: n?.debugLogger });
54647
+ this.medplum = e, this.ws = o2, this.masterSubEmitter = new vt(), this.criteriaEntries = /* @__PURE__ */ new Map(), this.criteriaEntriesBySubscriptionId = /* @__PURE__ */ new Map(), this.wsClosed = false, this.pingIntervalMs = n?.pingIntervalMs ?? 5e3, this.currentProfile = e.getProfile(), this.setupListeners();
54637
54648
  }
54638
54649
  setupListeners() {
54639
54650
  let e = this.ws;
@@ -54725,7 +54736,7 @@ var pr = class {
54725
54736
  }
54726
54737
  getAllCriteriaEmitters() {
54727
54738
  let e = [];
54728
- for (let r of this.criteriaEntries.values()) for (let n of gt(r)) n.refCount > 0 && e.push(n.emitter);
54739
+ for (let r of this.criteriaEntries.values()) for (let n of xt(r)) n.refCount > 0 && e.push(n.emitter);
54729
54740
  return e;
54730
54741
  }
54731
54742
  addCriteriaEntry(e) {
@@ -54748,7 +54759,7 @@ var pr = class {
54748
54759
  async refreshAllSubscriptions() {
54749
54760
  this.criteriaEntriesBySubscriptionId.clear();
54750
54761
  let e = [], r = [];
54751
- for (let n of this.criteriaEntries.values()) for (let i of gt(n)) i.refCount === 0 ? r.push(i) : e.push(i);
54762
+ for (let n of this.criteriaEntries.values()) for (let i of xt(n)) i.refCount === 0 ? r.push(i) : e.push(i);
54752
54763
  for (let n of r) this.removeCriteriaEntry(n);
54753
54764
  for (let n of e) n.token && this.sendUnbind(n.token), n.token = void 0, n.tokenExpiry = void 0, n.subscriptionId = void 0, n.state = "idle", n.generation++, await this.subscribeToCriteria(n);
54754
54765
  }
@@ -54772,7 +54783,7 @@ var pr = class {
54772
54783
  checkTokenExpirations() {
54773
54784
  if (!this.medplum.getProfile()) return;
54774
54785
  let e = Date.now();
54775
- for (let r of this.criteriaEntries.values()) for (let n of gt(r)) n.refCount === 0 || !n.tokenExpiry || n.tokenExpiry - e <= 3e5 && n.state === "active" && this.ws.readyState === WebSocket.OPEN && (n.state = "refreshing", this.rebindCriteriaEntry(n).catch((i) => {
54786
+ for (let r of this.criteriaEntries.values()) for (let n of xt(r)) n.refCount === 0 || !n.tokenExpiry || n.tokenExpiry - e <= 3e5 && n.state === "active" && this.ws.readyState === WebSocket.OPEN && (n.state = "refreshing", this.rebindCriteriaEntry(n).catch((i) => {
54776
54787
  this.masterSubEmitter?.dispatchEvent({ type: "error", payload: i });
54777
54788
  }));
54778
54789
  }
@@ -54780,7 +54791,7 @@ var pr = class {
54780
54791
  this.masterSubEmitter && this.masterSubEmitter._addCriteria(e);
54781
54792
  let n = this.maybeGetCriteriaEntry(e, r);
54782
54793
  if (n) return n.refCount === 0 && (n.lastUnrefTime = void 0, n.generation++, n.state !== "active" && (n.state = n.token ? "active" : "idle")), n.refCount += 1, n.state === "idle" && this.subscribeToCriteria(n).catch(console.error), n.emitter;
54783
- let i = new Rn(e, r);
54794
+ let i = new Pn(e, r);
54784
54795
  return this.addCriteriaEntry(i), this.subscribeToCriteria(i).catch(console.error), i.emitter;
54785
54796
  }
54786
54797
  removeCriteria(e, r) {
@@ -54793,7 +54804,7 @@ var pr = class {
54793
54804
  }
54794
54805
  gcUnrefEntries() {
54795
54806
  let e = Date.now(), r = [];
54796
- for (let n of this.criteriaEntries.values()) for (let i of gt(n)) i.refCount === 0 && i.lastUnrefTime !== void 0 && e - i.lastUnrefTime >= 1e4 && r.push(i);
54807
+ for (let n of this.criteriaEntries.values()) for (let i of xt(n)) i.refCount === 0 && i.lastUnrefTime !== void 0 && e - i.lastUnrefTime >= 1e4 && r.push(i);
54797
54808
  for (let n of r) this.maybeEmitDisconnect(n), this.removeCriteriaEntry(n);
54798
54809
  r.length > 0 && this.criteriaEntries.size === 0 && this.closeWebSocket();
54799
54810
  }
@@ -54805,7 +54816,7 @@ var pr = class {
54805
54816
  }
54806
54817
  closeWebSocket() {
54807
54818
  if (!this.wsClosed) {
54808
- if (this.ws.readyState === WebSocket.OPEN) for (let e of this.criteriaEntries.values()) for (let r of gt(e)) r.token && this.sendUnbind(r.token);
54819
+ if (this.ws.readyState === WebSocket.OPEN) for (let e of this.criteriaEntries.values()) for (let r of xt(e)) r.token && this.sendUnbind(r.token);
54809
54820
  this.wsClosed = true, this.ws.close();
54810
54821
  }
54811
54822
  }
@@ -54816,10 +54827,10 @@ var pr = class {
54816
54827
  return this.getAllCriteriaEmitters().length;
54817
54828
  }
54818
54829
  getMasterEmitter() {
54819
- return this.masterSubEmitter || (this.masterSubEmitter = new yt(...Array.from(this.criteriaEntries.keys()))), this.masterSubEmitter;
54830
+ return this.masterSubEmitter || (this.masterSubEmitter = new vt(...Array.from(this.criteriaEntries.keys()))), this.masterSubEmitter;
54820
54831
  }
54821
54832
  async reconnectIfNeeded() {
54822
- wc.includes(this.getWebSocket().readyState) && await new Promise((e) => {
54833
+ Oc.includes(this.getWebSocket().readyState) && await new Promise((e) => {
54823
54834
  let r = () => {
54824
54835
  this.getWebSocket().removeEventListener("open", r), e();
54825
54836
  };
@@ -54827,24 +54838,24 @@ var pr = class {
54827
54838
  });
54828
54839
  }
54829
54840
  };
54830
- function gt(t6) {
54841
+ function xt(t6) {
54831
54842
  return t6.bareCriteria ? [t6.bareCriteria, ...t6.criteriaWithProps] : t6.criteriaWithProps;
54832
54843
  }
54833
- var Oc = new Z(1e3);
54834
- var Pn = "5.1.23-0bc44b2";
54835
- var Vc = M.FHIR_JSON + ", */*; q=0.1";
54836
- var Dc = "https://api.medplum.com/";
54837
- var Mc = 1e3;
54838
- var _c = 6e4;
54839
- var Lc = 0;
54840
- var Nc = 3e5;
54841
- var Fc = "Binary/";
54842
- var Co = { resourceType: "Device", id: "system", deviceName: [{ type: "model-name", name: "System" }] };
54843
- var Uc = 2;
54844
- var rt = { 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", PreAuthorizedCode: "urn:ietf:params:oauth:grant-type:pre-authorized_code" };
54845
- var Bc = { 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" };
54846
- var Wc = { JwtBearer: "urn:ietf:params:oauth:client-assertion-type:jwt-bearer" };
54847
- var fr = class extends ae {
54844
+ var Ic = new Z(1e3);
54845
+ var Cn = "5.1.24-4eda806";
54846
+ var Dc = M.FHIR_JSON + ", */*; q=0.1";
54847
+ var Mc = "https://api.medplum.com/";
54848
+ var _c = 1e3;
54849
+ var Lc = 6e4;
54850
+ var Nc = 0;
54851
+ var Fc = 3e5;
54852
+ var Uc = "Binary/";
54853
+ var Ao = { resourceType: "Device", id: "system", deviceName: [{ type: "model-name", name: "System" }] };
54854
+ var Bc = 2;
54855
+ var nt = { 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", PreAuthorizedCode: "urn:ietf:params:oauth:grant-type:pre-authorized_code" };
54856
+ var Wc = { 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" };
54857
+ var qc = { JwtBearer: "urn:ietf:params:oauth:client-assertion-type:jwt-bearer" };
54858
+ var mr = class extends ae {
54848
54859
  constructor(r) {
54849
54860
  super();
54850
54861
  c(this, "options");
@@ -54886,7 +54897,7 @@ var fr = class extends ae {
54886
54897
  c(this, "keyValueClient");
54887
54898
  c(this, "logLevel");
54888
54899
  if (r?.baseUrl && !r.baseUrl.startsWith("http")) throw new Error("Base URL must start with http or https");
54889
- this.options = r ?? {}, this.fetch = r?.fetch ?? qc(), this.storage = r?.storage ?? new ht(void 0, r?.storagePrefix), this.createPdfImpl = r?.createPdf, this.baseUrl = pn(r?.baseUrl ?? Dc), this.fhirBaseUrl = W(this.baseUrl, r?.fhirUrlPath ?? "fhir/R4"), this.authorizeUrl = W(this.baseUrl, r?.authorizeUrl ?? "oauth2/authorize"), this.tokenUrl = W(this.baseUrl, r?.tokenUrl ?? "oauth2/token"), this.logoutUrl = W(this.baseUrl, r?.logoutUrl ?? "oauth2/logout"), this.fhircastHubUrl = W(this.baseUrl, r?.fhircastHubUrl ?? "fhircast/STU3"), this.cdsServicesUrl = W(this.baseUrl, r?.cdsServicesUrl ?? "cds-services"), this.clientId = r?.clientId ?? "", this.clientSecret = r?.clientSecret ?? "", this.credentialsInHeader = r?.authCredentialsMethod === "header", this.defaultHeaders = r?.defaultHeaders ?? {}, this.onUnauthenticated = r?.onUnauthenticated, this.refreshGracePeriod = r?.refreshGracePeriod ?? Nc, this.logLevel = this.initializeLogLevel(r), this.maxRetries = r?.maxRetries ?? 2, this.maxRetryTime = r?.maxRetryTime ?? 2e3, this.cacheTime = r?.cacheTime ?? (X() ? _c : Lc), this.cacheTime > 0 ? this.requestCache = new Z(r?.resourceCacheSize ?? Mc) : this.requestCache = void 0, r?.autoBatchTime ? (this.autoBatchTime = r.autoBatchTime, this.autoBatchQueue = []) : (this.autoBatchTime = 0, this.autoBatchQueue = void 0), r?.accessToken && this.setAccessToken(r.accessToken), this.storage.getInitPromise === void 0 ? (r?.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(() => {
54900
+ this.options = r ?? {}, this.fetch = r?.fetch ?? $c(), this.storage = r?.storage ?? new yt(void 0, r?.storagePrefix), this.createPdfImpl = r?.createPdf, this.baseUrl = fn(r?.baseUrl ?? Mc), this.fhirBaseUrl = q(this.baseUrl, r?.fhirUrlPath ?? "fhir/R4"), this.authorizeUrl = q(this.baseUrl, r?.authorizeUrl ?? "oauth2/authorize"), this.tokenUrl = q(this.baseUrl, r?.tokenUrl ?? "oauth2/token"), this.logoutUrl = q(this.baseUrl, r?.logoutUrl ?? "oauth2/logout"), this.fhircastHubUrl = q(this.baseUrl, r?.fhircastHubUrl ?? "fhircast/STU3"), this.cdsServicesUrl = q(this.baseUrl, r?.cdsServicesUrl ?? "cds-services"), this.clientId = r?.clientId ?? "", this.clientSecret = r?.clientSecret ?? "", this.credentialsInHeader = r?.authCredentialsMethod === "header", this.defaultHeaders = r?.defaultHeaders ?? {}, this.onUnauthenticated = r?.onUnauthenticated, this.refreshGracePeriod = r?.refreshGracePeriod ?? Fc, this.logLevel = this.initializeLogLevel(r), this.maxRetries = r?.maxRetries ?? 2, this.maxRetryTime = r?.maxRetryTime ?? 2e3, this.cacheTime = r?.cacheTime ?? (X() ? Lc : Nc), this.cacheTime > 0 ? this.requestCache = new Z(r?.resourceCacheSize ?? _c) : this.requestCache = void 0, r?.autoBatchTime ? (this.autoBatchTime = r.autoBatchTime, this.autoBatchQueue = []) : (this.autoBatchTime = 0, this.autoBatchQueue = void 0), r?.accessToken && this.setAccessToken(r.accessToken), this.storage.getInitPromise === void 0 ? (r?.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(() => {
54890
54901
  r?.accessToken || this.attemptResumeActiveLogin().catch(console.error), this.initComplete = true, this.dispatchEvent({ type: "storageInitialized" });
54891
54902
  }).catch((n) => {
54892
54903
  console.error(n), this.initComplete = true, this.dispatchEvent({ type: "storageInitFailed", payload: { error: n } });
@@ -54939,7 +54950,7 @@ var fr = class extends ae {
54939
54950
  this.requestCache?.clear();
54940
54951
  }
54941
54952
  invalidateSearches(r) {
54942
- let n = W(this.fhirBaseUrl, r);
54953
+ let n = q(this.fhirBaseUrl, r);
54943
54954
  for (let i of this.requestCache?.keys() ?? x) (i.endsWith(n) || i.includes(n + "?")) && this.requestCache?.delete(i);
54944
54955
  }
54945
54956
  get(r, n = {}) {
@@ -55004,7 +55015,7 @@ var fr = class extends ae {
55004
55015
  }
55005
55016
  async exchangeExternalAccessToken(r, n, i) {
55006
55017
  if (n = n ?? this.clientId, !n) throw new Error("MedplumClient is missing clientId");
55007
- let o2 = { grant_type: rt.TokenExchange, subject_token_type: Bc.AccessToken, client_id: n, subject_token: r };
55018
+ let o2 = { grant_type: nt.TokenExchange, subject_token_type: Wc.AccessToken, client_id: n, subject_token: r };
55008
55019
  return i && (o2.membership_id = i), this.fetchTokens(o2);
55009
55020
  }
55010
55021
  getExternalAuthRedirectUri(r, n, i, o2, s = true) {
@@ -55018,11 +55029,11 @@ var fr = class extends ae {
55018
55029
  return a.toString();
55019
55030
  }
55020
55031
  fhirUrl(...r) {
55021
- return new URL(W(this.fhirBaseUrl, r.join("/")));
55032
+ return new URL(q(this.fhirBaseUrl, r.join("/")));
55022
55033
  }
55023
55034
  fhirSearchUrl(r, n) {
55024
55035
  let i = this.fhirUrl(r);
55025
- return n && (i.search = Hi(n)), i;
55036
+ return n && (i.search = Gi(n)), i;
55026
55037
  }
55027
55038
  search(r, n, i) {
55028
55039
  let o2 = this.fhirSearchUrl(r, n), s = "search-" + o2.toString(), a = this.getCacheEntry(s, i);
@@ -55041,7 +55052,7 @@ var fr = class extends ae {
55041
55052
  searchResources(r, n, i) {
55042
55053
  let s = "searchResources-" + this.fhirSearchUrl(r, n).toString(), a = this.getCacheEntry(s, i);
55043
55054
  if (a) return a.value;
55044
- let u2 = new $(this.search(r, n, i).then(wo));
55055
+ let u2 = new $(this.search(r, n, i).then(Oo));
55045
55056
  return this.setCacheEntry(s, u2, i), u2;
55046
55057
  }
55047
55058
  async *searchResourcePages(r, n, i) {
@@ -55051,7 +55062,7 @@ var fr = class extends ae {
55051
55062
  s.has("_count") || s.set("_count", "1000");
55052
55063
  let a = await this.search(r, s, i), u2 = a.link?.find((l) => l.relation === "next");
55053
55064
  if (!a.entry?.length && !u2) break;
55054
- yield wo(a), o2 = u2?.url ? new URL(u2.url) : void 0;
55065
+ yield Oo(a), o2 = u2?.url ? new URL(u2.url) : void 0;
55055
55066
  }
55056
55067
  }
55057
55068
  valueSetExpand(r, n) {
@@ -55065,7 +55076,7 @@ var fr = class extends ae {
55065
55076
  getCachedReference(r) {
55066
55077
  let n = r.reference;
55067
55078
  if (!n) return;
55068
- if (n === "system") return Co;
55079
+ if (n === "system") return Ao;
55069
55080
  let [i, o2] = n.split("/");
55070
55081
  if (!(!i || !o2)) return this.getCached(i, o2);
55071
55082
  }
@@ -55076,7 +55087,7 @@ var fr = class extends ae {
55076
55087
  readReference(r, n) {
55077
55088
  let i = r.reference;
55078
55089
  if (!i) return new $(Promise.reject(new Error("Missing reference")));
55079
- if (i === "system") return new $(Promise.resolve(Co));
55090
+ if (i === "system") return new $(Promise.resolve(Ao));
55080
55091
  let [o2, s] = i.split("/");
55081
55092
  return !o2 || !s ? new $(Promise.reject(new Error("Invalid reference"))) : this.readResource(o2, s, n);
55082
55093
  }
@@ -55084,7 +55095,7 @@ var fr = class extends ae {
55084
55095
  return Array.isArray(r) ? this.searchOne("", { _type: r.join(","), url: n }, i) : this.searchOne(r, "url=" + n, i);
55085
55096
  }
55086
55097
  requestSchema(r, n) {
55087
- if (Si(r)) return Promise.resolve();
55098
+ if (bi(r)) return Promise.resolve();
55088
55099
  let i = r + "-requestSchema", o2 = this.getCacheEntry(i, void 0);
55089
55100
  if (o2) return o2.value;
55090
55101
  let s = new $((async () => {
@@ -55129,13 +55140,13 @@ var fr = class extends ae {
55129
55140
  target
55130
55141
  }
55131
55142
  }`.replaceAll(/\s+/g, " "), u2 = await this.graphql(a);
55132
- qr(u2.data.StructureDefinitionList);
55133
- for (let l of u2.data.SearchParameterList) fn(l);
55143
+ $r(u2.data.StructureDefinitionList);
55144
+ for (let l of u2.data.SearchParameterList) mn(l);
55134
55145
  })());
55135
55146
  return this.setCacheEntry(i, s, n), s;
55136
55147
  }
55137
55148
  requestProfileSchema(r, n) {
55138
- if (!n?.expandProfile && bi(r)) return Promise.resolve();
55149
+ if (!n?.expandProfile && Ei(r)) return Promise.resolve();
55139
55150
  let i = r + "-requestSchema" + (n?.expandProfile ? "-nested" : ""), o2 = this.getCacheEntry(i, void 0);
55140
55151
  if (o2) return o2.value;
55141
55152
  let s = new $((async () => {
@@ -55143,14 +55154,14 @@ var fr = class extends ae {
55143
55154
  let a = this.fhirUrl("StructureDefinition", "$expand-profile");
55144
55155
  a.search = new URLSearchParams({ url: r }).toString();
55145
55156
  let u2 = await this.post(a.toString(), {});
55146
- qr(u2);
55157
+ $r(u2);
55147
55158
  } else {
55148
55159
  let a = await this.searchOne("StructureDefinition", { url: r, _sort: "-_lastUpdated" });
55149
55160
  if (!a) {
55150
55161
  console.warn(`No StructureDefinition found for ${r}!`);
55151
55162
  return;
55152
55163
  }
55153
- $r(a);
55164
+ jr(a);
55154
55165
  }
55155
55166
  })());
55156
55167
  return this.setCacheEntry(i, s, n), s;
@@ -55183,7 +55194,7 @@ var fr = class extends ae {
55183
55194
  return s || (s = r), this.cacheResource(s, i), this.invalidateUrl(this.fhirUrl(r.resourceType, r.id, "_history")), this.invalidateSearches(r.resourceType), s;
55184
55195
  }
55185
55196
  async createAttachment(r, n, i, o2, s) {
55186
- let a = Oo(r, n, i, o2);
55197
+ let a = Io(r, n, i, o2);
55187
55198
  if (a.contentType === M.XML) {
55188
55199
  let d = a.data, f;
55189
55200
  d instanceof Blob ? f = await new Promise((h, b2) => {
@@ -55201,7 +55212,7 @@ var fr = class extends ae {
55201
55212
  return { contentType: a.contentType, url: l.url, title: a.filename };
55202
55213
  }
55203
55214
  createBinary(r, n, i, o2, s) {
55204
- let a = Oo(r, n, i, o2), u2 = s ?? (typeof n == "object" ? n : {}), { data: l, contentType: d, filename: f, securityContext: h, onProgress: b2 } = a, C2 = this.fhirUrl("Binary");
55215
+ let a = Io(r, n, i, o2), u2 = s ?? (typeof n == "object" ? n : {}), { data: l, contentType: d, filename: f, securityContext: h, onProgress: b2 } = a, C2 = this.fhirUrl("Binary");
55205
55216
  return f && C2.searchParams.set("_filename", f), h?.reference && this.setRequestHeader(u2, "X-Security-Context", h.reference), b2 ? this.uploadwithProgress(C2, l, d, b2, u2) : this.post(C2, l, d, u2);
55206
55217
  }
55207
55218
  uploadwithProgress(r, n, i, o2, s) {
@@ -55212,7 +55223,7 @@ var fr = class extends ae {
55212
55223
  s?.signal?.removeEventListener("abort", d), h instanceof Error ? u2(h) : a(h);
55213
55224
  };
55214
55225
  if (l.responseType = "json", l.onabort = () => f(new DOMException("Request aborted", "AbortError")), l.onerror = () => f(new Error("Request error")), o2 && (l.upload.onprogress = (h) => o2(h), l.upload.onload = (h) => o2(h)), l.onload = () => {
55215
- l.status >= 200 && l.status < 300 ? f(l.response) : f(new m(Ot(l.response || l.statusText)));
55226
+ l.status >= 200 && l.status < 300 ? f(l.response) : f(new m(kt(l.response || l.statusText)));
55216
55227
  }, l.open("POST", r), l.withCredentials = true, l.setRequestHeader("Authorization", "Bearer " + this.accessToken), l.setRequestHeader("Cache-Control", "no-cache, no-store, max-age=0"), l.setRequestHeader("Content-Type", i), this.options.extendedMode !== false && l.setRequestHeader("X-Medplum", "extended"), s?.headers) {
55217
55228
  let h = s.headers;
55218
55229
  for (let [b2, C2] of Object.entries(h)) l.setRequestHeader(b2, C2);
@@ -55222,7 +55233,7 @@ var fr = class extends ae {
55222
55233
  }
55223
55234
  async createPdf(r, n, i, o2) {
55224
55235
  if (!this.createPdfImpl) throw new Error("PDF creation not enabled");
55225
- let s = Hc(r, n, i, o2), a = typeof n == "object" ? n : {}, { docDefinition: u2, tableLayouts: l, fonts: d, ...f } = s, h = await this.createPdfImpl(u2, l, d), b2 = { ...f, data: h, contentType: "application/pdf" };
55236
+ let s = Gc(r, n, i, o2), a = typeof n == "object" ? n : {}, { docDefinition: u2, tableLayouts: l, fonts: d, ...f } = s, h = await this.createPdfImpl(u2, l, d), b2 = { ...f, data: h, contentType: "application/pdf" };
55226
55237
  return this.createBinary(b2, a);
55227
55238
  }
55228
55239
  createComment(r, n, i) {
@@ -55276,7 +55287,7 @@ var fr = class extends ae {
55276
55287
  return this.get(this.cdsServicesUrl, r);
55277
55288
  }
55278
55289
  callCdsService(r, n, i) {
55279
- return this.post(W(this.cdsServicesUrl, r), n, M.JSON, i);
55290
+ return this.post(q(this.cdsServicesUrl, r), n, M.JSON, i);
55280
55291
  }
55281
55292
  getActiveLogin() {
55282
55293
  return this.storage.getObject("activeLogin");
@@ -55291,7 +55302,7 @@ var fr = class extends ae {
55291
55302
  return this.accessTokenExpires !== void 0 && Date.now() < this.accessTokenExpires - (r ?? this.refreshGracePeriod);
55292
55303
  }
55293
55304
  setAccessToken(r, n) {
55294
- this.accessToken = r, this.refreshToken = n, this.accessTokenExpires = So(r), this.medplumServer = To(r);
55305
+ this.accessToken = r, this.refreshToken = n, this.accessTokenExpires = bo(r), this.medplumServer = So(r);
55295
55306
  }
55296
55307
  getLogins() {
55297
55308
  return this.storage.getObject("logins") ?? [];
@@ -55348,7 +55359,7 @@ var fr = class extends ae {
55348
55359
  async downloadResponse(r, n = {}) {
55349
55360
  this.refreshPromise && await this.refreshPromise;
55350
55361
  let i = r.toString();
55351
- i.startsWith(Fc) && (r = this.fhirUrl(i));
55362
+ i.startsWith(Uc) && (r = this.fhirUrl(i));
55352
55363
  let o2 = n.headers;
55353
55364
  return o2 || (o2 = {}, n.headers = o2), o2.Accept || (o2.Accept = "*/*"), this.addFetchOptionsDefaults(n), this.fetchWithRetry(r.toString(), n);
55354
55365
  }
@@ -55380,7 +55391,7 @@ var fr = class extends ae {
55380
55391
  return await this.refreshIfExpired(), this.addFetchOptionsDefaults(n), this.fetchWithRetry(r, n);
55381
55392
  }
55382
55393
  get keyValue() {
55383
- return this.keyValueClient || (this.keyValueClient = new ur(this)), this.keyValueClient;
55394
+ return this.keyValueClient || (this.keyValueClient = new lr(this)), this.keyValueClient;
55384
55395
  }
55385
55396
  getBundle(r, n) {
55386
55397
  return new $((async () => {
@@ -55413,17 +55424,17 @@ var fr = class extends ae {
55413
55424
  if (o2.status === 401) return this.handleUnauthenticated(r, n, i);
55414
55425
  if (o2.status === 204 || o2.status === 304) return;
55415
55426
  let a = o2.headers.get("content-type")?.includes("json");
55416
- if (o2.status === 404 && !a) throw new m(ci);
55427
+ if (o2.status === 404 && !a) throw new m(ui);
55417
55428
  let u2 = await this.parseBody(o2, a);
55418
55429
  if (o2.status === 200 && n.followRedirectOnOk || o2.status === 201 && n.followRedirectOnCreated) {
55419
- let l = await Ao(o2, u2);
55430
+ let l = await wo(o2, u2);
55420
55431
  if (l) return this.request(l, { ...n, method: "GET", body: void 0 });
55421
55432
  }
55422
55433
  if (o2.status === 202 && n.pollStatusOnAccepted) {
55423
- let d = await Ao(o2, u2) ?? i.statusUrl;
55434
+ let d = await wo(o2, u2) ?? i.statusUrl;
55424
55435
  if (d) return this.pollStatus(d, n, i);
55425
55436
  }
55426
- if (o2.status >= 400) throw new m(Ot(u2));
55437
+ if (o2.status >= 400) throw new m(kt(u2));
55427
55438
  return u2;
55428
55439
  }
55429
55440
  async parseBody(r, n) {
@@ -55439,15 +55450,15 @@ var fr = class extends ae {
55439
55450
  }
55440
55451
  }
55441
55452
  async fetchWithRetry(r, n) {
55442
- r.startsWith("http") || (r = W(this.baseUrl, r));
55453
+ r.startsWith("http") || (r = q(this.baseUrl, r));
55443
55454
  let i = n?.maxRetries ?? this.maxRetries;
55444
55455
  for (let o2 = 0; o2 <= i; o2++) try {
55445
55456
  this.logLevel !== "none" && this.logRequest(r, n);
55446
55457
  let s = await this.fetch(r, n);
55447
- if (this.logLevel !== "none" && this.logResponse(s), this.setCurrentRateLimit(s), o2 >= i || !Gc(s)) return s;
55458
+ if (this.logLevel !== "none" && this.logResponse(s), this.setCurrentRateLimit(s), o2 >= i || !Qc(s)) return s;
55448
55459
  let a = this.getRetryDelay(o2), u2 = n.maxRetryTime ?? this.maxRetryTime;
55449
55460
  if (a > u2) return s;
55450
- await dn(a, { signal: n.signal });
55461
+ await pn(a, { signal: n.signal });
55451
55462
  } catch (s) {
55452
55463
  if (s.message === "Failed to fetch" && o2 === 0 && this.dispatchEvent({ type: "offline" }), s.name === "AbortError" || o2 === i) throw s;
55453
55464
  }
@@ -55456,7 +55467,7 @@ var fr = class extends ae {
55456
55467
  logRequest(r, n) {
55457
55468
  if (console.log(`> ${n.method} ${r}`), this.logLevel === "verbose" && n.headers) {
55458
55469
  let i = n.headers;
55459
- for (let o2 of Bt(Object.keys(i))) console.log(`> ${o2}: ${i[o2]}`);
55470
+ for (let o2 of Wt(Object.keys(i))) console.log(`> ${o2}: ${i[o2]}`);
55460
55471
  }
55461
55472
  }
55462
55473
  logResponse(r) {
@@ -55488,9 +55499,9 @@ var fr = class extends ae {
55488
55499
  if (i.pollCount === void 0) n.headers && typeof n.headers == "object" && "Prefer" in n.headers && (o2.headers = { ...n.headers }, delete o2.headers.Prefer), i.statusUrl = r, i.pollCount = 1;
55489
55500
  else {
55490
55501
  let s = n.pollStatusPeriod ?? 1e3;
55491
- await dn(s, { signal: n.signal }), i.pollCount++;
55502
+ await pn(s, { signal: n.signal }), i.pollCount++;
55492
55503
  }
55493
- return this.request(r, { ...n, method: "GET" }, i);
55504
+ return this.request(r, o2, i);
55494
55505
  }
55495
55506
  async executeAutoBatch() {
55496
55507
  if (this.autoBatchQueue === void 0) return;
@@ -55498,22 +55509,22 @@ var fr = class extends ae {
55498
55509
  if (this.autoBatchQueue.length = 0, this.autoBatchTimerId = void 0, r.length === 1) {
55499
55510
  let o2 = r[0];
55500
55511
  try {
55501
- o2.options.method = o2.method, o2.resolve(await this.request(W(this.fhirBaseUrl, o2.url), o2.options));
55512
+ o2.options.method = o2.method, o2.resolve(await this.request(q(this.fhirBaseUrl, o2.url), o2.options));
55502
55513
  } catch (s) {
55503
- o2.reject(new m(Ot(s)));
55514
+ o2.reject(new m(kt(s)));
55504
55515
  }
55505
55516
  return;
55506
55517
  }
55507
55518
  let n = { resourceType: "Bundle", type: "batch", entry: r.map((o2) => ({ request: { method: o2.method, url: o2.url }, resource: o2.options.body ? JSON.parse(o2.options.body) : void 0 })) }, i = await this.post(this.fhirBaseUrl, n);
55508
55519
  for (let o2 = 0; o2 < r.length; o2++) {
55509
55520
  let s = r[o2], a = i.entry?.[o2];
55510
- a?.response?.outcome && !Lr(a.response.outcome) ? s.reject(new m(a.response.outcome)) : s.resolve(a?.resource);
55521
+ a?.response?.outcome && !Nr(a.response.outcome) ? s.reject(new m(a.response.outcome)) : s.resolve(a?.resource);
55511
55522
  }
55512
55523
  }
55513
55524
  addFetchOptionsDefaults(r) {
55514
55525
  Object.entries(this.defaultHeaders).forEach(([n, i]) => {
55515
55526
  this.setRequestHeader(r, n, i);
55516
- }), this.setRequestHeader(r, "Accept", Vc, true), this.options.extendedMode !== false && this.setRequestHeader(r, "X-Medplum", "extended"), r.body && this.setRequestHeader(r, "Content-Type", M.FHIR_JSON, true), this.accessToken ? this.setRequestHeader(r, "Authorization", "Bearer " + this.accessToken) : this.basicAuth && this.setRequestHeader(r, "Authorization", "Basic " + this.basicAuth), r.cache || (r.cache = "no-cache"), r.credentials || (r.credentials = "include");
55527
+ }), this.setRequestHeader(r, "Accept", Dc, true), this.options.extendedMode !== false && this.setRequestHeader(r, "X-Medplum", "extended"), r.body && this.setRequestHeader(r, "Content-Type", M.FHIR_JSON, true), this.accessToken ? this.setRequestHeader(r, "Authorization", "Bearer " + this.accessToken) : this.basicAuth && this.setRequestHeader(r, "Authorization", "Basic " + this.basicAuth), r.cache || (r.cache = "no-cache"), r.credentials || (r.credentials = "include");
55517
55528
  }
55518
55529
  setRequestContentType(r, n) {
55519
55530
  this.setRequestHeader(r, "Content-Type", n);
@@ -55537,18 +55548,18 @@ var fr = class extends ae {
55537
55548
  typeof n == "string" || typeof Blob < "u" && (n instanceof Blob || n?.constructor.name === "Blob") || typeof File < "u" && (n instanceof File || n?.constructor.name === "File") || typeof Uint8Array < "u" && (n instanceof Uint8Array || n?.constructor.name === "Uint8Array") ? r.body = n : typeof n == "object" && n !== null && (typeof n.getReader == "function" || typeof n.pipe == "function" && typeof n.on == "function") ? (r.body = n, r.duplex = "half") : n && (r.body = JSON.stringify(n));
55538
55549
  }
55539
55550
  async handleUnauthenticated(r, n, i) {
55540
- let o2 = i.authAttempt ?? 0, s = o2 + 1 < Uc ? this.refresh(void 0, true) : void 0;
55551
+ let o2 = i.authAttempt ?? 0, s = o2 + 1 < Bc ? this.refresh(void 0, true) : void 0;
55541
55552
  if (s) return await s, this.request(r, n, { ...i, authAttempt: o2 + 1 });
55542
55553
  throw this.clear(), this.onUnauthenticated?.(), new m(Qe);
55543
55554
  }
55544
55555
  async startPkce() {
55545
- let r = yn();
55556
+ let r = xn();
55546
55557
  this.storage.setString("pkceState", r);
55547
- let n = yn().slice(0, 128);
55558
+ let n = xn().slice(0, 128);
55548
55559
  this.storage.setString("codeVerifier", n);
55549
55560
  try {
55550
- let i = await mo(n);
55551
- return { codeChallengeMethod: "S256", codeChallenge: Ui(i).replaceAll("+", "-").replaceAll("/", "_").replaceAll("=", "") };
55561
+ let i = await ho(n);
55562
+ return { codeChallengeMethod: "S256", codeChallenge: Bi(i).replaceAll("+", "-").replaceAll("/", "_").replaceAll("=", "") };
55552
55563
  } catch (i) {
55553
55564
  return console.warn("Failed to hash code verifier. Falling back to 'plain' code challenge method", i), { codeChallengeMethod: "plain", codeChallenge: n };
55554
55565
  }
@@ -55558,7 +55569,7 @@ var fr = class extends ae {
55558
55569
  i.searchParams.set("response_type", "code"), i.searchParams.set("state", this.storage.getString("pkceState")), i.searchParams.set("client_id", n.clientId ?? this.clientId), i.searchParams.set("redirect_uri", n.redirectUri ?? pe.getOrigin()), i.searchParams.set("code_challenge_method", n.codeChallengeMethod), i.searchParams.set("code_challenge", n.codeChallenge), i.searchParams.set("scope", n.scope ?? "openid profile"), pe.assign(i.toString());
55559
55570
  }
55560
55571
  processCode(r, n) {
55561
- let i = { grant_type: rt.AuthorizationCode, code: r, client_id: n?.clientId ?? this.clientId ?? "", redirect_uri: n?.redirectUri ?? pe.getOrigin() }, o2 = this.storage.getString("codeVerifier");
55572
+ let i = { grant_type: nt.AuthorizationCode, code: r, client_id: n?.clientId ?? this.clientId ?? "", redirect_uri: n?.redirectUri ?? pe.getOrigin() }, o2 = this.storage.getString("codeVerifier");
55562
55573
  return o2 && (i.code_verifier = o2), this.fetchTokens(i);
55563
55574
  }
55564
55575
  refreshIfExpired(r) {
@@ -55573,23 +55584,23 @@ var fr = class extends ae {
55573
55584
  let a = this.accessToken, u2 = this.getActiveLogin();
55574
55585
  u2?.accessToken && u2.accessToken !== this.accessToken && this.setAccessToken(u2.accessToken, u2.refreshToken);
55575
55586
  let l = this.accessToken !== a;
55576
- return this.isAuthenticated(r) && (!n || l) ? Promise.resolve(this.getProfile()) : this.refreshToken ? this.fetchTokens({ grant_type: rt.RefreshToken, client_id: this.clientId ?? "", refresh_token: this.refreshToken }) : this.clientId && this.clientSecret ? this.startClientLogin(this.clientId, this.clientSecret) : Promise.resolve(void 0);
55587
+ return this.isAuthenticated(r) && (!n || l) ? Promise.resolve(this.getProfile()) : this.refreshToken ? this.fetchTokens({ grant_type: nt.RefreshToken, client_id: this.clientId ?? "", refresh_token: this.refreshToken }) : this.clientId && this.clientSecret ? this.startClientLogin(this.clientId, this.clientSecret) : Promise.resolve(void 0);
55577
55588
  }, o2 = typeof navigator < "u" ? navigator.locks : void 0;
55578
55589
  if (!o2?.request) return i();
55579
55590
  let s = `medplum-refresh:${this.storage.makeKey("activeLogin")}`;
55580
55591
  return o2.request(s, i);
55581
55592
  }
55582
55593
  async startClientLogin(r, n) {
55583
- return this.clientId = r, this.clientSecret = n, this.fetchTokens({ grant_type: rt.ClientCredentials, client_id: r, client_secret: n });
55594
+ return this.clientId = r, this.clientSecret = n, this.fetchTokens({ grant_type: nt.ClientCredentials, client_id: r, client_secret: n });
55584
55595
  }
55585
55596
  async startJwtBearerLogin(r, n, i) {
55586
- return this.clientId = r, this.fetchTokens({ grant_type: rt.JwtBearer, client_id: r, assertion: n, scope: i });
55597
+ return this.clientId = r, this.fetchTokens({ grant_type: nt.JwtBearer, client_id: r, assertion: n, scope: i });
55587
55598
  }
55588
55599
  async startJwtAssertionLogin(r) {
55589
- return this.fetchTokens({ grant_type: rt.ClientCredentials, client_assertion_type: Wc.JwtBearer, client_assertion: r });
55600
+ return this.fetchTokens({ grant_type: nt.ClientCredentials, client_assertion_type: qc.JwtBearer, client_assertion: r });
55590
55601
  }
55591
55602
  setBasicAuth(r, n) {
55592
- this.clientId = r, this.clientSecret = n, this.basicAuth = ir(r + ":" + n);
55603
+ this.clientId = r, this.clientSecret = n, this.basicAuth = or(r + ":" + n);
55593
55604
  }
55594
55605
  setLogLevel(r) {
55595
55606
  this.logLevel = r, this.options.verbose = r === "verbose";
@@ -55603,20 +55614,20 @@ var fr = class extends ae {
55603
55614
  async fhircastSubscribe(r, n) {
55604
55615
  if (!(typeof r == "string" && r !== "")) throw new m(T("Invalid topic provided. Topic must be a valid string."));
55605
55616
  if (!(typeof n == "object" && Array.isArray(n) && n.length > 0)) throw new m(T("Invalid events provided. Events must be an array of event names containing at least one event."));
55606
- let i = { channelType: "websocket", mode: "subscribe", topic: r, events: n }, s = (await this.post(this.fhircastHubUrl, Sn(i), M.FORM_URL_ENCODED))["hub.channel.endpoint"];
55617
+ let i = { channelType: "websocket", mode: "subscribe", topic: r, events: n }, s = (await this.post(this.fhircastHubUrl, bn(i), M.FORM_URL_ENCODED))["hub.channel.endpoint"];
55607
55618
  if (!s) throw new Error("Invalid response!");
55608
55619
  return i.endpoint = s, i;
55609
55620
  }
55610
55621
  async fhircastUnsubscribe(r) {
55611
- if (!ar(r)) throw new m(T("Invalid topic or subscriptionRequest. SubscriptionRequest must be an object."));
55622
+ if (!cr(r)) throw new m(T("Invalid topic or subscriptionRequest. SubscriptionRequest must be an object."));
55612
55623
  if (!(r.endpoint && typeof r.endpoint == "string" && r.endpoint.startsWith("ws"))) throw new m(T("Provided subscription request must have an endpoint in order to unsubscribe."));
55613
- r.mode = "unsubscribe", await this.post(this.fhircastHubUrl, Sn(r), M.FORM_URL_ENCODED);
55624
+ r.mode = "unsubscribe", await this.post(this.fhircastHubUrl, bn(r), M.FORM_URL_ENCODED);
55614
55625
  }
55615
55626
  fhircastConnect(r) {
55616
- return new sr(r);
55627
+ return new ar(r);
55617
55628
  }
55618
55629
  async fhircastPublish(r, n, i, o2) {
55619
- return go(n) ? this.post(this.fhircastHubUrl, bn(r, n, i, o2), M.JSON) : (yo(n), this.post(this.fhircastHubUrl, bn(r, n, i), M.JSON));
55630
+ return yo(n) ? this.post(this.fhircastHubUrl, En(r, n, i, o2), M.JSON) : (xo(n), this.post(this.fhircastHubUrl, En(r, n, i), M.JSON));
55620
55631
  }
55621
55632
  async fhircastGetContext(r) {
55622
55633
  return this.get(`${this.fhircastHubUrl}/${r}`, { cache: "no-cache" });
@@ -55627,14 +55638,14 @@ var fr = class extends ae {
55627
55638
  async handleTokenError(r) {
55628
55639
  try {
55629
55640
  let n = await r.json();
55630
- throw ot(n) ? new m(n) : n.error_description ? new m(w(n.error_description)) : new Error(JSON.stringify(n));
55641
+ throw st(n) ? new m(n) : n.error_description ? new m(w(n.error_description)) : new Error(JSON.stringify(n));
55631
55642
  } catch (n) {
55632
55643
  throw n instanceof m ? (n.message = `Failed to fetch tokens: ${n.message}`, n) : new m(w("Failed to fetch tokens"), { cause: n });
55633
55644
  }
55634
55645
  }
55635
55646
  async fetchTokens(r) {
55636
55647
  let n = new URLSearchParams(r), i = { ...this.defaultHeaders, "Content-Type": M.FORM_URL_ENCODED };
55637
- this.basicAuth && (i.Authorization = `Basic ${this.basicAuth}`), this.credentialsInHeader && (n.delete("client_id"), n.delete("client_secret"), !this.basicAuth && r.client_id && r.client_secret && (i.Authorization = `Basic ${ir(r.client_id + ":" + r.client_secret)}`));
55648
+ this.basicAuth && (i.Authorization = `Basic ${this.basicAuth}`), this.credentialsInHeader && (n.delete("client_id"), n.delete("client_secret"), !this.basicAuth && r.client_id && r.client_secret && (i.Authorization = `Basic ${or(r.client_id + ":" + r.client_secret)}`));
55638
55649
  let o2 = { method: "POST", headers: i, body: n.toString(), credentials: "include" }, s;
55639
55650
  try {
55640
55651
  s = await this.fetchWithRetry(this.tokenUrl, o2);
@@ -55647,12 +55658,12 @@ var fr = class extends ae {
55647
55658
  }
55648
55659
  async verifyTokens(r) {
55649
55660
  let n = r.access_token;
55650
- if (vo(n)) {
55651
- let i = cr(n);
55652
- if (Date.now() >= i.exp * 1e3) throw this.clearActiveLogin(), new m(ui);
55661
+ if (To(n)) {
55662
+ let i = ur(n);
55663
+ if (Date.now() >= i.exp * 1e3) throw this.clearActiveLogin(), new m(li);
55653
55664
  if (i.cid) {
55654
- if (i.cid !== this.clientId) throw this.clearActiveLogin(), new m(Mr);
55655
- } else if (this.clientId && i.client_id !== this.clientId) throw this.clearActiveLogin(), new m(Mr);
55665
+ if (i.cid !== this.clientId) throw this.clearActiveLogin(), new m(_r);
55666
+ } else if (this.clientId && i.client_id !== this.clientId) throw this.clearActiveLogin(), new m(_r);
55656
55667
  }
55657
55668
  return this.setActiveLogin({ accessToken: n, refreshToken: r.refresh_token, project: r.project, profile: r.profile });
55658
55669
  }
@@ -55672,7 +55683,7 @@ var fr = class extends ae {
55672
55683
  }
55673
55684
  }
55674
55685
  getSubscriptionManager() {
55675
- return this.subscriptionManager || (this.subscriptionManager = new pr(this, ji(this.baseUrl, "/ws/subscriptions-r4"))), this.subscriptionManager;
55686
+ return this.subscriptionManager || (this.subscriptionManager = new fr(this, Hi(this.baseUrl, "/ws/subscriptions-r4"))), this.subscriptionManager;
55676
55687
  }
55677
55688
  subscribeToCriteria(r, n) {
55678
55689
  return this.getSubscriptionManager().addCriteria(r, n);
@@ -55684,44 +55695,44 @@ var fr = class extends ae {
55684
55695
  return this.getSubscriptionManager().getMasterEmitter();
55685
55696
  }
55686
55697
  };
55687
- function qc() {
55698
+ function $c() {
55688
55699
  if (!globalThis.fetch) throw new Error("Fetch not available in this environment");
55689
55700
  return globalThis.fetch.bind(globalThis);
55690
55701
  }
55691
- async function Ao(t6, e) {
55702
+ async function wo(t6, e) {
55692
55703
  let r = t6.headers.get("content-location");
55693
55704
  if (r) return r;
55694
55705
  let n = t6.headers.get("location");
55695
55706
  if (n) return n;
55696
- if (ot(e) && e.issue?.[0]?.diagnostics) return e.issue[0].diagnostics;
55707
+ if (st(e) && e.issue?.[0]?.diagnostics) return e.issue[0].diagnostics;
55697
55708
  }
55698
- function wo(t6) {
55709
+ function Oo(t6) {
55699
55710
  let e = t6.entry?.map((r) => r.resource) ?? [];
55700
55711
  return Object.assign(e, { bundle: t6 });
55701
55712
  }
55702
- function $c(t6) {
55713
+ function jc(t6) {
55703
55714
  return P(t6) && "data" in t6 && "contentType" in t6;
55704
55715
  }
55705
- function Oo(t6, e, r, n) {
55706
- return $c(t6) ? t6 : { data: t6, filename: e, contentType: r, onProgress: n };
55716
+ function Io(t6, e, r, n) {
55717
+ return jc(t6) ? t6 : { data: t6, filename: e, contentType: r, onProgress: n };
55707
55718
  }
55708
- function jc(t6) {
55719
+ function Hc(t6) {
55709
55720
  return P(t6) && "docDefinition" in t6;
55710
55721
  }
55711
- function Hc(t6, e, r, n) {
55712
- return jc(t6) ? t6 : { docDefinition: t6, filename: e, tableLayouts: r, fonts: n };
55722
+ function Gc(t6, e, r, n) {
55723
+ return Hc(t6) ? t6 : { docDefinition: t6, filename: e, tableLayouts: r, fonts: n };
55713
55724
  }
55714
- function Gc(t6) {
55725
+ function Qc(t6) {
55715
55726
  return t6.status === 429 || t6.status >= 500;
55716
55727
  }
55717
- var iu = [...dt, "->", "<<", ">>", "=="];
55718
- var au = pt().registerInfix("->", { precedence: S.Arrow }).registerInfix(";", { precedence: S.Semicolon });
55719
- var Lu = Object.freeze({ implicitArrayCreation: true });
55720
- var Fu = " ".repeat(2);
55721
- var Bu = [...dt, "eq", "ne", "co"];
55722
- var Wu = { eq: g.EXACT, ne: g.NOT_EQUALS, co: g.CONTAINS, sw: g.STARTS_WITH, ew: void 0, gt: g.GREATER_THAN, lt: g.LESS_THAN, ge: g.GREATER_THAN_OR_EQUALS, le: g.LESS_THAN_OR_EQUALS, ap: g.APPROXIMATELY, sa: g.STARTS_AFTER, eb: g.ENDS_BEFORE, pr: g.PRESENT, po: void 0, ss: void 0, sb: void 0, in: g.IN, ni: g.NOT_IN, re: g.EQUALS, identifier: g.IDENTIFIER };
55723
- var $u = pt();
55724
- var ju = { AA: "OK", AE: "Application Error", AR: "Application Reject", CA: "Commit Accept", CE: "Commit Error", CR: "Commit Reject" };
55728
+ var ou = [...ft, "->", "<<", ">>", "=="];
55729
+ var cu = mt().registerInfix("->", { precedence: S.Arrow }).registerInfix(";", { precedence: S.Semicolon });
55730
+ var Nu = Object.freeze({ implicitArrayCreation: true });
55731
+ var Uu = " ".repeat(2);
55732
+ var Wu = [...ft, "eq", "ne", "co"];
55733
+ var qu = { eq: g.EXACT, ne: g.NOT_EQUALS, co: g.CONTAINS, sw: g.STARTS_WITH, ew: void 0, gt: g.GREATER_THAN, lt: g.LESS_THAN, ge: g.GREATER_THAN_OR_EQUALS, le: g.LESS_THAN_OR_EQUALS, ap: g.APPROXIMATELY, sa: g.STARTS_AFTER, eb: g.ENDS_BEFORE, pr: g.PRESENT, po: void 0, ss: void 0, sb: void 0, in: g.IN, ni: g.NOT_IN, re: g.EQUALS, identifier: g.IDENTIFIER };
55734
+ var ju = mt();
55735
+ var Hu = { AA: "OK", AE: "Application Error", AR: "Application Reject", CA: "Commit Accept", CE: "Commit Error", CR: "Commit Reject" };
55725
55736
  var Ae = class {
55726
55737
  constructor(e = "\r", r = "|", n = "^", i = "~", o2 = "\\", s = "&") {
55727
55738
  c(this, "segmentSeparator");
@@ -55739,14 +55750,14 @@ var Ae = class {
55739
55750
  return this.componentSeparator + this.repetitionSeparator + this.escapeCharacter + this.subcomponentSeparator;
55740
55751
  }
55741
55752
  };
55742
- var ts = class t2 {
55753
+ var rs = class t2 {
55743
55754
  constructor(e, r = new Ae()) {
55744
55755
  c(this, "context");
55745
55756
  c(this, "_segments");
55746
55757
  c(this, "segmentsByName");
55747
55758
  c(this, "cachedString");
55748
55759
  c(this, "allSegmentsParsed");
55749
- this.context = r, this._segments = e, this.segmentsByName = rs(e), this.allSegmentsParsed = e.every((n) => typeof n != "string"), this.bindSegments();
55760
+ this.context = r, this._segments = e, this.segmentsByName = ns(e), this.allSegmentsParsed = e.every((n) => typeof n != "string"), this.bindSegments();
55750
55761
  }
55751
55762
  get segments() {
55752
55763
  if (!this.allSegmentsParsed) {
@@ -55779,7 +55790,7 @@ var ts = class t2 {
55779
55790
  let r = this._segments[e];
55780
55791
  if (r === void 0) return;
55781
55792
  if (typeof r != "string") return r;
55782
- let n = bt.parse(r, this.context);
55793
+ let n = Rt.parse(r, this.context);
55783
55794
  return n.onModified = () => {
55784
55795
  this.cachedString = void 0;
55785
55796
  }, this._segments[e] = n, n;
@@ -55789,7 +55800,7 @@ var ts = class t2 {
55789
55800
  }
55790
55801
  buildAck(e) {
55791
55802
  let r = /* @__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() ?? "", l = n?.getField(12)?.toString() ?? "2.5.1", d = e?.ackCode ?? "AA";
55792
- return new t2([new bt(["MSH", this.context.getMsh2(), s, a, i, o2, Gu(r), "", this.buildAckMessageType(n), r.getTime().toString(), "P", l], this.context), new bt(["MSA", d, u2, ju[d]], this.context), ...e?.errSegment ? [e.errSegment] : []]);
55803
+ return new t2([new Rt(["MSH", this.context.getMsh2(), s, a, i, o2, Qu(r), "", this.buildAckMessageType(n), r.getTime().toString(), "P", l], this.context), new Rt(["MSA", d, u2, Hu[d]], this.context), ...e?.errSegment ? [e.errSegment] : []]);
55793
55804
  }
55794
55805
  buildAckMessageType(e) {
55795
55806
  let r = e?.getField(9), n = r?.getComponent(2), i = r?.getComponent(3), o2 = "ACK";
@@ -55817,7 +55828,7 @@ var ts = class t2 {
55817
55828
  return this.segmentsByName.get(e)?.[0] ?? -1;
55818
55829
  }
55819
55830
  invalidateCache() {
55820
- this.segmentsByName = rs(this._segments), this.cachedString = void 0, this.bindSegments();
55831
+ this.segmentsByName = ns(this._segments), this.cachedString = void 0, this.bindSegments();
55821
55832
  }
55822
55833
  bindSegments() {
55823
55834
  let e = () => {
@@ -55826,7 +55837,7 @@ var ts = class t2 {
55826
55837
  for (let r of this._segments) typeof r != "string" && (r.onModified = e);
55827
55838
  }
55828
55839
  };
55829
- function rs(t6) {
55840
+ function ns(t6) {
55830
55841
  let e = /* @__PURE__ */ new Map();
55831
55842
  for (let r = 0; r < t6.length; r++) {
55832
55843
  let n = t6[r], i = typeof n == "string" ? n.slice(0, 3) : n.name, o2 = e.get(i);
@@ -55834,7 +55845,7 @@ function rs(t6) {
55834
55845
  }
55835
55846
  return e;
55836
55847
  }
55837
- var bt = class t3 {
55848
+ var Rt = class t3 {
55838
55849
  constructor(e, r = new Ae()) {
55839
55850
  c(this, "context");
55840
55851
  c(this, "name");
@@ -55949,14 +55960,14 @@ var fe = class t4 {
55949
55960
  this.cachedString = void 0, this.onModified?.();
55950
55961
  }
55951
55962
  };
55952
- function Gu(t6) {
55963
+ function Qu(t6) {
55953
55964
  let e = t6 instanceof Date ? t6 : new Date(t6), n = e.toISOString().replaceAll(/[-:T]/g, "").replace(/(\.\d+)?Z$/, ""), i = e.getUTCMilliseconds();
55954
55965
  return i > 0 && (n += "." + i.toString()), n;
55955
55966
  }
55956
- var it = { NONE: 0, ERROR: 1, WARN: 2, INFO: 3, DEBUG: 4 };
55957
- var Qu = ["NONE", "ERROR", "WARN", "INFO", "DEBUG"];
55958
- var ns = class t5 {
55959
- constructor(e, r = {}, n = it.INFO, i = {}) {
55967
+ var ot = { NONE: 0, ERROR: 1, WARN: 2, INFO: 3, DEBUG: 4 };
55968
+ var zu = ["NONE", "ERROR", "WARN", "INFO", "DEBUG"];
55969
+ var is = class t5 {
55970
+ constructor(e, r = {}, n = ot.INFO, i = {}) {
55960
55971
  c(this, "write");
55961
55972
  c(this, "metadata");
55962
55973
  c(this, "options");
@@ -55973,50 +55984,50 @@ var ns = class t5 {
55973
55984
  return { write: e, metadata: r, level: n, options: i };
55974
55985
  }
55975
55986
  error(e, r) {
55976
- this.log(it.ERROR, e, r);
55987
+ this.log(ot.ERROR, e, r);
55977
55988
  }
55978
55989
  warn(e, r) {
55979
- this.log(it.WARN, e, r);
55990
+ this.log(ot.WARN, e, r);
55980
55991
  }
55981
55992
  info(e, r) {
55982
- this.log(it.INFO, e, r);
55993
+ this.log(ot.INFO, e, r);
55983
55994
  }
55984
55995
  debug(e, r) {
55985
- this.log(it.DEBUG, e, r);
55996
+ this.log(ot.DEBUG, e, r);
55986
55997
  }
55987
55998
  log(e, r, n) {
55988
55999
  if (e > this.level) return;
55989
56000
  let i;
55990
- if (_r(n)) i = Rr(n);
56001
+ if (Lr(n)) i = Pr(n);
55991
56002
  else if (n) {
55992
56003
  i = { ...n };
55993
- for (let [o2, s] of Object.entries(i)) s instanceof Error && (i[o2] = Rr(s));
56004
+ for (let [o2, s] of Object.entries(i)) s instanceof Error && (i[o2] = Pr(s));
55994
56005
  }
55995
- this.write(JSON.stringify({ level: Qu[e], timestamp: (/* @__PURE__ */ new Date()).toISOString(), msg: this.prefix ? `${this.prefix}${r}` : r, ...i, ...this.metadata }));
56006
+ this.write(JSON.stringify({ level: zu[e], timestamp: (/* @__PURE__ */ new Date()).toISOString(), msg: this.prefix ? `${this.prefix}${r}` : r, ...i, ...this.metadata }));
55996
56007
  }
55997
56008
  };
55998
- function my(t6) {
55999
- let e = it[t6.toUpperCase()];
56009
+ function hy(t6) {
56010
+ let e = ot[t6.toUpperCase()];
56000
56011
  if (e === void 0) throw new Error(`Invalid log level: ${t6}`);
56001
56012
  return e;
56002
56013
  }
56003
- function Rr(t6, e = 0, r = 10) {
56014
+ function Pr(t6, e = 0, r = 10) {
56004
56015
  if (e >= r) return { error: "Max error depth reached" };
56005
56016
  let n = { error: t6.toString(), stack: t6.stack?.split(`
56006
56017
  `) };
56007
- t6.name && t6.name !== "Error" && (n.name = t6.name), t6.message && (n.message = t6.message), "cause" in t6 && t6.cause !== void 0 && (t6.cause instanceof Error ? n.cause = Rr(t6.cause, e + 1, r) : n.cause = t6.cause);
56018
+ t6.name && t6.name !== "Error" && (n.name = t6.name), t6.message && (n.message = t6.message), "cause" in t6 && t6.cause !== void 0 && (t6.cause instanceof Error ? n.cause = Pr(t6.cause, e + 1, r) : n.cause = t6.cause);
56008
56019
  let i = Object.getOwnPropertyNames(t6).filter((o2) => !["name", "message", "stack", "cause"].includes(o2));
56009
56020
  for (let o2 of i) try {
56010
56021
  let s = t6[o2];
56011
- s instanceof Error ? n[o2] = Rr(s, e + 1, r) : n[o2] = s;
56022
+ s instanceof Error ? n[o2] = Pr(s, e + 1, r) : n[o2] = s;
56012
56023
  } catch {
56013
56024
  }
56014
56025
  return n;
56015
56026
  }
56016
- var zn = `${Pt}/fhir/StructureDefinition/patient-preferredPharmacy`;
56017
- var hl = "https://meta.medplum.com/releases";
56018
- var Kn = /* @__PURE__ */ new Map();
56019
- function gl(t6) {
56027
+ var Jn = `${At}/fhir/StructureDefinition/patient-preferredPharmacy`;
56028
+ var gl = "https://meta.medplum.com/releases";
56029
+ var Yn = /* @__PURE__ */ new Map();
56030
+ function yl(t6) {
56020
56031
  let e = t6;
56021
56032
  if (!e.tag_name?.startsWith("v")) throw new Error("Manifest missing valid tag_name starting with a 'v' (eg. v5.1.15)");
56022
56033
  let r = e.assets;
@@ -56026,11 +56037,11 @@ function gl(t6) {
56026
56037
  if (!n.name) throw new Error("Asset missing name");
56027
56038
  }
56028
56039
  }
56029
- async function Yn(t6, e, r) {
56030
- let n = e ? Kn.get(e) : void 0;
56040
+ async function Xn(t6, e, r) {
56041
+ let n = e ? Yn.get(e) : void 0;
56031
56042
  if (!n) {
56032
- let i = e ? `v${e}` : "latest", o2 = new URL(`${hl}/${i}.json`);
56033
- if (o2.searchParams.set("a", t6), o2.searchParams.set("c", Pn), r) for (let [u2, l] of Object.entries(r)) o2.searchParams.set(u2, l);
56043
+ let i = e ? `v${e}` : "latest", o2 = new URL(`${gl}/${i}.json`);
56044
+ if (o2.searchParams.set("a", t6), o2.searchParams.set("c", Cn), r) for (let [u2, l] of Object.entries(r)) o2.searchParams.set(u2, l);
56034
56045
  let s = await fetch(o2.toString());
56035
56046
  if (s.status !== 200) {
56036
56047
  let u2;
@@ -56042,24 +56053,24 @@ async function Yn(t6, e, r) {
56042
56053
  throw new Error(`Received status code ${s.status} while fetching manifest for version '${e ?? "latest"}'. Message: ${u2}`);
56043
56054
  }
56044
56055
  let a = await s.json();
56045
- gl(a), n = a, Kn.set(n.tag_name.slice(1), n);
56056
+ yl(a), n = a, Yn.set(n.tag_name.slice(1), n);
56046
56057
  }
56047
56058
  return n;
56048
56059
  }
56049
- function yl(t6) {
56060
+ function xl(t6) {
56050
56061
  return /^\d+\.\d+\.\d+(-[0-9a-z]{7})?$/.test(t6);
56051
56062
  }
56052
- async function yx(t6, e) {
56053
- if (!yl(e)) return false;
56063
+ async function xx(t6, e) {
56064
+ if (!xl(e)) return false;
56054
56065
  try {
56055
- await Yn(t6, e);
56066
+ await Xn(t6, e);
56056
56067
  } catch {
56057
56068
  return false;
56058
56069
  }
56059
56070
  return true;
56060
56071
  }
56061
- async function xx(t6) {
56062
- let e = await Yn(t6);
56072
+ async function vx(t6) {
56073
+ let e = await Xn(t6);
56063
56074
  if (!e.tag_name.startsWith("v")) throw new Error(`Invalid release name found. Release tag '${e.tag_name}' did not start with 'v'`);
56064
56075
  return e.tag_name.slice(1);
56065
56076
  }
@@ -56170,7 +56181,7 @@ var v = class extends m2 {
56170
56181
  return;
56171
56182
  }
56172
56183
  let l = c2.message.getSegment("MSA")?.getField(1)?.toString()?.toUpperCase();
56173
- l && (h.returnAck === Xf.APPLICATION && l === "CA" || (h.timer && clearTimeout(h.timer), h.resolve(c2.message), this.deletePendingMessage(a)));
56184
+ l && (h.returnAck === Zf.APPLICATION && l === "CA" || (h.timer && clearTimeout(h.timer), h.resolve(c2.message), this.deletePendingMessage(a)));
56174
56185
  });
56175
56186
  }
56176
56187
  isClosed() {
@@ -56185,7 +56196,7 @@ var v = class extends m2 {
56185
56196
  for (this.responseQueueProcessing = true; this.responseQueue.length; ) {
56186
56197
  if (this.messagesPerMin) {
56187
56198
  let t6 = B2 / this.messagesPerMin, s = Date.now() - this.lastMessageDispatchedTime;
56188
- t6 > s && await dn(t6 - s);
56199
+ t6 > s && await pn(t6 - s);
56189
56200
  }
56190
56201
  let e = this.responseQueue.shift();
56191
56202
  e && this.dispatchEvent(e), this.lastMessageDispatchedTime = Date.now();
@@ -56205,7 +56216,7 @@ var v = class extends m2 {
56205
56216
  break;
56206
56217
  }
56207
56218
  if (n === -1) break;
56208
- let r = t6.subarray(s, n + 1).subarray(1, -2), a = import_iconv_lite.default.decode(r, this.encoding), h = ts.parse(a);
56219
+ let r = t6.subarray(s, n + 1).subarray(1, -2), a = import_iconv_lite.default.decode(r, this.encoding), h = rs.parse(a);
56209
56220
  e.push(h), s = n + 1;
56210
56221
  }
56211
56222
  return this.chunks = s < t6.length ? [t6.subarray(s)] : [], e;
@@ -56223,7 +56234,7 @@ var v = class extends m2 {
56223
56234
  let r;
56224
56235
  t6?.timeoutMs && (r = setTimeout(() => {
56225
56236
  this.deletePendingMessage(c2), n(new m({ resourceType: "OperationOutcome", issue: [{ severity: "error", code: "timeout", details: { text: "Client timeout" }, diagnostics: `Request timed out after waiting ${t6.timeoutMs} milliseconds for response` }] }));
56226
- }, t6.timeoutMs)), this.setPendingMessage(c2, { message: e, resolve: s, reject: n, returnAck: t6?.returnAck ?? Xf.APPLICATION, timer: r }), this.sendImpl(e);
56237
+ }, t6.timeoutMs)), this.setPendingMessage(c2, { message: e, resolve: s, reject: n, returnAck: t6?.returnAck ?? Zf.APPLICATION, timer: r }), this.sendImpl(e);
56227
56238
  });
56228
56239
  }
56229
56240
  async close() {
@@ -56397,7 +56408,7 @@ var x2 = class {
56397
56408
  c2(T2);
56398
56409
  });
56399
56410
  }, h = (l) => {
56400
- l?.code === "EADDRINUSE" ? n.close(() => dn(50).then(() => a(i))) : r(l);
56411
+ l?.code === "EADDRINUSE" ? n.close(() => pn(50).then(() => a(i))) : r(l);
56401
56412
  };
56402
56413
  n.on("error", h), n.once("listening", () => {
56403
56414
  n.off("error", h);
@@ -57555,10 +57566,10 @@ function _nonIterableRest() {
57555
57566
  throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
57556
57567
  }
57557
57568
  function _createForOfIteratorHelper(o2, allowArrayLike) {
57558
- var it2 = typeof Symbol !== "undefined" && o2[Symbol.iterator] || o2["@@iterator"];
57559
- if (!it2) {
57560
- if (Array.isArray(o2) || (it2 = _unsupportedIterableToArray(o2)) || allowArrayLike) {
57561
- if (it2) o2 = it2;
57569
+ var it = typeof Symbol !== "undefined" && o2[Symbol.iterator] || o2["@@iterator"];
57570
+ if (!it) {
57571
+ if (Array.isArray(o2) || (it = _unsupportedIterableToArray(o2)) || allowArrayLike) {
57572
+ if (it) o2 = it;
57562
57573
  var i = 0;
57563
57574
  var F2 = function() {
57564
57575
  };
@@ -57584,10 +57595,10 @@ function _createForOfIteratorHelper(o2, allowArrayLike) {
57584
57595
  var normalCompletion = true, didErr = false, err2;
57585
57596
  return {
57586
57597
  s: function() {
57587
- it2 = it2.call(o2);
57598
+ it = it.call(o2);
57588
57599
  },
57589
57600
  n: function() {
57590
- var step = it2.next();
57601
+ var step = it.next();
57591
57602
  normalCompletion = step.done;
57592
57603
  return step;
57593
57604
  },
@@ -57597,7 +57608,7 @@ function _createForOfIteratorHelper(o2, allowArrayLike) {
57597
57608
  },
57598
57609
  f: function() {
57599
57610
  try {
57600
- if (!normalCompletion && it2.return != null) it2.return();
57611
+ if (!normalCompletion && it.return != null) it.return();
57601
57612
  } finally {
57602
57613
  if (didErr) throw err2;
57603
57614
  }
@@ -63974,8 +63985,8 @@ var IntegerString = /* @__PURE__ */ (function(_NumericStringReprese2) {
63974
63985
  key: "writeBytes",
63975
63986
  value: function writeBytes(stream, value, writeOptions) {
63976
63987
  var _this11 = this;
63977
- var val = Array.isArray(value) ? value.map(function(is) {
63978
- return _this11.convertToString(is);
63988
+ var val = Array.isArray(value) ? value.map(function(is2) {
63989
+ return _this11.convertToString(is2);
63979
63990
  }) : [this.convertToString(value)];
63980
63991
  return _get(_getPrototypeOf(IntegerString2.prototype), "writeBytes", this).call(this, stream, val, writeOptions);
63981
63992
  }
@@ -65281,10 +65292,10 @@ function lookupTagHex(hex8) {
65281
65292
  var elem = parseInt(hex8.slice(4, 8), 16);
65282
65293
  if (!Number.isFinite(group) || !Number.isFinite(elem)) return void 0;
65283
65294
  var _initPacked = initPacked(), groups = _initPacked.groups, groupStart = _initPacked.groupStart, elems = _initPacked.elems, vrCode = _initPacked.vrCode, vmCode = _initPacked.vmCode, nameOff = _initPacked.nameOff, nameLen = _initPacked.nameLen;
65284
- var gi = _ensureGroupIndex(groups).get(group);
65285
- if (gi === void 0) return void 0;
65286
- var start = groupStart[gi];
65287
- var end = gi + 1 < groupStart.length ? groupStart[gi + 1] : elems.length;
65295
+ var gi2 = _ensureGroupIndex(groups).get(group);
65296
+ if (gi2 === void 0) return void 0;
65297
+ var start = groupStart[gi2];
65298
+ var end = gi2 + 1 < groupStart.length ? groupStart[gi2 + 1] : elems.length;
65288
65299
  var ei = _binSearchU16(elems, start, end, elem);
65289
65300
  if (ei < 0) return void 0;
65290
65301
  var vr = vrTable$1[vrCode[ei]];
@@ -65321,10 +65332,10 @@ function _pad4(hex) {
65321
65332
  function getAllStandardTagEntries() {
65322
65333
  var out = [];
65323
65334
  var _initPacked2 = initPacked(), groups = _initPacked2.groups, groupStart = _initPacked2.groupStart, elems = _initPacked2.elems, vrCode = _initPacked2.vrCode, vmCode = _initPacked2.vmCode, nameOff = _initPacked2.nameOff, nameLen = _initPacked2.nameLen;
65324
- for (var gi = 0; gi < groups.length; gi++) {
65325
- var group = groups[gi];
65326
- var start = groupStart[gi];
65327
- var end = gi + 1 < groupStart.length ? groupStart[gi + 1] : elems.length;
65335
+ for (var gi2 = 0; gi2 < groups.length; gi2++) {
65336
+ var group = groups[gi2];
65337
+ var start = groupStart[gi2];
65338
+ var end = gi2 + 1 < groupStart.length ? groupStart[gi2 + 1] : elems.length;
65328
65339
  var gHex = _pad4(group.toString(16).toUpperCase());
65329
65340
  for (var ei = start; ei < end; ei++) {
65330
65341
  var elem = elems[ei];
@@ -65369,9 +65380,9 @@ function _toHex8FromParenKey(k) {
65369
65380
  return k.slice(1, 5) + k.slice(6, 10);
65370
65381
  }
65371
65382
  var dictionary = new Proxy(/* @__PURE__ */ Object.create(null), {
65372
- get: function get(_t2, prop) {
65383
+ get: function get(_t, prop) {
65373
65384
  if (typeof prop !== "string") return void 0;
65374
- if (Object.prototype.hasOwnProperty.call(_t2, prop)) return _t2[prop];
65385
+ if (Object.prototype.hasOwnProperty.call(_t, prop)) return _t[prop];
65375
65386
  if (cache.has(prop)) return cache.get(prop);
65376
65387
  if (prop.length === 11 && prop[0] === "(" && prop[5] === "," && prop[10] === ")") {
65377
65388
  var hex8 = _toHex8FromParenKey(prop);
@@ -65414,7 +65425,7 @@ var dictionary = new Proxy(/* @__PURE__ */ Object.create(null), {
65414
65425
  }
65415
65426
  return void 0;
65416
65427
  },
65417
- has: function has(_t2, prop) {
65428
+ has: function has(_t, prop) {
65418
65429
  if (typeof prop !== "string") return false;
65419
65430
  if (cache.has(prop)) return true;
65420
65431
  if (prop.length === 11 && prop[0] === "(" && prop[5] === "," && prop[10] === ")") {
@@ -65869,7 +65880,7 @@ var Tag = /* @__PURE__ */ (function() {
65869
65880
  }
65870
65881
  }, {
65871
65882
  key: "is",
65872
- value: function is(t6) {
65883
+ value: function is2(t6) {
65873
65884
  return this.value == t6;
65874
65885
  }
65875
65886
  /**
@@ -71559,8 +71570,8 @@ var MeasurementReport$2 = /* @__PURE__ */ (function() {
71559
71570
  key: "getCornerstoneLabelFromDefaultState",
71560
71571
  value: function getCornerstoneLabelFromDefaultState(defaultState) {
71561
71572
  var _defaultState$finding = defaultState.findingSites, findingSites = _defaultState$finding === void 0 ? [] : _defaultState$finding, finding = defaultState.finding;
71562
- var freeTextLabel = findingSites.find(function(fs4) {
71563
- return isFreeTextCodeValue(fs4.CodeValue) || isLegacyFreeTextCodeValue(fs4.CodeValue);
71573
+ var freeTextLabel = findingSites.find(function(fs3) {
71574
+ return isFreeTextCodeValue(fs3.CodeValue) || isLegacyFreeTextCodeValue(fs3.CodeValue);
71564
71575
  });
71565
71576
  if (freeTextLabel) {
71566
71577
  return freeTextLabel.CodeMeaning;
@@ -73311,8 +73322,8 @@ var AgentDicomChannel = class extends BaseChannel {
73311
73322
  this.association = association;
73312
73323
  association.setMaxPduLength(65536);
73313
73324
  association.getPresentationContexts().forEach(({ context }) => {
73314
- context.getTransferSyntaxUids().forEach((ts2) => {
73315
- context.setResult(dimse.constants.PresentationContextResult.Accept, ts2);
73325
+ context.getTransferSyntaxUids().forEach((ts) => {
73326
+ context.setResult(dimse.constants.PresentationContextResult.Accept, ts);
73316
73327
  });
73317
73328
  });
73318
73329
  this.sendAssociationAccept();
@@ -73433,7 +73444,7 @@ var AgentDicomChannel = class extends BaseChannel {
73433
73444
  this.server.on("networkError", async (err2) => {
73434
73445
  this.log.error("Network error: ", { err: err2 });
73435
73446
  if (err2?.code === "EADDRINUSE") {
73436
- await dn(50);
73447
+ await pn(50);
73437
73448
  this.server.close();
73438
73449
  this.server.listen(port);
73439
73450
  }
@@ -74016,7 +74027,7 @@ var ChannelQueueWorker = class {
74016
74027
  async waitForWork() {
74017
74028
  const wake = this.wakeSignal;
74018
74029
  this.wakeSignal = makeWakeSignal();
74019
- await Promise.race([wake.promise, dn(this.idlePollMs)]);
74030
+ await Promise.race([wake.promise, pn(this.idlePollMs)]);
74020
74031
  }
74021
74032
  };
74022
74033
  function classifyStatusCode(statusCode) {
@@ -74166,7 +74177,7 @@ var AgentHl7Channel = class extends BaseChannel {
74166
74177
  this.log.warn(`Attempted to send message to disconnected remote: ${msg.remote}`);
74167
74178
  return false;
74168
74179
  }
74169
- const hl7Message = ts.parse(msg.body);
74180
+ const hl7Message = rs.parse(msg.body);
74170
74181
  const msgControlId = hl7Message.getSegment("MSA")?.getField(2)?.toString();
74171
74182
  const ackCode = hl7Message.getSegment("MSA")?.getField(1)?.toString()?.toUpperCase();
74172
74183
  if (ackCode && isAppLevelAckCode(ackCode) && !shouldSendAppLevelAck({
@@ -74184,7 +74195,7 @@ var AgentHl7Channel = class extends BaseChannel {
74184
74195
  }
74185
74196
  this.channelLog.info(`[Sending ACK -- ID: ${msgControlId}]: ${hl7Message.toString().replaceAll("\r", "\n")}`);
74186
74197
  try {
74187
- connection.hl7Connection.send(ts.parse(msg.body));
74198
+ connection.hl7Connection.send(rs.parse(msg.body));
74188
74199
  } catch (err2) {
74189
74200
  this.channelLog.error(`Failed to send ACK to ${msg.remote}: ${Ie(err2)}`);
74190
74201
  return false;
@@ -75074,7 +75085,7 @@ var DEFAULT_LOGGER_CONFIG = {
75074
75085
  logDir: __dirname,
75075
75086
  maxFileSizeMb: 10,
75076
75087
  filesToKeep: 10,
75077
- logLevel: it.INFO
75088
+ logLevel: ot.INFO
75078
75089
  };
75079
75090
  var LOGGER_CONFIG_INTEGER_KEYS = ["maxFileSizeMb", "filesToKeep"];
75080
75091
  var LEVELS_TO_UPPERCASE = {
@@ -75103,7 +75114,7 @@ function cleanupLoggerConfig(config, configPathRoot = "config") {
75103
75114
  warnings.push(`${configPathRoot}.filesToKeep must be a valid integer`);
75104
75115
  config.filesToKeep = void 0;
75105
75116
  }
75106
- if (typeof config.logLevel !== "undefined" && !(typeof config.logLevel === "number" && Qu[config.logLevel] !== void 0)) {
75117
+ if (typeof config.logLevel !== "undefined" && !(typeof config.logLevel === "number" && zu[config.logLevel] !== void 0)) {
75107
75118
  warnings.push(`${configPathRoot}.logLevel must be a valid log level between LogLevel.NONE and LogLevel.DEBUG`);
75108
75119
  config.logLevel = void 0;
75109
75120
  }
@@ -75141,14 +75152,14 @@ function parseLoggerConfigFromArgs(args) {
75141
75152
  if (!propName.startsWith("logger.") || propVal === void 0) {
75142
75153
  continue;
75143
75154
  }
75144
- const [_2, configType, settingName] = Ze(propName, ".", 3);
75155
+ const [_2, configType, settingName] = et(propName, ".", 3);
75145
75156
  if (!LOGGER_CONFIG_KEYS.includes(settingName)) {
75146
75157
  warnings.push(`${propName} is not a valid setting name`);
75147
75158
  }
75148
75159
  let configValue;
75149
75160
  if (settingName === "logLevel") {
75150
75161
  try {
75151
- configValue = my(propVal);
75162
+ configValue = hy(propVal);
75152
75163
  } catch (err2) {
75153
75164
  warnings.push(`Error while parsing ${propName}: ${Ie(err2)}`);
75154
75165
  }
@@ -75176,14 +75187,14 @@ function parseLoggerConfigFromArgs(args) {
75176
75187
  function getWinstonLevelFromMedplumLevel(level) {
75177
75188
  switch (level) {
75178
75189
  // Return error for NONE since we are going to turn silent on anyways
75179
- case it.NONE:
75180
- case it.ERROR:
75190
+ case ot.NONE:
75191
+ case ot.ERROR:
75181
75192
  return "error";
75182
- case it.WARN:
75193
+ case ot.WARN:
75183
75194
  return "warn";
75184
- case it.INFO:
75195
+ case ot.INFO:
75185
75196
  return "info";
75186
- case it.DEBUG:
75197
+ case ot.DEBUG:
75187
75198
  return "debug";
75188
75199
  default:
75189
75200
  throw new Error("Invalid log level");
@@ -75193,7 +75204,7 @@ function createWinstonFromLoggerConfig(config, loggerType) {
75193
75204
  const level = getWinstonLevelFromMedplumLevel(config.logLevel);
75194
75205
  const logger = import_winston.default.createLogger({
75195
75206
  level,
75196
- silent: config.logLevel === it.NONE,
75207
+ silent: config.logLevel === ot.NONE,
75197
75208
  format: import_winston.default.format.combine(
75198
75209
  import_winston.default.format.timestamp(),
75199
75210
  // Custom transform to match previous Medplum logger output
@@ -75247,16 +75258,16 @@ var WinstonWrapperLogger = class _WinstonWrapperLogger {
75247
75258
  this.prefix = options?.prefix;
75248
75259
  }
75249
75260
  debug(msg, data2) {
75250
- this.log(it.DEBUG, msg, data2);
75261
+ this.log(ot.DEBUG, msg, data2);
75251
75262
  }
75252
75263
  info(msg, data2) {
75253
- this.log(it.INFO, msg, data2);
75264
+ this.log(ot.INFO, msg, data2);
75254
75265
  }
75255
75266
  warn(msg, data2) {
75256
- this.log(it.WARN, msg, data2);
75267
+ this.log(ot.WARN, msg, data2);
75257
75268
  }
75258
75269
  error(msg, data2) {
75259
- this.log(it.ERROR, msg, data2);
75270
+ this.log(ot.ERROR, msg, data2);
75260
75271
  }
75261
75272
  log(level, msg, data2) {
75262
75273
  if (level > this.level) {
@@ -75271,16 +75282,16 @@ var WinstonWrapperLogger = class _WinstonWrapperLogger {
75271
75282
  const dataToLog = { ...data2, ...this.metadata };
75272
75283
  const msgToLog = this.prefix ? `${this.prefix}${msg}` : msg;
75273
75284
  switch (level) {
75274
- case it.DEBUG:
75285
+ case ot.DEBUG:
75275
75286
  this.winston.debug(msgToLog, dataToLog);
75276
75287
  return;
75277
- case it.INFO:
75288
+ case ot.INFO:
75278
75289
  this.winston.info(msgToLog, dataToLog);
75279
75290
  return;
75280
- case it.WARN:
75291
+ case ot.WARN:
75281
75292
  this.winston.warn(msgToLog, dataToLog);
75282
75293
  return;
75283
- case it.ERROR:
75294
+ case ot.ERROR:
75284
75295
  this.winston.error(msgToLog, dataToLog);
75285
75296
  }
75286
75297
  }
@@ -75295,24 +75306,55 @@ var WinstonWrapperLogger = class _WinstonWrapperLogger {
75295
75306
  return this.winston;
75296
75307
  }
75297
75308
  async fetchLogs(options) {
75298
- if (options?.limit !== void 0 && (typeof options.limit !== "number" || options.limit <= 0 || options.limit > MAX_LOG_LIMIT)) {
75309
+ if (options?.limit !== void 0 && (typeof options.limit !== "number" || !Number.isInteger(options.limit) || options.limit <= 0 || options.limit > MAX_LOG_LIMIT)) {
75299
75310
  throw new Error(
75300
75311
  `Invalid limit: ${options.limit} - must be a valid positive integer less than or equal to ${MAX_LOG_LIMIT}`
75301
75312
  );
75302
75313
  }
75303
75314
  const limit = options?.limit ?? DEFAULT_LOG_LIMIT;
75304
- return new Promise((resolve2, reject) => {
75315
+ let until;
75316
+ let skip = 0;
75317
+ if (options?.before !== void 0) {
75318
+ const at = options.before.lastIndexOf("@");
75319
+ const timestampPart = at === -1 ? options.before : options.before.slice(0, at);
75320
+ const skipPart = at === -1 ? "0" : options.before.slice(at + 1);
75321
+ const beforeMs = new Date(timestampPart).getTime();
75322
+ const parsedSkip = Number(skipPart);
75323
+ if (Number.isNaN(beforeMs) || !Number.isInteger(parsedSkip) || parsedSkip < 0) {
75324
+ throw new Error(`Invalid before cursor: ${options.before}`);
75325
+ }
75326
+ until = new Date(beforeMs);
75327
+ skip = parsedSkip;
75328
+ }
75329
+ const queryLogs = await new Promise((resolve2, reject) => {
75305
75330
  this.winston.query(
75306
- { order: "desc", limit, fields: ["level", "msg", "timestamp"] },
75331
+ {
75332
+ order: "desc",
75333
+ start: skip,
75334
+ limit: limit + 1,
75335
+ from: /* @__PURE__ */ new Date(0),
75336
+ ...until ? { until } : {},
75337
+ fields: ["level", "msg", "timestamp"]
75338
+ },
75307
75339
  (err2, results) => {
75308
75340
  if (err2) {
75309
75341
  reject(err2);
75310
75342
  return;
75311
75343
  }
75312
- resolve2(results.dailyRotateFile);
75344
+ resolve2(results.dailyRotateFile ?? []);
75313
75345
  }
75314
75346
  );
75315
75347
  });
75348
+ const hasMore = queryLogs.length > limit;
75349
+ const logs = queryLogs.slice(0, limit);
75350
+ let nextBefore;
75351
+ if (hasMore && logs.length > 0) {
75352
+ const oldest = logs.at(-1).timestamp;
75353
+ const sameTimestampInPage = logs.filter((l) => l.timestamp === oldest).length;
75354
+ const carriedSkip = new Date(oldest).getTime() === until?.getTime() ? skip : 0;
75355
+ nextBefore = `${oldest}@${carriedSkip + sameTimestampInPage}`;
75356
+ }
75357
+ return { logs, hasMore, nextBefore };
75316
75358
  }
75317
75359
  };
75318
75360
 
@@ -75322,7 +75364,7 @@ var import_node_os2 = require("node:os");
75322
75364
  var import_node_path3 = __toESM(require("node:path"));
75323
75365
  var import_node_process = __toESM(require("node:process"));
75324
75366
  var EXIT_SIGNALS = ["SIGINT", "SIGTERM", "SIGHUP"];
75325
- var pidLogger = new ns((msg) => `[PID]: ${msg}`);
75367
+ var pidLogger = new is((msg) => `[PID]: ${msg}`);
75326
75368
  var pidFileApps = /* @__PURE__ */ new Set();
75327
75369
  var processExitListener = () => {
75328
75370
  removeAllPidFiles();
@@ -75440,7 +75482,7 @@ async function waitForPidFile(appName, timeoutMs = 3e3) {
75440
75482
  if (Date.now() - startTime > timeoutMs) {
75441
75483
  throw new Error("Timeout while waiting for PID file");
75442
75484
  }
75443
- await dn(0);
75485
+ await pn(0);
75444
75486
  }
75445
75487
  }
75446
75488
  function removeAllPidFiles() {
@@ -76819,7 +76861,7 @@ var UPGRADER_LOG_PATH = (0, import_node_path4.resolve)(
76819
76861
  );
76820
76862
  var RELEASES_PATH = (0, import_node_path4.resolve)(__dirname);
76821
76863
  async function downloadRelease(version, path4) {
76822
- const release = await Yn("agent-upgrader", version);
76864
+ const release = await Xn("agent-upgrader", version);
76823
76865
  const downloadUrl = parseDownloadUrl(release, (0, import_node_os3.platform)());
76824
76866
  const result = await fetch(downloadUrl);
76825
76867
  if (!result.ok) {
@@ -76937,8 +76979,8 @@ var _App = class _App {
76937
76979
  _App.instance = this;
76938
76980
  this.medplum = medplum;
76939
76981
  this.agentId = agentId;
76940
- this.log = options?.mainLogger ?? new ns((msg) => console.log(msg), void 0, logLevel);
76941
- this.channelLog = options?.channelLogger ?? new ns((msg) => console.log(msg), void 0, logLevel);
76982
+ this.log = options?.mainLogger ?? new is((msg) => console.log(msg), void 0, logLevel);
76983
+ this.channelLog = options?.channelLogger ?? new is((msg) => console.log(msg), void 0, logLevel);
76942
76984
  }
76943
76985
  async start() {
76944
76986
  this.log.info("Medplum service starting...");
@@ -76982,7 +77024,7 @@ var _App = class _App {
76982
77024
  if (!upgradeDetails) {
76983
77025
  return;
76984
77026
  }
76985
- if (Pn.startsWith(upgradeDetails.targetVersion)) {
77027
+ if (Cn.startsWith(upgradeDetails.targetVersion)) {
76986
77028
  await this.sendToWebSocket({
76987
77029
  type: "agent:upgrade:response",
76988
77030
  statusCode: 200,
@@ -76990,7 +77032,7 @@ var _App = class _App {
76990
77032
  });
76991
77033
  this.log.info(`Successfully upgraded to version ${upgradeDetails.targetVersion}`);
76992
77034
  } else {
76993
- const errMsg = `Failed to upgrade to version ${upgradeDetails.targetVersion}. Agent still running with version ${Pn}`;
77035
+ const errMsg = `Failed to upgrade to version ${upgradeDetails.targetVersion}. Agent still running with version ${Cn}`;
76994
77036
  await this.sendToWebSocket({
76995
77037
  type: "agent:error",
76996
77038
  body: errMsg,
@@ -77017,7 +77059,7 @@ var _App = class _App {
77017
77059
  if (attempt === maxAttempts) {
77018
77060
  throw new Error("Too many unsuccessful attempts to create agent PID file");
77019
77061
  }
77020
- await dn(50);
77062
+ await pn(50);
77021
77063
  }
77022
77064
  }
77023
77065
  }
@@ -77066,7 +77108,7 @@ var _App = class _App {
77066
77108
  webSocketUrl.protocol = webSocketUrl.protocol === "https:" ? "wss:" : "ws:";
77067
77109
  webSocketUrl.pathname = "/ws/agent";
77068
77110
  this.log.info(`Connecting to WebSocket: ${webSocketUrl.href}`);
77069
- this.webSocket = new dr(webSocketUrl.toString(), void 0, {
77111
+ this.webSocket = new pr(webSocketUrl.toString(), void 0, {
77070
77112
  WebSocket: wrapper_default,
77071
77113
  binaryType: "nodebuffer"
77072
77114
  });
@@ -77114,7 +77156,7 @@ var _App = class _App {
77114
77156
  break;
77115
77157
  case "agent:heartbeat:request":
77116
77158
  this.outstandingHeartbeats = 0;
77117
- await this.sendToWebSocket({ type: "agent:heartbeat:response", version: Pn });
77159
+ await this.sendToWebSocket({ type: "agent:heartbeat:response", version: Cn });
77118
77160
  break;
77119
77161
  case "agent:heartbeat:response":
77120
77162
  this.outstandingHeartbeats = 0;
@@ -77888,7 +77930,7 @@ IPv6 is currently unsupported.`;
77888
77930
  this.log.error(errMsg);
77889
77931
  throw new Error(errMsg);
77890
77932
  }
77891
- if (!((0, import_node_net4.isIPv4)(message.remote) || yp(message.remote))) {
77933
+ if (!((0, import_node_net4.isIPv4)(message.remote) || xp(message.remote))) {
77892
77934
  const errMsg = `Attempted to ping an invalid host.
77893
77935
 
77894
77936
  "${message.remote}" is not a valid IPv4 address or a resolvable hostname.`;
@@ -77940,7 +77982,7 @@ ${result}`);
77940
77982
  }
77941
77983
  }
77942
77984
  async tryUpgradeAgent(message) {
77943
- this.log.info(`Attempting to upgrade from ${Pn} to ${message.version ?? "latest"}...`);
77985
+ this.log.info(`Attempting to upgrade from ${Cn} to ${message.version ?? "latest"}...`);
77944
77986
  if ((0, import_node_os4.platform)() !== "win32") {
77945
77987
  const errMsg = "Auto-upgrading is currently only supported on Windows";
77946
77988
  this.log.error(errMsg);
@@ -77963,7 +78005,7 @@ ${result}`);
77963
78005
  return;
77964
78006
  }
77965
78007
  let child;
77966
- if (message.version && !await yx("agent-upgrader", message.version)) {
78008
+ if (message.version && !await xx("agent-upgrader", message.version)) {
77967
78009
  const versionTag = message.version ? `v${message.version}` : "latest";
77968
78010
  const errMsg = `Error during upgrading to version '${versionTag}'. '${message.version}' is not a valid version`;
77969
78011
  this.log.error(errMsg);
@@ -77974,8 +78016,8 @@ ${result}`);
77974
78016
  });
77975
78017
  return;
77976
78018
  }
77977
- const targetVersion = message.version ?? await xx("agent-upgrader");
77978
- if (Pn.startsWith(targetVersion)) {
78019
+ const targetVersion = message.version ?? await vx("agent-upgrader");
78020
+ if (Cn.startsWith(targetVersion)) {
77979
78021
  if (!message?.force) {
77980
78022
  this.log.info(`Attempted to upgrade to version ${targetVersion}, but agent is already on that version`);
77981
78023
  await this.sendToWebSocket({
@@ -77985,7 +78027,7 @@ ${result}`);
77985
78027
  });
77986
78028
  return;
77987
78029
  }
77988
- this.log.info(`Forcing upgrade from ${Pn} to ${targetVersion}`);
78030
+ this.log.info(`Forcing upgrade from ${Cn} to ${targetVersion}`);
77989
78031
  }
77990
78032
  if (semver.lt(targetVersion, "4.2.4") && !message.force) {
77991
78033
  const errMsg = `WARNING: ${targetVersion} predates the zero-downtime upgrade feature. Downgrading to this version will 1) incur downtime during the downgrade process, as the current agent must stop itself before installing the older agent, and 2) incur downtime on any subsequent upgrade to a later version. We recommend against downgrading to this version, but if you must, reissue the command with force set to true to downgrade.`;
@@ -78010,7 +78052,7 @@ ${result}`);
78010
78052
  }
78011
78053
  }
78012
78054
  try {
78013
- const release = await Yn("agent-upgrader", targetVersion);
78055
+ const release = await Xn("agent-upgrader", targetVersion);
78014
78056
  parseDownloadUrl(release, (0, import_node_os4.platform)());
78015
78057
  } catch (err2) {
78016
78058
  const versionTag = message.version ? `v${message.version}` : "latest";
@@ -78064,11 +78106,11 @@ ${result}`);
78064
78106
  return;
78065
78107
  }
78066
78108
  try {
78067
- this.log.info("Writing upgrade manifest...", { previousVersion: Pn, targetVersion });
78109
+ this.log.info("Writing upgrade manifest...", { previousVersion: Cn, targetVersion });
78068
78110
  (0, import_node_fs5.writeFileSync)(
78069
78111
  UPGRADE_MANIFEST_PATH,
78070
78112
  JSON.stringify({
78071
- previousVersion: Pn,
78113
+ previousVersion: Cn,
78072
78114
  targetVersion,
78073
78115
  callback: message.callback ?? null
78074
78116
  }),
@@ -78112,11 +78154,16 @@ ${result}`);
78112
78154
  return;
78113
78155
  }
78114
78156
  try {
78115
- const logs = await this.log.fetchLogs({ limit: command.limit });
78157
+ const { logs, hasMore, nextBefore } = await this.log.fetchLogs({
78158
+ limit: command.limit,
78159
+ before: command.before
78160
+ });
78116
78161
  await this.sendToWebSocket({
78117
78162
  type: "agent:logs:response",
78118
78163
  statusCode: 200,
78119
78164
  logs,
78165
+ hasMore,
78166
+ nextBefore,
78120
78167
  callback: command.callback
78121
78168
  });
78122
78169
  } catch (err2) {
@@ -78193,7 +78240,7 @@ ${result}`);
78193
78240
  } catch (err2) {
78194
78241
  this.log.warn(`${Ie(err2)} - falling back to default return ACK behavior of 'first'.`);
78195
78242
  }
78196
- const returnAck = msgReturnAck ?? defaultReturnAck ?? Xf.FIRST;
78243
+ const returnAck = msgReturnAck ?? defaultReturnAck ?? Zf.FIRST;
78197
78244
  let pool;
78198
78245
  if (this.hl7Clients.has(message.remote)) {
78199
78246
  pool = this.hl7Clients.get(message.remote);
@@ -78214,7 +78261,7 @@ ${result}`);
78214
78261
  encoding
78215
78262
  });
78216
78263
  }
78217
- const requestMsg = ts.parse(message.body);
78264
+ const requestMsg = rs.parse(message.body);
78218
78265
  const msh10 = requestMsg.getSegment("MSH")?.getField(10);
78219
78266
  if (!msh10) {
78220
78267
  const errMsg = "MSH.10 is missing but required";
@@ -78296,10 +78343,10 @@ ${result}`);
78296
78343
  }
78297
78344
  const normalizedValue = rawValue.toLowerCase();
78298
78345
  if (normalizedValue === "application") {
78299
- return Xf.APPLICATION;
78346
+ return Zf.APPLICATION;
78300
78347
  }
78301
78348
  if (normalizedValue === "first") {
78302
- return Xf.FIRST;
78349
+ return Zf.FIRST;
78303
78350
  }
78304
78351
  throw new Error(`Invalid value for returnAck; expected: 'first' or 'application', received: ${rawValue}`);
78305
78352
  }
@@ -78340,7 +78387,7 @@ async function agentMain(argv) {
78340
78387
  process.exit(1);
78341
78388
  }
78342
78389
  const { baseUrl, clientId, clientSecret, agentId } = args;
78343
- const medplum = new fr({ baseUrl, clientId });
78390
+ const medplum = new mr({ baseUrl, clientId });
78344
78391
  let loggedIn = false;
78345
78392
  while (!loggedIn) {
78346
78393
  try {
@@ -78349,7 +78396,7 @@ async function agentMain(argv) {
78349
78396
  } catch (err2) {
78350
78397
  console.error("Failed to login", { err: Ie(err2) });
78351
78398
  console.log("Retrying login in 10 seconds...");
78352
- await dn(RETRY_WAIT_DURATION_MS);
78399
+ await pn(RETRY_WAIT_DURATION_MS);
78353
78400
  }
78354
78401
  }
78355
78402
  if (args.logLevel) {
@@ -78362,7 +78409,7 @@ async function agentMain(argv) {
78362
78409
  for (const warning of warnings) {
78363
78410
  mainLogger.warn(warning);
78364
78411
  }
78365
- const app = new App(medplum, agentId, args.logLevel ? my(args.logLevel) : void 0, {
78412
+ const app = new App(medplum, agentId, args.logLevel ? hy(args.logLevel) : void 0, {
78366
78413
  mainLogger,
78367
78414
  channelLogger
78368
78415
  });
@@ -78394,7 +78441,7 @@ async function upgraderMain(argv) {
78394
78441
  if ((0, import_node_os5.platform)() !== "win32") {
78395
78442
  throw new Error(`Unsupported platform: ${(0, import_node_os5.platform)()}. Agent upgrader currently only supports Windows`);
78396
78443
  }
78397
- const globalLogger = new ns((msg) => console.log(msg));
78444
+ const globalLogger = new is((msg) => console.log(msg));
78398
78445
  if (!import_node_process3.default.send) {
78399
78446
  globalLogger.error("Upgrader not started as a child process with Node IPC enabled. Aborting...");
78400
78447
  import_node_process3.default.exit(1);
@@ -78408,10 +78455,10 @@ async function upgraderMain(argv) {
78408
78455
  rejectOnTimeout = () => reject(new Error("Timed out while waiting for IPC to disconnect"));
78409
78456
  import_node_process3.default.once("disconnect", resolve2);
78410
78457
  });
78411
- if (argv[3] && !yl(argv[3])) {
78458
+ if (argv[3] && !xl(argv[3])) {
78412
78459
  throw new Error("Invalid version specified");
78413
78460
  }
78414
- version = argv[3] ?? await xx("agent-upgrader");
78461
+ version = argv[3] ?? await vx("agent-upgrader");
78415
78462
  binPath = getReleaseBinPath(version);
78416
78463
  if (!(0, import_node_fs7.existsSync)(binPath)) {
78417
78464
  globalLogger.info(`Could not find binary at "${binPath}". Downloading release from GitHub...`);
@@ -78466,7 +78513,7 @@ async function main(argv) {
78466
78513
  } else if (argv[2] === "--remove-old-services") {
78467
78514
  const logFileFd = (0, import_node_fs8.openSync)(TEMP_LOG_FILE, "a");
78468
78515
  let allAgentServices = [];
78469
- const currentServiceName = `MedplumAgent_${Pn}`;
78516
+ const currentServiceName = `MedplumAgent_${Cn}`;
78470
78517
  while (!allAgentServices.includes(currentServiceName)) {
78471
78518
  const output = (0, import_node_child_process3.execSync)('cmd.exe /c sc query type= service state= all | findstr /i "SERVICE_NAME.*MedplumAgent"');
78472
78519
  (0, import_node_fs8.appendFileSync)(logFileFd, `${output}\r
@@ -78476,8 +78523,8 @@ async function main(argv) {
78476
78523
  ${allAgentServices.join("\r\n")}\r
78477
78524
  `, { encoding: "utf-8" });
78478
78525
  }
78479
- const servicesToRemove = argv[3] === "--all" ? allAgentServices : allAgentServices.filter((serviceName) => serviceName !== `MedplumAgent_${Pn}`);
78480
- (0, import_node_fs8.appendFileSync)(logFileFd, `Medplum agent service to filter out: MedplumAgent_${Pn}\r
78526
+ const servicesToRemove = argv[3] === "--all" ? allAgentServices : allAgentServices.filter((serviceName) => serviceName !== `MedplumAgent_${Cn}`);
78527
+ (0, import_node_fs8.appendFileSync)(logFileFd, `Medplum agent service to filter out: MedplumAgent_${Cn}\r
78481
78528
  `, {
78482
78529
  encoding: "utf-8"
78483
78530
  });