@medplum/agent 2.0.32 → 2.1.1

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 +373 -332
  2. package/package.json +1 -1
@@ -30,9 +30,9 @@ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__ge
30
30
  ));
31
31
  var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
32
32
 
33
- // ../../node_modules/ws/lib/stream.js
33
+ // node_modules/ws/lib/stream.js
34
34
  var require_stream = __commonJS({
35
- "../../node_modules/ws/lib/stream.js"(exports, module2) {
35
+ "node_modules/ws/lib/stream.js"(exports, module2) {
36
36
  "use strict";
37
37
  var { Duplex } = require("stream");
38
38
  function emitClose(stream) {
@@ -135,9 +135,9 @@ var require_stream = __commonJS({
135
135
  }
136
136
  });
137
137
 
138
- // ../../node_modules/ws/lib/constants.js
138
+ // node_modules/ws/lib/constants.js
139
139
  var require_constants = __commonJS({
140
- "../../node_modules/ws/lib/constants.js"(exports, module2) {
140
+ "node_modules/ws/lib/constants.js"(exports, module2) {
141
141
  "use strict";
142
142
  module2.exports = {
143
143
  BINARY_TYPES: ["nodebuffer", "arraybuffer", "fragments"],
@@ -153,9 +153,9 @@ var require_constants = __commonJS({
153
153
  }
154
154
  });
155
155
 
156
- // ../../node_modules/ws/lib/buffer-util.js
156
+ // node_modules/ws/lib/buffer-util.js
157
157
  var require_buffer_util = __commonJS({
158
- "../../node_modules/ws/lib/buffer-util.js"(exports, module2) {
158
+ "node_modules/ws/lib/buffer-util.js"(exports, module2) {
159
159
  "use strict";
160
160
  var { EMPTY_BUFFER } = require_constants();
161
161
  var FastBuffer = Buffer[Symbol.species];
@@ -235,9 +235,9 @@ var require_buffer_util = __commonJS({
235
235
  }
236
236
  });
237
237
 
238
- // ../../node_modules/ws/lib/limiter.js
238
+ // node_modules/ws/lib/limiter.js
239
239
  var require_limiter = __commonJS({
240
- "../../node_modules/ws/lib/limiter.js"(exports, module2) {
240
+ "node_modules/ws/lib/limiter.js"(exports, module2) {
241
241
  "use strict";
242
242
  var kDone = Symbol("kDone");
243
243
  var kRun = Symbol("kRun");
@@ -286,9 +286,9 @@ var require_limiter = __commonJS({
286
286
  }
287
287
  });
288
288
 
289
- // ../../node_modules/ws/lib/permessage-deflate.js
289
+ // node_modules/ws/lib/permessage-deflate.js
290
290
  var require_permessage_deflate = __commonJS({
291
- "../../node_modules/ws/lib/permessage-deflate.js"(exports, module2) {
291
+ "node_modules/ws/lib/permessage-deflate.js"(exports, module2) {
292
292
  "use strict";
293
293
  var zlib = require("zlib");
294
294
  var bufferUtil = require_buffer_util();
@@ -666,9 +666,9 @@ var require_permessage_deflate = __commonJS({
666
666
  }
667
667
  });
668
668
 
669
- // ../../node_modules/ws/lib/validation.js
669
+ // node_modules/ws/lib/validation.js
670
670
  var require_validation = __commonJS({
671
- "../../node_modules/ws/lib/validation.js"(exports, module2) {
671
+ "node_modules/ws/lib/validation.js"(exports, module2) {
672
672
  "use strict";
673
673
  var { isUtf8 } = require("buffer");
674
674
  var tokenChars = [
@@ -862,9 +862,9 @@ var require_validation = __commonJS({
862
862
  }
863
863
  });
864
864
 
865
- // ../../node_modules/ws/lib/receiver.js
865
+ // node_modules/ws/lib/receiver.js
866
866
  var require_receiver = __commonJS({
867
- "../../node_modules/ws/lib/receiver.js"(exports, module2) {
867
+ "node_modules/ws/lib/receiver.js"(exports, module2) {
868
868
  "use strict";
869
869
  var { Writable } = require("stream");
870
870
  var PerMessageDeflate = require_permessage_deflate();
@@ -1285,9 +1285,9 @@ var require_receiver = __commonJS({
1285
1285
  }
1286
1286
  this._fragments.push(buf);
1287
1287
  }
1288
- const er = this.dataMessage();
1289
- if (er)
1290
- return cb(er);
1288
+ const er2 = this.dataMessage();
1289
+ if (er2)
1290
+ return cb(er2);
1291
1291
  this.startLoop(cb);
1292
1292
  });
1293
1293
  }
@@ -1394,9 +1394,9 @@ var require_receiver = __commonJS({
1394
1394
  }
1395
1395
  });
1396
1396
 
1397
- // ../../node_modules/ws/lib/sender.js
1397
+ // node_modules/ws/lib/sender.js
1398
1398
  var require_sender = __commonJS({
1399
- "../../node_modules/ws/lib/sender.js"(exports, module2) {
1399
+ "node_modules/ws/lib/sender.js"(exports, module2) {
1400
1400
  "use strict";
1401
1401
  var net = require("net");
1402
1402
  var tls = require("tls");
@@ -1806,9 +1806,9 @@ var require_sender = __commonJS({
1806
1806
  }
1807
1807
  });
1808
1808
 
1809
- // ../../node_modules/ws/lib/event-target.js
1809
+ // node_modules/ws/lib/event-target.js
1810
1810
  var require_event_target = __commonJS({
1811
- "../../node_modules/ws/lib/event-target.js"(exports, module2) {
1811
+ "node_modules/ws/lib/event-target.js"(exports, module2) {
1812
1812
  "use strict";
1813
1813
  var { kForOnEventAttribute, kListener } = require_constants();
1814
1814
  var kCode = Symbol("kCode");
@@ -2035,9 +2035,9 @@ var require_event_target = __commonJS({
2035
2035
  }
2036
2036
  });
2037
2037
 
2038
- // ../../node_modules/ws/lib/extension.js
2038
+ // node_modules/ws/lib/extension.js
2039
2039
  var require_extension = __commonJS({
2040
- "../../node_modules/ws/lib/extension.js"(exports, module2) {
2040
+ "node_modules/ws/lib/extension.js"(exports, module2) {
2041
2041
  "use strict";
2042
2042
  var { tokenChars } = require_validation();
2043
2043
  function push(dest, name, elem) {
@@ -2205,9 +2205,9 @@ var require_extension = __commonJS({
2205
2205
  }
2206
2206
  });
2207
2207
 
2208
- // ../../node_modules/ws/lib/websocket.js
2208
+ // node_modules/ws/lib/websocket.js
2209
2209
  var require_websocket = __commonJS({
2210
- "../../node_modules/ws/lib/websocket.js"(exports, module2) {
2210
+ "node_modules/ws/lib/websocket.js"(exports, module2) {
2211
2211
  "use strict";
2212
2212
  var EventEmitter = require("events");
2213
2213
  var https = require("https");
@@ -3077,9 +3077,9 @@ var require_websocket = __commonJS({
3077
3077
  }
3078
3078
  });
3079
3079
 
3080
- // ../../node_modules/ws/lib/subprotocol.js
3080
+ // node_modules/ws/lib/subprotocol.js
3081
3081
  var require_subprotocol = __commonJS({
3082
- "../../node_modules/ws/lib/subprotocol.js"(exports, module2) {
3082
+ "node_modules/ws/lib/subprotocol.js"(exports, module2) {
3083
3083
  "use strict";
3084
3084
  var { tokenChars } = require_validation();
3085
3085
  function parse(header) {
@@ -3125,9 +3125,9 @@ var require_subprotocol = __commonJS({
3125
3125
  }
3126
3126
  });
3127
3127
 
3128
- // ../../node_modules/ws/lib/websocket-server.js
3128
+ // node_modules/ws/lib/websocket-server.js
3129
3129
  var require_websocket_server = __commonJS({
3130
- "../../node_modules/ws/lib/websocket-server.js"(exports, module2) {
3130
+ "node_modules/ws/lib/websocket-server.js"(exports, module2) {
3131
3131
  "use strict";
3132
3132
  var EventEmitter = require("events");
3133
3133
  var http = require("http");
@@ -3501,7 +3501,7 @@ var require_websocket_server = __commonJS({
3501
3501
  socket.once("finish", socket.destroy);
3502
3502
  socket.end(
3503
3503
  `HTTP/1.1 ${code} ${http.STATUS_CODES[code]}\r
3504
- ` + Object.keys(headers).map((h) => `${h}: ${headers[h]}`).join("\r\n") + "\r\n\r\n" + message
3504
+ ` + Object.keys(headers).map((h2) => `${h2}: ${headers[h2]}`).join("\r\n") + "\r\n\r\n" + message
3505
3505
  );
3506
3506
  }
3507
3507
  function abortHandshakeOrEmitwsClientError(server, req, socket, code, message) {
@@ -3526,101 +3526,101 @@ __export(main_exports, {
3526
3526
  module.exports = __toCommonJS(main_exports);
3527
3527
 
3528
3528
  // ../core/dist/esm/index.mjs
3529
- var Ke = "ok";
3530
- var Je = "created";
3531
- var Xe = "not-modified";
3532
- var Ze = "not-found";
3533
- var me = "accepted";
3534
- var Ut = { resourceType: "OperationOutcome", id: Ze, issue: [{ severity: "error", code: "not-found", details: { text: "Not found" } }] };
3535
- function D(r4, e) {
3529
+ var Ye = "ok";
3530
+ var Xe = "created";
3531
+ var et = "not-modified";
3532
+ var tt = "not-found";
3533
+ var ye = "accepted";
3534
+ var qt = { resourceType: "OperationOutcome", id: tt, issue: [{ severity: "error", code: "not-found", details: { text: "Not found" } }] };
3535
+ function k(r4, e) {
3536
3536
  return { resourceType: "OperationOutcome", issue: [{ severity: "error", code: "invalid", details: { text: r4 }, expression: e ? [e] : void 0 }] };
3537
3537
  }
3538
- function he(r4) {
3538
+ function ge(r4) {
3539
3539
  return typeof r4 == "object" && r4 !== null && r4.resourceType === "OperationOutcome";
3540
3540
  }
3541
- function et(r4) {
3542
- return r4.id === Ke || r4.id === Je || r4.id === Xe || r4.id === me;
3541
+ function rt(r4) {
3542
+ return r4.id === Ye || r4.id === Xe || r4.id === et || r4.id === ye;
3543
3543
  }
3544
- var m = class extends Error {
3544
+ var h = class extends Error {
3545
3545
  constructor(t, n) {
3546
- super(_t(t));
3546
+ super($t(t));
3547
3547
  this.outcome = t, this.cause = n;
3548
3548
  }
3549
3549
  };
3550
- function tt(r4) {
3551
- return r4 instanceof m ? r4.outcome : he(r4) ? r4 : D(Qr(r4));
3550
+ function nt(r4) {
3551
+ return r4 instanceof h ? r4.outcome : ge(r4) ? r4 : k(Jr(r4));
3552
3552
  }
3553
- function Qr(r4) {
3554
- return r4 ? typeof r4 == "string" ? r4 : r4 instanceof Error ? r4.message : he(r4) ? _t(r4) : typeof r4 == "object" && "code" in r4 && typeof r4.code == "string" ? r4.code : JSON.stringify(r4) : "Unknown error";
3553
+ function Jr(r4) {
3554
+ return r4 ? typeof r4 == "string" ? r4 : r4 instanceof Error ? r4.message : ge(r4) ? $t(r4) : typeof r4 == "object" && "code" in r4 && typeof r4.code == "string" ? r4.code : JSON.stringify(r4) : "Unknown error";
3555
3555
  }
3556
- function _t(r4) {
3557
- let e = r4.issue?.map(Hr) ?? [];
3556
+ function $t(r4) {
3557
+ let e = r4.issue?.map(Yr) ?? [];
3558
3558
  return e.length > 0 ? e.join("; ") : "Unknown error";
3559
3559
  }
3560
- function Hr(r4) {
3560
+ function Yr(r4) {
3561
3561
  let e = r4.details?.text ?? r4.diagnostics ?? "Unknown error";
3562
3562
  return r4.expression?.length && (e += ` (${r4.expression.join(", ")})`), e;
3563
3563
  }
3564
- var Bt = { types: { Element: { display: "Element", properties: { id: { type: [{ code: "string" }] }, extension: { max: "*", type: [{ code: "Extension" }] } } }, BackboneElement: { display: "BackboneElement", properties: { id: { type: [{ code: "string" }] }, extension: { max: "*", type: [{ code: "Extension" }] }, modifierExtension: { max: "*", type: [{ code: "Extension" }] } } }, Address: { display: "Address", properties: { id: { type: [{ code: "string" }] }, extension: { max: "*", type: [{ code: "Extension" }] }, use: { type: [{ code: "code" }] }, type: { type: [{ code: "code" }] }, text: { type: [{ code: "string" }] }, line: { max: "*", 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: { display: "Age", properties: { id: { type: [{ code: "string" }] }, extension: { max: "*", type: [{ code: "Extension" }] }, value: { type: [{ code: "decimal" }] }, comparator: { type: [{ code: "code" }] }, unit: { type: [{ code: "string" }] }, system: { type: [{ code: "uri" }] }, code: { type: [{ code: "code" }] } } }, Annotation: { display: "Annotation", properties: { id: { type: [{ code: "string" }] }, extension: { max: "*", 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: { display: "Attachment", properties: { id: { type: [{ code: "string" }] }, extension: { max: "*", 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: { display: "CodeableConcept", properties: { id: { type: [{ code: "string" }] }, extension: { max: "*", type: [{ code: "Extension" }] }, coding: { max: "*", type: [{ code: "Coding" }] }, text: { type: [{ code: "string" }] } } }, Coding: { display: "Coding", properties: { id: { type: [{ code: "string" }] }, extension: { max: "*", type: [{ code: "Extension" }] }, system: { type: [{ code: "uri" }] }, version: { type: [{ code: "string" }] }, code: { type: [{ code: "code" }] }, display: { type: [{ code: "string" }] }, userSelected: { type: [{ code: "boolean" }] } } }, ContactDetail: { display: "ContactDetail", properties: { id: { type: [{ code: "string" }] }, extension: { max: "*", type: [{ code: "Extension" }] }, name: { type: [{ code: "string" }] }, telecom: { max: "*", type: [{ code: "ContactPoint" }] } } }, ContactPoint: { display: "ContactPoint", properties: { id: { type: [{ code: "string" }] }, extension: { max: "*", type: [{ code: "Extension" }] }, system: { type: [{ code: "code" }] }, value: { type: [{ code: "string" }] }, use: { type: [{ code: "code" }] }, rank: { type: [{ code: "positiveInt" }] }, period: { type: [{ code: "Period" }] } } }, Contributor: { display: "Contributor", properties: { id: { type: [{ code: "string" }] }, extension: { max: "*", type: [{ code: "Extension" }] }, type: { min: 1, type: [{ code: "code" }] }, name: { min: 1, type: [{ code: "string" }] }, contact: { max: "*", type: [{ code: "ContactDetail" }] } } }, Count: { display: "Count", properties: { id: { type: [{ code: "string" }] }, extension: { max: "*", type: [{ code: "Extension" }] }, value: { type: [{ code: "decimal" }] }, comparator: { type: [{ code: "code" }] }, unit: { type: [{ code: "string" }] }, system: { type: [{ code: "uri" }] }, code: { type: [{ code: "code" }] } } }, DataRequirement: { display: "DataRequirement", properties: { id: { type: [{ code: "string" }] }, extension: { max: "*", type: [{ code: "Extension" }] }, type: { min: 1, type: [{ code: "code" }] }, profile: { max: "*", 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: "*", type: [{ code: "string" }] }, codeFilter: { max: "*", type: [{ code: "Element" }] }, dateFilter: { max: "*", type: [{ code: "Element" }] }, limit: { type: [{ code: "positiveInt" }] }, sort: { max: "*", type: [{ code: "Element" }] } } }, DataRequirementCodeFilter: { display: "DataRequirementCodeFilter", properties: { id: { type: [{ code: "string" }] }, extension: { max: "*", type: [{ code: "Extension" }] }, path: { type: [{ code: "string" }] }, searchParam: { type: [{ code: "string" }] }, valueSet: { type: [{ code: "canonical", targetProfile: ["http://hl7.org/fhir/StructureDefinition/ValueSet"] }] }, code: { max: "*", type: [{ code: "Coding" }] } } }, DataRequirementDateFilter: { display: "DataRequirementDateFilter", properties: { id: { type: [{ code: "string" }] }, extension: { max: "*", type: [{ code: "Extension" }] }, path: { type: [{ code: "string" }] }, searchParam: { type: [{ code: "string" }] }, "value[x]": { type: [{ code: "dateTime" }, { code: "Period" }, { code: "Duration" }] } } }, DataRequirementSort: { display: "DataRequirementSort", properties: { id: { type: [{ code: "string" }] }, extension: { max: "*", type: [{ code: "Extension" }] }, path: { min: 1, type: [{ code: "string" }] }, direction: { min: 1, type: [{ code: "code" }] } } }, Distance: { display: "Distance", properties: { id: { type: [{ code: "string" }] }, extension: { max: "*", type: [{ code: "Extension" }] }, value: { type: [{ code: "decimal" }] }, comparator: { type: [{ code: "code" }] }, unit: { type: [{ code: "string" }] }, system: { type: [{ code: "uri" }] }, code: { type: [{ code: "code" }] } } }, Dosage: { display: "Dosage", properties: { id: { type: [{ code: "string" }] }, extension: { max: "*", type: [{ code: "Extension" }] }, modifierExtension: { max: "*", type: [{ code: "Extension" }] }, sequence: { type: [{ code: "integer" }] }, text: { type: [{ code: "string" }] }, additionalInstruction: { max: "*", 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: "*", type: [{ code: "Element" }] }, 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: { display: "DosageDoseAndRate", properties: { id: { type: [{ code: "string" }] }, extension: { max: "*", 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: { display: "Duration", properties: { id: { type: [{ code: "string" }] }, extension: { max: "*", type: [{ code: "Extension" }] }, value: { type: [{ code: "decimal" }] }, comparator: { type: [{ code: "code" }] }, unit: { type: [{ code: "string" }] }, system: { type: [{ code: "uri" }] }, code: { type: [{ code: "code" }] } } }, ElementDefinition: { display: "ElementDefinition", properties: { id: { type: [{ code: "string" }] }, extension: { max: "*", type: [{ code: "Extension" }] }, modifierExtension: { max: "*", type: [{ code: "Extension" }] }, path: { min: 1, type: [{ code: "string" }] }, representation: { max: "*", type: [{ code: "code" }] }, sliceName: { type: [{ code: "string" }] }, sliceIsConstraining: { type: [{ code: "boolean" }] }, label: { type: [{ code: "string" }] }, code: { max: "*", type: [{ code: "Coding" }] }, slicing: { type: [{ code: "Element" }] }, short: { type: [{ code: "string" }] }, definition: { type: [{ code: "markdown" }] }, comment: { type: [{ code: "markdown" }] }, requirements: { type: [{ code: "markdown" }] }, alias: { max: "*", type: [{ code: "string" }] }, min: { type: [{ code: "unsignedInt" }] }, max: { type: [{ code: "string" }] }, base: { type: [{ code: "Element" }] }, contentReference: { type: [{ code: "uri" }] }, type: { max: "*", type: [{ code: "Element" }] }, "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: "*", type: [{ code: "Element" }] }, "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: "*", type: [{ code: "id" }] }, constraint: { max: "*", type: [{ code: "Element" }] }, mustSupport: { type: [{ code: "boolean" }] }, isModifier: { type: [{ code: "boolean" }] }, isModifierReason: { type: [{ code: "string" }] }, isSummary: { type: [{ code: "boolean" }] }, binding: { type: [{ code: "Element" }] }, mapping: { max: "*", type: [{ code: "Element" }] } } }, ElementDefinitionSlicing: { display: "ElementDefinitionSlicing", properties: { id: { type: [{ code: "string" }] }, extension: { max: "*", type: [{ code: "Extension" }] }, discriminator: { max: "*", type: [{ code: "Element" }] }, description: { type: [{ code: "string" }] }, ordered: { type: [{ code: "boolean" }] }, rules: { min: 1, type: [{ code: "code" }] } } }, ElementDefinitionSlicingDiscriminator: { display: "ElementDefinitionSlicingDiscriminator", properties: { id: { type: [{ code: "string" }] }, extension: { max: "*", type: [{ code: "Extension" }] }, type: { min: 1, type: [{ code: "code" }] }, path: { min: 1, type: [{ code: "string" }] } } }, ElementDefinitionBase: { display: "ElementDefinitionBase", properties: { id: { type: [{ code: "string" }] }, extension: { max: "*", type: [{ code: "Extension" }] }, path: { min: 1, type: [{ code: "string" }] }, min: { min: 1, type: [{ code: "unsignedInt" }] }, max: { min: 1, type: [{ code: "string" }] } } }, ElementDefinitionType: { display: "ElementDefinitionType", properties: { id: { type: [{ code: "string" }] }, extension: { max: "*", type: [{ code: "Extension" }] }, code: { min: 1, type: [{ code: "uri" }] }, profile: { max: "*", type: [{ code: "canonical", targetProfile: ["http://hl7.org/fhir/StructureDefinition/StructureDefinition", "http://hl7.org/fhir/StructureDefinition/ImplementationGuide"] }] }, targetProfile: { max: "*", type: [{ code: "canonical", targetProfile: ["http://hl7.org/fhir/StructureDefinition/StructureDefinition", "http://hl7.org/fhir/StructureDefinition/ImplementationGuide"] }] }, aggregation: { max: "*", type: [{ code: "code" }] }, versioning: { type: [{ code: "code" }] } } }, ElementDefinitionExample: { display: "ElementDefinitionExample", properties: { id: { type: [{ code: "string" }] }, extension: { max: "*", 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: { display: "ElementDefinitionConstraint", properties: { id: { type: [{ code: "string" }] }, extension: { max: "*", 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: { display: "ElementDefinitionBinding", properties: { id: { type: [{ code: "string" }] }, extension: { max: "*", 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: { display: "ElementDefinitionMapping", properties: { id: { type: [{ code: "string" }] }, extension: { max: "*", type: [{ code: "Extension" }] }, identity: { min: 1, type: [{ code: "id" }] }, language: { type: [{ code: "code" }] }, map: { min: 1, type: [{ code: "string" }] }, comment: { type: [{ code: "string" }] } } }, Expression: { display: "Expression", properties: { id: { type: [{ code: "string" }] }, extension: { max: "*", 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: { display: "Extension", properties: { id: { type: [{ code: "string" }] }, extension: { max: "*", type: [{ code: "Extension" }] }, url: { min: 1, type: [{ code: "string" }] }, "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: { display: "HumanName", properties: { id: { type: [{ code: "string" }] }, extension: { max: "*", type: [{ code: "Extension" }] }, use: { type: [{ code: "code" }] }, text: { type: [{ code: "string" }] }, family: { type: [{ code: "string" }] }, given: { max: "*", type: [{ code: "string" }] }, prefix: { max: "*", type: [{ code: "string" }] }, suffix: { max: "*", type: [{ code: "string" }] }, period: { type: [{ code: "Period" }] } } }, Identifier: { display: "Identifier", properties: { id: { type: [{ code: "string" }] }, extension: { max: "*", 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: { display: "MarketingStatus", properties: { id: { type: [{ code: "string" }] }, extension: { max: "*", type: [{ code: "Extension" }] }, modifierExtension: { max: "*", 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: { display: "Meta", properties: { id: { type: [{ code: "string" }] }, extension: { max: "*", type: [{ code: "Extension" }] }, versionId: { type: [{ code: "id" }] }, lastUpdated: { type: [{ code: "instant" }] }, source: { type: [{ code: "uri" }] }, profile: { max: "*", type: [{ code: "canonical", targetProfile: ["http://hl7.org/fhir/StructureDefinition/StructureDefinition"] }] }, security: { max: "*", type: [{ code: "Coding" }] }, tag: { max: "*", type: [{ code: "Coding" }] }, project: { type: [{ code: "uri" }] }, author: { type: [{ code: "Reference" }] }, account: { type: [{ code: "Reference" }] }, compartment: { max: "*", type: [{ code: "Reference" }] } } }, Money: { display: "Money", properties: { id: { type: [{ code: "string" }] }, extension: { max: "*", type: [{ code: "Extension" }] }, value: { type: [{ code: "decimal" }] }, currency: { type: [{ code: "code" }] } } }, Narrative: { display: "Narrative", properties: { id: { type: [{ code: "string" }] }, extension: { max: "*", type: [{ code: "Extension" }] }, status: { min: 1, type: [{ code: "code" }] }, div: { min: 1, type: [{ code: "xhtml" }] } } }, ParameterDefinition: { display: "ParameterDefinition", properties: { id: { type: [{ code: "string" }] }, extension: { max: "*", 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: { display: "Period", properties: { id: { type: [{ code: "string" }] }, extension: { max: "*", type: [{ code: "Extension" }] }, start: { type: [{ code: "dateTime" }] }, end: { type: [{ code: "dateTime" }] } } }, Population: { display: "Population", properties: { id: { type: [{ code: "string" }] }, extension: { max: "*", type: [{ code: "Extension" }] }, modifierExtension: { max: "*", type: [{ code: "Extension" }] }, "age[x]": { type: [{ code: "Range" }, { code: "CodeableConcept" }] }, gender: { type: [{ code: "CodeableConcept" }] }, race: { type: [{ code: "CodeableConcept" }] }, physiologicalCondition: { type: [{ code: "CodeableConcept" }] } } }, ProdCharacteristic: { display: "ProdCharacteristic", properties: { id: { type: [{ code: "string" }] }, extension: { max: "*", type: [{ code: "Extension" }] }, modifierExtension: { max: "*", 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: "*", type: [{ code: "string" }] }, imprint: { max: "*", type: [{ code: "string" }] }, image: { max: "*", type: [{ code: "Attachment" }] }, scoring: { type: [{ code: "CodeableConcept" }] } } }, ProductShelfLife: { display: "ProductShelfLife", properties: { id: { type: [{ code: "string" }] }, extension: { max: "*", type: [{ code: "Extension" }] }, modifierExtension: { max: "*", type: [{ code: "Extension" }] }, identifier: { type: [{ code: "Identifier" }] }, type: { min: 1, type: [{ code: "CodeableConcept" }] }, period: { min: 1, type: [{ code: "Quantity" }] }, specialPrecautionsForStorage: { max: "*", type: [{ code: "CodeableConcept" }] } } }, Quantity: { display: "Quantity", properties: { id: { type: [{ code: "string" }] }, extension: { max: "*", 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" }] } } }, Range: { display: "Range", properties: { id: { type: [{ code: "string" }] }, extension: { max: "*", 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: { display: "Ratio", properties: { id: { type: [{ code: "string" }] }, extension: { max: "*", type: [{ code: "Extension" }] }, numerator: { type: [{ code: "Quantity" }] }, denominator: { type: [{ code: "Quantity" }] } } }, Reference: { display: "Reference", properties: { id: { type: [{ code: "string" }] }, extension: { max: "*", type: [{ code: "Extension" }] }, reference: { type: [{ code: "string" }] }, type: { type: [{ code: "uri" }] }, identifier: { type: [{ code: "Identifier" }] }, display: { type: [{ code: "string" }] } } }, RelatedArtifact: { display: "RelatedArtifact", properties: { id: { type: [{ code: "string" }] }, extension: { max: "*", 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: { display: "SampledData", properties: { id: { type: [{ code: "string" }] }, extension: { max: "*", 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: { display: "Signature", properties: { id: { type: [{ code: "string" }] }, extension: { max: "*", type: [{ code: "Extension" }] }, type: { min: 1, max: "*", 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: { display: "SubstanceAmount", properties: { id: { type: [{ code: "string" }] }, extension: { max: "*", type: [{ code: "Extension" }] }, modifierExtension: { max: "*", type: [{ code: "Extension" }] }, "amount[x]": { type: [{ code: "Quantity" }, { code: "Range" }, { code: "string" }] }, amountType: { type: [{ code: "CodeableConcept" }] }, amountText: { type: [{ code: "string" }] }, referenceRange: { type: [{ code: "Element" }] } } }, SubstanceAmountReferenceRange: { display: "SubstanceAmountReferenceRange", properties: { id: { type: [{ code: "string" }] }, extension: { max: "*", type: [{ code: "Extension" }] }, lowLimit: { type: [{ code: "Quantity" }] }, highLimit: { type: [{ code: "Quantity" }] } } }, Timing: { display: "Timing", properties: { id: { type: [{ code: "string" }] }, extension: { max: "*", type: [{ code: "Extension" }] }, modifierExtension: { max: "*", type: [{ code: "Extension" }] }, event: { max: "*", type: [{ code: "dateTime" }] }, repeat: { type: [{ code: "Element" }] }, code: { type: [{ code: "CodeableConcept" }] } } }, TimingRepeat: { display: "TimingRepeat", properties: { id: { type: [{ code: "string" }] }, extension: { max: "*", 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: "*", type: [{ code: "code" }] }, timeOfDay: { max: "*", type: [{ code: "time" }] }, when: { max: "*", type: [{ code: "code" }] }, offset: { type: [{ code: "unsignedInt" }] } } }, TriggerDefinition: { display: "TriggerDefinition", properties: { id: { type: [{ code: "string" }] }, extension: { max: "*", 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: "*", type: [{ code: "DataRequirement" }] }, condition: { type: [{ code: "Expression" }] } } }, UsageContext: { display: "UsageContext", properties: { id: { type: [{ code: "string" }] }, extension: { max: "*", 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"] }] } } }, MetadataResource: { display: "MetadataResource", properties: { id: { type: [{ code: "string" }] }, meta: { type: [{ code: "Meta" }] }, implicitRules: { type: [{ code: "uri" }] }, language: { type: [{ code: "code" }] }, text: { type: [{ code: "Narrative" }] }, contained: { max: "*", type: [{ code: "Resource" }] }, extension: { max: "*", type: [{ code: "Extension" }] }, modifierExtension: { max: "*", type: [{ code: "Extension" }] }, url: { type: [{ code: "uri" }] }, version: { type: [{ code: "string" }] }, name: { type: [{ code: "string" }] }, title: { type: [{ code: "string" }] }, status: { min: 1, type: [{ code: "code" }] }, experimental: { type: [{ code: "boolean" }] }, date: { type: [{ code: "dateTime" }] }, publisher: { type: [{ code: "string" }] }, contact: { max: "*", type: [{ code: "ContactDetail" }] }, description: { type: [{ code: "markdown" }] }, useContext: { max: "*", type: [{ code: "UsageContext" }] }, jurisdiction: { max: "*", type: [{ code: "CodeableConcept" }] } } }, IdentityProvider: { display: "IdentityProvider", properties: { authorizeUrl: { min: 1, type: [{ code: "string" }] }, tokenUrl: { min: 1, type: [{ code: "string" }] }, userInfoUrl: { min: 1, type: [{ code: "string" }] }, clientId: { min: 1, type: [{ code: "string" }] }, clientSecret: { min: 1, type: [{ code: "string" }] }, useSubject: { type: [{ code: "boolean" }] } } } } };
3565
- function Ft(r4, e) {
3564
+ var Wt = { types: { Element: { display: "Element", properties: { id: { type: [{ code: "string" }] }, extension: { max: "*", type: [{ code: "Extension" }] } } }, BackboneElement: { display: "BackboneElement", properties: { id: { type: [{ code: "string" }] }, extension: { max: "*", type: [{ code: "Extension" }] }, modifierExtension: { max: "*", type: [{ code: "Extension" }] } } }, Address: { display: "Address", properties: { id: { type: [{ code: "string" }] }, extension: { max: "*", type: [{ code: "Extension" }] }, use: { type: [{ code: "code" }] }, type: { type: [{ code: "code" }] }, text: { type: [{ code: "string" }] }, line: { max: "*", 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: { display: "Age", properties: { id: { type: [{ code: "string" }] }, extension: { max: "*", type: [{ code: "Extension" }] }, value: { type: [{ code: "decimal" }] }, comparator: { type: [{ code: "code" }] }, unit: { type: [{ code: "string" }] }, system: { type: [{ code: "uri" }] }, code: { type: [{ code: "code" }] } } }, Annotation: { display: "Annotation", properties: { id: { type: [{ code: "string" }] }, extension: { max: "*", 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: { display: "Attachment", properties: { id: { type: [{ code: "string" }] }, extension: { max: "*", 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: { display: "CodeableConcept", properties: { id: { type: [{ code: "string" }] }, extension: { max: "*", type: [{ code: "Extension" }] }, coding: { max: "*", type: [{ code: "Coding" }] }, text: { type: [{ code: "string" }] } } }, Coding: { display: "Coding", properties: { id: { type: [{ code: "string" }] }, extension: { max: "*", type: [{ code: "Extension" }] }, system: { type: [{ code: "uri" }] }, version: { type: [{ code: "string" }] }, code: { type: [{ code: "code" }] }, display: { type: [{ code: "string" }] }, userSelected: { type: [{ code: "boolean" }] } } }, ContactDetail: { display: "ContactDetail", properties: { id: { type: [{ code: "string" }] }, extension: { max: "*", type: [{ code: "Extension" }] }, name: { type: [{ code: "string" }] }, telecom: { max: "*", type: [{ code: "ContactPoint" }] } } }, ContactPoint: { display: "ContactPoint", properties: { id: { type: [{ code: "string" }] }, extension: { max: "*", type: [{ code: "Extension" }] }, system: { type: [{ code: "code" }] }, value: { type: [{ code: "string" }] }, use: { type: [{ code: "code" }] }, rank: { type: [{ code: "positiveInt" }] }, period: { type: [{ code: "Period" }] } } }, Contributor: { display: "Contributor", properties: { id: { type: [{ code: "string" }] }, extension: { max: "*", type: [{ code: "Extension" }] }, type: { min: 1, type: [{ code: "code" }] }, name: { min: 1, type: [{ code: "string" }] }, contact: { max: "*", type: [{ code: "ContactDetail" }] } } }, Count: { display: "Count", properties: { id: { type: [{ code: "string" }] }, extension: { max: "*", type: [{ code: "Extension" }] }, value: { type: [{ code: "decimal" }] }, comparator: { type: [{ code: "code" }] }, unit: { type: [{ code: "string" }] }, system: { type: [{ code: "uri" }] }, code: { type: [{ code: "code" }] } } }, DataRequirement: { display: "DataRequirement", properties: { id: { type: [{ code: "string" }] }, extension: { max: "*", type: [{ code: "Extension" }] }, type: { min: 1, type: [{ code: "code" }] }, profile: { max: "*", 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: "*", type: [{ code: "string" }] }, codeFilter: { max: "*", type: [{ code: "Element" }] }, dateFilter: { max: "*", type: [{ code: "Element" }] }, limit: { type: [{ code: "positiveInt" }] }, sort: { max: "*", type: [{ code: "Element" }] } } }, DataRequirementCodeFilter: { display: "DataRequirementCodeFilter", properties: { id: { type: [{ code: "string" }] }, extension: { max: "*", type: [{ code: "Extension" }] }, path: { type: [{ code: "string" }] }, searchParam: { type: [{ code: "string" }] }, valueSet: { type: [{ code: "canonical", targetProfile: ["http://hl7.org/fhir/StructureDefinition/ValueSet"] }] }, code: { max: "*", type: [{ code: "Coding" }] } } }, DataRequirementDateFilter: { display: "DataRequirementDateFilter", properties: { id: { type: [{ code: "string" }] }, extension: { max: "*", type: [{ code: "Extension" }] }, path: { type: [{ code: "string" }] }, searchParam: { type: [{ code: "string" }] }, "value[x]": { type: [{ code: "dateTime" }, { code: "Period" }, { code: "Duration" }] } } }, DataRequirementSort: { display: "DataRequirementSort", properties: { id: { type: [{ code: "string" }] }, extension: { max: "*", type: [{ code: "Extension" }] }, path: { min: 1, type: [{ code: "string" }] }, direction: { min: 1, type: [{ code: "code" }] } } }, Distance: { display: "Distance", properties: { id: { type: [{ code: "string" }] }, extension: { max: "*", type: [{ code: "Extension" }] }, value: { type: [{ code: "decimal" }] }, comparator: { type: [{ code: "code" }] }, unit: { type: [{ code: "string" }] }, system: { type: [{ code: "uri" }] }, code: { type: [{ code: "code" }] } } }, Dosage: { display: "Dosage", properties: { id: { type: [{ code: "string" }] }, extension: { max: "*", type: [{ code: "Extension" }] }, modifierExtension: { max: "*", type: [{ code: "Extension" }] }, sequence: { type: [{ code: "integer" }] }, text: { type: [{ code: "string" }] }, additionalInstruction: { max: "*", 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: "*", type: [{ code: "Element" }] }, 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: { display: "DosageDoseAndRate", properties: { id: { type: [{ code: "string" }] }, extension: { max: "*", 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: { display: "Duration", properties: { id: { type: [{ code: "string" }] }, extension: { max: "*", type: [{ code: "Extension" }] }, value: { type: [{ code: "decimal" }] }, comparator: { type: [{ code: "code" }] }, unit: { type: [{ code: "string" }] }, system: { type: [{ code: "uri" }] }, code: { type: [{ code: "code" }] } } }, ElementDefinition: { display: "ElementDefinition", properties: { id: { type: [{ code: "string" }] }, extension: { max: "*", type: [{ code: "Extension" }] }, modifierExtension: { max: "*", type: [{ code: "Extension" }] }, path: { min: 1, type: [{ code: "string" }] }, representation: { max: "*", type: [{ code: "code" }] }, sliceName: { type: [{ code: "string" }] }, sliceIsConstraining: { type: [{ code: "boolean" }] }, label: { type: [{ code: "string" }] }, code: { max: "*", type: [{ code: "Coding" }] }, slicing: { type: [{ code: "Element" }] }, short: { type: [{ code: "string" }] }, definition: { type: [{ code: "markdown" }] }, comment: { type: [{ code: "markdown" }] }, requirements: { type: [{ code: "markdown" }] }, alias: { max: "*", type: [{ code: "string" }] }, min: { type: [{ code: "unsignedInt" }] }, max: { type: [{ code: "string" }] }, base: { type: [{ code: "Element" }] }, contentReference: { type: [{ code: "uri" }] }, type: { max: "*", type: [{ code: "Element" }] }, "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: "*", type: [{ code: "Element" }] }, "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: "*", type: [{ code: "id" }] }, constraint: { max: "*", type: [{ code: "Element" }] }, mustSupport: { type: [{ code: "boolean" }] }, isModifier: { type: [{ code: "boolean" }] }, isModifierReason: { type: [{ code: "string" }] }, isSummary: { type: [{ code: "boolean" }] }, binding: { type: [{ code: "Element" }] }, mapping: { max: "*", type: [{ code: "Element" }] } } }, ElementDefinitionSlicing: { display: "ElementDefinitionSlicing", properties: { id: { type: [{ code: "string" }] }, extension: { max: "*", type: [{ code: "Extension" }] }, discriminator: { max: "*", type: [{ code: "Element" }] }, description: { type: [{ code: "string" }] }, ordered: { type: [{ code: "boolean" }] }, rules: { min: 1, type: [{ code: "code" }] } } }, ElementDefinitionSlicingDiscriminator: { display: "ElementDefinitionSlicingDiscriminator", properties: { id: { type: [{ code: "string" }] }, extension: { max: "*", type: [{ code: "Extension" }] }, type: { min: 1, type: [{ code: "code" }] }, path: { min: 1, type: [{ code: "string" }] } } }, ElementDefinitionBase: { display: "ElementDefinitionBase", properties: { id: { type: [{ code: "string" }] }, extension: { max: "*", type: [{ code: "Extension" }] }, path: { min: 1, type: [{ code: "string" }] }, min: { min: 1, type: [{ code: "unsignedInt" }] }, max: { min: 1, type: [{ code: "string" }] } } }, ElementDefinitionType: { display: "ElementDefinitionType", properties: { id: { type: [{ code: "string" }] }, extension: { max: "*", type: [{ code: "Extension" }] }, code: { min: 1, type: [{ code: "uri" }] }, profile: { max: "*", type: [{ code: "canonical", targetProfile: ["http://hl7.org/fhir/StructureDefinition/StructureDefinition", "http://hl7.org/fhir/StructureDefinition/ImplementationGuide"] }] }, targetProfile: { max: "*", type: [{ code: "canonical", targetProfile: ["http://hl7.org/fhir/StructureDefinition/StructureDefinition", "http://hl7.org/fhir/StructureDefinition/ImplementationGuide"] }] }, aggregation: { max: "*", type: [{ code: "code" }] }, versioning: { type: [{ code: "code" }] } } }, ElementDefinitionExample: { display: "ElementDefinitionExample", properties: { id: { type: [{ code: "string" }] }, extension: { max: "*", 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: { display: "ElementDefinitionConstraint", properties: { id: { type: [{ code: "string" }] }, extension: { max: "*", 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: { display: "ElementDefinitionBinding", properties: { id: { type: [{ code: "string" }] }, extension: { max: "*", 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: { display: "ElementDefinitionMapping", properties: { id: { type: [{ code: "string" }] }, extension: { max: "*", type: [{ code: "Extension" }] }, identity: { min: 1, type: [{ code: "id" }] }, language: { type: [{ code: "code" }] }, map: { min: 1, type: [{ code: "string" }] }, comment: { type: [{ code: "string" }] } } }, Expression: { display: "Expression", properties: { id: { type: [{ code: "string" }] }, extension: { max: "*", 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: { display: "Extension", properties: { id: { type: [{ code: "string" }] }, extension: { max: "*", type: [{ code: "Extension" }] }, url: { min: 1, type: [{ code: "string" }] }, "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: { display: "HumanName", properties: { id: { type: [{ code: "string" }] }, extension: { max: "*", type: [{ code: "Extension" }] }, use: { type: [{ code: "code" }] }, text: { type: [{ code: "string" }] }, family: { type: [{ code: "string" }] }, given: { max: "*", type: [{ code: "string" }] }, prefix: { max: "*", type: [{ code: "string" }] }, suffix: { max: "*", type: [{ code: "string" }] }, period: { type: [{ code: "Period" }] } } }, Identifier: { display: "Identifier", properties: { id: { type: [{ code: "string" }] }, extension: { max: "*", 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: { display: "MarketingStatus", properties: { id: { type: [{ code: "string" }] }, extension: { max: "*", type: [{ code: "Extension" }] }, modifierExtension: { max: "*", 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: { display: "Meta", properties: { id: { type: [{ code: "string" }] }, extension: { max: "*", type: [{ code: "Extension" }] }, versionId: { type: [{ code: "id" }] }, lastUpdated: { type: [{ code: "instant" }] }, source: { type: [{ code: "uri" }] }, profile: { max: "*", type: [{ code: "canonical", targetProfile: ["http://hl7.org/fhir/StructureDefinition/StructureDefinition"] }] }, security: { max: "*", type: [{ code: "Coding" }] }, tag: { max: "*", type: [{ code: "Coding" }] }, project: { type: [{ code: "uri" }] }, author: { type: [{ code: "Reference" }] }, account: { type: [{ code: "Reference" }] }, compartment: { max: "*", type: [{ code: "Reference" }] } } }, Money: { display: "Money", properties: { id: { type: [{ code: "string" }] }, extension: { max: "*", type: [{ code: "Extension" }] }, value: { type: [{ code: "decimal" }] }, currency: { type: [{ code: "code" }] } } }, Narrative: { display: "Narrative", properties: { id: { type: [{ code: "string" }] }, extension: { max: "*", type: [{ code: "Extension" }] }, status: { min: 1, type: [{ code: "code" }] }, div: { min: 1, type: [{ code: "xhtml" }] } } }, ParameterDefinition: { display: "ParameterDefinition", properties: { id: { type: [{ code: "string" }] }, extension: { max: "*", 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: { display: "Period", properties: { id: { type: [{ code: "string" }] }, extension: { max: "*", type: [{ code: "Extension" }] }, start: { type: [{ code: "dateTime" }] }, end: { type: [{ code: "dateTime" }] } } }, Population: { display: "Population", properties: { id: { type: [{ code: "string" }] }, extension: { max: "*", type: [{ code: "Extension" }] }, modifierExtension: { max: "*", type: [{ code: "Extension" }] }, "age[x]": { type: [{ code: "Range" }, { code: "CodeableConcept" }] }, gender: { type: [{ code: "CodeableConcept" }] }, race: { type: [{ code: "CodeableConcept" }] }, physiologicalCondition: { type: [{ code: "CodeableConcept" }] } } }, ProdCharacteristic: { display: "ProdCharacteristic", properties: { id: { type: [{ code: "string" }] }, extension: { max: "*", type: [{ code: "Extension" }] }, modifierExtension: { max: "*", 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: "*", type: [{ code: "string" }] }, imprint: { max: "*", type: [{ code: "string" }] }, image: { max: "*", type: [{ code: "Attachment" }] }, scoring: { type: [{ code: "CodeableConcept" }] } } }, ProductShelfLife: { display: "ProductShelfLife", properties: { id: { type: [{ code: "string" }] }, extension: { max: "*", type: [{ code: "Extension" }] }, modifierExtension: { max: "*", type: [{ code: "Extension" }] }, identifier: { type: [{ code: "Identifier" }] }, type: { min: 1, type: [{ code: "CodeableConcept" }] }, period: { min: 1, type: [{ code: "Quantity" }] }, specialPrecautionsForStorage: { max: "*", type: [{ code: "CodeableConcept" }] } } }, Quantity: { display: "Quantity", properties: { id: { type: [{ code: "string" }] }, extension: { max: "*", 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" }] } } }, Range: { display: "Range", properties: { id: { type: [{ code: "string" }] }, extension: { max: "*", 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: { display: "Ratio", properties: { id: { type: [{ code: "string" }] }, extension: { max: "*", type: [{ code: "Extension" }] }, numerator: { type: [{ code: "Quantity" }] }, denominator: { type: [{ code: "Quantity" }] } } }, Reference: { display: "Reference", properties: { id: { type: [{ code: "string" }] }, extension: { max: "*", type: [{ code: "Extension" }] }, reference: { type: [{ code: "string" }] }, type: { type: [{ code: "uri" }] }, identifier: { type: [{ code: "Identifier" }] }, display: { type: [{ code: "string" }] } } }, RelatedArtifact: { display: "RelatedArtifact", properties: { id: { type: [{ code: "string" }] }, extension: { max: "*", 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: { display: "SampledData", properties: { id: { type: [{ code: "string" }] }, extension: { max: "*", 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: { display: "Signature", properties: { id: { type: [{ code: "string" }] }, extension: { max: "*", type: [{ code: "Extension" }] }, type: { min: 1, max: "*", 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: { display: "SubstanceAmount", properties: { id: { type: [{ code: "string" }] }, extension: { max: "*", type: [{ code: "Extension" }] }, modifierExtension: { max: "*", type: [{ code: "Extension" }] }, "amount[x]": { type: [{ code: "Quantity" }, { code: "Range" }, { code: "string" }] }, amountType: { type: [{ code: "CodeableConcept" }] }, amountText: { type: [{ code: "string" }] }, referenceRange: { type: [{ code: "Element" }] } } }, SubstanceAmountReferenceRange: { display: "SubstanceAmountReferenceRange", properties: { id: { type: [{ code: "string" }] }, extension: { max: "*", type: [{ code: "Extension" }] }, lowLimit: { type: [{ code: "Quantity" }] }, highLimit: { type: [{ code: "Quantity" }] } } }, Timing: { display: "Timing", properties: { id: { type: [{ code: "string" }] }, extension: { max: "*", type: [{ code: "Extension" }] }, modifierExtension: { max: "*", type: [{ code: "Extension" }] }, event: { max: "*", type: [{ code: "dateTime" }] }, repeat: { type: [{ code: "Element" }] }, code: { type: [{ code: "CodeableConcept" }] } } }, TimingRepeat: { display: "TimingRepeat", properties: { id: { type: [{ code: "string" }] }, extension: { max: "*", 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: "*", type: [{ code: "code" }] }, timeOfDay: { max: "*", type: [{ code: "time" }] }, when: { max: "*", type: [{ code: "code" }] }, offset: { type: [{ code: "unsignedInt" }] } } }, TriggerDefinition: { display: "TriggerDefinition", properties: { id: { type: [{ code: "string" }] }, extension: { max: "*", 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: "*", type: [{ code: "DataRequirement" }] }, condition: { type: [{ code: "Expression" }] } } }, UsageContext: { display: "UsageContext", properties: { id: { type: [{ code: "string" }] }, extension: { max: "*", 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"] }] } } }, MetadataResource: { display: "MetadataResource", properties: { id: { type: [{ code: "string" }] }, meta: { type: [{ code: "Meta" }] }, implicitRules: { type: [{ code: "uri" }] }, language: { type: [{ code: "code" }] }, text: { type: [{ code: "Narrative" }] }, contained: { max: "*", type: [{ code: "Resource" }] }, extension: { max: "*", type: [{ code: "Extension" }] }, modifierExtension: { max: "*", type: [{ code: "Extension" }] }, url: { type: [{ code: "uri" }] }, version: { type: [{ code: "string" }] }, name: { type: [{ code: "string" }] }, title: { type: [{ code: "string" }] }, status: { min: 1, type: [{ code: "code" }] }, experimental: { type: [{ code: "boolean" }] }, date: { type: [{ code: "dateTime" }] }, publisher: { type: [{ code: "string" }] }, contact: { max: "*", type: [{ code: "ContactDetail" }] }, description: { type: [{ code: "markdown" }] }, useContext: { max: "*", type: [{ code: "UsageContext" }] }, jurisdiction: { max: "*", type: [{ code: "CodeableConcept" }] } } }, IdentityProvider: { display: "IdentityProvider", properties: { authorizeUrl: { min: 1, type: [{ code: "string" }] }, tokenUrl: { min: 1, type: [{ code: "string" }] }, userInfoUrl: { min: 1, type: [{ code: "string" }] }, clientId: { min: 1, type: [{ code: "string" }] }, clientSecret: { min: 1, type: [{ code: "string" }] }, useSubject: { type: [{ code: "boolean" }] } } } } };
3565
+ function Gt(r4, e) {
3566
3566
  let t = [];
3567
3567
  return r4.prefix && e?.prefix !== false && t.push(...r4.prefix), r4.given && t.push(...r4.given), r4.family && t.push(r4.family), r4.suffix && e?.suffix !== false && t.push(...r4.suffix), r4.use && (e?.all || e?.use) && t.push("[" + r4.use + "]"), t.join(" ").trim();
3568
3568
  }
3569
- function ie(r4) {
3570
- let e = $t(r4), t = on(r4);
3569
+ function ae(r4) {
3570
+ let e = Jt(r4), t = ln(r4);
3571
3571
  return t === e ? { reference: e } : { reference: e, display: t };
3572
3572
  }
3573
- function $t(r4) {
3573
+ function Jt(r4) {
3574
3574
  return r4.resourceType + "/" + r4.id;
3575
3575
  }
3576
- function Ro(r4) {
3576
+ function wo(r4) {
3577
3577
  return r4?.reference?.split("/")[1];
3578
3578
  }
3579
- function nn(r4) {
3579
+ function dn(r4) {
3580
3580
  return r4.resourceType === "Patient" || r4.resourceType === "Practitioner" || r4.resourceType === "RelatedPerson";
3581
3581
  }
3582
- function on(r4) {
3583
- if (nn(r4)) {
3584
- let e = sn(r4);
3582
+ function ln(r4) {
3583
+ if (dn(r4)) {
3584
+ let e = pn(r4);
3585
3585
  if (e)
3586
3586
  return e;
3587
3587
  }
3588
3588
  if (r4.resourceType === "Device") {
3589
- let e = an(r4);
3589
+ let e = fn(r4);
3590
3590
  if (e)
3591
3591
  return e;
3592
3592
  }
3593
- return r4.resourceType === "Observation" && "code" in r4 && r4.code?.text ? r4.code.text : r4.resourceType === "User" && r4.email ? r4.email : "name" in r4 && r4.name && typeof r4.name == "string" ? r4.name : $t(r4);
3593
+ return r4.resourceType === "Observation" && "code" in r4 && r4.code?.text ? r4.code.text : r4.resourceType === "User" && r4.email ? r4.email : "name" in r4 && r4.name && typeof r4.name == "string" ? r4.name : Jt(r4);
3594
3594
  }
3595
- function sn(r4) {
3595
+ function pn(r4) {
3596
3596
  let e = r4.name;
3597
3597
  if (e && e.length > 0)
3598
- return Ft(e[0]);
3598
+ return Gt(e[0]);
3599
3599
  }
3600
- function an(r4) {
3600
+ function fn(r4) {
3601
3601
  let e = r4.deviceName;
3602
3602
  if (e && e.length > 0)
3603
3603
  return e[0].name;
3604
3604
  }
3605
- function ye(r4, e) {
3605
+ function xe(r4, e) {
3606
3606
  let t = new Date(r4);
3607
3607
  t.setUTCHours(0, 0, 0, 0);
3608
3608
  let n = e ? new Date(e) : /* @__PURE__ */ new Date();
3609
3609
  n.setUTCHours(0, 0, 0, 0);
3610
- let i2 = t.getUTCFullYear(), o = t.getUTCMonth(), s = t.getUTCDate(), a = n.getUTCFullYear(), c2 = n.getUTCMonth(), p2 = n.getUTCDate(), l2 = a - i2;
3611
- (c2 < o || c2 === o && p2 < s) && l2--;
3612
- let ne = a * 12 + c2 - (i2 * 12 + o);
3613
- p2 < s && ne--;
3614
- let fe = Math.floor((n.getTime() - t.getTime()) / (1e3 * 60 * 60 * 24));
3615
- return { years: l2, months: ne, days: fe };
3610
+ let i2 = t.getUTCFullYear(), o = t.getUTCMonth(), s = t.getUTCDate(), a = n.getUTCFullYear(), c2 = n.getUTCMonth(), f = n.getUTCDate(), l2 = a - i2;
3611
+ (c2 < o || c2 === o && f < s) && l2--;
3612
+ let F = a * 12 + c2 - (i2 * 12 + o);
3613
+ f < s && F--;
3614
+ let Kr = Math.floor((n.getTime() - t.getTime()) / (1e3 * 60 * 60 * 24));
3615
+ return { years: l2, months: F, days: Kr };
3616
3616
  }
3617
- function Wt(r4, e) {
3618
- return JSON.stringify(r4, cn, e ? 2 : void 0);
3617
+ function er(r4, e) {
3618
+ return JSON.stringify(r4, hn, e ? 2 : void 0);
3619
3619
  }
3620
- function cn(r4, e) {
3621
- return !un(r4) && b(e) ? void 0 : e;
3620
+ function hn(r4, e) {
3621
+ return !mn(r4) && b(e) ? void 0 : e;
3622
3622
  }
3623
- function un(r4) {
3623
+ function mn(r4) {
3624
3624
  return !!/\d+$/.exec(r4);
3625
3625
  }
3626
3626
  function b(r4) {
@@ -3629,38 +3629,43 @@ function b(r4) {
3629
3629
  let e = typeof r4;
3630
3630
  return e === "string" && r4 === "" || e === "object" && Object.keys(r4).length === 0;
3631
3631
  }
3632
- function zt(r4) {
3632
+ function tr(r4) {
3633
3633
  return r4.every((e) => typeof e == "string");
3634
3634
  }
3635
- var Kt = [];
3635
+ var rr = [];
3636
3636
  for (let r4 = 0; r4 < 256; r4++)
3637
- Kt.push(r4.toString(16).padStart(2, "0"));
3638
- function Jt(r4) {
3637
+ rr.push(r4.toString(16).padStart(2, "0"));
3638
+ function nr(r4) {
3639
3639
  let e = new Uint8Array(r4), t = new Array(e.length);
3640
3640
  for (let n = 0; n < e.length; n++)
3641
- t[n] = Kt[e[n]];
3641
+ t[n] = rr[e[n]];
3642
3642
  return t.join("");
3643
3643
  }
3644
- function Yt(r4) {
3644
+ function ir(r4) {
3645
3645
  let e = new Uint8Array(r4), t = [];
3646
3646
  for (let n = 0; n < e.length; n++)
3647
3647
  t[n] = String.fromCharCode(e[n]);
3648
3648
  return window.btoa(t.join(""));
3649
3649
  }
3650
- function S(r4) {
3650
+ function R(r4) {
3651
3651
  return r4.charAt(0).toUpperCase() + r4.substring(1);
3652
3652
  }
3653
- var st = (r4) => new Promise((e) => {
3653
+ var ut = (r4) => new Promise((e) => {
3654
3654
  setTimeout(e, r4);
3655
3655
  });
3656
- var j = ((u2) => (u2.Address = "Address", u2.Age = "Age", u2.Annotation = "Annotation", u2.Attachment = "Attachment", u2.BackboneElement = "BackboneElement", u2.CodeableConcept = "CodeableConcept", u2.Coding = "Coding", u2.ContactDetail = "ContactDetail", u2.ContactPoint = "ContactPoint", u2.Contributor = "Contributor", u2.Count = "Count", u2.DataRequirement = "DataRequirement", u2.Distance = "Distance", u2.Dosage = "Dosage", u2.Duration = "Duration", u2.Expression = "Expression", u2.Extension = "Extension", u2.HumanName = "HumanName", u2.Identifier = "Identifier", u2.MarketingStatus = "MarketingStatus", u2.Meta = "Meta", u2.Money = "Money", u2.Narrative = "Narrative", u2.ParameterDefinition = "ParameterDefinition", u2.Period = "Period", u2.Population = "Population", u2.ProdCharacteristic = "ProdCharacteristic", u2.ProductShelfLife = "ProductShelfLife", u2.Quantity = "Quantity", u2.Range = "Range", u2.Ratio = "Ratio", u2.Reference = "Reference", u2.RelatedArtifact = "RelatedArtifact", u2.SampledData = "SampledData", u2.Signature = "Signature", u2.SubstanceAmount = "SubstanceAmount", u2.SystemString = "http://hl7.org/fhirpath/System.String", u2.Timing = "Timing", u2.TriggerDefinition = "TriggerDefinition", u2.UsageContext = "UsageContext", u2.base64Binary = "base64Binary", u2.boolean = "boolean", u2.canonical = "canonical", u2.code = "code", u2.date = "date", u2.dateTime = "dateTime", u2.decimal = "decimal", u2.id = "id", u2.instant = "instant", u2.integer = "integer", u2.markdown = "markdown", u2.oid = "oid", u2.positiveInt = "positiveInt", u2.string = "string", u2.time = "time", u2.unsignedInt = "unsignedInt", u2.uri = "uri", u2.url = "url", u2.uuid = "uuid", u2))(j || {});
3657
- function at(r4) {
3656
+ var z = ((u2) => (u2.Address = "Address", u2.Age = "Age", u2.Annotation = "Annotation", u2.Attachment = "Attachment", u2.BackboneElement = "BackboneElement", u2.CodeableConcept = "CodeableConcept", u2.Coding = "Coding", u2.ContactDetail = "ContactDetail", u2.ContactPoint = "ContactPoint", u2.Contributor = "Contributor", u2.Count = "Count", u2.DataRequirement = "DataRequirement", u2.Distance = "Distance", u2.Dosage = "Dosage", u2.Duration = "Duration", u2.Expression = "Expression", u2.Extension = "Extension", u2.HumanName = "HumanName", u2.Identifier = "Identifier", u2.MarketingStatus = "MarketingStatus", u2.Meta = "Meta", u2.Money = "Money", u2.Narrative = "Narrative", u2.ParameterDefinition = "ParameterDefinition", u2.Period = "Period", u2.Population = "Population", u2.ProdCharacteristic = "ProdCharacteristic", u2.ProductShelfLife = "ProductShelfLife", u2.Quantity = "Quantity", u2.Range = "Range", u2.Ratio = "Ratio", u2.Reference = "Reference", u2.RelatedArtifact = "RelatedArtifact", u2.SampledData = "SampledData", u2.Signature = "Signature", u2.SubstanceAmount = "SubstanceAmount", u2.SystemString = "http://hl7.org/fhirpath/System.String", u2.Timing = "Timing", u2.TriggerDefinition = "TriggerDefinition", u2.UsageContext = "UsageContext", u2.base64Binary = "base64Binary", u2.boolean = "boolean", u2.canonical = "canonical", u2.code = "code", u2.date = "date", u2.dateTime = "dateTime", u2.decimal = "decimal", u2.id = "id", u2.instant = "instant", u2.integer = "integer", u2.markdown = "markdown", u2.oid = "oid", u2.positiveInt = "positiveInt", u2.string = "string", u2.time = "time", u2.unsignedInt = "unsignedInt", u2.uri = "uri", u2.url = "url", u2.uuid = "uuid", u2))(z || {});
3657
+ function dt(r4) {
3658
3658
  if (!r4.name)
3659
3659
  return;
3660
3660
  let t = r4.snapshot?.element;
3661
- t && (t.forEach((n) => Tn(r4, n)), t.forEach((n) => vn(r4, n)));
3661
+ if (t) {
3662
+ for (let n of t)
3663
+ En(r4, n);
3664
+ for (let n of t)
3665
+ Pn(r4, n);
3666
+ }
3662
3667
  }
3663
- function Tn(r4, e) {
3668
+ function En(r4, e) {
3664
3669
  let t = e.path, n = e.type?.[0]?.code;
3665
3670
  if (n !== void 0 && n !== "Element" && n !== "BackboneElement")
3666
3671
  return;
@@ -3669,7 +3674,7 @@ function Tn(r4, e) {
3669
3674
  let o = L(i2), s = y.types[o];
3670
3675
  s || (y.types[o] = s = {}), s.parentType = s.parentType ?? L(i2.slice(0, i2.length - 1)), s.display = s.display ?? o, s.structureDefinition = s.structureDefinition ?? r4, s.elementDefinition = s.elementDefinition ?? e, s.description = s.description ?? e.definition, s.properties = s.properties ?? {};
3671
3676
  }
3672
- function vn(r4, e) {
3677
+ function Pn(r4, e) {
3673
3678
  let n = e.path.split(".");
3674
3679
  if (n.length === 1)
3675
3680
  return;
@@ -3680,16 +3685,16 @@ function vn(r4, e) {
3680
3685
  let s = n[n.length - 1];
3681
3686
  o.properties[s] = e;
3682
3687
  }
3683
- function ct(r4) {
3688
+ function lt(r4) {
3684
3689
  for (let e of r4.base ?? []) {
3685
3690
  let t = y.types[e];
3686
3691
  t && (t.searchParams || (t.searchParams = { _id: { base: [e], code: "_id", type: "token", expression: e + ".id" }, _lastUpdated: { base: [e], code: "_lastUpdated", type: "date", expression: e + ".meta.lastUpdated" }, _compartment: { base: [e], code: "_compartment", type: "reference", expression: e + ".meta.compartment" }, _profile: { base: [e], code: "_profile", type: "uri", expression: e + ".meta.profile" }, _security: { base: [e], code: "_security", type: "token", expression: e + ".meta.security" }, _source: { base: [e], code: "_source", type: "uri", expression: e + ".meta.source" }, _tag: { base: [e], code: "_tag", type: "token", expression: e + ".meta.tag" } }), t.searchParams[r4.code] = r4);
3687
3692
  }
3688
3693
  }
3689
3694
  function L(r4) {
3690
- return r4.length === 1 ? r4[0] : r4.map(S).join("");
3695
+ return r4.length === 1 ? r4[0] : r4.map(R).join("");
3691
3696
  }
3692
- function oe(r4, e) {
3697
+ function ce(r4, e) {
3693
3698
  let t = y.types[r4];
3694
3699
  if (!t)
3695
3700
  return;
@@ -3697,7 +3702,7 @@ function oe(r4, e) {
3697
3702
  if (n) {
3698
3703
  if (n.contentReference) {
3699
3704
  let i2 = n.contentReference.substring(1).split("."), o = i2.pop(), s = L(i2);
3700
- return oe(s, o);
3705
+ return ce(s, o);
3701
3706
  }
3702
3707
  return n;
3703
3708
  }
@@ -3705,9 +3710,9 @@ function oe(r4, e) {
3705
3710
  function _(r4) {
3706
3711
  return !!(r4 && typeof r4 == "object" && "resourceType" in r4);
3707
3712
  }
3708
- var y = Bt;
3709
- var An = ((g) => (g.EQUALS = "eq", g.NOT_EQUALS = "ne", g.GREATER_THAN = "gt", g.LESS_THAN = "lt", g.GREATER_THAN_OR_EQUALS = "ge", g.LESS_THAN_OR_EQUALS = "le", g.STARTS_AFTER = "sa", g.ENDS_BEFORE = "eb", g.APPROXIMATELY = "ap", g.CONTAINS = "contains", g.EXACT = "exact", g.TEXT = "text", g.NOT = "not", g.ABOVE = "above", g.BELOW = "below", g.IN = "in", g.NOT_IN = "not-in", g.OF_TYPE = "of-type", g.MISSING = "missing", g.IDENTIFIER = "identifier", g.ITERATE = "iterate", g))(An || {});
3710
- var be = class {
3713
+ var y = Wt;
3714
+ var kn = ((g) => (g.EQUALS = "eq", g.NOT_EQUALS = "ne", g.GREATER_THAN = "gt", g.LESS_THAN = "lt", g.GREATER_THAN_OR_EQUALS = "ge", g.LESS_THAN_OR_EQUALS = "le", g.STARTS_AFTER = "sa", g.ENDS_BEFORE = "eb", g.APPROXIMATELY = "ap", g.CONTAINS = "contains", g.EXACT = "exact", g.TEXT = "text", g.NOT = "not", g.ABOVE = "above", g.BELOW = "below", g.IN = "in", g.NOT_IN = "not-in", g.OF_TYPE = "of-type", g.MISSING = "missing", g.IDENTIFIER = "identifier", g.ITERATE = "iterate", g))(kn || {});
3715
+ var Se = class {
3711
3716
  constructor(e, t) {
3712
3717
  this.operator = e;
3713
3718
  this.child = t;
@@ -3726,7 +3731,7 @@ var $ = class {
3726
3731
  return `${this.left.toString()} ${this.operator} ${this.right.toString()}`;
3727
3732
  }
3728
3733
  };
3729
- var Se = class {
3734
+ var Ae = class {
3730
3735
  constructor() {
3731
3736
  this.prefixParselets = {};
3732
3737
  this.infixParselets = {};
@@ -3750,10 +3755,10 @@ var Se = class {
3750
3755
  }, precedence: t });
3751
3756
  }
3752
3757
  construct(e) {
3753
- return new dt(e, this.prefixParselets, this.infixParselets);
3758
+ return new ft(e, this.prefixParselets, this.infixParselets);
3754
3759
  }
3755
3760
  };
3756
- var dt = class {
3761
+ var ft = class {
3757
3762
  constructor(e, t, n) {
3758
3763
  this.tokens = e, this.prefixParselets = t, this.infixParselets = n;
3759
3764
  }
@@ -3804,7 +3809,7 @@ var dt = class {
3804
3809
  return this.infixParselets[e.id === "Symbol" ? e.value : e.id];
3805
3810
  }
3806
3811
  };
3807
- function Z(r4) {
3812
+ function te(r4) {
3808
3813
  if (r4.startsWith("T"))
3809
3814
  return r4 + "T00:00:00.000Z".substring(r4.length);
3810
3815
  if (r4.length <= 10)
@@ -3818,10 +3823,10 @@ function Z(r4) {
3818
3823
  function d(r4) {
3819
3824
  return [{ type: "boolean", value: r4 }];
3820
3825
  }
3821
- function T(r4) {
3826
+ function x(r4) {
3822
3827
  return r4 == null ? { type: "undefined", value: void 0 } : Number.isSafeInteger(r4) ? { type: "integer", value: r4 } : typeof r4 == "number" ? { type: "decimal", value: r4 } : typeof r4 == "boolean" ? { type: "boolean", value: r4 } : typeof r4 == "string" ? { type: "string", value: r4 } : A(r4) ? { type: "Quantity", value: r4 } : _(r4) ? { type: r4.resourceType, value: r4 } : { type: "BackboneElement", value: r4 };
3823
3828
  }
3824
- function N(r4) {
3829
+ function M(r4) {
3825
3830
  return r4.length === 0 ? false : !!r4[0].value;
3826
3831
  }
3827
3832
  function O(r4, e) {
@@ -3831,13 +3836,13 @@ function O(r4, e) {
3831
3836
  throw new Error(`Expected singleton of type ${e}, but found ${JSON.stringify(r4)}`);
3832
3837
  }
3833
3838
  }
3834
- function P(r4, e) {
3839
+ function E(r4, e) {
3835
3840
  if (!r4.value)
3836
3841
  return;
3837
- let t = oe(r4.type, e);
3838
- return t ? Nn(r4, e, t) : Mn(r4, e);
3842
+ let t = ce(r4.type, e);
3843
+ return t ? $n(r4, e, t) : Qn(r4, e);
3839
3844
  }
3840
- function Nn(r4, e, t) {
3845
+ function $n(r4, e, t) {
3841
3846
  let n = t.type;
3842
3847
  if (!n || n.length === 0)
3843
3848
  return;
@@ -3846,20 +3851,20 @@ function Nn(r4, e, t) {
3846
3851
  i2 = r4.value[e], o = n[0].code;
3847
3852
  else
3848
3853
  for (let a of n) {
3849
- let c2 = e.replace("[x]", "") + S(a.code);
3854
+ let c2 = e.replace("[x]", "") + R(a.code);
3850
3855
  if (c2 in r4.value) {
3851
3856
  i2 = r4.value[c2], o = a.code;
3852
3857
  break;
3853
3858
  }
3854
3859
  }
3855
3860
  let s = r4.value["_" + e];
3856
- if (s && (Array.isArray(i2) ? i2 = i2.map((a, c2) => s[c2] ? lr(a ?? {}, s[c2]) : a) : i2 = lr(i2 ?? {}, s)), !b(i2))
3857
- return (o === "Element" || o === "BackboneElement") && (o = L(t.path?.split("."))), Array.isArray(i2) ? i2.map((a) => cr(a, o)) : cr(i2, o);
3861
+ if (s && (Array.isArray(i2) ? i2 = i2.map((a, c2) => s[c2] ? gr(a ?? {}, s[c2]) : a) : i2 = gr(i2 ?? {}, s)), !b(i2))
3862
+ return (o === "Element" || o === "BackboneElement") && (o = L(t.path?.split("."))), Array.isArray(i2) ? i2.map((a) => hr(a, o)) : hr(i2, o);
3858
3863
  }
3859
- function cr(r4, e) {
3864
+ function hr(r4, e) {
3860
3865
  return e === "Resource" && _(r4) && (e = r4.resourceType), { type: e, value: r4 };
3861
3866
  }
3862
- function Mn(r4, e) {
3867
+ function Qn(r4, e) {
3863
3868
  let t = r4.value;
3864
3869
  if (!t || typeof t != "object")
3865
3870
  return;
@@ -3867,22 +3872,22 @@ function Mn(r4, e) {
3867
3872
  if (e in t)
3868
3873
  n = t[e];
3869
3874
  else
3870
- for (let i2 in j) {
3871
- let o = e + S(i2);
3875
+ for (let i2 in z) {
3876
+ let o = e + R(i2);
3872
3877
  if (o in t) {
3873
3878
  n = t[o];
3874
3879
  break;
3875
3880
  }
3876
3881
  }
3877
3882
  if (!b(n))
3878
- return Array.isArray(n) ? n.map(T) : T(n);
3883
+ return Array.isArray(n) ? n.map(x) : x(n);
3879
3884
  }
3880
- function Re(r4) {
3885
+ function Ee(r4) {
3881
3886
  let e = [];
3882
3887
  for (let t of r4) {
3883
3888
  let n = false;
3884
3889
  for (let i2 of e)
3885
- if (N(pr(t, i2))) {
3890
+ if (M(xr(t, i2))) {
3886
3891
  n = true;
3887
3892
  break;
3888
3893
  }
@@ -3890,28 +3895,28 @@ function Re(r4) {
3890
3895
  }
3891
3896
  return e;
3892
3897
  }
3893
- function lt(r4) {
3894
- return d(!N(r4));
3898
+ function ht(r4) {
3899
+ return d(!M(r4));
3895
3900
  }
3896
- function pt(r4, e) {
3897
- return r4.length === 0 || e.length === 0 ? [] : r4.length !== e.length ? d(false) : d(r4.every((t, n) => N(pr(t, e[n]))));
3901
+ function mt(r4, e) {
3902
+ return r4.length === 0 || e.length === 0 ? [] : r4.length !== e.length ? d(false) : d(r4.every((t, n) => M(xr(t, e[n]))));
3898
3903
  }
3899
- function pr(r4, e) {
3904
+ function xr(r4, e) {
3900
3905
  let t = r4.value?.valueOf(), n = e.value?.valueOf();
3901
- return typeof t == "number" && typeof n == "number" ? d(Math.abs(t - n) < 1e-8) : A(t) && A(n) ? d(fr(t, n)) : d(typeof t == "object" && typeof n == "object" ? mt(r4, e) : t === n);
3906
+ return typeof t == "number" && typeof n == "number" ? d(Math.abs(t - n) < 1e-8) : A(t) && A(n) ? d(Tr(t, n)) : d(typeof t == "object" && typeof n == "object" ? gt(r4, e) : t === n);
3902
3907
  }
3903
- function ft(r4, e) {
3904
- return r4.length === 0 && e.length === 0 ? d(true) : r4.length !== e.length ? d(false) : (r4.sort(ur), e.sort(ur), d(r4.every((t, n) => N(Bn(t, e[n])))));
3908
+ function yt(r4, e) {
3909
+ return r4.length === 0 && e.length === 0 ? d(true) : r4.length !== e.length ? d(false) : (r4.sort(mr), e.sort(mr), d(r4.every((t, n) => M(Hn(t, e[n])))));
3905
3910
  }
3906
- function Bn(r4, e) {
3911
+ function Hn(r4, e) {
3907
3912
  let { type: t, value: n } = r4, { type: i2, value: o } = e, s = n?.valueOf(), a = o?.valueOf();
3908
- return typeof s == "number" && typeof a == "number" ? d(Math.abs(s - a) < 0.01) : A(s) && A(a) ? d(fr(s, a)) : d(t === "Coding" && i2 === "Coding" ? typeof s != "object" || typeof a != "object" ? false : s.code === a.code && s.system === a.system : typeof s == "object" && typeof a == "object" ? mt({ ...s, id: void 0 }, { ...a, id: void 0 }) : typeof s == "string" && typeof a == "string" ? s.toLowerCase() === a.toLowerCase() : s === a);
3913
+ return typeof s == "number" && typeof a == "number" ? d(Math.abs(s - a) < 0.01) : A(s) && A(a) ? d(Tr(s, a)) : d(t === "Coding" && i2 === "Coding" ? typeof s != "object" || typeof a != "object" ? false : s.code === a.code && s.system === a.system : typeof s == "object" && typeof a == "object" ? gt({ ...s, id: void 0 }, { ...a, id: void 0 }) : typeof s == "string" && typeof a == "string" ? s.toLowerCase() === a.toLowerCase() : s === a);
3909
3914
  }
3910
- function ur(r4, e) {
3915
+ function mr(r4, e) {
3911
3916
  let t = r4.value?.valueOf(), n = e.value?.valueOf();
3912
3917
  return typeof t == "number" && typeof n == "number" ? t - n : typeof t == "string" && typeof n == "string" ? t.localeCompare(n) : 0;
3913
3918
  }
3914
- function Ae(r4, e) {
3919
+ function Pe(r4, e) {
3915
3920
  let { value: t } = r4;
3916
3921
  if (t == null)
3917
3922
  return false;
@@ -3928,44 +3933,44 @@ function Ae(r4, e) {
3928
3933
  case "Time":
3929
3934
  return typeof t == "string" && !!/^T\d/.exec(t);
3930
3935
  case "Period":
3931
- return Fn(t);
3936
+ return Wn(t);
3932
3937
  case "Quantity":
3933
3938
  return A(t);
3934
3939
  default:
3935
3940
  return typeof t == "object" && t?.resourceType === e;
3936
3941
  }
3937
3942
  }
3938
- function Fn(r4) {
3943
+ function Wn(r4) {
3939
3944
  return !!(r4 && typeof r4 == "object" && "start" in r4);
3940
3945
  }
3941
3946
  function A(r4) {
3942
3947
  return !!(r4 && typeof r4 == "object" && "value" in r4 && typeof r4.value == "number");
3943
3948
  }
3944
- function fr(r4, e) {
3949
+ function Tr(r4, e) {
3945
3950
  return Math.abs(r4.value - e.value) < 0.01 && (r4.unit === e.unit || r4.code === e.code || r4.unit === e.code || r4.code === e.unit);
3946
3951
  }
3947
- function mt(r4, e) {
3952
+ function gt(r4, e) {
3948
3953
  let t = Object.keys(r4), n = Object.keys(e);
3949
3954
  if (t.length !== n.length)
3950
3955
  return false;
3951
3956
  for (let i2 of t) {
3952
3957
  let o = r4[i2], s = e[i2];
3953
- if (dr(o) && dr(s)) {
3954
- if (!mt(o, s))
3958
+ if (yr(o) && yr(s)) {
3959
+ if (!gt(o, s))
3955
3960
  return false;
3956
3961
  } else if (o !== s)
3957
3962
  return false;
3958
3963
  }
3959
3964
  return true;
3960
3965
  }
3961
- function dr(r4) {
3966
+ function yr(r4) {
3962
3967
  return r4 !== null && typeof r4 == "object";
3963
3968
  }
3964
- function lr(r4, e) {
3969
+ function gr(r4, e) {
3965
3970
  return delete e.__proto__, delete e.constructor, Object.assign(r4, e);
3966
3971
  }
3967
- var se = () => [];
3968
- var R = { empty: (r4, e) => d(e.length === 0), exists: (r4, e, t) => t ? d(e.filter((n) => N(t.eval(r4, [n]))).length > 0) : d(e.length > 0), all: (r4, e, t) => d(e.every((n) => N(t.eval(r4, [n])))), allTrue: (r4, e) => {
3972
+ var ue = () => [];
3973
+ var S = { empty: (r4, e) => d(e.length === 0), exists: (r4, e, t) => t ? d(e.filter((n) => M(t.eval(r4, [n]))).length > 0) : d(e.length > 0), all: (r4, e, t) => d(e.every((n) => M(t.eval(r4, [n])))), allTrue: (r4, e) => {
3969
3974
  for (let t of e)
3970
3975
  if (!t.value)
3971
3976
  return d(false);
@@ -3985,12 +3990,12 @@ var R = { empty: (r4, e) => d(e.length === 0), exists: (r4, e, t) => t ? d(e.fil
3985
3990
  if (!t.value)
3986
3991
  return d(true);
3987
3992
  return d(false);
3988
- }, subsetOf: se, supersetOf: se, count: (r4, e) => [{ type: "integer", value: e.length }], distinct: (r4, e) => {
3993
+ }, subsetOf: ue, supersetOf: ue, count: (r4, e) => [{ type: "integer", value: e.length }], distinct: (r4, e) => {
3989
3994
  let t = [];
3990
3995
  for (let n of e)
3991
3996
  t.some((i2) => i2.value === n.value) || t.push(n);
3992
3997
  return t;
3993
- }, isDistinct: (r4, e) => d(e.length === R.distinct(r4, e).length), where: (r4, e, t) => e.filter((n) => N(t.eval(r4, [n]))), select: (r4, e, t) => e.map((n) => t.eval(r4, [n])).flat(), repeat: se, ofType: (r4, e, t) => e.filter((n) => n.type === t.name), single: (r4, e) => {
3998
+ }, isDistinct: (r4, e) => d(e.length === S.distinct(r4, e).length), where: (r4, e, t) => e.filter((n) => M(t.eval(r4, [n]))), select: (r4, e, t) => e.map((n) => t.eval(r4, [n])).flat(), repeat: ue, ofType: (r4, e, t) => e.filter((n) => n.type === t.name), single: (r4, e) => {
3994
3999
  if (e.length > 1)
3995
4000
  throw new Error("Expected input length one for single()");
3996
4001
  return e.length === 0 ? [] : e.slice(0, 1);
@@ -4022,17 +4027,17 @@ var R = { empty: (r4, e) => d(e.length === 0), exists: (r4, e, t) => t ? d(e.fil
4022
4027
  if (!t)
4023
4028
  return e;
4024
4029
  let n = t.eval(r4, e);
4025
- return Re([...e, ...n]);
4030
+ return Ee([...e, ...n]);
4026
4031
  }, combine: (r4, e, t) => {
4027
4032
  if (!t)
4028
4033
  return e;
4029
4034
  let n = t.eval(r4, e);
4030
4035
  return [...e, ...n];
4031
- }, htmlChecks: (r4, e, t) => [T(true)], iif: (r4, e, t, n, i2) => {
4036
+ }, htmlChecks: (r4, e, t) => [x(true)], iif: (r4, e, t, n, i2) => {
4032
4037
  let o = t.eval(r4, e);
4033
4038
  if (o.length > 1 || o.length === 1 && typeof o[0].value != "boolean")
4034
4039
  throw new Error("Expected criterion to evaluate to a Boolean");
4035
- return N(o) ? n.eval(r4, e) : i2 ? i2.eval(r4, e) : [];
4040
+ return M(o) ? n.eval(r4, e) : i2 ? i2.eval(r4, e) : [];
4036
4041
  }, toBoolean: (r4, e) => {
4037
4042
  if (e.length === 0)
4038
4043
  return [];
@@ -4049,72 +4054,72 @@ var R = { empty: (r4, e) => d(e.length === 0), exists: (r4, e, t) => t ? d(e.fil
4049
4054
  return d(false);
4050
4055
  }
4051
4056
  return [];
4052
- }, convertsToBoolean: (r4, e) => e.length === 0 ? [] : d(R.toBoolean(r4, e).length === 1), toInteger: (r4, e) => {
4057
+ }, convertsToBoolean: (r4, e) => e.length === 0 ? [] : d(S.toBoolean(r4, e).length === 1), toInteger: (r4, e) => {
4053
4058
  if (e.length === 0)
4054
4059
  return [];
4055
4060
  let [{ value: t }] = U(e, 1);
4056
4061
  return typeof t == "number" ? [{ type: "integer", value: t }] : typeof t == "string" && /^[+-]?\d+$/.exec(t) ? [{ type: "integer", value: parseInt(t, 10) }] : typeof t == "boolean" ? [{ type: "integer", value: t ? 1 : 0 }] : [];
4057
- }, convertsToInteger: (r4, e) => e.length === 0 ? [] : d(R.toInteger(r4, e).length === 1), toDate: (r4, e) => {
4062
+ }, convertsToInteger: (r4, e) => e.length === 0 ? [] : d(S.toInteger(r4, e).length === 1), toDate: (r4, e) => {
4058
4063
  if (e.length === 0)
4059
4064
  return [];
4060
4065
  let [{ value: t }] = U(e, 1);
4061
- return typeof t == "string" && /^\d{4}(-\d{2}(-\d{2})?)?/.exec(t) ? [{ type: "date", value: Z(t) }] : [];
4062
- }, convertsToDate: (r4, e) => e.length === 0 ? [] : d(R.toDate(r4, e).length === 1), toDateTime: (r4, e) => {
4066
+ return typeof t == "string" && /^\d{4}(-\d{2}(-\d{2})?)?/.exec(t) ? [{ type: "date", value: te(t) }] : [];
4067
+ }, convertsToDate: (r4, e) => e.length === 0 ? [] : d(S.toDate(r4, e).length === 1), toDateTime: (r4, e) => {
4063
4068
  if (e.length === 0)
4064
4069
  return [];
4065
4070
  let [{ value: t }] = U(e, 1);
4066
- return typeof t == "string" && /^\d{4}(-\d{2}(-\d{2})?)?/.exec(t) ? [{ type: "dateTime", value: Z(t) }] : [];
4067
- }, convertsToDateTime: (r4, e) => e.length === 0 ? [] : d(R.toDateTime(r4, e).length === 1), toDecimal: (r4, e) => {
4071
+ return typeof t == "string" && /^\d{4}(-\d{2}(-\d{2})?)?/.exec(t) ? [{ type: "dateTime", value: te(t) }] : [];
4072
+ }, convertsToDateTime: (r4, e) => e.length === 0 ? [] : d(S.toDateTime(r4, e).length === 1), toDecimal: (r4, e) => {
4068
4073
  if (e.length === 0)
4069
4074
  return [];
4070
4075
  let [{ value: t }] = U(e, 1);
4071
4076
  return typeof t == "number" ? [{ type: "decimal", value: t }] : typeof t == "string" && /^-?\d{1,9}(\.\d{1,9})?$/.exec(t) ? [{ type: "decimal", value: parseFloat(t) }] : typeof t == "boolean" ? [{ type: "decimal", value: t ? 1 : 0 }] : [];
4072
- }, convertsToDecimal: (r4, e) => e.length === 0 ? [] : d(R.toDecimal(r4, e).length === 1), toQuantity: (r4, e) => {
4077
+ }, convertsToDecimal: (r4, e) => e.length === 0 ? [] : d(S.toDecimal(r4, e).length === 1), toQuantity: (r4, e) => {
4073
4078
  if (e.length === 0)
4074
4079
  return [];
4075
4080
  let [{ value: t }] = U(e, 1);
4076
4081
  return A(t) ? [{ type: "Quantity", value: t }] : typeof t == "number" ? [{ type: "Quantity", value: { value: t, unit: "1" } }] : typeof t == "string" && /^-?\d{1,9}(\.\d{1,9})?/.exec(t) ? [{ type: "Quantity", value: { value: parseFloat(t), unit: "1" } }] : typeof t == "boolean" ? [{ type: "Quantity", value: { value: t ? 1 : 0, unit: "1" } }] : [];
4077
- }, convertsToQuantity: (r4, e) => e.length === 0 ? [] : d(R.toQuantity(r4, e).length === 1), toString: (r4, e) => {
4082
+ }, convertsToQuantity: (r4, e) => e.length === 0 ? [] : d(S.toQuantity(r4, e).length === 1), toString: (r4, e) => {
4078
4083
  if (e.length === 0)
4079
4084
  return [];
4080
4085
  let [{ value: t }] = U(e, 1);
4081
4086
  return t == null ? [] : A(t) ? [{ type: "string", value: `${t.value} '${t.unit}'` }] : [{ type: "string", value: t.toString() }];
4082
- }, convertsToString: (r4, e) => e.length === 0 ? [] : d(R.toString(r4, e).length === 1), toTime: (r4, e) => {
4087
+ }, convertsToString: (r4, e) => e.length === 0 ? [] : d(S.toString(r4, e).length === 1), toTime: (r4, e) => {
4083
4088
  if (e.length === 0)
4084
4089
  return [];
4085
4090
  let [{ value: t }] = U(e, 1);
4086
4091
  if (typeof t == "string") {
4087
4092
  let n = /^T?(\d{2}(:\d{2}(:\d{2})?)?)/.exec(t);
4088
4093
  if (n)
4089
- return [{ type: "time", value: Z("T" + n[1]) }];
4094
+ return [{ type: "time", value: te("T" + n[1]) }];
4090
4095
  }
4091
4096
  return [];
4092
- }, convertsToTime: (r4, e) => e.length === 0 ? [] : d(R.toTime(r4, e).length === 1), indexOf: (r4, e, t) => C((n, i2) => n.indexOf(i2), r4, e, t), substring: (r4, e, t, n) => C((i2, o, s) => {
4097
+ }, convertsToTime: (r4, e) => e.length === 0 ? [] : d(S.toTime(r4, e).length === 1), indexOf: (r4, e, t) => C((n, i2) => n.indexOf(i2), r4, e, t), substring: (r4, e, t, n) => C((i2, o, s) => {
4093
4098
  let a = o, c2 = s ? a + s : i2.length;
4094
4099
  return a < 0 || a >= i2.length ? void 0 : i2.substring(a, c2);
4095
- }, r4, e, t, n), startsWith: (r4, e, t) => C((n, i2) => n.startsWith(i2), r4, e, t), endsWith: (r4, e, t) => C((n, i2) => n.endsWith(i2), r4, e, t), contains: (r4, e, t) => C((n, i2) => n.includes(i2), r4, e, t), upper: (r4, e) => C((t) => t.toUpperCase(), r4, e), lower: (r4, e) => C((t) => t.toLowerCase(), r4, e), replace: (r4, e, t, n) => C((i2, o, s) => i2.replaceAll(o, s), r4, e, t, n), matches: (r4, e, t) => C((n, i2) => !!new RegExp(i2).exec(n), r4, e, t), replaceMatches: (r4, e, t, n) => C((i2, o, s) => i2.replaceAll(o, s), r4, e, t, n), length: (r4, e) => C((t) => t.length, r4, e), toChars: (r4, e) => C((t) => t ? t.split("") : void 0, r4, e), abs: (r4, e) => V(Math.abs, r4, e), ceiling: (r4, e) => V(Math.ceil, r4, e), exp: (r4, e) => V(Math.exp, r4, e), floor: (r4, e) => V(Math.floor, r4, e), ln: (r4, e) => V(Math.log, r4, e), log: (r4, e, t) => V((n, i2) => Math.log(n) / Math.log(i2), r4, e, t), power: (r4, e, t) => V(Math.pow, r4, e, t), round: (r4, e) => V(Math.round, r4, e), sqrt: (r4, e) => V(Math.sqrt, r4, e), truncate: (r4, e) => V((t) => t | 0, r4, e), children: se, descendants: se, trace: (r4, e, t) => (console.log("trace", e, t), e), now: () => [{ type: "dateTime", value: (/* @__PURE__ */ new Date()).toISOString() }], timeOfDay: () => [{ type: "time", value: (/* @__PURE__ */ new Date()).toISOString().substring(11) }], today: () => [{ type: "date", value: (/* @__PURE__ */ new Date()).toISOString().substring(0, 10) }], between: (r4, e, t, n, i2) => {
4096
- let o = R.toDateTime(r4, t.eval(r4, e));
4100
+ }, r4, e, t, n), startsWith: (r4, e, t) => C((n, i2) => n.startsWith(i2), r4, e, t), endsWith: (r4, e, t) => C((n, i2) => n.endsWith(i2), r4, e, t), contains: (r4, e, t) => C((n, i2) => n.includes(i2), r4, e, t), upper: (r4, e) => C((t) => t.toUpperCase(), r4, e), lower: (r4, e) => C((t) => t.toLowerCase(), r4, e), replace: (r4, e, t, n) => C((i2, o, s) => i2.replaceAll(o, s), r4, e, t, n), matches: (r4, e, t) => C((n, i2) => !!new RegExp(i2).exec(n), r4, e, t), replaceMatches: (r4, e, t, n) => C((i2, o, s) => i2.replaceAll(o, s), r4, e, t, n), length: (r4, e) => C((t) => t.length, r4, e), toChars: (r4, e) => C((t) => t ? t.split("") : void 0, r4, e), abs: (r4, e) => V(Math.abs, r4, e), ceiling: (r4, e) => V(Math.ceil, r4, e), exp: (r4, e) => V(Math.exp, r4, e), floor: (r4, e) => V(Math.floor, r4, e), ln: (r4, e) => V(Math.log, r4, e), log: (r4, e, t) => V((n, i2) => Math.log(n) / Math.log(i2), r4, e, t), power: (r4, e, t) => V(Math.pow, r4, e, t), round: (r4, e) => V(Math.round, r4, e), sqrt: (r4, e) => V(Math.sqrt, r4, e), truncate: (r4, e) => V((t) => t | 0, r4, e), children: ue, descendants: ue, trace: (r4, e, t) => (console.log("trace", e, t), e), now: () => [{ type: "dateTime", value: (/* @__PURE__ */ new Date()).toISOString() }], timeOfDay: () => [{ type: "time", value: (/* @__PURE__ */ new Date()).toISOString().substring(11) }], today: () => [{ type: "date", value: (/* @__PURE__ */ new Date()).toISOString().substring(0, 10) }], between: (r4, e, t, n, i2) => {
4101
+ let o = S.toDateTime(r4, t.eval(r4, e));
4097
4102
  if (o.length === 0)
4098
4103
  throw new Error("Invalid start date");
4099
- let s = R.toDateTime(r4, n.eval(r4, e));
4104
+ let s = S.toDateTime(r4, n.eval(r4, e));
4100
4105
  if (s.length === 0)
4101
4106
  throw new Error("Invalid end date");
4102
4107
  let a = i2.eval(r4, e)[0]?.value;
4103
4108
  if (a !== "years" && a !== "months" && a !== "days")
4104
4109
  throw new Error("Invalid units");
4105
- let c2 = ye(o[0].value, s[0].value);
4110
+ let c2 = xe(o[0].value, s[0].value);
4106
4111
  return [{ type: "Quantity", value: { value: c2[a], unit: a } }];
4107
4112
  }, is: (r4, e, t) => {
4108
4113
  let n = "";
4109
- return t instanceof M ? n = t.name : t instanceof H && (n = t.left.name + "." + t.right.name), n ? e.map((i2) => ({ type: "boolean", value: Ae(i2, n) })) : [];
4110
- }, not: (r4, e) => R.toBoolean(r4, e).map((t) => ({ type: "boolean", value: !t.value })), resolve: (r4, e) => e.map((t) => {
4114
+ return t instanceof N ? n = t.name : t instanceof H && (n = t.left.name + "." + t.right.name), n ? e.map((i2) => ({ type: "boolean", value: Pe(i2, n) })) : [];
4115
+ }, not: (r4, e) => S.toBoolean(r4, e).map((t) => ({ type: "boolean", value: !t.value })), resolve: (r4, e) => e.map((t) => {
4111
4116
  let n = t.value, i2;
4112
4117
  if (typeof n == "string")
4113
4118
  i2 = n;
4114
4119
  else if (typeof n == "object") {
4115
4120
  let o = n;
4116
4121
  if (o.resource)
4117
- return T(o.resource);
4122
+ return x(o.resource);
4118
4123
  o.reference ? i2 = o.reference : o.type && o.identifier && (i2 = `${o.type}?identifier=${o.identifier.system}|${o.identifier.value}`);
4119
4124
  }
4120
4125
  if (i2?.includes("?")) {
@@ -4140,7 +4145,7 @@ function C(r4, e, t, ...n) {
4140
4145
  if (typeof i2 != "string")
4141
4146
  throw new Error("String function cannot be called with non-string");
4142
4147
  let o = r4(i2, ...n.map((s) => s?.eval(e, t)[0]?.value));
4143
- return o === void 0 ? [] : Array.isArray(o) ? o.map(T) : [T(o)];
4148
+ return o === void 0 ? [] : Array.isArray(o) ? o.map(x) : [x(o)];
4144
4149
  }
4145
4150
  function V(r4, e, t, ...n) {
4146
4151
  if (t.length === 0)
@@ -4148,8 +4153,8 @@ function V(r4, e, t, ...n) {
4148
4153
  let [{ value: i2 }] = U(t, 1), o = A(i2), s = o ? i2.value : i2;
4149
4154
  if (typeof s != "number")
4150
4155
  throw new Error("Math function cannot be called with non-number");
4151
- let a = r4(s, ...n.map((l2) => l2.eval(e, t)[0]?.value)), c2 = o ? "Quantity" : t[0].type, p2 = o ? { ...i2, value: a } : a;
4152
- return [{ type: c2, value: p2 }];
4156
+ let a = r4(s, ...n.map((l2) => l2.eval(e, t)[0]?.value)), c2 = o ? "Quantity" : t[0].type, f = o ? { ...i2, value: a } : a;
4157
+ return [{ type: c2, value: f }];
4153
4158
  }
4154
4159
  function U(r4, e) {
4155
4160
  if (r4.length !== e)
@@ -4159,7 +4164,7 @@ function U(r4, e) {
4159
4164
  throw new Error("Expected non-null argument");
4160
4165
  return r4;
4161
4166
  }
4162
- var k = class {
4167
+ var I = class {
4163
4168
  constructor(e) {
4164
4169
  this.value = e;
4165
4170
  }
@@ -4171,7 +4176,7 @@ var k = class {
4171
4176
  return typeof e == "string" ? `'${e}'` : e.toString();
4172
4177
  }
4173
4178
  };
4174
- var M = class {
4179
+ var N = class {
4175
4180
  constructor(e) {
4176
4181
  this.name = e;
4177
4182
  }
@@ -4189,13 +4194,13 @@ var M = class {
4189
4194
  evalValue(e) {
4190
4195
  let t = e.value;
4191
4196
  if (!(!t || typeof t != "object"))
4192
- return _(t) && t.resourceType === this.name ? e : P(e, this.name);
4197
+ return _(t) && t.resourceType === this.name ? e : E(e, this.name);
4193
4198
  }
4194
4199
  toString() {
4195
4200
  return this.name;
4196
4201
  }
4197
4202
  };
4198
- var Pe = class {
4203
+ var we = class {
4199
4204
  eval() {
4200
4205
  return [];
4201
4206
  }
@@ -4203,7 +4208,7 @@ var Pe = class {
4203
4208
  return "{}";
4204
4209
  }
4205
4210
  };
4206
- var Ce = class extends be {
4211
+ var Ie = class extends Se {
4207
4212
  constructor(t, n, i2) {
4208
4213
  super(t, n);
4209
4214
  this.impl = i2;
@@ -4215,17 +4220,17 @@ var Ce = class extends be {
4215
4220
  return this.operator + this.child.toString();
4216
4221
  }
4217
4222
  };
4218
- var z = class extends $ {
4223
+ var K = class extends $ {
4219
4224
  constructor(e, t) {
4220
4225
  super("as", e, t);
4221
4226
  }
4222
4227
  eval(e, t) {
4223
- return R.ofType(e, this.left.eval(e, t), this.right);
4228
+ return S.ofType(e, this.left.eval(e, t), this.right);
4224
4229
  }
4225
4230
  };
4226
4231
  var v = class extends $ {
4227
4232
  };
4228
- var E = class extends v {
4233
+ var P = class extends v {
4229
4234
  constructor(t, n, i2, o) {
4230
4235
  super(t, n, i2);
4231
4236
  this.impl = o;
@@ -4237,11 +4242,11 @@ var E = class extends v {
4237
4242
  let o = this.right.eval(t, n);
4238
4243
  if (o.length !== 1)
4239
4244
  return [];
4240
- let s = i2[0].value, a = o[0].value, c2 = A(s) ? s.value : s, p2 = A(a) ? a.value : a, l2 = this.impl(c2, p2);
4241
- return typeof l2 == "boolean" ? d(l2) : A(s) ? [{ type: "Quantity", value: { ...s, value: l2 } }] : [T(l2)];
4245
+ let s = i2[0].value, a = o[0].value, c2 = A(s) ? s.value : s, f = A(a) ? a.value : a, l2 = this.impl(c2, f);
4246
+ return typeof l2 == "boolean" ? d(l2) : A(s) ? [{ type: "Quantity", value: { ...s, value: l2 } }] : [x(l2)];
4242
4247
  }
4243
4248
  };
4244
- var we = class extends $ {
4249
+ var ke = class extends $ {
4245
4250
  constructor(e, t) {
4246
4251
  super("&", e, t);
4247
4252
  }
@@ -4250,7 +4255,7 @@ var we = class extends $ {
4250
4255
  return o.length > 0 && o.every((s) => typeof s.value == "string") ? [{ type: "string", value: o.map((s) => s.value).join("") }] : o;
4251
4256
  }
4252
4257
  };
4253
- var ke = class extends v {
4258
+ var De = class extends v {
4254
4259
  constructor(e, t) {
4255
4260
  super("contains", e, t);
4256
4261
  }
@@ -4259,7 +4264,7 @@ var ke = class extends v {
4259
4264
  return d(n.some((o) => o.value === i2[0].value));
4260
4265
  }
4261
4266
  };
4262
- var De = class extends v {
4267
+ var Oe = class extends v {
4263
4268
  constructor(e, t) {
4264
4269
  super("in", e, t);
4265
4270
  }
@@ -4279,52 +4284,52 @@ var H = class extends $ {
4279
4284
  return `${this.left.toString()}.${this.right.toString()}`;
4280
4285
  }
4281
4286
  };
4282
- var ee = class extends $ {
4287
+ var re = class extends $ {
4283
4288
  constructor(e, t) {
4284
4289
  super("|", e, t);
4285
4290
  }
4286
4291
  eval(e, t) {
4287
4292
  let n = this.left.eval(e, t), i2 = this.right.eval(e, t);
4288
- return Re([...n, ...i2]);
4293
+ return Ee([...n, ...i2]);
4289
4294
  }
4290
4295
  };
4291
- var Ie = class extends v {
4296
+ var Ve = class extends v {
4292
4297
  constructor(e, t) {
4293
4298
  super("=", e, t);
4294
4299
  }
4295
4300
  eval(e, t) {
4296
4301
  let n = this.left.eval(e, t), i2 = this.right.eval(e, t);
4297
- return pt(n, i2);
4302
+ return mt(n, i2);
4298
4303
  }
4299
4304
  };
4300
- var Oe = class extends v {
4305
+ var Ue = class extends v {
4301
4306
  constructor(e, t) {
4302
4307
  super("!=", e, t);
4303
4308
  }
4304
4309
  eval(e, t) {
4305
4310
  let n = this.left.eval(e, t), i2 = this.right.eval(e, t);
4306
- return lt(pt(n, i2));
4311
+ return ht(mt(n, i2));
4307
4312
  }
4308
4313
  };
4309
- var Ve = class extends v {
4314
+ var Le = class extends v {
4310
4315
  constructor(e, t) {
4311
4316
  super("~", e, t);
4312
4317
  }
4313
4318
  eval(e, t) {
4314
4319
  let n = this.left.eval(e, t), i2 = this.right.eval(e, t);
4315
- return ft(n, i2);
4320
+ return yt(n, i2);
4316
4321
  }
4317
4322
  };
4318
- var Ue = class extends v {
4323
+ var _e = class extends v {
4319
4324
  constructor(e, t) {
4320
4325
  super("!~", e, t);
4321
4326
  }
4322
4327
  eval(e, t) {
4323
4328
  let n = this.left.eval(e, t), i2 = this.right.eval(e, t);
4324
- return lt(ft(n, i2));
4329
+ return ht(yt(n, i2));
4325
4330
  }
4326
4331
  };
4327
- var K = class extends v {
4332
+ var J = class extends v {
4328
4333
  constructor(e, t) {
4329
4334
  super("is", e, t);
4330
4335
  }
@@ -4333,10 +4338,10 @@ var K = class extends v {
4333
4338
  if (n.length !== 1)
4334
4339
  return [];
4335
4340
  let i2 = this.right.name;
4336
- return d(Ae(n[0], i2));
4341
+ return d(Pe(n[0], i2));
4337
4342
  }
4338
4343
  };
4339
- var Le = class extends v {
4344
+ var Me = class extends v {
4340
4345
  constructor(e, t) {
4341
4346
  super("and", e, t);
4342
4347
  }
@@ -4345,7 +4350,7 @@ var Le = class extends v {
4345
4350
  return n?.value === true && i2?.value === true ? d(true) : n?.value === false || i2?.value === false ? d(false) : [];
4346
4351
  }
4347
4352
  };
4348
- var _e = class extends v {
4353
+ var Ne = class extends v {
4349
4354
  constructor(e, t) {
4350
4355
  super("or", e, t);
4351
4356
  }
@@ -4354,7 +4359,7 @@ var _e = class extends v {
4354
4359
  return n?.value === false && i2?.value === false ? d(false) : n?.value || i2?.value ? d(true) : [];
4355
4360
  }
4356
4361
  };
4357
- var Ne = class extends v {
4362
+ var Be = class extends v {
4358
4363
  constructor(e, t) {
4359
4364
  super("xor", e, t);
4360
4365
  }
@@ -4363,7 +4368,7 @@ var Ne = class extends v {
4363
4368
  return !n || !i2 ? [] : d(n.value !== i2.value);
4364
4369
  }
4365
4370
  };
4366
- var Me = class extends v {
4371
+ var Fe = class extends v {
4367
4372
  constructor(e, t) {
4368
4373
  super("implies", e, t);
4369
4374
  }
@@ -4378,7 +4383,7 @@ var B = class {
4378
4383
  this.args = t;
4379
4384
  }
4380
4385
  eval(e, t) {
4381
- let n = R[this.name];
4386
+ let n = S[this.name];
4382
4387
  if (!n)
4383
4388
  throw new Error("Unrecognized function: " + this.name);
4384
4389
  return n(e, t, ...this.args);
@@ -4387,7 +4392,7 @@ var B = class {
4387
4392
  return `${this.name}(${this.args.map((e) => e.toString()).join(", ")})`;
4388
4393
  }
4389
4394
  };
4390
- var J = class {
4395
+ var Y = class {
4391
4396
  constructor(e, t) {
4392
4397
  this.left = e;
4393
4398
  this.expr = t;
@@ -4406,60 +4411,60 @@ var J = class {
4406
4411
  return `${this.left.toString()}[${this.expr.toString()}]`;
4407
4412
  }
4408
4413
  };
4409
- var ce = ["!=", "!~", "<=", ">=", "{}", "->"];
4410
- var f = { FunctionCall: 0, Dot: 1, Indexer: 2, UnaryAdd: 3, UnarySubtract: 3, Multiply: 4, Divide: 4, IntegerDivide: 4, Modulo: 4, Add: 5, Subtract: 5, Ampersand: 5, Is: 6, As: 6, Union: 7, GreaterThan: 8, GreaterThanOrEquals: 8, LessThan: 8, LessThanOrEquals: 8, Equals: 9, Equivalent: 9, NotEquals: 9, NotEquivalent: 9, In: 10, Contains: 10, And: 11, Xor: 12, Or: 12, Implies: 13, Arrow: 100, Semicolon: 200 };
4411
- var qn = { parse(r4) {
4414
+ var le = ["!=", "!~", "<=", ">=", "{}", "->"];
4415
+ var p = { FunctionCall: 0, Dot: 1, Indexer: 2, UnaryAdd: 3, UnarySubtract: 3, Multiply: 4, Divide: 4, IntegerDivide: 4, Modulo: 4, Add: 5, Subtract: 5, Ampersand: 5, Is: 6, As: 6, Union: 7, GreaterThan: 8, GreaterThanOrEquals: 8, LessThan: 8, LessThanOrEquals: 8, Equals: 9, Equivalent: 9, NotEquals: 9, NotEquivalent: 9, In: 10, Contains: 10, And: 11, Xor: 12, Or: 12, Implies: 13, Arrow: 100, Semicolon: 200 };
4416
+ var Gn = { parse(r4) {
4412
4417
  let e = r4.consumeAndParse();
4413
4418
  if (!r4.match(")"))
4414
4419
  throw new Error("Parse error: expected `)` got `" + r4.peek()?.value + "`");
4415
4420
  return e;
4416
4421
  } };
4417
- var jn = { parse(r4, e) {
4422
+ var zn = { parse(r4, e) {
4418
4423
  let t = r4.consumeAndParse();
4419
4424
  if (!r4.match("]"))
4420
4425
  throw new Error("Parse error: expected `]`");
4421
- return new J(e, t);
4422
- }, precedence: f.Indexer };
4423
- var $n = { parse(r4, e) {
4424
- if (!(e instanceof M))
4426
+ return new Y(e, t);
4427
+ }, precedence: p.Indexer };
4428
+ var Kn = { parse(r4, e) {
4429
+ if (!(e instanceof N))
4425
4430
  throw new Error("Unexpected parentheses");
4426
4431
  let t = [];
4427
4432
  for (; !r4.match(")"); )
4428
4433
  t.push(r4.consumeAndParse()), r4.match(",");
4429
4434
  return new B(e.name, t);
4430
- }, precedence: f.FunctionCall };
4431
- function Qn(r4) {
4435
+ }, precedence: p.FunctionCall };
4436
+ function Jn(r4) {
4432
4437
  let e = r4.split(" "), t = parseFloat(e[0]), n = e[1];
4433
4438
  return n?.startsWith("'") && n.endsWith("'") ? n = n.substring(1, n.length - 1) : n = "{" + n + "}", { value: t, unit: n };
4434
4439
  }
4435
- function ue() {
4436
- return new Se().registerPrefix("String", { parse: (r4, e) => new k({ type: "string", value: e.value }) }).registerPrefix("DateTime", { parse: (r4, e) => new k({ type: "dateTime", value: Z(e.value) }) }).registerPrefix("Quantity", { parse: (r4, e) => new k({ type: "Quantity", value: Qn(e.value) }) }).registerPrefix("Number", { parse: (r4, e) => new k({ type: "decimal", value: parseFloat(e.value) }) }).registerPrefix("true", { parse: () => new k({ type: "boolean", value: true }) }).registerPrefix("false", { parse: () => new k({ type: "boolean", value: false }) }).registerPrefix("Symbol", { parse: (r4, e) => new M(e.value) }).registerPrefix("{}", { parse: () => new Pe() }).registerPrefix("(", qn).registerInfix("[", jn).registerInfix("(", $n).prefix("+", f.UnaryAdd, (r4, e) => new Ce("+", e, (t) => t)).prefix("-", f.UnarySubtract, (r4, e) => new E("-", e, e, (t, n) => -n)).infixLeft(".", f.Dot, (r4, e, t) => new H(r4, t)).infixLeft("/", f.Divide, (r4, e, t) => new E("/", r4, t, (n, i2) => n / i2)).infixLeft("*", f.Multiply, (r4, e, t) => new E("*", r4, t, (n, i2) => n * i2)).infixLeft("+", f.Add, (r4, e, t) => new E("+", r4, t, (n, i2) => n + i2)).infixLeft("-", f.Subtract, (r4, e, t) => new E("-", r4, t, (n, i2) => n - i2)).infixLeft("|", f.Union, (r4, e, t) => new ee(r4, t)).infixLeft("=", f.Equals, (r4, e, t) => new Ie(r4, t)).infixLeft("!=", f.NotEquals, (r4, e, t) => new Oe(r4, t)).infixLeft("~", f.Equivalent, (r4, e, t) => new Ve(r4, t)).infixLeft("!~", f.NotEquivalent, (r4, e, t) => new Ue(r4, t)).infixLeft("<", f.LessThan, (r4, e, t) => new E("<", r4, t, (n, i2) => n < i2)).infixLeft("<=", f.LessThanOrEquals, (r4, e, t) => new E("<=", r4, t, (n, i2) => n <= i2)).infixLeft(">", f.GreaterThan, (r4, e, t) => new E(">", r4, t, (n, i2) => n > i2)).infixLeft(">=", f.GreaterThanOrEquals, (r4, e, t) => new E(">=", r4, t, (n, i2) => n >= i2)).infixLeft("&", f.Ampersand, (r4, e, t) => new we(r4, t)).infixLeft("and", f.And, (r4, e, t) => new Le(r4, t)).infixLeft("as", f.As, (r4, e, t) => new z(r4, t)).infixLeft("contains", f.Contains, (r4, e, t) => new ke(r4, t)).infixLeft("div", f.Divide, (r4, e, t) => new E("div", r4, t, (n, i2) => n / i2 | 0)).infixLeft("in", f.In, (r4, e, t) => new De(r4, t)).infixLeft("is", f.Is, (r4, e, t) => new K(r4, t)).infixLeft("mod", f.Modulo, (r4, e, t) => new E("mod", r4, t, (n, i2) => n % i2)).infixLeft("or", f.Or, (r4, e, t) => new _e(r4, t)).infixLeft("xor", f.Xor, (r4, e, t) => new Ne(r4, t)).infixLeft("implies", f.Implies, (r4, e, t) => new Me(r4, t));
4440
+ function pe() {
4441
+ return new Ae().registerPrefix("String", { parse: (r4, e) => new I({ type: "string", value: e.value }) }).registerPrefix("DateTime", { parse: (r4, e) => new I({ type: "dateTime", value: te(e.value) }) }).registerPrefix("Quantity", { parse: (r4, e) => new I({ type: "Quantity", value: Jn(e.value) }) }).registerPrefix("Number", { parse: (r4, e) => new I({ type: "decimal", value: parseFloat(e.value) }) }).registerPrefix("true", { parse: () => new I({ type: "boolean", value: true }) }).registerPrefix("false", { parse: () => new I({ type: "boolean", value: false }) }).registerPrefix("Symbol", { parse: (r4, e) => new N(e.value) }).registerPrefix("{}", { parse: () => new we() }).registerPrefix("(", Gn).registerInfix("[", zn).registerInfix("(", Kn).prefix("+", p.UnaryAdd, (r4, e) => new Ie("+", e, (t) => t)).prefix("-", p.UnarySubtract, (r4, e) => new P("-", e, e, (t, n) => -n)).infixLeft(".", p.Dot, (r4, e, t) => new H(r4, t)).infixLeft("/", p.Divide, (r4, e, t) => new P("/", r4, t, (n, i2) => n / i2)).infixLeft("*", p.Multiply, (r4, e, t) => new P("*", r4, t, (n, i2) => n * i2)).infixLeft("+", p.Add, (r4, e, t) => new P("+", r4, t, (n, i2) => n + i2)).infixLeft("-", p.Subtract, (r4, e, t) => new P("-", r4, t, (n, i2) => n - i2)).infixLeft("|", p.Union, (r4, e, t) => new re(r4, t)).infixLeft("=", p.Equals, (r4, e, t) => new Ve(r4, t)).infixLeft("!=", p.NotEquals, (r4, e, t) => new Ue(r4, t)).infixLeft("~", p.Equivalent, (r4, e, t) => new Le(r4, t)).infixLeft("!~", p.NotEquivalent, (r4, e, t) => new _e(r4, t)).infixLeft("<", p.LessThan, (r4, e, t) => new P("<", r4, t, (n, i2) => n < i2)).infixLeft("<=", p.LessThanOrEquals, (r4, e, t) => new P("<=", r4, t, (n, i2) => n <= i2)).infixLeft(">", p.GreaterThan, (r4, e, t) => new P(">", r4, t, (n, i2) => n > i2)).infixLeft(">=", p.GreaterThanOrEquals, (r4, e, t) => new P(">=", r4, t, (n, i2) => n >= i2)).infixLeft("&", p.Ampersand, (r4, e, t) => new ke(r4, t)).infixLeft("and", p.And, (r4, e, t) => new Me(r4, t)).infixLeft("as", p.As, (r4, e, t) => new K(r4, t)).infixLeft("contains", p.Contains, (r4, e, t) => new De(r4, t)).infixLeft("div", p.Divide, (r4, e, t) => new P("div", r4, t, (n, i2) => n / i2 | 0)).infixLeft("in", p.In, (r4, e, t) => new Oe(r4, t)).infixLeft("is", p.Is, (r4, e, t) => new J(r4, t)).infixLeft("mod", p.Modulo, (r4, e, t) => new P("mod", r4, t, (n, i2) => n % i2)).infixLeft("or", p.Or, (r4, e, t) => new Ne(r4, t)).infixLeft("xor", p.Xor, (r4, e, t) => new Be(r4, t)).infixLeft("implies", p.Implies, (r4, e, t) => new Fe(r4, t));
4437
4442
  }
4438
- var Hn = ue();
4439
- var hr = ((l2) => (l2.BOOLEAN = "BOOLEAN", l2.NUMBER = "NUMBER", l2.QUANTITY = "QUANTITY", l2.TEXT = "TEXT", l2.REFERENCE = "REFERENCE", l2.CANONICAL = "CANONICAL", l2.DATE = "DATE", l2.DATETIME = "DATETIME", l2.PERIOD = "PERIOD", l2.UUID = "UUID", l2))(hr || {});
4440
- var ci = ((x) => (x.READ = "read", x.VREAD = "vread", x.UPDATE = "update", x.PATCH = "patch", x.DELETE = "delete", x.HISTORY = "history", x.HISTORY_INSTANCE = "history-instance", x.HISTORY_TYPE = "history-type", x.HISTORY_SYSTEM = "history-system", x.CREATE = "create", x.SEARCH = "search", x.SEARCH_TYPE = "search-type", x.SEARCH_SYSTEM = "search-system", x.SEARCH_COMPARTMENT = "search-compartment", x.CAPABILITIES = "capabilities", x.TRANSACTION = "transaction", x.BATCH = "batch", x.OPERATION = "operation", x))(ci || {});
4441
- function Sr(r4) {
4443
+ var Yn = pe();
4444
+ var br = ((l2) => (l2.BOOLEAN = "BOOLEAN", l2.NUMBER = "NUMBER", l2.QUANTITY = "QUANTITY", l2.TEXT = "TEXT", l2.REFERENCE = "REFERENCE", l2.CANONICAL = "CANONICAL", l2.DATE = "DATE", l2.DATETIME = "DATETIME", l2.PERIOD = "PERIOD", l2.UUID = "UUID", l2))(br || {});
4445
+ var fi = ((T) => (T.READ = "read", T.VREAD = "vread", T.UPDATE = "update", T.PATCH = "patch", T.DELETE = "delete", T.HISTORY = "history", T.HISTORY_INSTANCE = "history-instance", T.HISTORY_TYPE = "history-type", T.HISTORY_SYSTEM = "history-system", T.CREATE = "create", T.SEARCH = "search", T.SEARCH_TYPE = "search-type", T.SEARCH_SYSTEM = "search-system", T.SEARCH_COMPARTMENT = "search-compartment", T.CAPABILITIES = "capabilities", T.TRANSACTION = "transaction", T.BATCH = "batch", T.OPERATION = "operation", T))(fi || {});
4446
+ function wr(r4) {
4442
4447
  if (typeof window < "u")
4443
4448
  return window.atob(r4);
4444
4449
  if (typeof Buffer < "u")
4445
4450
  return Buffer.from(r4, "base64").toString("binary");
4446
4451
  throw new Error("Unable to decode base64");
4447
4452
  }
4448
- function Rr(r4) {
4453
+ function Ir(r4) {
4449
4454
  if (typeof window < "u")
4450
4455
  return window.btoa(r4);
4451
4456
  if (typeof Buffer < "u")
4452
4457
  return Buffer.from(r4, "binary").toString("base64");
4453
4458
  throw new Error("Unable to encode base64");
4454
4459
  }
4455
- function vt() {
4460
+ function St() {
4456
4461
  let r4 = new Uint32Array(28);
4457
- return crypto.getRandomValues(r4), Jt(r4.buffer);
4462
+ return crypto.getRandomValues(r4), nr(r4.buffer);
4458
4463
  }
4459
- async function Ar(r4) {
4464
+ async function kr(r4) {
4460
4465
  return crypto.subtle.digest("SHA-256", new TextEncoder().encode(r4));
4461
4466
  }
4462
- var Fe = class {
4467
+ var je = class {
4463
4468
  constructor(e = 10) {
4464
4469
  this.max = e, this.cache = /* @__PURE__ */ new Map();
4465
4470
  }
@@ -4483,8 +4488,8 @@ var Fe = class {
4483
4488
  return this.cache.keys().next().value;
4484
4489
  }
4485
4490
  };
4486
- var Y = { CSS: "text/css", 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", PNG: "image/png", SVG: "image/svg+xml", TEXT: "text/plain", TYPESCRIPT: "text/typescript" };
4487
- var qe = class {
4491
+ var X = { CSS: "text/css", 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", PNG: "image/png", SVG: "image/svg+xml", TEXT: "text/plain", TYPESCRIPT: "text/typescript" };
4492
+ var $e = class {
4488
4493
  constructor() {
4489
4494
  this.listeners = {};
4490
4495
  }
@@ -4506,28 +4511,31 @@ var qe = class {
4506
4511
  return t && t.forEach((n) => n.call(this, e)), !e.defaultPrevented;
4507
4512
  }
4508
4513
  };
4509
- function yi(r4) {
4510
- let e = r4.replace(/-/g, "+").replace(/_/g, "/"), t = Sr(e), n = Array.from(t).reduce((o, s) => {
4514
+ function Ri(r4) {
4515
+ let e = r4.replace(/-/g, "+").replace(/_/g, "/"), t = wr(e), n = Array.from(t).reduce((o, s) => {
4511
4516
  let a = ("00" + s.charCodeAt(0).toString(16)).slice(-2);
4512
4517
  return `${o}%${a}`;
4513
4518
  }, ""), i2 = decodeURIComponent(n);
4514
4519
  return JSON.parse(i2);
4515
4520
  }
4516
- function bt(r4) {
4521
+ function Or(r4) {
4522
+ return r4.split(".").length === 3;
4523
+ }
4524
+ function Et(r4) {
4517
4525
  let [e, t, n] = r4.split(".");
4518
- return yi(t);
4526
+ return Ri(t);
4519
4527
  }
4520
- function Cr(r4) {
4528
+ function Vr(r4) {
4521
4529
  try {
4522
- return typeof bt(r4).login_id == "string";
4530
+ return typeof Et(r4).login_id == "string";
4523
4531
  } catch {
4524
4532
  return false;
4525
4533
  }
4526
4534
  }
4527
- var gi;
4535
+ var Si;
4528
4536
  var w = class {
4529
4537
  constructor(e) {
4530
- this[gi] = "ReadablePromise";
4538
+ this[Si] = "ReadablePromise";
4531
4539
  this.status = "pending";
4532
4540
  this.suspender = e.then((t) => (this.status = "success", this.response = t, t), (t) => {
4533
4541
  throw this.status = "error", this.error = t, t;
@@ -4559,10 +4567,10 @@ var w = class {
4559
4567
  return this.suspender.finally(e);
4560
4568
  }
4561
4569
  };
4562
- gi = Symbol.toStringTag;
4563
- var je = class {
4570
+ Si = Symbol.toStringTag;
4571
+ var Qe = class {
4564
4572
  constructor() {
4565
- this.storage = typeof localStorage < "u" ? localStorage : new St();
4573
+ this.storage = typeof localStorage < "u" ? localStorage : new Pt();
4566
4574
  }
4567
4575
  clear() {
4568
4576
  this.storage.clear();
@@ -4578,10 +4586,10 @@ var je = class {
4578
4586
  return t ? JSON.parse(t) : void 0;
4579
4587
  }
4580
4588
  setObject(e, t) {
4581
- this.setString(e, t ? Wt(t) : void 0);
4589
+ this.setString(e, t ? er(t) : void 0);
4582
4590
  }
4583
4591
  };
4584
- var St = class {
4592
+ var Pt = class {
4585
4593
  constructor() {
4586
4594
  this.data = /* @__PURE__ */ new Map();
4587
4595
  }
@@ -4604,19 +4612,20 @@ var St = class {
4604
4612
  return Array.from(this.data.keys())[e];
4605
4613
  }
4606
4614
  };
4607
- var xi = "https://api.medplum.com/";
4608
- var Ti = 1e3;
4609
- var vi = 6e4;
4610
- var wr = "Binary/";
4611
- var kr = { resourceType: "Device", id: "system", deviceName: [{ name: "System" }] };
4612
- var bi = ((o) => (o.ClientCredentials = "client_credentials", o.AuthorizationCode = "authorization_code", o.RefreshToken = "refresh_token", o.JwtBearer = "urn:ietf:params:oauth:grant-type:jwt-bearer", o.TokenExchange = "urn:ietf:params:oauth:grant-type:token-exchange", o))(bi || {});
4613
- var Si = ((o) => (o.AccessToken = "urn:ietf:params:oauth:token-type:access_token", o.RefreshToken = "urn:ietf:params:oauth:token-type:refresh_token", o.IdToken = "urn:ietf:params:oauth:token-type:id_token", o.Saml1Token = "urn:ietf:params:oauth:token-type:saml1", o.Saml2Token = "urn:ietf:params:oauth:token-type:saml2", o))(Si || {});
4614
- var Dr = class extends qe {
4615
+ var Ai = "https://api.medplum.com/";
4616
+ var Ei = 1e3;
4617
+ var Pi = 6e4;
4618
+ var Ur = "Binary/";
4619
+ var Lr = { resourceType: "Device", id: "system", deviceName: [{ name: "System" }] };
4620
+ var Ci = ((o) => (o.ClientCredentials = "client_credentials", o.AuthorizationCode = "authorization_code", o.RefreshToken = "refresh_token", o.JwtBearer = "urn:ietf:params:oauth:grant-type:jwt-bearer", o.TokenExchange = "urn:ietf:params:oauth:grant-type:token-exchange", o))(Ci || {});
4621
+ var wi = ((o) => (o.AccessToken = "urn:ietf:params:oauth:token-type:access_token", o.RefreshToken = "urn:ietf:params:oauth:token-type:refresh_token", o.IdToken = "urn:ietf:params:oauth:token-type:id_token", o.Saml1Token = "urn:ietf:params:oauth:token-type:saml1", o.Saml2Token = "urn:ietf:params:oauth:token-type:saml2", o))(wi || {});
4622
+ var Ii = ((e) => (e.JwtBearer = "urn:ietf:params:oauth:client-assertion-type:jwt-bearer", e))(Ii || {});
4623
+ var _r = class extends $e {
4615
4624
  constructor(t) {
4616
4625
  super();
4617
4626
  if (t?.baseUrl && !t.baseUrl.startsWith("http"))
4618
4627
  throw new Error("Base URL must start with http or https");
4619
- this.fetch = t?.fetch ?? Ri(), this.storage = t?.storage ?? new je(), this.createPdfImpl = t?.createPdf, this.baseUrl = Or(t?.baseUrl) ?? xi, this.fhirBaseUrl = this.baseUrl + (Or(t?.fhirUrlPath) ?? "fhir/R4/"), this.clientId = t?.clientId ?? "", this.clientSecret = t?.clientSecret ?? "", this.authorizeUrl = t?.authorizeUrl ?? this.baseUrl + "oauth2/authorize", this.tokenUrl = t?.tokenUrl ?? this.baseUrl + "oauth2/token", this.logoutUrl = t?.logoutUrl ?? this.baseUrl + "oauth2/logout", this.onUnauthenticated = t?.onUnauthenticated, this.cacheTime = t?.cacheTime ?? vi, this.cacheTime > 0 ? this.requestCache = new Fe(t?.resourceCacheSize ?? Ti) : this.requestCache = void 0, t?.autoBatchTime ? (this.autoBatchTime = t.autoBatchTime, this.autoBatchQueue = []) : (this.autoBatchTime = 0, this.autoBatchQueue = void 0);
4628
+ this.options = t ?? {}, this.fetch = t?.fetch ?? ki(), this.storage = t?.storage ?? new Qe(), this.createPdfImpl = t?.createPdf, this.baseUrl = Nr(t?.baseUrl ?? Ai), this.fhirBaseUrl = Nr(He(this.baseUrl, t?.fhirUrlPath ?? "fhir/R4/")), this.authorizeUrl = He(this.baseUrl, t?.authorizeUrl ?? "oauth2/authorize"), this.tokenUrl = He(this.baseUrl, t?.tokenUrl ?? "oauth2/token"), this.logoutUrl = He(this.baseUrl, t?.logoutUrl ?? "oauth2/logout"), this.clientId = t?.clientId ?? "", this.clientSecret = t?.clientSecret ?? "", this.onUnauthenticated = t?.onUnauthenticated, this.cacheTime = t?.cacheTime ?? Pi, this.cacheTime > 0 ? this.requestCache = new je(t?.resourceCacheSize ?? Ei) : this.requestCache = void 0, t?.autoBatchTime ? (this.autoBatchTime = t.autoBatchTime, this.autoBatchQueue = []) : (this.autoBatchTime = 0, this.autoBatchQueue = void 0);
4620
4629
  let n = this.getActiveLogin();
4621
4630
  n && (this.setAccessToken(n.accessToken, n.refreshToken), this.refreshProfile().catch(console.log)), this.setupStorageListener();
4622
4631
  }
@@ -4626,6 +4635,12 @@ var Dr = class extends qe {
4626
4635
  getAuthorizeUrl() {
4627
4636
  return this.authorizeUrl;
4628
4637
  }
4638
+ getTokenUrl() {
4639
+ return this.tokenUrl;
4640
+ }
4641
+ getLogoutUrl() {
4642
+ return this.logoutUrl;
4643
+ }
4629
4644
  clear() {
4630
4645
  this.storage.clear(), this.clearActiveLogin();
4631
4646
  }
@@ -4657,13 +4672,13 @@ var Dr = class extends qe {
4657
4672
  return this.setCacheEntry(t, s), s;
4658
4673
  }
4659
4674
  post(t, n, i2, o = {}) {
4660
- return t = t.toString(), n && this.setRequestBody(o, n), i2 && this.setRequestContentType(o, i2), this.invalidateUrl(t), this.request("POST", t, o);
4675
+ return t = t.toString(), this.setRequestBody(o, n), i2 && this.setRequestContentType(o, i2), this.invalidateUrl(t), this.request("POST", t, o);
4661
4676
  }
4662
4677
  put(t, n, i2, o = {}) {
4663
- return t = t.toString(), n && this.setRequestBody(o, n), i2 && this.setRequestContentType(o, i2), this.invalidateUrl(t), this.request("PUT", t, o);
4678
+ return t = t.toString(), this.setRequestBody(o, n), i2 && this.setRequestContentType(o, i2), this.invalidateUrl(t), this.request("PUT", t, o);
4664
4679
  }
4665
4680
  patch(t, n, i2 = {}) {
4666
- return t = t.toString(), this.setRequestBody(i2, n), this.setRequestContentType(i2, Y.JSON_PATCH), this.invalidateUrl(t), this.request("PATCH", t, i2);
4681
+ return t = t.toString(), this.setRequestBody(i2, n), this.setRequestContentType(i2, X.JSON_PATCH), this.invalidateUrl(t), this.request("PATCH", t, i2);
4667
4682
  }
4668
4683
  delete(t, n) {
4669
4684
  return t = t.toString(), this.invalidateUrl(t), this.request("DELETE", t, n);
@@ -4710,11 +4725,16 @@ var Dr = class extends qe {
4710
4725
  return i2.set("grant_type", "urn:ietf:params:oauth:grant-type:token-exchange"), i2.set("subject_token_type", "urn:ietf:params:oauth:token-type:access_token"), i2.set("client_id", n), i2.set("subject_token", t), this.fetchTokens(i2);
4711
4726
  }
4712
4727
  getExternalAuthRedirectUri(t, n, i2, o) {
4713
- let s = new URL(t);
4714
- return s.searchParams.set("response_type", "code"), s.searchParams.set("client_id", n), s.searchParams.set("redirect_uri", i2), s.searchParams.set("scope", "openid profile email"), s.searchParams.set("state", JSON.stringify(o)), s.toString();
4728
+ let { codeChallenge: s, codeChallengeMethod: a } = o;
4729
+ if (!a)
4730
+ throw new Error("`LoginRequest` for external auth must include a `codeChallengeMethod`.");
4731
+ if (!s)
4732
+ throw new Error("`LoginRequest` for external auth must include a `codeChallenge`.");
4733
+ let c2 = new URL(t);
4734
+ return c2.searchParams.set("response_type", "code"), c2.searchParams.set("client_id", n), c2.searchParams.set("redirect_uri", i2), c2.searchParams.set("scope", "openid profile email"), c2.searchParams.set("state", JSON.stringify(o)), c2.searchParams.set("code_challenge_method", a), c2.searchParams.set("code_challenge", s), c2.toString();
4715
4735
  }
4716
4736
  fhirUrl(...t) {
4717
- return new URL(this.fhirBaseUrl + t.join("/"));
4737
+ return new URL(t.join("/"), this.fhirBaseUrl);
4718
4738
  }
4719
4739
  fhirSearchUrl(t, n) {
4720
4740
  let i2 = this.fhirUrl(t);
@@ -4725,11 +4745,11 @@ var Dr = class extends qe {
4725
4745
  if (a)
4726
4746
  return a.value;
4727
4747
  let c2 = new w((async () => {
4728
- let p2 = await this.get(o, i2);
4729
- if (p2.entry)
4730
- for (let l2 of p2.entry)
4748
+ let f = await this.get(o, i2);
4749
+ if (f.entry)
4750
+ for (let l2 of f.entry)
4731
4751
  this.cacheResource(l2.resource);
4732
- return p2;
4752
+ return f;
4733
4753
  })());
4734
4754
  return this.setCacheEntry(s, c2), c2;
4735
4755
  }
@@ -4739,23 +4759,23 @@ var Dr = class extends qe {
4739
4759
  let s = o.toString() + "-searchOne", a = this.getCacheEntry(s, i2);
4740
4760
  if (a)
4741
4761
  return a.value;
4742
- let c2 = new w(this.search(t, o.searchParams, i2).then((p2) => p2.entry?.[0]?.resource));
4762
+ let c2 = new w(this.search(t, o.searchParams, i2).then((f) => f.entry?.[0]?.resource));
4743
4763
  return this.setCacheEntry(s, c2), c2;
4744
4764
  }
4745
4765
  searchResources(t, n, i2) {
4746
4766
  let s = this.fhirSearchUrl(t, n).toString() + "-searchResources", a = this.getCacheEntry(s, i2);
4747
4767
  if (a)
4748
4768
  return a.value;
4749
- let c2 = new w(this.search(t, n, i2).then(Ur));
4769
+ let c2 = new w(this.search(t, n, i2).then(Fr));
4750
4770
  return this.setCacheEntry(s, c2), c2;
4751
4771
  }
4752
4772
  async *searchResourcePages(t, n, i2) {
4753
4773
  let o = this.fhirSearchUrl(t, n);
4754
4774
  for (; o; ) {
4755
- let s = new URL(o).searchParams, a = await this.search(t, s, i2), c2 = a.link?.find((p2) => p2.relation === "next");
4775
+ let s = new URL(o).searchParams, a = await this.search(t, s, i2), c2 = a.link?.find((f) => f.relation === "next");
4756
4776
  if (!a.entry?.length && !c2)
4757
4777
  break;
4758
- yield Ur(a), o = c2?.url ? new URL(c2.url) : void 0;
4778
+ yield Fr(a), o = c2?.url ? new URL(c2.url) : void 0;
4759
4779
  }
4760
4780
  }
4761
4781
  searchValueSet(t, n, i2) {
@@ -4771,7 +4791,7 @@ var Dr = class extends qe {
4771
4791
  if (!n)
4772
4792
  return;
4773
4793
  if (n === "system")
4774
- return kr;
4794
+ return Lr;
4775
4795
  let [i2, o] = n.split("/");
4776
4796
  if (!(!i2 || !o))
4777
4797
  return this.getCached(i2, o);
@@ -4784,7 +4804,7 @@ var Dr = class extends qe {
4784
4804
  if (!i2)
4785
4805
  return new w(Promise.reject(new Error("Missing reference")));
4786
4806
  if (i2 === "system")
4787
- return new w(Promise.resolve(kr));
4807
+ return new w(Promise.resolve(Lr));
4788
4808
  let [o, s] = i2.split("/");
4789
4809
  return !o || !s ? new w(Promise.reject(new Error("Invalid reference"))) : this.readResource(o, s, n);
4790
4810
  }
@@ -4828,9 +4848,9 @@ var Dr = class extends qe {
4828
4848
  }
4829
4849
  }`.replace(/\s+/g, " "), a = await this.graphql(s);
4830
4850
  for (let c2 of a.data.StructureDefinitionList)
4831
- at(c2);
4851
+ dt(c2);
4832
4852
  for (let c2 of a.data.SearchParameterList)
4833
- ct(c2);
4853
+ lt(c2);
4834
4854
  return y;
4835
4855
  })());
4836
4856
  return this.setCacheEntry(n, o), o;
@@ -4863,7 +4883,7 @@ var Dr = class extends qe {
4863
4883
  uploadwithProgress(t, n, i2, o) {
4864
4884
  return new Promise((s, a) => {
4865
4885
  let c2 = new XMLHttpRequest();
4866
- c2.responseType = "json", c2.onabort = () => a(new Error("Request aborted")), c2.onerror = () => a(new Error("Request error")), o && (c2.upload.onprogress = (p2) => o(p2), c2.upload.onload = (p2) => o(p2)), c2.onload = () => {
4886
+ c2.responseType = "json", c2.onabort = () => a(new Error("Request aborted")), c2.onerror = () => a(new Error("Request error")), o && (c2.upload.onprogress = (f) => o(f), c2.upload.onload = (f) => o(f)), c2.onload = () => {
4867
4887
  c2.status >= 200 && c2.status < 300 ? s(c2.response) : a(new Error(c2.statusText));
4868
4888
  }, c2.open("POST", t), c2.withCredentials = true, c2.setRequestHeader("Authorization", "Bearer " + this.accessToken), c2.setRequestHeader("Cache-Control", "no-cache, no-store, max-age=0"), c2.setRequestHeader("Content-Type", i2), c2.setRequestHeader("X-Medplum", "extended"), c2.send(n);
4869
4889
  });
@@ -4876,7 +4896,7 @@ var Dr = class extends qe {
4876
4896
  }
4877
4897
  createComment(t, n, i2) {
4878
4898
  let o = this.getProfile(), s, a;
4879
- return t.resourceType === "Encounter" && (s = ie(t), a = t.subject), t.resourceType === "ServiceRequest" && (s = t.encounter, a = t.subject), t.resourceType === "Patient" && (a = ie(t)), this.createResource({ resourceType: "Communication", basedOn: [ie(t)], encounter: s, subject: a, sender: o ? ie(o) : void 0, sent: (/* @__PURE__ */ new Date()).toISOString(), payload: [{ contentString: n }] }, i2);
4899
+ return t.resourceType === "Encounter" && (s = ae(t), a = t.subject), t.resourceType === "ServiceRequest" && (s = t.encounter, a = t.subject), t.resourceType === "Patient" && (a = ae(t)), this.createResource({ resourceType: "Communication", basedOn: [ae(t)], encounter: s, subject: a, sender: o ? ae(o) : void 0, sent: (/* @__PURE__ */ new Date()).toISOString(), payload: [{ contentString: n }] }, i2);
4880
4900
  }
4881
4901
  async updateResource(t, n) {
4882
4902
  if (!t.resourceType)
@@ -4911,10 +4931,10 @@ var Dr = class extends qe {
4911
4931
  return this.post(this.fhirBaseUrl.slice(0, -1), t, void 0, n);
4912
4932
  }
4913
4933
  sendEmail(t, n) {
4914
- return this.post("email/v1/send", t, Y.JSON, n);
4934
+ return this.post("email/v1/send", t, X.JSON, n);
4915
4935
  }
4916
4936
  graphql(t, n, i2, o) {
4917
- return this.post(this.fhirUrl("$graphql"), { query: t, operationName: n, variables: i2 }, Y.JSON, o);
4937
+ return this.post(this.fhirUrl("$graphql"), { query: t, operationName: n, variables: i2 }, X.JSON, o);
4918
4938
  }
4919
4939
  readResourceGraph(t, n, i2, o) {
4920
4940
  return this.get(`${this.fhirUrl(t, n)}/$graph?graph=${i2}`, o);
@@ -4929,7 +4949,7 @@ var Dr = class extends qe {
4929
4949
  return this.accessToken;
4930
4950
  }
4931
4951
  setAccessToken(t, n) {
4932
- this.accessToken = t, this.refreshToken = n, this.sessionDetails = void 0, this.medplumServer = Cr(t);
4952
+ this.accessToken = t, this.refreshToken = n, this.sessionDetails = void 0, this.medplumServer = Vr(t);
4933
4953
  }
4934
4954
  getLogins() {
4935
4955
  return this.storage.getObject("logins") ?? [];
@@ -4972,16 +4992,14 @@ var Dr = class extends qe {
4972
4992
  getAccessPolicy() {
4973
4993
  return this.sessionDetails?.accessPolicy;
4974
4994
  }
4975
- normalizeFetchUrl(t) {
4976
- let n = t.toString();
4977
- return n.startsWith(wr) && (n = this.fhirUrl(n).toString()), n;
4978
- }
4979
4995
  async download(t, n = {}) {
4980
- return this.refreshPromise && await this.refreshPromise, this.addFetchOptionsDefaults(n), (await this.fetch(this.normalizeFetchUrl(t), n)).blob();
4996
+ this.refreshPromise && await this.refreshPromise;
4997
+ let i2 = t.toString();
4998
+ return i2.startsWith(Ur) && (t = this.fhirUrl(i2)), this.addFetchOptionsDefaults(n), (await this.fetchWithRetry(t.toString(), n)).blob();
4981
4999
  }
4982
5000
  async uploadMedia(t, n, i2, o, s) {
4983
5001
  let a = await this.createBinary(t, i2, n);
4984
- return this.createResource({ ...o, resourceType: "Media", content: { contentType: n, url: wr + a.id, title: i2 } }, s);
5002
+ return this.createResource({ ...o, resourceType: "Media", content: { contentType: n, url: Ur + a.id, title: i2 } }, s);
4985
5003
  }
4986
5004
  async bulkExport(t = "", n, i2, o) {
4987
5005
  let s = t && `${t}/`, a = this.fhirUrl(`${s}$export`);
@@ -4993,7 +5011,7 @@ var Dr = class extends qe {
4993
5011
  i2.Prefer = "respond-async";
4994
5012
  let o = await this.fetchWithRetry(t, n);
4995
5013
  if (o.status === 202) {
4996
- let s = await Vr(o);
5014
+ let s = await Br(o);
4997
5015
  if (s)
4998
5016
  return this.pollStatus(s);
4999
5017
  }
@@ -5027,34 +5045,47 @@ var Dr = class extends qe {
5027
5045
  return;
5028
5046
  let a = t.headers.get("content-type")?.includes("json");
5029
5047
  if (t.status === 404 && !a)
5030
- throw new m(Ut);
5031
- let c2;
5048
+ throw new h(qt);
5049
+ let c2 = t.headers.get("content-location"), f = o.redirect ?? this.options.redirect;
5050
+ if (t.status === 201 && c2 && f === "follow")
5051
+ return this.request("GET", c2, { ...o, body: void 0 });
5052
+ let l2;
5032
5053
  if (a)
5033
5054
  try {
5034
- c2 = await t.json();
5035
- } catch (p2) {
5036
- throw console.error("Error parsing response", t.status, p2), p2;
5055
+ l2 = await t.json();
5056
+ } catch (F) {
5057
+ throw console.error("Error parsing response", t.status, F), F;
5037
5058
  }
5038
5059
  else
5039
- c2 = await t.text();
5060
+ l2 = await t.text();
5040
5061
  if (t.status >= 400)
5041
- throw new m(tt(c2));
5042
- return c2;
5062
+ throw new h(nt(l2));
5063
+ return l2;
5043
5064
  }
5044
5065
  async fetchWithRetry(t, n) {
5045
5066
  t.startsWith("http") || (t = new URL(t, this.baseUrl).href);
5046
5067
  let i2 = 3, o = 200, s;
5047
5068
  for (let a = 0; a < i2; a++) {
5048
5069
  try {
5049
- if (s = await this.fetch(t, n), s.status < 500)
5070
+ if (this.options.verbose && this.logRequest(t, n), s = await this.fetch(t, n), this.options.verbose && this.logResponse(s), s.status < 500)
5050
5071
  return s;
5051
5072
  } catch (c2) {
5052
5073
  this.retryCatch(a, i2, c2);
5053
5074
  }
5054
- await st(o);
5075
+ await ut(o);
5055
5076
  }
5056
5077
  return s;
5057
5078
  }
5079
+ logRequest(t, n) {
5080
+ if (console.log(`> ${n.method} ${t}`), n.headers) {
5081
+ let i2 = n.headers, o = Object.entries(i2).sort((s, a) => s[0].localeCompare(a[0]));
5082
+ for (let [s, a] of o)
5083
+ console.log(`> ${s}: ${a}`);
5084
+ }
5085
+ }
5086
+ logResponse(t) {
5087
+ console.log(`< ${t.status} ${t.statusText}`), t.headers && t.headers.forEach((n, i2) => console.log(`< ${i2}: ${n}`));
5088
+ }
5058
5089
  async pollStatus(t) {
5059
5090
  let n = true, i2, o = 2e3;
5060
5091
  for (; n; ) {
@@ -5062,10 +5093,10 @@ var Dr = class extends qe {
5062
5093
  this.addFetchOptionsDefaults(s);
5063
5094
  let a = await this.fetchWithRetry(t, s);
5064
5095
  if (a.status !== 202 && (n = false, i2 = a, a.status === 201)) {
5065
- let c2 = await Vr(a);
5096
+ let c2 = await Br(a);
5066
5097
  c2 && (i2 = await this.fetchWithRetry(c2, s));
5067
5098
  }
5068
- await st(o);
5099
+ await ut(o);
5069
5100
  }
5070
5101
  return this.parseResponse(i2, "POST", t);
5071
5102
  }
@@ -5076,19 +5107,19 @@ var Dr = class extends qe {
5076
5107
  try {
5077
5108
  o.resolve(await this.request(o.method, this.fhirBaseUrl + o.url, o.options));
5078
5109
  } catch (s) {
5079
- o.reject(new m(tt(s)));
5110
+ o.reject(new h(nt(s)));
5080
5111
  }
5081
5112
  return;
5082
5113
  }
5083
5114
  let n = { resourceType: "Bundle", type: "batch", entry: t.map((o) => ({ request: { method: o.method, url: o.url }, resource: o.options.body ? JSON.parse(o.options.body) : void 0 })) }, i2 = await this.post(this.fhirBaseUrl.slice(0, -1), n);
5084
5115
  for (let o = 0; o < t.length; o++) {
5085
5116
  let s = t[o], a = i2.entry?.[o];
5086
- a?.response?.outcome && !et(a.response.outcome) ? s.reject(new m(a.response.outcome)) : s.resolve(a?.resource);
5117
+ a?.response?.outcome && !rt(a.response.outcome) ? s.reject(new h(a.response.outcome)) : s.resolve(a?.resource);
5087
5118
  }
5088
5119
  }
5089
5120
  addFetchOptionsDefaults(t) {
5090
5121
  let n = t.headers;
5091
- n || (n = {}, t.headers = n), n.Accept = Y.FHIR_JSON, n["X-Medplum"] = "extended", t.body && !n["Content-Type"] && (n["Content-Type"] = Y.FHIR_JSON), this.accessToken ? n.Authorization = "Bearer " + this.accessToken : this.basicAuth && (n.Authorization = "Basic " + this.basicAuth), t.cache || (t.cache = "no-cache"), t.credentials || (t.credentials = "include");
5122
+ n || (n = {}, t.headers = n), n.Accept = X.FHIR_JSON, n["X-Medplum"] = "extended", t.body && !n["Content-Type"] && (n["Content-Type"] = X.FHIR_JSON), this.accessToken ? n.Authorization = "Bearer " + this.accessToken : this.basicAuth && (n.Authorization = "Basic " + this.basicAuth), t.cache || (t.cache = "no-cache"), t.credentials || (t.credentials = "include");
5092
5123
  }
5093
5124
  setRequestContentType(t, n) {
5094
5125
  t.headers || (t.headers = {});
@@ -5102,20 +5133,20 @@ var Dr = class extends qe {
5102
5133
  return this.refresh() ? this.request(t, n, i2) : (this.clearActiveLogin(), this.onUnauthenticated && this.onUnauthenticated(), Promise.reject(new Error("Unauthenticated")));
5103
5134
  }
5104
5135
  async startPkce() {
5105
- let t = vt();
5136
+ let t = St();
5106
5137
  sessionStorage.setItem("pkceState", t);
5107
- let n = vt();
5138
+ let n = St();
5108
5139
  sessionStorage.setItem("codeVerifier", n);
5109
- let i2 = await Ar(n), o = Yt(i2).replaceAll("+", "-").replaceAll("/", "_").replaceAll("=", "");
5140
+ let i2 = await kr(n), o = ir(i2).replaceAll("+", "-").replaceAll("/", "_").replaceAll("=", "");
5110
5141
  return sessionStorage.setItem("codeChallenge", o), { codeChallengeMethod: "S256", codeChallenge: o };
5111
5142
  }
5112
5143
  async requestAuthorization(t) {
5113
5144
  let n = await this.ensureCodeChallenge(t ?? {}), i2 = new URL(this.authorizeUrl);
5114
- i2.searchParams.set("response_type", "code"), i2.searchParams.set("state", sessionStorage.getItem("pkceState")), i2.searchParams.set("client_id", n.clientId ?? this.clientId), i2.searchParams.set("redirect_uri", n.redirectUri ?? Ir()), i2.searchParams.set("code_challenge_method", n.codeChallengeMethod), i2.searchParams.set("code_challenge", n.codeChallenge), i2.searchParams.set("scope", n.scope ?? "openid profile"), window.location.assign(i2.toString());
5145
+ i2.searchParams.set("response_type", "code"), i2.searchParams.set("state", sessionStorage.getItem("pkceState")), i2.searchParams.set("client_id", n.clientId ?? this.clientId), i2.searchParams.set("redirect_uri", n.redirectUri ?? Mr()), i2.searchParams.set("code_challenge_method", n.codeChallengeMethod), i2.searchParams.set("code_challenge", n.codeChallenge), i2.searchParams.set("scope", n.scope ?? "openid profile"), window.location.assign(i2.toString());
5115
5146
  }
5116
5147
  processCode(t, n) {
5117
5148
  let i2 = new URLSearchParams();
5118
- if (i2.set("grant_type", "authorization_code"), i2.set("code", t), i2.set("client_id", n?.clientId ?? this.clientId), i2.set("redirect_uri", n?.redirectUri ?? Ir()), typeof sessionStorage < "u") {
5149
+ if (i2.set("grant_type", "authorization_code"), i2.set("code", t), i2.set("client_id", n?.clientId ?? this.clientId), i2.set("redirect_uri", n?.redirectUri ?? Mr()), typeof sessionStorage < "u") {
5119
5150
  let o = sessionStorage.getItem("codeVerifier");
5120
5151
  o && i2.set("code_verifier", o);
5121
5152
  }
@@ -5141,37 +5172,44 @@ var Dr = class extends qe {
5141
5172
  let o = new URLSearchParams();
5142
5173
  return o.set("grant_type", "urn:ietf:params:oauth:grant-type:jwt-bearer"), o.set("client_id", t), o.set("assertion", n), o.set("scope", i2), this.fetchTokens(o);
5143
5174
  }
5175
+ async startJwtAssertionLogin(t) {
5176
+ let n = new URLSearchParams();
5177
+ return n.append("grant_type", "client_credentials"), n.append("client_assertion_type", "urn:ietf:params:oauth:client-assertion-type:jwt-bearer"), n.append("client_assertion", t), this.fetchTokens(n);
5178
+ }
5144
5179
  setBasicAuth(t, n) {
5145
- this.clientId = t, this.clientSecret = n, this.basicAuth = Rr(t + ":" + n);
5180
+ this.clientId = t, this.clientSecret = n, this.basicAuth = Ir(t + ":" + n);
5146
5181
  }
5147
5182
  async invite(t, n) {
5148
5183
  return this.post("admin/projects/" + t + "/invite", n);
5149
5184
  }
5150
5185
  async fetchTokens(t) {
5151
- let n = { method: "POST", headers: { "Content-Type": Y.FORM_URL_ENCODED }, body: t.toString(), credentials: "include" }, i2 = n.headers;
5186
+ let n = { method: "POST", headers: { "Content-Type": X.FORM_URL_ENCODED }, body: t.toString(), credentials: "include" }, i2 = n.headers;
5152
5187
  this.basicAuth && (i2.Authorization = `Basic ${this.basicAuth}`);
5153
- let o = await this.fetch(this.tokenUrl, n);
5188
+ let o = await this.fetchWithRetry(this.tokenUrl, n);
5154
5189
  if (!o.ok) {
5155
5190
  this.clearActiveLogin();
5156
5191
  try {
5157
5192
  let a = await o.json();
5158
- throw new m(D(a.error_description));
5193
+ throw new h(k(a.error_description));
5159
5194
  } catch (a) {
5160
- throw new m(D("Failed to fetch tokens"), a);
5195
+ throw new h(k("Failed to fetch tokens"), a);
5161
5196
  }
5162
5197
  }
5163
5198
  let s = await o.json();
5164
5199
  return await this.verifyTokens(s), this.getProfile();
5165
5200
  }
5166
5201
  async verifyTokens(t) {
5167
- let n = t.access_token, i2 = bt(n);
5168
- if (Date.now() >= i2.exp * 1e3)
5169
- throw this.clearActiveLogin(), new Error("Token expired");
5170
- if (i2.cid) {
5171
- if (i2.cid !== this.clientId)
5202
+ let n = t.access_token;
5203
+ if (Or(n)) {
5204
+ let i2 = Et(n);
5205
+ if (Date.now() >= i2.exp * 1e3)
5206
+ throw this.clearActiveLogin(), new Error("Token expired");
5207
+ if (i2.cid) {
5208
+ if (i2.cid !== this.clientId)
5209
+ throw this.clearActiveLogin(), new Error("Token was not issued for this audience");
5210
+ } else if (this.clientId && i2.client_id !== this.clientId)
5172
5211
  throw this.clearActiveLogin(), new Error("Token was not issued for this audience");
5173
- } else if (this.clientId && i2.client_id !== this.clientId)
5174
- throw this.clearActiveLogin(), new Error("Token was not issued for this audience");
5212
+ }
5175
5213
  return this.setActiveLogin({ accessToken: n, refreshToken: t.refresh_token, project: t.project, profile: t.profile });
5176
5214
  }
5177
5215
  setupStorageListener() {
@@ -5187,18 +5225,21 @@ var Dr = class extends qe {
5187
5225
  throw i2;
5188
5226
  }
5189
5227
  };
5190
- function Ri() {
5228
+ function ki() {
5191
5229
  if (!globalThis.fetch)
5192
5230
  throw new Error("Fetch not available in this environment");
5193
5231
  return globalThis.fetch.bind(globalThis);
5194
5232
  }
5195
- function Ir() {
5233
+ function Mr() {
5196
5234
  return typeof window > "u" ? "" : window.location.protocol + "//" + window.location.host + "/";
5197
5235
  }
5198
- function Or(r4) {
5199
- return r4 && (r4.endsWith("/") ? r4 : r4 + "/");
5236
+ function Nr(r4) {
5237
+ return r4.endsWith("/") ? r4 : r4 + "/";
5238
+ }
5239
+ function He(r4, e) {
5240
+ return new URL(e, r4).toString();
5200
5241
  }
5201
- async function Vr(r4) {
5242
+ async function Br(r4) {
5202
5243
  let e = r4.headers.get("content-location");
5203
5244
  if (e)
5204
5245
  return e;
@@ -5206,17 +5247,17 @@ async function Vr(r4) {
5206
5247
  if (t)
5207
5248
  return t;
5208
5249
  let n = await r4.json();
5209
- if (he(n) && n.issue?.[0]?.diagnostics)
5250
+ if (ge(n) && n.issue?.[0]?.diagnostics)
5210
5251
  return n.issue[0].diagnostics;
5211
5252
  }
5212
- function Ur(r4) {
5253
+ function Fr(r4) {
5213
5254
  let e = r4.entry?.map((t) => t.resource) ?? [];
5214
5255
  return Object.assign(e, { bundle: r4 });
5215
5256
  }
5216
- var Ai = [...ce, "->", "<<", ">>"];
5217
- var Ei = ue().registerInfix("->", { precedence: f.Arrow }).registerInfix(";", { precedence: f.Semicolon });
5218
- var Pi = [...ce, "eq", "ne", "co"];
5219
- var ki = ue();
5257
+ var Di = [...le, "->", "<<", ">>"];
5258
+ var Oi = pe().registerInfix("->", { precedence: p.Arrow }).registerInfix(";", { precedence: p.Semicolon });
5259
+ var Vi = [...le, "eq", "ne", "co"];
5260
+ var _i = pe();
5220
5261
  var W = class {
5221
5262
  constructor(e = "\r", t = "|", n = "^", i2 = "~", o = "\\", s = "&") {
5222
5263
  this.segmentSeparator = e;
@@ -5233,7 +5274,7 @@ var W = class {
5233
5274
  return this.componentSeparator + this.repetitionSeparator + this.escapeCharacter + this.subcomponentSeparator;
5234
5275
  }
5235
5276
  };
5236
- var Nr = class r {
5277
+ var $r = class r {
5237
5278
  constructor(e, t = new W()) {
5238
5279
  this.context = t, this.segments = e;
5239
5280
  }
@@ -5257,7 +5298,7 @@ var Nr = class r {
5257
5298
  }
5258
5299
  buildAck() {
5259
5300
  let e = /* @__PURE__ */ new Date(), t = this.getSegment("MSH"), n = t?.getField(3)?.toString() ?? "", i2 = t?.getField(4)?.toString() ?? "", o = t?.getField(5)?.toString() ?? "", s = t?.getField(6)?.toString() ?? "", a = t?.getField(10)?.toString() ?? "", c2 = t?.getField(12)?.toString() ?? "2.5.1";
5260
- return new r([new pe(["MSH", this.context.getMsh2(), o, s, n, i2, Ii(e), "", this.buildAckMessageType(t), e.getTime().toString(), "P", c2], this.context), new pe(["MSA", "AA", a, "OK"], this.context)]);
5301
+ return new r([new he(["MSH", this.context.getMsh2(), o, s, n, i2, Ni(e), "", this.buildAckMessageType(t), e.getTime().toString(), "P", c2], this.context), new he(["MSA", "AA", a, "OK"], this.context)]);
5261
5302
  }
5262
5303
  buildAckMessageType(e) {
5263
5304
  let t = e?.getField(9), n = t?.getComponent(2), i2 = t?.getComponent(3), o = "ACK";
@@ -5269,12 +5310,12 @@ var Nr = class r {
5269
5310
  throw n.type = "entity.parse.failed", n;
5270
5311
  }
5271
5312
  let t = new W("\r", e.charAt(3), e.charAt(4), e.charAt(5), e.charAt(6), e.charAt(7));
5272
- return new r(e.split(/[\r\n]+/).map((n) => pe.parse(n, t)), t);
5313
+ return new r(e.split(/[\r\n]+/).map((n) => he.parse(n, t)), t);
5273
5314
  }
5274
5315
  };
5275
- var pe = class r2 {
5316
+ var he = class r2 {
5276
5317
  constructor(e, t = new W()) {
5277
- this.context = t, zt(e) ? this.fields = e.map((n) => te.parse(n, t)) : this.fields = e, this.name = this.fields[0].components[0][0];
5318
+ this.context = t, tr(e) ? this.fields = e.map((n) => ie.parse(n, t)) : this.fields = e, this.name = this.fields[0].components[0][0];
5278
5319
  }
5279
5320
  get(e) {
5280
5321
  return this.fields[e];
@@ -5282,9 +5323,9 @@ var pe = class r2 {
5282
5323
  getField(e) {
5283
5324
  if (this.name === "MSH") {
5284
5325
  if (e === 1)
5285
- return new te([[this.context.getMsh1()]], this.context);
5326
+ return new ie([[this.context.getMsh1()]], this.context);
5286
5327
  if (e === 2)
5287
- return new te([[this.context.getMsh2()]], this.context);
5328
+ return new ie([[this.context.getMsh2()]], this.context);
5288
5329
  if (e > 2)
5289
5330
  return this.fields[e - 1];
5290
5331
  }
@@ -5297,10 +5338,10 @@ var pe = class r2 {
5297
5338
  return this.fields.map((e) => e.toString()).join(this.context.fieldSeparator);
5298
5339
  }
5299
5340
  static parse(e, t = new W()) {
5300
- return new r2(e.split(t.fieldSeparator).map((n) => te.parse(n, t)), t);
5341
+ return new r2(e.split(t.fieldSeparator).map((n) => ie.parse(n, t)), t);
5301
5342
  }
5302
5343
  };
5303
- var te = class r3 {
5344
+ var ie = class r3 {
5304
5345
  constructor(e, t = new W()) {
5305
5346
  this.context = t, this.components = e;
5306
5347
  }
@@ -5318,7 +5359,7 @@ var te = class r3 {
5318
5359
  return new r3(e.split(t.repetitionSeparator).map((n) => n.split(t.componentSeparator)), t);
5319
5360
  }
5320
5361
  };
5321
- function Ii(r4) {
5362
+ function Ni(r4) {
5322
5363
  let e = r4 instanceof Date ? r4 : new Date(r4), n = e.toISOString().replace(/[-:T]/g, "").replace(/(\.\d+)?Z$/, ""), i2 = e.getUTCMilliseconds();
5323
5364
  return i2 > 0 && (n += "." + i2.toString()), n;
5324
5365
  }
@@ -5333,8 +5374,8 @@ var i = class extends EventTarget {
5333
5374
  super.removeEventListener(n, e, t);
5334
5375
  }
5335
5376
  };
5336
- var m2 = String.fromCharCode(11);
5337
- var p = String.fromCharCode(28);
5377
+ var m = String.fromCharCode(11);
5378
+ var p2 = String.fromCharCode(28);
5338
5379
  var v2 = String.fromCharCode(13);
5339
5380
  var d2 = class extends Event {
5340
5381
  constructor(e, t) {
@@ -5357,8 +5398,8 @@ var c = class extends i {
5357
5398
  let o = "";
5358
5399
  e.on("data", (s) => {
5359
5400
  try {
5360
- if (o += s.toString(), o.endsWith(p + v2)) {
5361
- let r4 = Nr.parse(o.substring(1, o.length - 2));
5401
+ if (o += s.toString(), o.endsWith(p2 + v2)) {
5402
+ let r4 = $r.parse(o.substring(1, o.length - 2));
5362
5403
  this.dispatchEvent(new d2(this, r4)), o = "";
5363
5404
  }
5364
5405
  } catch (r4) {
@@ -5369,7 +5410,7 @@ var c = class extends i {
5369
5410
  });
5370
5411
  }
5371
5412
  send(e) {
5372
- this.socket.write(m2 + e.toString() + p + v2);
5413
+ this.socket.write(m + e.toString() + p2 + v2);
5373
5414
  }
5374
5415
  async sendAndWait(e) {
5375
5416
  let t = new Promise((o) => {
@@ -5400,7 +5441,7 @@ var E2 = class {
5400
5441
  }
5401
5442
  };
5402
5443
 
5403
- // ../../node_modules/ws/wrapper.mjs
5444
+ // node_modules/ws/wrapper.mjs
5404
5445
  var import_stream = __toESM(require_stream(), 1);
5405
5446
  var import_receiver = __toESM(require_receiver(), 1);
5406
5447
  var import_sender = __toESM(require_sender(), 1);
@@ -5486,7 +5527,7 @@ var AgentHl7ChannelConnection = class {
5486
5527
  type: "connect",
5487
5528
  accessToken: medplum.getAccessToken(),
5488
5529
  agentId: channel.app.agentId,
5489
- botId: Ro(channel.definition.targetReference)
5530
+ botId: wo(channel.definition.targetReference)
5490
5531
  })
5491
5532
  );
5492
5533
  });
@@ -5502,7 +5543,7 @@ var AgentHl7ChannelConnection = class {
5502
5543
  this.trySendToWebSocket();
5503
5544
  break;
5504
5545
  case "transmit":
5505
- this.hl7ConnectionQueue.push(Nr.parse(command.message));
5546
+ this.hl7ConnectionQueue.push($r.parse(command.message));
5506
5547
  this.trySendToHl7Connection();
5507
5548
  break;
5508
5549
  }
@@ -5556,7 +5597,7 @@ if (typeof require !== "undefined" && require.main === module) {
5556
5597
  process.exit(1);
5557
5598
  }
5558
5599
  const [_node, _script, baseUrl, clientId, clientSecret, agentId] = process.argv;
5559
- const medplum = new Dr({ baseUrl, clientId });
5600
+ const medplum = new _r({ baseUrl, clientId });
5560
5601
  medplum.startClientLogin(clientId, clientSecret).then(() => new App(medplum, agentId).start()).catch(console.error);
5561
5602
  }
5562
5603
  // Annotate the CommonJS export names for ESM import in node: