@medplum/agent 5.0.1 → 5.0.3

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 +284 -273
  2. package/package.json +5 -5
@@ -58668,13 +58668,13 @@ var require_index_cjs = __commonJS({
58668
58668
  const h3 = hsv[0] / 60;
58669
58669
  const s = hsv[1] / 100;
58670
58670
  let v2 = hsv[2] / 100;
58671
- const hi = Math.floor(h3) % 6;
58671
+ const hi2 = Math.floor(h3) % 6;
58672
58672
  const f2 = h3 - Math.floor(h3);
58673
58673
  const p2 = 255 * v2 * (1 - s);
58674
58674
  const q = 255 * v2 * (1 - s * f2);
58675
58675
  const t = 255 * v2 * (1 - s * (1 - f2));
58676
58676
  v2 *= 255;
58677
- switch (hi) {
58677
+ switch (hi2) {
58678
58678
  case 0: {
58679
58679
  return [v2, t, p2];
58680
58680
  }
@@ -59028,11 +59028,11 @@ var require_index_cjs = __commonJS({
59028
59028
  return [g2 * 255, g2 * 255, g2 * 255];
59029
59029
  }
59030
59030
  const pure = [0, 0, 0];
59031
- const hi = h3 % 1 * 6;
59032
- const v2 = hi % 1;
59031
+ const hi2 = h3 % 1 * 6;
59032
+ const v2 = hi2 % 1;
59033
59033
  const w3 = 1 - v2;
59034
59034
  let mg = 0;
59035
- switch (Math.floor(hi)) {
59035
+ switch (Math.floor(hi2)) {
59036
59036
  case 0: {
59037
59037
  pure[0] = 1;
59038
59038
  pure[1] = v2;
@@ -67558,9 +67558,9 @@ __export(main_exports, {
67558
67558
  module.exports = __toCommonJS(main_exports);
67559
67559
 
67560
67560
  // ../core/dist/esm/index.mjs
67561
- var go = Object.defineProperty;
67562
- var xo = (r6, e, t) => e in r6 ? go(r6, e, { enumerable: true, configurable: true, writable: true, value: t }) : r6[e] = t;
67563
- var c = (r6, e, t) => xo(r6, typeof e != "symbol" ? e + "" : e, t);
67561
+ var xo = Object.defineProperty;
67562
+ var vo = (r6, e, t) => e in r6 ? xo(r6, e, { enumerable: true, configurable: true, writable: true, value: t }) : r6[e] = t;
67563
+ var c = (r6, e, t) => vo(r6, typeof e != "symbol" ? e + "" : e, t);
67564
67564
  var st = class {
67565
67565
  constructor(e, t) {
67566
67566
  c(this, "operator");
@@ -67691,9 +67691,9 @@ var lr = "not-modified";
67691
67691
  var dr = "not-found";
67692
67692
  var hr = "unauthorized";
67693
67693
  var ut = "accepted";
67694
- var Pn = { resourceType: "OperationOutcome", id: dr, issue: [{ severity: "error", code: "not-found", details: { text: "Not found" } }] };
67694
+ var wn = { resourceType: "OperationOutcome", id: dr, issue: [{ severity: "error", code: "not-found", details: { text: "Not found" } }] };
67695
67695
  var Ve = { resourceType: "OperationOutcome", id: hr, issue: [{ severity: "error", code: "login", details: { text: "Unauthorized" } }] };
67696
- var wn = { ...Ve, issue: [...Ve.issue, { severity: "error", code: "expired", details: { text: "Token expired" } }] };
67696
+ var An = { ...Ve, issue: [...Ve.issue, { severity: "error", code: "expired", details: { text: "Token expired" } }] };
67697
67697
  var mr = { ...Ve, issue: [...Ve.issue, { severity: "error", code: "invalid", details: { text: "Token not issued for this audience" } }] };
67698
67698
  function b(r6, e) {
67699
67699
  return { resourceType: "OperationOutcome", issue: [{ severity: "error", code: "invalid", details: { text: r6 }, ...e ? { expression: [e] } : void 0 }] };
@@ -67701,7 +67701,7 @@ function b(r6, e) {
67701
67701
  function g(r6) {
67702
67702
  return { resourceType: "OperationOutcome", issue: [{ severity: "error", code: "structure", details: { text: r6 } }] };
67703
67703
  }
67704
- function An(r6) {
67704
+ function On(r6) {
67705
67705
  return { resourceType: "OperationOutcome", issue: [{ severity: "error", code: "exception", details: { text: "Internal server error" }, diagnostics: r6.toString() }] };
67706
67706
  }
67707
67707
  function yr(r6) {
@@ -67715,7 +67715,7 @@ function gr(r6) {
67715
67715
  }
67716
67716
  var f = class extends Error {
67717
67717
  constructor(t, n) {
67718
- super(On(t));
67718
+ super(In(t));
67719
67719
  c(this, "outcome");
67720
67720
  this.outcome = t, this.cause = n;
67721
67721
  }
@@ -67724,61 +67724,61 @@ function pt(r6) {
67724
67724
  return r6 instanceof f ? r6.outcome : lt(r6) ? r6 : b(De(r6));
67725
67725
  }
67726
67726
  function De(r6) {
67727
- return r6 ? typeof r6 == "string" ? r6 : yr(r6) ? r6.message : lt(r6) ? On(r6) : typeof r6 == "object" && "code" in r6 && typeof r6.code == "string" ? r6.code : JSON.stringify(r6) : "Unknown error";
67727
+ return r6 ? typeof r6 == "string" ? r6 : yr(r6) ? r6.message : lt(r6) ? In(r6) : typeof r6 == "object" && "code" in r6 && typeof r6.code == "string" ? r6.code : JSON.stringify(r6) : "Unknown error";
67728
67728
  }
67729
- function On(r6) {
67730
- let e = r6.issue?.map(vo) ?? [];
67729
+ function In(r6) {
67730
+ let e = r6.issue?.map(To) ?? [];
67731
67731
  return e.length > 0 ? e.join("; ") : "Unknown error";
67732
67732
  }
67733
- function vo(r6) {
67733
+ function To(r6) {
67734
67734
  let e;
67735
67735
  return r6.details?.text ? r6.diagnostics ? e = `${r6.details.text} (${r6.diagnostics})` : e = r6.details.text : r6.diagnostics ? e = r6.diagnostics : e = "Unknown error", r6.expression?.length && (e += ` (${r6.expression.join(", ")})`), e;
67736
67736
  }
67737
- function So(r6, e) {
67737
+ function bo(r6, e) {
67738
67738
  let t = e.max && e.max === Number.MAX_SAFE_INTEGER ? Number.POSITIVE_INFINITY : e.max;
67739
67739
  return { path: r6, description: "", type: e.type ?? [], min: e.min ?? 0, max: t ?? 1, isArray: !!t && t > 1, constraints: [] };
67740
67740
  }
67741
- function Vn(r6) {
67741
+ function Dn(r6) {
67742
67742
  let e = /* @__PURE__ */ Object.create(null);
67743
- for (let [t, n] of Object.entries(r6)) e[t] = { name: t, type: t, path: t, elements: Object.fromEntries(Object.entries(n.elements).map(([i, o2]) => [i, So(i, o2)])), constraints: [], innerTypes: [] };
67743
+ for (let [t, n] of Object.entries(r6)) e[t] = { name: t, type: t, path: t, elements: Object.fromEntries(Object.entries(n.elements).map(([i, o2]) => [i, bo(i, o2)])), constraints: [], innerTypes: [] };
67744
67744
  return e;
67745
67745
  }
67746
- var Dn = { Element: { elements: { id: { type: [{ code: "string" }] }, extension: { max: 9007199254740991, type: [{ code: "Extension" }] } } }, BackboneElement: { elements: { id: { type: [{ code: "string" }] }, extension: { max: 9007199254740991, type: [{ code: "Extension" }] }, modifierExtension: { max: 9007199254740991, type: [{ code: "Extension" }] } } }, Address: { elements: { id: { type: [{ code: "string" }] }, extension: { max: 9007199254740991, type: [{ code: "Extension" }] }, use: { type: [{ code: "code" }] }, type: { type: [{ code: "code" }] }, text: { type: [{ code: "string" }] }, line: { max: 9007199254740991, type: [{ code: "string" }] }, city: { type: [{ code: "string" }] }, district: { type: [{ code: "string" }] }, state: { type: [{ code: "string" }] }, postalCode: { type: [{ code: "string" }] }, country: { type: [{ code: "string" }] }, period: { type: [{ code: "Period" }] } } }, Age: { elements: { id: { type: [{ code: "string" }] }, extension: { max: 9007199254740991, type: [{ code: "Extension" }] }, value: { type: [{ code: "decimal" }] }, comparator: { type: [{ code: "code" }] }, unit: { type: [{ code: "string" }] }, system: { type: [{ code: "uri" }] }, code: { type: [{ code: "code" }] } } }, Annotation: { elements: { id: { type: [{ code: "string" }] }, extension: { max: 9007199254740991, type: [{ code: "Extension" }] }, "author[x]": { type: [{ code: "Reference", targetProfile: ["http://hl7.org/fhir/StructureDefinition/Practitioner", "http://hl7.org/fhir/StructureDefinition/Patient", "http://hl7.org/fhir/StructureDefinition/RelatedPerson", "http://hl7.org/fhir/StructureDefinition/Organization"] }, { code: "string" }] }, time: { type: [{ code: "dateTime" }] }, text: { min: 1, type: [{ code: "markdown" }] } } }, Attachment: { elements: { id: { type: [{ code: "string" }] }, extension: { max: 9007199254740991, type: [{ code: "Extension" }] }, contentType: { type: [{ code: "code" }] }, language: { type: [{ code: "code" }] }, data: { type: [{ code: "base64Binary" }] }, url: { type: [{ code: "url" }] }, size: { type: [{ code: "unsignedInt" }] }, hash: { type: [{ code: "base64Binary" }] }, title: { type: [{ code: "string" }] }, creation: { type: [{ code: "dateTime" }] } } }, CodeableConcept: { elements: { id: { type: [{ code: "string" }] }, extension: { max: 9007199254740991, type: [{ code: "Extension" }] }, coding: { max: 9007199254740991, type: [{ code: "Coding" }] }, text: { type: [{ code: "string" }] } } }, Coding: { elements: { id: { type: [{ code: "string" }] }, extension: { max: 9007199254740991, type: [{ code: "Extension" }] }, system: { type: [{ code: "uri" }] }, version: { type: [{ code: "string" }] }, code: { type: [{ code: "code" }] }, display: { type: [{ code: "string" }] }, userSelected: { type: [{ code: "boolean" }] } } }, ContactDetail: { elements: { id: { type: [{ code: "string" }] }, extension: { max: 9007199254740991, type: [{ code: "Extension" }] }, name: { type: [{ code: "string" }] }, telecom: { max: 9007199254740991, type: [{ code: "ContactPoint" }] } } }, ContactPoint: { elements: { id: { type: [{ code: "string" }] }, extension: { max: 9007199254740991, type: [{ code: "Extension" }] }, system: { type: [{ code: "code" }] }, value: { type: [{ code: "string" }] }, use: { type: [{ code: "code" }] }, rank: { type: [{ code: "positiveInt" }] }, period: { type: [{ code: "Period" }] } } }, Contributor: { elements: { id: { type: [{ code: "string" }] }, extension: { max: 9007199254740991, type: [{ code: "Extension" }] }, type: { min: 1, type: [{ code: "code" }] }, name: { min: 1, type: [{ code: "string" }] }, contact: { max: 9007199254740991, type: [{ code: "ContactDetail" }] } } }, Count: { elements: { id: { type: [{ code: "string" }] }, extension: { max: 9007199254740991, type: [{ code: "Extension" }] }, value: { type: [{ code: "decimal" }] }, comparator: { type: [{ code: "code" }] }, unit: { type: [{ code: "string" }] }, system: { type: [{ code: "uri" }] }, code: { type: [{ code: "code" }] } } }, DataRequirement: { elements: { id: { type: [{ code: "string" }] }, extension: { max: 9007199254740991, type: [{ code: "Extension" }] }, type: { min: 1, type: [{ code: "code" }] }, profile: { max: 9007199254740991, type: [{ code: "canonical", targetProfile: ["http://hl7.org/fhir/StructureDefinition/StructureDefinition"] }] }, "subject[x]": { type: [{ code: "CodeableConcept" }, { code: "Reference", targetProfile: ["http://hl7.org/fhir/StructureDefinition/Group"] }] }, mustSupport: { max: 9007199254740991, type: [{ code: "string" }] }, codeFilter: { max: 9007199254740991, type: [{ code: "DataRequirementCodeFilter" }] }, dateFilter: { max: 9007199254740991, type: [{ code: "DataRequirementDateFilter" }] }, limit: { type: [{ code: "positiveInt" }] }, sort: { max: 9007199254740991, type: [{ code: "DataRequirementSort" }] } } }, DataRequirementCodeFilter: { elements: { id: { type: [{ code: "string" }] }, extension: { max: 9007199254740991, type: [{ code: "Extension" }] }, path: { type: [{ code: "string" }] }, searchParam: { type: [{ code: "string" }] }, valueSet: { type: [{ code: "canonical", targetProfile: ["http://hl7.org/fhir/StructureDefinition/ValueSet"] }] }, code: { max: 9007199254740991, type: [{ code: "Coding" }] } } }, DataRequirementDateFilter: { elements: { id: { type: [{ code: "string" }] }, extension: { max: 9007199254740991, type: [{ code: "Extension" }] }, path: { type: [{ code: "string" }] }, searchParam: { type: [{ code: "string" }] }, "value[x]": { type: [{ code: "dateTime" }, { code: "Period" }, { code: "Duration" }] } } }, DataRequirementSort: { elements: { id: { type: [{ code: "string" }] }, extension: { max: 9007199254740991, type: [{ code: "Extension" }] }, path: { min: 1, type: [{ code: "string" }] }, direction: { min: 1, type: [{ code: "code" }] } } }, Distance: { elements: { id: { type: [{ code: "string" }] }, extension: { max: 9007199254740991, type: [{ code: "Extension" }] }, value: { type: [{ code: "decimal" }] }, comparator: { type: [{ code: "code" }] }, unit: { type: [{ code: "string" }] }, system: { type: [{ code: "uri" }] }, code: { type: [{ code: "code" }] } } }, Dosage: { elements: { id: { type: [{ code: "string" }] }, extension: { max: 9007199254740991, type: [{ code: "Extension" }] }, modifierExtension: { max: 9007199254740991, type: [{ code: "Extension" }] }, sequence: { type: [{ code: "integer" }] }, text: { type: [{ code: "string" }] }, additionalInstruction: { max: 9007199254740991, type: [{ code: "CodeableConcept" }] }, patientInstruction: { type: [{ code: "string" }] }, timing: { type: [{ code: "Timing" }] }, "asNeeded[x]": { type: [{ code: "boolean" }, { code: "CodeableConcept" }] }, site: { type: [{ code: "CodeableConcept" }] }, route: { type: [{ code: "CodeableConcept" }] }, method: { type: [{ code: "CodeableConcept" }] }, doseAndRate: { max: 9007199254740991, type: [{ code: "DosageDoseAndRate" }] }, maxDosePerPeriod: { type: [{ code: "Ratio" }] }, maxDosePerAdministration: { type: [{ code: "Quantity", profile: ["http://hl7.org/fhir/StructureDefinition/SimpleQuantity"] }] }, maxDosePerLifetime: { type: [{ code: "Quantity", profile: ["http://hl7.org/fhir/StructureDefinition/SimpleQuantity"] }] } } }, DosageDoseAndRate: { elements: { id: { type: [{ code: "string" }] }, extension: { max: 9007199254740991, type: [{ code: "Extension" }] }, type: { type: [{ code: "CodeableConcept" }] }, "dose[x]": { type: [{ code: "Range" }, { code: "Quantity", profile: ["http://hl7.org/fhir/StructureDefinition/SimpleQuantity"] }] }, "rate[x]": { type: [{ code: "Ratio" }, { code: "Range" }, { code: "Quantity", profile: ["http://hl7.org/fhir/StructureDefinition/SimpleQuantity"] }] } } }, Duration: { elements: { id: { type: [{ code: "string" }] }, extension: { max: 9007199254740991, type: [{ code: "Extension" }] }, value: { type: [{ code: "decimal" }] }, comparator: { type: [{ code: "code" }] }, unit: { type: [{ code: "string" }] }, system: { type: [{ code: "uri" }] }, code: { type: [{ code: "code" }] } } }, ElementDefinition: { elements: { id: { type: [{ code: "string" }] }, extension: { max: 9007199254740991, type: [{ code: "Extension" }] }, modifierExtension: { max: 9007199254740991, type: [{ code: "Extension" }] }, path: { min: 1, type: [{ code: "string" }] }, representation: { max: 9007199254740991, type: [{ code: "code" }] }, sliceName: { type: [{ code: "string" }] }, sliceIsConstraining: { type: [{ code: "boolean" }] }, label: { type: [{ code: "string" }] }, code: { max: 9007199254740991, type: [{ code: "Coding" }] }, slicing: { type: [{ code: "ElementDefinitionSlicing" }] }, short: { type: [{ code: "string" }] }, definition: { type: [{ code: "markdown" }] }, comment: { type: [{ code: "markdown" }] }, requirements: { type: [{ code: "markdown" }] }, alias: { max: 9007199254740991, type: [{ code: "string" }] }, min: { type: [{ code: "unsignedInt" }] }, max: { type: [{ code: "string" }] }, base: { type: [{ code: "ElementDefinitionBase" }] }, contentReference: { type: [{ code: "uri" }] }, type: { max: 9007199254740991, type: [{ code: "ElementDefinitionType" }] }, "defaultValue[x]": { type: [{ code: "base64Binary" }, { code: "boolean" }, { code: "canonical" }, { code: "code" }, { code: "date" }, { code: "dateTime" }, { code: "decimal" }, { code: "id" }, { code: "instant" }, { code: "integer" }, { code: "markdown" }, { code: "oid" }, { code: "positiveInt" }, { code: "string" }, { code: "time" }, { code: "unsignedInt" }, { code: "uri" }, { code: "url" }, { code: "uuid" }, { code: "Address" }, { code: "Age" }, { code: "Annotation" }, { code: "Attachment" }, { code: "CodeableConcept" }, { code: "Coding" }, { code: "ContactPoint" }, { code: "Count" }, { code: "Distance" }, { code: "Duration" }, { code: "HumanName" }, { code: "Identifier" }, { code: "Money" }, { code: "Period" }, { code: "Quantity" }, { code: "Range" }, { code: "Ratio" }, { code: "Reference" }, { code: "SampledData" }, { code: "Signature" }, { code: "Timing" }, { code: "ContactDetail" }, { code: "Contributor" }, { code: "DataRequirement" }, { code: "Expression" }, { code: "ParameterDefinition" }, { code: "RelatedArtifact" }, { code: "TriggerDefinition" }, { code: "UsageContext" }, { code: "Dosage" }, { code: "Meta" }] }, meaningWhenMissing: { type: [{ code: "markdown" }] }, orderMeaning: { type: [{ code: "string" }] }, "fixed[x]": { type: [{ code: "base64Binary" }, { code: "boolean" }, { code: "canonical" }, { code: "code" }, { code: "date" }, { code: "dateTime" }, { code: "decimal" }, { code: "id" }, { code: "instant" }, { code: "integer" }, { code: "markdown" }, { code: "oid" }, { code: "positiveInt" }, { code: "string" }, { code: "time" }, { code: "unsignedInt" }, { code: "uri" }, { code: "url" }, { code: "uuid" }, { code: "Address" }, { code: "Age" }, { code: "Annotation" }, { code: "Attachment" }, { code: "CodeableConcept" }, { code: "Coding" }, { code: "ContactPoint" }, { code: "Count" }, { code: "Distance" }, { code: "Duration" }, { code: "HumanName" }, { code: "Identifier" }, { code: "Money" }, { code: "Period" }, { code: "Quantity" }, { code: "Range" }, { code: "Ratio" }, { code: "Reference" }, { code: "SampledData" }, { code: "Signature" }, { code: "Timing" }, { code: "ContactDetail" }, { code: "Contributor" }, { code: "DataRequirement" }, { code: "Expression" }, { code: "ParameterDefinition" }, { code: "RelatedArtifact" }, { code: "TriggerDefinition" }, { code: "UsageContext" }, { code: "Dosage" }, { code: "Meta" }] }, "pattern[x]": { type: [{ code: "base64Binary" }, { code: "boolean" }, { code: "canonical" }, { code: "code" }, { code: "date" }, { code: "dateTime" }, { code: "decimal" }, { code: "id" }, { code: "instant" }, { code: "integer" }, { code: "markdown" }, { code: "oid" }, { code: "positiveInt" }, { code: "string" }, { code: "time" }, { code: "unsignedInt" }, { code: "uri" }, { code: "url" }, { code: "uuid" }, { code: "Address" }, { code: "Age" }, { code: "Annotation" }, { code: "Attachment" }, { code: "CodeableConcept" }, { code: "Coding" }, { code: "ContactPoint" }, { code: "Count" }, { code: "Distance" }, { code: "Duration" }, { code: "HumanName" }, { code: "Identifier" }, { code: "Money" }, { code: "Period" }, { code: "Quantity" }, { code: "Range" }, { code: "Ratio" }, { code: "Reference" }, { code: "SampledData" }, { code: "Signature" }, { code: "Timing" }, { code: "ContactDetail" }, { code: "Contributor" }, { code: "DataRequirement" }, { code: "Expression" }, { code: "ParameterDefinition" }, { code: "RelatedArtifact" }, { code: "TriggerDefinition" }, { code: "UsageContext" }, { code: "Dosage" }, { code: "Meta" }] }, example: { max: 9007199254740991, type: [{ code: "ElementDefinitionExample" }] }, "minValue[x]": { type: [{ code: "date" }, { code: "dateTime" }, { code: "instant" }, { code: "time" }, { code: "decimal" }, { code: "integer" }, { code: "positiveInt" }, { code: "unsignedInt" }, { code: "Quantity" }] }, "maxValue[x]": { type: [{ code: "date" }, { code: "dateTime" }, { code: "instant" }, { code: "time" }, { code: "decimal" }, { code: "integer" }, { code: "positiveInt" }, { code: "unsignedInt" }, { code: "Quantity" }] }, maxLength: { type: [{ code: "integer" }] }, condition: { max: 9007199254740991, type: [{ code: "id" }] }, constraint: { max: 9007199254740991, type: [{ code: "ElementDefinitionConstraint" }] }, mustSupport: { type: [{ code: "boolean" }] }, isModifier: { type: [{ code: "boolean" }] }, isModifierReason: { type: [{ code: "string" }] }, isSummary: { type: [{ code: "boolean" }] }, binding: { type: [{ code: "ElementDefinitionBinding" }] }, mapping: { max: 9007199254740991, type: [{ code: "ElementDefinitionMapping" }] } } }, ElementDefinitionSlicingDiscriminator: { elements: { id: { type: [{ code: "string" }] }, extension: { max: 9007199254740991, type: [{ code: "Extension" }] }, type: { min: 1, type: [{ code: "code" }] }, path: { min: 1, type: [{ code: "string" }] } } }, ElementDefinitionSlicing: { elements: { id: { type: [{ code: "string" }] }, extension: { max: 9007199254740991, type: [{ code: "Extension" }] }, discriminator: { max: 9007199254740991, type: [{ code: "ElementDefinitionSlicingDiscriminator" }] }, description: { type: [{ code: "string" }] }, ordered: { type: [{ code: "boolean" }] }, rules: { min: 1, type: [{ code: "code" }] } } }, ElementDefinitionBase: { elements: { id: { type: [{ code: "string" }] }, extension: { max: 9007199254740991, type: [{ code: "Extension" }] }, path: { min: 1, type: [{ code: "string" }] }, min: { min: 1, type: [{ code: "unsignedInt" }] }, max: { min: 1, type: [{ code: "string" }] } } }, ElementDefinitionType: { elements: { id: { type: [{ code: "string" }] }, extension: { max: 9007199254740991, type: [{ code: "Extension" }] }, code: { min: 1, type: [{ code: "uri" }] }, profile: { max: 9007199254740991, type: [{ code: "canonical", targetProfile: ["http://hl7.org/fhir/StructureDefinition/StructureDefinition", "http://hl7.org/fhir/StructureDefinition/ImplementationGuide"] }] }, targetProfile: { max: 9007199254740991, type: [{ code: "canonical", targetProfile: ["http://hl7.org/fhir/StructureDefinition/StructureDefinition", "http://hl7.org/fhir/StructureDefinition/ImplementationGuide"] }] }, aggregation: { max: 9007199254740991, type: [{ code: "code" }] }, versioning: { type: [{ code: "code" }] } } }, ElementDefinitionExample: { elements: { id: { type: [{ code: "string" }] }, extension: { max: 9007199254740991, type: [{ code: "Extension" }] }, label: { min: 1, type: [{ code: "string" }] }, "value[x]": { min: 1, type: [{ code: "base64Binary" }, { code: "boolean" }, { code: "canonical" }, { code: "code" }, { code: "date" }, { code: "dateTime" }, { code: "decimal" }, { code: "id" }, { code: "instant" }, { code: "integer" }, { code: "markdown" }, { code: "oid" }, { code: "positiveInt" }, { code: "string" }, { code: "time" }, { code: "unsignedInt" }, { code: "uri" }, { code: "url" }, { code: "uuid" }, { code: "Address" }, { code: "Age" }, { code: "Annotation" }, { code: "Attachment" }, { code: "CodeableConcept" }, { code: "Coding" }, { code: "ContactPoint" }, { code: "Count" }, { code: "Distance" }, { code: "Duration" }, { code: "HumanName" }, { code: "Identifier" }, { code: "Money" }, { code: "Period" }, { code: "Quantity" }, { code: "Range" }, { code: "Ratio" }, { code: "Reference" }, { code: "SampledData" }, { code: "Signature" }, { code: "Timing" }, { code: "ContactDetail" }, { code: "Contributor" }, { code: "DataRequirement" }, { code: "Expression" }, { code: "ParameterDefinition" }, { code: "RelatedArtifact" }, { code: "TriggerDefinition" }, { code: "UsageContext" }, { code: "Dosage" }, { code: "Meta" }] } } }, ElementDefinitionConstraint: { elements: { id: { type: [{ code: "string" }] }, extension: { max: 9007199254740991, type: [{ code: "Extension" }] }, key: { min: 1, type: [{ code: "id" }] }, requirements: { type: [{ code: "string" }] }, severity: { min: 1, type: [{ code: "code" }] }, human: { min: 1, type: [{ code: "string" }] }, expression: { type: [{ code: "string" }] }, xpath: { type: [{ code: "string" }] }, source: { type: [{ code: "canonical", targetProfile: ["http://hl7.org/fhir/StructureDefinition/StructureDefinition"] }] } } }, ElementDefinitionBinding: { elements: { id: { type: [{ code: "string" }] }, extension: { max: 9007199254740991, type: [{ code: "Extension" }] }, strength: { min: 1, type: [{ code: "code" }] }, description: { type: [{ code: "string" }] }, valueSet: { type: [{ code: "canonical", targetProfile: ["http://hl7.org/fhir/StructureDefinition/ValueSet"] }] } } }, ElementDefinitionMapping: { elements: { id: { type: [{ code: "string" }] }, extension: { max: 9007199254740991, type: [{ code: "Extension" }] }, identity: { min: 1, type: [{ code: "id" }] }, language: { type: [{ code: "code" }] }, map: { min: 1, type: [{ code: "string" }] }, comment: { type: [{ code: "string" }] } } }, Expression: { elements: { id: { type: [{ code: "string" }] }, extension: { max: 9007199254740991, type: [{ code: "Extension" }] }, description: { type: [{ code: "string" }] }, name: { type: [{ code: "id" }] }, language: { min: 1, type: [{ code: "code" }] }, expression: { type: [{ code: "string" }] }, reference: { type: [{ code: "uri" }] } } }, Extension: { elements: { id: { type: [{ code: "string" }] }, extension: { max: 9007199254740991, type: [{ code: "Extension" }] }, url: { min: 1, type: [{ code: "uri" }] }, "value[x]": { type: [{ code: "base64Binary" }, { code: "boolean" }, { code: "canonical" }, { code: "code" }, { code: "date" }, { code: "dateTime" }, { code: "decimal" }, { code: "id" }, { code: "instant" }, { code: "integer" }, { code: "markdown" }, { code: "oid" }, { code: "positiveInt" }, { code: "string" }, { code: "time" }, { code: "unsignedInt" }, { code: "uri" }, { code: "url" }, { code: "uuid" }, { code: "Address" }, { code: "Age" }, { code: "Annotation" }, { code: "Attachment" }, { code: "CodeableConcept" }, { code: "Coding" }, { code: "ContactPoint" }, { code: "Count" }, { code: "Distance" }, { code: "Duration" }, { code: "HumanName" }, { code: "Identifier" }, { code: "Money" }, { code: "Period" }, { code: "Quantity" }, { code: "Range" }, { code: "Ratio" }, { code: "Reference" }, { code: "SampledData" }, { code: "Signature" }, { code: "Timing" }, { code: "ContactDetail" }, { code: "Contributor" }, { code: "DataRequirement" }, { code: "Expression" }, { code: "ParameterDefinition" }, { code: "RelatedArtifact" }, { code: "TriggerDefinition" }, { code: "UsageContext" }, { code: "Dosage" }, { code: "Meta" }] } } }, HumanName: { elements: { id: { type: [{ code: "string" }] }, extension: { max: 9007199254740991, type: [{ code: "Extension" }] }, use: { type: [{ code: "code" }] }, text: { type: [{ code: "string" }] }, family: { type: [{ code: "string" }] }, given: { max: 9007199254740991, type: [{ code: "string" }] }, prefix: { max: 9007199254740991, type: [{ code: "string" }] }, suffix: { max: 9007199254740991, type: [{ code: "string" }] }, period: { type: [{ code: "Period" }] } } }, Identifier: { elements: { id: { type: [{ code: "string" }] }, extension: { max: 9007199254740991, type: [{ code: "Extension" }] }, use: { type: [{ code: "code" }] }, type: { type: [{ code: "CodeableConcept" }] }, system: { type: [{ code: "uri" }] }, value: { type: [{ code: "string" }] }, period: { type: [{ code: "Period" }] }, assigner: { type: [{ code: "Reference", targetProfile: ["http://hl7.org/fhir/StructureDefinition/Organization"] }] } } }, MarketingStatus: { elements: { id: { type: [{ code: "string" }] }, extension: { max: 9007199254740991, type: [{ code: "Extension" }] }, modifierExtension: { max: 9007199254740991, type: [{ code: "Extension" }] }, country: { min: 1, type: [{ code: "CodeableConcept" }] }, jurisdiction: { type: [{ code: "CodeableConcept" }] }, status: { min: 1, type: [{ code: "CodeableConcept" }] }, dateRange: { min: 1, type: [{ code: "Period" }] }, restoreDate: { type: [{ code: "dateTime" }] } } }, Meta: { elements: { id: { type: [{ code: "string" }] }, extension: { max: 9007199254740991, type: [{ code: "Extension" }] }, versionId: { type: [{ code: "id" }] }, lastUpdated: { type: [{ code: "instant" }] }, source: { type: [{ code: "uri" }] }, profile: { max: 9007199254740991, type: [{ code: "canonical", targetProfile: ["http://hl7.org/fhir/StructureDefinition/StructureDefinition"] }] }, security: { max: 9007199254740991, type: [{ code: "Coding" }] }, tag: { max: 9007199254740991, type: [{ code: "Coding" }] }, project: { type: [{ code: "uri" }] }, author: { type: [{ code: "Reference" }] }, onBehalfOf: { type: [{ code: "Reference" }] }, account: { type: [{ code: "Reference" }] }, accounts: { max: 9007199254740991, type: [{ code: "Reference" }] }, compartment: { max: 9007199254740991, type: [{ code: "Reference" }] } } }, Money: { elements: { id: { type: [{ code: "string" }] }, extension: { max: 9007199254740991, type: [{ code: "Extension" }] }, value: { type: [{ code: "decimal" }] }, currency: { type: [{ code: "code" }] } } }, Narrative: { elements: { id: { type: [{ code: "string" }] }, extension: { max: 9007199254740991, type: [{ code: "Extension" }] }, status: { min: 1, type: [{ code: "code" }] }, div: { min: 1, type: [{ code: "xhtml" }] } } }, ParameterDefinition: { elements: { id: { type: [{ code: "string" }] }, extension: { max: 9007199254740991, type: [{ code: "Extension" }] }, name: { type: [{ code: "code" }] }, use: { min: 1, type: [{ code: "code" }] }, min: { type: [{ code: "integer" }] }, max: { type: [{ code: "string" }] }, documentation: { type: [{ code: "string" }] }, type: { min: 1, type: [{ code: "code" }] }, profile: { type: [{ code: "canonical", targetProfile: ["http://hl7.org/fhir/StructureDefinition/StructureDefinition"] }] } } }, Period: { elements: { id: { type: [{ code: "string" }] }, extension: { max: 9007199254740991, type: [{ code: "Extension" }] }, start: { type: [{ code: "dateTime" }] }, end: { type: [{ code: "dateTime" }] } } }, Population: { elements: { id: { type: [{ code: "string" }] }, extension: { max: 9007199254740991, type: [{ code: "Extension" }] }, modifierExtension: { max: 9007199254740991, type: [{ code: "Extension" }] }, "age[x]": { type: [{ code: "Range" }, { code: "CodeableConcept" }] }, gender: { type: [{ code: "CodeableConcept" }] }, race: { type: [{ code: "CodeableConcept" }] }, physiologicalCondition: { type: [{ code: "CodeableConcept" }] } } }, ProdCharacteristic: { elements: { id: { type: [{ code: "string" }] }, extension: { max: 9007199254740991, type: [{ code: "Extension" }] }, modifierExtension: { max: 9007199254740991, type: [{ code: "Extension" }] }, height: { type: [{ code: "Quantity" }] }, width: { type: [{ code: "Quantity" }] }, depth: { type: [{ code: "Quantity" }] }, weight: { type: [{ code: "Quantity" }] }, nominalVolume: { type: [{ code: "Quantity" }] }, externalDiameter: { type: [{ code: "Quantity" }] }, shape: { type: [{ code: "string" }] }, color: { max: 9007199254740991, type: [{ code: "string" }] }, imprint: { max: 9007199254740991, type: [{ code: "string" }] }, image: { max: 9007199254740991, type: [{ code: "Attachment" }] }, scoring: { type: [{ code: "CodeableConcept" }] } } }, ProductShelfLife: { elements: { id: { type: [{ code: "string" }] }, extension: { max: 9007199254740991, type: [{ code: "Extension" }] }, modifierExtension: { max: 9007199254740991, type: [{ code: "Extension" }] }, identifier: { type: [{ code: "Identifier" }] }, type: { min: 1, type: [{ code: "CodeableConcept" }] }, period: { min: 1, type: [{ code: "Quantity" }] }, specialPrecautionsForStorage: { max: 9007199254740991, type: [{ code: "CodeableConcept" }] } } }, Quantity: { elements: { id: { type: [{ code: "string" }] }, extension: { max: 9007199254740991, type: [{ code: "Extension" }] }, value: { type: [{ code: "decimal" }] }, comparator: { type: [{ code: "code" }] }, unit: { type: [{ code: "string" }] }, system: { type: [{ code: "uri" }] }, code: { type: [{ code: "code" }] } } }, Range: { elements: { id: { type: [{ code: "string" }] }, extension: { max: 9007199254740991, type: [{ code: "Extension" }] }, low: { type: [{ code: "Quantity", profile: ["http://hl7.org/fhir/StructureDefinition/SimpleQuantity"] }] }, high: { type: [{ code: "Quantity", profile: ["http://hl7.org/fhir/StructureDefinition/SimpleQuantity"] }] } } }, Ratio: { elements: { id: { type: [{ code: "string" }] }, extension: { max: 9007199254740991, type: [{ code: "Extension" }] }, numerator: { type: [{ code: "Quantity" }] }, denominator: { type: [{ code: "Quantity" }] } } }, Reference: { elements: { id: { type: [{ code: "string" }] }, extension: { max: 9007199254740991, type: [{ code: "Extension" }] }, reference: { type: [{ code: "string" }] }, type: { type: [{ code: "uri" }] }, identifier: { type: [{ code: "Identifier" }] }, display: { type: [{ code: "string" }] } } }, RelatedArtifact: { elements: { id: { type: [{ code: "string" }] }, extension: { max: 9007199254740991, type: [{ code: "Extension" }] }, type: { min: 1, type: [{ code: "code" }] }, label: { type: [{ code: "string" }] }, display: { type: [{ code: "string" }] }, citation: { type: [{ code: "markdown" }] }, url: { type: [{ code: "url" }] }, document: { type: [{ code: "Attachment" }] }, resource: { type: [{ code: "canonical", targetProfile: ["http://hl7.org/fhir/StructureDefinition/Resource"] }] } } }, SampledData: { elements: { id: { type: [{ code: "string" }] }, extension: { max: 9007199254740991, type: [{ code: "Extension" }] }, origin: { min: 1, type: [{ code: "Quantity", profile: ["http://hl7.org/fhir/StructureDefinition/SimpleQuantity"] }] }, period: { min: 1, type: [{ code: "decimal" }] }, factor: { type: [{ code: "decimal" }] }, lowerLimit: { type: [{ code: "decimal" }] }, upperLimit: { type: [{ code: "decimal" }] }, dimensions: { min: 1, type: [{ code: "positiveInt" }] }, data: { type: [{ code: "string" }] } } }, Signature: { elements: { id: { type: [{ code: "string" }] }, extension: { max: 9007199254740991, type: [{ code: "Extension" }] }, type: { min: 1, max: 9007199254740991, type: [{ code: "Coding" }] }, when: { min: 1, type: [{ code: "instant" }] }, who: { min: 1, type: [{ code: "Reference", targetProfile: ["http://hl7.org/fhir/StructureDefinition/Practitioner", "http://hl7.org/fhir/StructureDefinition/PractitionerRole", "http://hl7.org/fhir/StructureDefinition/RelatedPerson", "http://hl7.org/fhir/StructureDefinition/Patient", "http://hl7.org/fhir/StructureDefinition/Device", "http://hl7.org/fhir/StructureDefinition/Organization"] }] }, onBehalfOf: { type: [{ code: "Reference", targetProfile: ["http://hl7.org/fhir/StructureDefinition/Practitioner", "http://hl7.org/fhir/StructureDefinition/PractitionerRole", "http://hl7.org/fhir/StructureDefinition/RelatedPerson", "http://hl7.org/fhir/StructureDefinition/Patient", "http://hl7.org/fhir/StructureDefinition/Device", "http://hl7.org/fhir/StructureDefinition/Organization"] }] }, targetFormat: { type: [{ code: "code" }] }, sigFormat: { type: [{ code: "code" }] }, data: { type: [{ code: "base64Binary" }] } } }, SubstanceAmount: { elements: { id: { type: [{ code: "string" }] }, extension: { max: 9007199254740991, type: [{ code: "Extension" }] }, modifierExtension: { max: 9007199254740991, type: [{ code: "Extension" }] }, "amount[x]": { type: [{ code: "Quantity" }, { code: "Range" }, { code: "string" }] }, amountType: { type: [{ code: "CodeableConcept" }] }, amountText: { type: [{ code: "string" }] }, referenceRange: { type: [{ code: "SubstanceAmountReferenceRange" }] } } }, SubstanceAmountReferenceRange: { elements: { id: { type: [{ code: "string" }] }, extension: { max: 9007199254740991, type: [{ code: "Extension" }] }, lowLimit: { type: [{ code: "Quantity" }] }, highLimit: { type: [{ code: "Quantity" }] } } }, Timing: { elements: { id: { type: [{ code: "string" }] }, extension: { max: 9007199254740991, type: [{ code: "Extension" }] }, modifierExtension: { max: 9007199254740991, type: [{ code: "Extension" }] }, event: { max: 9007199254740991, type: [{ code: "dateTime" }] }, repeat: { type: [{ code: "TimingRepeat" }] }, code: { type: [{ code: "CodeableConcept" }] } } }, TimingRepeat: { elements: { id: { type: [{ code: "string" }] }, extension: { max: 9007199254740991, type: [{ code: "Extension" }] }, "bounds[x]": { type: [{ code: "Duration" }, { code: "Range" }, { code: "Period" }] }, count: { type: [{ code: "positiveInt" }] }, countMax: { type: [{ code: "positiveInt" }] }, duration: { type: [{ code: "decimal" }] }, durationMax: { type: [{ code: "decimal" }] }, durationUnit: { type: [{ code: "code" }] }, frequency: { type: [{ code: "positiveInt" }] }, frequencyMax: { type: [{ code: "positiveInt" }] }, period: { type: [{ code: "decimal" }] }, periodMax: { type: [{ code: "decimal" }] }, periodUnit: { type: [{ code: "code" }] }, dayOfWeek: { max: 9007199254740991, type: [{ code: "code" }] }, timeOfDay: { max: 9007199254740991, type: [{ code: "time" }] }, when: { max: 9007199254740991, type: [{ code: "code" }] }, offset: { type: [{ code: "unsignedInt" }] } } }, TriggerDefinition: { elements: { id: { type: [{ code: "string" }] }, extension: { max: 9007199254740991, type: [{ code: "Extension" }] }, type: { min: 1, type: [{ code: "code" }] }, name: { type: [{ code: "string" }] }, "timing[x]": { type: [{ code: "Timing" }, { code: "Reference", targetProfile: ["http://hl7.org/fhir/StructureDefinition/Schedule"] }, { code: "date" }, { code: "dateTime" }] }, data: { max: 9007199254740991, type: [{ code: "DataRequirement" }] }, condition: { type: [{ code: "Expression" }] } } }, UsageContext: { elements: { id: { type: [{ code: "string" }] }, extension: { max: 9007199254740991, type: [{ code: "Extension" }] }, code: { min: 1, type: [{ code: "Coding" }] }, "value[x]": { min: 1, type: [{ code: "CodeableConcept" }, { code: "Quantity" }, { code: "Range" }, { code: "Reference", targetProfile: ["http://hl7.org/fhir/StructureDefinition/PlanDefinition", "http://hl7.org/fhir/StructureDefinition/ResearchStudy", "http://hl7.org/fhir/StructureDefinition/InsurancePlan", "http://hl7.org/fhir/StructureDefinition/HealthcareService", "http://hl7.org/fhir/StructureDefinition/Group", "http://hl7.org/fhir/StructureDefinition/Location", "http://hl7.org/fhir/StructureDefinition/Organization"] }] } } }, MoneyQuantity: { elements: { id: { type: [{ code: "string" }] }, extension: { max: 9007199254740991, type: [{ code: "Extension" }] }, value: { type: [{ code: "decimal" }] }, comparator: { type: [{ code: "code" }] }, unit: { type: [{ code: "string" }] }, system: { type: [{ code: "uri" }] }, code: { type: [{ code: "code" }] } } }, SimpleQuantity: { elements: { id: { type: [{ code: "string" }] }, extension: { max: 9007199254740991, type: [{ code: "Extension" }] }, value: { type: [{ code: "decimal" }] }, comparator: { max: 0, type: [{ code: "code" }] }, unit: { type: [{ code: "string" }] }, system: { type: [{ code: "uri" }] }, code: { type: [{ code: "code" }] } } }, IdentityProvider: { elements: { authorizeUrl: { min: 1, type: [{ code: "string" }] }, tokenUrl: { min: 1, type: [{ code: "string" }] }, tokenAuthMethod: { type: [{ code: "code" }] }, userInfoUrl: { min: 1, type: [{ code: "string" }] }, clientId: { min: 1, type: [{ code: "string" }] }, clientSecret: { min: 1, type: [{ code: "string" }] }, usePkce: { type: [{ code: "boolean" }] }, useSubject: { type: [{ code: "boolean" }] } } } };
67746
+ var Mn = { Element: { elements: { id: { type: [{ code: "string" }] }, extension: { max: 9007199254740991, type: [{ code: "Extension" }] } } }, BackboneElement: { elements: { id: { type: [{ code: "string" }] }, extension: { max: 9007199254740991, type: [{ code: "Extension" }] }, modifierExtension: { max: 9007199254740991, type: [{ code: "Extension" }] } } }, Address: { elements: { id: { type: [{ code: "string" }] }, extension: { max: 9007199254740991, type: [{ code: "Extension" }] }, use: { type: [{ code: "code" }] }, type: { type: [{ code: "code" }] }, text: { type: [{ code: "string" }] }, line: { max: 9007199254740991, type: [{ code: "string" }] }, city: { type: [{ code: "string" }] }, district: { type: [{ code: "string" }] }, state: { type: [{ code: "string" }] }, postalCode: { type: [{ code: "string" }] }, country: { type: [{ code: "string" }] }, period: { type: [{ code: "Period" }] } } }, Age: { elements: { id: { type: [{ code: "string" }] }, extension: { max: 9007199254740991, type: [{ code: "Extension" }] }, value: { type: [{ code: "decimal" }] }, comparator: { type: [{ code: "code" }] }, unit: { type: [{ code: "string" }] }, system: { type: [{ code: "uri" }] }, code: { type: [{ code: "code" }] } } }, Annotation: { elements: { id: { type: [{ code: "string" }] }, extension: { max: 9007199254740991, type: [{ code: "Extension" }] }, "author[x]": { type: [{ code: "Reference", targetProfile: ["http://hl7.org/fhir/StructureDefinition/Practitioner", "http://hl7.org/fhir/StructureDefinition/Patient", "http://hl7.org/fhir/StructureDefinition/RelatedPerson", "http://hl7.org/fhir/StructureDefinition/Organization"] }, { code: "string" }] }, time: { type: [{ code: "dateTime" }] }, text: { min: 1, type: [{ code: "markdown" }] } } }, Attachment: { elements: { id: { type: [{ code: "string" }] }, extension: { max: 9007199254740991, type: [{ code: "Extension" }] }, contentType: { type: [{ code: "code" }] }, language: { type: [{ code: "code" }] }, data: { type: [{ code: "base64Binary" }] }, url: { type: [{ code: "url" }] }, size: { type: [{ code: "unsignedInt" }] }, hash: { type: [{ code: "base64Binary" }] }, title: { type: [{ code: "string" }] }, creation: { type: [{ code: "dateTime" }] } } }, CodeableConcept: { elements: { id: { type: [{ code: "string" }] }, extension: { max: 9007199254740991, type: [{ code: "Extension" }] }, coding: { max: 9007199254740991, type: [{ code: "Coding" }] }, text: { type: [{ code: "string" }] } } }, Coding: { elements: { id: { type: [{ code: "string" }] }, extension: { max: 9007199254740991, type: [{ code: "Extension" }] }, system: { type: [{ code: "uri" }] }, version: { type: [{ code: "string" }] }, code: { type: [{ code: "code" }] }, display: { type: [{ code: "string" }] }, userSelected: { type: [{ code: "boolean" }] } } }, ContactDetail: { elements: { id: { type: [{ code: "string" }] }, extension: { max: 9007199254740991, type: [{ code: "Extension" }] }, name: { type: [{ code: "string" }] }, telecom: { max: 9007199254740991, type: [{ code: "ContactPoint" }] } } }, ContactPoint: { elements: { id: { type: [{ code: "string" }] }, extension: { max: 9007199254740991, type: [{ code: "Extension" }] }, system: { type: [{ code: "code" }] }, value: { type: [{ code: "string" }] }, use: { type: [{ code: "code" }] }, rank: { type: [{ code: "positiveInt" }] }, period: { type: [{ code: "Period" }] } } }, Contributor: { elements: { id: { type: [{ code: "string" }] }, extension: { max: 9007199254740991, type: [{ code: "Extension" }] }, type: { min: 1, type: [{ code: "code" }] }, name: { min: 1, type: [{ code: "string" }] }, contact: { max: 9007199254740991, type: [{ code: "ContactDetail" }] } } }, Count: { elements: { id: { type: [{ code: "string" }] }, extension: { max: 9007199254740991, type: [{ code: "Extension" }] }, value: { type: [{ code: "decimal" }] }, comparator: { type: [{ code: "code" }] }, unit: { type: [{ code: "string" }] }, system: { type: [{ code: "uri" }] }, code: { type: [{ code: "code" }] } } }, DataRequirement: { elements: { id: { type: [{ code: "string" }] }, extension: { max: 9007199254740991, type: [{ code: "Extension" }] }, type: { min: 1, type: [{ code: "code" }] }, profile: { max: 9007199254740991, type: [{ code: "canonical", targetProfile: ["http://hl7.org/fhir/StructureDefinition/StructureDefinition"] }] }, "subject[x]": { type: [{ code: "CodeableConcept" }, { code: "Reference", targetProfile: ["http://hl7.org/fhir/StructureDefinition/Group"] }] }, mustSupport: { max: 9007199254740991, type: [{ code: "string" }] }, codeFilter: { max: 9007199254740991, type: [{ code: "DataRequirementCodeFilter" }] }, dateFilter: { max: 9007199254740991, type: [{ code: "DataRequirementDateFilter" }] }, limit: { type: [{ code: "positiveInt" }] }, sort: { max: 9007199254740991, type: [{ code: "DataRequirementSort" }] } } }, DataRequirementCodeFilter: { elements: { id: { type: [{ code: "string" }] }, extension: { max: 9007199254740991, type: [{ code: "Extension" }] }, path: { type: [{ code: "string" }] }, searchParam: { type: [{ code: "string" }] }, valueSet: { type: [{ code: "canonical", targetProfile: ["http://hl7.org/fhir/StructureDefinition/ValueSet"] }] }, code: { max: 9007199254740991, type: [{ code: "Coding" }] } } }, DataRequirementDateFilter: { elements: { id: { type: [{ code: "string" }] }, extension: { max: 9007199254740991, type: [{ code: "Extension" }] }, path: { type: [{ code: "string" }] }, searchParam: { type: [{ code: "string" }] }, "value[x]": { type: [{ code: "dateTime" }, { code: "Period" }, { code: "Duration" }] } } }, DataRequirementSort: { elements: { id: { type: [{ code: "string" }] }, extension: { max: 9007199254740991, type: [{ code: "Extension" }] }, path: { min: 1, type: [{ code: "string" }] }, direction: { min: 1, type: [{ code: "code" }] } } }, Distance: { elements: { id: { type: [{ code: "string" }] }, extension: { max: 9007199254740991, type: [{ code: "Extension" }] }, value: { type: [{ code: "decimal" }] }, comparator: { type: [{ code: "code" }] }, unit: { type: [{ code: "string" }] }, system: { type: [{ code: "uri" }] }, code: { type: [{ code: "code" }] } } }, Dosage: { elements: { id: { type: [{ code: "string" }] }, extension: { max: 9007199254740991, type: [{ code: "Extension" }] }, modifierExtension: { max: 9007199254740991, type: [{ code: "Extension" }] }, sequence: { type: [{ code: "integer" }] }, text: { type: [{ code: "string" }] }, additionalInstruction: { max: 9007199254740991, type: [{ code: "CodeableConcept" }] }, patientInstruction: { type: [{ code: "string" }] }, timing: { type: [{ code: "Timing" }] }, "asNeeded[x]": { type: [{ code: "boolean" }, { code: "CodeableConcept" }] }, site: { type: [{ code: "CodeableConcept" }] }, route: { type: [{ code: "CodeableConcept" }] }, method: { type: [{ code: "CodeableConcept" }] }, doseAndRate: { max: 9007199254740991, type: [{ code: "DosageDoseAndRate" }] }, maxDosePerPeriod: { type: [{ code: "Ratio" }] }, maxDosePerAdministration: { type: [{ code: "Quantity", profile: ["http://hl7.org/fhir/StructureDefinition/SimpleQuantity"] }] }, maxDosePerLifetime: { type: [{ code: "Quantity", profile: ["http://hl7.org/fhir/StructureDefinition/SimpleQuantity"] }] } } }, DosageDoseAndRate: { elements: { id: { type: [{ code: "string" }] }, extension: { max: 9007199254740991, type: [{ code: "Extension" }] }, type: { type: [{ code: "CodeableConcept" }] }, "dose[x]": { type: [{ code: "Range" }, { code: "Quantity", profile: ["http://hl7.org/fhir/StructureDefinition/SimpleQuantity"] }] }, "rate[x]": { type: [{ code: "Ratio" }, { code: "Range" }, { code: "Quantity", profile: ["http://hl7.org/fhir/StructureDefinition/SimpleQuantity"] }] } } }, Duration: { elements: { id: { type: [{ code: "string" }] }, extension: { max: 9007199254740991, type: [{ code: "Extension" }] }, value: { type: [{ code: "decimal" }] }, comparator: { type: [{ code: "code" }] }, unit: { type: [{ code: "string" }] }, system: { type: [{ code: "uri" }] }, code: { type: [{ code: "code" }] } } }, ElementDefinition: { elements: { id: { type: [{ code: "string" }] }, extension: { max: 9007199254740991, type: [{ code: "Extension" }] }, modifierExtension: { max: 9007199254740991, type: [{ code: "Extension" }] }, path: { min: 1, type: [{ code: "string" }] }, representation: { max: 9007199254740991, type: [{ code: "code" }] }, sliceName: { type: [{ code: "string" }] }, sliceIsConstraining: { type: [{ code: "boolean" }] }, label: { type: [{ code: "string" }] }, code: { max: 9007199254740991, type: [{ code: "Coding" }] }, slicing: { type: [{ code: "ElementDefinitionSlicing" }] }, short: { type: [{ code: "string" }] }, definition: { type: [{ code: "markdown" }] }, comment: { type: [{ code: "markdown" }] }, requirements: { type: [{ code: "markdown" }] }, alias: { max: 9007199254740991, type: [{ code: "string" }] }, min: { type: [{ code: "unsignedInt" }] }, max: { type: [{ code: "string" }] }, base: { type: [{ code: "ElementDefinitionBase" }] }, contentReference: { type: [{ code: "uri" }] }, type: { max: 9007199254740991, type: [{ code: "ElementDefinitionType" }] }, "defaultValue[x]": { type: [{ code: "base64Binary" }, { code: "boolean" }, { code: "canonical" }, { code: "code" }, { code: "date" }, { code: "dateTime" }, { code: "decimal" }, { code: "id" }, { code: "instant" }, { code: "integer" }, { code: "markdown" }, { code: "oid" }, { code: "positiveInt" }, { code: "string" }, { code: "time" }, { code: "unsignedInt" }, { code: "uri" }, { code: "url" }, { code: "uuid" }, { code: "Address" }, { code: "Age" }, { code: "Annotation" }, { code: "Attachment" }, { code: "CodeableConcept" }, { code: "Coding" }, { code: "ContactPoint" }, { code: "Count" }, { code: "Distance" }, { code: "Duration" }, { code: "HumanName" }, { code: "Identifier" }, { code: "Money" }, { code: "Period" }, { code: "Quantity" }, { code: "Range" }, { code: "Ratio" }, { code: "Reference" }, { code: "SampledData" }, { code: "Signature" }, { code: "Timing" }, { code: "ContactDetail" }, { code: "Contributor" }, { code: "DataRequirement" }, { code: "Expression" }, { code: "ParameterDefinition" }, { code: "RelatedArtifact" }, { code: "TriggerDefinition" }, { code: "UsageContext" }, { code: "Dosage" }, { code: "Meta" }] }, meaningWhenMissing: { type: [{ code: "markdown" }] }, orderMeaning: { type: [{ code: "string" }] }, "fixed[x]": { type: [{ code: "base64Binary" }, { code: "boolean" }, { code: "canonical" }, { code: "code" }, { code: "date" }, { code: "dateTime" }, { code: "decimal" }, { code: "id" }, { code: "instant" }, { code: "integer" }, { code: "markdown" }, { code: "oid" }, { code: "positiveInt" }, { code: "string" }, { code: "time" }, { code: "unsignedInt" }, { code: "uri" }, { code: "url" }, { code: "uuid" }, { code: "Address" }, { code: "Age" }, { code: "Annotation" }, { code: "Attachment" }, { code: "CodeableConcept" }, { code: "Coding" }, { code: "ContactPoint" }, { code: "Count" }, { code: "Distance" }, { code: "Duration" }, { code: "HumanName" }, { code: "Identifier" }, { code: "Money" }, { code: "Period" }, { code: "Quantity" }, { code: "Range" }, { code: "Ratio" }, { code: "Reference" }, { code: "SampledData" }, { code: "Signature" }, { code: "Timing" }, { code: "ContactDetail" }, { code: "Contributor" }, { code: "DataRequirement" }, { code: "Expression" }, { code: "ParameterDefinition" }, { code: "RelatedArtifact" }, { code: "TriggerDefinition" }, { code: "UsageContext" }, { code: "Dosage" }, { code: "Meta" }] }, "pattern[x]": { type: [{ code: "base64Binary" }, { code: "boolean" }, { code: "canonical" }, { code: "code" }, { code: "date" }, { code: "dateTime" }, { code: "decimal" }, { code: "id" }, { code: "instant" }, { code: "integer" }, { code: "markdown" }, { code: "oid" }, { code: "positiveInt" }, { code: "string" }, { code: "time" }, { code: "unsignedInt" }, { code: "uri" }, { code: "url" }, { code: "uuid" }, { code: "Address" }, { code: "Age" }, { code: "Annotation" }, { code: "Attachment" }, { code: "CodeableConcept" }, { code: "Coding" }, { code: "ContactPoint" }, { code: "Count" }, { code: "Distance" }, { code: "Duration" }, { code: "HumanName" }, { code: "Identifier" }, { code: "Money" }, { code: "Period" }, { code: "Quantity" }, { code: "Range" }, { code: "Ratio" }, { code: "Reference" }, { code: "SampledData" }, { code: "Signature" }, { code: "Timing" }, { code: "ContactDetail" }, { code: "Contributor" }, { code: "DataRequirement" }, { code: "Expression" }, { code: "ParameterDefinition" }, { code: "RelatedArtifact" }, { code: "TriggerDefinition" }, { code: "UsageContext" }, { code: "Dosage" }, { code: "Meta" }] }, example: { max: 9007199254740991, type: [{ code: "ElementDefinitionExample" }] }, "minValue[x]": { type: [{ code: "date" }, { code: "dateTime" }, { code: "instant" }, { code: "time" }, { code: "decimal" }, { code: "integer" }, { code: "positiveInt" }, { code: "unsignedInt" }, { code: "Quantity" }] }, "maxValue[x]": { type: [{ code: "date" }, { code: "dateTime" }, { code: "instant" }, { code: "time" }, { code: "decimal" }, { code: "integer" }, { code: "positiveInt" }, { code: "unsignedInt" }, { code: "Quantity" }] }, maxLength: { type: [{ code: "integer" }] }, condition: { max: 9007199254740991, type: [{ code: "id" }] }, constraint: { max: 9007199254740991, type: [{ code: "ElementDefinitionConstraint" }] }, mustSupport: { type: [{ code: "boolean" }] }, isModifier: { type: [{ code: "boolean" }] }, isModifierReason: { type: [{ code: "string" }] }, isSummary: { type: [{ code: "boolean" }] }, binding: { type: [{ code: "ElementDefinitionBinding" }] }, mapping: { max: 9007199254740991, type: [{ code: "ElementDefinitionMapping" }] } } }, ElementDefinitionSlicingDiscriminator: { elements: { id: { type: [{ code: "string" }] }, extension: { max: 9007199254740991, type: [{ code: "Extension" }] }, type: { min: 1, type: [{ code: "code" }] }, path: { min: 1, type: [{ code: "string" }] } } }, ElementDefinitionSlicing: { elements: { id: { type: [{ code: "string" }] }, extension: { max: 9007199254740991, type: [{ code: "Extension" }] }, discriminator: { max: 9007199254740991, type: [{ code: "ElementDefinitionSlicingDiscriminator" }] }, description: { type: [{ code: "string" }] }, ordered: { type: [{ code: "boolean" }] }, rules: { min: 1, type: [{ code: "code" }] } } }, ElementDefinitionBase: { elements: { id: { type: [{ code: "string" }] }, extension: { max: 9007199254740991, type: [{ code: "Extension" }] }, path: { min: 1, type: [{ code: "string" }] }, min: { min: 1, type: [{ code: "unsignedInt" }] }, max: { min: 1, type: [{ code: "string" }] } } }, ElementDefinitionType: { elements: { id: { type: [{ code: "string" }] }, extension: { max: 9007199254740991, type: [{ code: "Extension" }] }, code: { min: 1, type: [{ code: "uri" }] }, profile: { max: 9007199254740991, type: [{ code: "canonical", targetProfile: ["http://hl7.org/fhir/StructureDefinition/StructureDefinition", "http://hl7.org/fhir/StructureDefinition/ImplementationGuide"] }] }, targetProfile: { max: 9007199254740991, type: [{ code: "canonical", targetProfile: ["http://hl7.org/fhir/StructureDefinition/StructureDefinition", "http://hl7.org/fhir/StructureDefinition/ImplementationGuide"] }] }, aggregation: { max: 9007199254740991, type: [{ code: "code" }] }, versioning: { type: [{ code: "code" }] } } }, ElementDefinitionExample: { elements: { id: { type: [{ code: "string" }] }, extension: { max: 9007199254740991, type: [{ code: "Extension" }] }, label: { min: 1, type: [{ code: "string" }] }, "value[x]": { min: 1, type: [{ code: "base64Binary" }, { code: "boolean" }, { code: "canonical" }, { code: "code" }, { code: "date" }, { code: "dateTime" }, { code: "decimal" }, { code: "id" }, { code: "instant" }, { code: "integer" }, { code: "markdown" }, { code: "oid" }, { code: "positiveInt" }, { code: "string" }, { code: "time" }, { code: "unsignedInt" }, { code: "uri" }, { code: "url" }, { code: "uuid" }, { code: "Address" }, { code: "Age" }, { code: "Annotation" }, { code: "Attachment" }, { code: "CodeableConcept" }, { code: "Coding" }, { code: "ContactPoint" }, { code: "Count" }, { code: "Distance" }, { code: "Duration" }, { code: "HumanName" }, { code: "Identifier" }, { code: "Money" }, { code: "Period" }, { code: "Quantity" }, { code: "Range" }, { code: "Ratio" }, { code: "Reference" }, { code: "SampledData" }, { code: "Signature" }, { code: "Timing" }, { code: "ContactDetail" }, { code: "Contributor" }, { code: "DataRequirement" }, { code: "Expression" }, { code: "ParameterDefinition" }, { code: "RelatedArtifact" }, { code: "TriggerDefinition" }, { code: "UsageContext" }, { code: "Dosage" }, { code: "Meta" }] } } }, ElementDefinitionConstraint: { elements: { id: { type: [{ code: "string" }] }, extension: { max: 9007199254740991, type: [{ code: "Extension" }] }, key: { min: 1, type: [{ code: "id" }] }, requirements: { type: [{ code: "string" }] }, severity: { min: 1, type: [{ code: "code" }] }, human: { min: 1, type: [{ code: "string" }] }, expression: { type: [{ code: "string" }] }, xpath: { type: [{ code: "string" }] }, source: { type: [{ code: "canonical", targetProfile: ["http://hl7.org/fhir/StructureDefinition/StructureDefinition"] }] } } }, ElementDefinitionBinding: { elements: { id: { type: [{ code: "string" }] }, extension: { max: 9007199254740991, type: [{ code: "Extension" }] }, strength: { min: 1, type: [{ code: "code" }] }, description: { type: [{ code: "string" }] }, valueSet: { type: [{ code: "canonical", targetProfile: ["http://hl7.org/fhir/StructureDefinition/ValueSet"] }] } } }, ElementDefinitionMapping: { elements: { id: { type: [{ code: "string" }] }, extension: { max: 9007199254740991, type: [{ code: "Extension" }] }, identity: { min: 1, type: [{ code: "id" }] }, language: { type: [{ code: "code" }] }, map: { min: 1, type: [{ code: "string" }] }, comment: { type: [{ code: "string" }] } } }, Expression: { elements: { id: { type: [{ code: "string" }] }, extension: { max: 9007199254740991, type: [{ code: "Extension" }] }, description: { type: [{ code: "string" }] }, name: { type: [{ code: "id" }] }, language: { min: 1, type: [{ code: "code" }] }, expression: { type: [{ code: "string" }] }, reference: { type: [{ code: "uri" }] } } }, Extension: { elements: { id: { type: [{ code: "string" }] }, extension: { max: 9007199254740991, type: [{ code: "Extension" }] }, url: { min: 1, type: [{ code: "uri" }] }, "value[x]": { type: [{ code: "base64Binary" }, { code: "boolean" }, { code: "canonical" }, { code: "code" }, { code: "date" }, { code: "dateTime" }, { code: "decimal" }, { code: "id" }, { code: "instant" }, { code: "integer" }, { code: "markdown" }, { code: "oid" }, { code: "positiveInt" }, { code: "string" }, { code: "time" }, { code: "unsignedInt" }, { code: "uri" }, { code: "url" }, { code: "uuid" }, { code: "Address" }, { code: "Age" }, { code: "Annotation" }, { code: "Attachment" }, { code: "CodeableConcept" }, { code: "Coding" }, { code: "ContactPoint" }, { code: "Count" }, { code: "Distance" }, { code: "Duration" }, { code: "HumanName" }, { code: "Identifier" }, { code: "Money" }, { code: "Period" }, { code: "Quantity" }, { code: "Range" }, { code: "Ratio" }, { code: "Reference" }, { code: "SampledData" }, { code: "Signature" }, { code: "Timing" }, { code: "ContactDetail" }, { code: "Contributor" }, { code: "DataRequirement" }, { code: "Expression" }, { code: "ParameterDefinition" }, { code: "RelatedArtifact" }, { code: "TriggerDefinition" }, { code: "UsageContext" }, { code: "Dosage" }, { code: "Meta" }] } } }, HumanName: { elements: { id: { type: [{ code: "string" }] }, extension: { max: 9007199254740991, type: [{ code: "Extension" }] }, use: { type: [{ code: "code" }] }, text: { type: [{ code: "string" }] }, family: { type: [{ code: "string" }] }, given: { max: 9007199254740991, type: [{ code: "string" }] }, prefix: { max: 9007199254740991, type: [{ code: "string" }] }, suffix: { max: 9007199254740991, type: [{ code: "string" }] }, period: { type: [{ code: "Period" }] } } }, Identifier: { elements: { id: { type: [{ code: "string" }] }, extension: { max: 9007199254740991, type: [{ code: "Extension" }] }, use: { type: [{ code: "code" }] }, type: { type: [{ code: "CodeableConcept" }] }, system: { type: [{ code: "uri" }] }, value: { type: [{ code: "string" }] }, period: { type: [{ code: "Period" }] }, assigner: { type: [{ code: "Reference", targetProfile: ["http://hl7.org/fhir/StructureDefinition/Organization"] }] } } }, MarketingStatus: { elements: { id: { type: [{ code: "string" }] }, extension: { max: 9007199254740991, type: [{ code: "Extension" }] }, modifierExtension: { max: 9007199254740991, type: [{ code: "Extension" }] }, country: { min: 1, type: [{ code: "CodeableConcept" }] }, jurisdiction: { type: [{ code: "CodeableConcept" }] }, status: { min: 1, type: [{ code: "CodeableConcept" }] }, dateRange: { min: 1, type: [{ code: "Period" }] }, restoreDate: { type: [{ code: "dateTime" }] } } }, Meta: { elements: { id: { type: [{ code: "string" }] }, extension: { max: 9007199254740991, type: [{ code: "Extension" }] }, versionId: { type: [{ code: "id" }] }, lastUpdated: { type: [{ code: "instant" }] }, source: { type: [{ code: "uri" }] }, profile: { max: 9007199254740991, type: [{ code: "canonical", targetProfile: ["http://hl7.org/fhir/StructureDefinition/StructureDefinition"] }] }, security: { max: 9007199254740991, type: [{ code: "Coding" }] }, tag: { max: 9007199254740991, type: [{ code: "Coding" }] }, project: { type: [{ code: "uri" }] }, author: { type: [{ code: "Reference" }] }, onBehalfOf: { type: [{ code: "Reference" }] }, account: { type: [{ code: "Reference" }] }, accounts: { max: 9007199254740991, type: [{ code: "Reference" }] }, compartment: { max: 9007199254740991, type: [{ code: "Reference" }] } } }, Money: { elements: { id: { type: [{ code: "string" }] }, extension: { max: 9007199254740991, type: [{ code: "Extension" }] }, value: { type: [{ code: "decimal" }] }, currency: { type: [{ code: "code" }] } } }, Narrative: { elements: { id: { type: [{ code: "string" }] }, extension: { max: 9007199254740991, type: [{ code: "Extension" }] }, status: { min: 1, type: [{ code: "code" }] }, div: { min: 1, type: [{ code: "xhtml" }] } } }, ParameterDefinition: { elements: { id: { type: [{ code: "string" }] }, extension: { max: 9007199254740991, type: [{ code: "Extension" }] }, name: { type: [{ code: "code" }] }, use: { min: 1, type: [{ code: "code" }] }, min: { type: [{ code: "integer" }] }, max: { type: [{ code: "string" }] }, documentation: { type: [{ code: "string" }] }, type: { min: 1, type: [{ code: "code" }] }, profile: { type: [{ code: "canonical", targetProfile: ["http://hl7.org/fhir/StructureDefinition/StructureDefinition"] }] } } }, Period: { elements: { id: { type: [{ code: "string" }] }, extension: { max: 9007199254740991, type: [{ code: "Extension" }] }, start: { type: [{ code: "dateTime" }] }, end: { type: [{ code: "dateTime" }] } } }, Population: { elements: { id: { type: [{ code: "string" }] }, extension: { max: 9007199254740991, type: [{ code: "Extension" }] }, modifierExtension: { max: 9007199254740991, type: [{ code: "Extension" }] }, "age[x]": { type: [{ code: "Range" }, { code: "CodeableConcept" }] }, gender: { type: [{ code: "CodeableConcept" }] }, race: { type: [{ code: "CodeableConcept" }] }, physiologicalCondition: { type: [{ code: "CodeableConcept" }] } } }, ProdCharacteristic: { elements: { id: { type: [{ code: "string" }] }, extension: { max: 9007199254740991, type: [{ code: "Extension" }] }, modifierExtension: { max: 9007199254740991, type: [{ code: "Extension" }] }, height: { type: [{ code: "Quantity" }] }, width: { type: [{ code: "Quantity" }] }, depth: { type: [{ code: "Quantity" }] }, weight: { type: [{ code: "Quantity" }] }, nominalVolume: { type: [{ code: "Quantity" }] }, externalDiameter: { type: [{ code: "Quantity" }] }, shape: { type: [{ code: "string" }] }, color: { max: 9007199254740991, type: [{ code: "string" }] }, imprint: { max: 9007199254740991, type: [{ code: "string" }] }, image: { max: 9007199254740991, type: [{ code: "Attachment" }] }, scoring: { type: [{ code: "CodeableConcept" }] } } }, ProductShelfLife: { elements: { id: { type: [{ code: "string" }] }, extension: { max: 9007199254740991, type: [{ code: "Extension" }] }, modifierExtension: { max: 9007199254740991, type: [{ code: "Extension" }] }, identifier: { type: [{ code: "Identifier" }] }, type: { min: 1, type: [{ code: "CodeableConcept" }] }, period: { min: 1, type: [{ code: "Quantity" }] }, specialPrecautionsForStorage: { max: 9007199254740991, type: [{ code: "CodeableConcept" }] } } }, Quantity: { elements: { id: { type: [{ code: "string" }] }, extension: { max: 9007199254740991, type: [{ code: "Extension" }] }, value: { type: [{ code: "decimal" }] }, comparator: { type: [{ code: "code" }] }, unit: { type: [{ code: "string" }] }, system: { type: [{ code: "uri" }] }, code: { type: [{ code: "code" }] } } }, Range: { elements: { id: { type: [{ code: "string" }] }, extension: { max: 9007199254740991, type: [{ code: "Extension" }] }, low: { type: [{ code: "Quantity", profile: ["http://hl7.org/fhir/StructureDefinition/SimpleQuantity"] }] }, high: { type: [{ code: "Quantity", profile: ["http://hl7.org/fhir/StructureDefinition/SimpleQuantity"] }] } } }, Ratio: { elements: { id: { type: [{ code: "string" }] }, extension: { max: 9007199254740991, type: [{ code: "Extension" }] }, numerator: { type: [{ code: "Quantity" }] }, denominator: { type: [{ code: "Quantity" }] } } }, Reference: { elements: { id: { type: [{ code: "string" }] }, extension: { max: 9007199254740991, type: [{ code: "Extension" }] }, reference: { type: [{ code: "string" }] }, type: { type: [{ code: "uri" }] }, identifier: { type: [{ code: "Identifier" }] }, display: { type: [{ code: "string" }] } } }, RelatedArtifact: { elements: { id: { type: [{ code: "string" }] }, extension: { max: 9007199254740991, type: [{ code: "Extension" }] }, type: { min: 1, type: [{ code: "code" }] }, label: { type: [{ code: "string" }] }, display: { type: [{ code: "string" }] }, citation: { type: [{ code: "markdown" }] }, url: { type: [{ code: "url" }] }, document: { type: [{ code: "Attachment" }] }, resource: { type: [{ code: "canonical", targetProfile: ["http://hl7.org/fhir/StructureDefinition/Resource"] }] } } }, SampledData: { elements: { id: { type: [{ code: "string" }] }, extension: { max: 9007199254740991, type: [{ code: "Extension" }] }, origin: { min: 1, type: [{ code: "Quantity", profile: ["http://hl7.org/fhir/StructureDefinition/SimpleQuantity"] }] }, period: { min: 1, type: [{ code: "decimal" }] }, factor: { type: [{ code: "decimal" }] }, lowerLimit: { type: [{ code: "decimal" }] }, upperLimit: { type: [{ code: "decimal" }] }, dimensions: { min: 1, type: [{ code: "positiveInt" }] }, data: { type: [{ code: "string" }] } } }, Signature: { elements: { id: { type: [{ code: "string" }] }, extension: { max: 9007199254740991, type: [{ code: "Extension" }] }, type: { min: 1, max: 9007199254740991, type: [{ code: "Coding" }] }, when: { min: 1, type: [{ code: "instant" }] }, who: { min: 1, type: [{ code: "Reference", targetProfile: ["http://hl7.org/fhir/StructureDefinition/Practitioner", "http://hl7.org/fhir/StructureDefinition/PractitionerRole", "http://hl7.org/fhir/StructureDefinition/RelatedPerson", "http://hl7.org/fhir/StructureDefinition/Patient", "http://hl7.org/fhir/StructureDefinition/Device", "http://hl7.org/fhir/StructureDefinition/Organization"] }] }, onBehalfOf: { type: [{ code: "Reference", targetProfile: ["http://hl7.org/fhir/StructureDefinition/Practitioner", "http://hl7.org/fhir/StructureDefinition/PractitionerRole", "http://hl7.org/fhir/StructureDefinition/RelatedPerson", "http://hl7.org/fhir/StructureDefinition/Patient", "http://hl7.org/fhir/StructureDefinition/Device", "http://hl7.org/fhir/StructureDefinition/Organization"] }] }, targetFormat: { type: [{ code: "code" }] }, sigFormat: { type: [{ code: "code" }] }, data: { type: [{ code: "base64Binary" }] } } }, SubstanceAmount: { elements: { id: { type: [{ code: "string" }] }, extension: { max: 9007199254740991, type: [{ code: "Extension" }] }, modifierExtension: { max: 9007199254740991, type: [{ code: "Extension" }] }, "amount[x]": { type: [{ code: "Quantity" }, { code: "Range" }, { code: "string" }] }, amountType: { type: [{ code: "CodeableConcept" }] }, amountText: { type: [{ code: "string" }] }, referenceRange: { type: [{ code: "SubstanceAmountReferenceRange" }] } } }, SubstanceAmountReferenceRange: { elements: { id: { type: [{ code: "string" }] }, extension: { max: 9007199254740991, type: [{ code: "Extension" }] }, lowLimit: { type: [{ code: "Quantity" }] }, highLimit: { type: [{ code: "Quantity" }] } } }, Timing: { elements: { id: { type: [{ code: "string" }] }, extension: { max: 9007199254740991, type: [{ code: "Extension" }] }, modifierExtension: { max: 9007199254740991, type: [{ code: "Extension" }] }, event: { max: 9007199254740991, type: [{ code: "dateTime" }] }, repeat: { type: [{ code: "TimingRepeat" }] }, code: { type: [{ code: "CodeableConcept" }] } } }, TimingRepeat: { elements: { id: { type: [{ code: "string" }] }, extension: { max: 9007199254740991, type: [{ code: "Extension" }] }, "bounds[x]": { type: [{ code: "Duration" }, { code: "Range" }, { code: "Period" }] }, count: { type: [{ code: "positiveInt" }] }, countMax: { type: [{ code: "positiveInt" }] }, duration: { type: [{ code: "decimal" }] }, durationMax: { type: [{ code: "decimal" }] }, durationUnit: { type: [{ code: "code" }] }, frequency: { type: [{ code: "positiveInt" }] }, frequencyMax: { type: [{ code: "positiveInt" }] }, period: { type: [{ code: "decimal" }] }, periodMax: { type: [{ code: "decimal" }] }, periodUnit: { type: [{ code: "code" }] }, dayOfWeek: { max: 9007199254740991, type: [{ code: "code" }] }, timeOfDay: { max: 9007199254740991, type: [{ code: "time" }] }, when: { max: 9007199254740991, type: [{ code: "code" }] }, offset: { type: [{ code: "unsignedInt" }] } } }, TriggerDefinition: { elements: { id: { type: [{ code: "string" }] }, extension: { max: 9007199254740991, type: [{ code: "Extension" }] }, type: { min: 1, type: [{ code: "code" }] }, name: { type: [{ code: "string" }] }, "timing[x]": { type: [{ code: "Timing" }, { code: "Reference", targetProfile: ["http://hl7.org/fhir/StructureDefinition/Schedule"] }, { code: "date" }, { code: "dateTime" }] }, data: { max: 9007199254740991, type: [{ code: "DataRequirement" }] }, condition: { type: [{ code: "Expression" }] } } }, UsageContext: { elements: { id: { type: [{ code: "string" }] }, extension: { max: 9007199254740991, type: [{ code: "Extension" }] }, code: { min: 1, type: [{ code: "Coding" }] }, "value[x]": { min: 1, type: [{ code: "CodeableConcept" }, { code: "Quantity" }, { code: "Range" }, { code: "Reference", targetProfile: ["http://hl7.org/fhir/StructureDefinition/PlanDefinition", "http://hl7.org/fhir/StructureDefinition/ResearchStudy", "http://hl7.org/fhir/StructureDefinition/InsurancePlan", "http://hl7.org/fhir/StructureDefinition/HealthcareService", "http://hl7.org/fhir/StructureDefinition/Group", "http://hl7.org/fhir/StructureDefinition/Location", "http://hl7.org/fhir/StructureDefinition/Organization"] }] } } }, MoneyQuantity: { elements: { id: { type: [{ code: "string" }] }, extension: { max: 9007199254740991, type: [{ code: "Extension" }] }, value: { type: [{ code: "decimal" }] }, comparator: { type: [{ code: "code" }] }, unit: { type: [{ code: "string" }] }, system: { type: [{ code: "uri" }] }, code: { type: [{ code: "code" }] } } }, SimpleQuantity: { elements: { id: { type: [{ code: "string" }] }, extension: { max: 9007199254740991, type: [{ code: "Extension" }] }, value: { type: [{ code: "decimal" }] }, comparator: { max: 0, type: [{ code: "code" }] }, unit: { type: [{ code: "string" }] }, system: { type: [{ code: "uri" }] }, code: { type: [{ code: "code" }] } } }, IdentityProvider: { elements: { authorizeUrl: { min: 1, type: [{ code: "string" }] }, tokenUrl: { min: 1, type: [{ code: "string" }] }, tokenAuthMethod: { type: [{ code: "code" }] }, userInfoUrl: { min: 1, type: [{ code: "string" }] }, clientId: { min: 1, type: [{ code: "string" }] }, clientSecret: { min: 1, type: [{ code: "string" }] }, usePkce: { type: [{ code: "boolean" }] }, useSubject: { type: [{ code: "boolean" }] } } } };
67747
67747
  function Sr(r6) {
67748
67748
  return new vr(r6).parse();
67749
67749
  }
67750
- var ge = Vn(Dn);
67750
+ var ge = Dn(Mn);
67751
67751
  var br = /* @__PURE__ */ Object.create(null);
67752
- var Mn = /* @__PURE__ */ Object.create(null);
67753
- var Eo = { "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" };
67754
- function Nn(r6) {
67752
+ var _n = /* @__PURE__ */ Object.create(null);
67753
+ var Ro = { "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" };
67754
+ function Un(r6) {
67755
67755
  let e;
67756
- return e = Mn[r6], e || (e = Mn[r6] = /* @__PURE__ */ Object.create(null)), e;
67756
+ return e = _n[r6], e || (e = _n[r6] = /* @__PURE__ */ Object.create(null)), e;
67757
67757
  }
67758
67758
  function Er(r6) {
67759
67759
  let t = (Array.isArray(r6) ? r6 : r6.entry?.map((n) => n.resource) ?? []).filter((n) => n?.resourceType === "StructureDefinition");
67760
- jn(t);
67760
+ $n(t);
67761
67761
  for (let n of t) Rr(n);
67762
67762
  }
67763
67763
  function Rr(r6) {
67764
67764
  if (!r6?.name) throw new Error("Failed loading StructureDefinition from bundle");
67765
67765
  if (r6.resourceType !== "StructureDefinition") return;
67766
- let e = Sr(r6), t = Eo[r6.url], n, i;
67767
- t ? (n = ge, 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 = ge, i = r6.type) : (n = Nn(r6.url), i = r6.type), n[i] = e;
67766
+ let e = Sr(r6), t = Ro[r6.url], n, i;
67767
+ t ? (n = ge, 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 = ge, i = r6.type) : (n = Un(r6.url), i = r6.type), n[i] = e;
67768
67768
  for (let o2 of e.innerTypes) o2.parentType = e, n[o2.name] = o2;
67769
67769
  br[r6.url] = e;
67770
67770
  }
67771
- function Bn(r6) {
67771
+ function Wn(r6) {
67772
67772
  return !!ge[r6];
67773
67773
  }
67774
67774
  function $e(r6, e) {
67775
67775
  if (e) {
67776
- let t = Nn(e)[r6];
67776
+ let t = Un(e)[r6];
67777
67777
  if (t) return t;
67778
67778
  }
67779
67779
  return ge[r6];
67780
67780
  }
67781
- function Wn(r6) {
67781
+ function qn(r6) {
67782
67782
  return !!br[r6];
67783
67783
  }
67784
67784
  var vr = class {
@@ -67792,7 +67792,7 @@ var vr = class {
67792
67792
  c(this, "innerTypes");
67793
67793
  c(this, "backboneContext");
67794
67794
  if (!e.snapshot?.element || e.snapshot.element.length === 0) throw new Error(`No snapshot defined for StructureDefinition '${e.name}'`);
67795
- 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: wo(e), elements: {}, constraints: this.parseElementDefinition(this.root).constraints, innerTypes: [], summaryProperties: /* @__PURE__ */ new Set(), mandatoryProperties: /* @__PURE__ */ new Set() }, this.innerTypes = [];
67795
+ 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: Ao(e), elements: {}, constraints: this.parseElementDefinition(this.root).constraints, innerTypes: [], summaryProperties: /* @__PURE__ */ new Set(), mandatoryProperties: /* @__PURE__ */ new Set() }, this.innerTypes = [];
67796
67796
  }
67797
67797
  parse() {
67798
67798
  let e = this.next();
@@ -67833,7 +67833,7 @@ var vr = class {
67833
67833
  this.backboneContext = { type: { name: t, type: t, path: e.path, title: e.label, description: e.definition, elements: {}, constraints: this.parseElementDefinition(e).constraints, innerTypes: [] }, path: e.path, parent: Me(this.backboneContext?.path, e.path) ? this.backboneContext : this.backboneContext?.parent };
67834
67834
  }
67835
67835
  enterSlice(e, t) {
67836
- Po(e) && !this.peek()?.sliceName || (t.slicing = { discriminator: (e.slicing?.discriminator ?? []).map((n) => {
67836
+ wo(e) && !this.peek()?.sliceName || (t.slicing = { discriminator: (e.slicing?.discriminator ?? []).map((n) => {
67837
67837
  if (n.type !== "value" && n.type !== "pattern" && n.type !== "type") throw new Error(`Unsupported slicing discriminator type: ${n.type}`);
67838
67838
  return { path: n.path, type: n.type };
67839
67839
  }), slices: [], ordered: e.slicing?.ordered ?? false, rule: e.slicing?.rules }, this.slicingContext = { field: t.slicing, path: e.path ?? "" });
@@ -67873,40 +67873,48 @@ var vr = class {
67873
67873
  });
67874
67874
  }
67875
67875
  parseElementDefinition(e) {
67876
- let t = Ln(e.max), n = e.base?.max ? Ln(e.base.max) : t, i = { type: "ElementDefinition", value: e };
67877
- return { description: e.definition || "", path: e.path || e.base?.path || "", min: e.min ?? 0, max: t, 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: Fn(w(i, "fixed[x]")), pattern: Fn(w(i, "pattern[x]")), binding: e.binding };
67876
+ let t = Fn(e.max), n = e.base?.max ? Fn(e.base.max) : t, i = { type: "ElementDefinition", value: e };
67877
+ return { description: e.definition || "", path: e.path || e.base?.path || "", min: e.min ?? 0, max: t, 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: Nn(k(i, "fixed[x]")), pattern: Nn(k(i, "pattern[x]")), binding: e.binding };
67878
67878
  }
67879
67879
  };
67880
- function Ln(r6) {
67880
+ function Fn(r6) {
67881
67881
  return r6 === "*" ? Number.POSITIVE_INFINITY : Number.parseInt(r6, 10);
67882
67882
  }
67883
67883
  function xr(r6, e = "") {
67884
- return Co(r6.path, e);
67884
+ return Po(r6.path, e);
67885
67885
  }
67886
- function Co(r6, e) {
67886
+ function Po(r6, e) {
67887
67887
  return r6 ? e && r6.startsWith(e) ? r6.substring(e.length + 1) : r6 : "";
67888
67888
  }
67889
67889
  function Me(r6, e) {
67890
67890
  return !r6 || !e ? false : e.startsWith(r6 + ".") || e === r6;
67891
67891
  }
67892
- function Fn(r6) {
67892
+ function Nn(r6) {
67893
67893
  return Array.isArray(r6) && r6.length > 0 ? r6[0] : E(r6) ? void 0 : r6;
67894
67894
  }
67895
- function Po(r6) {
67895
+ function wo(r6) {
67896
67896
  let e = r6.slicing?.discriminator;
67897
67897
  return !!(r6.type?.some((t) => t.code === "Extension") && e?.length === 1 && e[0].type === "value" && e[0].path === "url");
67898
67898
  }
67899
- function wo(r6) {
67899
+ function Ao(r6) {
67900
67900
  let e = r6.description;
67901
67901
  return e?.startsWith(`Base StructureDefinition for ${r6.name} Type: `) && (e = e.substring(`Base StructureDefinition for ${r6.name} Type: `.length)), e;
67902
67902
  }
67903
+ function Or(r6, e, t) {
67904
+ let n = r6.path;
67905
+ return Oo(k(r6, e, t), n, e);
67906
+ }
67907
+ function Oo(r6, e, t) {
67908
+ let n = e ? e + "." : "";
67909
+ return r6 === void 0 ? { type: "undefined", value: void 0, path: `${n}${t}` } : Array.isArray(r6) ? r6.map((i, o2) => ({ ...i, path: `${n}${t}[${o2}]` })) : { ...r6, path: `${n}${t}` };
67910
+ }
67903
67911
  var Io = new ke(1e3);
67904
67912
  var ht = { 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: /.*/ };
67905
67913
  function m(r6) {
67906
67914
  return [{ type: p.boolean, value: r6 }];
67907
67915
  }
67908
67916
  function T(r6) {
67909
- return r6 == null ? { type: "undefined", value: void 0 } : Number.isSafeInteger(r6) ? { type: p.integer, value: r6 } : typeof r6 == "number" ? { type: p.decimal, value: r6 } : typeof r6 == "boolean" ? { type: p.boolean, value: r6 } : typeof r6 == "string" ? { type: p.string, value: r6 } : A(r6) ? { type: p.Quantity, value: r6 } : I(r6) ? { type: r6.resourceType, value: r6 } : Fr(r6) ? { type: p.CodeableConcept, value: r6 } : Lr(r6) ? { type: p.Coding, value: r6 } : { type: p.BackboneElement, value: r6 };
67917
+ return r6 == null ? { type: "undefined", value: void 0 } : Number.isSafeInteger(r6) ? { type: p.integer, value: r6 } : typeof r6 == "number" ? { type: p.decimal, value: r6 } : typeof r6 == "boolean" ? { type: p.boolean, value: r6 } : typeof r6 == "string" ? { type: p.string, value: r6 } : w(r6) ? { type: p.Quantity, value: r6 } : O(r6) ? { type: r6.resourceType, value: r6 } : Nr(r6) ? { type: p.CodeableConcept, value: r6 } : Fr(r6) ? { type: p.Coding, value: r6 } : { type: p.BackboneElement, value: r6 };
67910
67918
  }
67911
67919
  function F(r6) {
67912
67920
  return r6.length === 0 ? false : !!r6[0].value;
@@ -67917,7 +67925,7 @@ function z(r6, e) {
67917
67925
  throw new Error(`Expected singleton of type ${e}, but found ${JSON.stringify(r6)}`);
67918
67926
  }
67919
67927
  }
67920
- function w(r6, e, t) {
67928
+ function k(r6, e, t) {
67921
67929
  if (!r6.value) return;
67922
67930
  let n = vt(r6.type, e, t?.profileUrl);
67923
67931
  return n ? Uo(r6, e, n) : Bo(r6, e);
@@ -67935,15 +67943,15 @@ function Uo(r6, e, t) {
67935
67943
  }
67936
67944
  if (a) if (Array.isArray(o2)) {
67937
67945
  o2 = o2.slice();
67938
- for (let d = 0; d < Math.max(o2.length, a.length); d++) o2[d] = Dr(o2[d], a[d]);
67946
+ for (let d = 0; d < Math.max(o2.length, a.length); d++) o2[d] = Mr(o2[d], a[d]);
67939
67947
  } else if (!o2 && Array.isArray(a)) {
67940
67948
  o2 = a.slice();
67941
- for (let d = 0; d < a.length; d++) o2[d] = Dr(void 0, a[d]);
67942
- } else o2 = Dr(o2, a);
67943
- if (!E(o2)) return (s === "Element" || s === "BackboneElement") && (s = t.type[0].code), Array.isArray(o2) ? o2.map((d) => $n(d, s)) : $n(o2, s);
67949
+ for (let d = 0; d < a.length; d++) o2[d] = Mr(void 0, a[d]);
67950
+ } else o2 = Mr(o2, a);
67951
+ if (!E(o2)) return (s === "Element" || s === "BackboneElement") && (s = t.type[0].code), Array.isArray(o2) ? o2.map((d) => Gn(d, s)) : Gn(o2, s);
67944
67952
  }
67945
- function $n(r6, e) {
67946
- return e === "Resource" && I(r6) && (e = r6.resourceType), { type: e, value: r6 };
67953
+ function Gn(r6, e) {
67954
+ return e === "Resource" && O(r6) && (e = r6.resourceType), { type: e, value: r6 };
67947
67955
  }
67948
67956
  function Bo(r6, e) {
67949
67957
  let t = r6.value;
@@ -67980,27 +67988,27 @@ function yt(r6) {
67980
67988
  }
67981
67989
  return e;
67982
67990
  }
67983
- function Qn(r6) {
67991
+ function zn(r6) {
67984
67992
  return m(!F(r6));
67985
67993
  }
67986
- function zn(r6, e) {
67994
+ function Kn(r6, e) {
67987
67995
  return r6.length === 0 || e.length === 0 ? [] : r6.length !== e.length ? m(false) : m(r6.every((t, n) => F(He(t, e[n]))));
67988
67996
  }
67989
- function Kn(r6, e) {
67997
+ function Jn(r6, e) {
67990
67998
  return r6.length === 0 || e.length === 0 ? [] : r6.length !== e.length ? m(true) : m(r6.some((t, n) => !F(He(t, e[n]))));
67991
67999
  }
67992
68000
  function He(r6, e) {
67993
68001
  let t = r6.value?.valueOf(), n = e.value?.valueOf();
67994
- return typeof t == "number" && typeof n == "number" ? m(Math.abs(t - n) < 1e-8) : A(t) && A(n) ? m(Yn(t, n)) : m(typeof t == "object" && typeof n == "object" ? _r(r6, e) : t === n);
68002
+ return typeof t == "number" && typeof n == "number" ? m(Math.abs(t - n) < 1e-8) : w(t) && w(n) ? m(Zn(t, n)) : m(typeof t == "object" && typeof n == "object" ? Lr(r6, e) : t === n);
67995
68003
  }
67996
- function Mr(r6, e) {
67997
- return r6.length === 0 && e.length === 0 ? m(true) : r6.length !== e.length ? m(false) : (r6.sort(Gn), e.sort(Gn), m(r6.every((t, n) => F(Wo(t, e[n])))));
68004
+ function _r(r6, e) {
68005
+ return r6.length === 0 && e.length === 0 ? m(true) : r6.length !== e.length ? m(false) : (r6.sort(Hn), e.sort(Hn), m(r6.every((t, n) => F(Wo(t, e[n])))));
67998
68006
  }
67999
68007
  function Wo(r6, e) {
68000
68008
  let { type: t, value: n } = r6, { type: i, value: o2 } = e, s = n?.valueOf(), a = o2?.valueOf();
68001
- return typeof s == "number" && typeof a == "number" ? m(Math.abs(s - a) < 0.01) : A(s) && A(a) ? m(Yn(s, a)) : m(t === "Coding" && i === "Coding" ? typeof s != "object" || typeof a != "object" ? false : s.code === a.code && s.system === a.system : typeof s == "object" && typeof a == "object" ? _r({ ...s, id: void 0 }, { ...a, id: void 0 }) : typeof s == "string" && typeof a == "string" ? s.toLowerCase() === a.toLowerCase() : s === a);
68009
+ return typeof s == "number" && typeof a == "number" ? m(Math.abs(s - a) < 0.01) : w(s) && w(a) ? m(Zn(s, a)) : m(t === "Coding" && i === "Coding" ? typeof s != "object" || typeof a != "object" ? false : s.code === a.code && s.system === a.system : typeof s == "object" && typeof a == "object" ? Lr({ ...s, id: void 0 }, { ...a, id: void 0 }) : typeof s == "string" && typeof a == "string" ? s.toLowerCase() === a.toLowerCase() : s === a);
68002
68010
  }
68003
- function Gn(r6, e) {
68011
+ function Hn(r6, e) {
68004
68012
  let t = r6.value?.valueOf(), n = e.value?.valueOf();
68005
68013
  return typeof t == "number" && typeof n == "number" ? t - n : typeof t == "string" && typeof n == "string" ? t.localeCompare(n) : 0;
68006
68014
  }
@@ -68015,49 +68023,49 @@ function gt(r6, e) {
68015
68023
  case "Integer":
68016
68024
  return typeof t == "number";
68017
68025
  case "Date":
68018
- return Jn(t);
68026
+ return Xn(t);
68019
68027
  case "DateTime":
68020
68028
  return Fe(t);
68021
68029
  case "Time":
68022
68030
  return typeof t == "string" && !!/^T\d/.exec(t);
68023
68031
  case "Period":
68024
- return Xn(t);
68032
+ return Yn(t);
68025
68033
  case "Quantity":
68026
- return A(t);
68034
+ return w(t);
68027
68035
  default:
68028
68036
  return r6.type === n || typeof t == "object" && t?.resourceType === n;
68029
68037
  }
68030
68038
  }
68031
- function Jn(r6) {
68039
+ function Xn(r6) {
68032
68040
  return typeof r6 == "string" && !!ht.date.exec(r6);
68033
68041
  }
68034
68042
  function Fe(r6) {
68035
68043
  return typeof r6 == "string" && !!ht.dateTime.exec(r6);
68036
68044
  }
68037
- function Xn(r6) {
68045
+ function Yn(r6) {
68038
68046
  return !!(r6 && typeof r6 == "object" && ("start" in r6 && Fe(r6.start) || "end" in r6 && Fe(r6.end)));
68039
68047
  }
68040
- function A(r6) {
68048
+ function w(r6) {
68041
68049
  return !!(r6 && typeof r6 == "object" && "value" in r6 && typeof r6.value == "number");
68042
68050
  }
68043
- function Yn(r6, e) {
68051
+ function Zn(r6, e) {
68044
68052
  return Math.abs(r6.value - e.value) < 0.01 && (r6.unit === e.unit || r6.code === e.code || r6.unit === e.code || r6.code === e.unit);
68045
68053
  }
68046
- function _r(r6, e) {
68054
+ function Lr(r6, e) {
68047
68055
  let t = Object.keys(r6), n = Object.keys(e);
68048
68056
  if (t.length !== n.length) return false;
68049
68057
  for (let i of t) {
68050
68058
  let o2 = r6[i], s = e[i];
68051
- if (Hn(o2) && Hn(s)) {
68052
- if (!_r(o2, s)) return false;
68059
+ if (Qn(o2) && Qn(s)) {
68060
+ if (!Lr(o2, s)) return false;
68053
68061
  } else if (o2 !== s) return false;
68054
68062
  }
68055
68063
  return true;
68056
68064
  }
68057
- function Hn(r6) {
68065
+ function Qn(r6) {
68058
68066
  return r6 !== null && typeof r6 == "object";
68059
68067
  }
68060
- function Dr(r6, e) {
68068
+ function Mr(r6, e) {
68061
68069
  if (e) {
68062
68070
  if (typeof e != "object") throw new Error("Primitive extension must be an object");
68063
68071
  return qo(r6 ?? {}, e);
@@ -68068,7 +68076,7 @@ function qo(r6, e) {
68068
68076
  return delete e.__proto__, delete e.constructor, Object.assign(r6, e);
68069
68077
  }
68070
68078
  function ze(r6, e) {
68071
- return I(r6, e) && "id" in r6 && typeof r6.id == "string";
68079
+ return O(r6, e) && "id" in r6 && typeof r6.id == "string";
68072
68080
  }
68073
68081
  function xe(r6) {
68074
68082
  let e = D(r6) ?? "undefined/undefined", t = $o(r6);
@@ -68099,7 +68107,7 @@ function $o(r6) {
68099
68107
  if ("name" in r6 && r6.name && typeof r6.name == "string") return r6.name;
68100
68108
  if ("code" in r6 && r6.code) {
68101
68109
  let e = r6.code;
68102
- if (Array.isArray(e) && (e = e[0]), Fr(e)) return Qe(e);
68110
+ if (Array.isArray(e) && (e = e[0]), Nr(e)) return Qe(e);
68103
68111
  if (es(e)) return e.text;
68104
68112
  }
68105
68113
  return D(r6) ?? "";
@@ -68130,10 +68138,10 @@ function ae(r6, ...e) {
68130
68138
  return t;
68131
68139
  }
68132
68140
  function St(r6, e) {
68133
- let t = Br(r6);
68141
+ let t = Wr(r6);
68134
68142
  return JSON.stringify(t, null, e ? 2 : void 0) ?? "";
68135
68143
  }
68136
- function Br(r6) {
68144
+ function Wr(r6) {
68137
68145
  if (!(r6 == null || r6 === "")) return typeof r6 == "object" ? Array.isArray(r6) ? zo(r6) : Ko(r6) : r6;
68138
68146
  }
68139
68147
  function zo(r6) {
@@ -68141,7 +68149,7 @@ function zo(r6) {
68141
68149
  if (e === 0) return;
68142
68150
  let t, n = 0;
68143
68151
  for (let i = 0; i < e; i++) {
68144
- let o2 = r6[i], s = Br(o2);
68152
+ let o2 = r6[i], s = Wr(o2);
68145
68153
  s !== o2 && !t && (t = Array.from(r6)), s === void 0 ? t && (t[i] = null) : (t && (t[i] = s), n++);
68146
68154
  }
68147
68155
  if (n !== 0) return t ?? r6;
@@ -68149,7 +68157,7 @@ function zo(r6) {
68149
68157
  function Ko(r6) {
68150
68158
  let e, t = 0;
68151
68159
  for (let n in r6) {
68152
- let i = r6[n], o2 = Br(i);
68160
+ let i = r6[n], o2 = Wr(i);
68153
68161
  o2 !== i && !e && (e = { ...r6 }), o2 === void 0 ? e && delete e[n] : (e && (e[n] = o2), t++);
68154
68162
  }
68155
68163
  if (t !== 0) return e ?? r6;
@@ -68184,43 +68192,43 @@ function Xo(r6, e, t) {
68184
68192
  function R(r6) {
68185
68193
  return r6 !== null && typeof r6 == "object";
68186
68194
  }
68187
- function ri(r6) {
68195
+ function ni(r6) {
68188
68196
  return r6.every(bt);
68189
68197
  }
68190
68198
  function bt(r6) {
68191
68199
  return typeof r6 == "string";
68192
68200
  }
68193
- function Lr(r6) {
68201
+ function Fr(r6) {
68194
68202
  return R(r6) && "code" in r6 && typeof r6.code == "string";
68195
68203
  }
68196
- function Fr(r6) {
68197
- return R(r6) && "coding" in r6 && Array.isArray(r6.coding) && r6.coding.every(Lr);
68204
+ function Nr(r6) {
68205
+ return R(r6) && "coding" in r6 && Array.isArray(r6.coding) && r6.coding.every(Fr);
68198
68206
  }
68199
68207
  function es(r6) {
68200
68208
  return R(r6) && "text" in r6 && typeof r6.text == "string";
68201
68209
  }
68202
- var ni = [];
68203
- for (let r6 = 0; r6 < 256; r6++) ni.push(r6.toString(16).padStart(2, "0"));
68204
- function ii(r6) {
68205
- let e = si(r6), t = new Uint8Array(e), n = new Array(t.length);
68206
- for (let i = 0; i < t.length; i++) n[i] = ni[t[i]];
68210
+ var ii = [];
68211
+ for (let r6 = 0; r6 < 256; r6++) ii.push(r6.toString(16).padStart(2, "0"));
68212
+ function oi(r6) {
68213
+ let e = ai(r6), t = new Uint8Array(e), n = new Array(t.length);
68214
+ for (let i = 0; i < t.length; i++) n[i] = ii[t[i]];
68207
68215
  return n.join("");
68208
68216
  }
68209
- function oi(r6) {
68210
- let e = si(r6), t = new Uint8Array(e), n = new Array(t.length);
68217
+ function si(r6) {
68218
+ let e = ai(r6), t = new Uint8Array(e), n = new Array(t.length);
68211
68219
  for (let i = 0; i < t.length; i++) n[i] = String.fromCharCode(t[i]);
68212
68220
  return window.btoa(n.join(""));
68213
68221
  }
68214
- function si(r6) {
68222
+ function ai(r6) {
68215
68223
  return ArrayBuffer.isView(r6) ? r6.buffer : r6;
68216
68224
  }
68217
68225
  function V(r6) {
68218
68226
  return r6 ? r6.charAt(0).toUpperCase() + r6.substring(1) : "";
68219
68227
  }
68220
- var qr = (r6) => new Promise((e) => {
68228
+ var jr = (r6) => new Promise((e) => {
68221
68229
  setTimeout(e, r6);
68222
68230
  });
68223
- function jr(r6, e, t) {
68231
+ function $r(r6, e, t) {
68224
68232
  let n = [];
68225
68233
  for (let i = 0; i < t - 1; i++) {
68226
68234
  let o2 = r6.indexOf(e);
@@ -68232,19 +68240,19 @@ function jr(r6, e, t) {
68232
68240
  function Et(r6) {
68233
68241
  return r6.sort((e, t) => e.localeCompare(t));
68234
68242
  }
68235
- function $r(r6) {
68243
+ function Gr(r6) {
68236
68244
  return r6.endsWith("/") ? r6 : r6 + "/";
68237
68245
  }
68238
68246
  function as(r6) {
68239
68247
  return r6.startsWith("/") ? r6.slice(1) : r6;
68240
68248
  }
68241
68249
  function $(r6, e) {
68242
- return new URL(as(e), $r(r6.toString())).toString();
68250
+ return new URL(as(e), Gr(r6.toString())).toString();
68243
68251
  }
68244
- function li(r6, e) {
68252
+ function pi(r6, e) {
68245
68253
  return $(r6, e).toString().replace("http://", "ws://").replace("https://", "wss://");
68246
68254
  }
68247
- function pi(r6) {
68255
+ function di(r6) {
68248
68256
  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();
68249
68257
  }
68250
68258
  var cs = /^(([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])$/;
@@ -68263,9 +68271,9 @@ function Ke(r6, e) {
68263
68271
  function Qe(r6) {
68264
68272
  if (!r6) return "";
68265
68273
  let e = Se(r6.text);
68266
- return e || (r6.coding ? r6.coding.map((t) => fi(t)).join(", ") : "");
68274
+ return e || (r6.coding ? r6.coding.map((t) => hi(t)).join(", ") : "");
68267
68275
  }
68268
- function fi(r6, e) {
68276
+ function hi(r6, e) {
68269
68277
  let t = Se(r6?.display);
68270
68278
  if (t) {
68271
68279
  let n = e ? Se(r6?.code) : void 0;
@@ -68277,17 +68285,17 @@ function Se(r6) {
68277
68285
  return typeof r6 == "string" ? r6 : void 0;
68278
68286
  }
68279
68287
  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", 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" };
68280
- function jn(r6) {
68288
+ function $n(r6) {
68281
68289
  let e = Array.isArray(r6) ? r6 : r6.entry?.map((t) => t.resource) ?? [];
68282
- for (let t of e) t?.resourceType === "StructureDefinition" && t.kind === "resource" && yi(t.type);
68290
+ for (let t of e) t?.resourceType === "StructureDefinition" && t.kind === "resource" && gi(t.type);
68283
68291
  }
68284
- function yi(r6) {
68292
+ function gi(r6) {
68285
68293
  let e = N.types[r6];
68286
68294
  return e || (e = { searchParamsDetails: {} }, N.types[r6] = e), !e.searchParams && r6 !== "Binary" && (e.searchParams = { _id: { base: [r6], code: "_id", type: "token", expression: r6 + ".id" }, _lastUpdated: { base: [r6], code: "_lastUpdated", type: "date", expression: r6 + ".meta.lastUpdated" }, _compartment: { base: [r6], code: "_compartment", type: "reference", expression: r6 + ".meta.compartment" }, _profile: { base: [r6], code: "_profile", type: "uri", expression: r6 + ".meta.profile" }, _security: { base: [r6], code: "_security", type: "token", expression: r6 + ".meta.security" }, _source: { base: [r6], code: "_source", type: "uri", expression: r6 + ".meta.source" }, _tag: { base: [r6], code: "_tag", type: "token", expression: r6 + ".meta.tag" } }), e;
68287
68295
  }
68288
- function Qr(r6) {
68296
+ function zr(r6) {
68289
68297
  for (let e of r6.base ?? []) {
68290
- let t = yi(e);
68298
+ let t = gi(e);
68291
68299
  t.searchParams || (t.searchParams = {}), t.searchParams[r6.code] = r6;
68292
68300
  }
68293
68301
  }
@@ -68313,7 +68321,7 @@ function Es(r6, e) {
68313
68321
  }
68314
68322
  }
68315
68323
  }
68316
- function I(r6, e) {
68324
+ function O(r6, e) {
68317
68325
  return !(!r6 || typeof r6 != "object" || !("resourceType" in r6) || e && r6.resourceType !== e);
68318
68326
  }
68319
68327
  function j(r6, e) {
@@ -68330,7 +68338,7 @@ function Ne(r6) {
68330
68338
  }
68331
68339
  }
68332
68340
  var te = () => [];
68333
- var k = { empty: (r6, e) => m(e.length === 0 || e.every((t) => E(t.value))), hasValue: (r6, e) => m(e.length !== 0), exists: (r6, e, t) => t ? m(e.filter((n) => F(t.eval(r6, [n]))).length > 0) : m(e.length > 0 && e.every((n) => !E(n.value))), all: (r6, e, t) => m(e.every((n) => F(t.eval(r6, [n])))), allTrue: (r6, e) => {
68341
+ var I = { empty: (r6, e) => m(e.every((t) => E(t.value))), hasValue: (r6, e) => m(e.length !== 0), exists: (r6, e, t) => t ? m(e.some((n) => F(t.eval(r6, [n])))) : m(e.length > 0 && e.every((n) => !E(n.value))), all: (r6, e, t) => m(e.every((n) => F(t.eval(r6, [n])))), allTrue: (r6, e) => {
68334
68342
  for (let t of e) if (!t.value) return m(false);
68335
68343
  return m(true);
68336
68344
  }, anyTrue: (r6, e) => {
@@ -68353,16 +68361,16 @@ var k = { empty: (r6, e) => m(e.length === 0 || e.every((t) => E(t.value))), has
68353
68361
  let t = [];
68354
68362
  for (let n of e) t.some((i) => i.value === n.value) || t.push(n);
68355
68363
  return t;
68356
- }, isDistinct: (r6, e) => m(e.length === k.distinct(r6, e).length), where: (r6, e, t) => e.filter((n) => F(t.eval(r6, [n]))), select: (r6, e, t) => e.map((n) => t.eval({ parent: r6, variables: { $this: n } }, [n])).flat(), repeat: te, ofType: (r6, e, t) => e.filter((n) => n.type === t.name), single: (r6, e) => {
68364
+ }, isDistinct: (r6, e) => m(e.length === I.distinct(r6, e).length), where: (r6, e, t) => e.filter((n) => F(t.eval(r6, [n]))), select: (r6, e, t) => e.flatMap((n) => t.eval({ parent: r6, variables: { $this: n } }, [n])), repeat: te, ofType: (r6, e, t) => e.filter((n) => n.type === t.name), single: (r6, e) => {
68357
68365
  if (e.length > 1) throw new Error("Expected input length one for single()");
68358
68366
  return e.length === 0 ? [] : e.slice(0, 1);
68359
- }, first: (r6, e) => e.length === 0 ? [] : e.slice(0, 1), last: (r6, e) => e.length === 0 ? [] : e.slice(e.length - 1, e.length), tail: (r6, e) => e.length === 0 ? [] : e.slice(1, e.length), skip: (r6, e, t) => {
68367
+ }, first: (r6, e) => e.length === 0 ? [] : e.slice(0, 1), last: (r6, e) => e.length === 0 ? [] : e.slice(-1, e.length), tail: (r6, e) => e.length === 0 ? [] : e.slice(1, e.length), skip: (r6, e, t) => {
68360
68368
  let n = t.eval(r6, e)[0]?.value;
68361
- if (typeof n != "number") throw new Error("Expected a number for skip(num)");
68369
+ if (typeof n != "number") throw new TypeError("Expected a number for skip(num)");
68362
68370
  return n >= e.length ? [] : n <= 0 ? e : e.slice(n, e.length);
68363
68371
  }, take: (r6, e, t) => {
68364
68372
  let n = t.eval(r6, e)[0]?.value;
68365
- if (typeof n != "number") throw new Error("Expected a number for take(num)");
68373
+ if (typeof n != "number") throw new TypeError("Expected a number for take(num)");
68366
68374
  return n >= e.length ? e : n <= 0 ? [] : e.slice(0, n);
68367
68375
  }, intersect: (r6, e, t) => {
68368
68376
  if (!t) return e;
@@ -68397,31 +68405,31 @@ var k = { empty: (r6, e) => m(e.length === 0 || e.every((t) => E(t.value))), has
68397
68405
  if (["false", "f", "no", "n", "0", "0.0"].includes(n)) return m(false);
68398
68406
  }
68399
68407
  return [];
68400
- }, convertsToBoolean: (r6, e) => e.length === 0 ? [] : m(k.toBoolean(r6, e).length === 1), toInteger: (r6, e) => {
68408
+ }, convertsToBoolean: (r6, e) => e.length === 0 ? [] : m(I.toBoolean(r6, e).length === 1), toInteger: (r6, e) => {
68401
68409
  if (e.length === 0) return [];
68402
68410
  let [{ value: t }] = X(e, 1);
68403
- return typeof t == "number" ? [{ type: p.integer, value: t }] : typeof t == "string" && /^[+-]?\d+$/.exec(t) ? [{ type: p.integer, value: parseInt(t, 10) }] : typeof t == "boolean" ? [{ type: p.integer, value: t ? 1 : 0 }] : [];
68404
- }, convertsToInteger: (r6, e) => e.length === 0 ? [] : m(k.toInteger(r6, e).length === 1), toDate: (r6, e) => {
68411
+ return typeof t == "number" ? [{ type: p.integer, value: t }] : typeof t == "string" && /^[+-]?\d+$/.exec(t) ? [{ type: p.integer, value: Number.parseInt(t, 10) }] : typeof t == "boolean" ? [{ type: p.integer, value: t ? 1 : 0 }] : [];
68412
+ }, convertsToInteger: (r6, e) => e.length === 0 ? [] : m(I.toInteger(r6, e).length === 1), toDate: (r6, e) => {
68405
68413
  if (e.length === 0) return [];
68406
68414
  let [{ value: t }] = X(e, 1);
68407
68415
  return typeof t == "string" && /^\d{4}(-\d{2}(-\d{2})?)?/.exec(t) ? [{ type: p.date, value: Ne(t) }] : [];
68408
- }, convertsToDate: (r6, e) => e.length === 0 ? [] : m(k.toDate(r6, e).length === 1), toDateTime: (r6, e) => {
68416
+ }, convertsToDate: (r6, e) => e.length === 0 ? [] : m(I.toDate(r6, e).length === 1), toDateTime: (r6, e) => {
68409
68417
  if (e.length === 0) return [];
68410
68418
  let [{ value: t }] = X(e, 1);
68411
68419
  return typeof t == "string" && /^\d{4}(-\d{2}(-\d{2})?)?/.exec(t) ? [{ type: p.dateTime, value: Ne(t) }] : [];
68412
- }, convertsToDateTime: (r6, e) => e.length === 0 ? [] : m(k.toDateTime(r6, e).length === 1), toDecimal: (r6, e) => {
68420
+ }, convertsToDateTime: (r6, e) => e.length === 0 ? [] : m(I.toDateTime(r6, e).length === 1), toDecimal: (r6, e) => {
68413
68421
  if (e.length === 0) return [];
68414
68422
  let [{ value: t }] = X(e, 1);
68415
- return typeof t == "number" ? [{ type: p.decimal, value: t }] : typeof t == "string" && /^-?\d{1,9}(\.\d{1,9})?$/.exec(t) ? [{ type: p.decimal, value: parseFloat(t) }] : typeof t == "boolean" ? [{ type: p.decimal, value: t ? 1 : 0 }] : [];
68416
- }, convertsToDecimal: (r6, e) => e.length === 0 ? [] : m(k.toDecimal(r6, e).length === 1), toQuantity: (r6, e) => {
68423
+ return typeof t == "number" ? [{ type: p.decimal, value: t }] : typeof t == "string" && /^-?\d{1,9}(\.\d{1,9})?$/.exec(t) ? [{ type: p.decimal, value: Number.parseFloat(t) }] : typeof t == "boolean" ? [{ type: p.decimal, value: t ? 1 : 0 }] : [];
68424
+ }, convertsToDecimal: (r6, e) => e.length === 0 ? [] : m(I.toDecimal(r6, e).length === 1), toQuantity: (r6, e) => {
68417
68425
  if (e.length === 0) return [];
68418
68426
  let [{ value: t }] = X(e, 1);
68419
- return A(t) ? [{ type: p.Quantity, value: t }] : typeof t == "number" ? [{ type: p.Quantity, value: { value: t, unit: "1" } }] : typeof t == "string" && /^-?\d{1,9}(\.\d{1,9})?/.exec(t) ? [{ type: p.Quantity, value: { value: parseFloat(t), unit: "1" } }] : typeof t == "boolean" ? [{ type: p.Quantity, value: { value: t ? 1 : 0, unit: "1" } }] : [];
68420
- }, convertsToQuantity: (r6, e) => e.length === 0 ? [] : m(k.toQuantity(r6, e).length === 1), toString: (r6, e) => {
68427
+ return w(t) ? [{ type: p.Quantity, value: t }] : typeof t == "number" ? [{ type: p.Quantity, value: { value: t, unit: "1" } }] : typeof t == "string" && /^-?\d{1,9}(\.\d{1,9})?/.exec(t) ? [{ type: p.Quantity, value: { value: Number.parseFloat(t), unit: "1" } }] : typeof t == "boolean" ? [{ type: p.Quantity, value: { value: t ? 1 : 0, unit: "1" } }] : [];
68428
+ }, convertsToQuantity: (r6, e) => e.length === 0 ? [] : m(I.toQuantity(r6, e).length === 1), toString: (r6, e) => {
68421
68429
  if (e.length === 0) return [];
68422
68430
  let [{ value: t }] = X(e, 1);
68423
- return t == null ? [] : A(t) ? [{ type: p.string, value: `${t.value} '${t.unit}'` }] : [{ type: p.string, value: t.toString() }];
68424
- }, convertsToString: (r6, e) => e.length === 0 ? [] : m(k.toString(r6, e).length === 1), toTime: (r6, e) => {
68431
+ return t == null ? [] : w(t) ? [{ type: p.string, value: `${t.value} '${t.unit}'` }] : [{ type: p.string, value: t.toString() }];
68432
+ }, convertsToString: (r6, e) => e.length === 0 ? [] : m(I.toString(r6, e).length === 1), toTime: (r6, e) => {
68425
68433
  if (e.length === 0) return [];
68426
68434
  let [{ value: t }] = X(e, 1);
68427
68435
  if (typeof t == "string") {
@@ -68429,21 +68437,21 @@ var k = { empty: (r6, e) => m(e.length === 0 || e.every((t) => E(t.value))), has
68429
68437
  if (n) return [{ type: p.time, value: Ne("T" + n[1]) }];
68430
68438
  }
68431
68439
  return [];
68432
- }, convertsToTime: (r6, e) => e.length === 0 ? [] : m(k.toTime(r6, e).length === 1), indexOf: (r6, e, t) => U((n, i) => n.indexOf(i), r6, e, t), substring: (r6, e, t, n) => U((i, o2, s) => {
68440
+ }, convertsToTime: (r6, e) => e.length === 0 ? [] : m(I.toTime(r6, e).length === 1), indexOf: (r6, e, t) => U((n, i) => n.indexOf(i), r6, e, t), substring: (r6, e, t, n) => U((i, o2, s) => {
68433
68441
  let a = o2, u2 = s ? a + s : i.length;
68434
68442
  return a < 0 || a >= i.length ? void 0 : i.substring(a, u2);
68435
68443
  }, r6, e, t, n), startsWith: (r6, e, t) => U((n, i) => n.startsWith(i), r6, e, t), endsWith: (r6, e, t) => U((n, i) => n.endsWith(i), r6, e, t), contains: (r6, e, t) => U((n, i) => n.includes(i), r6, e, t), upper: (r6, e) => U((t) => t.toUpperCase(), r6, e), lower: (r6, e) => U((t) => t.toLowerCase(), r6, e), replace: (r6, e, t, n) => U((i, o2, s) => i.replaceAll(o2, s), r6, e, t, n), matches: (r6, e, t) => U((n, i) => !!new RegExp(i).exec(n), r6, e, t), replaceMatches: (r6, e, t, n) => U((i, o2, s) => i.replaceAll(new RegExp(o2, "g"), s.replaceAll(/\$\{(\w+)\}/g, "$<$1>")), r6, e, t, n), length: (r6, e) => U((t) => t.length, r6, e), toChars: (r6, e) => U((t) => t ? t.split("") : void 0, r6, e), encode: te, decode: te, escape: te, unescape: te, trim: te, split: te, join: (r6, e, t) => {
68436
68444
  let n = t?.eval(r6, be(r6))[0]?.value ?? "";
68437
- if (typeof n != "string") throw new Error("Separator must be a string.");
68445
+ if (typeof n != "string") throw new TypeError("Separator must be a string.");
68438
68446
  return [{ type: p.string, value: e.map((i) => i.value?.toString() ?? "").join(n) }];
68439
68447
  }, abs: (r6, e) => J(Math.abs, r6, e), ceiling: (r6, e) => J(Math.ceil, r6, e), exp: (r6, e) => J(Math.exp, r6, e), floor: (r6, e) => J(Math.floor, r6, e), ln: (r6, e) => J(Math.log, r6, e), log: (r6, e, t) => J((n, i) => Math.log(n) / Math.log(i), r6, e, t), power: (r6, e, t) => J(Math.pow, r6, e, t), round: (r6, e, ...t) => J((n, i = 0) => {
68440
68448
  if (typeof i != "number" || i < 0) throw new Error("Invalid precision provided to round()");
68441
68449
  let o2 = Math.pow(10, i);
68442
68450
  return Math.round(n * o2) / o2;
68443
- }, r6, e, ...t), sqrt: (r6, e) => J(Math.sqrt, r6, e), truncate: (r6, e) => J((t) => t | 0, r6, e), children: te, descendants: te, trace: (r6, e, t) => e, now: () => [{ type: p.dateTime, value: (/* @__PURE__ */ new Date()).toISOString() }], timeOfDay: () => [{ type: p.time, value: (/* @__PURE__ */ new Date()).toISOString().substring(11) }], today: () => [{ type: p.date, value: (/* @__PURE__ */ new Date()).toISOString().substring(0, 10) }], between: (r6, e, t, n, i) => {
68444
- let o2 = k.toDateTime(r6, t.eval(r6, e));
68451
+ }, r6, e, ...t), sqrt: (r6, e) => J(Math.sqrt, r6, e), truncate: (r6, e) => J((t) => Math.trunc(t), r6, e), children: te, descendants: te, trace: (r6, e, t) => e, now: () => [{ type: p.dateTime, value: (/* @__PURE__ */ new Date()).toISOString() }], timeOfDay: () => [{ type: p.time, value: (/* @__PURE__ */ new Date()).toISOString().substring(11) }], today: () => [{ type: p.date, value: (/* @__PURE__ */ new Date()).toISOString().substring(0, 10) }], between: (r6, e, t, n, i) => {
68452
+ let o2 = I.toDateTime(r6, t.eval(r6, e));
68445
68453
  if (o2.length === 0) throw new Error("Invalid start date");
68446
- let s = k.toDateTime(r6, n.eval(r6, e));
68454
+ let s = I.toDateTime(r6, n.eval(r6, e));
68447
68455
  if (s.length === 0) throw new Error("Invalid end date");
68448
68456
  let a = i.eval(r6, e)[0]?.value;
68449
68457
  if (a !== "years" && a !== "months" && a !== "days") throw new Error("Invalid units");
@@ -68452,7 +68460,7 @@ var k = { empty: (r6, e) => m(e.length === 0 || e.every((t) => E(t.value))), has
68452
68460
  }, is: (r6, e, t) => {
68453
68461
  let n = "";
68454
68462
  return t instanceof G ? n = t.name : t instanceof pe && (n = t.left.name + "." + t.right.name), n ? e.map((i) => ({ type: p.boolean, value: gt(i, n) })) : [];
68455
- }, not: (r6, e) => k.toBoolean(r6, e).map((t) => ({ type: p.boolean, value: !t.value })), resolve: (r6, e) => e.map((t) => {
68463
+ }, not: (r6, e) => I.toBoolean(r6, e).map((t) => ({ type: p.boolean, value: !t.value })), resolve: (r6, e) => e.map((t) => {
68456
68464
  let n = t.value, i;
68457
68465
  if (typeof n == "string") i = n;
68458
68466
  else if (typeof n == "object") {
@@ -68469,7 +68477,7 @@ var k = { empty: (r6, e) => m(e.length === 0 || e.every((t) => E(t.value))), has
68469
68477
  return { type: o2, value: { resourceType: o2, id: s } };
68470
68478
  }
68471
68479
  return { type: p.BackboneElement, value: void 0 };
68472
- }).filter((t) => !!t.value), as: (r6, e) => e, type: (r6, e) => e.map(({ value: t }) => typeof t == "boolean" ? { type: p.BackboneElement, value: { namespace: "System", name: "Boolean" } } : typeof t == "number" ? { type: p.BackboneElement, value: { namespace: "System", name: "Integer" } } : I(t) ? { type: p.BackboneElement, value: { namespace: "FHIR", name: t.resourceType } } : { type: p.BackboneElement, value: null }), conformsTo: (r6, e, t) => {
68480
+ }).filter((t) => !!t.value), as: (r6, e) => e, type: (r6, e) => e.map(({ value: t }) => typeof t == "boolean" ? { type: p.BackboneElement, value: { namespace: "System", name: "Boolean" } } : typeof t == "number" ? { type: p.BackboneElement, value: { namespace: "System", name: "Integer" } } : O(t) ? { type: p.BackboneElement, value: { namespace: "FHIR", name: t.resourceType } } : { type: p.BackboneElement, value: null }), conformsTo: (r6, e, t) => {
68473
68481
  let n = t.eval(r6, e)[0].value;
68474
68482
  if (!n.startsWith("http://hl7.org/fhir/StructureDefinition/")) throw new Error("Expected a StructureDefinition URL");
68475
68483
  let i = n.replace("http://hl7.org/fhir/StructureDefinition/", "");
@@ -68493,14 +68501,14 @@ var k = { empty: (r6, e) => m(e.length === 0 || e.every((t) => E(t.value))), has
68493
68501
  function U(r6, e, t, ...n) {
68494
68502
  if (t.length === 0) return [];
68495
68503
  let [{ value: i }] = X(t, 1);
68496
- if (typeof i != "string") throw new Error("String function cannot be called with non-string");
68504
+ if (typeof i != "string") throw new TypeError("String function cannot be called with non-string");
68497
68505
  let o2 = n.map((a) => a?.eval(e, t)[0]?.value), s = r6(i, ...o2);
68498
68506
  return s === void 0 ? [] : Array.isArray(s) ? s.map(T) : [T(s)];
68499
68507
  }
68500
68508
  function J(r6, e, t, ...n) {
68501
68509
  if (t.length === 0) return [];
68502
- let [{ value: i }] = X(t, 1), o2 = A(i), s = o2 ? i.value : i;
68503
- if (typeof s != "number") throw new Error("Math function cannot be called with non-number");
68510
+ let [{ value: i }] = X(t, 1), o2 = w(i), s = o2 ? i.value : i;
68511
+ if (typeof s != "number") throw new TypeError("Math function cannot be called with non-number");
68504
68512
  let a = r6(s, ...n.map((d) => d.eval(e, t)[0]?.value)), u2 = o2 ? p.Quantity : t[0].type, l2 = o2 ? { ...i, value: a } : a;
68505
68513
  return [{ type: u2, value: l2 }];
68506
68514
  }
@@ -68546,7 +68554,7 @@ var G = class {
68546
68554
  }
68547
68555
  evalValue(e) {
68548
68556
  let t = e.value;
68549
- if (!(!t || typeof t != "object")) return I(t, this.name) ? e : w(e, this.name);
68557
+ if (!(!t || typeof t != "object")) return O(t, this.name) ? e : Or(e, this.name);
68550
68558
  }
68551
68559
  toString() {
68552
68560
  return this.name;
@@ -68578,7 +68586,7 @@ var de = class extends oe {
68578
68586
  super("as", e, t);
68579
68587
  }
68580
68588
  eval(e, t) {
68581
- return k.ofType(e, this.left.eval(e, t), this.right);
68589
+ return I.ofType(e, this.left.eval(e, t), this.right);
68582
68590
  }
68583
68591
  };
68584
68592
  var P = class extends oe {
@@ -68594,8 +68602,8 @@ var M = class extends P {
68594
68602
  if (i.length !== 1) return [];
68595
68603
  let o2 = this.right.eval(t, n);
68596
68604
  if (o2.length !== 1) return [];
68597
- let s = i[0].value, a = o2[0].value, u2 = A(s) ? s.value : s, l2 = A(a) ? a.value : a, d = this.impl(u2, l2);
68598
- return typeof d == "boolean" ? m(d) : A(s) ? [{ type: p.Quantity, value: { ...s, value: d } }] : [T(d)];
68605
+ let s = i[0].value, a = o2[0].value, u2 = w(s) ? s.value : s, l2 = w(a) ? a.value : a, d = this.impl(u2, l2);
68606
+ return typeof d == "boolean" ? m(d) : w(s) ? [{ type: p.Quantity, value: { ...s, value: d } }] : [T(d)];
68599
68607
  }
68600
68608
  };
68601
68609
  var Pt = class extends oe {
@@ -68651,7 +68659,7 @@ var Ot = class extends P {
68651
68659
  }
68652
68660
  eval(e, t) {
68653
68661
  let n = this.left.eval(e, t), i = this.right.eval(e, t);
68654
- return zn(n, i);
68662
+ return Kn(n, i);
68655
68663
  }
68656
68664
  };
68657
68665
  var It = class extends P {
@@ -68660,7 +68668,7 @@ var It = class extends P {
68660
68668
  }
68661
68669
  eval(e, t) {
68662
68670
  let n = this.left.eval(e, t), i = this.right.eval(e, t);
68663
- return Kn(n, i);
68671
+ return Jn(n, i);
68664
68672
  }
68665
68673
  };
68666
68674
  var kt = class extends P {
@@ -68669,7 +68677,7 @@ var kt = class extends P {
68669
68677
  }
68670
68678
  eval(e, t) {
68671
68679
  let n = this.left.eval(e, t), i = this.right.eval(e, t);
68672
- return Mr(n, i);
68680
+ return _r(n, i);
68673
68681
  }
68674
68682
  };
68675
68683
  var Vt = class extends P {
@@ -68678,7 +68686,7 @@ var Vt = class extends P {
68678
68686
  }
68679
68687
  eval(e, t) {
68680
68688
  let n = this.left.eval(e, t), i = this.right.eval(e, t);
68681
- return Qn(Mr(n, i));
68689
+ return zn(_r(n, i));
68682
68690
  }
68683
68691
  };
68684
68692
  var Re = class extends P {
@@ -68735,7 +68743,7 @@ var re = class {
68735
68743
  this.name = e, this.args = t;
68736
68744
  }
68737
68745
  eval(e, t) {
68738
- let n = k[this.name];
68746
+ let n = I[this.name];
68739
68747
  if (!n) throw new Error("Unrecognized function: " + this.name);
68740
68748
  return n(e, t, ...this.args);
68741
68749
  }
@@ -68780,23 +68788,23 @@ var Os = { parse(r6, e) {
68780
68788
  return new re(e.name, t);
68781
68789
  }, precedence: x.FunctionCall };
68782
68790
  function Is(r6) {
68783
- let e = r6.split(" "), t = parseFloat(e[0]), n = e[1];
68791
+ let e = r6.split(" "), t = Number.parseFloat(e[0]), n = e[1];
68784
68792
  return n?.startsWith("'") && n.endsWith("'") ? n = n.substring(1, n.length - 1) : n = "{" + n + "}", { value: t, unit: n };
68785
68793
  }
68786
68794
  function Ye() {
68787
- return new at().registerPrefix("String", { parse: (r6, e) => new B({ type: p.string, value: e.value }) }).registerPrefix("DateTime", { parse: (r6, e) => new B({ type: p.dateTime, value: Ne(e.value) }) }).registerPrefix("Quantity", { parse: (r6, e) => new B({ type: p.Quantity, value: Is(e.value) }) }).registerPrefix("Number", { parse: (r6, e) => new B({ type: e.value.includes(".") ? p.decimal : p.integer, value: parseFloat(e.value) }) }).registerPrefix("true", { parse: () => new B({ type: p.boolean, value: true }) }).registerPrefix("false", { parse: () => new B({ type: p.boolean, value: false }) }).registerPrefix("Symbol", { parse: (r6, e) => new G(e.value) }).registerPrefix("{}", { parse: () => new Rt() }).registerPrefix("(", ws).registerInfix("[", As).registerInfix("(", Os).prefix("+", x.UnaryAdd, (r6, e) => new Ct("+", e, (t) => t)).prefix("-", x.UnarySubtract, (r6, e) => new M("-", e, e, (t, n) => -n)).infixLeft(".", x.Dot, (r6, e, t) => new pe(r6, t)).infixLeft("/", x.Divide, (r6, e, t) => new M("/", r6, t, (n, i) => n / i)).infixLeft("*", x.Multiply, (r6, e, t) => new M("*", r6, t, (n, i) => n * i)).infixLeft("+", x.Add, (r6, e, t) => new M("+", r6, t, (n, i) => n + i)).infixLeft("-", x.Subtract, (r6, e, t) => new M("-", r6, t, (n, i) => n - i)).infixLeft("|", x.Union, (r6, e, t) => new Ee(r6, t)).infixLeft("=", x.Equals, (r6, e, t) => new Ot(r6, t)).infixLeft("!=", x.NotEquals, (r6, e, t) => new It(r6, t)).infixLeft("~", x.Equivalent, (r6, e, t) => new kt(r6, t)).infixLeft("!~", x.NotEquivalent, (r6, e, t) => new Vt(r6, t)).infixLeft("<", x.LessThan, (r6, e, t) => new M("<", r6, t, (n, i) => n < i)).infixLeft("<=", x.LessThanOrEquals, (r6, e, t) => new M("<=", r6, t, (n, i) => n <= i)).infixLeft(">", x.GreaterThan, (r6, e, t) => new M(">", r6, t, (n, i) => n > i)).infixLeft(">=", x.GreaterThanOrEquals, (r6, e, t) => new M(">=", r6, t, (n, i) => n >= i)).infixLeft("&", x.Ampersand, (r6, e, t) => new Pt(r6, t)).infixLeft("and", x.And, (r6, e, t) => new Dt(r6, t)).infixLeft("as", x.As, (r6, e, t) => new de(r6, t)).infixLeft("contains", x.Contains, (r6, e, t) => new wt(r6, t)).infixLeft("div", x.Divide, (r6, e, t) => new M("div", r6, t, (n, i) => n / i | 0)).infixLeft("in", x.In, (r6, e, t) => new At(r6, t)).infixLeft("is", x.Is, (r6, e, t) => new Re(r6, t)).infixLeft("mod", x.Modulo, (r6, e, t) => new M("mod", r6, t, (n, i) => n % i)).infixLeft("or", x.Or, (r6, e, t) => new Mt(r6, t)).infixLeft("xor", x.Xor, (r6, e, t) => new _t(r6, t)).infixLeft("implies", x.Implies, (r6, e, t) => new Lt(r6, t));
68795
+ return new at().registerPrefix("String", { parse: (r6, e) => new B({ type: p.string, value: e.value }) }).registerPrefix("DateTime", { parse: (r6, e) => new B({ type: p.dateTime, value: Ne(e.value) }) }).registerPrefix("Quantity", { parse: (r6, e) => new B({ type: p.Quantity, value: Is(e.value) }) }).registerPrefix("Number", { parse: (r6, e) => new B({ type: e.value.includes(".") ? p.decimal : p.integer, value: Number.parseFloat(e.value) }) }).registerPrefix("true", { parse: () => new B({ type: p.boolean, value: true }) }).registerPrefix("false", { parse: () => new B({ type: p.boolean, value: false }) }).registerPrefix("Symbol", { parse: (r6, e) => new G(e.value) }).registerPrefix("{}", { parse: () => new Rt() }).registerPrefix("(", ws).registerInfix("[", As).registerInfix("(", Os).prefix("+", x.UnaryAdd, (r6, e) => new Ct("+", e, (t) => t)).prefix("-", x.UnarySubtract, (r6, e) => new M("-", e, e, (t, n) => -n)).infixLeft(".", x.Dot, (r6, e, t) => new pe(r6, t)).infixLeft("/", x.Divide, (r6, e, t) => new M("/", r6, t, (n, i) => n / i)).infixLeft("*", x.Multiply, (r6, e, t) => new M("*", r6, t, (n, i) => n * i)).infixLeft("+", x.Add, (r6, e, t) => new M("+", r6, t, (n, i) => n + i)).infixLeft("-", x.Subtract, (r6, e, t) => new M("-", r6, t, (n, i) => n - i)).infixLeft("|", x.Union, (r6, e, t) => new Ee(r6, t)).infixLeft("=", x.Equals, (r6, e, t) => new Ot(r6, t)).infixLeft("!=", x.NotEquals, (r6, e, t) => new It(r6, t)).infixLeft("~", x.Equivalent, (r6, e, t) => new kt(r6, t)).infixLeft("!~", x.NotEquivalent, (r6, e, t) => new Vt(r6, t)).infixLeft("<", x.LessThan, (r6, e, t) => new M("<", r6, t, (n, i) => n < i)).infixLeft("<=", x.LessThanOrEquals, (r6, e, t) => new M("<=", r6, t, (n, i) => n <= i)).infixLeft(">", x.GreaterThan, (r6, e, t) => new M(">", r6, t, (n, i) => n > i)).infixLeft(">=", x.GreaterThanOrEquals, (r6, e, t) => new M(">=", r6, t, (n, i) => n >= i)).infixLeft("&", x.Ampersand, (r6, e, t) => new Pt(r6, t)).infixLeft("and", x.And, (r6, e, t) => new Dt(r6, t)).infixLeft("as", x.As, (r6, e, t) => new de(r6, t)).infixLeft("contains", x.Contains, (r6, e, t) => new wt(r6, t)).infixLeft("div", x.Divide, (r6, e, t) => new M("div", r6, t, (n, i) => n / i | 0)).infixLeft("in", x.In, (r6, e, t) => new At(r6, t)).infixLeft("is", x.Is, (r6, e, t) => new Re(r6, t)).infixLeft("mod", x.Modulo, (r6, e, t) => new M("mod", r6, t, (n, i) => n % i)).infixLeft("or", x.Or, (r6, e, t) => new Mt(r6, t)).infixLeft("xor", x.Xor, (r6, e, t) => new _t(r6, t)).infixLeft("implies", x.Implies, (r6, e, t) => new Lt(r6, t));
68788
68796
  }
68789
68797
  var ks = Ye();
68790
68798
  var h = { 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" };
68791
- var zr = { contains: h.CONTAINS, exact: h.EXACT, above: h.ABOVE, below: h.BELOW, text: h.TEXT, not: h.NOT, in: h.IN, "not-in": h.NOT_IN, "of-type": h.OF_TYPE, missing: h.MISSING, identifier: h.IDENTIFIER, iterate: h.ITERATE };
68792
- var Kr = { eq: h.EQUALS, ne: h.NOT_EQUALS, lt: h.LESS_THAN, le: h.LESS_THAN_OR_EQUALS, gt: h.GREATER_THAN, ge: h.GREATER_THAN_OR_EQUALS, sa: h.STARTS_AFTER, eb: h.ENDS_BEFORE, ap: h.APPROXIMATELY, sw: h.STARTS_WITH };
68799
+ var Kr = { contains: h.CONTAINS, exact: h.EXACT, above: h.ABOVE, below: h.BELOW, text: h.TEXT, not: h.NOT, in: h.IN, "not-in": h.NOT_IN, "of-type": h.OF_TYPE, missing: h.MISSING, identifier: h.IDENTIFIER, iterate: h.ITERATE };
68800
+ var Jr = { eq: h.EQUALS, ne: h.NOT_EQUALS, lt: h.LESS_THAN, le: h.LESS_THAN_OR_EQUALS, gt: h.GREATER_THAN, ge: h.GREATER_THAN_OR_EQUALS, sa: h.STARTS_AFTER, eb: h.ENDS_BEFORE, ap: h.APPROXIMATELY, sw: h.STARTS_WITH };
68793
68801
  var Us = [h.MISSING, h.PRESENT];
68794
68802
  var we = { READ: "read", VREAD: "vread", UPDATE: "update", DELETE: "delete", HISTORY: "history", CREATE: "create", SEARCH: "search" };
68795
68803
  var sa = [we.READ, we.VREAD, we.HISTORY, we.SEARCH];
68796
68804
  function W() {
68797
68805
  return typeof window < "u";
68798
68806
  }
68799
- function Jr() {
68807
+ function Xr() {
68800
68808
  return typeof Buffer < "u" ? Buffer : void 0;
68801
68809
  }
68802
68810
  var ne = { assign(r6) {
@@ -68817,7 +68825,7 @@ function ua(r6) {
68817
68825
  let t = window.atob(r6), n = Uint8Array.from(t, (i) => i.charCodeAt(0));
68818
68826
  return new window.TextDecoder().decode(n);
68819
68827
  }
68820
- let e = Jr();
68828
+ let e = Xr();
68821
68829
  if (e) return e.from(r6, "base64").toString("utf-8");
68822
68830
  throw new Error("Unable to decode base64");
68823
68831
  }
@@ -68826,20 +68834,20 @@ function Bt(r6) {
68826
68834
  let t = new window.TextEncoder().encode(r6), n = String.fromCharCode.apply(null, t);
68827
68835
  return window.btoa(n);
68828
68836
  }
68829
- let e = Jr();
68837
+ let e = Xr();
68830
68838
  if (e) return e.from(r6, "utf8").toString("base64");
68831
68839
  throw new Error("Unable to encode base64");
68832
68840
  }
68833
- function Oi(r6) {
68841
+ function Ii(r6) {
68834
68842
  r6 = r6.padEnd(r6.length + (4 - r6.length % 4) % 4, "=");
68835
68843
  let e = r6.replaceAll("-", "+").replaceAll("_", "/");
68836
68844
  return ua(e);
68837
68845
  }
68838
- function Xr() {
68846
+ function Yr() {
68839
68847
  let r6 = new Uint32Array(28);
68840
- return crypto.getRandomValues(r6), ii(r6.buffer);
68848
+ return crypto.getRandomValues(r6), oi(r6.buffer);
68841
68849
  }
68842
- async function Ii(r6) {
68850
+ async function ki(r6) {
68843
68851
  return crypto.subtle.digest("SHA-256", new TextEncoder().encode(r6));
68844
68852
  }
68845
68853
  function Ae() {
@@ -68848,8 +68856,8 @@ function Ae() {
68848
68856
  return (r6 === "x" ? e : e & 3 | 8).toString(16);
68849
68857
  });
68850
68858
  }
68851
- var O = { CSS: "text/css", DICOM: "application/dicom", FAVICON: "image/vnd.microsoft.icon", FHIR_JSON: "application/fhir+json", FORM_URL_ENCODED: "application/x-www-form-urlencoded", HL7_V2: "x-application/hl7-v2+er7", HTML: "text/html", JAVASCRIPT: "text/javascript", JSON: "application/json", JSON_PATCH: "application/json-patch+json", JWT: "application/jwt", MULTIPART_FORM_DATA: "multipart/form-data", PNG: "image/png", SCIM_JSON: "application/scim+json", SVG: "image/svg+xml", TEXT: "text/plain", TYPESCRIPT: "text/typescript", PING: "x-application/ping", XML: "text/xml", CDA_XML: "application/cda+xml", OCTET_STREAM: "application/octet-stream" };
68852
- var Yr = class {
68859
+ var A = { CSS: "text/css", DICOM: "application/dicom", FAVICON: "image/vnd.microsoft.icon", FHIR_JSON: "application/fhir+json", FORM_URL_ENCODED: "application/x-www-form-urlencoded", HL7_V2: "x-application/hl7-v2+er7", HTML: "text/html", JAVASCRIPT: "text/javascript", JSON: "application/json", JSON_PATCH: "application/json-patch+json", JWT: "application/jwt", MULTIPART_FORM_DATA: "multipart/form-data", PNG: "image/png", SCIM_JSON: "application/scim+json", SVG: "image/svg+xml", TEXT: "text/plain", TYPESCRIPT: "text/typescript", PING: "x-application/ping", XML: "text/xml", CDA_XML: "application/cda+xml", OCTET_STREAM: "application/octet-stream" };
68860
+ var Zr = class {
68853
68861
  constructor() {
68854
68862
  c(this, "listeners");
68855
68863
  this.listeners = {};
@@ -68877,7 +68885,7 @@ var Yr = class {
68877
68885
  };
68878
68886
  var Y = class {
68879
68887
  constructor() {
68880
- c(this, "emitter", new Yr());
68888
+ c(this, "emitter", new Zr());
68881
68889
  }
68882
68890
  dispatchEvent(e) {
68883
68891
  this.emitter.dispatchEvent(e);
@@ -68892,33 +68900,33 @@ var Y = class {
68892
68900
  this.emitter.removeAllListeners();
68893
68901
  }
68894
68902
  };
68895
- var Zr = { "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" };
68903
+ var en = { "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" };
68896
68904
  var ma = ["Patient", "Encounter", "ImagingStudy", "DiagnosticReport", "OperationOutcome", "Bundle"];
68897
- var en = ["DiagnosticReport-update"];
68898
- function Vi(r6) {
68899
- return en.includes(r6);
68900
- }
68905
+ var tn = ["DiagnosticReport-update"];
68901
68906
  function Di(r6) {
68902
- if (en.includes(r6)) throw new f(g(`'context.version' is required for '${r6}'.`));
68907
+ return tn.includes(r6);
68908
+ }
68909
+ function Mi(r6) {
68910
+ if (tn.includes(r6)) throw new f(g(`'context.version' is required for '${r6}'.`));
68903
68911
  }
68904
68912
  var ya = { "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" } } };
68905
68913
  function ga(r6) {
68906
68914
  return ma.includes(r6);
68907
68915
  }
68908
- function Mi(r6) {
68916
+ function _i(r6) {
68909
68917
  return !!r6.endpoint;
68910
68918
  }
68911
- function tn(r6) {
68919
+ function rn(r6) {
68912
68920
  if (!qt(r6)) throw new f(g("subscriptionRequest must be an object conforming to SubscriptionRequest type."));
68913
68921
  let { channelType: e, mode: t, topic: n, events: i } = r6, o2 = { "hub.channel.type": e, "hub.mode": t, "hub.topic": n, "hub.events": i.join(",") };
68914
- return Mi(r6) && (o2.endpoint = r6.endpoint), new URLSearchParams(o2).toString();
68922
+ return _i(r6) && (o2.endpoint = r6.endpoint), new URLSearchParams(o2).toString();
68915
68923
  }
68916
68924
  function qt(r6) {
68917
68925
  if (typeof r6 != "object") return false;
68918
68926
  let { channelType: e, mode: t, topic: n, events: i } = r6;
68919
68927
  if (!(e && t && n && i) || typeof n != "string" || typeof i != "object" || !Array.isArray(i) || i.length < 1 || e !== "websocket" || t !== "subscribe" && t !== "unsubscribe") return false;
68920
- for (let o2 of i) if (!Zr[o2]) return false;
68921
- return !(Mi(r6) && !(typeof r6.endpoint == "string" && r6.endpoint.startsWith("ws")));
68928
+ for (let o2 of i) if (!en[o2]) return false;
68929
+ return !(_i(r6) && !(typeof r6.endpoint == "string" && r6.endpoint.startsWith("ws")));
68922
68930
  }
68923
68931
  function xa(r6, e, t, n) {
68924
68932
  if (typeof e != "object") throw new f(g(`context[${t}] is invalid. Context must contain a single valid FHIR resource! Resource is not an object.`));
@@ -68947,11 +68955,11 @@ function Ta(r6, e) {
68947
68955
  if (!o2.manyAllowed && (t.get(i) ?? 0) > 1) throw new f(g(`${t.get(i)} context entries with key '${i}' found for the '${r6}' event when schema only allows for 1.`));
68948
68956
  }
68949
68957
  }
68950
- function rn(r6, e, t, n) {
68958
+ function nn(r6, e, t, n) {
68951
68959
  if (!(r6 && typeof r6 == "string")) throw new f(g("Must provide a topic."));
68952
- if (!Zr[e]) throw new f(g(`Must provide a valid FHIRcast event name. Supported events: ${Object.keys(Zr).join(", ")}`));
68960
+ if (!en[e]) throw new f(g(`Must provide a valid FHIRcast event name. Supported events: ${Object.keys(en).join(", ")}`));
68953
68961
  if (typeof t != "object") throw new f(g("context must be a context object or array of context objects."));
68954
- if (en.includes(e) && !n) throw new f(g(`The '${e}' event must contain a 'context.versionId'.`));
68962
+ if (tn.includes(e) && !n) throw new f(g(`The '${e}' event must contain a 'context.versionId'.`));
68955
68963
  let i = Array.isArray(t) ? t : [t];
68956
68964
  return Ta(e, i), { timestamp: (/* @__PURE__ */ new Date()).toISOString(), id: Ae(), event: { "hub.topic": r6, "hub.event": e, context: i, ...n ? { "context.versionId": n } : {} } };
68957
68965
  }
@@ -68979,23 +68987,23 @@ var Wt = class extends Y {
68979
68987
  }
68980
68988
  };
68981
68989
  function Sa(r6) {
68982
- return JSON.parse(Oi(r6));
68990
+ return JSON.parse(Ii(r6));
68983
68991
  }
68984
- function _i(r6) {
68992
+ function Li(r6) {
68985
68993
  return r6.split(".").length === 3;
68986
68994
  }
68987
68995
  function jt(r6) {
68988
68996
  let [e, t, n] = r6.split(".");
68989
68997
  return Sa(t);
68990
68998
  }
68991
- function Li(r6) {
68999
+ function Fi(r6) {
68992
69000
  try {
68993
69001
  return typeof jt(r6).login_id == "string";
68994
69002
  } catch {
68995
69003
  return false;
68996
69004
  }
68997
69005
  }
68998
- function Fi(r6) {
69006
+ function Ni(r6) {
68999
69007
  try {
69000
69008
  let t = jt(r6).exp;
69001
69009
  return typeof t == "number" ? t * 1e3 : void 0;
@@ -69012,17 +69020,17 @@ var $t = class {
69012
69020
  return this.medplum.get(`keyvalue/v1/${e}`);
69013
69021
  }
69014
69022
  async set(e, t) {
69015
- await this.medplum.put(`keyvalue/v1/${e}`, t, O.TEXT);
69023
+ await this.medplum.put(`keyvalue/v1/${e}`, t, A.TEXT);
69016
69024
  }
69017
69025
  async delete(e) {
69018
69026
  await this.medplum.delete(`keyvalue/v1/${e}`);
69019
69027
  }
69020
69028
  };
69021
- var Ni;
69022
- Ni = Symbol.toStringTag;
69029
+ var Ui;
69030
+ Ui = Symbol.toStringTag;
69023
69031
  var _ = class {
69024
69032
  constructor(e) {
69025
- c(this, Ni, "ReadablePromise");
69033
+ c(this, Ui, "ReadablePromise");
69026
69034
  c(this, "suspender");
69027
69035
  c(this, "status", "pending");
69028
69036
  c(this, "response");
@@ -69061,7 +69069,7 @@ var tt = class {
69061
69069
  constructor(e, t = "") {
69062
69070
  c(this, "storage");
69063
69071
  c(this, "prefix", "");
69064
- this.storage = e ?? globalThis.localStorage ?? new nn(), this.prefix = t;
69072
+ this.storage = e ?? globalThis.localStorage ?? new on(), this.prefix = t;
69065
69073
  }
69066
69074
  makeKey(e) {
69067
69075
  return this.prefix + e;
@@ -69085,7 +69093,7 @@ var tt = class {
69085
69093
  this.setString(e, t ? St(t) : void 0);
69086
69094
  }
69087
69095
  };
69088
- var nn = class {
69096
+ var on = class {
69089
69097
  constructor() {
69090
69098
  c(this, "data");
69091
69099
  this.data = /* @__PURE__ */ new Map();
@@ -69110,7 +69118,7 @@ var nn = class {
69110
69118
  }
69111
69119
  };
69112
69120
  var We = { Event: typeof globalThis.Event < "u" ? globalThis.Event : void 0, ErrorEvent: void 0, CloseEvent: void 0 };
69113
- var Bi = false;
69121
+ var Wi = false;
69114
69122
  function ba() {
69115
69123
  if (typeof globalThis.Event > "u") throw new Error("Unable to lazy init events for ReconnectingWebSocket. globalThis.Event is not defined yet");
69116
69124
  We.Event = globalThis.Event, We.ErrorEvent = class extends Event {
@@ -69137,10 +69145,10 @@ function Gt(r6) {
69137
69145
  return new r6.constructor(r6.type, r6);
69138
69146
  }
69139
69147
  var Oe = { maxReconnectionDelay: 1e4, minReconnectionDelay: 1e3 + Math.random() * 4e3, minUptime: 5e3, reconnectionDelayGrowFactor: 1.3, connectionTimeout: 4e3, maxRetries: 1 / 0, maxEnqueuedMessages: 1 / 0, startClosed: false, debug: false };
69140
- var Wi = false;
69148
+ var qi = false;
69141
69149
  var Ht = class r extends Y {
69142
69150
  constructor(t, n, i = {}) {
69143
- Bi || (ba(), Bi = true);
69151
+ Wi || (ba(), Wi = true);
69144
69152
  super();
69145
69153
  c(this, "_ws");
69146
69154
  c(this, "_retryCount", -1);
@@ -69272,7 +69280,7 @@ var Ht = class r extends Y {
69272
69280
  this._connectLock = false;
69273
69281
  return;
69274
69282
  }
69275
- !this._options.WebSocket && typeof WebSocket > "u" && !Wi && (console.error("\u203C\uFE0F No WebSocket implementation available. You should define options.WebSocket."), Wi = true);
69283
+ !this._options.WebSocket && typeof WebSocket > "u" && !qi && (console.error("\u203C\uFE0F No WebSocket implementation available. You should define options.WebSocket."), qi = true);
69276
69284
  let i = this._options.WebSocket || WebSocket;
69277
69285
  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);
69278
69286
  }).catch((i) => {
@@ -69321,7 +69329,7 @@ var rt = class extends Y {
69321
69329
  this.criteria.delete(t);
69322
69330
  }
69323
69331
  };
69324
- var on = class {
69332
+ var sn = class {
69325
69333
  constructor(e, t) {
69326
69334
  c(this, "criteria");
69327
69335
  c(this, "emitter");
@@ -69397,7 +69405,7 @@ var Qt = class {
69397
69405
  for (let o2 of this.getAllCriteriaEmitters()) o2.dispatchEvent({ ...i });
69398
69406
  }
69399
69407
  }), e.addEventListener("error", () => {
69400
- let t = { type: "error", payload: new f(An(new Error("WebSocket error"))) };
69408
+ let t = { type: "error", payload: new f(On(new Error("WebSocket error"))) };
69401
69409
  this.masterSubEmitter?.dispatchEvent(t);
69402
69410
  for (let n of this.getAllCriteriaEmitters()) n.dispatchEvent({ ...t });
69403
69411
  }), e.addEventListener("close", () => {
@@ -69487,7 +69495,7 @@ var Qt = class {
69487
69495
  this.masterSubEmitter && this.masterSubEmitter._addCriteria(e);
69488
69496
  let n = this.maybeGetCriteriaEntry(e, t);
69489
69497
  if (n) return n.refCount += 1, n.emitter;
69490
- let i = new on(e, t);
69498
+ let i = new sn(e, t);
69491
69499
  return this.addCriteriaEntry(i), this.subscribeToCriteria(i).catch(console.error), i.emitter;
69492
69500
  }
69493
69501
  removeCriteria(e, t) {
@@ -69514,15 +69522,15 @@ var Qt = class {
69514
69522
  return this.masterSubEmitter || (this.masterSubEmitter = new rt(...Array.from(this.criteriaEntries.keys()))), this.masterSubEmitter;
69515
69523
  }
69516
69524
  };
69517
- var sn = "5.0.1-b8f6268";
69518
- var wa = O.FHIR_JSON + ", */*; q=0.1";
69525
+ var an = "5.0.3-516efe2";
69526
+ var wa = A.FHIR_JSON + ", */*; q=0.1";
69519
69527
  var Aa = "https://api.medplum.com/";
69520
69528
  var Oa = 1e3;
69521
69529
  var Ia = 6e4;
69522
69530
  var ka = 0;
69523
69531
  var Va = 3e5;
69524
69532
  var Da = "Binary/";
69525
- var qi = { resourceType: "Device", id: "system", deviceName: [{ type: "model-name", name: "System" }] };
69533
+ var ji = { resourceType: "Device", id: "system", deviceName: [{ type: "model-name", name: "System" }] };
69526
69534
  var qe = { 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" };
69527
69535
  var Ma = { 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" };
69528
69536
  var _a = { JwtBearer: "urn:ietf:params:oauth:client-assertion-type:jwt-bearer" };
@@ -69564,7 +69572,7 @@ var zt = class extends Y {
69564
69572
  c(this, "initComplete", true);
69565
69573
  c(this, "keyValueClient");
69566
69574
  if (t?.baseUrl && !t.baseUrl.startsWith("http")) throw new Error("Base URL must start with http or https");
69567
- this.options = t ?? {}, this.fetch = t?.fetch ?? La(), this.storage = t?.storage ?? new tt(void 0, t?.storagePrefix), this.createPdfImpl = t?.createPdf, this.baseUrl = $r(t?.baseUrl ?? Aa), this.fhirBaseUrl = $(this.baseUrl, t?.fhirUrlPath ?? "fhir/R4"), this.authorizeUrl = $(this.baseUrl, t?.authorizeUrl ?? "oauth2/authorize"), this.tokenUrl = $(this.baseUrl, t?.tokenUrl ?? "oauth2/token"), this.logoutUrl = $(this.baseUrl, t?.logoutUrl ?? "oauth2/logout"), this.fhircastHubUrl = $(this.baseUrl, t?.fhircastHubUrl ?? "fhircast/STU3"), this.clientId = t?.clientId ?? "", this.clientSecret = t?.clientSecret ?? "", this.credentialsInHeader = t?.authCredentialsMethod === "header", this.defaultHeaders = t?.defaultHeaders ?? {}, this.onUnauthenticated = t?.onUnauthenticated, this.refreshGracePeriod = t?.refreshGracePeriod ?? Va, this.cacheTime = t?.cacheTime ?? (W() ? Ia : ka), this.cacheTime > 0 ? this.requestCache = new ke(t?.resourceCacheSize ?? Oa) : 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(() => {
69575
+ this.options = t ?? {}, this.fetch = t?.fetch ?? La(), this.storage = t?.storage ?? new tt(void 0, t?.storagePrefix), this.createPdfImpl = t?.createPdf, this.baseUrl = Gr(t?.baseUrl ?? Aa), this.fhirBaseUrl = $(this.baseUrl, t?.fhirUrlPath ?? "fhir/R4"), this.authorizeUrl = $(this.baseUrl, t?.authorizeUrl ?? "oauth2/authorize"), this.tokenUrl = $(this.baseUrl, t?.tokenUrl ?? "oauth2/token"), this.logoutUrl = $(this.baseUrl, t?.logoutUrl ?? "oauth2/logout"), this.fhircastHubUrl = $(this.baseUrl, t?.fhircastHubUrl ?? "fhircast/STU3"), this.clientId = t?.clientId ?? "", this.clientSecret = t?.clientSecret ?? "", this.credentialsInHeader = t?.authCredentialsMethod === "header", this.defaultHeaders = t?.defaultHeaders ?? {}, this.onUnauthenticated = t?.onUnauthenticated, this.refreshGracePeriod = t?.refreshGracePeriod ?? Va, this.cacheTime = t?.cacheTime ?? (W() ? Ia : ka), this.cacheTime > 0 ? this.requestCache = new ke(t?.resourceCacheSize ?? Oa) : 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(() => {
69568
69576
  t?.accessToken || this.attemptResumeActiveLogin().catch(console.error), this.initComplete = true, this.dispatchEvent({ type: "storageInitialized" });
69569
69577
  }).catch((n) => {
69570
69578
  console.error(n), this.initComplete = true, this.dispatchEvent({ type: "storageInitFailed", payload: { error: n } });
@@ -69632,7 +69640,7 @@ var zt = class extends Y {
69632
69640
  return t = t.toString(), this.setRequestBody(o2, n), i && this.setRequestContentType(o2, i), this.invalidateUrl(t), this.request("PUT", t, o2);
69633
69641
  }
69634
69642
  patch(t, n, i = {}) {
69635
- return t = t.toString(), this.setRequestBody(i, n), this.setRequestContentType(i, O.JSON_PATCH), this.invalidateUrl(t), this.request("PATCH", t, i);
69643
+ return t = t.toString(), this.setRequestBody(i, n), this.setRequestContentType(i, A.JSON_PATCH), this.invalidateUrl(t), this.request("PATCH", t, i);
69636
69644
  }
69637
69645
  delete(t, n) {
69638
69646
  return t = t.toString(), this.invalidateUrl(t), this.request("DELETE", t, n);
@@ -69693,7 +69701,7 @@ var zt = class extends Y {
69693
69701
  }
69694
69702
  fhirSearchUrl(t, n) {
69695
69703
  let i = this.fhirUrl(t);
69696
- return n && (i.search = pi(n)), i;
69704
+ return n && (i.search = di(n)), i;
69697
69705
  }
69698
69706
  search(t, n, i) {
69699
69707
  let o2 = this.fhirSearchUrl(t, n), s = "search-" + o2.toString(), a = this.getCacheEntry(s, i);
@@ -69712,7 +69720,7 @@ var zt = class extends Y {
69712
69720
  searchResources(t, n, i) {
69713
69721
  let s = "searchResources-" + this.fhirSearchUrl(t, n).toString(), a = this.getCacheEntry(s, i);
69714
69722
  if (a) return a.value;
69715
- let u2 = new _(this.search(t, n, i).then($i));
69723
+ let u2 = new _(this.search(t, n, i).then(Gi));
69716
69724
  return this.setCacheEntry(s, u2), u2;
69717
69725
  }
69718
69726
  async *searchResourcePages(t, n, i) {
@@ -69722,7 +69730,7 @@ var zt = class extends Y {
69722
69730
  s.has("_count") || s.set("_count", "1000");
69723
69731
  let a = await this.search(t, s, i), u2 = a.link?.find((l2) => l2.relation === "next");
69724
69732
  if (!a.entry?.length && !u2) break;
69725
- yield $i(a), o2 = u2?.url ? new URL(u2.url) : void 0;
69733
+ yield Gi(a), o2 = u2?.url ? new URL(u2.url) : void 0;
69726
69734
  }
69727
69735
  }
69728
69736
  valueSetExpand(t, n) {
@@ -69736,7 +69744,7 @@ var zt = class extends Y {
69736
69744
  getCachedReference(t) {
69737
69745
  let n = t.reference;
69738
69746
  if (!n) return;
69739
- if (n === "system") return qi;
69747
+ if (n === "system") return ji;
69740
69748
  let [i, o2] = n.split("/");
69741
69749
  if (!(!i || !o2)) return this.getCached(i, o2);
69742
69750
  }
@@ -69747,12 +69755,12 @@ var zt = class extends Y {
69747
69755
  readReference(t, n) {
69748
69756
  let i = t.reference;
69749
69757
  if (!i) return new _(Promise.reject(new Error("Missing reference")));
69750
- if (i === "system") return new _(Promise.resolve(qi));
69758
+ if (i === "system") return new _(Promise.resolve(ji));
69751
69759
  let [o2, s] = i.split("/");
69752
69760
  return !o2 || !s ? new _(Promise.reject(new Error("Invalid reference"))) : this.readResource(o2, s, n);
69753
69761
  }
69754
69762
  requestSchema(t) {
69755
- if (Bn(t)) return Promise.resolve();
69763
+ if (Wn(t)) return Promise.resolve();
69756
69764
  let n = t + "-requestSchema", i = this.getCacheEntry(n, void 0);
69757
69765
  if (i) return i.value;
69758
69766
  let o2 = new _((async () => {
@@ -69798,12 +69806,12 @@ var zt = class extends Y {
69798
69806
  }
69799
69807
  }`.replaceAll(/\s+/g, " "), a = await this.graphql(s);
69800
69808
  Er(a.data.StructureDefinitionList);
69801
- for (let u2 of a.data.SearchParameterList) Qr(u2);
69809
+ for (let u2 of a.data.SearchParameterList) zr(u2);
69802
69810
  })());
69803
69811
  return this.setCacheEntry(n, o2), o2;
69804
69812
  }
69805
69813
  requestProfileSchema(t, n) {
69806
- if (!n?.expandProfile && Wn(t)) return Promise.resolve();
69814
+ if (!n?.expandProfile && qn(t)) return Promise.resolve();
69807
69815
  let i = t + "-requestSchema" + (n?.expandProfile ? "-nested" : ""), o2 = this.getCacheEntry(i, void 0);
69808
69816
  if (o2) return o2.value;
69809
69817
  let s = new _((async () => {
@@ -69851,8 +69859,8 @@ var zt = class extends Y {
69851
69859
  return s || (s = t), this.cacheResource(s), this.invalidateUrl(this.fhirUrl(t.resourceType, t.id, "_history")), this.invalidateSearches(t.resourceType), s;
69852
69860
  }
69853
69861
  async createAttachment(t, n, i, o2, s) {
69854
- let a = Gi(t, n, i, o2);
69855
- if (a.contentType === O.XML) {
69862
+ let a = Hi(t, n, i, o2);
69863
+ if (a.contentType === A.XML) {
69856
69864
  let d = a.data, y2;
69857
69865
  d instanceof Blob ? y2 = await new Promise((v2, q) => {
69858
69866
  let H2 = new FileReader();
@@ -69863,13 +69871,13 @@ var zt = class extends Y {
69863
69871
  }
69864
69872
  v2(H2.result);
69865
69873
  }, H2.readAsText(d, "utf-8");
69866
- }) : ArrayBuffer.isView(d) ? y2 = new TextDecoder().decode(d) : y2 = d, y2.includes("<ClinicalDocument") && y2.includes("urn:hl7-org:v3") && (a = { ...a, contentType: O.CDA_XML });
69874
+ }) : ArrayBuffer.isView(d) ? y2 = new TextDecoder().decode(d) : y2 = d, y2.includes("<ClinicalDocument") && y2.includes("urn:hl7-org:v3") && (a = { ...a, contentType: A.CDA_XML });
69867
69875
  }
69868
69876
  let u2 = s ?? (typeof n == "object" ? n : {}), l2 = await this.createBinary(a, u2);
69869
69877
  return { contentType: a.contentType, url: l2.url, title: a.filename };
69870
69878
  }
69871
69879
  createBinary(t, n, i, o2, s) {
69872
- let a = Gi(t, n, i, o2), u2 = s ?? (typeof n == "object" ? n : {}), { data: l2, contentType: d, filename: y2, securityContext: v2, onProgress: q } = a, H2 = this.fhirUrl("Binary");
69880
+ let a = Hi(t, n, i, o2), u2 = s ?? (typeof n == "object" ? n : {}), { data: l2, contentType: d, filename: y2, securityContext: v2, onProgress: q } = a, H2 = this.fhirUrl("Binary");
69873
69881
  return y2 && H2.searchParams.set("_filename", y2), v2?.reference && this.setRequestHeader(u2, "X-Security-Context", v2.reference), q ? this.uploadwithProgress(H2, l2, d, q, u2) : this.post(H2, l2, d, u2);
69874
69882
  }
69875
69883
  uploadwithProgress(t, n, i, o2, s) {
@@ -69928,17 +69936,17 @@ var zt = class extends Y {
69928
69936
  return this.post(this.fhirBaseUrl, t, void 0, n);
69929
69937
  }
69930
69938
  sendEmail(t, n) {
69931
- return this.post("email/v1/send", t, O.JSON, n);
69939
+ return this.post("email/v1/send", t, A.JSON, n);
69932
69940
  }
69933
69941
  graphql(t, n, i, o2) {
69934
- return this.post(this.fhirUrl("$graphql"), { query: t, operationName: n, variables: i }, O.JSON, o2);
69942
+ return this.post(this.fhirUrl("$graphql"), { query: t, operationName: n, variables: i }, A.JSON, o2);
69935
69943
  }
69936
69944
  readResourceGraph(t, n, i, o2) {
69937
69945
  return this.get(`${this.fhirUrl(t, n)}/$graph?graph=${i}`, o2);
69938
69946
  }
69939
69947
  pushToAgent(t, n, i, o2, s, a) {
69940
69948
  let { waitTimeout: u2, ...l2 } = a ?? {};
69941
- return this.post(this.fhirUrl("Agent", ve(t), "$push"), { destination: typeof n == "string" ? n : D(n), body: i, contentType: o2, waitForResponse: s, ...u2 !== void 0 ? { waitTimeout: u2 } : void 0 }, O.FHIR_JSON, l2);
69949
+ return this.post(this.fhirUrl("Agent", ve(t), "$push"), { destination: typeof n == "string" ? n : D(n), body: i, contentType: o2, waitForResponse: s, ...u2 !== void 0 ? { waitTimeout: u2 } : void 0 }, A.FHIR_JSON, l2);
69942
69950
  }
69943
69951
  getActiveLogin() {
69944
69952
  return this.storage.getObject("activeLogin");
@@ -69953,7 +69961,7 @@ var zt = class extends Y {
69953
69961
  return this.accessTokenExpires !== void 0 && Date.now() < this.accessTokenExpires - (t ?? this.refreshGracePeriod);
69954
69962
  }
69955
69963
  setAccessToken(t, n) {
69956
- this.accessToken = t, this.refreshToken = n, this.accessTokenExpires = Fi(t), this.medplumServer = Li(t);
69964
+ this.accessToken = t, this.refreshToken = n, this.accessTokenExpires = Ni(t), this.medplumServer = Fi(t);
69957
69965
  }
69958
69966
  getLogins() {
69959
69967
  return this.storage.getObject("logins") ?? [];
@@ -70059,14 +70067,14 @@ var zt = class extends Y {
70059
70067
  if (s.status === 401) return this.handleUnauthenticated(t, n, i);
70060
70068
  if (s.status === 204 || s.status === 304) return;
70061
70069
  let u2 = s.headers.get("content-type")?.includes("json");
70062
- if (s.status === 404 && !u2) throw new f(Pn);
70070
+ if (s.status === 404 && !u2) throw new f(wn);
70063
70071
  let l2 = await this.parseBody(s, u2);
70064
70072
  if (s.status === 200 && i.followRedirectOnOk || s.status === 201 && i.followRedirectOnCreated) {
70065
- let d = await ji(s, l2);
70073
+ let d = await $i(s, l2);
70066
70074
  if (d) return this.request("GET", d, { ...i, body: void 0 });
70067
70075
  }
70068
70076
  if (s.status === 202 && i.pollStatusOnAccepted) {
70069
- let y2 = await ji(s, l2) ?? o2.statusUrl;
70077
+ let y2 = await $i(s, l2) ?? o2.statusUrl;
70070
70078
  if (y2) return this.pollStatus(y2, i, o2);
70071
70079
  }
70072
70080
  if (s.status >= 400) throw new f(pt(l2));
@@ -70093,7 +70101,7 @@ var zt = class extends Y {
70093
70101
  if (this.options.verbose && this.logResponse(s), this.setCurrentRateLimit(s), o2 >= i || !Ba(s)) return s;
70094
70102
  let a = this.getRetryDelay(o2), u2 = n.maxRetryTime ?? 2e3;
70095
70103
  if (a > u2) return s;
70096
- await qr(a);
70104
+ await jr(a);
70097
70105
  } catch (s) {
70098
70106
  if (s.message === "Failed to fetch" && o2 === 0 && this.dispatchEvent({ type: "offline" }), s.name === "AbortError" || o2 === i) throw s;
70099
70107
  }
@@ -70119,7 +70127,7 @@ var zt = class extends Y {
70119
70127
  return t.split(/\s*;\s*/g).map((n) => {
70120
70128
  let i = n.split(/\s*,\s*/g);
70121
70129
  if (i.length !== 3) throw new Error("Could not parse RateLimit header: " + t);
70122
- let o2 = i[0].substring(1, i[0].length - 1), s = i.find((d) => d.startsWith("r=")), a = s ? parseInt(s.substring(2), 10) : NaN, u2 = i.find((d) => d.startsWith("t=")), l2 = u2 ? parseInt(u2.substring(2), 10) : NaN;
70130
+ let o2 = i[0].substring(1, i[0].length - 1), s = i.find((d) => d.startsWith("r=")), a = s ? Number.parseInt(s.substring(2), 10) : NaN, u2 = i.find((d) => d.startsWith("t=")), l2 = u2 ? Number.parseInt(u2.substring(2), 10) : NaN;
70123
70131
  if (!o2 || Number.isNaN(a) || Number.isNaN(l2)) throw new Error("Could not parse RateLimit header: " + t);
70124
70132
  return { name: o2, remainingUnits: a, secondsUntilReset: l2 };
70125
70133
  });
@@ -70134,7 +70142,7 @@ var zt = class extends Y {
70134
70142
  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 = t, i.pollCount = 1;
70135
70143
  else {
70136
70144
  let s = n.pollStatusPeriod ?? 1e3;
70137
- await qr(s), i.pollCount++;
70145
+ await jr(s), i.pollCount++;
70138
70146
  }
70139
70147
  return this.request("GET", t, o2, i);
70140
70148
  }
@@ -70159,7 +70167,7 @@ var zt = class extends Y {
70159
70167
  addFetchOptionsDefaults(t) {
70160
70168
  Object.entries(this.defaultHeaders).forEach(([n, i]) => {
70161
70169
  this.setRequestHeader(t, n, i);
70162
- }), this.setRequestHeader(t, "Accept", wa, true), this.options.extendedMode !== false && this.setRequestHeader(t, "X-Medplum", "extended"), t.body && this.setRequestHeader(t, "Content-Type", O.FHIR_JSON, true), this.accessToken ? this.setRequestHeader(t, "Authorization", "Bearer " + this.accessToken) : this.basicAuth && this.setRequestHeader(t, "Authorization", "Basic " + this.basicAuth), t.cache || (t.cache = "no-cache"), t.credentials || (t.credentials = "include");
70170
+ }), this.setRequestHeader(t, "Accept", wa, true), this.options.extendedMode !== false && this.setRequestHeader(t, "X-Medplum", "extended"), t.body && this.setRequestHeader(t, "Content-Type", A.FHIR_JSON, true), this.accessToken ? this.setRequestHeader(t, "Authorization", "Bearer " + this.accessToken) : this.basicAuth && this.setRequestHeader(t, "Authorization", "Basic " + this.basicAuth), t.cache || (t.cache = "no-cache"), t.credentials || (t.credentials = "include");
70163
70171
  }
70164
70172
  setRequestContentType(t, n) {
70165
70173
  this.setRequestHeader(t, "Content-Type", n);
@@ -70175,13 +70183,13 @@ var zt = class extends Y {
70175
70183
  return this.refresh() ? this.request(t, n, i) : (this.clear(), this.onUnauthenticated && this.onUnauthenticated(), Promise.reject(new f(Ve)));
70176
70184
  }
70177
70185
  async startPkce() {
70178
- let t = Xr();
70186
+ let t = Yr();
70179
70187
  sessionStorage.setItem("pkceState", t);
70180
- let n = Xr().slice(0, 128);
70188
+ let n = Yr().slice(0, 128);
70181
70189
  sessionStorage.setItem("codeVerifier", n);
70182
70190
  try {
70183
- let i = await Ii(n);
70184
- return { codeChallengeMethod: "S256", codeChallenge: oi(i).replaceAll("+", "-").replaceAll("/", "_").replaceAll("=", "") };
70191
+ let i = await ki(n);
70192
+ return { codeChallengeMethod: "S256", codeChallenge: si(i).replaceAll("+", "-").replaceAll("/", "_").replaceAll("=", "") };
70185
70193
  } catch (i) {
70186
70194
  return console.warn("Failed to hash code verifier. Falling back to 'plain' code challenge method", i), { codeChallengeMethod: "plain", codeChallenge: n };
70187
70195
  }
@@ -70218,23 +70226,26 @@ var zt = class extends Y {
70218
70226
  setBasicAuth(t, n) {
70219
70227
  this.clientId = t, this.clientSecret = n, this.basicAuth = Bt(t + ":" + n);
70220
70228
  }
70229
+ setVerbose(t) {
70230
+ this.options.verbose = t;
70231
+ }
70221
70232
  async fhircastSubscribe(t, n) {
70222
70233
  if (!(typeof t == "string" && t !== "")) throw new f(g("Invalid topic provided. Topic must be a valid string."));
70223
70234
  if (!(typeof n == "object" && Array.isArray(n) && n.length > 0)) throw new f(g("Invalid events provided. Events must be an array of event names containing at least one event."));
70224
- let i = { channelType: "websocket", mode: "subscribe", topic: t, events: n }, s = (await this.post(this.fhircastHubUrl, tn(i), O.FORM_URL_ENCODED))["hub.channel.endpoint"];
70235
+ let i = { channelType: "websocket", mode: "subscribe", topic: t, events: n }, s = (await this.post(this.fhircastHubUrl, rn(i), A.FORM_URL_ENCODED))["hub.channel.endpoint"];
70225
70236
  if (!s) throw new Error("Invalid response!");
70226
70237
  return i.endpoint = s, i;
70227
70238
  }
70228
70239
  async fhircastUnsubscribe(t) {
70229
70240
  if (!qt(t)) throw new f(g("Invalid topic or subscriptionRequest. SubscriptionRequest must be an object."));
70230
70241
  if (!(t.endpoint && typeof t.endpoint == "string" && t.endpoint.startsWith("ws"))) throw new f(g("Provided subscription request must have an endpoint in order to unsubscribe."));
70231
- t.mode = "unsubscribe", await this.post(this.fhircastHubUrl, tn(t), O.FORM_URL_ENCODED);
70242
+ t.mode = "unsubscribe", await this.post(this.fhircastHubUrl, rn(t), A.FORM_URL_ENCODED);
70232
70243
  }
70233
70244
  fhircastConnect(t) {
70234
70245
  return new Wt(t);
70235
70246
  }
70236
70247
  async fhircastPublish(t, n, i, o2) {
70237
- return Vi(n) ? this.post(this.fhircastHubUrl, rn(t, n, i, o2), O.JSON) : (Di(n), this.post(this.fhircastHubUrl, rn(t, n, i), O.JSON));
70248
+ return Di(n) ? this.post(this.fhircastHubUrl, nn(t, n, i, o2), A.JSON) : (Mi(n), this.post(this.fhircastHubUrl, nn(t, n, i), A.JSON));
70238
70249
  }
70239
70250
  async fhircastGetContext(t) {
70240
70251
  return this.get(`${this.fhircastHubUrl}/${t}`, { cache: "no-cache" });
@@ -70243,7 +70254,7 @@ var zt = class extends Y {
70243
70254
  return this.post("admin/projects/" + t + "/invite", n);
70244
70255
  }
70245
70256
  async fetchTokens(t) {
70246
- let n = new URLSearchParams(t), i = { ...this.defaultHeaders, "Content-Type": O.FORM_URL_ENCODED };
70257
+ let n = new URLSearchParams(t), i = { ...this.defaultHeaders, "Content-Type": A.FORM_URL_ENCODED };
70247
70258
  this.basicAuth && (i.Authorization = `Basic ${this.basicAuth}`), this.credentialsInHeader && (n.delete("client_id"), n.delete("client_secret"), !this.basicAuth && t.client_id && t.client_secret && (i.Authorization = `Basic ${Bt(t.client_id + ":" + t.client_secret)}`));
70248
70259
  let o2 = { method: "POST", headers: i, body: n.toString(), credentials: "include" }, s;
70249
70260
  try {
@@ -70265,9 +70276,9 @@ var zt = class extends Y {
70265
70276
  }
70266
70277
  async verifyTokens(t) {
70267
70278
  let n = t.access_token;
70268
- if (_i(n)) {
70279
+ if (Li(n)) {
70269
70280
  let i = jt(n);
70270
- if (Date.now() >= i.exp * 1e3) throw this.clearActiveLogin(), new f(wn);
70281
+ if (Date.now() >= i.exp * 1e3) throw this.clearActiveLogin(), new f(An);
70271
70282
  if (i.cid) {
70272
70283
  if (i.cid !== this.clientId) throw this.clearActiveLogin(), new f(mr);
70273
70284
  } else if (this.clientId && i.client_id !== this.clientId) throw this.clearActiveLogin(), new f(mr);
@@ -70290,7 +70301,7 @@ var zt = class extends Y {
70290
70301
  }
70291
70302
  }
70292
70303
  getSubscriptionManager() {
70293
- return this.subscriptionManager || (this.subscriptionManager = new Qt(this, li(this.baseUrl, "/ws/subscriptions-r4"))), this.subscriptionManager;
70304
+ return this.subscriptionManager || (this.subscriptionManager = new Qt(this, pi(this.baseUrl, "/ws/subscriptions-r4"))), this.subscriptionManager;
70294
70305
  }
70295
70306
  subscribeToCriteria(t, n) {
70296
70307
  return this.getSubscriptionManager().addCriteria(t, n);
@@ -70306,21 +70317,21 @@ function La() {
70306
70317
  if (!globalThis.fetch) throw new Error("Fetch not available in this environment");
70307
70318
  return globalThis.fetch.bind(globalThis);
70308
70319
  }
70309
- async function ji(r6, e) {
70320
+ async function $i(r6, e) {
70310
70321
  let t = r6.headers.get("content-location");
70311
70322
  if (t) return t;
70312
70323
  let n = r6.headers.get("location");
70313
70324
  if (n) return n;
70314
70325
  if (lt(e) && e.issue?.[0]?.diagnostics) return e.issue[0].diagnostics;
70315
70326
  }
70316
- function $i(r6) {
70327
+ function Gi(r6) {
70317
70328
  let e = r6.entry?.map((t) => t.resource) ?? [];
70318
70329
  return Object.assign(e, { bundle: r6 });
70319
70330
  }
70320
70331
  function Fa(r6) {
70321
70332
  return R(r6) && "data" in r6 && "contentType" in r6;
70322
70333
  }
70323
- function Gi(r6, e, t, n) {
70334
+ function Hi(r6, e, t, n) {
70324
70335
  return Fa(r6) ? r6 : { data: r6, filename: e, contentType: t, onProgress: n };
70325
70336
  }
70326
70337
  function Na(r6) {
@@ -70356,7 +70367,7 @@ var me = class {
70356
70367
  return this.componentSeparator + this.repetitionSeparator + this.escapeCharacter + this.subcomponentSeparator;
70357
70368
  }
70358
70369
  };
70359
- var po = class r2 {
70370
+ var fo = class r2 {
70360
70371
  constructor(e, t = new me()) {
70361
70372
  c(this, "context");
70362
70373
  c(this, "segments");
@@ -70412,7 +70423,7 @@ var ot = class r3 {
70412
70423
  c(this, "context");
70413
70424
  c(this, "name");
70414
70425
  c(this, "fields");
70415
- this.context = t, ri(e) ? this.fields = e.map((n) => Z.parse(n, t)) : this.fields = e, this.name = this.fields[0].components[0][0];
70426
+ this.context = t, ni(e) ? this.fields = e.map((n) => Z.parse(n, t)) : this.fields = e, this.name = this.fields[0].components[0][0];
70416
70427
  }
70417
70428
  get(e) {
70418
70429
  return this.fields[e];
@@ -70488,7 +70499,7 @@ function wc(r6) {
70488
70499
  }
70489
70500
  var je = { NONE: 0, ERROR: 1, WARN: 2, INFO: 3, DEBUG: 4 };
70490
70501
  var Ac = ["NONE", "ERROR", "WARN", "INFO", "DEBUG"];
70491
- var fo = class r5 {
70502
+ var ho = class r5 {
70492
70503
  constructor(e, t = {}, n = je.INFO, i = {}) {
70493
70504
  c(this, "write");
70494
70505
  c(this, "metadata");
@@ -70528,7 +70539,7 @@ var fo = class r5 {
70528
70539
  this.write(JSON.stringify({ level: Ac[e], timestamp: (/* @__PURE__ */ new Date()).toISOString(), msg: this.prefix ? `${this.prefix}${t}` : t, ...i, ...this.metadata }));
70529
70540
  }
70530
70541
  };
70531
- function Nh(r6) {
70542
+ function Uh(r6) {
70532
70543
  let e = je[r6.toUpperCase()];
70533
70544
  if (e === void 0) throw new Error(`Invalid log level: ${r6}`);
70534
70545
  return e;
@@ -70558,11 +70569,11 @@ function qc(r6) {
70558
70569
  if (!n.name) throw new Error("Asset missing name");
70559
70570
  }
70560
70571
  }
70561
- async function gn(r6, e, t) {
70572
+ async function xn(r6, e, t) {
70562
70573
  let n = ar.get(e ?? "latest");
70563
70574
  if (!n) {
70564
70575
  let i = e ? `v${e}` : "latest", o2 = new URL(`${Wc}/${i}.json`);
70565
- if (o2.searchParams.set("a", r6), o2.searchParams.set("c", sn), t) for (let [u2, l2] of Object.entries(t)) o2.searchParams.set(u2, l2);
70576
+ if (o2.searchParams.set("a", r6), o2.searchParams.set("c", an), t) for (let [u2, l2] of Object.entries(t)) o2.searchParams.set(u2, l2);
70566
70577
  let s = await fetch(o2.toString());
70567
70578
  if (s.status !== 200) {
70568
70579
  let u2;
@@ -70581,17 +70592,17 @@ async function gn(r6, e, t) {
70581
70592
  function jc(r6) {
70582
70593
  return /^\d+\.\d+\.\d+(-[0-9a-z]{7})?$/.test(r6);
70583
70594
  }
70584
- async function am(r6, e) {
70595
+ async function cm(r6, e) {
70585
70596
  if (!jc(e)) return false;
70586
70597
  try {
70587
- await gn(r6, e);
70598
+ await xn(r6, e);
70588
70599
  } catch {
70589
70600
  return false;
70590
70601
  }
70591
70602
  return true;
70592
70603
  }
70593
- async function cm(r6) {
70594
- let e = await gn(r6);
70604
+ async function um(r6) {
70605
+ let e = await xn(r6);
70595
70606
  if (!e.tag_name.startsWith("v")) throw new Error(`Invalid release name found. Release tag '${e.tag_name}' did not start with 'v'`);
70596
70607
  return e.tag_name.slice(1);
70597
70608
  }
@@ -70695,7 +70706,7 @@ var u = class extends h2 {
70695
70706
  for (this.responseQueueProcessing = true; this.responseQueue.length; ) {
70696
70707
  if (this.messagesPerMin) {
70697
70708
  let t = T2 / this.messagesPerMin, s = Date.now() - this.lastMessageDispatchedTime;
70698
- t > s && await qr(t - s);
70709
+ t > s && await jr(t - s);
70699
70710
  }
70700
70711
  let e = this.responseQueue.shift();
70701
70712
  e && this.dispatchEvent(e), this.lastMessageDispatchedTime = Date.now();
@@ -70715,7 +70726,7 @@ var u = class extends h2 {
70715
70726
  break;
70716
70727
  }
70717
70728
  if (n === -1) break;
70718
- let r6 = t.subarray(s, n + 1).subarray(1, -2), a = import_iconv_lite.default.decode(r6, this.encoding), p2 = po.parse(a);
70729
+ let r6 = t.subarray(s, n + 1).subarray(1, -2), a = import_iconv_lite.default.decode(r6, this.encoding), p2 = fo.parse(a);
70719
70730
  e.push(p2), s = n + 1;
70720
70731
  }
70721
70732
  return this.chunks = s < t.length ? [t.subarray(s)] : [], e;
@@ -70881,7 +70892,7 @@ var S = class {
70881
70892
  let r6 = (p2) => {
70882
70893
  n.listen(p2, c2);
70883
70894
  }, a = async (p2) => {
70884
- p2?.code === "EADDRINUSE" && (await qr(50), n.close(), r6(i));
70895
+ p2?.code === "EADDRINUSE" && (await jr(50), n.close(), r6(i));
70885
70896
  };
70886
70897
  n.on("error", a), n.once("listening", () => {
70887
70898
  n.off("error", a);
@@ -71134,7 +71145,7 @@ var ByteStreamChannelConnection = class {
71134
71145
  accessToken: "placeholder",
71135
71146
  channel: this.channel.getDefinition().name,
71136
71147
  remote: this.remote,
71137
- contentType: O.OCTET_STREAM,
71148
+ contentType: A.OCTET_STREAM,
71138
71149
  body: messageBuffer.toString("hex"),
71139
71150
  callback: `Agent/${this.channel.app.agentId}-${(0, import_node_crypto.randomUUID)()}`
71140
71151
  });
@@ -71267,7 +71278,7 @@ var AgentDicomChannel = class extends BaseChannel {
71267
71278
  accessToken: "placeholder",
71268
71279
  channel: _DcmjsDimseScp.channel.getDefinition().name,
71269
71280
  remote: this.association?.getCallingAeTitle(),
71270
- contentType: O.JSON,
71281
+ contentType: A.JSON,
71271
71282
  body: JSON.stringify(payload),
71272
71283
  callback: `Agent/${App.instance.agentId}-${(0, import_node_crypto2.randomUUID)()}`
71273
71284
  });
@@ -71321,7 +71332,7 @@ var AgentDicomChannel = class extends BaseChannel {
71321
71332
  this.server.on("networkError", async (err) => {
71322
71333
  this.log.error("Network error: ", { err });
71323
71334
  if (err?.code === "EADDRINUSE") {
71324
- await qr(50);
71335
+ await jr(50);
71325
71336
  this.server.close();
71326
71337
  this.server.listen(port);
71327
71338
  }
@@ -71605,10 +71616,10 @@ var AgentHl7Channel = class extends BaseChannel {
71605
71616
  sendToRemote(msg) {
71606
71617
  const connection = this.connections.get(msg.remote);
71607
71618
  if (connection) {
71608
- const hl7Message = po.parse(msg.body);
71619
+ const hl7Message = fo.parse(msg.body);
71609
71620
  const msgControlId = hl7Message.getSegment("MSA")?.getField(2)?.toString();
71610
71621
  this.channelLog.info(`[Sending ACK -- ID: ${msgControlId}]: ${hl7Message.toString().replaceAll("\r", "\n")}`);
71611
- connection.hl7Connection.send(po.parse(msg.body));
71622
+ connection.hl7Connection.send(fo.parse(msg.body));
71612
71623
  if (msgControlId) {
71613
71624
  this.stats?.recordAckReceived(msgControlId);
71614
71625
  }
@@ -71706,7 +71717,7 @@ var AgentHl7ChannelConnection = class {
71706
71717
  accessToken: "placeholder",
71707
71718
  channel: this.channel.getDefinition().name,
71708
71719
  remote: this.remote,
71709
- contentType: O.HL7_V2,
71720
+ contentType: A.HL7_V2,
71710
71721
  body: event.message.toString(),
71711
71722
  callback: `Agent/${this.channel.app.agentId}-${(0, import_node_crypto3.randomUUID)()}`
71712
71723
  });
@@ -71806,14 +71817,14 @@ function parseLoggerConfigFromArgs(args) {
71806
71817
  if (!propName.startsWith("logger.") || propVal === void 0) {
71807
71818
  continue;
71808
71819
  }
71809
- const [_2, configType, settingName] = jr(propName, ".", 3);
71820
+ const [_2, configType, settingName] = $r(propName, ".", 3);
71810
71821
  if (!LOGGER_CONFIG_KEYS.includes(settingName)) {
71811
71822
  warnings.push(`${propName} is not a valid setting name`);
71812
71823
  }
71813
71824
  let configValue;
71814
71825
  if (settingName === "logLevel") {
71815
71826
  try {
71816
- configValue = Nh(propVal);
71827
+ configValue = Uh(propVal);
71817
71828
  } catch (err) {
71818
71829
  warnings.push(`Error while parsing ${propName}: ${De(err)}`);
71819
71830
  }
@@ -71987,7 +71998,7 @@ var import_node_os2 = require("node:os");
71987
71998
  var import_node_path2 = __toESM(require("node:path"));
71988
71999
  var import_node_process = __toESM(require("node:process"));
71989
72000
  var EXIT_SIGNALS = ["SIGINT", "SIGTERM", "SIGHUP"];
71990
- var pidLogger = new fo((msg) => `[PID]: ${msg}`);
72001
+ var pidLogger = new ho((msg) => `[PID]: ${msg}`);
71991
72002
  var pidFileApps = /* @__PURE__ */ new Set();
71992
72003
  var processExitListener = () => {
71993
72004
  removeAllPidFiles();
@@ -72105,7 +72116,7 @@ async function waitForPidFile(appName, timeoutMs = 3e3) {
72105
72116
  if (Date.now() - startTime > timeoutMs) {
72106
72117
  throw new Error("Timeout while waiting for PID file");
72107
72118
  }
72108
- await qr(0);
72119
+ await jr(0);
72109
72120
  }
72110
72121
  }
72111
72122
  function removeAllPidFiles() {
@@ -72136,7 +72147,7 @@ var UPGRADER_LOG_PATH = (0, import_node_path3.resolve)(
72136
72147
  );
72137
72148
  var RELEASES_PATH = (0, import_node_path3.resolve)(__dirname);
72138
72149
  async function downloadRelease(version, path4) {
72139
- const release = await gn("agent-upgrader", version);
72150
+ const release = await xn("agent-upgrader", version);
72140
72151
  const downloadUrl = parseDownloadUrl(release, (0, import_node_os3.platform)());
72141
72152
  const { body } = await fetch(downloadUrl);
72142
72153
  if (!body) {
@@ -72221,8 +72232,8 @@ var _App = class _App {
72221
72232
  _App.instance = this;
72222
72233
  this.medplum = medplum;
72223
72234
  this.agentId = agentId;
72224
- this.log = options?.mainLogger ?? new fo((msg) => console.log(msg), void 0, logLevel);
72225
- this.channelLog = options?.channelLogger ?? new fo((msg) => console.log(msg), void 0, logLevel);
72235
+ this.log = options?.mainLogger ?? new ho((msg) => console.log(msg), void 0, logLevel);
72236
+ this.channelLog = options?.channelLogger ?? new ho((msg) => console.log(msg), void 0, logLevel);
72226
72237
  }
72227
72238
  async start() {
72228
72239
  this.log.info("Medplum service starting...");
@@ -72244,7 +72255,7 @@ var _App = class _App {
72244
72255
  if ((0, import_node_fs4.existsSync)(UPGRADE_MANIFEST_PATH)) {
72245
72256
  const upgradeFile = (0, import_node_fs4.readFileSync)(UPGRADE_MANIFEST_PATH, { encoding: "utf-8" });
72246
72257
  const upgradeDetails = JSON.parse(upgradeFile);
72247
- if (sn.startsWith(upgradeDetails.targetVersion)) {
72258
+ if (an.startsWith(upgradeDetails.targetVersion)) {
72248
72259
  await this.sendToWebSocket({
72249
72260
  type: "agent:upgrade:response",
72250
72261
  statusCode: 200,
@@ -72252,7 +72263,7 @@ var _App = class _App {
72252
72263
  });
72253
72264
  this.log.info(`Successfully upgraded to version ${upgradeDetails.targetVersion}`);
72254
72265
  } else {
72255
- const errMsg = `Failed to upgrade to version ${upgradeDetails.targetVersion}. Agent still running with version ${sn}`;
72266
+ const errMsg = `Failed to upgrade to version ${upgradeDetails.targetVersion}. Agent still running with version ${an}`;
72256
72267
  await this.sendToWebSocket({
72257
72268
  type: "agent:error",
72258
72269
  body: errMsg,
@@ -72280,7 +72291,7 @@ var _App = class _App {
72280
72291
  if (attempt === maxAttempts) {
72281
72292
  throw new Error("Too many unsuccessful attempts to create agent PID file");
72282
72293
  }
72283
- await qr(500);
72294
+ await jr(500);
72284
72295
  }
72285
72296
  }
72286
72297
  }
@@ -72352,7 +72363,7 @@ var _App = class _App {
72352
72363
  break;
72353
72364
  case "agent:heartbeat:request":
72354
72365
  this.outstandingHeartbeats = 0;
72355
- await this.sendToWebSocket({ type: "agent:heartbeat:response", version: sn });
72366
+ await this.sendToWebSocket({ type: "agent:heartbeat:response", version: an });
72356
72367
  break;
72357
72368
  case "agent:heartbeat:response":
72358
72369
  this.outstandingHeartbeats = 0;
@@ -72378,7 +72389,7 @@ var _App = class _App {
72378
72389
  case "agent:transmit:request":
72379
72390
  if (this.config?.status !== "active") {
72380
72391
  this.sendAgentDisabledError(command);
72381
- } else if (command.contentType === O.PING) {
72392
+ } else if (command.contentType === A.PING) {
72382
72393
  await this.tryPingHost(command);
72383
72394
  } else {
72384
72395
  this.pushMessage(command);
@@ -72755,7 +72766,7 @@ ${result}`);
72755
72766
  this.addToWebSocketQueue({
72756
72767
  type: "agent:transmit:response",
72757
72768
  channel: message.channel,
72758
- contentType: O.PING,
72769
+ contentType: A.PING,
72759
72770
  remote: message.remote,
72760
72771
  callback: message.callback,
72761
72772
  statusCode: 200,
@@ -72766,7 +72777,7 @@ ${result}`);
72766
72777
  this.addToWebSocketQueue({
72767
72778
  type: "agent:transmit:response",
72768
72779
  channel: message.channel,
72769
- contentType: O.TEXT,
72780
+ contentType: A.TEXT,
72770
72781
  remote: message.remote,
72771
72782
  callback: message.callback,
72772
72783
  statusCode: 400,
@@ -72775,7 +72786,7 @@ ${result}`);
72775
72786
  }
72776
72787
  }
72777
72788
  async tryUpgradeAgent(message) {
72778
- this.log.info(`Attempting to upgrade from ${sn} to ${message.version ?? "latest"}...`);
72789
+ this.log.info(`Attempting to upgrade from ${an} to ${message.version ?? "latest"}...`);
72779
72790
  if ((0, import_node_os4.platform)() !== "win32") {
72780
72791
  const errMsg = "Auto-upgrading is currently only supported on Windows";
72781
72792
  this.log.error(errMsg);
@@ -72798,7 +72809,7 @@ ${result}`);
72798
72809
  return;
72799
72810
  }
72800
72811
  let child;
72801
- if (message.version && !await am("agent-upgrader", message.version)) {
72812
+ if (message.version && !await cm("agent-upgrader", message.version)) {
72802
72813
  const versionTag = message.version ? `v${message.version}` : "latest";
72803
72814
  const errMsg = `Error during upgrading to version '${versionTag}'. '${message.version}' is not a valid version`;
72804
72815
  this.log.error(errMsg);
@@ -72809,8 +72820,8 @@ ${result}`);
72809
72820
  });
72810
72821
  return;
72811
72822
  }
72812
- const targetVersion = message.version ?? await cm("agent-upgrader");
72813
- if (sn.startsWith(targetVersion)) {
72823
+ const targetVersion = message.version ?? await um("agent-upgrader");
72824
+ if (an.startsWith(targetVersion)) {
72814
72825
  if (!message?.force) {
72815
72826
  this.log.info(`Attempted to upgrade to version ${targetVersion}, but agent is already on that version`);
72816
72827
  await this.sendToWebSocket({
@@ -72820,7 +72831,7 @@ ${result}`);
72820
72831
  });
72821
72832
  return;
72822
72833
  }
72823
- this.log.info(`Forcing upgrade from ${sn} to ${targetVersion}`);
72834
+ this.log.info(`Forcing upgrade from ${an} to ${targetVersion}`);
72824
72835
  }
72825
72836
  if (semver.lt(targetVersion, "4.2.4") && !message.force) {
72826
72837
  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.`;
@@ -72880,11 +72891,11 @@ ${result}`);
72880
72891
  return;
72881
72892
  }
72882
72893
  try {
72883
- this.log.info("Writing upgrade manifest...", { previousVersion: sn, targetVersion });
72894
+ this.log.info("Writing upgrade manifest...", { previousVersion: an, targetVersion });
72884
72895
  (0, import_node_fs4.writeFileSync)(
72885
72896
  UPGRADE_MANIFEST_PATH,
72886
72897
  JSON.stringify({
72887
- previousVersion: sn,
72898
+ previousVersion: an,
72888
72899
  targetVersion,
72889
72900
  callback: message.callback ?? null
72890
72901
  }),
@@ -72993,7 +73004,7 @@ ${result}`);
72993
73004
  });
72994
73005
  }
72995
73006
  }
72996
- const requestMsg = po.parse(message.body);
73007
+ const requestMsg = fo.parse(message.body);
72997
73008
  const msh10 = requestMsg.getSegment("MSH")?.getField(10);
72998
73009
  if (!msh10) {
72999
73010
  this.log.error("MSH.10 is missing but required");
@@ -73007,7 +73018,7 @@ ${result}`);
73007
73018
  channel: message.channel,
73008
73019
  remote: message.remote,
73009
73020
  callback: message.callback,
73010
- contentType: O.HL7_V2,
73021
+ contentType: A.HL7_V2,
73011
73022
  statusCode: 200,
73012
73023
  body: response2.toString()
73013
73024
  });
@@ -73018,7 +73029,7 @@ ${result}`);
73018
73029
  channel: message.channel,
73019
73030
  remote: message.remote,
73020
73031
  callback: message.callback,
73021
- contentType: O.TEXT,
73032
+ contentType: A.TEXT,
73022
73033
  statusCode: 400,
73023
73034
  body: De(err)
73024
73035
  });
@@ -73091,7 +73102,7 @@ async function agentMain(argv) {
73091
73102
  } catch (err) {
73092
73103
  console.error("Failed to login", { err: De(err) });
73093
73104
  console.log("Retrying login in 10 seconds...");
73094
- await qr(RETRY_WAIT_DURATION_MS);
73105
+ await jr(RETRY_WAIT_DURATION_MS);
73095
73106
  }
73096
73107
  }
73097
73108
  if (args.logLevel) {
@@ -73104,7 +73115,7 @@ async function agentMain(argv) {
73104
73115
  for (const warning of warnings) {
73105
73116
  mainLogger.warn(warning);
73106
73117
  }
73107
- const app = new App(medplum, agentId, args.logLevel ? Nh(args.logLevel) : void 0, {
73118
+ const app = new App(medplum, agentId, args.logLevel ? Uh(args.logLevel) : void 0, {
73108
73119
  mainLogger,
73109
73120
  channelLogger
73110
73121
  });
@@ -73136,7 +73147,7 @@ async function upgraderMain(argv) {
73136
73147
  if ((0, import_node_os5.platform)() !== "win32") {
73137
73148
  throw new Error(`Unsupported platform: ${(0, import_node_os5.platform)()}. Agent upgrader currently only supports Windows`);
73138
73149
  }
73139
- const globalLogger = new fo((msg) => console.log(msg));
73150
+ const globalLogger = new ho((msg) => console.log(msg));
73140
73151
  if (!import_node_process3.default.send) {
73141
73152
  globalLogger.error("Upgrader not started as a child process with Node IPC enabled. Aborting...");
73142
73153
  import_node_process3.default.exit(1);
@@ -73149,7 +73160,7 @@ async function upgraderMain(argv) {
73149
73160
  if (argv[3] && !jc(argv[3])) {
73150
73161
  throw new Error("Invalid version specified");
73151
73162
  }
73152
- const version = argv[3] ?? await cm("agent-upgrader");
73163
+ const version = argv[3] ?? await um("agent-upgrader");
73153
73164
  const binPath = getReleaseBinPath(version);
73154
73165
  if (!(0, import_node_fs6.existsSync)(binPath)) {
73155
73166
  globalLogger.info(`Could not find binary at "${binPath}". Downloading release from GitHub...`);
@@ -73200,7 +73211,7 @@ async function main(argv) {
73200
73211
  } else if (argv[2] === "--remove-old-services") {
73201
73212
  const logFileFd = (0, import_node_fs7.openSync)(TEMP_LOG_FILE, "a");
73202
73213
  let allAgentServices = [];
73203
- const currentServiceName = `MedplumAgent_${sn}`;
73214
+ const currentServiceName = `MedplumAgent_${an}`;
73204
73215
  while (!allAgentServices.includes(currentServiceName)) {
73205
73216
  const output = (0, import_node_child_process3.execSync)('cmd.exe /c sc query type= service state= all | findstr /i "SERVICE_NAME.*MedplumAgent"');
73206
73217
  (0, import_node_fs7.appendFileSync)(logFileFd, `${output}\r
@@ -73210,8 +73221,8 @@ async function main(argv) {
73210
73221
  ${allAgentServices.join("\r\n")}\r
73211
73222
  `, { encoding: "utf-8" });
73212
73223
  }
73213
- const servicesToRemove = argv[3] === "--all" ? allAgentServices : allAgentServices.filter((serviceName) => serviceName !== `MedplumAgent_${sn}`);
73214
- (0, import_node_fs7.appendFileSync)(logFileFd, `Medplum agent service to filter out: MedplumAgent_${sn}\r
73224
+ const servicesToRemove = argv[3] === "--all" ? allAgentServices : allAgentServices.filter((serviceName) => serviceName !== `MedplumAgent_${an}`);
73225
+ (0, import_node_fs7.appendFileSync)(logFileFd, `Medplum agent service to filter out: MedplumAgent_${an}\r
73215
73226
  `, {
73216
73227
  encoding: "utf-8"
73217
73228
  });