@medplum/agent 4.4.3 → 4.5.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (2) hide show
  1. package/dist/cjs/index.cjs +177 -177
  2. package/package.json +5 -5
@@ -9904,10 +9904,10 @@ var require_dcmjs = __commonJS({
9904
9904
  throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
9905
9905
  }
9906
9906
  function _createForOfIteratorHelper(o, allowArrayLike) {
9907
- var it = typeof Symbol !== "undefined" && o[Symbol.iterator] || o["@@iterator"];
9908
- if (!it) {
9909
- if (Array.isArray(o) || (it = _unsupportedIterableToArray(o)) || allowArrayLike) {
9910
- if (it) o = it;
9907
+ var it2 = typeof Symbol !== "undefined" && o[Symbol.iterator] || o["@@iterator"];
9908
+ if (!it2) {
9909
+ if (Array.isArray(o) || (it2 = _unsupportedIterableToArray(o)) || allowArrayLike) {
9910
+ if (it2) o = it2;
9911
9911
  var i = 0;
9912
9912
  var F2 = function() {
9913
9913
  };
@@ -9933,10 +9933,10 @@ var require_dcmjs = __commonJS({
9933
9933
  var normalCompletion = true, didErr = false, err2;
9934
9934
  return {
9935
9935
  s: function() {
9936
- it = it.call(o);
9936
+ it2 = it2.call(o);
9937
9937
  },
9938
9938
  n: function() {
9939
- var step = it.next();
9939
+ var step = it2.next();
9940
9940
  normalCompletion = step.done;
9941
9941
  return step;
9942
9942
  },
@@ -9946,7 +9946,7 @@ var require_dcmjs = __commonJS({
9946
9946
  },
9947
9947
  f: function() {
9948
9948
  try {
9949
- if (!normalCompletion && it.return != null) it.return();
9949
+ if (!normalCompletion && it2.return != null) it2.return();
9950
9950
  } finally {
9951
9951
  if (didErr) throw err2;
9952
9952
  }
@@ -15814,8 +15814,8 @@ var require_dcmjs = __commonJS({
15814
15814
  } finally {
15815
15815
  _iterator.f();
15816
15816
  }
15817
- return _get(_getPrototypeOf(BinaryRepresentation2.prototype), "writeBytes", this).call(this, stream, value, value.map(function(it) {
15818
- return it.byteLength;
15817
+ return _get(_getPrototypeOf(BinaryRepresentation2.prototype), "writeBytes", this).call(this, stream, value, value.map(function(it2) {
15818
+ return it2.byteLength;
15819
15819
  }), writeOptions);
15820
15820
  }
15821
15821
  }
@@ -29942,10 +29942,10 @@ var require_dcmjs2 = __commonJS({
29942
29942
  throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
29943
29943
  }
29944
29944
  function _createForOfIteratorHelper(o, allowArrayLike) {
29945
- var it = typeof Symbol !== "undefined" && o[Symbol.iterator] || o["@@iterator"];
29946
- if (!it) {
29947
- if (Array.isArray(o) || (it = _unsupportedIterableToArray(o)) || allowArrayLike) {
29948
- if (it) o = it;
29945
+ var it2 = typeof Symbol !== "undefined" && o[Symbol.iterator] || o["@@iterator"];
29946
+ if (!it2) {
29947
+ if (Array.isArray(o) || (it2 = _unsupportedIterableToArray(o)) || allowArrayLike) {
29948
+ if (it2) o = it2;
29949
29949
  var i = 0;
29950
29950
  var F2 = function() {
29951
29951
  };
@@ -29971,10 +29971,10 @@ var require_dcmjs2 = __commonJS({
29971
29971
  var normalCompletion = true, didErr = false, err2;
29972
29972
  return {
29973
29973
  s: function() {
29974
- it = it.call(o);
29974
+ it2 = it2.call(o);
29975
29975
  },
29976
29976
  n: function() {
29977
- var step = it.next();
29977
+ var step = it2.next();
29978
29978
  normalCompletion = step.done;
29979
29979
  return step;
29980
29980
  },
@@ -29984,7 +29984,7 @@ var require_dcmjs2 = __commonJS({
29984
29984
  },
29985
29985
  f: function() {
29986
29986
  try {
29987
- if (!normalCompletion && it.return != null) it.return();
29987
+ if (!normalCompletion && it2.return != null) it2.return();
29988
29988
  } finally {
29989
29989
  if (didErr) throw err2;
29990
29990
  }
@@ -58711,15 +58711,15 @@ var require_index_cjs = __commonJS({
58711
58711
  convert$1.hwb.rgb = function(hwb) {
58712
58712
  const h3 = hwb[0] / 360;
58713
58713
  let wh2 = hwb[1] / 100;
58714
- let bl2 = hwb[2] / 100;
58715
- const ratio = wh2 + bl2;
58714
+ let bl = hwb[2] / 100;
58715
+ const ratio = wh2 + bl;
58716
58716
  let f3;
58717
58717
  if (ratio > 1) {
58718
58718
  wh2 /= ratio;
58719
- bl2 /= ratio;
58719
+ bl /= ratio;
58720
58720
  }
58721
58721
  const i = Math.floor(6 * h3);
58722
- const v2 = 1 - bl2;
58722
+ const v2 = 1 - bl;
58723
58723
  f3 = 6 * h3 - i;
58724
58724
  if ((i & 1) !== 0) {
58725
58725
  f3 = 1 - f3;
@@ -60670,11 +60670,11 @@ var require_http = __commonJS({
60670
60670
  _doBatch(options, callback, auth, path4) {
60671
60671
  this.batchOptions.push(options);
60672
60672
  if (this.batchOptions.length === 1) {
60673
- const me2 = this;
60673
+ const me = this;
60674
60674
  this.batchCallback = callback;
60675
60675
  this.batchTimeoutID = setTimeout(function() {
60676
- me2.batchTimeoutID = -1;
60677
- me2._doBatchRequest(me2.batchCallback, auth, path4);
60676
+ me.batchTimeoutID = -1;
60677
+ me._doBatchRequest(me.batchCallback, auth, path4);
60678
60678
  }, this.batchInterval);
60679
60679
  }
60680
60680
  if (this.batchOptions.length === this.batchCount) {
@@ -67556,7 +67556,7 @@ __export(main_exports, {
67556
67556
  module.exports = __toCommonJS(main_exports);
67557
67557
 
67558
67558
  // ../core/dist/esm/index.mjs
67559
- var st = class {
67559
+ var ot = class {
67560
67560
  constructor(e, t) {
67561
67561
  this.operator = e, this.child = t;
67562
67562
  }
@@ -67572,7 +67572,7 @@ var ne = class {
67572
67572
  return `(${this.left.toString()} ${this.operator} ${this.right.toString()})`;
67573
67573
  }
67574
67574
  };
67575
- var at = class {
67575
+ var st = class {
67576
67576
  constructor() {
67577
67577
  this.prefixParselets = {};
67578
67578
  this.infixParselets = {};
@@ -67647,7 +67647,7 @@ var ar = class {
67647
67647
  return this.infixParselets[e.id === "Symbol" ? e.value : e.id];
67648
67648
  }
67649
67649
  };
67650
- var Oe = class {
67650
+ var Ie = class {
67651
67651
  constructor(e = 10) {
67652
67652
  this.max = e, this.cache = /* @__PURE__ */ new Map();
67653
67653
  }
@@ -67671,15 +67671,15 @@ var Oe = class {
67671
67671
  return this.cache.keys().next().value;
67672
67672
  }
67673
67673
  };
67674
- var ct = "created";
67674
+ var at = "created";
67675
67675
  var ur = "not-modified";
67676
67676
  var pr = "not-found";
67677
67677
  var fr = "unauthorized";
67678
- var ut = "accepted";
67678
+ var ct = "accepted";
67679
67679
  var bn = { resourceType: "OperationOutcome", id: pr, issue: [{ severity: "error", code: "not-found", details: { text: "Not found" } }] };
67680
- var Ie = { resourceType: "OperationOutcome", id: fr, issue: [{ severity: "error", code: "login", details: { text: "Unauthorized" } }] };
67681
- var En = { ...Ie, issue: [...Ie.issue, { severity: "error", code: "expired", details: { text: "Token expired" } }] };
67682
- var hr = { ...Ie, issue: [...Ie.issue, { severity: "error", code: "invalid", details: { text: "Token not issued for this audience" } }] };
67680
+ var ke = { resourceType: "OperationOutcome", id: fr, issue: [{ severity: "error", code: "login", details: { text: "Unauthorized" } }] };
67681
+ var En = { ...ke, issue: [...ke.issue, { severity: "error", code: "expired", details: { text: "Token expired" } }] };
67682
+ var hr = { ...ke, issue: [...ke.issue, { severity: "error", code: "invalid", details: { text: "Token not issued for this audience" } }] };
67683
67683
  function b(r6, e) {
67684
67684
  return { resourceType: "OperationOutcome", issue: [{ severity: "error", code: "invalid", details: { text: r6 }, ...e ? { expression: [e] } : void 0 }] };
67685
67685
  }
@@ -67692,11 +67692,11 @@ function Rn(r6) {
67692
67692
  function mr(r6) {
67693
67693
  return !r6 || typeof r6 != "object" ? false : r6 instanceof Error || typeof DOMException < "u" && r6 instanceof DOMException ? true : Object.prototype.toString.call(r6) === "[object Error]";
67694
67694
  }
67695
- function ke(r6) {
67695
+ function ut(r6) {
67696
67696
  return typeof r6 == "object" && r6 !== null && r6.resourceType === "OperationOutcome";
67697
67697
  }
67698
67698
  function yr(r6) {
67699
- return r6.id === "ok" || r6.id === ct || r6.id === ur || r6.id === ut;
67699
+ return r6.id === "ok" || r6.id === at || r6.id === ur || r6.id === ct;
67700
67700
  }
67701
67701
  var d = class extends Error {
67702
67702
  constructor(e, t) {
@@ -67704,10 +67704,10 @@ var d = class extends Error {
67704
67704
  }
67705
67705
  };
67706
67706
  function lt(r6) {
67707
- return r6 instanceof d ? r6.outcome : ke(r6) ? r6 : b(Ve(r6));
67707
+ return r6 instanceof d ? r6.outcome : ut(r6) ? r6 : b(Ve(r6));
67708
67708
  }
67709
67709
  function Ve(r6) {
67710
- return r6 ? typeof r6 == "string" ? r6 : mr(r6) ? r6.message : ke(r6) ? Cn(r6) : typeof r6 == "object" && "code" in r6 && typeof r6.code == "string" ? r6.code : JSON.stringify(r6) : "Unknown error";
67710
+ return r6 ? typeof r6 == "string" ? r6 : mr(r6) ? r6.message : ut(r6) ? Cn(r6) : typeof r6 == "object" && "code" in r6 && typeof r6.code == "string" ? r6.code : JSON.stringify(r6) : "Unknown error";
67711
67711
  }
67712
67712
  function Cn(r6) {
67713
67713
  let e = r6.issue?.map(mo) ?? [];
@@ -67730,7 +67730,7 @@ var On = { Element: { elements: { id: { type: [{ code: "string" }] }, extension:
67730
67730
  function Tr(r6) {
67731
67731
  return new xr(r6).parse();
67732
67732
  }
67733
- var me = An(On);
67733
+ var ye = An(On);
67734
67734
  var Sr = /* @__PURE__ */ Object.create(null);
67735
67735
  var In = /* @__PURE__ */ Object.create(null);
67736
67736
  var vo = { "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" };
@@ -67747,19 +67747,19 @@ function Er(r6) {
67747
67747
  if (!r6?.name) throw new Error("Failed loading StructureDefinition from bundle");
67748
67748
  if (r6.resourceType !== "StructureDefinition") return;
67749
67749
  let e = Tr(r6), t = vo[r6.url], n, i;
67750
- t ? (n = me, i = t) : r6.url === `http://hl7.org/fhir/StructureDefinition/${r6.type}` || r6.url === `https://medplum.com/fhir/StructureDefinition/${r6.type}` || r6.type?.startsWith("http://") || r6.type?.startsWith("https://") ? (n = me, i = r6.type) : (n = Mn(r6.url), i = r6.type), n[i] = e;
67750
+ t ? (n = ye, i = t) : r6.url === `http://hl7.org/fhir/StructureDefinition/${r6.type}` || r6.url === `https://medplum.com/fhir/StructureDefinition/${r6.type}` || r6.type?.startsWith("http://") || r6.type?.startsWith("https://") ? (n = ye, i = r6.type) : (n = Mn(r6.url), i = r6.type), n[i] = e;
67751
67751
  for (let o of e.innerTypes) o.parentType = e, n[o.name] = o;
67752
67752
  Sr[r6.url] = e;
67753
67753
  }
67754
67754
  function Ln(r6) {
67755
- return !!me[r6];
67755
+ return !!ye[r6];
67756
67756
  }
67757
- function je(r6, e) {
67757
+ function qe(r6, e) {
67758
67758
  if (e) {
67759
67759
  let t = Mn(e)[r6];
67760
67760
  if (t) return t;
67761
67761
  }
67762
- return me[r6];
67762
+ return ye[r6];
67763
67763
  }
67764
67764
  function Nn(r6) {
67765
67765
  return !!Sr[r6];
@@ -67875,7 +67875,7 @@ function Eo(r6) {
67875
67875
  let e = r6.description;
67876
67876
  return e?.startsWith(`Base StructureDefinition for ${r6.name} Type: `) && (e = e.substring(`Base StructureDefinition for ${r6.name} Type: `.length)), e;
67877
67877
  }
67878
- var Po = new Oe(1e3);
67878
+ var Po = new Ie(1e3);
67879
67879
  var ft = { base64Binary: /^([A-Za-z\d+/]{4})*([A-Za-z\d+/]{2}==|[A-Za-z\d+/]{3}=)?$/, canonical: /^\S*$/, code: /^[^\s]+( [^\s]+)*$/, date: /^(\d(\d(\d[1-9]|[1-9]0)|[1-9]00)|[1-9]000)(-(0[1-9]|1[0-2])(-(0[1-9]|[1-2]\d|3[0-1]))?)?$/, dateTime: /^(\d(\d(\d[1-9]|[1-9]0)|[1-9]00)|[1-9]000)(-(0[1-9]|1[0-2])(-(0[1-9]|[1-2]\d|3[0-1])(T([01]\d|2[0-3])(:[0-5]\d:([0-5]\d|60)(\.\d{1,9})?)?)?)?(Z|[+-]((0\d|1[0-3]):[0-5]\d|14:00)?)?)?$/, id: /^[A-Za-z0-9\-.]{1,64}$/, instant: /^(\d(\d(\d[1-9]|[1-9]0)|[1-9]00)|[1-9]000)-(0[1-9]|1[0-2])-(0[1-9]|[1-2]\d|3[0-1])T([01]\d|2[0-3]):[0-5]\d:([0-5]\d|60)(\.\d{1,9})?(Z|[+-]((0\d|1[0-3]):[0-5]\d|14:00))$/, markdown: /^[\r\n\t\u0020-\uFFFF]+$/, oid: /^urn:oid:[0-2](\.(0|[1-9]\d*))+$/, string: /^[\r\n\t\u0020-\uFFFF]+$/, time: /^([01]\d|2[0-3]):[0-5]\d:([0-5]\d|60)(\.\d{1,9})?$/, uri: /^\S*$/, url: /^\S*$/, uuid: /^urn:uuid:[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/, xhtml: /.*/ };
67880
67880
  function h(r6) {
67881
67881
  return [{ type: l.boolean, value: r6 }];
@@ -67947,7 +67947,7 @@ function mt(r6) {
67947
67947
  let e = [];
67948
67948
  for (let t of r6) {
67949
67949
  let n = false;
67950
- for (let i of e) if (L(He(t, i))) {
67950
+ for (let i of e) if (L(Ge(t, i))) {
67951
67951
  n = true;
67952
67952
  break;
67953
67953
  }
@@ -67959,12 +67959,12 @@ function $n(r6) {
67959
67959
  return h(!L(r6));
67960
67960
  }
67961
67961
  function Gn(r6, e) {
67962
- return r6.length === 0 || e.length === 0 ? [] : r6.length !== e.length ? h(false) : h(r6.every((t, n) => L(He(t, e[n]))));
67962
+ return r6.length === 0 || e.length === 0 ? [] : r6.length !== e.length ? h(false) : h(r6.every((t, n) => L(Ge(t, e[n]))));
67963
67963
  }
67964
67964
  function Hn(r6, e) {
67965
- return r6.length === 0 || e.length === 0 ? [] : r6.length !== e.length ? h(true) : h(r6.some((t, n) => !L(He(t, e[n]))));
67965
+ return r6.length === 0 || e.length === 0 ? [] : r6.length !== e.length ? h(true) : h(r6.some((t, n) => !L(Ge(t, e[n]))));
67966
67966
  }
67967
- function He(r6, e) {
67967
+ function Ge(r6, e) {
67968
67968
  let t = r6.value?.valueOf(), n = e.value?.valueOf();
67969
67969
  return typeof t == "number" && typeof n == "number" ? h(Math.abs(t - n) < 1e-8) : w(t) && w(n) ? h(Jn(t, n)) : h(typeof t == "object" && typeof n == "object" ? Dr(r6, e) : t === n);
67970
67970
  }
@@ -68042,18 +68042,18 @@ function kr(r6, e) {
68042
68042
  function Lo(r6, e) {
68043
68043
  return delete e.__proto__, delete e.constructor, Object.assign(r6, e);
68044
68044
  }
68045
- function ze(r6, e) {
68045
+ function Qe(r6, e) {
68046
68046
  return O(r6, e) && "id" in r6 && typeof r6.id == "string";
68047
68047
  }
68048
- function ye(r6) {
68048
+ function ge(r6) {
68049
68049
  let e = D(r6) ?? "undefined/undefined", t = No(r6);
68050
68050
  return t === e ? { reference: e } : { reference: e, display: t };
68051
68051
  }
68052
68052
  function D(r6) {
68053
68053
  if (q(r6)) return r6.reference;
68054
- if (ze(r6)) return `${r6.resourceType}/${r6.id}`;
68054
+ if (Qe(r6)) return `${r6.resourceType}/${r6.id}`;
68055
68055
  }
68056
- function ge(r6) {
68056
+ function xe(r6) {
68057
68057
  if (r6) return q(r6) ? r6.reference.split("/")[1] : r6.id;
68058
68058
  }
68059
68059
  function Fo(r6) {
@@ -68068,20 +68068,20 @@ function No(r6) {
68068
68068
  let e = Bo(r6);
68069
68069
  if (e) return e;
68070
68070
  }
68071
- if (r6.resourceType === "MedicationRequest" && r6.medicationCodeableConcept) return Qe(r6.medicationCodeableConcept);
68071
+ if (r6.resourceType === "MedicationRequest" && r6.medicationCodeableConcept) return He(r6.medicationCodeableConcept);
68072
68072
  if (r6.resourceType === "Subscription" && r6.criteria) return r6.criteria;
68073
68073
  if (r6.resourceType === "User" && r6.email) return r6.email;
68074
68074
  if ("name" in r6 && r6.name && typeof r6.name == "string") return r6.name;
68075
68075
  if ("code" in r6 && r6.code) {
68076
68076
  let e = r6.code;
68077
- if (Array.isArray(e) && (e = e[0]), _r(e)) return Qe(e);
68077
+ if (Array.isArray(e) && (e = e[0]), _r(e)) return He(e);
68078
68078
  if (zo(e)) return e.text;
68079
68079
  }
68080
68080
  return D(r6) ?? "";
68081
68081
  }
68082
68082
  function Uo(r6) {
68083
68083
  let e = r6.name;
68084
- if (e && e.length > 0) return Je(e[0]);
68084
+ if (e && e.length > 0) return ze(e[0]);
68085
68085
  }
68086
68086
  function Bo(r6) {
68087
68087
  let e = r6.deviceName;
@@ -68223,32 +68223,32 @@ function ci(r6) {
68223
68223
  return typeof r6 == "object" && !Array.isArray(r6) && !(r6 instanceof URLSearchParams) && (r6 = Object.fromEntries(Object.entries(r6).filter((e) => e[1] !== void 0))), new URLSearchParams(r6).toString();
68224
68224
  }
68225
68225
  var rs = /^(([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])$/;
68226
- function bl(r6) {
68226
+ function Sl(r6) {
68227
68227
  return rs.test(r6);
68228
68228
  }
68229
- function Je(r6, e) {
68229
+ function ze(r6, e) {
68230
68230
  if (!r6) return "";
68231
68231
  let t = [];
68232
68232
  if (r6.prefix && e?.prefix !== false && t.push(...r6.prefix), r6.given && t.push(...r6.given), r6.family && t.push(r6.family), r6.suffix && e?.suffix !== false && t.push(...r6.suffix), r6.use && (e?.all || e?.use) && t.push("[" + r6.use + "]"), t.length === 0) {
68233
- let n = ve(r6.text);
68233
+ let n = Te(r6.text);
68234
68234
  if (n) return n;
68235
68235
  }
68236
68236
  return t.join(" ").trim();
68237
68237
  }
68238
- function Qe(r6) {
68238
+ function He(r6) {
68239
68239
  if (!r6) return "";
68240
- let e = ve(r6.text);
68240
+ let e = Te(r6.text);
68241
68241
  return e || (r6.coding ? r6.coding.map((t) => li(t)).join(", ") : "");
68242
68242
  }
68243
68243
  function li(r6, e) {
68244
- let t = ve(r6?.display);
68244
+ let t = Te(r6?.display);
68245
68245
  if (t) {
68246
- let n = e ? ve(r6?.code) : void 0;
68246
+ let n = e ? Te(r6?.code) : void 0;
68247
68247
  return `${t}${n ? " (" + n + ")" : ""}`;
68248
68248
  }
68249
- return ve(r6?.code) ?? "";
68249
+ return Te(r6?.code) ?? "";
68250
68250
  }
68251
- function ve(r6) {
68251
+ function Te(r6) {
68252
68252
  return typeof r6 == "string" ? r6 : void 0;
68253
68253
  }
68254
68254
  var l = { Address: "Address", Age: "Age", Annotation: "Annotation", Attachment: "Attachment", BackboneElement: "BackboneElement", CodeableConcept: "CodeableConcept", Coding: "Coding", ContactDetail: "ContactDetail", ContactPoint: "ContactPoint", Contributor: "Contributor", Count: "Count", DataRequirement: "DataRequirement", Distance: "Distance", Dosage: "Dosage", Duration: "Duration", Expression: "Expression", Extension: "Extension", HumanName: "HumanName", Identifier: "Identifier", MarketingStatus: "MarketingStatus", Meta: "Meta", Money: "Money", Narrative: "Narrative", ParameterDefinition: "ParameterDefinition", Period: "Period", Population: "Population", ProdCharacteristic: "ProdCharacteristic", ProductShelfLife: "ProductShelfLife", Quantity: "Quantity", Range: "Range", Ratio: "Ratio", Reference: "Reference", RelatedArtifact: "RelatedArtifact", SampledData: "SampledData", Signature: "Signature", SubstanceAmount: "SubstanceAmount", SystemString: "http://hl7.org/fhirpath/System.String", Timing: "Timing", TriggerDefinition: "TriggerDefinition", UsageContext: "UsageContext", base64Binary: "base64Binary", boolean: "boolean", canonical: "canonical", code: "code", date: "date", dateTime: "dateTime", decimal: "decimal", id: "id", instant: "instant", integer: "integer", markdown: "markdown", oid: "oid", positiveInt: "positiveInt", string: "string", time: "time", unsignedInt: "unsignedInt", uri: "uri", url: "url", uuid: "uuid" };
@@ -68274,7 +68274,7 @@ function fs2(r6) {
68274
68274
  return r6.length === 1 ? r6[0] : r6.map(k).join("");
68275
68275
  }
68276
68276
  function xt(r6, e, t) {
68277
- let n = je(r6, t);
68277
+ let n = qe(r6, t);
68278
68278
  if (n) return gs(n.elements, e);
68279
68279
  }
68280
68280
  function gs(r6, e) {
@@ -68295,7 +68295,7 @@ function q(r6, e) {
68295
68295
  return r6 && typeof r6 == "object" && "reference" in r6 && typeof r6.reference == "string" ? e ? r6.reference.match(new RegExp(`^${e}(/|\\?)`)) !== null : true : false;
68296
68296
  }
68297
68297
  var F = { types: {} };
68298
- function Fe(r6) {
68298
+ function Le(r6) {
68299
68299
  if (r6.startsWith("T")) return r6 + "T00:00:00.000Z".substring(r6.length);
68300
68300
  if (r6.length <= 10) return r6;
68301
68301
  try {
@@ -68319,10 +68319,10 @@ var I = { empty: (r6, e) => h(e.length === 0 || e.every((t) => S(t.value))), has
68319
68319
  return h(false);
68320
68320
  }, subsetOf: (r6, e, t) => {
68321
68321
  if (e.length === 0) return h(true);
68322
- let n = t.eval(r6, Te(r6));
68322
+ let n = t.eval(r6, Se(r6));
68323
68323
  return n.length === 0 ? h(false) : h(e.every((i) => n.some((o) => o.value === i.value)));
68324
68324
  }, supersetOf: (r6, e, t) => {
68325
- let n = t.eval(r6, Te(r6));
68325
+ let n = t.eval(r6, Se(r6));
68326
68326
  return n.length === 0 ? h(true) : e.length === 0 ? h(false) : h(n.every((i) => e.some((o) => o.value === i.value)));
68327
68327
  }, count: (r6, e) => [{ type: l.integer, value: e.length }], distinct: (r6, e) => {
68328
68328
  let t = [];
@@ -68341,21 +68341,21 @@ var I = { empty: (r6, e) => h(e.length === 0 || e.every((t) => S(t.value))), has
68341
68341
  return n >= e.length ? e : n <= 0 ? [] : e.slice(0, n);
68342
68342
  }, intersect: (r6, e, t) => {
68343
68343
  if (!t) return e;
68344
- let n = t.eval(r6, Te(r6)), i = [];
68344
+ let n = t.eval(r6, Se(r6)), i = [];
68345
68345
  for (let o of e) !i.some((s) => s.value === o.value) && n.some((s) => s.value === o.value) && i.push(o);
68346
68346
  return i;
68347
68347
  }, exclude: (r6, e, t) => {
68348
68348
  if (!t) return e;
68349
- let n = t.eval(r6, Te(r6)), i = [];
68349
+ let n = t.eval(r6, Se(r6)), i = [];
68350
68350
  for (let o of e) n.some((s) => s.value === o.value) || i.push(o);
68351
68351
  return i;
68352
68352
  }, union: (r6, e, t) => {
68353
68353
  if (!t) return e;
68354
- let n = t.eval(r6, Te(r6));
68354
+ let n = t.eval(r6, Se(r6));
68355
68355
  return mt([...e, ...n]);
68356
68356
  }, combine: (r6, e, t) => {
68357
68357
  if (!t) return e;
68358
- let n = t.eval(r6, Te(r6));
68358
+ let n = t.eval(r6, Se(r6));
68359
68359
  return [...e, ...n];
68360
68360
  }, htmlChecks: (r6, e, t) => [v(true)], iif: (r6, e, t, n, i) => {
68361
68361
  let o = t.eval(r6, e);
@@ -68379,11 +68379,11 @@ var I = { empty: (r6, e) => h(e.length === 0 || e.every((t) => S(t.value))), has
68379
68379
  }, convertsToInteger: (r6, e) => e.length === 0 ? [] : h(I.toInteger(r6, e).length === 1), toDate: (r6, e) => {
68380
68380
  if (e.length === 0) return [];
68381
68381
  let [{ value: t }] = J(e, 1);
68382
- return typeof t == "string" && /^\d{4}(-\d{2}(-\d{2})?)?/.exec(t) ? [{ type: l.date, value: Fe(t) }] : [];
68382
+ return typeof t == "string" && /^\d{4}(-\d{2}(-\d{2})?)?/.exec(t) ? [{ type: l.date, value: Le(t) }] : [];
68383
68383
  }, convertsToDate: (r6, e) => e.length === 0 ? [] : h(I.toDate(r6, e).length === 1), toDateTime: (r6, e) => {
68384
68384
  if (e.length === 0) return [];
68385
68385
  let [{ value: t }] = J(e, 1);
68386
- return typeof t == "string" && /^\d{4}(-\d{2}(-\d{2})?)?/.exec(t) ? [{ type: l.dateTime, value: Fe(t) }] : [];
68386
+ return typeof t == "string" && /^\d{4}(-\d{2}(-\d{2})?)?/.exec(t) ? [{ type: l.dateTime, value: Le(t) }] : [];
68387
68387
  }, convertsToDateTime: (r6, e) => e.length === 0 ? [] : h(I.toDateTime(r6, e).length === 1), toDecimal: (r6, e) => {
68388
68388
  if (e.length === 0) return [];
68389
68389
  let [{ value: t }] = J(e, 1);
@@ -68401,14 +68401,14 @@ var I = { empty: (r6, e) => h(e.length === 0 || e.every((t) => S(t.value))), has
68401
68401
  let [{ value: t }] = J(e, 1);
68402
68402
  if (typeof t == "string") {
68403
68403
  let n = /^T?(\d{2}(:\d{2}(:\d{2})?)?)/.exec(t);
68404
- if (n) return [{ type: l.time, value: Fe("T" + n[1]) }];
68404
+ if (n) return [{ type: l.time, value: Le("T" + n[1]) }];
68405
68405
  }
68406
68406
  return [];
68407
68407
  }, convertsToTime: (r6, e) => e.length === 0 ? [] : h(I.toTime(r6, e).length === 1), indexOf: (r6, e, t) => N((n, i) => n.indexOf(i), r6, e, t), substring: (r6, e, t, n) => N((i, o, s) => {
68408
68408
  let a = o, c = s ? a + s : i.length;
68409
68409
  return a < 0 || a >= i.length ? void 0 : i.substring(a, c);
68410
68410
  }, r6, e, t, n), startsWith: (r6, e, t) => N((n, i) => n.startsWith(i), r6, e, t), endsWith: (r6, e, t) => N((n, i) => n.endsWith(i), r6, e, t), contains: (r6, e, t) => N((n, i) => n.includes(i), r6, e, t), upper: (r6, e) => N((t) => t.toUpperCase(), r6, e), lower: (r6, e) => N((t) => t.toLowerCase(), r6, e), replace: (r6, e, t, n) => N((i, o, s) => i.replaceAll(o, s), r6, e, t, n), matches: (r6, e, t) => N((n, i) => !!new RegExp(i).exec(n), r6, e, t), replaceMatches: (r6, e, t, n) => N((i, o, s) => i.replaceAll(new RegExp(o, "g"), s.replaceAll(/\$\{(\w+)\}/g, "$<$1>")), r6, e, t, n), length: (r6, e) => N((t) => t.length, r6, e), toChars: (r6, e) => N((t) => t ? t.split("") : void 0, r6, e), encode: Z, decode: Z, escape: Z, unescape: Z, trim: Z, split: Z, join: (r6, e, t) => {
68411
- let n = t?.eval(r6, Te(r6))[0]?.value ?? "";
68411
+ let n = t?.eval(r6, Se(r6))[0]?.value ?? "";
68412
68412
  if (typeof n != "string") throw new Error("Separator must be a string.");
68413
68413
  return [{ type: l.string, value: e.map((i) => i.value?.toString() ?? "").join(n) }];
68414
68414
  }, abs: (r6, e) => z(Math.abs, r6, e), ceiling: (r6, e) => z(Math.ceil, r6, e), exp: (r6, e) => z(Math.exp, r6, e), floor: (r6, e) => z(Math.floor, r6, e), ln: (r6, e) => z(Math.log, r6, e), log: (r6, e, t) => z((n, i) => Math.log(n) / Math.log(i), r6, e, t), power: (r6, e, t) => z(Math.pow, r6, e, t), round: (r6, e, ...t) => z((n, i = 0) => {
@@ -68426,7 +68426,7 @@ var I = { empty: (r6, e) => h(e.length === 0 || e.every((t) => S(t.value))), has
68426
68426
  return [{ type: l.Quantity, value: { value: c[a], unit: a } }];
68427
68427
  }, is: (r6, e, t) => {
68428
68428
  let n = "";
68429
- return t instanceof $ ? n = t.name : t instanceof ue && (n = t.left.name + "." + t.right.name), n ? e.map((i) => ({ type: l.boolean, value: yt(i, n) })) : [];
68429
+ return t instanceof $ ? n = t.name : t instanceof le && (n = t.left.name + "." + t.right.name), n ? e.map((i) => ({ type: l.boolean, value: yt(i, n) })) : [];
68430
68430
  }, not: (r6, e) => I.toBoolean(r6, e).map((t) => ({ type: l.boolean, value: !t.value })), resolve: (r6, e) => e.map((t) => {
68431
68431
  let n = t.value, i;
68432
68432
  if (typeof n == "string") i = n;
@@ -68456,7 +68456,7 @@ var I = { empty: (r6, e) => h(e.length === 0 || e.every((t) => S(t.value))), has
68456
68456
  let n = e[0].value;
68457
68457
  if (!n?.reference) return [];
68458
68458
  let i = "";
68459
- return t instanceof $ && (i = t.name), i && !n.reference.startsWith(i + "/") ? [] : [{ type: l.id, value: ge(n) }];
68459
+ return t instanceof $ && (i = t.name), i && !n.reference.startsWith(i + "/") ? [] : [{ type: l.id, value: xe(n) }];
68460
68460
  }, extension: (r6, e, t) => {
68461
68461
  let n = t.eval(r6, e)[0].value, i = e?.[0]?.value;
68462
68462
  if (i) {
@@ -68484,7 +68484,7 @@ function J(r6, e) {
68484
68484
  for (let t of r6) if (t == null) throw new Error("Expected non-null argument");
68485
68485
  return r6;
68486
68486
  }
68487
- function Te(r6) {
68487
+ function Se(r6) {
68488
68488
  let e = r6;
68489
68489
  for (; e.parent?.variables.$this; ) e = e.parent;
68490
68490
  return [e.variables.$this];
@@ -68533,7 +68533,7 @@ var Et = class {
68533
68533
  return "{}";
68534
68534
  }
68535
68535
  };
68536
- var Rt = class extends st {
68536
+ var Rt = class extends ot {
68537
68537
  constructor(e, t, n) {
68538
68538
  super(e, t), this.impl = n;
68539
68539
  }
@@ -68544,7 +68544,7 @@ var Rt = class extends st {
68544
68544
  return this.operator + this.child.toString();
68545
68545
  }
68546
68546
  };
68547
- var le = class extends ne {
68547
+ var pe = class extends ne {
68548
68548
  constructor(e, t) {
68549
68549
  super("as", e, t);
68550
68550
  }
@@ -68591,10 +68591,10 @@ var wt = class extends C {
68591
68591
  }
68592
68592
  eval(e, t) {
68593
68593
  let n = H(this.left.eval(e, t)), i = this.right.eval(e, t);
68594
- return n ? h(i.some((o) => He(n, o)[0].value)) : [];
68594
+ return n ? h(i.some((o) => Ge(n, o)[0].value)) : [];
68595
68595
  }
68596
68596
  };
68597
- var ue = class extends ne {
68597
+ var le = class extends ne {
68598
68598
  constructor(e, t) {
68599
68599
  super(".", e, t);
68600
68600
  }
@@ -68605,7 +68605,7 @@ var ue = class extends ne {
68605
68605
  return `${this.left.toString()}.${this.right.toString()}`;
68606
68606
  }
68607
68607
  };
68608
- var Se = class extends ne {
68608
+ var be = class extends ne {
68609
68609
  constructor(e, t) {
68610
68610
  super("|", e, t);
68611
68611
  }
@@ -68650,7 +68650,7 @@ var kt = class extends C {
68650
68650
  return $n(Vr(n, i));
68651
68651
  }
68652
68652
  };
68653
- var be = class extends C {
68653
+ var Ee = class extends C {
68654
68654
  constructor(e, t) {
68655
68655
  super("is", e, t);
68656
68656
  }
@@ -68710,7 +68710,7 @@ var ee = class {
68710
68710
  return `${this.name}(${this.args.map((e) => e.toString()).join(", ")})`;
68711
68711
  }
68712
68712
  };
68713
- var Ee = class {
68713
+ var Re = class {
68714
68714
  constructor(e, t) {
68715
68715
  this.left = e, this.expr = t;
68716
68716
  }
@@ -68726,7 +68726,7 @@ var Ee = class {
68726
68726
  return `${this.left.toString()}[${this.expr.toString()}]`;
68727
68727
  }
68728
68728
  };
68729
- var Xe = ["!=", "!~", "<=", ">=", "{}", "->"];
68729
+ var Ke = ["!=", "!~", "<=", ">=", "{}", "->"];
68730
68730
  var g = { FunctionCall: 0, Dot: 1, Indexer: 2, UnaryAdd: 3, UnarySubtract: 3, Multiply: 4, Divide: 4, IntegerDivide: 4, Modulo: 4, Add: 5, Subtract: 5, Ampersand: 5, Is: 6, As: 6, Union: 7, GreaterThan: 8, GreaterThanOrEquals: 8, LessThan: 8, LessThanOrEquals: 8, Equals: 9, Equivalent: 9, NotEquals: 9, NotEquivalent: 9, In: 10, Contains: 10, And: 11, Xor: 12, Or: 12, Implies: 13, Arrow: 100, Semicolon: 200 };
68731
68731
  var Ss = { parse(r6) {
68732
68732
  let e = r6.consumeAndParse();
@@ -68736,7 +68736,7 @@ var Ss = { parse(r6) {
68736
68736
  var bs = { parse(r6, e) {
68737
68737
  let t = r6.consumeAndParse();
68738
68738
  if (!r6.match("]")) throw new Error("Parse error: expected `]`");
68739
- return new Ee(e, t);
68739
+ return new Re(e, t);
68740
68740
  }, precedence: g.Indexer };
68741
68741
  var Es = { parse(r6, e) {
68742
68742
  if (!(e instanceof $)) throw new Error("Unexpected parentheses");
@@ -68748,16 +68748,16 @@ function Rs(r6) {
68748
68748
  let e = r6.split(" "), t = parseFloat(e[0]), n = e[1];
68749
68749
  return n?.startsWith("'") && n.endsWith("'") ? n = n.substring(1, n.length - 1) : n = "{" + n + "}", { value: t, unit: n };
68750
68750
  }
68751
- function Ye() {
68752
- return new at().registerPrefix("String", { parse: (r6, e) => new U({ type: l.string, value: e.value }) }).registerPrefix("DateTime", { parse: (r6, e) => new U({ type: l.dateTime, value: Fe(e.value) }) }).registerPrefix("Quantity", { parse: (r6, e) => new U({ type: l.Quantity, value: Rs(e.value) }) }).registerPrefix("Number", { parse: (r6, e) => new U({ type: e.value.includes(".") ? l.decimal : l.integer, value: parseFloat(e.value) }) }).registerPrefix("true", { parse: () => new U({ type: l.boolean, value: true }) }).registerPrefix("false", { parse: () => new U({ type: l.boolean, value: false }) }).registerPrefix("Symbol", { parse: (r6, e) => new $(e.value) }).registerPrefix("{}", { parse: () => new Et() }).registerPrefix("(", Ss).registerInfix("[", bs).registerInfix("(", Es).prefix("+", g.UnaryAdd, (r6, e) => new Rt("+", e, (t) => t)).prefix("-", g.UnarySubtract, (r6, e) => new V("-", e, e, (t, n) => -n)).infixLeft(".", g.Dot, (r6, e, t) => new ue(r6, t)).infixLeft("/", g.Divide, (r6, e, t) => new V("/", r6, t, (n, i) => n / i)).infixLeft("*", g.Multiply, (r6, e, t) => new V("*", r6, t, (n, i) => n * i)).infixLeft("+", g.Add, (r6, e, t) => new V("+", r6, t, (n, i) => n + i)).infixLeft("-", g.Subtract, (r6, e, t) => new V("-", r6, t, (n, i) => n - i)).infixLeft("|", g.Union, (r6, e, t) => new Se(r6, t)).infixLeft("=", g.Equals, (r6, e, t) => new At(r6, t)).infixLeft("!=", g.NotEquals, (r6, e, t) => new Ot(r6, t)).infixLeft("~", g.Equivalent, (r6, e, t) => new It(r6, t)).infixLeft("!~", g.NotEquivalent, (r6, e, t) => new kt(r6, t)).infixLeft("<", g.LessThan, (r6, e, t) => new V("<", r6, t, (n, i) => n < i)).infixLeft("<=", g.LessThanOrEquals, (r6, e, t) => new V("<=", r6, t, (n, i) => n <= i)).infixLeft(">", g.GreaterThan, (r6, e, t) => new V(">", r6, t, (n, i) => n > i)).infixLeft(">=", g.GreaterThanOrEquals, (r6, e, t) => new V(">=", r6, t, (n, i) => n >= i)).infixLeft("&", g.Ampersand, (r6, e, t) => new Ct(r6, t)).infixLeft("and", g.And, (r6, e, t) => new Vt(r6, t)).infixLeft("as", g.As, (r6, e, t) => new le(r6, t)).infixLeft("contains", g.Contains, (r6, e, t) => new Pt(r6, t)).infixLeft("div", g.Divide, (r6, e, t) => new V("div", r6, t, (n, i) => n / i | 0)).infixLeft("in", g.In, (r6, e, t) => new wt(r6, t)).infixLeft("is", g.Is, (r6, e, t) => new be(r6, t)).infixLeft("mod", g.Modulo, (r6, e, t) => new V("mod", r6, t, (n, i) => n % i)).infixLeft("or", g.Or, (r6, e, t) => new Dt(r6, t)).infixLeft("xor", g.Xor, (r6, e, t) => new Mt(r6, t)).infixLeft("implies", g.Implies, (r6, e, t) => new _t(r6, t));
68751
+ function Xe() {
68752
+ return new st().registerPrefix("String", { parse: (r6, e) => new U({ type: l.string, value: e.value }) }).registerPrefix("DateTime", { parse: (r6, e) => new U({ type: l.dateTime, value: Le(e.value) }) }).registerPrefix("Quantity", { parse: (r6, e) => new U({ type: l.Quantity, value: Rs(e.value) }) }).registerPrefix("Number", { parse: (r6, e) => new U({ type: e.value.includes(".") ? l.decimal : l.integer, value: parseFloat(e.value) }) }).registerPrefix("true", { parse: () => new U({ type: l.boolean, value: true }) }).registerPrefix("false", { parse: () => new U({ type: l.boolean, value: false }) }).registerPrefix("Symbol", { parse: (r6, e) => new $(e.value) }).registerPrefix("{}", { parse: () => new Et() }).registerPrefix("(", Ss).registerInfix("[", bs).registerInfix("(", Es).prefix("+", g.UnaryAdd, (r6, e) => new Rt("+", e, (t) => t)).prefix("-", g.UnarySubtract, (r6, e) => new V("-", e, e, (t, n) => -n)).infixLeft(".", g.Dot, (r6, e, t) => new le(r6, t)).infixLeft("/", g.Divide, (r6, e, t) => new V("/", r6, t, (n, i) => n / i)).infixLeft("*", g.Multiply, (r6, e, t) => new V("*", r6, t, (n, i) => n * i)).infixLeft("+", g.Add, (r6, e, t) => new V("+", r6, t, (n, i) => n + i)).infixLeft("-", g.Subtract, (r6, e, t) => new V("-", r6, t, (n, i) => n - i)).infixLeft("|", g.Union, (r6, e, t) => new be(r6, t)).infixLeft("=", g.Equals, (r6, e, t) => new At(r6, t)).infixLeft("!=", g.NotEquals, (r6, e, t) => new Ot(r6, t)).infixLeft("~", g.Equivalent, (r6, e, t) => new It(r6, t)).infixLeft("!~", g.NotEquivalent, (r6, e, t) => new kt(r6, t)).infixLeft("<", g.LessThan, (r6, e, t) => new V("<", r6, t, (n, i) => n < i)).infixLeft("<=", g.LessThanOrEquals, (r6, e, t) => new V("<=", r6, t, (n, i) => n <= i)).infixLeft(">", g.GreaterThan, (r6, e, t) => new V(">", r6, t, (n, i) => n > i)).infixLeft(">=", g.GreaterThanOrEquals, (r6, e, t) => new V(">=", r6, t, (n, i) => n >= i)).infixLeft("&", g.Ampersand, (r6, e, t) => new Ct(r6, t)).infixLeft("and", g.And, (r6, e, t) => new Vt(r6, t)).infixLeft("as", g.As, (r6, e, t) => new pe(r6, t)).infixLeft("contains", g.Contains, (r6, e, t) => new Pt(r6, t)).infixLeft("div", g.Divide, (r6, e, t) => new V("div", r6, t, (n, i) => n / i | 0)).infixLeft("in", g.In, (r6, e, t) => new wt(r6, t)).infixLeft("is", g.Is, (r6, e, t) => new Ee(r6, t)).infixLeft("mod", g.Modulo, (r6, e, t) => new V("mod", r6, t, (n, i) => n % i)).infixLeft("or", g.Or, (r6, e, t) => new Dt(r6, t)).infixLeft("xor", g.Xor, (r6, e, t) => new Mt(r6, t)).infixLeft("implies", g.Implies, (r6, e, t) => new _t(r6, t));
68753
68753
  }
68754
- var Cs = Ye();
68754
+ var Cs = Xe();
68755
68755
  var f = { EQUALS: "eq", NOT_EQUALS: "ne", GREATER_THAN: "gt", LESS_THAN: "lt", GREATER_THAN_OR_EQUALS: "ge", LESS_THAN_OR_EQUALS: "le", STARTS_AFTER: "sa", ENDS_BEFORE: "eb", APPROXIMATELY: "ap", CONTAINS: "contains", STARTS_WITH: "sw", EXACT: "exact", TEXT: "text", NOT: "not", ABOVE: "above", BELOW: "below", IN: "in", NOT_IN: "not-in", OF_TYPE: "of-type", MISSING: "missing", PRESENT: "present", IDENTIFIER: "identifier", ITERATE: "iterate" };
68756
68756
  var Ri = { contains: f.CONTAINS, exact: f.EXACT, above: f.ABOVE, below: f.BELOW, text: f.TEXT, not: f.NOT, in: f.IN, "not-in": f.NOT_IN, "of-type": f.OF_TYPE, missing: f.MISSING, identifier: f.IDENTIFIER, iterate: f.ITERATE };
68757
68757
  var Gr = { eq: f.EQUALS, ne: f.NOT_EQUALS, lt: f.LESS_THAN, le: f.LESS_THAN_OR_EQUALS, gt: f.GREATER_THAN, ge: f.GREATER_THAN_OR_EQUALS, sa: f.STARTS_AFTER, eb: f.ENDS_BEFORE, ap: f.APPROXIMATELY, sw: f.STARTS_WITH };
68758
68758
  var Ds = [f.MISSING, f.PRESENT];
68759
- var Ce = { READ: "read", VREAD: "vread", UPDATE: "update", DELETE: "delete", HISTORY: "history", CREATE: "create", SEARCH: "search" };
68760
- var Zs = [Ce.READ, Ce.VREAD, Ce.HISTORY, Ce.SEARCH];
68759
+ var Pe = { READ: "read", VREAD: "vread", UPDATE: "update", DELETE: "delete", HISTORY: "history", CREATE: "create", SEARCH: "search" };
68760
+ var Zs = [Pe.READ, Pe.VREAD, Pe.HISTORY, Pe.SEARCH];
68761
68761
  function B() {
68762
68762
  return typeof window < "u";
68763
68763
  }
@@ -68807,7 +68807,7 @@ function Qr() {
68807
68807
  async function Ai(r6) {
68808
68808
  return crypto.subtle.digest("SHA-256", new TextEncoder().encode(r6));
68809
68809
  }
68810
- function Pe() {
68810
+ function we() {
68811
68811
  return "xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g, (r6) => {
68812
68812
  let e = Math.random() * 16 | 0;
68813
68813
  return (r6 === "x" ? e : e & 3 | 8).toString(16);
@@ -68917,7 +68917,7 @@ function Yr(r6, e, t, n) {
68917
68917
  if (typeof t != "object") throw new d(y("context must be a context object or array of context objects."));
68918
68918
  if (Kr.includes(e) && !n) throw new d(y(`The '${e}' event must contain a 'context.versionId'.`));
68919
68919
  let i = Array.isArray(t) ? t : [t];
68920
- return fa(e, i), { timestamp: (/* @__PURE__ */ new Date()).toISOString(), id: Pe(), event: { "hub.topic": r6, "hub.event": e, context: i, ...n ? { "context.versionId": n } : {} } };
68920
+ return fa(e, i), { timestamp: (/* @__PURE__ */ new Date()).toISOString(), id: we(), event: { "hub.topic": r6, "hub.event": e, context: i, ...n ? { "context.versionId": n } : {} } };
68921
68921
  }
68922
68922
  var Bt = class extends K {
68923
68923
  constructor(e) {
@@ -69014,7 +69014,7 @@ var M = class {
69014
69014
  return this.suspender.finally(e);
69015
69015
  }
69016
69016
  };
69017
- var tt = class {
69017
+ var et = class {
69018
69018
  constructor(e) {
69019
69019
  this.storage = e ?? (typeof localStorage < "u" ? localStorage : new Zr());
69020
69020
  }
@@ -69058,15 +69058,15 @@ var Zr = class {
69058
69058
  return Array.from(this.data.keys())[e];
69059
69059
  }
69060
69060
  };
69061
- var Be = { Event: typeof globalThis.Event < "u" ? globalThis.Event : void 0, ErrorEvent: void 0, CloseEvent: void 0 };
69061
+ var Ue = { Event: typeof globalThis.Event < "u" ? globalThis.Event : void 0, ErrorEvent: void 0, CloseEvent: void 0 };
69062
69062
  var Ni = false;
69063
69063
  function ma() {
69064
69064
  if (typeof globalThis.Event > "u") throw new Error("Unable to lazy init events for ReconnectingWebSocket. globalThis.Event is not defined yet");
69065
- Be.Event = globalThis.Event, Be.ErrorEvent = class extends Event {
69065
+ Ue.Event = globalThis.Event, Ue.ErrorEvent = class extends Event {
69066
69066
  constructor(e, t) {
69067
69067
  super("error", t), this.message = e.message, this.error = e;
69068
69068
  }
69069
- }, Be.CloseEvent = class extends Event {
69069
+ }, Ue.CloseEvent = class extends Event {
69070
69070
  constructor(t = 1e3, n = "", i) {
69071
69071
  super("close", i);
69072
69072
  this.wasClean = true;
@@ -69080,7 +69080,7 @@ function ya(r6, e) {
69080
69080
  function $t(r6) {
69081
69081
  return new r6.constructor(r6.type, r6);
69082
69082
  }
69083
- var we = { maxReconnectionDelay: 1e4, minReconnectionDelay: 1e3 + Math.random() * 4e3, minUptime: 5e3, reconnectionDelayGrowFactor: 1.3, connectionTimeout: 4e3, maxRetries: 1 / 0, maxEnqueuedMessages: 1 / 0, startClosed: false, debug: false };
69083
+ var Ae = { maxReconnectionDelay: 1e4, minReconnectionDelay: 1e3 + Math.random() * 4e3, minUptime: 5e3, reconnectionDelayGrowFactor: 1.3, connectionTimeout: 4e3, maxRetries: 1 / 0, maxEnqueuedMessages: 1 / 0, startClosed: false, debug: false };
69084
69084
  var Ui = false;
69085
69085
  var Gt = class r extends K {
69086
69086
  constructor(t, n, i = {}) {
@@ -69098,7 +69098,7 @@ var Gt = class r extends K {
69098
69098
  this.onopen = null;
69099
69099
  this._handleOpen = (t2) => {
69100
69100
  this._debug("open event");
69101
- let { minUptime: n2 = we.minUptime } = this._options;
69101
+ let { minUptime: n2 = Ae.minUptime } = this._options;
69102
69102
  clearTimeout(this._connectTimeout), this._uptimeTimeout = setTimeout(() => this._acceptOpen(), n2), ya(this._ws, "WebSocket is not defined"), this._ws.binaryType = this._binaryType, this._messageQueue.forEach((i2) => this._ws?.send(i2)), this._messageQueue = [], this.onopen && this.onopen(t2), this.dispatchEvent($t(t2));
69103
69103
  };
69104
69104
  this._handleMessage = (t2) => {
@@ -69180,7 +69180,7 @@ var Gt = class r extends K {
69180
69180
  send(t) {
69181
69181
  if (this._ws && this._ws.readyState === this.OPEN) this._debug("send", t), this._ws.send(t);
69182
69182
  else {
69183
- let { maxEnqueuedMessages: n = we.maxEnqueuedMessages } = this._options;
69183
+ let { maxEnqueuedMessages: n = Ae.maxEnqueuedMessages } = this._options;
69184
69184
  this._messageQueue.length < n && (this._debug("enqueue", t), this._messageQueue.push(t));
69185
69185
  }
69186
69186
  }
@@ -69188,7 +69188,7 @@ var Gt = class r extends K {
69188
69188
  this._options.debug && this._debugLogger("RWS>", ...t);
69189
69189
  }
69190
69190
  _getNextDelay() {
69191
- let { reconnectionDelayGrowFactor: t = we.reconnectionDelayGrowFactor, minReconnectionDelay: n = we.minReconnectionDelay, maxReconnectionDelay: i = we.maxReconnectionDelay } = this._options, o = 0;
69191
+ let { reconnectionDelayGrowFactor: t = Ae.reconnectionDelayGrowFactor, minReconnectionDelay: n = Ae.minReconnectionDelay, maxReconnectionDelay: i = Ae.maxReconnectionDelay } = this._options, o = 0;
69192
69192
  return this._retryCount > 0 && (o = n * Math.pow(t, this._retryCount - 1), o > i && (o = i)), this._debug("next delay", o), o;
69193
69193
  }
69194
69194
  _wait() {
@@ -69199,7 +69199,7 @@ var Gt = class r extends K {
69199
69199
  _connect() {
69200
69200
  if (this._connectLock || !this._shouldReconnect) return;
69201
69201
  this._connectLock = true;
69202
- let { maxRetries: t = we.maxRetries, connectionTimeout: n = we.connectionTimeout } = this._options;
69202
+ let { maxRetries: t = Ae.maxRetries, connectionTimeout: n = Ae.connectionTimeout } = this._options;
69203
69203
  if (this._retryCount >= t) {
69204
69204
  this._debug("max retries reached", this._retryCount, ">=", t);
69205
69205
  return;
@@ -69213,17 +69213,17 @@ var Gt = class r extends K {
69213
69213
  let i = this._options.WebSocket || WebSocket;
69214
69214
  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);
69215
69215
  }).catch((i) => {
69216
- this._connectLock = false, this._handleError(new Be.ErrorEvent(Error(i.message), this));
69216
+ this._connectLock = false, this._handleError(new Ue.ErrorEvent(Error(i.message), this));
69217
69217
  });
69218
69218
  }
69219
69219
  _handleTimeout() {
69220
- this._debug("timeout event"), this._handleError(new Be.ErrorEvent(Error("TIMEOUT"), this));
69220
+ this._debug("timeout event"), this._handleError(new Ue.ErrorEvent(Error("TIMEOUT"), this));
69221
69221
  }
69222
69222
  _disconnect(t = 1e3, n) {
69223
69223
  if (this._clearTimeouts(), !!this._ws) {
69224
69224
  this._removeListeners();
69225
69225
  try {
69226
- this._ws.close(t, n), this._handleClose(new Be.CloseEvent(t, n, this));
69226
+ this._ws.close(t, n), this._handleClose(new Ue.CloseEvent(t, n, this));
69227
69227
  } catch {
69228
69228
  }
69229
69229
  }
@@ -69242,7 +69242,7 @@ var Gt = class r extends K {
69242
69242
  }
69243
69243
  };
69244
69244
  var ga = 5e3;
69245
- var rt = class extends K {
69245
+ var tt = class extends K {
69246
69246
  constructor(...e) {
69247
69247
  super(), this.criteria = new Set(e);
69248
69248
  }
@@ -69259,7 +69259,7 @@ var rt = class extends K {
69259
69259
  var en = class {
69260
69260
  constructor(e, t) {
69261
69261
  this.connecting = false;
69262
- this.criteria = e, this.emitter = new rt(e), this.refCount = 1, this.subscriptionProps = t ? { ...t } : void 0;
69262
+ this.criteria = e, this.emitter = new tt(e), this.refCount = 1, this.subscriptionProps = t ? { ...t } : void 0;
69263
69263
  }
69264
69264
  clearAttachedSubscription() {
69265
69265
  this.subscriptionId = void 0, this.token = void 0;
@@ -69277,7 +69277,7 @@ var Ht = class {
69277
69277
  throw new d(y("Not a valid URL"));
69278
69278
  }
69279
69279
  let o = n?.ReconnectingWebSocket ? new n.ReconnectingWebSocket(i, void 0, { debug: n?.debug, debugLogger: n?.debugLogger }) : new Gt(i, void 0, { debug: n?.debug, debugLogger: n?.debugLogger });
69280
- this.medplum = e, this.ws = o, this.masterSubEmitter = new rt(), this.criteriaEntries = /* @__PURE__ */ new Map(), this.criteriaEntriesBySubscriptionId = /* @__PURE__ */ new Map(), this.wsClosed = false, this.pingIntervalMs = n?.pingIntervalMs ?? ga, this.currentProfile = e.getProfile(), this.setupListeners();
69280
+ this.medplum = e, this.ws = o, this.masterSubEmitter = new tt(), this.criteriaEntries = /* @__PURE__ */ new Map(), this.criteriaEntriesBySubscriptionId = /* @__PURE__ */ new Map(), this.wsClosed = false, this.pingIntervalMs = n?.pingIntervalMs ?? ga, this.currentProfile = e.getProfile(), this.setupListeners();
69281
69281
  }
69282
69282
  setupListeners() {
69283
69283
  let e = this.ws;
@@ -69294,7 +69294,7 @@ var Ht = class {
69294
69294
  return;
69295
69295
  }
69296
69296
  if (o.type === "handshake") {
69297
- let a = ge(o.subscription), c = { type: "connect", payload: { subscriptionId: a } };
69297
+ let a = xe(o.subscription), c = { type: "connect", payload: { subscriptionId: a } };
69298
69298
  this.masterSubEmitter?.dispatchEvent(c);
69299
69299
  let u = this.criteriaEntriesBySubscriptionId.get(a);
69300
69300
  if (!u) {
@@ -69305,7 +69305,7 @@ var Ht = class {
69305
69305
  return;
69306
69306
  }
69307
69307
  this.masterSubEmitter?.dispatchEvent({ type: "message", payload: i });
69308
- let s = this.criteriaEntriesBySubscriptionId.get(ge(o.subscription));
69308
+ let s = this.criteriaEntriesBySubscriptionId.get(xe(o.subscription));
69309
69309
  if (!s) {
69310
69310
  console.warn("Received notification for criteria the SubscriptionManager is not listening for");
69311
69311
  return;
@@ -69432,10 +69432,10 @@ var Ht = class {
69432
69432
  return this.getAllCriteriaEmitters().length;
69433
69433
  }
69434
69434
  getMasterEmitter() {
69435
- return this.masterSubEmitter || (this.masterSubEmitter = new rt(...Array.from(this.criteriaEntries.keys()))), this.masterSubEmitter;
69435
+ return this.masterSubEmitter || (this.masterSubEmitter = new tt(...Array.from(this.criteriaEntries.keys()))), this.masterSubEmitter;
69436
69436
  }
69437
69437
  };
69438
- var tn = "4.4.3-84d43c2a6";
69438
+ var tn = "4.5.0-686bc335c";
69439
69439
  var Ta = A.FHIR_JSON + ", */*; q=0.1";
69440
69440
  var Sa = "https://api.medplum.com/";
69441
69441
  var ba = 1e3;
@@ -69444,7 +69444,7 @@ var Ra = 0;
69444
69444
  var Ca = 3e5;
69445
69445
  var Pa = "Binary/";
69446
69446
  var Bi = { resourceType: "Device", id: "system", deviceName: [{ type: "model-name", name: "System" }] };
69447
- var We = { 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" };
69447
+ var Be = { 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" };
69448
69448
  var wa = { 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" };
69449
69449
  var Aa = { JwtBearer: "urn:ietf:params:oauth:client-assertion-type:jwt-bearer" };
69450
69450
  var Qt = class extends K {
@@ -69452,7 +69452,7 @@ var Qt = class extends K {
69452
69452
  super();
69453
69453
  this.initComplete = true;
69454
69454
  if (t?.baseUrl && !t.baseUrl.startsWith("http")) throw new Error("Base URL must start with http or https");
69455
- this.options = t ?? {}, this.fetch = t?.fetch ?? Oa(), this.storage = t?.storage ?? new tt(), this.createPdfImpl = t?.createPdf, this.baseUrl = Wr(t?.baseUrl ?? Sa), this.fhirBaseUrl = j(this.baseUrl, t?.fhirUrlPath ?? "fhir/R4"), this.authorizeUrl = j(this.baseUrl, t?.authorizeUrl ?? "oauth2/authorize"), this.tokenUrl = j(this.baseUrl, t?.tokenUrl ?? "oauth2/token"), this.logoutUrl = j(this.baseUrl, t?.logoutUrl ?? "oauth2/logout"), this.fhircastHubUrl = j(this.baseUrl, t?.fhircastHubUrl ?? "fhircast/STU3"), this.clientId = t?.clientId ?? "", this.clientSecret = t?.clientSecret ?? "", this.credentialsInHeader = t?.authCredentialsMethod === "header", this.defaultHeaders = t?.defaultHeaders ?? {}, this.onUnauthenticated = t?.onUnauthenticated, this.refreshGracePeriod = t?.refreshGracePeriod ?? Ca, this.cacheTime = t?.cacheTime ?? (B() ? Ea : Ra), this.cacheTime > 0 ? this.requestCache = new Oe(t?.resourceCacheSize ?? ba) : this.requestCache = void 0, t?.autoBatchTime ? (this.autoBatchTime = t.autoBatchTime, this.autoBatchQueue = []) : (this.autoBatchTime = 0, this.autoBatchQueue = void 0), t?.accessToken && this.setAccessToken(t.accessToken), this.storage.getInitPromise === void 0 ? (t?.accessToken || this.attemptResumeActiveLogin().catch(console.error), this.initPromise = Promise.resolve(), this.dispatchEvent({ type: "storageInitialized" })) : (this.initComplete = false, this.initPromise = this.storage.getInitPromise(), this.initPromise.then(() => {
69455
+ this.options = t ?? {}, this.fetch = t?.fetch ?? Oa(), this.storage = t?.storage ?? new et(), this.createPdfImpl = t?.createPdf, this.baseUrl = Wr(t?.baseUrl ?? Sa), this.fhirBaseUrl = j(this.baseUrl, t?.fhirUrlPath ?? "fhir/R4"), this.authorizeUrl = j(this.baseUrl, t?.authorizeUrl ?? "oauth2/authorize"), this.tokenUrl = j(this.baseUrl, t?.tokenUrl ?? "oauth2/token"), this.logoutUrl = j(this.baseUrl, t?.logoutUrl ?? "oauth2/logout"), this.fhircastHubUrl = j(this.baseUrl, t?.fhircastHubUrl ?? "fhircast/STU3"), this.clientId = t?.clientId ?? "", this.clientSecret = t?.clientSecret ?? "", this.credentialsInHeader = t?.authCredentialsMethod === "header", this.defaultHeaders = t?.defaultHeaders ?? {}, this.onUnauthenticated = t?.onUnauthenticated, this.refreshGracePeriod = t?.refreshGracePeriod ?? Ca, this.cacheTime = t?.cacheTime ?? (B() ? Ea : Ra), this.cacheTime > 0 ? this.requestCache = new Ie(t?.resourceCacheSize ?? ba) : this.requestCache = void 0, t?.autoBatchTime ? (this.autoBatchTime = t.autoBatchTime, this.autoBatchQueue = []) : (this.autoBatchTime = 0, this.autoBatchQueue = void 0), t?.accessToken && this.setAccessToken(t.accessToken), this.storage.getInitPromise === void 0 ? (t?.accessToken || this.attemptResumeActiveLogin().catch(console.error), this.initPromise = Promise.resolve(), this.dispatchEvent({ type: "storageInitialized" })) : (this.initComplete = false, this.initPromise = this.storage.getInitPromise(), this.initPromise.then(() => {
69456
69456
  t?.accessToken || this.attemptResumeActiveLogin().catch(console.error), this.initComplete = true, this.dispatchEvent({ type: "storageInitialized" });
69457
69457
  }).catch((n) => {
69458
69458
  console.error(n), this.initComplete = true, this.dispatchEvent({ type: "storageInitFailed", payload: { error: n } });
@@ -69564,7 +69564,7 @@ var Qt = class extends K {
69564
69564
  }
69565
69565
  async exchangeExternalAccessToken(t, n) {
69566
69566
  if (n = n ?? this.clientId, !n) throw new Error("MedplumClient is missing clientId");
69567
- return this.fetchTokens({ grant_type: We.TokenExchange, subject_token_type: wa.AccessToken, client_id: n, subject_token: t });
69567
+ return this.fetchTokens({ grant_type: Be.TokenExchange, subject_token_type: wa.AccessToken, client_id: n, subject_token: t });
69568
69568
  }
69569
69569
  getExternalAuthRedirectUri(t, n, i, o, s = true) {
69570
69570
  let a = new URL(t);
@@ -69783,7 +69783,7 @@ var Qt = class extends K {
69783
69783
  }
69784
69784
  createComment(t, n, i) {
69785
69785
  let o = this.getProfile(), s, a;
69786
- return t.resourceType === "Encounter" && (s = ye(t), a = t.subject), t.resourceType === "ServiceRequest" && (s = t.encounter, a = t.subject), t.resourceType === "Patient" && (a = ye(t)), this.createResource({ resourceType: "Communication", status: "completed", basedOn: [ye(t)], encounter: s, subject: a, sender: o ? ye(o) : void 0, sent: (/* @__PURE__ */ new Date()).toISOString(), payload: [{ contentString: n }] }, i);
69786
+ return t.resourceType === "Encounter" && (s = ge(t), a = t.subject), t.resourceType === "ServiceRequest" && (s = t.encounter, a = t.subject), t.resourceType === "Patient" && (a = ge(t)), this.createResource({ resourceType: "Communication", status: "completed", basedOn: [ge(t)], encounter: s, subject: a, sender: o ? ge(o) : void 0, sent: (/* @__PURE__ */ new Date()).toISOString(), payload: [{ contentString: n }] }, i);
69787
69787
  }
69788
69788
  async updateResource(t, n) {
69789
69789
  if (!t.resourceType) throw new Error("Missing resourceType");
@@ -69826,7 +69826,7 @@ var Qt = class extends K {
69826
69826
  }
69827
69827
  pushToAgent(t, n, i, o, s, a) {
69828
69828
  let { waitTimeout: c, ...u } = a ?? {};
69829
- return this.post(this.fhirUrl("Agent", ge(t), "$push"), { destination: typeof n == "string" ? n : D(n), body: i, contentType: o, waitForResponse: s, ...c !== void 0 ? { waitTimeout: c } : void 0 }, A.FHIR_JSON, u);
69829
+ return this.post(this.fhirUrl("Agent", xe(t), "$push"), { destination: typeof n == "string" ? n : D(n), body: i, contentType: o, waitForResponse: s, ...c !== void 0 ? { waitTimeout: c } : void 0 }, A.FHIR_JSON, u);
69830
69830
  }
69831
69831
  getActiveLogin() {
69832
69832
  return this.storage.getObject("activeLogin");
@@ -69895,7 +69895,7 @@ var Qt = class extends K {
69895
69895
  }
69896
69896
  async createMedia(t, n) {
69897
69897
  let { additionalFields: i, ...o } = t, s = await this.createResource({ resourceType: "Media", status: "preparation", content: { contentType: t.contentType }, ...i });
69898
- o.securityContext || (o.securityContext = ye(s));
69898
+ o.securityContext || (o.securityContext = ge(s));
69899
69899
  let a = await this.createAttachment(o, n);
69900
69900
  return this.updateResource({ ...s, status: "completed", content: a });
69901
69901
  }
@@ -69904,7 +69904,7 @@ var Qt = class extends K {
69904
69904
  }
69905
69905
  async createDocumentReference(t, n) {
69906
69906
  let { additionalFields: i, ...o } = t, s = await this.createResource({ resourceType: "DocumentReference", status: "current", content: [{ attachment: { contentType: t.contentType } }], ...i });
69907
- o.securityContext || (o.securityContext = ye(s));
69907
+ o.securityContext || (o.securityContext = ge(s));
69908
69908
  let a = await this.createAttachment(o, n);
69909
69909
  return this.updateResource({ ...s, content: [{ attachment: a }] });
69910
69910
  }
@@ -70061,7 +70061,7 @@ var Qt = class extends K {
70061
70061
  typeof n == "string" || typeof Blob < "u" && (n instanceof Blob || n?.constructor.name === "Blob") || typeof File < "u" && (n instanceof File || n?.constructor.name === "File") || typeof Uint8Array < "u" && (n instanceof Uint8Array || n?.constructor.name === "Uint8Array") ? t.body = n : n && (t.body = JSON.stringify(n));
70062
70062
  }
70063
70063
  handleUnauthenticated(t, n, i) {
70064
- return this.refresh() ? this.request(t, n, i) : (this.clear(), this.onUnauthenticated && this.onUnauthenticated(), Promise.reject(new d(Ie)));
70064
+ return this.refresh() ? this.request(t, n, i) : (this.clear(), this.onUnauthenticated && this.onUnauthenticated(), Promise.reject(new d(ke)));
70065
70065
  }
70066
70066
  async startPkce() {
70067
70067
  let t = Qr();
@@ -70080,7 +70080,7 @@ var Qt = class extends K {
70080
70080
  i.searchParams.set("response_type", "code"), i.searchParams.set("state", sessionStorage.getItem("pkceState")), i.searchParams.set("client_id", n.clientId ?? this.clientId), i.searchParams.set("redirect_uri", n.redirectUri ?? te.getOrigin()), i.searchParams.set("code_challenge_method", n.codeChallengeMethod), i.searchParams.set("code_challenge", n.codeChallenge), i.searchParams.set("scope", n.scope ?? "openid profile"), te.assign(i.toString());
70081
70081
  }
70082
70082
  processCode(t, n) {
70083
- let i = { grant_type: We.AuthorizationCode, code: t, client_id: n?.clientId ?? this.clientId ?? "", redirect_uri: n?.redirectUri ?? te.getOrigin() };
70083
+ let i = { grant_type: Be.AuthorizationCode, code: t, client_id: n?.clientId ?? this.clientId ?? "", redirect_uri: n?.redirectUri ?? te.getOrigin() };
70084
70084
  if (typeof sessionStorage < "u") {
70085
70085
  let o = sessionStorage.getItem("codeVerifier");
70086
70086
  o && (i.code_verifier = o);
@@ -70092,17 +70092,17 @@ var Qt = class extends K {
70092
70092
  }
70093
70093
  refresh() {
70094
70094
  if (this.refreshPromise) return this.refreshPromise;
70095
- if (this.refreshToken) return this.refreshPromise = this.fetchTokens({ grant_type: We.RefreshToken, client_id: this.clientId ?? "", refresh_token: this.refreshToken }), this.refreshPromise;
70095
+ if (this.refreshToken) return this.refreshPromise = this.fetchTokens({ grant_type: Be.RefreshToken, client_id: this.clientId ?? "", refresh_token: this.refreshToken }), this.refreshPromise;
70096
70096
  if (this.clientId && this.clientSecret) return this.refreshPromise = this.startClientLogin(this.clientId, this.clientSecret), this.refreshPromise;
70097
70097
  }
70098
70098
  async startClientLogin(t, n) {
70099
- return this.clientId = t, this.clientSecret = n, this.fetchTokens({ grant_type: We.ClientCredentials, client_id: t, client_secret: n });
70099
+ return this.clientId = t, this.clientSecret = n, this.fetchTokens({ grant_type: Be.ClientCredentials, client_id: t, client_secret: n });
70100
70100
  }
70101
70101
  async startJwtBearerLogin(t, n, i) {
70102
- return this.clientId = t, this.fetchTokens({ grant_type: We.JwtBearer, client_id: t, assertion: n, scope: i });
70102
+ return this.clientId = t, this.fetchTokens({ grant_type: Be.JwtBearer, client_id: t, assertion: n, scope: i });
70103
70103
  }
70104
70104
  async startJwtAssertionLogin(t) {
70105
- return this.fetchTokens({ grant_type: We.ClientCredentials, client_assertion_type: Aa.JwtBearer, client_assertion: t });
70105
+ return this.fetchTokens({ grant_type: Be.ClientCredentials, client_assertion_type: Aa.JwtBearer, client_assertion: t });
70106
70106
  }
70107
70107
  setBasicAuth(t, n) {
70108
70108
  this.clientId = t, this.clientSecret = n, this.basicAuth = Ut(t + ":" + n);
@@ -70200,7 +70200,7 @@ async function Wi(r6, e) {
70200
70200
  if (t) return t;
70201
70201
  let n = r6.headers.get("location");
70202
70202
  if (n) return n;
70203
- if (ke(e) && e.issue?.[0]?.diagnostics) return e.issue[0].diagnostics;
70203
+ if (ut(e) && e.issue?.[0]?.diagnostics) return e.issue[0].diagnostics;
70204
70204
  }
70205
70205
  function qi(r6) {
70206
70206
  let e = r6.entry?.map((t) => t.resource) ?? [];
@@ -70221,14 +70221,14 @@ function Va(r6, e, t, n) {
70221
70221
  function Da(r6) {
70222
70222
  return r6.status === 429 || r6.status >= 500;
70223
70223
  }
70224
- var Ha = [...Xe, "->", "<<", ">>", "=="];
70225
- var Ja = Ye().registerInfix("->", { precedence: g.Arrow }).registerInfix(";", { precedence: g.Semicolon });
70226
- var fc = " ".repeat(2);
70227
- var mc = [...Xe, "eq", "ne", "co"];
70228
- var yc = { eq: f.EXACT, ne: f.NOT_EQUALS, co: f.CONTAINS, sw: f.STARTS_WITH, ew: void 0, gt: f.GREATER_THAN, lt: f.LESS_THAN, ge: f.GREATER_THAN_OR_EQUALS, le: f.LESS_THAN_OR_EQUALS, ap: f.APPROXIMATELY, sa: f.STARTS_AFTER, eb: f.ENDS_BEFORE, pr: f.PRESENT, po: void 0, ss: void 0, sb: void 0, in: f.IN, ni: f.NOT_IN, re: f.EQUALS, identifier: f.IDENTIFIER };
70229
- var xc = Ye();
70230
- var vc = { AA: "OK", AE: "Application Error", AR: "Application Reject", CA: "Commit Accept", CE: "Commit Error", CR: "Commit Reject" };
70231
- var fe = class {
70224
+ var Ga = [...Ke, "->", "<<", ">>", "=="];
70225
+ var za = Xe().registerInfix("->", { precedence: g.Arrow }).registerInfix(";", { precedence: g.Semicolon });
70226
+ var dc = " ".repeat(2);
70227
+ var hc = [...Ke, "eq", "ne", "co"];
70228
+ var mc = { eq: f.EXACT, ne: f.NOT_EQUALS, co: f.CONTAINS, sw: f.STARTS_WITH, ew: void 0, gt: f.GREATER_THAN, lt: f.LESS_THAN, ge: f.GREATER_THAN_OR_EQUALS, le: f.LESS_THAN_OR_EQUALS, ap: f.APPROXIMATELY, sa: f.STARTS_AFTER, eb: f.ENDS_BEFORE, pr: f.PRESENT, po: void 0, ss: void 0, sb: void 0, in: f.IN, ni: f.NOT_IN, re: f.EQUALS, identifier: f.IDENTIFIER };
70229
+ var gc = Xe();
70230
+ var xc = { AA: "OK", AE: "Application Error", AR: "Application Reject", CA: "Commit Accept", CE: "Commit Error", CR: "Commit Reject" };
70231
+ var he = class {
70232
70232
  constructor(e = "\r", t = "|", n = "^", i = "~", o = "\\", s = "&") {
70233
70233
  this.segmentSeparator = e, this.fieldSeparator = t, this.componentSeparator = n, this.repetitionSeparator = i, this.escapeCharacter = o, this.subcomponentSeparator = s;
70234
70234
  }
@@ -70240,7 +70240,7 @@ var fe = class {
70240
70240
  }
70241
70241
  };
70242
70242
  var uo = class r2 {
70243
- constructor(e, t = new fe()) {
70243
+ constructor(e, t = new he()) {
70244
70244
  this.context = t, this.segments = e;
70245
70245
  }
70246
70246
  get header() {
@@ -70263,7 +70263,7 @@ var uo = class r2 {
70263
70263
  }
70264
70264
  buildAck(e) {
70265
70265
  let t = /* @__PURE__ */ new Date(), n = this.getSegment("MSH"), i = n?.getField(3)?.toString() ?? "", o = n?.getField(4)?.toString() ?? "", s = n?.getField(5)?.toString() ?? "", a = n?.getField(6)?.toString() ?? "", c = n?.getField(10)?.toString() ?? "", u = n?.getField(12)?.toString() ?? "2.5.1", p2 = e?.ackCode ?? "AA";
70266
- return new r2([new ot(["MSH", this.context.getMsh2(), s, a, i, o, Sc(t), "", this.buildAckMessageType(n), t.getTime().toString(), "P", u], this.context), new ot(["MSA", p2, c, vc[p2]], this.context), ...e?.errSegment ? [e.errSegment] : []]);
70266
+ return new r2([new it(["MSH", this.context.getMsh2(), s, a, i, o, Tc(t), "", this.buildAckMessageType(n), t.getTime().toString(), "P", u], this.context), new it(["MSA", p2, c, xc[p2]], this.context), ...e?.errSegment ? [e.errSegment] : []]);
70267
70267
  }
70268
70268
  buildAckMessageType(e) {
70269
70269
  let t = e?.getField(9), n = t?.getComponent(2), i = t?.getComponent(3), o = "ACK";
@@ -70274,8 +70274,8 @@ var uo = class r2 {
70274
70274
  let n = new Error("Invalid HL7 message");
70275
70275
  throw n.type = "entity.parse.failed", n;
70276
70276
  }
70277
- let t = new fe("\r", e.charAt(3), e.charAt(4), e.charAt(5), e.charAt(6), e.charAt(7));
70278
- return new r2(e.split(/[\r\n]+/).map((n) => ot.parse(n, t)), t);
70277
+ let t = new he("\r", e.charAt(3), e.charAt(4), e.charAt(5), e.charAt(6), e.charAt(7));
70278
+ return new r2(e.split(/[\r\n]+/).map((n) => it.parse(n, t)), t);
70279
70279
  }
70280
70280
  setSegment(e, t) {
70281
70281
  if (t.name === "MSH") {
@@ -70288,8 +70288,8 @@ var uo = class r2 {
70288
70288
  return n === 0 && t.name !== "MSH" ? false : n !== -1 ? (this.segments[n] = t, true) : false;
70289
70289
  }
70290
70290
  };
70291
- var ot = class r3 {
70292
- constructor(e, t = new fe()) {
70291
+ var it = class r3 {
70292
+ constructor(e, t = new he()) {
70293
70293
  this.context = t, Zn(e) ? this.fields = e.map((n) => X.parse(n, t)) : this.fields = e, this.name = this.fields[0].components[0][0];
70294
70294
  }
70295
70295
  get(e) {
@@ -70309,7 +70309,7 @@ var ot = class r3 {
70309
70309
  toString() {
70310
70310
  return this.fields.map((e) => e.toString()).join(this.context.fieldSeparator);
70311
70311
  }
70312
- static parse(e, t = new fe()) {
70312
+ static parse(e, t = new he()) {
70313
70313
  return new r3(e.split(t.fieldSeparator).map((n) => X.parse(n, t)), t);
70314
70314
  }
70315
70315
  setField(e, t) {
@@ -70330,7 +70330,7 @@ var ot = class r3 {
70330
70330
  }
70331
70331
  };
70332
70332
  var X = class r4 {
70333
- constructor(e, t = new fe()) {
70333
+ constructor(e, t = new he()) {
70334
70334
  this.context = t, this.components = e;
70335
70335
  }
70336
70336
  get(e, t, n = 0) {
@@ -70343,7 +70343,7 @@ var X = class r4 {
70343
70343
  toString() {
70344
70344
  return this.components.map((e) => e.join(this.context.componentSeparator)).join(this.context.repetitionSeparator);
70345
70345
  }
70346
- static parse(e, t = new fe()) {
70346
+ static parse(e, t = new he()) {
70347
70347
  return new r4(e.split(t.repetitionSeparator).map((n) => n.split(t.componentSeparator)), t);
70348
70348
  }
70349
70349
  setComponent(e, t, n, i = 0) {
@@ -70358,14 +70358,14 @@ var X = class r4 {
70358
70358
  return true;
70359
70359
  }
70360
70360
  };
70361
- function Sc(r6) {
70361
+ function Tc(r6) {
70362
70362
  let e = r6 instanceof Date ? r6 : new Date(r6), n = e.toISOString().replace(/[-:T]/g, "").replace(/(\.\d+)?Z$/, ""), i = e.getUTCMilliseconds();
70363
70363
  return i > 0 && (n += "." + i.toString()), n;
70364
70364
  }
70365
- var qe = { NONE: 0, ERROR: 1, WARN: 2, INFO: 3, DEBUG: 4 };
70366
- var bc = ["NONE", "ERROR", "WARN", "INFO", "DEBUG"];
70365
+ var We = { NONE: 0, ERROR: 1, WARN: 2, INFO: 3, DEBUG: 4 };
70366
+ var Sc = ["NONE", "ERROR", "WARN", "INFO", "DEBUG"];
70367
70367
  var lo = class r5 {
70368
- constructor(e, t = {}, n = qe.INFO, i = {}) {
70368
+ constructor(e, t = {}, n = We.INFO, i = {}) {
70369
70369
  this.write = e, this.metadata = t, this.level = n, this.options = i, i?.prefix && (this.prefix = i.prefix), this.error = this.error.bind(this), this.warn = this.warn.bind(this), this.info = this.info.bind(this), this.debug = this.debug.bind(this), this.log = this.log.bind(this);
70370
70370
  }
70371
70371
  clone(e) {
@@ -70377,16 +70377,16 @@ var lo = class r5 {
70377
70377
  return { write: e, metadata: t, level: n, options: i };
70378
70378
  }
70379
70379
  error(e, t) {
70380
- this.log(qe.ERROR, e, t);
70380
+ this.log(We.ERROR, e, t);
70381
70381
  }
70382
70382
  warn(e, t) {
70383
- this.log(qe.WARN, e, t);
70383
+ this.log(We.WARN, e, t);
70384
70384
  }
70385
70385
  info(e, t) {
70386
- this.log(qe.INFO, e, t);
70386
+ this.log(We.INFO, e, t);
70387
70387
  }
70388
70388
  debug(e, t) {
70389
- this.log(qe.DEBUG, e, t);
70389
+ this.log(We.DEBUG, e, t);
70390
70390
  }
70391
70391
  log(e, t, n) {
70392
70392
  if (e > this.level) return;
@@ -70396,11 +70396,11 @@ var lo = class r5 {
70396
70396
  i = { ...n };
70397
70397
  for (let [o, s] of Object.entries(i)) s instanceof Error && (i[o] = nr(s));
70398
70398
  }
70399
- this.write(JSON.stringify({ level: bc[e], timestamp: (/* @__PURE__ */ new Date()).toISOString(), msg: this.prefix ? `${this.prefix}${t}` : t, ...i, ...this.metadata }));
70399
+ this.write(JSON.stringify({ level: Sc[e], timestamp: (/* @__PURE__ */ new Date()).toISOString(), msg: this.prefix ? `${this.prefix}${t}` : t, ...i, ...this.metadata }));
70400
70400
  }
70401
70401
  };
70402
70402
  function oh(r6) {
70403
- let e = qe[r6.toUpperCase()];
70403
+ let e = We[r6.toUpperCase()];
70404
70404
  if (e === void 0) throw new Error(`Invalid log level: ${r6}`);
70405
70405
  return e;
70406
70406
  }
@@ -70417,9 +70417,9 @@ function nr(r6, e = 0, t = 10) {
70417
70417
  }
70418
70418
  return n;
70419
70419
  }
70420
- var _c = "https://meta.medplum.com/releases";
70420
+ var Mc = "https://meta.medplum.com/releases";
70421
70421
  var sr = /* @__PURE__ */ new Map();
70422
- function Lc(r6) {
70422
+ function _c(r6) {
70423
70423
  let e = r6;
70424
70424
  if (!e.tag_name) throw new Error("Manifest missing tag_name");
70425
70425
  let t = e.assets;
@@ -70432,7 +70432,7 @@ function Lc(r6) {
70432
70432
  async function fn(r6, e, t) {
70433
70433
  let n = sr.get(e ?? "latest");
70434
70434
  if (!n) {
70435
- let i = e ? `v${e}` : "latest", o = new URL(`${_c}/${i}.json`);
70435
+ let i = e ? `v${e}` : "latest", o = new URL(`${Mc}/${i}.json`);
70436
70436
  if (o.searchParams.set("a", r6), o.searchParams.set("c", tn), t) for (let [c, u] of Object.entries(t)) o.searchParams.set(c, u);
70437
70437
  let s = await fetch(o.toString());
70438
70438
  if (s.status !== 200) {
@@ -70445,15 +70445,15 @@ async function fn(r6, e, t) {
70445
70445
  throw new Error(`Received status code ${s.status} while fetching manifest for version '${e ?? "latest"}'. Message: ${c}`);
70446
70446
  }
70447
70447
  let a = await s.json();
70448
- Lc(a), n = a, sr.set(e ?? "latest", n), e || sr.set(n.tag_name.slice(1), n);
70448
+ _c(a), n = a, sr.set(e ?? "latest", n), e || sr.set(n.tag_name.slice(1), n);
70449
70449
  }
70450
70450
  return n;
70451
70451
  }
70452
- function Fc(r6) {
70452
+ function Lc(r6) {
70453
70453
  return /^\d+\.\d+\.\d+(-[0-9a-z]{7})?$/.test(r6);
70454
70454
  }
70455
70455
  async function wh(r6, e) {
70456
- if (!Fc(e)) return false;
70456
+ if (!Lc(e)) return false;
70457
70457
  try {
70458
70458
  await fn(r6, e);
70459
70459
  } catch {
@@ -71063,7 +71063,7 @@ var AgentDicomChannel = class extends BaseChannel {
71063
71063
  calledAeTitle: this.association?.getCalledAeTitle()
71064
71064
  },
71065
71065
  dataset: dicomJson,
71066
- binary: binary ? ye(binary) : void 0
71066
+ binary: binary ? ge(binary) : void 0
71067
71067
  };
71068
71068
  App.instance.addToWebSocketQueue({
71069
71069
  type: "agent:transmit:request",
@@ -71306,7 +71306,7 @@ var DEFAULT_LOGGER_CONFIG = {
71306
71306
  logDir: __dirname,
71307
71307
  maxFileSizeMb: 10,
71308
71308
  filesToKeep: 10,
71309
- logLevel: qe.INFO
71309
+ logLevel: We.INFO
71310
71310
  };
71311
71311
  var LOGGER_CONFIG_INTEGER_KEYS = ["maxFileSizeMb", "filesToKeep"];
71312
71312
  var LEVELS_TO_UPPERCASE = {
@@ -71335,7 +71335,7 @@ function cleanupLoggerConfig(config, configPathRoot = "config") {
71335
71335
  warnings.push(`${configPathRoot}.filesToKeep must be a valid integer`);
71336
71336
  config.filesToKeep = void 0;
71337
71337
  }
71338
- if (typeof config.logLevel !== "undefined" && !(typeof config.logLevel === "number" && bc[config.logLevel] !== void 0)) {
71338
+ if (typeof config.logLevel !== "undefined" && !(typeof config.logLevel === "number" && Sc[config.logLevel] !== void 0)) {
71339
71339
  warnings.push(`${configPathRoot}.logLevel must be a valid log level between LogLevel.NONE and LogLevel.DEBUG`);
71340
71340
  config.logLevel = void 0;
71341
71341
  }
@@ -71408,14 +71408,14 @@ function parseLoggerConfigFromArgs(args) {
71408
71408
  function getWinstonLevelFromMedplumLevel(level) {
71409
71409
  switch (level) {
71410
71410
  // Return error for NONE since we are going to turn silent on anyways
71411
- case qe.NONE:
71412
- case qe.ERROR:
71411
+ case We.NONE:
71412
+ case We.ERROR:
71413
71413
  return "error";
71414
- case qe.WARN:
71414
+ case We.WARN:
71415
71415
  return "warn";
71416
- case qe.INFO:
71416
+ case We.INFO:
71417
71417
  return "info";
71418
- case qe.DEBUG:
71418
+ case We.DEBUG:
71419
71419
  return "debug";
71420
71420
  default:
71421
71421
  throw new Error("Invalid log level");
@@ -71425,7 +71425,7 @@ function createWinstonFromLoggerConfig(config, loggerType) {
71425
71425
  const level = getWinstonLevelFromMedplumLevel(config.logLevel);
71426
71426
  const logger = import_winston.default.createLogger({
71427
71427
  level,
71428
- silent: config.logLevel === qe.NONE,
71428
+ silent: config.logLevel === We.NONE,
71429
71429
  format: import_winston.default.format.combine(
71430
71430
  import_winston.default.format.timestamp(),
71431
71431
  // Custom transform to match previous Medplum logger output
@@ -71472,16 +71472,16 @@ var WinstonWrapperLogger = class _WinstonWrapperLogger {
71472
71472
  this.prefix = options?.prefix;
71473
71473
  }
71474
71474
  debug(msg, data2) {
71475
- this.log(qe.DEBUG, msg, data2);
71475
+ this.log(We.DEBUG, msg, data2);
71476
71476
  }
71477
71477
  info(msg, data2) {
71478
- this.log(qe.INFO, msg, data2);
71478
+ this.log(We.INFO, msg, data2);
71479
71479
  }
71480
71480
  warn(msg, data2) {
71481
- this.log(qe.WARN, msg, data2);
71481
+ this.log(We.WARN, msg, data2);
71482
71482
  }
71483
71483
  error(msg, data2) {
71484
- this.log(qe.ERROR, msg, data2);
71484
+ this.log(We.ERROR, msg, data2);
71485
71485
  }
71486
71486
  log(level, msg, data2) {
71487
71487
  if (level > this.level) {
@@ -71496,16 +71496,16 @@ var WinstonWrapperLogger = class _WinstonWrapperLogger {
71496
71496
  const dataToLog = { ...data2, ...this.metadata };
71497
71497
  const msgToLog = this.prefix ? `${this.prefix}${msg}` : msg;
71498
71498
  switch (level) {
71499
- case qe.DEBUG:
71499
+ case We.DEBUG:
71500
71500
  this.winston.debug(msgToLog, dataToLog);
71501
71501
  return;
71502
- case qe.INFO:
71502
+ case We.INFO:
71503
71503
  this.winston.info(msgToLog, dataToLog);
71504
71504
  return;
71505
- case qe.WARN:
71505
+ case We.WARN:
71506
71506
  this.winston.warn(msgToLog, dataToLog);
71507
71507
  return;
71508
- case qe.ERROR:
71508
+ case We.ERROR:
71509
71509
  this.winston.error(msgToLog, dataToLog);
71510
71510
  }
71511
71511
  }
@@ -72239,7 +72239,7 @@ IPv6 is currently unsupported.`;
72239
72239
  this.log.error(errMsg);
72240
72240
  throw new Error(errMsg);
72241
72241
  }
72242
- if (!((0, import_node_net4.isIPv4)(message.remote) || bl(message.remote))) {
72242
+ if (!((0, import_node_net4.isIPv4)(message.remote) || Sl(message.remote))) {
72243
72243
  const errMsg = `Attempted to ping an invalid host.
72244
72244
 
72245
72245
  "${message.remote}" is not a valid IPv4 address or a resolvable hostname.`;
@@ -72653,7 +72653,7 @@ async function upgraderMain(argv) {
72653
72653
  rejectOnTimeout = () => reject(new Error("Timed out while waiting for IPC to disconnect"));
72654
72654
  import_node_process3.default.once("disconnect", resolve2);
72655
72655
  });
72656
- if (argv[3] && !Fc(argv[3])) {
72656
+ if (argv[3] && !Lc(argv[3])) {
72657
72657
  throw new Error("Invalid version specified");
72658
72658
  }
72659
72659
  const version = argv[3] ?? await Ah("agent-upgrader");
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@medplum/agent",
3
- "version": "4.4.3",
3
+ "version": "4.5.0",
4
4
  "description": "Medplum Agent",
5
5
  "homepage": "https://www.medplum.com/",
6
6
  "bugs": {
@@ -25,8 +25,8 @@
25
25
  "test": "jest --runInBand"
26
26
  },
27
27
  "dependencies": {
28
- "@medplum/core": "4.4.3",
29
- "@medplum/hl7": "4.4.3",
28
+ "@medplum/core": "4.5.0",
29
+ "@medplum/hl7": "4.5.0",
30
30
  "dcmjs-dimse": "0.3.1",
31
31
  "iconv-lite": "0.7.0",
32
32
  "semver": "7.7.3",
@@ -35,8 +35,8 @@
35
35
  "ws": "8.18.3"
36
36
  },
37
37
  "devDependencies": {
38
- "@medplum/fhirtypes": "4.4.3",
39
- "@medplum/mock": "4.4.3",
38
+ "@medplum/fhirtypes": "4.5.0",
39
+ "@medplum/mock": "4.5.0",
40
40
  "@types/async-eventemitter": "0.2.4",
41
41
  "@types/ws": "8.18.1",
42
42
  "mock-socket": "9.3.1",