@medplum/agent 4.1.8 → 4.1.10

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 +491 -488
  2. package/package.json +5 -5
@@ -6763,7 +6763,7 @@ var require_stream = __commonJS({
6763
6763
  this.emit("error", err);
6764
6764
  }
6765
6765
  }
6766
- function createWebSocketStream2(ws, options) {
6766
+ function createWebSocketStream2(ws2, options) {
6767
6767
  let terminateOnDestroy = true;
6768
6768
  const duplex = new Duplex({
6769
6769
  ...options,
@@ -6772,65 +6772,65 @@ var require_stream = __commonJS({
6772
6772
  objectMode: false,
6773
6773
  writableObjectMode: false
6774
6774
  });
6775
- ws.on("message", function message(msg, isBinary) {
6775
+ ws2.on("message", function message(msg, isBinary) {
6776
6776
  const data2 = !isBinary && duplex._readableState.objectMode ? msg.toString() : msg;
6777
- if (!duplex.push(data2)) ws.pause();
6777
+ if (!duplex.push(data2)) ws2.pause();
6778
6778
  });
6779
- ws.once("error", function error(err) {
6779
+ ws2.once("error", function error(err) {
6780
6780
  if (duplex.destroyed) return;
6781
6781
  terminateOnDestroy = false;
6782
6782
  duplex.destroy(err);
6783
6783
  });
6784
- ws.once("close", function close() {
6784
+ ws2.once("close", function close() {
6785
6785
  if (duplex.destroyed) return;
6786
6786
  duplex.push(null);
6787
6787
  });
6788
6788
  duplex._destroy = function(err, callback) {
6789
- if (ws.readyState === ws.CLOSED) {
6789
+ if (ws2.readyState === ws2.CLOSED) {
6790
6790
  callback(err);
6791
6791
  process.nextTick(emitClose, duplex);
6792
6792
  return;
6793
6793
  }
6794
6794
  let called = false;
6795
- ws.once("error", function error(err2) {
6795
+ ws2.once("error", function error(err2) {
6796
6796
  called = true;
6797
6797
  callback(err2);
6798
6798
  });
6799
- ws.once("close", function close() {
6799
+ ws2.once("close", function close() {
6800
6800
  if (!called) callback(err);
6801
6801
  process.nextTick(emitClose, duplex);
6802
6802
  });
6803
- if (terminateOnDestroy) ws.terminate();
6803
+ if (terminateOnDestroy) ws2.terminate();
6804
6804
  };
6805
6805
  duplex._final = function(callback) {
6806
- if (ws.readyState === ws.CONNECTING) {
6807
- ws.once("open", function open() {
6806
+ if (ws2.readyState === ws2.CONNECTING) {
6807
+ ws2.once("open", function open() {
6808
6808
  duplex._final(callback);
6809
6809
  });
6810
6810
  return;
6811
6811
  }
6812
- if (ws._socket === null) return;
6813
- if (ws._socket._writableState.finished) {
6812
+ if (ws2._socket === null) return;
6813
+ if (ws2._socket._writableState.finished) {
6814
6814
  callback();
6815
6815
  if (duplex._readableState.endEmitted) duplex.destroy();
6816
6816
  } else {
6817
- ws._socket.once("finish", function finish() {
6817
+ ws2._socket.once("finish", function finish() {
6818
6818
  callback();
6819
6819
  });
6820
- ws.close();
6820
+ ws2.close();
6821
6821
  }
6822
6822
  };
6823
6823
  duplex._read = function() {
6824
- if (ws.isPaused) ws.resume();
6824
+ if (ws2.isPaused) ws2.resume();
6825
6825
  };
6826
6826
  duplex._write = function(chunk, encoding, callback) {
6827
- if (ws.readyState === ws.CONNECTING) {
6828
- ws.once("open", function open() {
6827
+ if (ws2.readyState === ws2.CONNECTING) {
6828
+ ws2.once("open", function open() {
6829
6829
  duplex._write(chunk, encoding, callback);
6830
6830
  });
6831
6831
  return;
6832
6832
  }
6833
- ws.send(chunk, callback);
6833
+ ws2.send(chunk, callback);
6834
6834
  };
6835
6835
  duplex.on("end", duplexOnEnd);
6836
6836
  duplex.on("error", duplexOnError);
@@ -7194,12 +7194,12 @@ var require_websocket_server = __commonJS({
7194
7194
  "Connection: Upgrade",
7195
7195
  `Sec-WebSocket-Accept: ${digest}`
7196
7196
  ];
7197
- const ws = new this.options.WebSocket(null, void 0, this.options);
7197
+ const ws2 = new this.options.WebSocket(null, void 0, this.options);
7198
7198
  if (protocols.size) {
7199
7199
  const protocol = this.options.handleProtocols ? this.options.handleProtocols(protocols, req) : protocols.values().next().value;
7200
7200
  if (protocol) {
7201
7201
  headers.push(`Sec-WebSocket-Protocol: ${protocol}`);
7202
- ws._protocol = protocol;
7202
+ ws2._protocol = protocol;
7203
7203
  }
7204
7204
  }
7205
7205
  if (extensions[PerMessageDeflate.extensionName]) {
@@ -7208,26 +7208,26 @@ var require_websocket_server = __commonJS({
7208
7208
  [PerMessageDeflate.extensionName]: [params]
7209
7209
  });
7210
7210
  headers.push(`Sec-WebSocket-Extensions: ${value}`);
7211
- ws._extensions = extensions;
7211
+ ws2._extensions = extensions;
7212
7212
  }
7213
7213
  this.emit("headers", headers, req);
7214
7214
  socket.write(headers.concat("\r\n").join("\r\n"));
7215
7215
  socket.removeListener("error", socketOnError);
7216
- ws.setSocket(socket, head, {
7216
+ ws2.setSocket(socket, head, {
7217
7217
  allowSynchronousEvents: this.options.allowSynchronousEvents,
7218
7218
  maxPayload: this.options.maxPayload,
7219
7219
  skipUTF8Validation: this.options.skipUTF8Validation
7220
7220
  });
7221
7221
  if (this.clients) {
7222
- this.clients.add(ws);
7223
- ws.on("close", () => {
7224
- this.clients.delete(ws);
7222
+ this.clients.add(ws2);
7223
+ ws2.on("close", () => {
7224
+ this.clients.delete(ws2);
7225
7225
  if (this._shouldEmitClose && !this.clients.size) {
7226
7226
  process.nextTick(emitClose, this);
7227
7227
  }
7228
7228
  });
7229
7229
  }
7230
- cb(ws, req);
7230
+ cb(ws2, req);
7231
7231
  }
7232
7232
  };
7233
7233
  module2.exports = WebSocketServer2;
@@ -8184,7 +8184,7 @@ var require_dcmjs = __commonJS({
8184
8184
  };
8185
8185
  const compress_block = (s, ltree, dtree) => {
8186
8186
  let dist2;
8187
- let lc;
8187
+ let lc2;
8188
8188
  let sx = 0;
8189
8189
  let code;
8190
8190
  let extra;
@@ -8192,16 +8192,16 @@ var require_dcmjs = __commonJS({
8192
8192
  do {
8193
8193
  dist2 = s.pending_buf[s.sym_buf + sx++] & 255;
8194
8194
  dist2 += (s.pending_buf[s.sym_buf + sx++] & 255) << 8;
8195
- lc = s.pending_buf[s.sym_buf + sx++];
8195
+ lc2 = s.pending_buf[s.sym_buf + sx++];
8196
8196
  if (dist2 === 0) {
8197
- send_code(s, lc, ltree);
8197
+ send_code(s, lc2, ltree);
8198
8198
  } else {
8199
- code = _length_code[lc];
8199
+ code = _length_code[lc2];
8200
8200
  send_code(s, code + LITERALS$1 + 1, ltree);
8201
8201
  extra = extra_lbits[code];
8202
8202
  if (extra !== 0) {
8203
- lc -= base_length[code];
8204
- send_bits(s, lc, extra);
8203
+ lc2 -= base_length[code];
8204
+ send_bits(s, lc2, extra);
8205
8205
  }
8206
8206
  dist2--;
8207
8207
  code = d_code(dist2);
@@ -8486,16 +8486,16 @@ var require_dcmjs = __commonJS({
8486
8486
  bi_windup(s);
8487
8487
  }
8488
8488
  };
8489
- const _tr_tally$1 = (s, dist2, lc) => {
8489
+ const _tr_tally$1 = (s, dist2, lc2) => {
8490
8490
  s.pending_buf[s.sym_buf + s.sym_next++] = dist2;
8491
8491
  s.pending_buf[s.sym_buf + s.sym_next++] = dist2 >> 8;
8492
- s.pending_buf[s.sym_buf + s.sym_next++] = lc;
8492
+ s.pending_buf[s.sym_buf + s.sym_next++] = lc2;
8493
8493
  if (dist2 === 0) {
8494
- s.dyn_ltree[lc * 2]++;
8494
+ s.dyn_ltree[lc2 * 2]++;
8495
8495
  } else {
8496
8496
  s.matches++;
8497
8497
  dist2--;
8498
- s.dyn_ltree[(_length_code[lc] + LITERALS$1 + 1) * 2]++;
8498
+ s.dyn_ltree[(_length_code[lc2] + LITERALS$1 + 1) * 2]++;
8499
8499
  s.dyn_dtree[d_code(dist2) * 2]++;
8500
8500
  }
8501
8501
  return s.sym_next === s.sym_end;
@@ -15169,9 +15169,9 @@ var require_dcmjs = __commonJS({
15169
15169
  key: "rgb2XYZ",
15170
15170
  value: function rgb2XYZ(rgb) {
15171
15171
  var R2 = Colors2.invGammaCorrection(rgb[0]);
15172
- var G = Colors2.invGammaCorrection(rgb[1]);
15172
+ var G2 = Colors2.invGammaCorrection(rgb[1]);
15173
15173
  var B2 = Colors2.invGammaCorrection(rgb[2]);
15174
- return [0.41239558896741424 * R2 + 0.3575834307637148 * G + 0.18049264738170157 * B2, 0.21258623078559555 * R2 + 0.7151703037034108 * G + 0.07220049864333623 * B2, 0.019297215491746945 * R2 + 0.11918386458084854 * G + 0.9504971251315798 * B2];
15174
+ return [0.41239558896741424 * R2 + 0.3575834307637148 * G2 + 0.18049264738170157 * B2, 0.21258623078559555 * R2 + 0.7151703037034108 * G2 + 0.07220049864333623 * B2, 0.019297215491746945 * R2 + 0.11918386458084854 * G2 + 0.9504971251315798 * B2];
15175
15175
  }
15176
15176
  }, {
15177
15177
  key: "xyz2LAB",
@@ -24837,7 +24837,7 @@ var require_dcmjs = __commonJS({
24837
24837
  __proto__: null,
24838
24838
  Comprehensive3DSR
24839
24839
  });
24840
- var sr2 = {
24840
+ var sr = {
24841
24841
  coding,
24842
24842
  contentItems,
24843
24843
  documents,
@@ -25149,7 +25149,7 @@ var require_dcmjs = __commonJS({
25149
25149
  data: data2,
25150
25150
  derivations,
25151
25151
  normalizers,
25152
- sr: sr2,
25152
+ sr,
25153
25153
  utilities,
25154
25154
  log: log2,
25155
25155
  anonymizer
@@ -25166,7 +25166,7 @@ var require_dcmjs = __commonJS({
25166
25166
  exports3.derivations = derivations;
25167
25167
  exports3.log = log2;
25168
25168
  exports3.normalizers = normalizers;
25169
- exports3.sr = sr2;
25169
+ exports3.sr = sr;
25170
25170
  exports3.utilities = utilities;
25171
25171
  Object.defineProperty(exports3, "__esModule", { value: true });
25172
25172
  });
@@ -29305,8 +29305,8 @@ var require_dcmjs_dimse_min = __commonJS({
29305
29305
  "use strict";
29306
29306
  e2.exports = t;
29307
29307
  }, 237: (e2, t2, s2) => {
29308
- const { Association: n2, PresentationContext: i3 } = s2(570), { Scp: r7, Server: a3 } = s2(538), { CCancelRequest: o2, CEchoRequest: c2, CEchoResponse: d3, CFindRequest: u2, CFindResponse: h3, CGetRequest: m2, CGetResponse: g2, CMoveRequest: l3, CMoveResponse: p2, CStoreRequest: R2, CStoreResponse: S2, NActionRequest: y3, NActionResponse: f3, NCreateRequest: I2, NCreateResponse: C2, NDeleteRequest: P, NDeleteResponse: A2, NEventReportRequest: v2, NEventReportResponse: x, NGetRequest: w2, NGetResponse: U, NSetRequest: q2, NSetResponse: D2 } = s2(940), { AbortReason: E2, AbortSource: T, CommandFieldType: b2, PresentationContextResult: O2, Priority: N2, RawPduType: M2, RejectReason: B2, RejectResult: L2, RejectSource: F2, SopClass: k2, Status: $, StorageClass: j, TransferSyntax: V2, Uid: _2, UserIdentityType: G } = s2(492), z2 = s2(422), Q2 = s2(825), W2 = s2(139), J2 = s2(906), X2 = s2(73), H2 = { association: { Association: n2, PresentationContext: i3 }, Client: z2, constants: { AbortReason: E2, AbortSource: T, CommandFieldType: b2, PresentationContextResult: O2, Priority: N2, RawPduType: M2, RejectReason: B2, RejectResult: L2, RejectSource: F2, SopClass: k2, Status: $, StorageClass: j, TransferSyntax: V2, Uid: _2, UserIdentityType: G }, Dataset: Q2, Implementation: W2, log: s2(547), requests: { CCancelRequest: o2, CEchoRequest: c2, CFindRequest: u2, CGetRequest: m2, CMoveRequest: l3, CStoreRequest: R2, NActionRequest: y3, NCreateRequest: I2, NDeleteRequest: P, NEventReportRequest: v2, NGetRequest: w2, NSetRequest: q2 }, responses: { CEchoResponse: d3, CFindResponse: h3, CGetResponse: g2, CMoveResponse: p2, CStoreResponse: S2, NActionResponse: f3, NCreateResponse: C2, NDeleteResponse: A2, NEventReportResponse: x, NGetResponse: U, NSetResponse: D2 }, Scp: r7, Server: a3, Statistics: J2, Transcoding: X2, version: s2(837) };
29309
- e2.exports = H2;
29308
+ const { Association: n2, PresentationContext: i3 } = s2(570), { Scp: r7, Server: a3 } = s2(538), { CCancelRequest: o2, CEchoRequest: c2, CEchoResponse: d3, CFindRequest: u2, CFindResponse: h3, CGetRequest: m2, CGetResponse: g2, CMoveRequest: l3, CMoveResponse: p2, CStoreRequest: R2, CStoreResponse: S2, NActionRequest: y3, NActionResponse: f3, NCreateRequest: I2, NCreateResponse: C2, NDeleteRequest: P, NDeleteResponse: A2, NEventReportRequest: v2, NEventReportResponse: x, NGetRequest: w2, NGetResponse: U, NSetRequest: q2, NSetResponse: D2 } = s2(940), { AbortReason: E2, AbortSource: T, CommandFieldType: b2, PresentationContextResult: O2, Priority: N2, RawPduType: M2, RejectReason: B2, RejectResult: L2, RejectSource: F2, SopClass: k2, Status: $, StorageClass: j, TransferSyntax: V2, Uid: _2, UserIdentityType: G2 } = s2(492), z2 = s2(422), Q2 = s2(825), W2 = s2(139), J2 = s2(906), X2 = s2(73), H = { association: { Association: n2, PresentationContext: i3 }, Client: z2, constants: { AbortReason: E2, AbortSource: T, CommandFieldType: b2, PresentationContextResult: O2, Priority: N2, RawPduType: M2, RejectReason: B2, RejectResult: L2, RejectSource: F2, SopClass: k2, Status: $, StorageClass: j, TransferSyntax: V2, Uid: _2, UserIdentityType: G2 }, Dataset: Q2, Implementation: W2, log: s2(547), requests: { CCancelRequest: o2, CEchoRequest: c2, CFindRequest: u2, CGetRequest: m2, CMoveRequest: l3, CStoreRequest: R2, NActionRequest: y3, NCreateRequest: I2, NDeleteRequest: P, NEventReportRequest: v2, NGetRequest: w2, NSetRequest: q2 }, responses: { CEchoResponse: d3, CFindResponse: h3, CGetResponse: g2, CMoveResponse: p2, CStoreResponse: S2, NActionResponse: f3, NCreateResponse: C2, NDeleteResponse: A2, NEventReportResponse: x, NGetResponse: U, NSetResponse: D2 }, Scp: r7, Server: a3, Statistics: J2, Transcoding: X2, version: s2(837) };
29309
+ e2.exports = H;
29310
29310
  }, 278: (e2) => {
29311
29311
  "use strict";
29312
29312
  e2.exports = require("net");
@@ -29314,8 +29314,8 @@ var require_dcmjs_dimse_min = __commonJS({
29314
29314
  "use strict";
29315
29315
  e2.exports = s;
29316
29316
  }, 371: (e2, t2, s2) => {
29317
- const { Association: n2 } = s2(570), { AAbort: i3, AAssociateAC: r7, AAssociateRJ: a3, AAssociateRQ: o2, AReleaseRP: c2, AReleaseRQ: d3, PDataTF: u2, Pdv: h3, RawPdu: m2 } = s2(942), { CommandFieldType: g2, RawPduType: l3, Status: p2 } = s2(492), { CCancelRequest: R2, CEchoRequest: S2, CEchoResponse: y3, CFindRequest: f3, CFindResponse: I2, CGetRequest: C2, CGetResponse: P, CMoveRequest: A2, CMoveResponse: v2, Command: x, CStoreRequest: w2, CStoreResponse: U, NActionRequest: q2, NActionResponse: D2, NCreateRequest: E2, NCreateResponse: T, NDeleteRequest: b2, NDeleteResponse: O2, NEventReportRequest: N2, NEventReportResponse: M2, NGetRequest: B2, NGetResponse: L2, NSetRequest: F2, NSetResponse: k2, Response: $ } = s2(940), j = s2(825), V2 = s2(139), _2 = s2(906), G = s2(73), z2 = s2(547), { SmartBuffer: Q2 } = s2(766), { EOL: W2 } = s2(857), J2 = s2(733), X2 = s2(235);
29318
- class H2 extends J2 {
29317
+ const { Association: n2 } = s2(570), { AAbort: i3, AAssociateAC: r7, AAssociateRJ: a3, AAssociateRQ: o2, AReleaseRP: c2, AReleaseRQ: d3, PDataTF: u2, Pdv: h3, RawPdu: m2 } = s2(942), { CommandFieldType: g2, RawPduType: l3, Status: p2 } = s2(492), { CCancelRequest: R2, CEchoRequest: S2, CEchoResponse: y3, CFindRequest: f3, CFindResponse: I2, CGetRequest: C2, CGetResponse: P, CMoveRequest: A2, CMoveResponse: v2, Command: x, CStoreRequest: w2, CStoreResponse: U, NActionRequest: q2, NActionResponse: D2, NCreateRequest: E2, NCreateResponse: T, NDeleteRequest: b2, NDeleteResponse: O2, NEventReportRequest: N2, NEventReportResponse: M2, NGetRequest: B2, NGetResponse: L2, NSetRequest: F2, NSetResponse: k2, Response: $ } = s2(940), j = s2(825), V2 = s2(139), _2 = s2(906), G2 = s2(73), z2 = s2(547), { SmartBuffer: Q2 } = s2(766), { EOL: W2 } = s2(857), J2 = s2(733), X2 = s2(235);
29318
+ class H extends J2 {
29319
29319
  constructor() {
29320
29320
  super();
29321
29321
  }
@@ -29435,7 +29435,7 @@ var require_dcmjs_dimse_min = __commonJS({
29435
29435
  try {
29436
29436
  const t3 = e3.command.getDataset(), s3 = this.association.getPresentationContext(e3.context.getPresentationContextId()).getAcceptedTransferSyntaxUid();
29437
29437
  if (t3 && s3 !== t3.getTransferSyntaxUid()) try {
29438
- const n3 = G.transcodeDataset(t3, s3, this.datasetTranscodeOptions);
29438
+ const n3 = G2.transcodeDataset(t3, s3, this.datasetTranscodeOptions);
29439
29439
  e3.command.setDataset(n3);
29440
29440
  } catch (t4) {
29441
29441
  return z2.error(t4.message), void e3.command.raiseDoneEvent();
@@ -29641,7 +29641,7 @@ var require_dcmjs_dimse_min = __commonJS({
29641
29641
  this.socket.setTimeout(this.connectTimeout), this.socket.on("connect", () => {
29642
29642
  this.connected = true, this.connectedTime = Date.now(), this.emit("connect");
29643
29643
  });
29644
- const e3 = new H2();
29644
+ const e3 = new H();
29645
29645
  e3.on("pdu", async (e4) => {
29646
29646
  this.lastPduTime = Date.now(), await this._processPdu(e4);
29647
29647
  }), e3.on("error", (e4) => {
@@ -31402,10 +31402,10 @@ var nt = class {
31402
31402
  }, precedence: t });
31403
31403
  }
31404
31404
  construct(e) {
31405
- return new tr(e, this.prefixParselets, this.infixParselets);
31405
+ return new rr(e, this.prefixParselets, this.infixParselets);
31406
31406
  }
31407
31407
  };
31408
- var tr = class {
31408
+ var rr = class {
31409
31409
  constructor(e, t, n) {
31410
31410
  this.tokens = e, this.prefixParselets = t, this.infixParselets = n;
31411
31411
  }
@@ -31453,7 +31453,7 @@ var tr = class {
31453
31453
  return this.infixParselets[e.id === "Symbol" ? e.value : e.id];
31454
31454
  }
31455
31455
  };
31456
- var Ce = class {
31456
+ var Pe = class {
31457
31457
  constructor(e = 10) {
31458
31458
  this.max = e, this.cache = /* @__PURE__ */ new Map();
31459
31459
  }
@@ -31477,101 +31477,101 @@ var Ce = class {
31477
31477
  return this.cache.keys().next().value;
31478
31478
  }
31479
31479
  };
31480
- var rr = "ok";
31480
+ var nr = "ok";
31481
31481
  var it = "created";
31482
- var ir = "not-modified";
31483
- var sr = "not-found";
31484
- var cr = "unauthorized";
31482
+ var or = "not-modified";
31483
+ var ar = "not-found";
31484
+ var ur = "unauthorized";
31485
31485
  var ot = "accepted";
31486
- var vn = { resourceType: "OperationOutcome", id: sr, issue: [{ severity: "error", code: "not-found", details: { text: "Not found" } }] };
31487
- var Pe = { resourceType: "OperationOutcome", id: cr, issue: [{ severity: "error", code: "login", details: { text: "Unauthorized" } }] };
31488
- var Tn = { ...Pe, issue: [...Pe.issue, { severity: "error", code: "expired", details: { text: "Token expired" } }] };
31489
- var ur = { ...Pe, issue: [...Pe.issue, { severity: "error", code: "invalid", details: { text: "Token not issued for this audience" } }] };
31486
+ var xn = { resourceType: "OperationOutcome", id: ar, issue: [{ severity: "error", code: "not-found", details: { text: "Not found" } }] };
31487
+ var we = { resourceType: "OperationOutcome", id: ur, issue: [{ severity: "error", code: "login", details: { text: "Unauthorized" } }] };
31488
+ var vn = { ...we, issue: [...we.issue, { severity: "error", code: "expired", details: { text: "Token expired" } }] };
31489
+ var lr = { ...we, issue: [...we.issue, { severity: "error", code: "invalid", details: { text: "Token not issued for this audience" } }] };
31490
31490
  function b(r6, e) {
31491
31491
  return { resourceType: "OperationOutcome", issue: [{ severity: "error", code: "invalid", details: { text: r6 }, ...e ? { expression: [e] } : void 0 }] };
31492
31492
  }
31493
31493
  function y(r6) {
31494
31494
  return { resourceType: "OperationOutcome", issue: [{ severity: "error", code: "structure", details: { text: r6 } }] };
31495
31495
  }
31496
- function Sn(r6) {
31496
+ function Tn(r6) {
31497
31497
  return { resourceType: "OperationOutcome", issue: [{ severity: "error", code: "exception", details: { text: "Internal server error" }, diagnostics: r6.toString() }] };
31498
31498
  }
31499
- function we(r6) {
31499
+ function Ae(r6) {
31500
31500
  return typeof r6 == "object" && r6 !== null && r6.resourceType === "OperationOutcome";
31501
31501
  }
31502
- function lr(r6) {
31503
- return r6.id === rr || r6.id === it || r6.id === ir || r6.id === ot;
31502
+ function dr(r6) {
31503
+ return r6.id === nr || r6.id === it || r6.id === or || r6.id === ot;
31504
31504
  }
31505
31505
  var p = class extends Error {
31506
31506
  constructor(e, t) {
31507
- super(bn(e)), this.outcome = e, this.cause = t;
31507
+ super(Sn(e)), this.outcome = e, this.cause = t;
31508
31508
  }
31509
31509
  };
31510
31510
  function st(r6) {
31511
- return r6 instanceof p ? r6.outcome : we(r6) ? r6 : b(Ae(r6));
31511
+ return r6 instanceof p ? r6.outcome : Ae(r6) ? r6 : b(Oe(r6));
31512
31512
  }
31513
- function Ae(r6) {
31514
- return r6 ? typeof r6 == "string" ? r6 : r6 instanceof Error ? r6.message : we(r6) ? bn(r6) : typeof r6 == "object" && "code" in r6 && typeof r6.code == "string" ? r6.code : JSON.stringify(r6) : "Unknown error";
31513
+ function Oe(r6) {
31514
+ return r6 ? typeof r6 == "string" ? r6 : r6 instanceof Error ? r6.message : Ae(r6) ? Sn(r6) : typeof r6 == "object" && "code" in r6 && typeof r6.code == "string" ? r6.code : JSON.stringify(r6) : "Unknown error";
31515
31515
  }
31516
- function bn(r6) {
31517
- let e = r6.issue?.map(so) ?? [];
31516
+ function Sn(r6) {
31517
+ let e = r6.issue?.map(ao) ?? [];
31518
31518
  return e.length > 0 ? e.join("; ") : "Unknown error";
31519
31519
  }
31520
- function so(r6) {
31520
+ function ao(r6) {
31521
31521
  let e;
31522
31522
  return r6.details?.text ? r6.diagnostics ? e = `${r6.details.text} (${r6.diagnostics})` : e = r6.details.text : r6.diagnostics ? e = r6.diagnostics : e = "Unknown error", r6.expression?.length && (e += ` (${r6.expression.join(", ")})`), e;
31523
31523
  }
31524
- function co(r6, e) {
31524
+ function uo(r6, e) {
31525
31525
  let t = e.max && e.max === Number.MAX_SAFE_INTEGER ? Number.POSITIVE_INFINITY : e.max;
31526
31526
  return { path: r6, description: "", type: e.type ?? [], min: e.min ?? 0, max: t ?? 1, isArray: !!t && t > 1, constraints: [] };
31527
31527
  }
31528
- function Cn(r6) {
31528
+ function Rn(r6) {
31529
31529
  let e = /* @__PURE__ */ Object.create(null);
31530
- for (let [t, n] of Object.entries(r6)) e[t] = { name: t, type: t, path: t, elements: Object.fromEntries(Object.entries(n.elements).map(([i2, o]) => [i2, co(i2, o)])), constraints: [], innerTypes: [] };
31530
+ for (let [t, n] of Object.entries(r6)) e[t] = { name: t, type: t, path: t, elements: Object.fromEntries(Object.entries(n.elements).map(([i2, o]) => [i2, uo(i2, o)])), constraints: [], innerTypes: [] };
31531
31531
  return e;
31532
31532
  }
31533
- var Pn = { Element: { elements: { id: { type: [{ code: "string" }] }, extension: { max: 9007199254740991, type: [{ code: "Extension" }] } } }, BackboneElement: { elements: { id: { type: [{ code: "string" }] }, extension: { max: 9007199254740991, type: [{ code: "Extension" }] }, modifierExtension: { max: 9007199254740991, type: [{ code: "Extension" }] } } }, Address: { elements: { id: { type: [{ code: "string" }] }, extension: { max: 9007199254740991, type: [{ code: "Extension" }] }, use: { type: [{ code: "code" }] }, type: { type: [{ code: "code" }] }, text: { type: [{ code: "string" }] }, line: { max: 9007199254740991, type: [{ code: "string" }] }, city: { type: [{ code: "string" }] }, district: { type: [{ code: "string" }] }, state: { type: [{ code: "string" }] }, postalCode: { type: [{ code: "string" }] }, country: { type: [{ code: "string" }] }, period: { type: [{ code: "Period" }] } } }, Age: { elements: { id: { type: [{ code: "string" }] }, extension: { max: 9007199254740991, type: [{ code: "Extension" }] }, value: { type: [{ code: "decimal" }] }, comparator: { type: [{ code: "code" }] }, unit: { type: [{ code: "string" }] }, system: { type: [{ code: "uri" }] }, code: { type: [{ code: "code" }] } } }, Annotation: { elements: { id: { type: [{ code: "string" }] }, extension: { max: 9007199254740991, type: [{ code: "Extension" }] }, "author[x]": { type: [{ code: "Reference", targetProfile: ["http://hl7.org/fhir/StructureDefinition/Practitioner", "http://hl7.org/fhir/StructureDefinition/Patient", "http://hl7.org/fhir/StructureDefinition/RelatedPerson", "http://hl7.org/fhir/StructureDefinition/Organization"] }, { code: "string" }] }, time: { type: [{ code: "dateTime" }] }, text: { min: 1, type: [{ code: "markdown" }] } } }, Attachment: { elements: { id: { type: [{ code: "string" }] }, extension: { max: 9007199254740991, type: [{ code: "Extension" }] }, contentType: { type: [{ code: "code" }] }, language: { type: [{ code: "code" }] }, data: { type: [{ code: "base64Binary" }] }, url: { type: [{ code: "url" }] }, size: { type: [{ code: "unsignedInt" }] }, hash: { type: [{ code: "base64Binary" }] }, title: { type: [{ code: "string" }] }, creation: { type: [{ code: "dateTime" }] } } }, CodeableConcept: { elements: { id: { type: [{ code: "string" }] }, extension: { max: 9007199254740991, type: [{ code: "Extension" }] }, coding: { max: 9007199254740991, type: [{ code: "Coding" }] }, text: { type: [{ code: "string" }] } } }, Coding: { elements: { id: { type: [{ code: "string" }] }, extension: { max: 9007199254740991, type: [{ code: "Extension" }] }, system: { type: [{ code: "uri" }] }, version: { type: [{ code: "string" }] }, code: { type: [{ code: "code" }] }, display: { type: [{ code: "string" }] }, userSelected: { type: [{ code: "boolean" }] } } }, ContactDetail: { elements: { id: { type: [{ code: "string" }] }, extension: { max: 9007199254740991, type: [{ code: "Extension" }] }, name: { type: [{ code: "string" }] }, telecom: { max: 9007199254740991, type: [{ code: "ContactPoint" }] } } }, ContactPoint: { elements: { id: { type: [{ code: "string" }] }, extension: { max: 9007199254740991, type: [{ code: "Extension" }] }, system: { type: [{ code: "code" }] }, value: { type: [{ code: "string" }] }, use: { type: [{ code: "code" }] }, rank: { type: [{ code: "positiveInt" }] }, period: { type: [{ code: "Period" }] } } }, Contributor: { elements: { id: { type: [{ code: "string" }] }, extension: { max: 9007199254740991, type: [{ code: "Extension" }] }, type: { min: 1, type: [{ code: "code" }] }, name: { min: 1, type: [{ code: "string" }] }, contact: { max: 9007199254740991, type: [{ code: "ContactDetail" }] } } }, Count: { elements: { id: { type: [{ code: "string" }] }, extension: { max: 9007199254740991, type: [{ code: "Extension" }] }, value: { type: [{ code: "decimal" }] }, comparator: { type: [{ code: "code" }] }, unit: { type: [{ code: "string" }] }, system: { type: [{ code: "uri" }] }, code: { type: [{ code: "code" }] } } }, DataRequirement: { elements: { id: { type: [{ code: "string" }] }, extension: { max: 9007199254740991, type: [{ code: "Extension" }] }, type: { min: 1, type: [{ code: "code" }] }, profile: { max: 9007199254740991, type: [{ code: "canonical", targetProfile: ["http://hl7.org/fhir/StructureDefinition/StructureDefinition"] }] }, "subject[x]": { type: [{ code: "CodeableConcept" }, { code: "Reference", targetProfile: ["http://hl7.org/fhir/StructureDefinition/Group"] }] }, mustSupport: { max: 9007199254740991, type: [{ code: "string" }] }, codeFilter: { max: 9007199254740991, type: [{ code: "DataRequirementCodeFilter" }] }, dateFilter: { max: 9007199254740991, type: [{ code: "DataRequirementDateFilter" }] }, limit: { type: [{ code: "positiveInt" }] }, sort: { max: 9007199254740991, type: [{ code: "DataRequirementSort" }] } } }, DataRequirementCodeFilter: { elements: { id: { type: [{ code: "string" }] }, extension: { max: 9007199254740991, type: [{ code: "Extension" }] }, path: { type: [{ code: "string" }] }, searchParam: { type: [{ code: "string" }] }, valueSet: { type: [{ code: "canonical", targetProfile: ["http://hl7.org/fhir/StructureDefinition/ValueSet"] }] }, code: { max: 9007199254740991, type: [{ code: "Coding" }] } } }, DataRequirementDateFilter: { elements: { id: { type: [{ code: "string" }] }, extension: { max: 9007199254740991, type: [{ code: "Extension" }] }, path: { type: [{ code: "string" }] }, searchParam: { type: [{ code: "string" }] }, "value[x]": { type: [{ code: "dateTime" }, { code: "Period" }, { code: "Duration" }] } } }, DataRequirementSort: { elements: { id: { type: [{ code: "string" }] }, extension: { max: 9007199254740991, type: [{ code: "Extension" }] }, path: { min: 1, type: [{ code: "string" }] }, direction: { min: 1, type: [{ code: "code" }] } } }, Distance: { elements: { id: { type: [{ code: "string" }] }, extension: { max: 9007199254740991, type: [{ code: "Extension" }] }, value: { type: [{ code: "decimal" }] }, comparator: { type: [{ code: "code" }] }, unit: { type: [{ code: "string" }] }, system: { type: [{ code: "uri" }] }, code: { type: [{ code: "code" }] } } }, Dosage: { elements: { id: { type: [{ code: "string" }] }, extension: { max: 9007199254740991, type: [{ code: "Extension" }] }, modifierExtension: { max: 9007199254740991, type: [{ code: "Extension" }] }, sequence: { type: [{ code: "integer" }] }, text: { type: [{ code: "string" }] }, additionalInstruction: { max: 9007199254740991, type: [{ code: "CodeableConcept" }] }, patientInstruction: { type: [{ code: "string" }] }, timing: { type: [{ code: "Timing" }] }, "asNeeded[x]": { type: [{ code: "boolean" }, { code: "CodeableConcept" }] }, site: { type: [{ code: "CodeableConcept" }] }, route: { type: [{ code: "CodeableConcept" }] }, method: { type: [{ code: "CodeableConcept" }] }, doseAndRate: { max: 9007199254740991, type: [{ code: "DosageDoseAndRate" }] }, maxDosePerPeriod: { type: [{ code: "Ratio" }] }, maxDosePerAdministration: { type: [{ code: "Quantity", profile: ["http://hl7.org/fhir/StructureDefinition/SimpleQuantity"] }] }, maxDosePerLifetime: { type: [{ code: "Quantity", profile: ["http://hl7.org/fhir/StructureDefinition/SimpleQuantity"] }] } } }, DosageDoseAndRate: { elements: { id: { type: [{ code: "string" }] }, extension: { max: 9007199254740991, type: [{ code: "Extension" }] }, type: { type: [{ code: "CodeableConcept" }] }, "dose[x]": { type: [{ code: "Range" }, { code: "Quantity", profile: ["http://hl7.org/fhir/StructureDefinition/SimpleQuantity"] }] }, "rate[x]": { type: [{ code: "Ratio" }, { code: "Range" }, { code: "Quantity", profile: ["http://hl7.org/fhir/StructureDefinition/SimpleQuantity"] }] } } }, Duration: { elements: { id: { type: [{ code: "string" }] }, extension: { max: 9007199254740991, type: [{ code: "Extension" }] }, value: { type: [{ code: "decimal" }] }, comparator: { type: [{ code: "code" }] }, unit: { type: [{ code: "string" }] }, system: { type: [{ code: "uri" }] }, code: { type: [{ code: "code" }] } } }, ElementDefinition: { elements: { id: { type: [{ code: "string" }] }, extension: { max: 9007199254740991, type: [{ code: "Extension" }] }, modifierExtension: { max: 9007199254740991, type: [{ code: "Extension" }] }, path: { min: 1, type: [{ code: "string" }] }, representation: { max: 9007199254740991, type: [{ code: "code" }] }, sliceName: { type: [{ code: "string" }] }, sliceIsConstraining: { type: [{ code: "boolean" }] }, label: { type: [{ code: "string" }] }, code: { max: 9007199254740991, type: [{ code: "Coding" }] }, slicing: { type: [{ code: "ElementDefinitionSlicing" }] }, short: { type: [{ code: "string" }] }, definition: { type: [{ code: "markdown" }] }, comment: { type: [{ code: "markdown" }] }, requirements: { type: [{ code: "markdown" }] }, alias: { max: 9007199254740991, type: [{ code: "string" }] }, min: { type: [{ code: "unsignedInt" }] }, max: { type: [{ code: "string" }] }, base: { type: [{ code: "ElementDefinitionBase" }] }, contentReference: { type: [{ code: "uri" }] }, type: { max: 9007199254740991, type: [{ code: "ElementDefinitionType" }] }, "defaultValue[x]": { type: [{ code: "base64Binary" }, { code: "boolean" }, { code: "canonical" }, { code: "code" }, { code: "date" }, { code: "dateTime" }, { code: "decimal" }, { code: "id" }, { code: "instant" }, { code: "integer" }, { code: "markdown" }, { code: "oid" }, { code: "positiveInt" }, { code: "string" }, { code: "time" }, { code: "unsignedInt" }, { code: "uri" }, { code: "url" }, { code: "uuid" }, { code: "Address" }, { code: "Age" }, { code: "Annotation" }, { code: "Attachment" }, { code: "CodeableConcept" }, { code: "Coding" }, { code: "ContactPoint" }, { code: "Count" }, { code: "Distance" }, { code: "Duration" }, { code: "HumanName" }, { code: "Identifier" }, { code: "Money" }, { code: "Period" }, { code: "Quantity" }, { code: "Range" }, { code: "Ratio" }, { code: "Reference" }, { code: "SampledData" }, { code: "Signature" }, { code: "Timing" }, { code: "ContactDetail" }, { code: "Contributor" }, { code: "DataRequirement" }, { code: "Expression" }, { code: "ParameterDefinition" }, { code: "RelatedArtifact" }, { code: "TriggerDefinition" }, { code: "UsageContext" }, { code: "Dosage" }, { code: "Meta" }] }, meaningWhenMissing: { type: [{ code: "markdown" }] }, orderMeaning: { type: [{ code: "string" }] }, "fixed[x]": { type: [{ code: "base64Binary" }, { code: "boolean" }, { code: "canonical" }, { code: "code" }, { code: "date" }, { code: "dateTime" }, { code: "decimal" }, { code: "id" }, { code: "instant" }, { code: "integer" }, { code: "markdown" }, { code: "oid" }, { code: "positiveInt" }, { code: "string" }, { code: "time" }, { code: "unsignedInt" }, { code: "uri" }, { code: "url" }, { code: "uuid" }, { code: "Address" }, { code: "Age" }, { code: "Annotation" }, { code: "Attachment" }, { code: "CodeableConcept" }, { code: "Coding" }, { code: "ContactPoint" }, { code: "Count" }, { code: "Distance" }, { code: "Duration" }, { code: "HumanName" }, { code: "Identifier" }, { code: "Money" }, { code: "Period" }, { code: "Quantity" }, { code: "Range" }, { code: "Ratio" }, { code: "Reference" }, { code: "SampledData" }, { code: "Signature" }, { code: "Timing" }, { code: "ContactDetail" }, { code: "Contributor" }, { code: "DataRequirement" }, { code: "Expression" }, { code: "ParameterDefinition" }, { code: "RelatedArtifact" }, { code: "TriggerDefinition" }, { code: "UsageContext" }, { code: "Dosage" }, { code: "Meta" }] }, "pattern[x]": { type: [{ code: "base64Binary" }, { code: "boolean" }, { code: "canonical" }, { code: "code" }, { code: "date" }, { code: "dateTime" }, { code: "decimal" }, { code: "id" }, { code: "instant" }, { code: "integer" }, { code: "markdown" }, { code: "oid" }, { code: "positiveInt" }, { code: "string" }, { code: "time" }, { code: "unsignedInt" }, { code: "uri" }, { code: "url" }, { code: "uuid" }, { code: "Address" }, { code: "Age" }, { code: "Annotation" }, { code: "Attachment" }, { code: "CodeableConcept" }, { code: "Coding" }, { code: "ContactPoint" }, { code: "Count" }, { code: "Distance" }, { code: "Duration" }, { code: "HumanName" }, { code: "Identifier" }, { code: "Money" }, { code: "Period" }, { code: "Quantity" }, { code: "Range" }, { code: "Ratio" }, { code: "Reference" }, { code: "SampledData" }, { code: "Signature" }, { code: "Timing" }, { code: "ContactDetail" }, { code: "Contributor" }, { code: "DataRequirement" }, { code: "Expression" }, { code: "ParameterDefinition" }, { code: "RelatedArtifact" }, { code: "TriggerDefinition" }, { code: "UsageContext" }, { code: "Dosage" }, { code: "Meta" }] }, example: { max: 9007199254740991, type: [{ code: "ElementDefinitionExample" }] }, "minValue[x]": { type: [{ code: "date" }, { code: "dateTime" }, { code: "instant" }, { code: "time" }, { code: "decimal" }, { code: "integer" }, { code: "positiveInt" }, { code: "unsignedInt" }, { code: "Quantity" }] }, "maxValue[x]": { type: [{ code: "date" }, { code: "dateTime" }, { code: "instant" }, { code: "time" }, { code: "decimal" }, { code: "integer" }, { code: "positiveInt" }, { code: "unsignedInt" }, { code: "Quantity" }] }, maxLength: { type: [{ code: "integer" }] }, condition: { max: 9007199254740991, type: [{ code: "id" }] }, constraint: { max: 9007199254740991, type: [{ code: "ElementDefinitionConstraint" }] }, mustSupport: { type: [{ code: "boolean" }] }, isModifier: { type: [{ code: "boolean" }] }, isModifierReason: { type: [{ code: "string" }] }, isSummary: { type: [{ code: "boolean" }] }, binding: { type: [{ code: "ElementDefinitionBinding" }] }, mapping: { max: 9007199254740991, type: [{ code: "ElementDefinitionMapping" }] } } }, ElementDefinitionSlicingDiscriminator: { elements: { id: { type: [{ code: "string" }] }, extension: { max: 9007199254740991, type: [{ code: "Extension" }] }, type: { min: 1, type: [{ code: "code" }] }, path: { min: 1, type: [{ code: "string" }] } } }, ElementDefinitionSlicing: { elements: { id: { type: [{ code: "string" }] }, extension: { max: 9007199254740991, type: [{ code: "Extension" }] }, discriminator: { max: 9007199254740991, type: [{ code: "ElementDefinitionSlicingDiscriminator" }] }, description: { type: [{ code: "string" }] }, ordered: { type: [{ code: "boolean" }] }, rules: { min: 1, type: [{ code: "code" }] } } }, ElementDefinitionBase: { elements: { id: { type: [{ code: "string" }] }, extension: { max: 9007199254740991, type: [{ code: "Extension" }] }, path: { min: 1, type: [{ code: "string" }] }, min: { min: 1, type: [{ code: "unsignedInt" }] }, max: { min: 1, type: [{ code: "string" }] } } }, ElementDefinitionType: { elements: { id: { type: [{ code: "string" }] }, extension: { max: 9007199254740991, type: [{ code: "Extension" }] }, code: { min: 1, type: [{ code: "uri" }] }, profile: { max: 9007199254740991, type: [{ code: "canonical", targetProfile: ["http://hl7.org/fhir/StructureDefinition/StructureDefinition", "http://hl7.org/fhir/StructureDefinition/ImplementationGuide"] }] }, targetProfile: { max: 9007199254740991, type: [{ code: "canonical", targetProfile: ["http://hl7.org/fhir/StructureDefinition/StructureDefinition", "http://hl7.org/fhir/StructureDefinition/ImplementationGuide"] }] }, aggregation: { max: 9007199254740991, type: [{ code: "code" }] }, versioning: { type: [{ code: "code" }] } } }, ElementDefinitionExample: { elements: { id: { type: [{ code: "string" }] }, extension: { max: 9007199254740991, type: [{ code: "Extension" }] }, label: { min: 1, type: [{ code: "string" }] }, "value[x]": { min: 1, type: [{ code: "base64Binary" }, { code: "boolean" }, { code: "canonical" }, { code: "code" }, { code: "date" }, { code: "dateTime" }, { code: "decimal" }, { code: "id" }, { code: "instant" }, { code: "integer" }, { code: "markdown" }, { code: "oid" }, { code: "positiveInt" }, { code: "string" }, { code: "time" }, { code: "unsignedInt" }, { code: "uri" }, { code: "url" }, { code: "uuid" }, { code: "Address" }, { code: "Age" }, { code: "Annotation" }, { code: "Attachment" }, { code: "CodeableConcept" }, { code: "Coding" }, { code: "ContactPoint" }, { code: "Count" }, { code: "Distance" }, { code: "Duration" }, { code: "HumanName" }, { code: "Identifier" }, { code: "Money" }, { code: "Period" }, { code: "Quantity" }, { code: "Range" }, { code: "Ratio" }, { code: "Reference" }, { code: "SampledData" }, { code: "Signature" }, { code: "Timing" }, { code: "ContactDetail" }, { code: "Contributor" }, { code: "DataRequirement" }, { code: "Expression" }, { code: "ParameterDefinition" }, { code: "RelatedArtifact" }, { code: "TriggerDefinition" }, { code: "UsageContext" }, { code: "Dosage" }, { code: "Meta" }] } } }, ElementDefinitionConstraint: { elements: { id: { type: [{ code: "string" }] }, extension: { max: 9007199254740991, type: [{ code: "Extension" }] }, key: { min: 1, type: [{ code: "id" }] }, requirements: { type: [{ code: "string" }] }, severity: { min: 1, type: [{ code: "code" }] }, human: { min: 1, type: [{ code: "string" }] }, expression: { type: [{ code: "string" }] }, xpath: { type: [{ code: "string" }] }, source: { type: [{ code: "canonical", targetProfile: ["http://hl7.org/fhir/StructureDefinition/StructureDefinition"] }] } } }, ElementDefinitionBinding: { elements: { id: { type: [{ code: "string" }] }, extension: { max: 9007199254740991, type: [{ code: "Extension" }] }, strength: { min: 1, type: [{ code: "code" }] }, description: { type: [{ code: "string" }] }, valueSet: { type: [{ code: "canonical", targetProfile: ["http://hl7.org/fhir/StructureDefinition/ValueSet"] }] } } }, ElementDefinitionMapping: { elements: { id: { type: [{ code: "string" }] }, extension: { max: 9007199254740991, type: [{ code: "Extension" }] }, identity: { min: 1, type: [{ code: "id" }] }, language: { type: [{ code: "code" }] }, map: { min: 1, type: [{ code: "string" }] }, comment: { type: [{ code: "string" }] } } }, Expression: { elements: { id: { type: [{ code: "string" }] }, extension: { max: 9007199254740991, type: [{ code: "Extension" }] }, description: { type: [{ code: "string" }] }, name: { type: [{ code: "id" }] }, language: { min: 1, type: [{ code: "code" }] }, expression: { type: [{ code: "string" }] }, reference: { type: [{ code: "uri" }] } } }, Extension: { elements: { id: { type: [{ code: "string" }] }, extension: { max: 9007199254740991, type: [{ code: "Extension" }] }, url: { min: 1, type: [{ code: "uri" }] }, "value[x]": { type: [{ code: "base64Binary" }, { code: "boolean" }, { code: "canonical" }, { code: "code" }, { code: "date" }, { code: "dateTime" }, { code: "decimal" }, { code: "id" }, { code: "instant" }, { code: "integer" }, { code: "markdown" }, { code: "oid" }, { code: "positiveInt" }, { code: "string" }, { code: "time" }, { code: "unsignedInt" }, { code: "uri" }, { code: "url" }, { code: "uuid" }, { code: "Address" }, { code: "Age" }, { code: "Annotation" }, { code: "Attachment" }, { code: "CodeableConcept" }, { code: "Coding" }, { code: "ContactPoint" }, { code: "Count" }, { code: "Distance" }, { code: "Duration" }, { code: "HumanName" }, { code: "Identifier" }, { code: "Money" }, { code: "Period" }, { code: "Quantity" }, { code: "Range" }, { code: "Ratio" }, { code: "Reference" }, { code: "SampledData" }, { code: "Signature" }, { code: "Timing" }, { code: "ContactDetail" }, { code: "Contributor" }, { code: "DataRequirement" }, { code: "Expression" }, { code: "ParameterDefinition" }, { code: "RelatedArtifact" }, { code: "TriggerDefinition" }, { code: "UsageContext" }, { code: "Dosage" }, { code: "Meta" }] } } }, HumanName: { elements: { id: { type: [{ code: "string" }] }, extension: { max: 9007199254740991, type: [{ code: "Extension" }] }, use: { type: [{ code: "code" }] }, text: { type: [{ code: "string" }] }, family: { type: [{ code: "string" }] }, given: { max: 9007199254740991, type: [{ code: "string" }] }, prefix: { max: 9007199254740991, type: [{ code: "string" }] }, suffix: { max: 9007199254740991, type: [{ code: "string" }] }, period: { type: [{ code: "Period" }] } } }, Identifier: { elements: { id: { type: [{ code: "string" }] }, extension: { max: 9007199254740991, type: [{ code: "Extension" }] }, use: { type: [{ code: "code" }] }, type: { type: [{ code: "CodeableConcept" }] }, system: { type: [{ code: "uri" }] }, value: { type: [{ code: "string" }] }, period: { type: [{ code: "Period" }] }, assigner: { type: [{ code: "Reference", targetProfile: ["http://hl7.org/fhir/StructureDefinition/Organization"] }] } } }, MarketingStatus: { elements: { id: { type: [{ code: "string" }] }, extension: { max: 9007199254740991, type: [{ code: "Extension" }] }, modifierExtension: { max: 9007199254740991, type: [{ code: "Extension" }] }, country: { min: 1, type: [{ code: "CodeableConcept" }] }, jurisdiction: { type: [{ code: "CodeableConcept" }] }, status: { min: 1, type: [{ code: "CodeableConcept" }] }, dateRange: { min: 1, type: [{ code: "Period" }] }, restoreDate: { type: [{ code: "dateTime" }] } } }, Meta: { elements: { id: { type: [{ code: "string" }] }, extension: { max: 9007199254740991, type: [{ code: "Extension" }] }, versionId: { type: [{ code: "id" }] }, lastUpdated: { type: [{ code: "instant" }] }, source: { type: [{ code: "uri" }] }, profile: { max: 9007199254740991, type: [{ code: "canonical", targetProfile: ["http://hl7.org/fhir/StructureDefinition/StructureDefinition"] }] }, security: { max: 9007199254740991, type: [{ code: "Coding" }] }, tag: { max: 9007199254740991, type: [{ code: "Coding" }] }, project: { type: [{ code: "uri" }] }, author: { type: [{ code: "Reference" }] }, onBehalfOf: { type: [{ code: "Reference" }] }, account: { type: [{ code: "Reference" }] }, accounts: { max: 9007199254740991, type: [{ code: "Reference" }] }, compartment: { max: 9007199254740991, type: [{ code: "Reference" }] } } }, Money: { elements: { id: { type: [{ code: "string" }] }, extension: { max: 9007199254740991, type: [{ code: "Extension" }] }, value: { type: [{ code: "decimal" }] }, currency: { type: [{ code: "code" }] } } }, Narrative: { elements: { id: { type: [{ code: "string" }] }, extension: { max: 9007199254740991, type: [{ code: "Extension" }] }, status: { min: 1, type: [{ code: "code" }] }, div: { min: 1, type: [{ code: "xhtml" }] } } }, ParameterDefinition: { elements: { id: { type: [{ code: "string" }] }, extension: { max: 9007199254740991, type: [{ code: "Extension" }] }, name: { type: [{ code: "code" }] }, use: { min: 1, type: [{ code: "code" }] }, min: { type: [{ code: "integer" }] }, max: { type: [{ code: "string" }] }, documentation: { type: [{ code: "string" }] }, type: { min: 1, type: [{ code: "code" }] }, profile: { type: [{ code: "canonical", targetProfile: ["http://hl7.org/fhir/StructureDefinition/StructureDefinition"] }] } } }, Period: { elements: { id: { type: [{ code: "string" }] }, extension: { max: 9007199254740991, type: [{ code: "Extension" }] }, start: { type: [{ code: "dateTime" }] }, end: { type: [{ code: "dateTime" }] } } }, Population: { elements: { id: { type: [{ code: "string" }] }, extension: { max: 9007199254740991, type: [{ code: "Extension" }] }, modifierExtension: { max: 9007199254740991, type: [{ code: "Extension" }] }, "age[x]": { type: [{ code: "Range" }, { code: "CodeableConcept" }] }, gender: { type: [{ code: "CodeableConcept" }] }, race: { type: [{ code: "CodeableConcept" }] }, physiologicalCondition: { type: [{ code: "CodeableConcept" }] } } }, ProdCharacteristic: { elements: { id: { type: [{ code: "string" }] }, extension: { max: 9007199254740991, type: [{ code: "Extension" }] }, modifierExtension: { max: 9007199254740991, type: [{ code: "Extension" }] }, height: { type: [{ code: "Quantity" }] }, width: { type: [{ code: "Quantity" }] }, depth: { type: [{ code: "Quantity" }] }, weight: { type: [{ code: "Quantity" }] }, nominalVolume: { type: [{ code: "Quantity" }] }, externalDiameter: { type: [{ code: "Quantity" }] }, shape: { type: [{ code: "string" }] }, color: { max: 9007199254740991, type: [{ code: "string" }] }, imprint: { max: 9007199254740991, type: [{ code: "string" }] }, image: { max: 9007199254740991, type: [{ code: "Attachment" }] }, scoring: { type: [{ code: "CodeableConcept" }] } } }, ProductShelfLife: { elements: { id: { type: [{ code: "string" }] }, extension: { max: 9007199254740991, type: [{ code: "Extension" }] }, modifierExtension: { max: 9007199254740991, type: [{ code: "Extension" }] }, identifier: { type: [{ code: "Identifier" }] }, type: { min: 1, type: [{ code: "CodeableConcept" }] }, period: { min: 1, type: [{ code: "Quantity" }] }, specialPrecautionsForStorage: { max: 9007199254740991, type: [{ code: "CodeableConcept" }] } } }, Quantity: { elements: { id: { type: [{ code: "string" }] }, extension: { max: 9007199254740991, type: [{ code: "Extension" }] }, value: { type: [{ code: "decimal" }] }, comparator: { type: [{ code: "code" }] }, unit: { type: [{ code: "string" }] }, system: { type: [{ code: "uri" }] }, code: { type: [{ code: "code" }] } } }, Range: { elements: { id: { type: [{ code: "string" }] }, extension: { max: 9007199254740991, type: [{ code: "Extension" }] }, low: { type: [{ code: "Quantity", profile: ["http://hl7.org/fhir/StructureDefinition/SimpleQuantity"] }] }, high: { type: [{ code: "Quantity", profile: ["http://hl7.org/fhir/StructureDefinition/SimpleQuantity"] }] } } }, Ratio: { elements: { id: { type: [{ code: "string" }] }, extension: { max: 9007199254740991, type: [{ code: "Extension" }] }, numerator: { type: [{ code: "Quantity" }] }, denominator: { type: [{ code: "Quantity" }] } } }, Reference: { elements: { id: { type: [{ code: "string" }] }, extension: { max: 9007199254740991, type: [{ code: "Extension" }] }, reference: { type: [{ code: "string" }] }, type: { type: [{ code: "uri" }] }, identifier: { type: [{ code: "Identifier" }] }, display: { type: [{ code: "string" }] } } }, RelatedArtifact: { elements: { id: { type: [{ code: "string" }] }, extension: { max: 9007199254740991, type: [{ code: "Extension" }] }, type: { min: 1, type: [{ code: "code" }] }, label: { type: [{ code: "string" }] }, display: { type: [{ code: "string" }] }, citation: { type: [{ code: "markdown" }] }, url: { type: [{ code: "url" }] }, document: { type: [{ code: "Attachment" }] }, resource: { type: [{ code: "canonical", targetProfile: ["http://hl7.org/fhir/StructureDefinition/Resource"] }] } } }, SampledData: { elements: { id: { type: [{ code: "string" }] }, extension: { max: 9007199254740991, type: [{ code: "Extension" }] }, origin: { min: 1, type: [{ code: "Quantity", profile: ["http://hl7.org/fhir/StructureDefinition/SimpleQuantity"] }] }, period: { min: 1, type: [{ code: "decimal" }] }, factor: { type: [{ code: "decimal" }] }, lowerLimit: { type: [{ code: "decimal" }] }, upperLimit: { type: [{ code: "decimal" }] }, dimensions: { min: 1, type: [{ code: "positiveInt" }] }, data: { type: [{ code: "string" }] } } }, Signature: { elements: { id: { type: [{ code: "string" }] }, extension: { max: 9007199254740991, type: [{ code: "Extension" }] }, type: { min: 1, max: 9007199254740991, type: [{ code: "Coding" }] }, when: { min: 1, type: [{ code: "instant" }] }, who: { min: 1, type: [{ code: "Reference", targetProfile: ["http://hl7.org/fhir/StructureDefinition/Practitioner", "http://hl7.org/fhir/StructureDefinition/PractitionerRole", "http://hl7.org/fhir/StructureDefinition/RelatedPerson", "http://hl7.org/fhir/StructureDefinition/Patient", "http://hl7.org/fhir/StructureDefinition/Device", "http://hl7.org/fhir/StructureDefinition/Organization"] }] }, onBehalfOf: { type: [{ code: "Reference", targetProfile: ["http://hl7.org/fhir/StructureDefinition/Practitioner", "http://hl7.org/fhir/StructureDefinition/PractitionerRole", "http://hl7.org/fhir/StructureDefinition/RelatedPerson", "http://hl7.org/fhir/StructureDefinition/Patient", "http://hl7.org/fhir/StructureDefinition/Device", "http://hl7.org/fhir/StructureDefinition/Organization"] }] }, targetFormat: { type: [{ code: "code" }] }, sigFormat: { type: [{ code: "code" }] }, data: { type: [{ code: "base64Binary" }] } } }, SubstanceAmount: { elements: { id: { type: [{ code: "string" }] }, extension: { max: 9007199254740991, type: [{ code: "Extension" }] }, modifierExtension: { max: 9007199254740991, type: [{ code: "Extension" }] }, "amount[x]": { type: [{ code: "Quantity" }, { code: "Range" }, { code: "string" }] }, amountType: { type: [{ code: "CodeableConcept" }] }, amountText: { type: [{ code: "string" }] }, referenceRange: { type: [{ code: "SubstanceAmountReferenceRange" }] } } }, SubstanceAmountReferenceRange: { elements: { id: { type: [{ code: "string" }] }, extension: { max: 9007199254740991, type: [{ code: "Extension" }] }, lowLimit: { type: [{ code: "Quantity" }] }, highLimit: { type: [{ code: "Quantity" }] } } }, Timing: { elements: { id: { type: [{ code: "string" }] }, extension: { max: 9007199254740991, type: [{ code: "Extension" }] }, modifierExtension: { max: 9007199254740991, type: [{ code: "Extension" }] }, event: { max: 9007199254740991, type: [{ code: "dateTime" }] }, repeat: { type: [{ code: "TimingRepeat" }] }, code: { type: [{ code: "CodeableConcept" }] } } }, TimingRepeat: { elements: { id: { type: [{ code: "string" }] }, extension: { max: 9007199254740991, type: [{ code: "Extension" }] }, "bounds[x]": { type: [{ code: "Duration" }, { code: "Range" }, { code: "Period" }] }, count: { type: [{ code: "positiveInt" }] }, countMax: { type: [{ code: "positiveInt" }] }, duration: { type: [{ code: "decimal" }] }, durationMax: { type: [{ code: "decimal" }] }, durationUnit: { type: [{ code: "code" }] }, frequency: { type: [{ code: "positiveInt" }] }, frequencyMax: { type: [{ code: "positiveInt" }] }, period: { type: [{ code: "decimal" }] }, periodMax: { type: [{ code: "decimal" }] }, periodUnit: { type: [{ code: "code" }] }, dayOfWeek: { max: 9007199254740991, type: [{ code: "code" }] }, timeOfDay: { max: 9007199254740991, type: [{ code: "time" }] }, when: { max: 9007199254740991, type: [{ code: "code" }] }, offset: { type: [{ code: "unsignedInt" }] } } }, TriggerDefinition: { elements: { id: { type: [{ code: "string" }] }, extension: { max: 9007199254740991, type: [{ code: "Extension" }] }, type: { min: 1, type: [{ code: "code" }] }, name: { type: [{ code: "string" }] }, "timing[x]": { type: [{ code: "Timing" }, { code: "Reference", targetProfile: ["http://hl7.org/fhir/StructureDefinition/Schedule"] }, { code: "date" }, { code: "dateTime" }] }, data: { max: 9007199254740991, type: [{ code: "DataRequirement" }] }, condition: { type: [{ code: "Expression" }] } } }, UsageContext: { elements: { id: { type: [{ code: "string" }] }, extension: { max: 9007199254740991, type: [{ code: "Extension" }] }, code: { min: 1, type: [{ code: "Coding" }] }, "value[x]": { min: 1, type: [{ code: "CodeableConcept" }, { code: "Quantity" }, { code: "Range" }, { code: "Reference", targetProfile: ["http://hl7.org/fhir/StructureDefinition/PlanDefinition", "http://hl7.org/fhir/StructureDefinition/ResearchStudy", "http://hl7.org/fhir/StructureDefinition/InsurancePlan", "http://hl7.org/fhir/StructureDefinition/HealthcareService", "http://hl7.org/fhir/StructureDefinition/Group", "http://hl7.org/fhir/StructureDefinition/Location", "http://hl7.org/fhir/StructureDefinition/Organization"] }] } } }, MoneyQuantity: { elements: { id: { type: [{ code: "string" }] }, extension: { max: 9007199254740991, type: [{ code: "Extension" }] }, value: { type: [{ code: "decimal" }] }, comparator: { type: [{ code: "code" }] }, unit: { type: [{ code: "string" }] }, system: { type: [{ code: "uri" }] }, code: { type: [{ code: "code" }] } } }, SimpleQuantity: { elements: { id: { type: [{ code: "string" }] }, extension: { max: 9007199254740991, type: [{ code: "Extension" }] }, value: { type: [{ code: "decimal" }] }, comparator: { max: 0, type: [{ code: "code" }] }, unit: { type: [{ code: "string" }] }, system: { type: [{ code: "uri" }] }, code: { type: [{ code: "code" }] } } }, IdentityProvider: { elements: { authorizeUrl: { min: 1, type: [{ code: "string" }] }, tokenUrl: { min: 1, type: [{ code: "string" }] }, tokenAuthMethod: { type: [{ code: "code" }] }, userInfoUrl: { min: 1, type: [{ code: "string" }] }, clientId: { min: 1, type: [{ code: "string" }] }, clientSecret: { min: 1, type: [{ code: "string" }] }, usePkce: { type: [{ code: "boolean" }] }, useSubject: { type: [{ code: "boolean" }] } } } };
31534
- function hr(r6) {
31535
- return new pr(r6).parse();
31533
+ var Cn = { Element: { elements: { id: { type: [{ code: "string" }] }, extension: { max: 9007199254740991, type: [{ code: "Extension" }] } } }, BackboneElement: { elements: { id: { type: [{ code: "string" }] }, extension: { max: 9007199254740991, type: [{ code: "Extension" }] }, modifierExtension: { max: 9007199254740991, type: [{ code: "Extension" }] } } }, Address: { elements: { id: { type: [{ code: "string" }] }, extension: { max: 9007199254740991, type: [{ code: "Extension" }] }, use: { type: [{ code: "code" }] }, type: { type: [{ code: "code" }] }, text: { type: [{ code: "string" }] }, line: { max: 9007199254740991, type: [{ code: "string" }] }, city: { type: [{ code: "string" }] }, district: { type: [{ code: "string" }] }, state: { type: [{ code: "string" }] }, postalCode: { type: [{ code: "string" }] }, country: { type: [{ code: "string" }] }, period: { type: [{ code: "Period" }] } } }, Age: { elements: { id: { type: [{ code: "string" }] }, extension: { max: 9007199254740991, type: [{ code: "Extension" }] }, value: { type: [{ code: "decimal" }] }, comparator: { type: [{ code: "code" }] }, unit: { type: [{ code: "string" }] }, system: { type: [{ code: "uri" }] }, code: { type: [{ code: "code" }] } } }, Annotation: { elements: { id: { type: [{ code: "string" }] }, extension: { max: 9007199254740991, type: [{ code: "Extension" }] }, "author[x]": { type: [{ code: "Reference", targetProfile: ["http://hl7.org/fhir/StructureDefinition/Practitioner", "http://hl7.org/fhir/StructureDefinition/Patient", "http://hl7.org/fhir/StructureDefinition/RelatedPerson", "http://hl7.org/fhir/StructureDefinition/Organization"] }, { code: "string" }] }, time: { type: [{ code: "dateTime" }] }, text: { min: 1, type: [{ code: "markdown" }] } } }, Attachment: { elements: { id: { type: [{ code: "string" }] }, extension: { max: 9007199254740991, type: [{ code: "Extension" }] }, contentType: { type: [{ code: "code" }] }, language: { type: [{ code: "code" }] }, data: { type: [{ code: "base64Binary" }] }, url: { type: [{ code: "url" }] }, size: { type: [{ code: "unsignedInt" }] }, hash: { type: [{ code: "base64Binary" }] }, title: { type: [{ code: "string" }] }, creation: { type: [{ code: "dateTime" }] } } }, CodeableConcept: { elements: { id: { type: [{ code: "string" }] }, extension: { max: 9007199254740991, type: [{ code: "Extension" }] }, coding: { max: 9007199254740991, type: [{ code: "Coding" }] }, text: { type: [{ code: "string" }] } } }, Coding: { elements: { id: { type: [{ code: "string" }] }, extension: { max: 9007199254740991, type: [{ code: "Extension" }] }, system: { type: [{ code: "uri" }] }, version: { type: [{ code: "string" }] }, code: { type: [{ code: "code" }] }, display: { type: [{ code: "string" }] }, userSelected: { type: [{ code: "boolean" }] } } }, ContactDetail: { elements: { id: { type: [{ code: "string" }] }, extension: { max: 9007199254740991, type: [{ code: "Extension" }] }, name: { type: [{ code: "string" }] }, telecom: { max: 9007199254740991, type: [{ code: "ContactPoint" }] } } }, ContactPoint: { elements: { id: { type: [{ code: "string" }] }, extension: { max: 9007199254740991, type: [{ code: "Extension" }] }, system: { type: [{ code: "code" }] }, value: { type: [{ code: "string" }] }, use: { type: [{ code: "code" }] }, rank: { type: [{ code: "positiveInt" }] }, period: { type: [{ code: "Period" }] } } }, Contributor: { elements: { id: { type: [{ code: "string" }] }, extension: { max: 9007199254740991, type: [{ code: "Extension" }] }, type: { min: 1, type: [{ code: "code" }] }, name: { min: 1, type: [{ code: "string" }] }, contact: { max: 9007199254740991, type: [{ code: "ContactDetail" }] } } }, Count: { elements: { id: { type: [{ code: "string" }] }, extension: { max: 9007199254740991, type: [{ code: "Extension" }] }, value: { type: [{ code: "decimal" }] }, comparator: { type: [{ code: "code" }] }, unit: { type: [{ code: "string" }] }, system: { type: [{ code: "uri" }] }, code: { type: [{ code: "code" }] } } }, DataRequirement: { elements: { id: { type: [{ code: "string" }] }, extension: { max: 9007199254740991, type: [{ code: "Extension" }] }, type: { min: 1, type: [{ code: "code" }] }, profile: { max: 9007199254740991, type: [{ code: "canonical", targetProfile: ["http://hl7.org/fhir/StructureDefinition/StructureDefinition"] }] }, "subject[x]": { type: [{ code: "CodeableConcept" }, { code: "Reference", targetProfile: ["http://hl7.org/fhir/StructureDefinition/Group"] }] }, mustSupport: { max: 9007199254740991, type: [{ code: "string" }] }, codeFilter: { max: 9007199254740991, type: [{ code: "DataRequirementCodeFilter" }] }, dateFilter: { max: 9007199254740991, type: [{ code: "DataRequirementDateFilter" }] }, limit: { type: [{ code: "positiveInt" }] }, sort: { max: 9007199254740991, type: [{ code: "DataRequirementSort" }] } } }, DataRequirementCodeFilter: { elements: { id: { type: [{ code: "string" }] }, extension: { max: 9007199254740991, type: [{ code: "Extension" }] }, path: { type: [{ code: "string" }] }, searchParam: { type: [{ code: "string" }] }, valueSet: { type: [{ code: "canonical", targetProfile: ["http://hl7.org/fhir/StructureDefinition/ValueSet"] }] }, code: { max: 9007199254740991, type: [{ code: "Coding" }] } } }, DataRequirementDateFilter: { elements: { id: { type: [{ code: "string" }] }, extension: { max: 9007199254740991, type: [{ code: "Extension" }] }, path: { type: [{ code: "string" }] }, searchParam: { type: [{ code: "string" }] }, "value[x]": { type: [{ code: "dateTime" }, { code: "Period" }, { code: "Duration" }] } } }, DataRequirementSort: { elements: { id: { type: [{ code: "string" }] }, extension: { max: 9007199254740991, type: [{ code: "Extension" }] }, path: { min: 1, type: [{ code: "string" }] }, direction: { min: 1, type: [{ code: "code" }] } } }, Distance: { elements: { id: { type: [{ code: "string" }] }, extension: { max: 9007199254740991, type: [{ code: "Extension" }] }, value: { type: [{ code: "decimal" }] }, comparator: { type: [{ code: "code" }] }, unit: { type: [{ code: "string" }] }, system: { type: [{ code: "uri" }] }, code: { type: [{ code: "code" }] } } }, Dosage: { elements: { id: { type: [{ code: "string" }] }, extension: { max: 9007199254740991, type: [{ code: "Extension" }] }, modifierExtension: { max: 9007199254740991, type: [{ code: "Extension" }] }, sequence: { type: [{ code: "integer" }] }, text: { type: [{ code: "string" }] }, additionalInstruction: { max: 9007199254740991, type: [{ code: "CodeableConcept" }] }, patientInstruction: { type: [{ code: "string" }] }, timing: { type: [{ code: "Timing" }] }, "asNeeded[x]": { type: [{ code: "boolean" }, { code: "CodeableConcept" }] }, site: { type: [{ code: "CodeableConcept" }] }, route: { type: [{ code: "CodeableConcept" }] }, method: { type: [{ code: "CodeableConcept" }] }, doseAndRate: { max: 9007199254740991, type: [{ code: "DosageDoseAndRate" }] }, maxDosePerPeriod: { type: [{ code: "Ratio" }] }, maxDosePerAdministration: { type: [{ code: "Quantity", profile: ["http://hl7.org/fhir/StructureDefinition/SimpleQuantity"] }] }, maxDosePerLifetime: { type: [{ code: "Quantity", profile: ["http://hl7.org/fhir/StructureDefinition/SimpleQuantity"] }] } } }, DosageDoseAndRate: { elements: { id: { type: [{ code: "string" }] }, extension: { max: 9007199254740991, type: [{ code: "Extension" }] }, type: { type: [{ code: "CodeableConcept" }] }, "dose[x]": { type: [{ code: "Range" }, { code: "Quantity", profile: ["http://hl7.org/fhir/StructureDefinition/SimpleQuantity"] }] }, "rate[x]": { type: [{ code: "Ratio" }, { code: "Range" }, { code: "Quantity", profile: ["http://hl7.org/fhir/StructureDefinition/SimpleQuantity"] }] } } }, Duration: { elements: { id: { type: [{ code: "string" }] }, extension: { max: 9007199254740991, type: [{ code: "Extension" }] }, value: { type: [{ code: "decimal" }] }, comparator: { type: [{ code: "code" }] }, unit: { type: [{ code: "string" }] }, system: { type: [{ code: "uri" }] }, code: { type: [{ code: "code" }] } } }, ElementDefinition: { elements: { id: { type: [{ code: "string" }] }, extension: { max: 9007199254740991, type: [{ code: "Extension" }] }, modifierExtension: { max: 9007199254740991, type: [{ code: "Extension" }] }, path: { min: 1, type: [{ code: "string" }] }, representation: { max: 9007199254740991, type: [{ code: "code" }] }, sliceName: { type: [{ code: "string" }] }, sliceIsConstraining: { type: [{ code: "boolean" }] }, label: { type: [{ code: "string" }] }, code: { max: 9007199254740991, type: [{ code: "Coding" }] }, slicing: { type: [{ code: "ElementDefinitionSlicing" }] }, short: { type: [{ code: "string" }] }, definition: { type: [{ code: "markdown" }] }, comment: { type: [{ code: "markdown" }] }, requirements: { type: [{ code: "markdown" }] }, alias: { max: 9007199254740991, type: [{ code: "string" }] }, min: { type: [{ code: "unsignedInt" }] }, max: { type: [{ code: "string" }] }, base: { type: [{ code: "ElementDefinitionBase" }] }, contentReference: { type: [{ code: "uri" }] }, type: { max: 9007199254740991, type: [{ code: "ElementDefinitionType" }] }, "defaultValue[x]": { type: [{ code: "base64Binary" }, { code: "boolean" }, { code: "canonical" }, { code: "code" }, { code: "date" }, { code: "dateTime" }, { code: "decimal" }, { code: "id" }, { code: "instant" }, { code: "integer" }, { code: "markdown" }, { code: "oid" }, { code: "positiveInt" }, { code: "string" }, { code: "time" }, { code: "unsignedInt" }, { code: "uri" }, { code: "url" }, { code: "uuid" }, { code: "Address" }, { code: "Age" }, { code: "Annotation" }, { code: "Attachment" }, { code: "CodeableConcept" }, { code: "Coding" }, { code: "ContactPoint" }, { code: "Count" }, { code: "Distance" }, { code: "Duration" }, { code: "HumanName" }, { code: "Identifier" }, { code: "Money" }, { code: "Period" }, { code: "Quantity" }, { code: "Range" }, { code: "Ratio" }, { code: "Reference" }, { code: "SampledData" }, { code: "Signature" }, { code: "Timing" }, { code: "ContactDetail" }, { code: "Contributor" }, { code: "DataRequirement" }, { code: "Expression" }, { code: "ParameterDefinition" }, { code: "RelatedArtifact" }, { code: "TriggerDefinition" }, { code: "UsageContext" }, { code: "Dosage" }, { code: "Meta" }] }, meaningWhenMissing: { type: [{ code: "markdown" }] }, orderMeaning: { type: [{ code: "string" }] }, "fixed[x]": { type: [{ code: "base64Binary" }, { code: "boolean" }, { code: "canonical" }, { code: "code" }, { code: "date" }, { code: "dateTime" }, { code: "decimal" }, { code: "id" }, { code: "instant" }, { code: "integer" }, { code: "markdown" }, { code: "oid" }, { code: "positiveInt" }, { code: "string" }, { code: "time" }, { code: "unsignedInt" }, { code: "uri" }, { code: "url" }, { code: "uuid" }, { code: "Address" }, { code: "Age" }, { code: "Annotation" }, { code: "Attachment" }, { code: "CodeableConcept" }, { code: "Coding" }, { code: "ContactPoint" }, { code: "Count" }, { code: "Distance" }, { code: "Duration" }, { code: "HumanName" }, { code: "Identifier" }, { code: "Money" }, { code: "Period" }, { code: "Quantity" }, { code: "Range" }, { code: "Ratio" }, { code: "Reference" }, { code: "SampledData" }, { code: "Signature" }, { code: "Timing" }, { code: "ContactDetail" }, { code: "Contributor" }, { code: "DataRequirement" }, { code: "Expression" }, { code: "ParameterDefinition" }, { code: "RelatedArtifact" }, { code: "TriggerDefinition" }, { code: "UsageContext" }, { code: "Dosage" }, { code: "Meta" }] }, "pattern[x]": { type: [{ code: "base64Binary" }, { code: "boolean" }, { code: "canonical" }, { code: "code" }, { code: "date" }, { code: "dateTime" }, { code: "decimal" }, { code: "id" }, { code: "instant" }, { code: "integer" }, { code: "markdown" }, { code: "oid" }, { code: "positiveInt" }, { code: "string" }, { code: "time" }, { code: "unsignedInt" }, { code: "uri" }, { code: "url" }, { code: "uuid" }, { code: "Address" }, { code: "Age" }, { code: "Annotation" }, { code: "Attachment" }, { code: "CodeableConcept" }, { code: "Coding" }, { code: "ContactPoint" }, { code: "Count" }, { code: "Distance" }, { code: "Duration" }, { code: "HumanName" }, { code: "Identifier" }, { code: "Money" }, { code: "Period" }, { code: "Quantity" }, { code: "Range" }, { code: "Ratio" }, { code: "Reference" }, { code: "SampledData" }, { code: "Signature" }, { code: "Timing" }, { code: "ContactDetail" }, { code: "Contributor" }, { code: "DataRequirement" }, { code: "Expression" }, { code: "ParameterDefinition" }, { code: "RelatedArtifact" }, { code: "TriggerDefinition" }, { code: "UsageContext" }, { code: "Dosage" }, { code: "Meta" }] }, example: { max: 9007199254740991, type: [{ code: "ElementDefinitionExample" }] }, "minValue[x]": { type: [{ code: "date" }, { code: "dateTime" }, { code: "instant" }, { code: "time" }, { code: "decimal" }, { code: "integer" }, { code: "positiveInt" }, { code: "unsignedInt" }, { code: "Quantity" }] }, "maxValue[x]": { type: [{ code: "date" }, { code: "dateTime" }, { code: "instant" }, { code: "time" }, { code: "decimal" }, { code: "integer" }, { code: "positiveInt" }, { code: "unsignedInt" }, { code: "Quantity" }] }, maxLength: { type: [{ code: "integer" }] }, condition: { max: 9007199254740991, type: [{ code: "id" }] }, constraint: { max: 9007199254740991, type: [{ code: "ElementDefinitionConstraint" }] }, mustSupport: { type: [{ code: "boolean" }] }, isModifier: { type: [{ code: "boolean" }] }, isModifierReason: { type: [{ code: "string" }] }, isSummary: { type: [{ code: "boolean" }] }, binding: { type: [{ code: "ElementDefinitionBinding" }] }, mapping: { max: 9007199254740991, type: [{ code: "ElementDefinitionMapping" }] } } }, ElementDefinitionSlicingDiscriminator: { elements: { id: { type: [{ code: "string" }] }, extension: { max: 9007199254740991, type: [{ code: "Extension" }] }, type: { min: 1, type: [{ code: "code" }] }, path: { min: 1, type: [{ code: "string" }] } } }, ElementDefinitionSlicing: { elements: { id: { type: [{ code: "string" }] }, extension: { max: 9007199254740991, type: [{ code: "Extension" }] }, discriminator: { max: 9007199254740991, type: [{ code: "ElementDefinitionSlicingDiscriminator" }] }, description: { type: [{ code: "string" }] }, ordered: { type: [{ code: "boolean" }] }, rules: { min: 1, type: [{ code: "code" }] } } }, ElementDefinitionBase: { elements: { id: { type: [{ code: "string" }] }, extension: { max: 9007199254740991, type: [{ code: "Extension" }] }, path: { min: 1, type: [{ code: "string" }] }, min: { min: 1, type: [{ code: "unsignedInt" }] }, max: { min: 1, type: [{ code: "string" }] } } }, ElementDefinitionType: { elements: { id: { type: [{ code: "string" }] }, extension: { max: 9007199254740991, type: [{ code: "Extension" }] }, code: { min: 1, type: [{ code: "uri" }] }, profile: { max: 9007199254740991, type: [{ code: "canonical", targetProfile: ["http://hl7.org/fhir/StructureDefinition/StructureDefinition", "http://hl7.org/fhir/StructureDefinition/ImplementationGuide"] }] }, targetProfile: { max: 9007199254740991, type: [{ code: "canonical", targetProfile: ["http://hl7.org/fhir/StructureDefinition/StructureDefinition", "http://hl7.org/fhir/StructureDefinition/ImplementationGuide"] }] }, aggregation: { max: 9007199254740991, type: [{ code: "code" }] }, versioning: { type: [{ code: "code" }] } } }, ElementDefinitionExample: { elements: { id: { type: [{ code: "string" }] }, extension: { max: 9007199254740991, type: [{ code: "Extension" }] }, label: { min: 1, type: [{ code: "string" }] }, "value[x]": { min: 1, type: [{ code: "base64Binary" }, { code: "boolean" }, { code: "canonical" }, { code: "code" }, { code: "date" }, { code: "dateTime" }, { code: "decimal" }, { code: "id" }, { code: "instant" }, { code: "integer" }, { code: "markdown" }, { code: "oid" }, { code: "positiveInt" }, { code: "string" }, { code: "time" }, { code: "unsignedInt" }, { code: "uri" }, { code: "url" }, { code: "uuid" }, { code: "Address" }, { code: "Age" }, { code: "Annotation" }, { code: "Attachment" }, { code: "CodeableConcept" }, { code: "Coding" }, { code: "ContactPoint" }, { code: "Count" }, { code: "Distance" }, { code: "Duration" }, { code: "HumanName" }, { code: "Identifier" }, { code: "Money" }, { code: "Period" }, { code: "Quantity" }, { code: "Range" }, { code: "Ratio" }, { code: "Reference" }, { code: "SampledData" }, { code: "Signature" }, { code: "Timing" }, { code: "ContactDetail" }, { code: "Contributor" }, { code: "DataRequirement" }, { code: "Expression" }, { code: "ParameterDefinition" }, { code: "RelatedArtifact" }, { code: "TriggerDefinition" }, { code: "UsageContext" }, { code: "Dosage" }, { code: "Meta" }] } } }, ElementDefinitionConstraint: { elements: { id: { type: [{ code: "string" }] }, extension: { max: 9007199254740991, type: [{ code: "Extension" }] }, key: { min: 1, type: [{ code: "id" }] }, requirements: { type: [{ code: "string" }] }, severity: { min: 1, type: [{ code: "code" }] }, human: { min: 1, type: [{ code: "string" }] }, expression: { type: [{ code: "string" }] }, xpath: { type: [{ code: "string" }] }, source: { type: [{ code: "canonical", targetProfile: ["http://hl7.org/fhir/StructureDefinition/StructureDefinition"] }] } } }, ElementDefinitionBinding: { elements: { id: { type: [{ code: "string" }] }, extension: { max: 9007199254740991, type: [{ code: "Extension" }] }, strength: { min: 1, type: [{ code: "code" }] }, description: { type: [{ code: "string" }] }, valueSet: { type: [{ code: "canonical", targetProfile: ["http://hl7.org/fhir/StructureDefinition/ValueSet"] }] } } }, ElementDefinitionMapping: { elements: { id: { type: [{ code: "string" }] }, extension: { max: 9007199254740991, type: [{ code: "Extension" }] }, identity: { min: 1, type: [{ code: "id" }] }, language: { type: [{ code: "code" }] }, map: { min: 1, type: [{ code: "string" }] }, comment: { type: [{ code: "string" }] } } }, Expression: { elements: { id: { type: [{ code: "string" }] }, extension: { max: 9007199254740991, type: [{ code: "Extension" }] }, description: { type: [{ code: "string" }] }, name: { type: [{ code: "id" }] }, language: { min: 1, type: [{ code: "code" }] }, expression: { type: [{ code: "string" }] }, reference: { type: [{ code: "uri" }] } } }, Extension: { elements: { id: { type: [{ code: "string" }] }, extension: { max: 9007199254740991, type: [{ code: "Extension" }] }, url: { min: 1, type: [{ code: "uri" }] }, "value[x]": { type: [{ code: "base64Binary" }, { code: "boolean" }, { code: "canonical" }, { code: "code" }, { code: "date" }, { code: "dateTime" }, { code: "decimal" }, { code: "id" }, { code: "instant" }, { code: "integer" }, { code: "markdown" }, { code: "oid" }, { code: "positiveInt" }, { code: "string" }, { code: "time" }, { code: "unsignedInt" }, { code: "uri" }, { code: "url" }, { code: "uuid" }, { code: "Address" }, { code: "Age" }, { code: "Annotation" }, { code: "Attachment" }, { code: "CodeableConcept" }, { code: "Coding" }, { code: "ContactPoint" }, { code: "Count" }, { code: "Distance" }, { code: "Duration" }, { code: "HumanName" }, { code: "Identifier" }, { code: "Money" }, { code: "Period" }, { code: "Quantity" }, { code: "Range" }, { code: "Ratio" }, { code: "Reference" }, { code: "SampledData" }, { code: "Signature" }, { code: "Timing" }, { code: "ContactDetail" }, { code: "Contributor" }, { code: "DataRequirement" }, { code: "Expression" }, { code: "ParameterDefinition" }, { code: "RelatedArtifact" }, { code: "TriggerDefinition" }, { code: "UsageContext" }, { code: "Dosage" }, { code: "Meta" }] } } }, HumanName: { elements: { id: { type: [{ code: "string" }] }, extension: { max: 9007199254740991, type: [{ code: "Extension" }] }, use: { type: [{ code: "code" }] }, text: { type: [{ code: "string" }] }, family: { type: [{ code: "string" }] }, given: { max: 9007199254740991, type: [{ code: "string" }] }, prefix: { max: 9007199254740991, type: [{ code: "string" }] }, suffix: { max: 9007199254740991, type: [{ code: "string" }] }, period: { type: [{ code: "Period" }] } } }, Identifier: { elements: { id: { type: [{ code: "string" }] }, extension: { max: 9007199254740991, type: [{ code: "Extension" }] }, use: { type: [{ code: "code" }] }, type: { type: [{ code: "CodeableConcept" }] }, system: { type: [{ code: "uri" }] }, value: { type: [{ code: "string" }] }, period: { type: [{ code: "Period" }] }, assigner: { type: [{ code: "Reference", targetProfile: ["http://hl7.org/fhir/StructureDefinition/Organization"] }] } } }, MarketingStatus: { elements: { id: { type: [{ code: "string" }] }, extension: { max: 9007199254740991, type: [{ code: "Extension" }] }, modifierExtension: { max: 9007199254740991, type: [{ code: "Extension" }] }, country: { min: 1, type: [{ code: "CodeableConcept" }] }, jurisdiction: { type: [{ code: "CodeableConcept" }] }, status: { min: 1, type: [{ code: "CodeableConcept" }] }, dateRange: { min: 1, type: [{ code: "Period" }] }, restoreDate: { type: [{ code: "dateTime" }] } } }, Meta: { elements: { id: { type: [{ code: "string" }] }, extension: { max: 9007199254740991, type: [{ code: "Extension" }] }, versionId: { type: [{ code: "id" }] }, lastUpdated: { type: [{ code: "instant" }] }, source: { type: [{ code: "uri" }] }, profile: { max: 9007199254740991, type: [{ code: "canonical", targetProfile: ["http://hl7.org/fhir/StructureDefinition/StructureDefinition"] }] }, security: { max: 9007199254740991, type: [{ code: "Coding" }] }, tag: { max: 9007199254740991, type: [{ code: "Coding" }] }, project: { type: [{ code: "uri" }] }, author: { type: [{ code: "Reference" }] }, onBehalfOf: { type: [{ code: "Reference" }] }, account: { type: [{ code: "Reference" }] }, accounts: { max: 9007199254740991, type: [{ code: "Reference" }] }, compartment: { max: 9007199254740991, type: [{ code: "Reference" }] } } }, Money: { elements: { id: { type: [{ code: "string" }] }, extension: { max: 9007199254740991, type: [{ code: "Extension" }] }, value: { type: [{ code: "decimal" }] }, currency: { type: [{ code: "code" }] } } }, Narrative: { elements: { id: { type: [{ code: "string" }] }, extension: { max: 9007199254740991, type: [{ code: "Extension" }] }, status: { min: 1, type: [{ code: "code" }] }, div: { min: 1, type: [{ code: "xhtml" }] } } }, ParameterDefinition: { elements: { id: { type: [{ code: "string" }] }, extension: { max: 9007199254740991, type: [{ code: "Extension" }] }, name: { type: [{ code: "code" }] }, use: { min: 1, type: [{ code: "code" }] }, min: { type: [{ code: "integer" }] }, max: { type: [{ code: "string" }] }, documentation: { type: [{ code: "string" }] }, type: { min: 1, type: [{ code: "code" }] }, profile: { type: [{ code: "canonical", targetProfile: ["http://hl7.org/fhir/StructureDefinition/StructureDefinition"] }] } } }, Period: { elements: { id: { type: [{ code: "string" }] }, extension: { max: 9007199254740991, type: [{ code: "Extension" }] }, start: { type: [{ code: "dateTime" }] }, end: { type: [{ code: "dateTime" }] } } }, Population: { elements: { id: { type: [{ code: "string" }] }, extension: { max: 9007199254740991, type: [{ code: "Extension" }] }, modifierExtension: { max: 9007199254740991, type: [{ code: "Extension" }] }, "age[x]": { type: [{ code: "Range" }, { code: "CodeableConcept" }] }, gender: { type: [{ code: "CodeableConcept" }] }, race: { type: [{ code: "CodeableConcept" }] }, physiologicalCondition: { type: [{ code: "CodeableConcept" }] } } }, ProdCharacteristic: { elements: { id: { type: [{ code: "string" }] }, extension: { max: 9007199254740991, type: [{ code: "Extension" }] }, modifierExtension: { max: 9007199254740991, type: [{ code: "Extension" }] }, height: { type: [{ code: "Quantity" }] }, width: { type: [{ code: "Quantity" }] }, depth: { type: [{ code: "Quantity" }] }, weight: { type: [{ code: "Quantity" }] }, nominalVolume: { type: [{ code: "Quantity" }] }, externalDiameter: { type: [{ code: "Quantity" }] }, shape: { type: [{ code: "string" }] }, color: { max: 9007199254740991, type: [{ code: "string" }] }, imprint: { max: 9007199254740991, type: [{ code: "string" }] }, image: { max: 9007199254740991, type: [{ code: "Attachment" }] }, scoring: { type: [{ code: "CodeableConcept" }] } } }, ProductShelfLife: { elements: { id: { type: [{ code: "string" }] }, extension: { max: 9007199254740991, type: [{ code: "Extension" }] }, modifierExtension: { max: 9007199254740991, type: [{ code: "Extension" }] }, identifier: { type: [{ code: "Identifier" }] }, type: { min: 1, type: [{ code: "CodeableConcept" }] }, period: { min: 1, type: [{ code: "Quantity" }] }, specialPrecautionsForStorage: { max: 9007199254740991, type: [{ code: "CodeableConcept" }] } } }, Quantity: { elements: { id: { type: [{ code: "string" }] }, extension: { max: 9007199254740991, type: [{ code: "Extension" }] }, value: { type: [{ code: "decimal" }] }, comparator: { type: [{ code: "code" }] }, unit: { type: [{ code: "string" }] }, system: { type: [{ code: "uri" }] }, code: { type: [{ code: "code" }] } } }, Range: { elements: { id: { type: [{ code: "string" }] }, extension: { max: 9007199254740991, type: [{ code: "Extension" }] }, low: { type: [{ code: "Quantity", profile: ["http://hl7.org/fhir/StructureDefinition/SimpleQuantity"] }] }, high: { type: [{ code: "Quantity", profile: ["http://hl7.org/fhir/StructureDefinition/SimpleQuantity"] }] } } }, Ratio: { elements: { id: { type: [{ code: "string" }] }, extension: { max: 9007199254740991, type: [{ code: "Extension" }] }, numerator: { type: [{ code: "Quantity" }] }, denominator: { type: [{ code: "Quantity" }] } } }, Reference: { elements: { id: { type: [{ code: "string" }] }, extension: { max: 9007199254740991, type: [{ code: "Extension" }] }, reference: { type: [{ code: "string" }] }, type: { type: [{ code: "uri" }] }, identifier: { type: [{ code: "Identifier" }] }, display: { type: [{ code: "string" }] } } }, RelatedArtifact: { elements: { id: { type: [{ code: "string" }] }, extension: { max: 9007199254740991, type: [{ code: "Extension" }] }, type: { min: 1, type: [{ code: "code" }] }, label: { type: [{ code: "string" }] }, display: { type: [{ code: "string" }] }, citation: { type: [{ code: "markdown" }] }, url: { type: [{ code: "url" }] }, document: { type: [{ code: "Attachment" }] }, resource: { type: [{ code: "canonical", targetProfile: ["http://hl7.org/fhir/StructureDefinition/Resource"] }] } } }, SampledData: { elements: { id: { type: [{ code: "string" }] }, extension: { max: 9007199254740991, type: [{ code: "Extension" }] }, origin: { min: 1, type: [{ code: "Quantity", profile: ["http://hl7.org/fhir/StructureDefinition/SimpleQuantity"] }] }, period: { min: 1, type: [{ code: "decimal" }] }, factor: { type: [{ code: "decimal" }] }, lowerLimit: { type: [{ code: "decimal" }] }, upperLimit: { type: [{ code: "decimal" }] }, dimensions: { min: 1, type: [{ code: "positiveInt" }] }, data: { type: [{ code: "string" }] } } }, Signature: { elements: { id: { type: [{ code: "string" }] }, extension: { max: 9007199254740991, type: [{ code: "Extension" }] }, type: { min: 1, max: 9007199254740991, type: [{ code: "Coding" }] }, when: { min: 1, type: [{ code: "instant" }] }, who: { min: 1, type: [{ code: "Reference", targetProfile: ["http://hl7.org/fhir/StructureDefinition/Practitioner", "http://hl7.org/fhir/StructureDefinition/PractitionerRole", "http://hl7.org/fhir/StructureDefinition/RelatedPerson", "http://hl7.org/fhir/StructureDefinition/Patient", "http://hl7.org/fhir/StructureDefinition/Device", "http://hl7.org/fhir/StructureDefinition/Organization"] }] }, onBehalfOf: { type: [{ code: "Reference", targetProfile: ["http://hl7.org/fhir/StructureDefinition/Practitioner", "http://hl7.org/fhir/StructureDefinition/PractitionerRole", "http://hl7.org/fhir/StructureDefinition/RelatedPerson", "http://hl7.org/fhir/StructureDefinition/Patient", "http://hl7.org/fhir/StructureDefinition/Device", "http://hl7.org/fhir/StructureDefinition/Organization"] }] }, targetFormat: { type: [{ code: "code" }] }, sigFormat: { type: [{ code: "code" }] }, data: { type: [{ code: "base64Binary" }] } } }, SubstanceAmount: { elements: { id: { type: [{ code: "string" }] }, extension: { max: 9007199254740991, type: [{ code: "Extension" }] }, modifierExtension: { max: 9007199254740991, type: [{ code: "Extension" }] }, "amount[x]": { type: [{ code: "Quantity" }, { code: "Range" }, { code: "string" }] }, amountType: { type: [{ code: "CodeableConcept" }] }, amountText: { type: [{ code: "string" }] }, referenceRange: { type: [{ code: "SubstanceAmountReferenceRange" }] } } }, SubstanceAmountReferenceRange: { elements: { id: { type: [{ code: "string" }] }, extension: { max: 9007199254740991, type: [{ code: "Extension" }] }, lowLimit: { type: [{ code: "Quantity" }] }, highLimit: { type: [{ code: "Quantity" }] } } }, Timing: { elements: { id: { type: [{ code: "string" }] }, extension: { max: 9007199254740991, type: [{ code: "Extension" }] }, modifierExtension: { max: 9007199254740991, type: [{ code: "Extension" }] }, event: { max: 9007199254740991, type: [{ code: "dateTime" }] }, repeat: { type: [{ code: "TimingRepeat" }] }, code: { type: [{ code: "CodeableConcept" }] } } }, TimingRepeat: { elements: { id: { type: [{ code: "string" }] }, extension: { max: 9007199254740991, type: [{ code: "Extension" }] }, "bounds[x]": { type: [{ code: "Duration" }, { code: "Range" }, { code: "Period" }] }, count: { type: [{ code: "positiveInt" }] }, countMax: { type: [{ code: "positiveInt" }] }, duration: { type: [{ code: "decimal" }] }, durationMax: { type: [{ code: "decimal" }] }, durationUnit: { type: [{ code: "code" }] }, frequency: { type: [{ code: "positiveInt" }] }, frequencyMax: { type: [{ code: "positiveInt" }] }, period: { type: [{ code: "decimal" }] }, periodMax: { type: [{ code: "decimal" }] }, periodUnit: { type: [{ code: "code" }] }, dayOfWeek: { max: 9007199254740991, type: [{ code: "code" }] }, timeOfDay: { max: 9007199254740991, type: [{ code: "time" }] }, when: { max: 9007199254740991, type: [{ code: "code" }] }, offset: { type: [{ code: "unsignedInt" }] } } }, TriggerDefinition: { elements: { id: { type: [{ code: "string" }] }, extension: { max: 9007199254740991, type: [{ code: "Extension" }] }, type: { min: 1, type: [{ code: "code" }] }, name: { type: [{ code: "string" }] }, "timing[x]": { type: [{ code: "Timing" }, { code: "Reference", targetProfile: ["http://hl7.org/fhir/StructureDefinition/Schedule"] }, { code: "date" }, { code: "dateTime" }] }, data: { max: 9007199254740991, type: [{ code: "DataRequirement" }] }, condition: { type: [{ code: "Expression" }] } } }, UsageContext: { elements: { id: { type: [{ code: "string" }] }, extension: { max: 9007199254740991, type: [{ code: "Extension" }] }, code: { min: 1, type: [{ code: "Coding" }] }, "value[x]": { min: 1, type: [{ code: "CodeableConcept" }, { code: "Quantity" }, { code: "Range" }, { code: "Reference", targetProfile: ["http://hl7.org/fhir/StructureDefinition/PlanDefinition", "http://hl7.org/fhir/StructureDefinition/ResearchStudy", "http://hl7.org/fhir/StructureDefinition/InsurancePlan", "http://hl7.org/fhir/StructureDefinition/HealthcareService", "http://hl7.org/fhir/StructureDefinition/Group", "http://hl7.org/fhir/StructureDefinition/Location", "http://hl7.org/fhir/StructureDefinition/Organization"] }] } } }, MoneyQuantity: { elements: { id: { type: [{ code: "string" }] }, extension: { max: 9007199254740991, type: [{ code: "Extension" }] }, value: { type: [{ code: "decimal" }] }, comparator: { type: [{ code: "code" }] }, unit: { type: [{ code: "string" }] }, system: { type: [{ code: "uri" }] }, code: { type: [{ code: "code" }] } } }, SimpleQuantity: { elements: { id: { type: [{ code: "string" }] }, extension: { max: 9007199254740991, type: [{ code: "Extension" }] }, value: { type: [{ code: "decimal" }] }, comparator: { max: 0, type: [{ code: "code" }] }, unit: { type: [{ code: "string" }] }, system: { type: [{ code: "uri" }] }, code: { type: [{ code: "code" }] } } }, IdentityProvider: { elements: { authorizeUrl: { min: 1, type: [{ code: "string" }] }, tokenUrl: { min: 1, type: [{ code: "string" }] }, tokenAuthMethod: { type: [{ code: "code" }] }, userInfoUrl: { min: 1, type: [{ code: "string" }] }, clientId: { min: 1, type: [{ code: "string" }] }, clientSecret: { min: 1, type: [{ code: "string" }] }, usePkce: { type: [{ code: "boolean" }] }, useSubject: { type: [{ code: "boolean" }] } } } };
31534
+ function mr(r6) {
31535
+ return new fr(r6).parse();
31536
31536
  }
31537
- var fe = Cn(Pn);
31538
- var mr = /* @__PURE__ */ Object.create(null);
31539
- var wn = /* @__PURE__ */ Object.create(null);
31540
- var lo = { "http://hl7.org/fhir/StructureDefinition/MoneyQuantity": "MoneyQuantity", "http://hl7.org/fhir/StructureDefinition/SimpleQuantity": "SimpleQuantity", "http://hl7.org/fhir/uv/sql-on-fhir/StructureDefinition/ViewDefinition": "ViewDefinition" };
31541
- function kn(r6) {
31537
+ var fe = Rn(Cn);
31538
+ var yr = /* @__PURE__ */ Object.create(null);
31539
+ var Pn = /* @__PURE__ */ Object.create(null);
31540
+ var po = { "http://hl7.org/fhir/StructureDefinition/MoneyQuantity": "MoneyQuantity", "http://hl7.org/fhir/StructureDefinition/SimpleQuantity": "SimpleQuantity", "http://hl7.org/fhir/uv/sql-on-fhir/StructureDefinition/ViewDefinition": "ViewDefinition" };
31541
+ function In(r6) {
31542
31542
  let e;
31543
- return e = wn[r6], e || (e = wn[r6] = /* @__PURE__ */ Object.create(null)), e;
31543
+ return e = Pn[r6], e || (e = Pn[r6] = /* @__PURE__ */ Object.create(null)), e;
31544
31544
  }
31545
- function yr(r6) {
31545
+ function gr(r6) {
31546
31546
  let t = (Array.isArray(r6) ? r6 : r6.entry?.map((n) => n.resource) ?? []).filter((n) => n?.resourceType === "StructureDefinition");
31547
31547
  Ln(t);
31548
- for (let n of t) gr(n);
31548
+ for (let n of t) xr(n);
31549
31549
  }
31550
- function gr(r6) {
31550
+ function xr(r6) {
31551
31551
  if (!r6?.name) throw new Error("Failed loading StructureDefinition from bundle");
31552
31552
  if (r6.resourceType !== "StructureDefinition") return;
31553
- let e = hr(r6), t = lo[r6.url], n, i2;
31554
- t ? (n = fe, i2 = t) : r6.url === `http://hl7.org/fhir/StructureDefinition/${r6.type}` || r6.url === `https://medplum.com/fhir/StructureDefinition/${r6.type}` || r6.type?.startsWith("http://") || r6.type?.startsWith("https://") ? (n = fe, i2 = r6.type) : (n = kn(r6.url), i2 = r6.type), n[i2] = e;
31553
+ let e = mr(r6), t = po[r6.url], n, i2;
31554
+ t ? (n = fe, i2 = t) : r6.url === `http://hl7.org/fhir/StructureDefinition/${r6.type}` || r6.url === `https://medplum.com/fhir/StructureDefinition/${r6.type}` || r6.type?.startsWith("http://") || r6.type?.startsWith("https://") ? (n = fe, i2 = r6.type) : (n = In(r6.url), i2 = r6.type), n[i2] = e;
31555
31555
  for (let o of e.innerTypes) o.parentType = e, n[o.name] = o;
31556
- mr[r6.url] = e;
31556
+ yr[r6.url] = e;
31557
31557
  }
31558
- function Vn(r6) {
31558
+ function Dn(r6) {
31559
31559
  return !!fe[r6];
31560
31560
  }
31561
- function Be(r6, e) {
31561
+ function We(r6, e) {
31562
31562
  if (e) {
31563
- let t = kn(e)[r6];
31563
+ let t = In(e)[r6];
31564
31564
  if (t) return t;
31565
31565
  }
31566
31566
  return fe[r6];
31567
31567
  }
31568
- function _n(r6) {
31569
- return !!mr[r6];
31568
+ function Mn(r6) {
31569
+ return !!yr[r6];
31570
31570
  }
31571
- var pr = class {
31571
+ var fr = class {
31572
31572
  constructor(e) {
31573
31573
  if (!e.snapshot?.element || e.snapshot.element.length === 0) throw new Error(`No snapshot defined for StructureDefinition '${e.name}'`);
31574
- this.root = e.snapshot.element[0], this.elements = e.snapshot.element.slice(1), this.elementIndex = /* @__PURE__ */ Object.create(null), this.index = 0, this.resourceSchema = { name: e.name, path: this.root.path, title: e.title, type: e.type, url: e.url, version: e.version, kind: e.kind, description: mo(e), elements: {}, constraints: this.parseElementDefinition(this.root).constraints, innerTypes: [], summaryProperties: /* @__PURE__ */ new Set(), mandatoryProperties: /* @__PURE__ */ new Set() }, this.innerTypes = [];
31574
+ this.root = e.snapshot.element[0], this.elements = e.snapshot.element.slice(1), this.elementIndex = /* @__PURE__ */ Object.create(null), this.index = 0, this.resourceSchema = { name: e.name, path: this.root.path, title: e.title, type: e.type, url: e.url, version: e.version, kind: e.kind, description: yo(e), elements: {}, constraints: this.parseElementDefinition(this.root).constraints, innerTypes: [], summaryProperties: /* @__PURE__ */ new Set(), mandatoryProperties: /* @__PURE__ */ new Set() }, this.innerTypes = [];
31575
31575
  }
31576
31576
  parse() {
31577
31577
  let e = this.next();
@@ -31579,7 +31579,7 @@ var pr = class {
31579
31579
  if (e.sliceName) this.parseSliceStart(e);
31580
31580
  else if (e.id?.includes(":")) {
31581
31581
  if (this.slicingContext?.current) {
31582
- let t = dr(e, this.slicingContext.path);
31582
+ let t = pr(e, this.slicingContext.path);
31583
31583
  this.slicingContext.current.elements[t] = this.parseElementDefinition(e);
31584
31584
  }
31585
31585
  } else {
@@ -31588,13 +31588,13 @@ var pr = class {
31588
31588
  let n = this.backboneContext;
31589
31589
  for (; n; ) {
31590
31590
  if (e.path?.startsWith(n.path + ".")) {
31591
- n.type.elements[dr(e, n.path)] = t;
31591
+ n.type.elements[pr(e, n.path)] = t;
31592
31592
  break;
31593
31593
  }
31594
31594
  n = n.parent;
31595
31595
  }
31596
31596
  if (!n) {
31597
- let i2 = dr(e, this.root.path);
31597
+ let i2 = pr(e, this.root.path);
31598
31598
  e.isSummary && this.resourceSchema.summaryProperties?.add(i2.replace("[x]", "")), t.min > 0 && this.resourceSchema.mandatoryProperties?.add(i2.replace("[x]", "")), this.resourceSchema.elements[i2] = t;
31599
31599
  }
31600
31600
  this.checkFieldExit(e);
@@ -31604,23 +31604,23 @@ var pr = class {
31604
31604
  return this.checkFieldExit(), this.innerTypes.length > 0 && (this.resourceSchema.innerTypes = this.innerTypes), this.resourceSchema;
31605
31605
  }
31606
31606
  checkFieldEnter(e, t) {
31607
- this.isInnerType(e) && this.enterInnerType(e), this.slicingContext && !Oe(this.slicingContext.path, e?.path) && (this.slicingContext = void 0), e.slicing && !this.slicingContext && this.enterSlice(e, t);
31607
+ this.isInnerType(e) && this.enterInnerType(e), this.slicingContext && !Ie(this.slicingContext.path, e?.path) && (this.slicingContext = void 0), e.slicing && !this.slicingContext && this.enterSlice(e, t);
31608
31608
  }
31609
31609
  enterInnerType(e) {
31610
- for (; this.backboneContext && !Oe(this.backboneContext?.path, e.path); ) this.innerTypes.push(this.backboneContext.type), this.backboneContext = this.backboneContext.parent;
31611
- let t = fr(e);
31612
- this.backboneContext = { type: { name: t, type: t, path: e.path, title: e.label, description: e.definition, elements: {}, constraints: this.parseElementDefinition(e).constraints, innerTypes: [] }, path: e.path, parent: Oe(this.backboneContext?.path, e.path) ? this.backboneContext : this.backboneContext?.parent };
31610
+ for (; this.backboneContext && !Ie(this.backboneContext?.path, e.path); ) this.innerTypes.push(this.backboneContext.type), this.backboneContext = this.backboneContext.parent;
31611
+ let t = hr(e);
31612
+ this.backboneContext = { type: { name: t, type: t, path: e.path, title: e.label, description: e.definition, elements: {}, constraints: this.parseElementDefinition(e).constraints, innerTypes: [] }, path: e.path, parent: Ie(this.backboneContext?.path, e.path) ? this.backboneContext : this.backboneContext?.parent };
31613
31613
  }
31614
31614
  enterSlice(e, t) {
31615
- ho(e) && !this.peek()?.sliceName || (t.slicing = { discriminator: (e.slicing?.discriminator ?? []).map((n) => {
31615
+ mo(e) && !this.peek()?.sliceName || (t.slicing = { discriminator: (e.slicing?.discriminator ?? []).map((n) => {
31616
31616
  if (n.type !== "value" && n.type !== "pattern" && n.type !== "type") throw new Error(`Unsupported slicing discriminator type: ${n.type}`);
31617
31617
  return { path: n.path, type: n.type };
31618
31618
  }), slices: [], ordered: e.slicing?.ordered ?? false, rule: e.slicing?.rules }, this.slicingContext = { field: t.slicing, path: e.path ?? "" });
31619
31619
  }
31620
31620
  checkFieldExit(e = void 0) {
31621
- if (this.backboneContext && !Oe(this.backboneContext.path, e?.path)) if (this.backboneContext.parent) do
31621
+ if (this.backboneContext && !Ie(this.backboneContext.path, e?.path)) if (this.backboneContext.parent) do
31622
31622
  this.innerTypes.push(this.backboneContext.type), this.backboneContext = this.backboneContext.parent;
31623
- while (this.backboneContext && !Oe(this.backboneContext.path, e?.path));
31623
+ while (this.backboneContext && !Ie(this.backboneContext.path, e?.path));
31624
31624
  else this.innerTypes.push(this.backboneContext.type), this.backboneContext = void 0;
31625
31625
  }
31626
31626
  next() {
@@ -31639,7 +31639,7 @@ var pr = class {
31639
31639
  }
31640
31640
  isInnerType(e) {
31641
31641
  let t = this.peek();
31642
- return !!(Oe(e?.path, t?.path) && e.type?.some((n) => ["BackboneElement", "Element"].includes(n.code)));
31642
+ return !!(Ie(e?.path, t?.path) && e.type?.some((n) => ["BackboneElement", "Element"].includes(n.code)));
31643
31643
  }
31644
31644
  parseSliceStart(e) {
31645
31645
  if (!this.slicingContext) throw new Error(`Invalid slice start before discriminator: ${e.sliceName} (${e.id})`);
@@ -31648,49 +31648,49 @@ var pr = class {
31648
31648
  parseElementDefinitionType(e) {
31649
31649
  return (e.type ?? []).map((t) => {
31650
31650
  let n;
31651
- return (t.code === "BackboneElement" || t.code === "Element") && (n = fr(e)), n || (n = ne(t, "http://hl7.org/fhir/StructureDefinition/structuredefinition-fhir-type")?.valueUrl), n || (n = t.code ?? ""), { code: n, targetProfile: t.targetProfile, profile: t.profile };
31651
+ return (t.code === "BackboneElement" || t.code === "Element") && (n = hr(e)), n || (n = ne(t, "http://hl7.org/fhir/StructureDefinition/structuredefinition-fhir-type")?.valueUrl), n || (n = t.code ?? ""), { code: n, targetProfile: t.targetProfile, profile: t.profile };
31652
31652
  });
31653
31653
  }
31654
31654
  parseElementDefinition(e) {
31655
- let t = On(e.max), n = e.base?.max ? On(e.base.max) : t, i2 = { type: "ElementDefinition", value: e };
31656
- return { description: e.definition || "", path: e.path || e.base?.path || "", min: e.min ?? 0, max: t, isArray: n > 1, constraints: (e.constraint ?? []).map((o) => ({ key: o.key ?? "", severity: o.severity ?? "error", expression: o.expression ?? "", description: o.human ?? "" })), type: this.parseElementDefinitionType(e), fixed: In(C(i2, "fixed[x]")), pattern: In(C(i2, "pattern[x]")), binding: e.binding };
31655
+ let t = An(e.max), n = e.base?.max ? An(e.base.max) : t, i2 = { type: "ElementDefinition", value: e };
31656
+ return { description: e.definition || "", path: e.path || e.base?.path || "", min: e.min ?? 0, max: t, isArray: n > 1, constraints: (e.constraint ?? []).map((o) => ({ key: o.key ?? "", severity: o.severity ?? "error", expression: o.expression ?? "", description: o.human ?? "" })), type: this.parseElementDefinitionType(e), fixed: On(C(i2, "fixed[x]")), pattern: On(C(i2, "pattern[x]")), binding: e.binding };
31657
31657
  }
31658
31658
  };
31659
- function On(r6) {
31659
+ function An(r6) {
31660
31660
  return r6 === "*" ? Number.POSITIVE_INFINITY : Number.parseInt(r6, 10);
31661
31661
  }
31662
- function dr(r6, e = "") {
31663
- return fo(r6.path, e);
31662
+ function pr(r6, e = "") {
31663
+ return ho(r6.path, e);
31664
31664
  }
31665
- function fo(r6, e) {
31665
+ function ho(r6, e) {
31666
31666
  return r6 ? e && r6.startsWith(e) ? r6.substring(e.length + 1) : r6 : "";
31667
31667
  }
31668
- function Oe(r6, e) {
31668
+ function Ie(r6, e) {
31669
31669
  return !r6 || !e ? false : e.startsWith(r6 + ".") || e === r6;
31670
31670
  }
31671
- function In(r6) {
31671
+ function On(r6) {
31672
31672
  return Array.isArray(r6) && r6.length > 0 ? r6[0] : S(r6) ? void 0 : r6;
31673
31673
  }
31674
- function ho(r6) {
31674
+ function mo(r6) {
31675
31675
  let e = r6.slicing?.discriminator;
31676
31676
  return !!(r6.type?.some((t) => t.code === "Extension") && e?.length === 1 && e[0].type === "value" && e[0].path === "url");
31677
31677
  }
31678
- function mo(r6) {
31678
+ function yo(r6) {
31679
31679
  let e = r6.description;
31680
31680
  return e?.startsWith(`Base StructureDefinition for ${r6.name} Type: `) && (e = e.substring(`Base StructureDefinition for ${r6.name} Type: `.length)), e;
31681
31681
  }
31682
- var xo = new Ce(1e3);
31682
+ var vo = new Pe(1e3);
31683
31683
  var ut = { base64Binary: /^([A-Za-z\d+/]{4})*([A-Za-z\d+/]{2}==|[A-Za-z\d+/]{3}=)?$/, canonical: /^\S*$/, code: /^[^\s]+( [^\s]+)*$/, date: /^(\d(\d(\d[1-9]|[1-9]0)|[1-9]00)|[1-9]000)(-(0[1-9]|1[0-2])(-(0[1-9]|[1-2]\d|3[0-1]))?)?$/, dateTime: /^(\d(\d(\d[1-9]|[1-9]0)|[1-9]00)|[1-9]000)(-(0[1-9]|1[0-2])(-(0[1-9]|[1-2]\d|3[0-1])(T([01]\d|2[0-3])(:[0-5]\d:([0-5]\d|60)(\.\d{1,9})?)?)?)?(Z|[+-]((0\d|1[0-3]):[0-5]\d|14:00)?)?)?$/, id: /^[A-Za-z0-9\-.]{1,64}$/, instant: /^(\d(\d(\d[1-9]|[1-9]0)|[1-9]00)|[1-9]000)-(0[1-9]|1[0-2])-(0[1-9]|[1-2]\d|3[0-1])T([01]\d|2[0-3]):[0-5]\d:([0-5]\d|60)(\.\d{1,9})?(Z|[+-]((0\d|1[0-3]):[0-5]\d|14:00))$/, markdown: /^[\r\n\t\u0020-\uFFFF]+$/, oid: /^urn:oid:[0-2](\.(0|[1-9]\d*))+$/, string: /^[\r\n\t\u0020-\uFFFF]+$/, time: /^([01]\d|2[0-3]):[0-5]\d:([0-5]\d|60)(\.\d{1,9})?$/, uri: /^\S*$/, url: /^\S*$/, uuid: /^urn:uuid:[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/, xhtml: /.*/ };
31684
31684
  function h(r6) {
31685
31685
  return [{ type: l.boolean, value: r6 }];
31686
31686
  }
31687
31687
  function v(r6) {
31688
- return r6 == null ? { type: "undefined", value: void 0 } : Number.isSafeInteger(r6) ? { type: l.integer, value: r6 } : typeof r6 == "number" ? { type: l.decimal, value: r6 } : typeof r6 == "boolean" ? { type: l.boolean, value: r6 } : typeof r6 == "string" ? { type: l.string, value: r6 } : k(r6) ? { type: l.Quantity, value: r6 } : A(r6) ? { type: r6.resourceType, value: r6 } : Ar(r6) ? { type: l.CodeableConcept, value: r6 } : wr(r6) ? { type: l.Coding, value: r6 } : { type: l.BackboneElement, value: r6 };
31688
+ return r6 == null ? { type: "undefined", value: void 0 } : Number.isSafeInteger(r6) ? { type: l.integer, value: r6 } : typeof r6 == "number" ? { type: l.decimal, value: r6 } : typeof r6 == "boolean" ? { type: l.boolean, value: r6 } : typeof r6 == "string" ? { type: l.string, value: r6 } : k(r6) ? { type: l.Quantity, value: r6 } : A(r6) ? { type: r6.resourceType, value: r6 } : Or(r6) ? { type: l.CodeableConcept, value: r6 } : Ar(r6) ? { type: l.Coding, value: r6 } : { type: l.BackboneElement, value: r6 };
31689
31689
  }
31690
31690
  function _(r6) {
31691
31691
  return r6.length === 0 ? false : !!r6[0].value;
31692
31692
  }
31693
- function H(r6, e) {
31693
+ function G(r6, e) {
31694
31694
  if (r6.length !== 0) {
31695
31695
  if (r6.length === 1 && (!e || r6[0].type === e)) return r6[0];
31696
31696
  throw new Error(`Expected singleton of type ${e}, but found ${JSON.stringify(r6)}`);
@@ -31699,9 +31699,9 @@ function H(r6, e) {
31699
31699
  function C(r6, e, t) {
31700
31700
  if (!r6.value) return;
31701
31701
  let n = ft(r6.type, e, t?.profileUrl);
31702
- return n ? Co(r6, e, n) : Po(r6, e);
31702
+ return n ? Po(r6, e, n) : wo(r6, e);
31703
31703
  }
31704
- function Co(r6, e, t) {
31704
+ function Po(r6, e, t) {
31705
31705
  let n = r6.value, i2 = t.type;
31706
31706
  if (!i2 || i2.length === 0) return;
31707
31707
  let o, s = "undefined", a2, c = t.path.lastIndexOf("."), u2 = t.path.substring(c + 1);
@@ -31714,14 +31714,14 @@ function Co(r6, e, t) {
31714
31714
  }
31715
31715
  if (a2) if (Array.isArray(o)) {
31716
31716
  o = o.slice();
31717
- for (let d2 = 0; d2 < Math.max(o.length, a2.length); d2++) o[d2] = qn(o[d2], a2[d2]);
31718
- } else o = qn(o, a2);
31719
- if (!S(o)) return (s === "Element" || s === "BackboneElement") && (s = t.type[0].code), Array.isArray(o) ? o.map((d2) => Nn(d2, s)) : Nn(o, s);
31717
+ for (let d2 = 0; d2 < Math.max(o.length, a2.length); d2++) o[d2] = Wn(o[d2], a2[d2]);
31718
+ } else o = Wn(o, a2);
31719
+ if (!S(o)) return (s === "Element" || s === "BackboneElement") && (s = t.type[0].code), Array.isArray(o) ? o.map((d2) => Fn(d2, s)) : Fn(o, s);
31720
31720
  }
31721
- function Nn(r6, e) {
31721
+ function Fn(r6, e) {
31722
31722
  return e === "Resource" && A(r6) && (e = r6.resourceType), { type: e, value: r6 };
31723
31723
  }
31724
- function Po(r6, e) {
31724
+ function wo(r6, e) {
31725
31725
  let t = r6.value;
31726
31726
  if (!t || typeof t != "object") return;
31727
31727
  let n;
@@ -31748,7 +31748,7 @@ function lt(r6) {
31748
31748
  let e = [];
31749
31749
  for (let t of r6) {
31750
31750
  let n = false;
31751
- for (let i2 of e) if (_(je(t, i2))) {
31751
+ for (let i2 of e) if (_($e(t, i2))) {
31752
31752
  n = true;
31753
31753
  break;
31754
31754
  }
@@ -31756,27 +31756,27 @@ function lt(r6) {
31756
31756
  }
31757
31757
  return e;
31758
31758
  }
31759
- function jn(r6) {
31759
+ function qn(r6) {
31760
31760
  return h(!_(r6));
31761
31761
  }
31762
- function $n(r6, e) {
31763
- return r6.length === 0 || e.length === 0 ? [] : r6.length !== e.length ? h(false) : h(r6.every((t, n) => _(je(t, e[n]))));
31762
+ function jn(r6, e) {
31763
+ return r6.length === 0 || e.length === 0 ? [] : r6.length !== e.length ? h(false) : h(r6.every((t, n) => _($e(t, e[n]))));
31764
31764
  }
31765
- function Hn(r6, e) {
31766
- return r6.length === 0 || e.length === 0 ? [] : r6.length !== e.length ? h(true) : h(r6.some((t, n) => !_(je(t, e[n]))));
31765
+ function $n(r6, e) {
31766
+ return r6.length === 0 || e.length === 0 ? [] : r6.length !== e.length ? h(true) : h(r6.some((t, n) => !_($e(t, e[n]))));
31767
31767
  }
31768
- function je(r6, e) {
31768
+ function $e(r6, e) {
31769
31769
  let t = r6.value?.valueOf(), n = e.value?.valueOf();
31770
- return typeof t == "number" && typeof n == "number" ? h(Math.abs(t - n) < 1e-8) : k(t) && k(n) ? h(Qn(t, n)) : h(typeof t == "object" && typeof n == "object" ? Pr(r6, e) : t === n);
31770
+ return typeof t == "number" && typeof n == "number" ? h(Math.abs(t - n) < 1e-8) : k(t) && k(n) ? h(Hn(t, n)) : h(typeof t == "object" && typeof n == "object" ? wr(r6, e) : t === n);
31771
31771
  }
31772
- function Cr(r6, e) {
31773
- return r6.length === 0 && e.length === 0 ? h(true) : r6.length !== e.length ? h(false) : (r6.sort(Un), e.sort(Un), h(r6.every((t, n) => _(wo(t, e[n])))));
31772
+ function Pr(r6, e) {
31773
+ return r6.length === 0 && e.length === 0 ? h(true) : r6.length !== e.length ? h(false) : (r6.sort(Nn), e.sort(Nn), h(r6.every((t, n) => _(Ao(t, e[n])))));
31774
31774
  }
31775
- function wo(r6, e) {
31775
+ function Ao(r6, e) {
31776
31776
  let { type: t, value: n } = r6, { type: i2, value: o } = e, s = n?.valueOf(), a2 = o?.valueOf();
31777
- return typeof s == "number" && typeof a2 == "number" ? h(Math.abs(s - a2) < 0.01) : k(s) && k(a2) ? h(Qn(s, a2)) : h(t === "Coding" && i2 === "Coding" ? typeof s != "object" || typeof a2 != "object" ? false : s.code === a2.code && s.system === a2.system : typeof s == "object" && typeof a2 == "object" ? Pr({ ...s, id: void 0 }, { ...a2, id: void 0 }) : typeof s == "string" && typeof a2 == "string" ? s.toLowerCase() === a2.toLowerCase() : s === a2);
31777
+ return typeof s == "number" && typeof a2 == "number" ? h(Math.abs(s - a2) < 0.01) : k(s) && k(a2) ? h(Hn(s, a2)) : h(t === "Coding" && i2 === "Coding" ? typeof s != "object" || typeof a2 != "object" ? false : s.code === a2.code && s.system === a2.system : typeof s == "object" && typeof a2 == "object" ? wr({ ...s, id: void 0 }, { ...a2, id: void 0 }) : typeof s == "string" && typeof a2 == "string" ? s.toLowerCase() === a2.toLowerCase() : s === a2);
31778
31778
  }
31779
- function Un(r6, e) {
31779
+ function Nn(r6, e) {
31780
31780
  let t = r6.value?.valueOf(), n = e.value?.valueOf();
31781
31781
  return typeof t == "number" && typeof n == "number" ? t - n : typeof t == "string" && typeof n == "string" ? t.localeCompare(n) : 0;
31782
31782
  }
@@ -31793,7 +31793,7 @@ function dt(r6, e) {
31793
31793
  case "Date":
31794
31794
  return Gn(t);
31795
31795
  case "DateTime":
31796
- return ke(t);
31796
+ return De(t);
31797
31797
  case "Time":
31798
31798
  return typeof t == "string" && !!/^T\d/.exec(t);
31799
31799
  case "Period":
@@ -31807,84 +31807,84 @@ function dt(r6, e) {
31807
31807
  function Gn(r6) {
31808
31808
  return typeof r6 == "string" && !!ut.date.exec(r6);
31809
31809
  }
31810
- function ke(r6) {
31810
+ function De(r6) {
31811
31811
  return typeof r6 == "string" && !!ut.dateTime.exec(r6);
31812
31812
  }
31813
31813
  function pt(r6) {
31814
- return !!(r6 && typeof r6 == "object" && ("start" in r6 && ke(r6.start) || "end" in r6 && ke(r6.end)));
31814
+ return !!(r6 && typeof r6 == "object" && ("start" in r6 && De(r6.start) || "end" in r6 && De(r6.end)));
31815
31815
  }
31816
31816
  function k(r6) {
31817
31817
  return !!(r6 && typeof r6 == "object" && "value" in r6 && typeof r6.value == "number");
31818
31818
  }
31819
- function Qn(r6, e) {
31819
+ function Hn(r6, e) {
31820
31820
  return Math.abs(r6.value - e.value) < 0.01 && (r6.unit === e.unit || r6.code === e.code || r6.unit === e.code || r6.code === e.unit);
31821
31821
  }
31822
- function Pr(r6, e) {
31822
+ function wr(r6, e) {
31823
31823
  let t = Object.keys(r6), n = Object.keys(e);
31824
31824
  if (t.length !== n.length) return false;
31825
31825
  for (let i2 of t) {
31826
31826
  let o = r6[i2], s = e[i2];
31827
- if (Wn(o) && Wn(s)) {
31828
- if (!Pr(o, s)) return false;
31827
+ if (Bn(o) && Bn(s)) {
31828
+ if (!wr(o, s)) return false;
31829
31829
  } else if (o !== s) return false;
31830
31830
  }
31831
31831
  return true;
31832
31832
  }
31833
- function Wn(r6) {
31833
+ function Bn(r6) {
31834
31834
  return r6 !== null && typeof r6 == "object";
31835
31835
  }
31836
- function qn(r6, e) {
31836
+ function Wn(r6, e) {
31837
31837
  if (e) {
31838
31838
  if (typeof e != "object") throw new Error("Primitive extension must be an object");
31839
- return Ao(r6 ?? {}, e);
31839
+ return Oo(r6 ?? {}, e);
31840
31840
  }
31841
31841
  return r6;
31842
31842
  }
31843
- function Ao(r6, e) {
31843
+ function Oo(r6, e) {
31844
31844
  return delete e.__proto__, delete e.constructor, Object.assign(r6, e);
31845
31845
  }
31846
- function Ir(r6, e) {
31846
+ function kr(r6, e) {
31847
31847
  return A(r6, e) && "id" in r6 && typeof r6.id == "string";
31848
31848
  }
31849
31849
  function he(r6) {
31850
- let e = B(r6) ?? "undefined/undefined", t = Io(r6);
31850
+ let e = B(r6) ?? "undefined/undefined", t = ko(r6);
31851
31851
  return t === e ? { reference: e } : { reference: e, display: t };
31852
31852
  }
31853
31853
  function B(r6) {
31854
- if (Y(r6)) return r6.reference;
31855
- if (Ir(r6)) return `${r6.resourceType}/${r6.id}`;
31854
+ if (X(r6)) return r6.reference;
31855
+ if (kr(r6)) return `${r6.resourceType}/${r6.id}`;
31856
31856
  }
31857
31857
  function me(r6) {
31858
- if (r6) return Y(r6) ? r6.reference.split("/")[1] : r6.id;
31858
+ if (r6) return X(r6) ? r6.reference.split("/")[1] : r6.id;
31859
31859
  }
31860
- function Oo(r6) {
31860
+ function Io(r6) {
31861
31861
  return r6.resourceType === "Patient" || r6.resourceType === "Practitioner" || r6.resourceType === "RelatedPerson";
31862
31862
  }
31863
- function Io(r6) {
31864
- if (Oo(r6)) {
31865
- let e = ko(r6);
31863
+ function ko(r6) {
31864
+ if (Io(r6)) {
31865
+ let e = Do(r6);
31866
31866
  if (e) return e;
31867
31867
  }
31868
31868
  if (r6.resourceType === "Device") {
31869
- let e = Do(r6);
31869
+ let e = Vo(r6);
31870
31870
  if (e) return e;
31871
31871
  }
31872
- if (r6.resourceType === "MedicationRequest" && r6.medicationCodeableConcept) return $e(r6.medicationCodeableConcept);
31872
+ if (r6.resourceType === "MedicationRequest" && r6.medicationCodeableConcept) return Ge(r6.medicationCodeableConcept);
31873
31873
  if (r6.resourceType === "Subscription" && r6.criteria) return r6.criteria;
31874
31874
  if (r6.resourceType === "User" && r6.email) return r6.email;
31875
31875
  if ("name" in r6 && r6.name && typeof r6.name == "string") return r6.name;
31876
31876
  if ("code" in r6 && r6.code) {
31877
31877
  let e = r6.code;
31878
- if (Array.isArray(e) && (e = e[0]), Ar(e)) return $e(e);
31879
- if (Bo(e)) return e.text;
31878
+ if (Array.isArray(e) && (e = e[0]), Or(e)) return Ge(e);
31879
+ if (Wo(e)) return e.text;
31880
31880
  }
31881
31881
  return B(r6) ?? "";
31882
31882
  }
31883
- function ko(r6) {
31883
+ function Do(r6) {
31884
31884
  let e = r6.name;
31885
31885
  if (e && e.length > 0) return He(e[0]);
31886
31886
  }
31887
- function Do(r6) {
31887
+ function Vo(r6) {
31888
31888
  let e = r6.deviceName;
31889
31889
  if (e && e.length > 0) return e[0].name;
31890
31890
  }
@@ -31906,26 +31906,26 @@ function ne(r6, ...e) {
31906
31906
  return t;
31907
31907
  }
31908
31908
  function mt(r6, e) {
31909
- let t = kr(r6);
31909
+ let t = Dr(r6);
31910
31910
  return JSON.stringify(t, null, e ? 2 : void 0) ?? "";
31911
31911
  }
31912
- function kr(r6) {
31913
- if (!(r6 == null || r6 === "")) return typeof r6 == "object" ? Array.isArray(r6) ? Mo(r6) : _o(r6) : r6;
31912
+ function Dr(r6) {
31913
+ if (!(r6 == null || r6 === "")) return typeof r6 == "object" ? Array.isArray(r6) ? _o(r6) : Lo(r6) : r6;
31914
31914
  }
31915
- function Mo(r6) {
31915
+ function _o(r6) {
31916
31916
  let e = r6.length;
31917
31917
  if (e === 0) return;
31918
31918
  let t, n = 0;
31919
31919
  for (let i2 = 0; i2 < e; i2++) {
31920
- let o = r6[i2], s = kr(o);
31920
+ let o = r6[i2], s = Dr(o);
31921
31921
  s !== o && !t && (t = Array.from(r6)), s === void 0 ? t && (t[i2] = null) : (t && (t[i2] = s), n++);
31922
31922
  }
31923
31923
  if (n !== 0) return t ?? r6;
31924
31924
  }
31925
- function _o(r6) {
31925
+ function Lo(r6) {
31926
31926
  let e, t = 0;
31927
31927
  for (let n in r6) {
31928
- let i2 = r6[n], o = kr(i2);
31928
+ let i2 = r6[n], o = Dr(i2);
31929
31929
  o !== i2 && !e && (e = { ...r6 }), o === void 0 ? e && delete e[n] : (e && (e[n] = o), t++);
31930
31930
  }
31931
31931
  if (t !== 0) return e ?? r6;
@@ -31933,22 +31933,22 @@ function _o(r6) {
31933
31933
  function S(r6) {
31934
31934
  if (r6 == null) return true;
31935
31935
  let e = typeof r6;
31936
- return e === "string" || e === "object" ? !X(r6) : false;
31936
+ return e === "string" || e === "object" ? !Y(r6) : false;
31937
31937
  }
31938
- function X(r6) {
31938
+ function Y(r6) {
31939
31939
  if (r6 == null) return false;
31940
31940
  let e = typeof r6;
31941
31941
  return e === "string" && r6 !== "" || e === "object" && ("length" in r6 && r6.length > 0 || Object.keys(r6).length > 0);
31942
31942
  }
31943
31943
  function ie(r6, e, t) {
31944
- return r6 === e || S(r6) && S(e) ? true : S(r6) || S(e) ? false : Array.isArray(r6) && Array.isArray(e) ? Fo(r6, e) : Array.isArray(r6) || Array.isArray(e) ? false : E(r6) && E(e) ? Lo(r6, e, t) : (E(r6) || E(e), false);
31944
+ return r6 === e || S(r6) && S(e) ? true : S(r6) || S(e) ? false : Array.isArray(r6) && Array.isArray(e) ? Fo(r6, e) : Array.isArray(r6) || Array.isArray(e) ? false : E(r6) && E(e) ? No(r6, e, t) : (E(r6) || E(e), false);
31945
31945
  }
31946
31946
  function Fo(r6, e) {
31947
31947
  if (r6.length !== e.length) return false;
31948
31948
  for (let t = 0; t < r6.length; t++) if (!ie(r6[t], e[t])) return false;
31949
31949
  return true;
31950
31950
  }
31951
- function Lo(r6, e, t) {
31951
+ function No(r6, e, t) {
31952
31952
  let n = /* @__PURE__ */ new Set();
31953
31953
  Object.keys(r6).forEach((i2) => n.add(i2)), Object.keys(e).forEach((i2) => n.add(i2)), t === "meta" && (n.delete("versionId"), n.delete("lastUpdated"), n.delete("author"));
31954
31954
  for (let i2 of n) {
@@ -31960,40 +31960,40 @@ function Lo(r6, e, t) {
31960
31960
  function E(r6) {
31961
31961
  return r6 !== null && typeof r6 == "object";
31962
31962
  }
31963
- function Yn(r6) {
31964
- return r6.every(Dr);
31963
+ function Kn(r6) {
31964
+ return r6.every(Vr);
31965
31965
  }
31966
- function Dr(r6) {
31966
+ function Vr(r6) {
31967
31967
  return typeof r6 == "string";
31968
31968
  }
31969
- function wr(r6) {
31969
+ function Ar(r6) {
31970
31970
  return E(r6) && "code" in r6 && typeof r6.code == "string";
31971
31971
  }
31972
- function Ar(r6) {
31973
- return E(r6) && "coding" in r6 && Array.isArray(r6.coding) && r6.coding.every(wr);
31972
+ function Or(r6) {
31973
+ return E(r6) && "coding" in r6 && Array.isArray(r6.coding) && r6.coding.every(Ar);
31974
31974
  }
31975
- function Bo(r6) {
31975
+ function Wo(r6) {
31976
31976
  return E(r6) && "text" in r6 && typeof r6.text == "string";
31977
31977
  }
31978
31978
  var Xn = [];
31979
31979
  for (let r6 = 0; r6 < 256; r6++) Xn.push(r6.toString(16).padStart(2, "0"));
31980
- function Zn(r6) {
31981
- let e = ti(r6), t = new Uint8Array(e), n = new Array(t.length);
31980
+ function Yn(r6) {
31981
+ let e = ei(r6), t = new Uint8Array(e), n = new Array(t.length);
31982
31982
  for (let i2 = 0; i2 < t.length; i2++) n[i2] = Xn[t[i2]];
31983
31983
  return n.join("");
31984
31984
  }
31985
- function ei(r6) {
31986
- let e = ti(r6), t = new Uint8Array(e), n = new Array(t.length);
31985
+ function Zn(r6) {
31986
+ let e = ei(r6), t = new Uint8Array(e), n = new Array(t.length);
31987
31987
  for (let i2 = 0; i2 < t.length; i2++) n[i2] = String.fromCharCode(t[i2]);
31988
31988
  return window.btoa(n.join(""));
31989
31989
  }
31990
- function ti(r6) {
31990
+ function ei(r6) {
31991
31991
  return ArrayBuffer.isView(r6) ? r6.buffer : r6;
31992
31992
  }
31993
31993
  function I(r6) {
31994
31994
  return r6 ? r6.charAt(0).toUpperCase() + r6.substring(1) : "";
31995
31995
  }
31996
- var Mr = (r6) => new Promise((e) => {
31996
+ var _r = (r6) => new Promise((e) => {
31997
31997
  setTimeout(e, r6);
31998
31998
  });
31999
31999
  function yt(r6) {
@@ -32002,21 +32002,21 @@ function yt(r6) {
32002
32002
  function Fr(r6) {
32003
32003
  return r6.endsWith("/") ? r6 : r6 + "/";
32004
32004
  }
32005
- function Qo(r6) {
32005
+ function zo(r6) {
32006
32006
  return r6.startsWith("/") ? r6.slice(1) : r6;
32007
32007
  }
32008
32008
  function W(r6, e) {
32009
- return new URL(Qo(e), Fr(r6.toString())).toString();
32009
+ return new URL(zo(e), Fr(r6.toString())).toString();
32010
32010
  }
32011
- function oi(r6, e) {
32011
+ function ii(r6, e) {
32012
32012
  return W(r6, e).toString().replace("http://", "ws://").replace("https://", "wss://");
32013
32013
  }
32014
- function si(r6) {
32014
+ function oi(r6) {
32015
32015
  return typeof r6 == "object" && !Array.isArray(r6) && !(r6 instanceof URLSearchParams) && (r6 = Object.fromEntries(Object.entries(r6).filter((e) => e[1] !== void 0))), new URLSearchParams(r6).toString();
32016
32016
  }
32017
- var zo = /^(([a-zA-Z0-9]|[a-zA-Z0-9][a-zA-Z0-9\-_]*[a-zA-Z0-9])\.)*([A-Za-z0-9]|[A-Za-z0-9][A-Za-z0-9\-_]*[A-Za-z0-9])$/;
32018
- function bl(r6) {
32019
- return zo.test(r6);
32017
+ var Jo = /^(([a-zA-Z0-9]|[a-zA-Z0-9][a-zA-Z0-9\-_]*[a-zA-Z0-9])\.)*([A-Za-z0-9]|[A-Za-z0-9][A-Za-z0-9\-_]*[A-Za-z0-9])$/;
32018
+ function El(r6) {
32019
+ return Jo.test(r6);
32020
32020
  }
32021
32021
  function He(r6, e) {
32022
32022
  if (!r6) return "";
@@ -32027,12 +32027,12 @@ function He(r6, e) {
32027
32027
  }
32028
32028
  return t.join(" ").trim();
32029
32029
  }
32030
- function $e(r6) {
32030
+ function Ge(r6) {
32031
32031
  if (!r6) return "";
32032
32032
  let e = ge(r6.text);
32033
- return e || (r6.coding ? r6.coding.map((t) => ai(t)).join(", ") : "");
32033
+ return e || (r6.coding ? r6.coding.map((t) => si(t)).join(", ") : "");
32034
32034
  }
32035
- function ai(r6, e) {
32035
+ function si(r6, e) {
32036
32036
  let t = ge(r6?.display);
32037
32037
  if (t) {
32038
32038
  let n = e ? ge(r6?.code) : void 0;
@@ -32046,30 +32046,30 @@ function ge(r6) {
32046
32046
  var l = { Address: "Address", Age: "Age", Annotation: "Annotation", Attachment: "Attachment", BackboneElement: "BackboneElement", CodeableConcept: "CodeableConcept", Coding: "Coding", ContactDetail: "ContactDetail", ContactPoint: "ContactPoint", Contributor: "Contributor", Count: "Count", DataRequirement: "DataRequirement", Distance: "Distance", Dosage: "Dosage", Duration: "Duration", Expression: "Expression", Extension: "Extension", HumanName: "HumanName", Identifier: "Identifier", MarketingStatus: "MarketingStatus", Meta: "Meta", Money: "Money", Narrative: "Narrative", ParameterDefinition: "ParameterDefinition", Period: "Period", Population: "Population", ProdCharacteristic: "ProdCharacteristic", ProductShelfLife: "ProductShelfLife", Quantity: "Quantity", Range: "Range", Ratio: "Ratio", Reference: "Reference", RelatedArtifact: "RelatedArtifact", SampledData: "SampledData", Signature: "Signature", SubstanceAmount: "SubstanceAmount", SystemString: "http://hl7.org/fhirpath/System.String", Timing: "Timing", TriggerDefinition: "TriggerDefinition", UsageContext: "UsageContext", base64Binary: "base64Binary", boolean: "boolean", canonical: "canonical", code: "code", date: "date", dateTime: "dateTime", decimal: "decimal", id: "id", instant: "instant", integer: "integer", markdown: "markdown", oid: "oid", positiveInt: "positiveInt", string: "string", time: "time", unsignedInt: "unsignedInt", uri: "uri", url: "url", uuid: "uuid" };
32047
32047
  function Ln(r6) {
32048
32048
  let e = Array.isArray(r6) ? r6 : r6.entry?.map((t) => t.resource) ?? [];
32049
- for (let t of e) t?.resourceType === "StructureDefinition" && t.kind === "resource" && li(t.type);
32049
+ for (let t of e) t?.resourceType === "StructureDefinition" && t.kind === "resource" && ui(t.type);
32050
32050
  }
32051
- function li(r6) {
32052
- let e = F.types[r6];
32053
- return e || (e = { searchParamsDetails: {} }, F.types[r6] = e), e.searchParams || (e.searchParams = { _id: { base: [r6], code: "_id", type: "token", expression: r6 + ".id" }, _lastUpdated: { base: [r6], code: "_lastUpdated", type: "date", expression: r6 + ".meta.lastUpdated" }, _compartment: { base: [r6], code: "_compartment", type: "reference", expression: r6 + ".meta.compartment" }, _profile: { base: [r6], code: "_profile", type: "uri", expression: r6 + ".meta.profile" }, _security: { base: [r6], code: "_security", type: "token", expression: r6 + ".meta.security" }, _source: { base: [r6], code: "_source", type: "uri", expression: r6 + ".meta.source" }, _tag: { base: [r6], code: "_tag", type: "token", expression: r6 + ".meta.tag" } }), e;
32051
+ function ui(r6) {
32052
+ let e = L.types[r6];
32053
+ return e || (e = { searchParamsDetails: {} }, L.types[r6] = e), !e.searchParams && r6 !== "Binary" && (e.searchParams = { _id: { base: [r6], code: "_id", type: "token", expression: r6 + ".id" }, _lastUpdated: { base: [r6], code: "_lastUpdated", type: "date", expression: r6 + ".meta.lastUpdated" }, _compartment: { base: [r6], code: "_compartment", type: "reference", expression: r6 + ".meta.compartment" }, _profile: { base: [r6], code: "_profile", type: "uri", expression: r6 + ".meta.profile" }, _security: { base: [r6], code: "_security", type: "token", expression: r6 + ".meta.security" }, _source: { base: [r6], code: "_source", type: "uri", expression: r6 + ".meta.source" }, _tag: { base: [r6], code: "_tag", type: "token", expression: r6 + ".meta.tag" } }), e;
32054
32054
  }
32055
- function Ur(r6) {
32055
+ function Br(r6) {
32056
32056
  for (let e of r6.base ?? []) {
32057
- let t = li(e);
32057
+ let t = ui(e);
32058
32058
  t.searchParams || (t.searchParams = {}), t.searchParams[r6.code] = r6;
32059
32059
  }
32060
32060
  }
32061
- function fr(r6) {
32061
+ function hr(r6) {
32062
32062
  let e = r6.type?.[0]?.code;
32063
- return e === "BackboneElement" || e === "Element" ? os((r6.base?.path ?? r6.path)?.split(".")) : e;
32063
+ return e === "BackboneElement" || e === "Element" ? ss((r6.base?.path ?? r6.path)?.split(".")) : e;
32064
32064
  }
32065
- function os(r6) {
32065
+ function ss(r6) {
32066
32066
  return r6.length === 1 ? r6[0] : r6.map(I).join("");
32067
32067
  }
32068
32068
  function ft(r6, e, t) {
32069
- let n = Be(r6, t);
32070
- if (n) return us(n.elements, e);
32069
+ let n = We(r6, t);
32070
+ if (n) return ls(n.elements, e);
32071
32071
  }
32072
- function us(r6, e) {
32072
+ function ls(r6, e) {
32073
32073
  let t = r6[e] ?? r6[e + "[x]"];
32074
32074
  if (t) return t;
32075
32075
  for (let n = 0; n < e.length; n++) {
@@ -32083,11 +32083,11 @@ function us(r6, e) {
32083
32083
  function A(r6, e) {
32084
32084
  return !(!r6 || typeof r6 != "object" || !("resourceType" in r6) || e && r6.resourceType !== e);
32085
32085
  }
32086
- function Y(r6) {
32086
+ function X(r6) {
32087
32087
  return !!(r6 && typeof r6 == "object" && "reference" in r6 && typeof r6.reference == "string");
32088
32088
  }
32089
- var F = { types: {} };
32090
- function Ve(r6) {
32089
+ var L = { types: {} };
32090
+ function Me(r6) {
32091
32091
  if (r6.startsWith("T")) return r6 + "T00:00:00.000Z".substring(r6.length);
32092
32092
  if (r6.length <= 10) return r6;
32093
32093
  try {
@@ -32171,11 +32171,11 @@ var O = { empty: (r6, e) => h(e.length === 0 || e.every((t) => S(t.value))), has
32171
32171
  }, convertsToInteger: (r6, e) => e.length === 0 ? [] : h(O.toInteger(r6, e).length === 1), toDate: (r6, e) => {
32172
32172
  if (e.length === 0) return [];
32173
32173
  let [{ value: t }] = z(e, 1);
32174
- return typeof t == "string" && /^\d{4}(-\d{2}(-\d{2})?)?/.exec(t) ? [{ type: l.date, value: Ve(t) }] : [];
32174
+ return typeof t == "string" && /^\d{4}(-\d{2}(-\d{2})?)?/.exec(t) ? [{ type: l.date, value: Me(t) }] : [];
32175
32175
  }, convertsToDate: (r6, e) => e.length === 0 ? [] : h(O.toDate(r6, e).length === 1), toDateTime: (r6, e) => {
32176
32176
  if (e.length === 0) return [];
32177
32177
  let [{ value: t }] = z(e, 1);
32178
- return typeof t == "string" && /^\d{4}(-\d{2}(-\d{2})?)?/.exec(t) ? [{ type: l.dateTime, value: Ve(t) }] : [];
32178
+ return typeof t == "string" && /^\d{4}(-\d{2}(-\d{2})?)?/.exec(t) ? [{ type: l.dateTime, value: Me(t) }] : [];
32179
32179
  }, convertsToDateTime: (r6, e) => e.length === 0 ? [] : h(O.toDateTime(r6, e).length === 1), toDecimal: (r6, e) => {
32180
32180
  if (e.length === 0) return [];
32181
32181
  let [{ value: t }] = z(e, 1);
@@ -32193,13 +32193,13 @@ var O = { empty: (r6, e) => h(e.length === 0 || e.every((t) => S(t.value))), has
32193
32193
  let [{ value: t }] = z(e, 1);
32194
32194
  if (typeof t == "string") {
32195
32195
  let n = /^T?(\d{2}(:\d{2}(:\d{2})?)?)/.exec(t);
32196
- if (n) return [{ type: l.time, value: Ve("T" + n[1]) }];
32196
+ if (n) return [{ type: l.time, value: Me("T" + n[1]) }];
32197
32197
  }
32198
32198
  return [];
32199
- }, convertsToTime: (r6, e) => e.length === 0 ? [] : h(O.toTime(r6, e).length === 1), indexOf: (r6, e, t) => L((n, i2) => n.indexOf(i2), r6, e, t), substring: (r6, e, t, n) => L((i2, o, s) => {
32199
+ }, convertsToTime: (r6, e) => e.length === 0 ? [] : h(O.toTime(r6, e).length === 1), indexOf: (r6, e, t) => F((n, i2) => n.indexOf(i2), r6, e, t), substring: (r6, e, t, n) => F((i2, o, s) => {
32200
32200
  let a2 = o, c = s ? a2 + s : i2.length;
32201
32201
  return a2 < 0 || a2 >= i2.length ? void 0 : i2.substring(a2, c);
32202
- }, r6, e, t, n), startsWith: (r6, e, t) => L((n, i2) => n.startsWith(i2), r6, e, t), endsWith: (r6, e, t) => L((n, i2) => n.endsWith(i2), r6, e, t), contains: (r6, e, t) => L((n, i2) => n.includes(i2), r6, e, t), upper: (r6, e) => L((t) => t.toUpperCase(), r6, e), lower: (r6, e) => L((t) => t.toLowerCase(), r6, e), replace: (r6, e, t, n) => L((i2, o, s) => i2.replaceAll(o, s), r6, e, t, n), matches: (r6, e, t) => L((n, i2) => !!new RegExp(i2).exec(n), r6, e, t), replaceMatches: (r6, e, t, n) => L((i2, o, s) => i2.replaceAll(new RegExp(o, "g"), s), r6, e, t, n), length: (r6, e) => L((t) => t.length, r6, e), toChars: (r6, e) => L((t) => t ? t.split("") : void 0, r6, e), encode: Z, decode: Z, escape: Z, unescape: Z, trim: Z, split: Z, join: (r6, e, t) => {
32202
+ }, r6, e, t, n), startsWith: (r6, e, t) => F((n, i2) => n.startsWith(i2), r6, e, t), endsWith: (r6, e, t) => F((n, i2) => n.endsWith(i2), r6, e, t), contains: (r6, e, t) => F((n, i2) => n.includes(i2), r6, e, t), upper: (r6, e) => F((t) => t.toUpperCase(), r6, e), lower: (r6, e) => F((t) => t.toLowerCase(), r6, e), replace: (r6, e, t, n) => F((i2, o, s) => i2.replaceAll(o, s), r6, e, t, n), matches: (r6, e, t) => F((n, i2) => !!new RegExp(i2).exec(n), r6, e, t), replaceMatches: (r6, e, t, n) => F((i2, o, s) => i2.replaceAll(new RegExp(o, "g"), s), r6, e, t, n), length: (r6, e) => F((t) => t.length, r6, e), toChars: (r6, e) => F((t) => t ? t.split("") : void 0, r6, e), encode: Z, decode: Z, escape: Z, unescape: Z, trim: Z, split: Z, join: (r6, e, t) => {
32203
32203
  let n = t?.eval(r6, xe(r6))[0]?.value ?? "";
32204
32204
  if (typeof n != "string") throw new Error("Separator must be a string.");
32205
32205
  return [{ type: l.string, value: e.map((i2) => i2.value?.toString() ?? "").join(n) }];
@@ -32253,7 +32253,7 @@ var O = { empty: (r6, e) => h(e.length === 0 || e.every((t) => S(t.value))), has
32253
32253
  }
32254
32254
  return [];
32255
32255
  } };
32256
- function L(r6, e, t, ...n) {
32256
+ function F(r6, e, t, ...n) {
32257
32257
  if (t.length === 0) return [];
32258
32258
  let [{ value: i2 }] = z(t, 1);
32259
32259
  if (typeof i2 != "string") throw new Error("String function cannot be called with non-string");
@@ -32378,8 +32378,8 @@ var St = class extends R {
32378
32378
  super("in", e, t);
32379
32379
  }
32380
32380
  eval(e, t) {
32381
- let n = H(this.left.eval(e, t)), i2 = this.right.eval(e, t);
32382
- return n ? h(i2.some((o) => je(n, o)[0].value)) : [];
32381
+ let n = G(this.left.eval(e, t)), i2 = this.right.eval(e, t);
32382
+ return n ? h(i2.some((o) => $e(n, o)[0].value)) : [];
32383
32383
  }
32384
32384
  };
32385
32385
  var ae = class extends te {
@@ -32408,7 +32408,7 @@ var bt = class extends R {
32408
32408
  }
32409
32409
  eval(e, t) {
32410
32410
  let n = this.left.eval(e, t), i2 = this.right.eval(e, t);
32411
- return $n(n, i2);
32411
+ return jn(n, i2);
32412
32412
  }
32413
32413
  };
32414
32414
  var Et = class extends R {
@@ -32417,7 +32417,7 @@ var Et = class extends R {
32417
32417
  }
32418
32418
  eval(e, t) {
32419
32419
  let n = this.left.eval(e, t), i2 = this.right.eval(e, t);
32420
- return Hn(n, i2);
32420
+ return $n(n, i2);
32421
32421
  }
32422
32422
  };
32423
32423
  var Rt = class extends R {
@@ -32426,7 +32426,7 @@ var Rt = class extends R {
32426
32426
  }
32427
32427
  eval(e, t) {
32428
32428
  let n = this.left.eval(e, t), i2 = this.right.eval(e, t);
32429
- return Cr(n, i2);
32429
+ return Pr(n, i2);
32430
32430
  }
32431
32431
  };
32432
32432
  var Ct = class extends R {
@@ -32435,7 +32435,7 @@ var Ct = class extends R {
32435
32435
  }
32436
32436
  eval(e, t) {
32437
32437
  let n = this.left.eval(e, t), i2 = this.right.eval(e, t);
32438
- return jn(Cr(n, i2));
32438
+ return qn(Pr(n, i2));
32439
32439
  }
32440
32440
  };
32441
32441
  var Te = class extends R {
@@ -32454,7 +32454,7 @@ var Pt = class extends R {
32454
32454
  super("and", e, t);
32455
32455
  }
32456
32456
  eval(e, t) {
32457
- let n = H(this.left.eval(e, t), "boolean"), i2 = H(this.right.eval(e, t), "boolean");
32457
+ let n = G(this.left.eval(e, t), "boolean"), i2 = G(this.right.eval(e, t), "boolean");
32458
32458
  return n?.value === true && i2?.value === true ? h(true) : n?.value === false || i2?.value === false ? h(false) : [];
32459
32459
  }
32460
32460
  };
@@ -32463,7 +32463,7 @@ var wt = class extends R {
32463
32463
  super("or", e, t);
32464
32464
  }
32465
32465
  eval(e, t) {
32466
- let n = H(this.left.eval(e, t), "boolean"), i2 = H(this.right.eval(e, t), "boolean");
32466
+ let n = G(this.left.eval(e, t), "boolean"), i2 = G(this.right.eval(e, t), "boolean");
32467
32467
  return n?.value === false && i2?.value === false ? h(false) : n?.value || i2?.value ? h(true) : [];
32468
32468
  }
32469
32469
  };
@@ -32472,7 +32472,7 @@ var At = class extends R {
32472
32472
  super("xor", e, t);
32473
32473
  }
32474
32474
  eval(e, t) {
32475
- let n = H(this.left.eval(e, t), "boolean"), i2 = H(this.right.eval(e, t), "boolean");
32475
+ let n = G(this.left.eval(e, t), "boolean"), i2 = G(this.right.eval(e, t), "boolean");
32476
32476
  return !n || !i2 ? [] : h(n.value !== i2.value);
32477
32477
  }
32478
32478
  };
@@ -32481,7 +32481,7 @@ var Ot = class extends R {
32481
32481
  super("implies", e, t);
32482
32482
  }
32483
32483
  eval(e, t) {
32484
- let n = H(this.left.eval(e, t), "boolean"), i2 = H(this.right.eval(e, t), "boolean");
32484
+ let n = G(this.left.eval(e, t), "boolean"), i2 = G(this.right.eval(e, t), "boolean");
32485
32485
  return i2?.value === true || n?.value === false ? h(true) : !n || !i2 ? [] : h(false);
32486
32486
  }
32487
32487
  };
@@ -32514,39 +32514,39 @@ var Se = class {
32514
32514
  return `${this.left.toString()}[${this.expr.toString()}]`;
32515
32515
  }
32516
32516
  };
32517
- var Qe = ["!=", "!~", "<=", ">=", "{}", "->"];
32517
+ var ze = ["!=", "!~", "<=", ">=", "{}", "->"];
32518
32518
  var g = { FunctionCall: 0, Dot: 1, Indexer: 2, UnaryAdd: 3, UnarySubtract: 3, Multiply: 4, Divide: 4, IntegerDivide: 4, Modulo: 4, Add: 5, Subtract: 5, Ampersand: 5, Is: 6, As: 6, Union: 7, GreaterThan: 8, GreaterThanOrEquals: 8, LessThan: 8, LessThanOrEquals: 8, Equals: 9, Equivalent: 9, NotEquals: 9, NotEquivalent: 9, In: 10, Contains: 10, And: 11, Xor: 12, Or: 12, Implies: 13, Arrow: 100, Semicolon: 200 };
32519
- var ps = { parse(r6) {
32519
+ var fs2 = { parse(r6) {
32520
32520
  let e = r6.consumeAndParse();
32521
32521
  if (!r6.match(")")) throw new Error("Parse error: expected `)` got `" + r6.peek()?.value + "`");
32522
32522
  return e;
32523
32523
  } };
32524
- var fs2 = { parse(r6, e) {
32524
+ var hs = { parse(r6, e) {
32525
32525
  let t = r6.consumeAndParse();
32526
32526
  if (!r6.match("]")) throw new Error("Parse error: expected `]`");
32527
32527
  return new Se(e, t);
32528
32528
  }, precedence: g.Indexer };
32529
- var hs = { parse(r6, e) {
32529
+ var ms = { parse(r6, e) {
32530
32530
  if (!(e instanceof q)) throw new Error("Unexpected parentheses");
32531
32531
  let t = [];
32532
32532
  for (; !r6.match(")"); ) t.push(r6.consumeAndParse()), r6.match(",");
32533
32533
  return new ee(e.name, t);
32534
32534
  }, precedence: g.FunctionCall };
32535
- function ms(r6) {
32535
+ function ys(r6) {
32536
32536
  let e = r6.split(" "), t = parseFloat(e[0]), n = e[1];
32537
32537
  return n?.startsWith("'") && n.endsWith("'") ? n = n.substring(1, n.length - 1) : n = "{" + n + "}", { value: t, unit: n };
32538
32538
  }
32539
- function ze() {
32540
- return new nt().registerPrefix("String", { parse: (r6, e) => new N({ type: l.string, value: e.value }) }).registerPrefix("DateTime", { parse: (r6, e) => new N({ type: l.dateTime, value: Ve(e.value) }) }).registerPrefix("Quantity", { parse: (r6, e) => new N({ type: l.Quantity, value: ms(e.value) }) }).registerPrefix("Number", { parse: (r6, e) => new N({ type: e.value.includes(".") ? l.decimal : l.integer, value: parseFloat(e.value) }) }).registerPrefix("true", { parse: () => new N({ type: l.boolean, value: true }) }).registerPrefix("false", { parse: () => new N({ type: l.boolean, value: false }) }).registerPrefix("Symbol", { parse: (r6, e) => new q(e.value) }).registerPrefix("{}", { parse: () => new gt() }).registerPrefix("(", ps).registerInfix("[", fs2).registerInfix("(", hs).prefix("+", g.UnaryAdd, (r6, e) => new xt("+", e, (t) => t)).prefix("-", g.UnarySubtract, (r6, e) => new D("-", e, e, (t, n) => -n)).infixLeft(".", g.Dot, (r6, e, t) => new ae(r6, t)).infixLeft("/", g.Divide, (r6, e, t) => new D("/", r6, t, (n, i2) => n / i2)).infixLeft("*", g.Multiply, (r6, e, t) => new D("*", r6, t, (n, i2) => n * i2)).infixLeft("+", g.Add, (r6, e, t) => new D("+", r6, t, (n, i2) => n + i2)).infixLeft("-", g.Subtract, (r6, e, t) => new D("-", r6, t, (n, i2) => n - i2)).infixLeft("|", g.Union, (r6, e, t) => new ve(r6, t)).infixLeft("=", g.Equals, (r6, e, t) => new bt(r6, t)).infixLeft("!=", g.NotEquals, (r6, e, t) => new Et(r6, t)).infixLeft("~", g.Equivalent, (r6, e, t) => new Rt(r6, t)).infixLeft("!~", g.NotEquivalent, (r6, e, t) => new Ct(r6, t)).infixLeft("<", g.LessThan, (r6, e, t) => new D("<", r6, t, (n, i2) => n < i2)).infixLeft("<=", g.LessThanOrEquals, (r6, e, t) => new D("<=", r6, t, (n, i2) => n <= i2)).infixLeft(">", g.GreaterThan, (r6, e, t) => new D(">", r6, t, (n, i2) => n > i2)).infixLeft(">=", g.GreaterThanOrEquals, (r6, e, t) => new D(">=", r6, t, (n, i2) => n >= i2)).infixLeft("&", g.Ampersand, (r6, e, t) => new vt(r6, t)).infixLeft("and", g.And, (r6, e, t) => new Pt(r6, t)).infixLeft("as", g.As, (r6, e, t) => new ce(r6, t)).infixLeft("contains", g.Contains, (r6, e, t) => new Tt(r6, t)).infixLeft("div", g.Divide, (r6, e, t) => new D("div", r6, t, (n, i2) => n / i2 | 0)).infixLeft("in", g.In, (r6, e, t) => new St(r6, t)).infixLeft("is", g.Is, (r6, e, t) => new Te(r6, t)).infixLeft("mod", g.Modulo, (r6, e, t) => new D("mod", r6, t, (n, i2) => n % i2)).infixLeft("or", g.Or, (r6, e, t) => new wt(r6, t)).infixLeft("xor", g.Xor, (r6, e, t) => new At(r6, t)).infixLeft("implies", g.Implies, (r6, e, t) => new Ot(r6, t));
32539
+ function Je() {
32540
+ return new nt().registerPrefix("String", { parse: (r6, e) => new N({ type: l.string, value: e.value }) }).registerPrefix("DateTime", { parse: (r6, e) => new N({ type: l.dateTime, value: Me(e.value) }) }).registerPrefix("Quantity", { parse: (r6, e) => new N({ type: l.Quantity, value: ys(e.value) }) }).registerPrefix("Number", { parse: (r6, e) => new N({ type: e.value.includes(".") ? l.decimal : l.integer, value: parseFloat(e.value) }) }).registerPrefix("true", { parse: () => new N({ type: l.boolean, value: true }) }).registerPrefix("false", { parse: () => new N({ type: l.boolean, value: false }) }).registerPrefix("Symbol", { parse: (r6, e) => new q(e.value) }).registerPrefix("{}", { parse: () => new gt() }).registerPrefix("(", fs2).registerInfix("[", hs).registerInfix("(", ms).prefix("+", g.UnaryAdd, (r6, e) => new xt("+", e, (t) => t)).prefix("-", g.UnarySubtract, (r6, e) => new D("-", e, e, (t, n) => -n)).infixLeft(".", g.Dot, (r6, e, t) => new ae(r6, t)).infixLeft("/", g.Divide, (r6, e, t) => new D("/", r6, t, (n, i2) => n / i2)).infixLeft("*", g.Multiply, (r6, e, t) => new D("*", r6, t, (n, i2) => n * i2)).infixLeft("+", g.Add, (r6, e, t) => new D("+", r6, t, (n, i2) => n + i2)).infixLeft("-", g.Subtract, (r6, e, t) => new D("-", r6, t, (n, i2) => n - i2)).infixLeft("|", g.Union, (r6, e, t) => new ve(r6, t)).infixLeft("=", g.Equals, (r6, e, t) => new bt(r6, t)).infixLeft("!=", g.NotEquals, (r6, e, t) => new Et(r6, t)).infixLeft("~", g.Equivalent, (r6, e, t) => new Rt(r6, t)).infixLeft("!~", g.NotEquivalent, (r6, e, t) => new Ct(r6, t)).infixLeft("<", g.LessThan, (r6, e, t) => new D("<", r6, t, (n, i2) => n < i2)).infixLeft("<=", g.LessThanOrEquals, (r6, e, t) => new D("<=", r6, t, (n, i2) => n <= i2)).infixLeft(">", g.GreaterThan, (r6, e, t) => new D(">", r6, t, (n, i2) => n > i2)).infixLeft(">=", g.GreaterThanOrEquals, (r6, e, t) => new D(">=", r6, t, (n, i2) => n >= i2)).infixLeft("&", g.Ampersand, (r6, e, t) => new vt(r6, t)).infixLeft("and", g.And, (r6, e, t) => new Pt(r6, t)).infixLeft("as", g.As, (r6, e, t) => new ce(r6, t)).infixLeft("contains", g.Contains, (r6, e, t) => new Tt(r6, t)).infixLeft("div", g.Divide, (r6, e, t) => new D("div", r6, t, (n, i2) => n / i2 | 0)).infixLeft("in", g.In, (r6, e, t) => new St(r6, t)).infixLeft("is", g.Is, (r6, e, t) => new Te(r6, t)).infixLeft("mod", g.Modulo, (r6, e, t) => new D("mod", r6, t, (n, i2) => n % i2)).infixLeft("or", g.Or, (r6, e, t) => new wt(r6, t)).infixLeft("xor", g.Xor, (r6, e, t) => new At(r6, t)).infixLeft("implies", g.Implies, (r6, e, t) => new Ot(r6, t));
32541
32541
  }
32542
- var ys = ze();
32542
+ var gs = Je();
32543
32543
  var f = { EQUALS: "eq", NOT_EQUALS: "ne", GREATER_THAN: "gt", LESS_THAN: "lt", GREATER_THAN_OR_EQUALS: "ge", LESS_THAN_OR_EQUALS: "le", STARTS_AFTER: "sa", ENDS_BEFORE: "eb", APPROXIMATELY: "ap", CONTAINS: "contains", STARTS_WITH: "sw", EXACT: "exact", TEXT: "text", NOT: "not", ABOVE: "above", BELOW: "below", IN: "in", NOT_IN: "not-in", OF_TYPE: "of-type", MISSING: "missing", PRESENT: "present", IDENTIFIER: "identifier", ITERATE: "iterate" };
32544
- var xi = { contains: f.CONTAINS, exact: f.EXACT, above: f.ABOVE, below: f.BELOW, text: f.TEXT, not: f.NOT, in: f.IN, "not-in": f.NOT_IN, "of-type": f.OF_TYPE, missing: f.MISSING, identifier: f.IDENTIFIER, iterate: f.ITERATE };
32545
- var Wr = { eq: f.EQUALS, ne: f.NOT_EQUALS, lt: f.LESS_THAN, le: f.LESS_THAN_OR_EQUALS, gt: f.GREATER_THAN, ge: f.GREATER_THAN_OR_EQUALS, sa: f.STARTS_AFTER, eb: f.ENDS_BEFORE, ap: f.APPROXIMATELY, sw: f.STARTS_WITH };
32546
- var Ps = [f.MISSING, f.PRESENT];
32547
- var Ke = { READ: "read", VREAD: "vread", UPDATE: "update", PATCH: "patch", DELETE: "delete", HISTORY: "history", HISTORY_INSTANCE: "history-instance", HISTORY_TYPE: "history-type", HISTORY_SYSTEM: "history-system", CREATE: "create", SEARCH: "search", SEARCH_TYPE: "search-type", SEARCH_SYSTEM: "search-system", SEARCH_COMPARTMENT: "search-compartment", CAPABILITIES: "capabilities", TRANSACTION: "transaction", BATCH: "batch", OPERATION: "operation" };
32548
- var Gs = [Ke.READ, Ke.VREAD, Ke.HISTORY, Ke.HISTORY_INSTANCE];
32549
- function Ti(r6) {
32544
+ var gi = { contains: f.CONTAINS, exact: f.EXACT, above: f.ABOVE, below: f.BELOW, text: f.TEXT, not: f.NOT, in: f.IN, "not-in": f.NOT_IN, "of-type": f.OF_TYPE, missing: f.MISSING, identifier: f.IDENTIFIER, iterate: f.ITERATE };
32545
+ var qr = { eq: f.EQUALS, ne: f.NOT_EQUALS, lt: f.LESS_THAN, le: f.LESS_THAN_OR_EQUALS, gt: f.GREATER_THAN, ge: f.GREATER_THAN_OR_EQUALS, sa: f.STARTS_AFTER, eb: f.ENDS_BEFORE, ap: f.APPROXIMATELY, sw: f.STARTS_WITH };
32546
+ var ws = [f.MISSING, f.PRESENT];
32547
+ var be = { READ: "read", VREAD: "vread", UPDATE: "update", DELETE: "delete", HISTORY: "history", CREATE: "create", SEARCH: "search" };
32548
+ var Qs = [be.READ, be.VREAD, be.HISTORY, be.SEARCH];
32549
+ function Ks(r6) {
32550
32550
  if (typeof window < "u") {
32551
32551
  let e = window.atob(r6), t = Uint8Array.from(e, (n) => n.charCodeAt(0));
32552
32552
  return new window.TextDecoder().decode(t);
@@ -32554,7 +32554,7 @@ function Ti(r6) {
32554
32554
  if (typeof Buffer < "u") return Buffer.from(r6, "base64").toString("utf-8");
32555
32555
  throw new Error("Unable to decode base64");
32556
32556
  }
32557
- function $r(r6) {
32557
+ function Ft(r6) {
32558
32558
  if (typeof window < "u") {
32559
32559
  let e = new window.TextEncoder().encode(r6), t = String.fromCharCode.apply(null, e);
32560
32560
  return window.btoa(t);
@@ -32562,14 +32562,19 @@ function $r(r6) {
32562
32562
  if (typeof Buffer < "u") return Buffer.from(r6, "utf8").toString("base64");
32563
32563
  throw new Error("Unable to encode base64");
32564
32564
  }
32565
- function Hr() {
32565
+ function Si(r6) {
32566
+ r6 = r6.padEnd(r6.length + (4 - r6.length % 4) % 4, "=");
32567
+ let e = r6.replace(/-/g, "+").replace(/_/g, "/");
32568
+ return Ks(e);
32569
+ }
32570
+ function $r() {
32566
32571
  let r6 = new Uint32Array(28);
32567
- return crypto.getRandomValues(r6), Zn(r6.buffer);
32572
+ return crypto.getRandomValues(r6), Yn(r6.buffer);
32568
32573
  }
32569
- async function Si(r6) {
32574
+ async function bi(r6) {
32570
32575
  return crypto.subtle.digest("SHA-256", new TextEncoder().encode(r6));
32571
32576
  }
32572
- function be() {
32577
+ function Ee() {
32573
32578
  return "xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g, (r6) => {
32574
32579
  let e = Math.random() * 16 | 0;
32575
32580
  return (r6 === "x" ? e : e & 3 | 8).toString(16);
@@ -32618,73 +32623,73 @@ var J = class {
32618
32623
  this.emitter.removeAllListeners();
32619
32624
  }
32620
32625
  };
32621
- var Qr = { "Patient-open": "Patient-open", "Patient-close": "Patient-close", "ImagingStudy-open": "ImagingStudy-open", "ImagingStudy-close": "ImagingStudy-close", "Encounter-open": "Encounter-open", "Encounter-close": "Encounter-close", "DiagnosticReport-open": "DiagnosticReport-open", "DiagnosticReport-close": "DiagnosticReport-close", "DiagnosticReport-select": "DiagnosticReport-select", "DiagnosticReport-update": "DiagnosticReport-update", syncerror: "syncerror" };
32622
- var ta = ["Patient", "Encounter", "ImagingStudy", "DiagnosticReport", "OperationOutcome", "Bundle"];
32623
- var zr = ["DiagnosticReport-update"];
32624
- function Ei(r6) {
32625
- return zr.includes(r6);
32626
- }
32626
+ var Hr = { "Patient-open": "Patient-open", "Patient-close": "Patient-close", "ImagingStudy-open": "ImagingStudy-open", "ImagingStudy-close": "ImagingStudy-close", "Encounter-open": "Encounter-open", "Encounter-close": "Encounter-close", "DiagnosticReport-open": "DiagnosticReport-open", "DiagnosticReport-close": "DiagnosticReport-close", "DiagnosticReport-select": "DiagnosticReport-select", "DiagnosticReport-update": "DiagnosticReport-update", syncerror: "syncerror" };
32627
+ var ra = ["Patient", "Encounter", "ImagingStudy", "DiagnosticReport", "OperationOutcome", "Bundle"];
32628
+ var Qr = ["DiagnosticReport-update"];
32627
32629
  function Ri(r6) {
32628
- if (zr.includes(r6)) throw new p(y(`'context.version' is required for '${r6}'.`));
32629
- }
32630
- var ra = { "Patient-open": { patient: { resourceType: "Patient" }, encounter: { resourceType: "Encounter", optional: true } }, "Patient-close": { patient: { resourceType: "Patient" }, encounter: { resourceType: "Encounter", optional: true } }, "ImagingStudy-open": { study: { resourceType: "ImagingStudy" }, encounter: { resourceType: "Encounter", optional: true }, patient: { resourceType: "Patient", optional: true } }, "ImagingStudy-close": { study: { resourceType: "ImagingStudy" }, encounter: { resourceType: "Encounter", optional: true }, patient: { resourceType: "Patient", optional: true } }, "Encounter-open": { encounter: { resourceType: "Encounter" }, patient: { resourceType: "Patient" } }, "Encounter-close": { encounter: { resourceType: "Encounter" }, patient: { resourceType: "Patient" } }, "DiagnosticReport-open": { report: { resourceType: "DiagnosticReport" }, encounter: { resourceType: "Encounter", optional: true }, study: { resourceType: "ImagingStudy", optional: true, manyAllowed: true }, patient: { resourceType: "Patient" } }, "DiagnosticReport-close": { report: { resourceType: "DiagnosticReport" }, encounter: { resourceType: "Encounter", optional: true }, study: { resourceType: "ImagingStudy", optional: true, manyAllowed: true }, patient: { resourceType: "Patient" } }, "DiagnosticReport-select": { report: { resourceType: "DiagnosticReport", reference: true }, patient: { resourceType: "Patient", optional: true, reference: true }, select: { resourceType: "*", reference: true, manyAllowed: true } }, "DiagnosticReport-update": { report: { resourceType: "DiagnosticReport", reference: true }, patient: { resourceType: "Patient", optional: true, reference: true }, updates: { resourceType: "Bundle" } }, syncerror: { operationoutcome: { resourceType: "OperationOutcome" } } };
32631
- function na(r6) {
32632
- return ta.includes(r6);
32630
+ return Qr.includes(r6);
32633
32631
  }
32634
32632
  function Ci(r6) {
32633
+ if (Qr.includes(r6)) throw new p(y(`'context.version' is required for '${r6}'.`));
32634
+ }
32635
+ var na = { "Patient-open": { patient: { resourceType: "Patient" }, encounter: { resourceType: "Encounter", optional: true } }, "Patient-close": { patient: { resourceType: "Patient" }, encounter: { resourceType: "Encounter", optional: true } }, "ImagingStudy-open": { study: { resourceType: "ImagingStudy" }, encounter: { resourceType: "Encounter", optional: true }, patient: { resourceType: "Patient", optional: true } }, "ImagingStudy-close": { study: { resourceType: "ImagingStudy" }, encounter: { resourceType: "Encounter", optional: true }, patient: { resourceType: "Patient", optional: true } }, "Encounter-open": { encounter: { resourceType: "Encounter" }, patient: { resourceType: "Patient" } }, "Encounter-close": { encounter: { resourceType: "Encounter" }, patient: { resourceType: "Patient" } }, "DiagnosticReport-open": { report: { resourceType: "DiagnosticReport" }, encounter: { resourceType: "Encounter", optional: true }, study: { resourceType: "ImagingStudy", optional: true, manyAllowed: true }, patient: { resourceType: "Patient" } }, "DiagnosticReport-close": { report: { resourceType: "DiagnosticReport" }, encounter: { resourceType: "Encounter", optional: true }, study: { resourceType: "ImagingStudy", optional: true, manyAllowed: true }, patient: { resourceType: "Patient" } }, "DiagnosticReport-select": { report: { resourceType: "DiagnosticReport", reference: true }, patient: { resourceType: "Patient", optional: true, reference: true }, select: { resourceType: "*", reference: true, manyAllowed: true } }, "DiagnosticReport-update": { report: { resourceType: "DiagnosticReport", reference: true }, patient: { resourceType: "Patient", optional: true, reference: true }, updates: { resourceType: "Bundle" } }, syncerror: { operationoutcome: { resourceType: "OperationOutcome" } } };
32636
+ function ia(r6) {
32637
+ return ra.includes(r6);
32638
+ }
32639
+ function Pi(r6) {
32635
32640
  return !!r6.endpoint;
32636
32641
  }
32637
- function Jr(r6) {
32638
- if (!Nt(r6)) throw new p(y("subscriptionRequest must be an object conforming to SubscriptionRequest type."));
32642
+ function zr(r6) {
32643
+ if (!Ut(r6)) throw new p(y("subscriptionRequest must be an object conforming to SubscriptionRequest type."));
32639
32644
  let { channelType: e, mode: t, topic: n, events: i2 } = r6, o = { "hub.channel.type": e, "hub.mode": t, "hub.topic": n, "hub.events": i2.join(",") };
32640
- return Ci(r6) && (o.endpoint = r6.endpoint), new URLSearchParams(o).toString();
32645
+ return Pi(r6) && (o.endpoint = r6.endpoint), new URLSearchParams(o).toString();
32641
32646
  }
32642
- function Nt(r6) {
32647
+ function Ut(r6) {
32643
32648
  if (typeof r6 != "object") return false;
32644
32649
  let { channelType: e, mode: t, topic: n, events: i2 } = r6;
32645
32650
  if (!(e && t && n && i2) || typeof n != "string" || typeof i2 != "object" || !Array.isArray(i2) || i2.length < 1 || e !== "websocket" || t !== "subscribe" && t !== "unsubscribe") return false;
32646
- for (let o of i2) if (!Qr[o]) return false;
32647
- return !(Ci(r6) && !(typeof r6.endpoint == "string" && r6.endpoint.startsWith("ws")));
32651
+ for (let o of i2) if (!Hr[o]) return false;
32652
+ return !(Pi(r6) && !(typeof r6.endpoint == "string" && r6.endpoint.startsWith("ws")));
32648
32653
  }
32649
- function ia(r6, e, t, n) {
32654
+ function oa(r6, e, t, n) {
32650
32655
  if (typeof e != "object") throw new p(y(`context[${t}] is invalid. Context must contain a single valid FHIR resource! Resource is not an object.`));
32651
32656
  if (!(e.id && typeof e.id == "string")) throw new p(y(`context[${t}] is invalid. Resource must contain a valid string ID.`));
32652
32657
  if (!e.resourceType) throw new p(y(`context[${t}] is invalid. Resource must contain a resource type. No resource type found.`));
32653
32658
  let i2 = n.resourceType;
32654
32659
  if (i2 !== "*") {
32655
- if (!na(e.resourceType)) throw new p(y(`context[${t}] is invalid. Resource must contain a valid FHIRcast resource type. Resource type is not a known resource type.`));
32660
+ if (!ia(e.resourceType)) throw new p(y(`context[${t}] is invalid. Resource must contain a valid FHIRcast resource type. Resource type is not a known resource type.`));
32656
32661
  if (i2 && e.resourceType !== i2) throw new p(y(`context[${t}] is invalid. context[${t}] for the '${r6}' event should contain resource of type ${i2}.`));
32657
32662
  }
32658
32663
  }
32659
- function oa(r6, e, t, n, i2) {
32664
+ function sa(r6, e, t, n, i2) {
32660
32665
  if (i2.set(e.key, (i2.get(e.key) ?? 0) + 1), n.reference) {
32661
- if (!Y(e.reference)) throw new p(y(`context[${t}] is invalid. Expected key '${e.key}' to be a reference.`));
32662
- } else ia(r6, e.resource, t, n);
32666
+ if (!X(e.reference)) throw new p(y(`context[${t}] is invalid. Expected key '${e.key}' to be a reference.`));
32667
+ } else oa(r6, e.resource, t, n);
32663
32668
  }
32664
- function sa(r6, e) {
32665
- let t = /* @__PURE__ */ new Map(), n = ra[r6];
32669
+ function aa(r6, e) {
32670
+ let t = /* @__PURE__ */ new Map(), n = na[r6];
32666
32671
  for (let i2 = 0; i2 < e.length; i2++) {
32667
32672
  let o = e[i2].key;
32668
32673
  if (!n[o]) throw new p(y(`Key '${o}' not found for event '${r6}'. Make sure to add only valid keys.`));
32669
- oa(r6, e[i2], i2, n[o], t);
32674
+ sa(r6, e[i2], i2, n[o], t);
32670
32675
  }
32671
32676
  for (let [i2, o] of Object.entries(n)) {
32672
32677
  if (!(o.optional || t.has(i2))) throw new p(y(`Missing required key '${i2}' on context for '${r6}' event.`));
32673
32678
  if (!o.manyAllowed && (t.get(i2) ?? 0) > 1) throw new p(y(`${t.get(i2)} context entries with key '${i2}' found for the '${r6}' event when schema only allows for 1.`));
32674
32679
  }
32675
32680
  }
32676
- function Kr(r6, e, t, n) {
32681
+ function Jr(r6, e, t, n) {
32677
32682
  if (!(r6 && typeof r6 == "string")) throw new p(y("Must provide a topic."));
32678
- if (!Qr[e]) throw new p(y(`Must provide a valid FHIRcast event name. Supported events: ${Object.keys(Qr).join(", ")}`));
32683
+ if (!Hr[e]) throw new p(y(`Must provide a valid FHIRcast event name. Supported events: ${Object.keys(Hr).join(", ")}`));
32679
32684
  if (typeof t != "object") throw new p(y("context must be a context object or array of context objects."));
32680
- if (zr.includes(e) && !n) throw new p(y(`The '${e}' event must contain a 'context.versionId'.`));
32685
+ if (Qr.includes(e) && !n) throw new p(y(`The '${e}' event must contain a 'context.versionId'.`));
32681
32686
  let i2 = Array.isArray(t) ? t : [t];
32682
- return sa(e, i2), { timestamp: (/* @__PURE__ */ new Date()).toISOString(), id: be(), event: { "hub.topic": r6, "hub.event": e, context: i2, ...n ? { "context.versionId": n } : {} } };
32687
+ return aa(e, i2), { timestamp: (/* @__PURE__ */ new Date()).toISOString(), id: Ee(), event: { "hub.topic": r6, "hub.event": e, context: i2, ...n ? { "context.versionId": n } : {} } };
32683
32688
  }
32684
- var Lt = class extends J {
32689
+ var Nt = class extends J {
32685
32690
  constructor(e) {
32686
32691
  if (super(), this.subRequest = e, !e.endpoint) throw new p(y("Subscription request should contain an endpoint."));
32687
- if (!Nt(e)) throw new p(y("Subscription request failed validation."));
32692
+ if (!Ut(e)) throw new p(y("Subscription request failed validation."));
32688
32693
  let t = new WebSocket(e.endpoint);
32689
32694
  t.addEventListener("open", () => {
32690
32695
  this.dispatchEvent({ type: "connect" }), t.addEventListener("message", (n) => {
@@ -32701,36 +32706,32 @@ var Lt = class extends J {
32701
32706
  this.websocket.close();
32702
32707
  }
32703
32708
  };
32704
- function aa(r6) {
32705
- let e = r6.replace(/-/g, "+").replace(/_/g, "/"), t = Ti(e), n = Array.from(t).reduce((o, s) => {
32706
- let a2 = ("00" + s.charCodeAt(0).toString(16)).slice(-2);
32707
- return `${o}%${a2}`;
32708
- }, ""), i2 = decodeURIComponent(n);
32709
- return JSON.parse(i2);
32709
+ function ca(r6) {
32710
+ return JSON.parse(Si(r6));
32710
32711
  }
32711
- function Pi(r6) {
32712
+ function wi(r6) {
32712
32713
  return r6.split(".").length === 3;
32713
32714
  }
32714
- function Ut(r6) {
32715
+ function Bt(r6) {
32715
32716
  let [e, t, n] = r6.split(".");
32716
- return aa(t);
32717
+ return ca(t);
32717
32718
  }
32718
- function wi(r6) {
32719
+ function Ai(r6) {
32719
32720
  try {
32720
- return typeof Ut(r6).login_id == "string";
32721
+ return typeof Bt(r6).login_id == "string";
32721
32722
  } catch {
32722
32723
  return false;
32723
32724
  }
32724
32725
  }
32725
- function Ai(r6) {
32726
+ function Oi(r6) {
32726
32727
  try {
32727
- let t = Ut(r6).exp;
32728
+ let t = Bt(r6).exp;
32728
32729
  return typeof t == "number" ? t * 1e3 : void 0;
32729
32730
  } catch {
32730
32731
  return;
32731
32732
  }
32732
32733
  }
32733
- var Bt = class {
32734
+ var Wt = class {
32734
32735
  constructor(e) {
32735
32736
  this.medplum = e;
32736
32737
  }
@@ -32744,11 +32745,11 @@ var Bt = class {
32744
32745
  await this.medplum.delete(`keyvalue/v1/${e}`);
32745
32746
  }
32746
32747
  };
32747
- var Oi;
32748
- Oi = Symbol.toStringTag;
32748
+ var Ii;
32749
+ Ii = Symbol.toStringTag;
32749
32750
  var V = class {
32750
32751
  constructor(e) {
32751
- this[Oi] = "ReadablePromise";
32752
+ this[Ii] = "ReadablePromise";
32752
32753
  this.status = "pending";
32753
32754
  this.suspender = e.then((t) => (this.status = "success", this.response = t, t), (t) => {
32754
32755
  throw this.status = "error", this.error = t, t;
@@ -32780,9 +32781,9 @@ var V = class {
32780
32781
  return this.suspender.finally(e);
32781
32782
  }
32782
32783
  };
32783
- var Ye = class {
32784
+ var Xe = class {
32784
32785
  constructor(e) {
32785
- this.storage = e ?? (typeof localStorage < "u" ? localStorage : new Yr());
32786
+ this.storage = e ?? (typeof localStorage < "u" ? localStorage : new Kr());
32786
32787
  }
32787
32788
  clear() {
32788
32789
  this.storage.clear();
@@ -32801,7 +32802,7 @@ var Ye = class {
32801
32802
  this.setString(e, t ? mt(t) : void 0);
32802
32803
  }
32803
32804
  };
32804
- var Yr = class {
32805
+ var Kr = class {
32805
32806
  constructor() {
32806
32807
  this.data = /* @__PURE__ */ new Map();
32807
32808
  }
@@ -32824,15 +32825,15 @@ var Yr = class {
32824
32825
  return Array.from(this.data.keys())[e];
32825
32826
  }
32826
32827
  };
32827
- var Le = { Event: typeof globalThis.Event < "u" ? globalThis.Event : void 0, ErrorEvent: void 0, CloseEvent: void 0 };
32828
- var ki = false;
32829
- function ca() {
32828
+ var Ne = { Event: typeof globalThis.Event < "u" ? globalThis.Event : void 0, ErrorEvent: void 0, CloseEvent: void 0 };
32829
+ var Di = false;
32830
+ function ua() {
32830
32831
  if (typeof globalThis.Event > "u") throw new Error("Unable to lazy init events for ReconnectingWebSocket. globalThis.Event is not defined yet");
32831
- Le.Event = globalThis.Event, Le.ErrorEvent = class extends Event {
32832
+ Ne.Event = globalThis.Event, Ne.ErrorEvent = class extends Event {
32832
32833
  constructor(e, t) {
32833
32834
  super("error", t), this.message = e.message, this.error = e;
32834
32835
  }
32835
- }, Le.CloseEvent = class extends Event {
32836
+ }, Ne.CloseEvent = class extends Event {
32836
32837
  constructor(t = 1e3, n = "", i2) {
32837
32838
  super("close", i2);
32838
32839
  this.wasClean = true;
@@ -32840,17 +32841,17 @@ function ca() {
32840
32841
  }
32841
32842
  };
32842
32843
  }
32843
- function ua(r6, e) {
32844
+ function la(r6, e) {
32844
32845
  if (!r6) throw new Error(e);
32845
32846
  }
32846
- function Wt(r6) {
32847
+ function qt(r6) {
32847
32848
  return new r6.constructor(r6.type, r6);
32848
32849
  }
32849
- var Ee = { maxReconnectionDelay: 1e4, minReconnectionDelay: 1e3 + Math.random() * 4e3, minUptime: 5e3, reconnectionDelayGrowFactor: 1.3, connectionTimeout: 4e3, maxRetries: 1 / 0, maxEnqueuedMessages: 1 / 0, startClosed: false, debug: false };
32850
- var Di = false;
32851
- var qt = class r extends J {
32850
+ var Re = { maxReconnectionDelay: 1e4, minReconnectionDelay: 1e3 + Math.random() * 4e3, minUptime: 5e3, reconnectionDelayGrowFactor: 1.3, connectionTimeout: 4e3, maxRetries: 1 / 0, maxEnqueuedMessages: 1 / 0, startClosed: false, debug: false };
32851
+ var Vi = false;
32852
+ var jt = class r extends J {
32852
32853
  constructor(t, n, i2 = {}) {
32853
- ki || (ca(), ki = true);
32854
+ Di || (ua(), Di = true);
32854
32855
  super();
32855
32856
  this._retryCount = -1;
32856
32857
  this._shouldReconnect = true;
@@ -32864,17 +32865,17 @@ var qt = class r extends J {
32864
32865
  this.onopen = null;
32865
32866
  this._handleOpen = (t2) => {
32866
32867
  this._debug("open event");
32867
- let { minUptime: n2 = Ee.minUptime } = this._options;
32868
- clearTimeout(this._connectTimeout), this._uptimeTimeout = setTimeout(() => this._acceptOpen(), n2), ua(this._ws, "WebSocket is not defined"), this._ws.binaryType = this._binaryType, this._messageQueue.forEach((i3) => this._ws?.send(i3)), this._messageQueue = [], this.onopen && this.onopen(t2), this.dispatchEvent(Wt(t2));
32868
+ let { minUptime: n2 = Re.minUptime } = this._options;
32869
+ clearTimeout(this._connectTimeout), this._uptimeTimeout = setTimeout(() => this._acceptOpen(), n2), la(this._ws, "WebSocket is not defined"), this._ws.binaryType = this._binaryType, this._messageQueue.forEach((i3) => this._ws?.send(i3)), this._messageQueue = [], this.onopen && this.onopen(t2), this.dispatchEvent(qt(t2));
32869
32870
  };
32870
32871
  this._handleMessage = (t2) => {
32871
- this._debug("message event"), this.onmessage && this.onmessage(t2), this.dispatchEvent(Wt(t2));
32872
+ this._debug("message event"), this.onmessage && this.onmessage(t2), this.dispatchEvent(qt(t2));
32872
32873
  };
32873
32874
  this._handleError = (t2) => {
32874
- this._debug("error event", t2.message), this._disconnect(void 0, t2.message === "TIMEOUT" ? "timeout" : void 0), this.onerror && this.onerror(t2), this._debug("exec error listeners"), this.dispatchEvent(Wt(t2)), this._connect();
32875
+ this._debug("error event", t2.message), this._disconnect(void 0, t2.message === "TIMEOUT" ? "timeout" : void 0), this.onerror && this.onerror(t2), this._debug("exec error listeners"), this.dispatchEvent(qt(t2)), this._connect();
32875
32876
  };
32876
32877
  this._handleClose = (t2) => {
32877
- this._debug("close event"), this._clearTimeouts(), this._shouldReconnect && this._connect(), this.onclose && this.onclose(t2), this.dispatchEvent(Wt(t2));
32878
+ this._debug("close event"), this._clearTimeouts(), this._shouldReconnect && this._connect(), this.onclose && this.onclose(t2), this.dispatchEvent(qt(t2));
32878
32879
  };
32879
32880
  this._url = t, this._protocols = n, this._options = i2, this._options.startClosed && (this._shouldReconnect = false), this._options.binaryType ? this._binaryType = this._options.binaryType : this._binaryType = "blob", this._options.debugLogger && (this._debugLogger = this._options.debugLogger), this._connect();
32880
32881
  }
@@ -32946,7 +32947,7 @@ var qt = class r extends J {
32946
32947
  send(t) {
32947
32948
  if (this._ws && this._ws.readyState === this.OPEN) this._debug("send", t), this._ws.send(t);
32948
32949
  else {
32949
- let { maxEnqueuedMessages: n = Ee.maxEnqueuedMessages } = this._options;
32950
+ let { maxEnqueuedMessages: n = Re.maxEnqueuedMessages } = this._options;
32950
32951
  this._messageQueue.length < n && (this._debug("enqueue", t), this._messageQueue.push(t));
32951
32952
  }
32952
32953
  }
@@ -32954,7 +32955,7 @@ var qt = class r extends J {
32954
32955
  this._options.debug && this._debugLogger("RWS>", ...t);
32955
32956
  }
32956
32957
  _getNextDelay() {
32957
- let { reconnectionDelayGrowFactor: t = Ee.reconnectionDelayGrowFactor, minReconnectionDelay: n = Ee.minReconnectionDelay, maxReconnectionDelay: i2 = Ee.maxReconnectionDelay } = this._options, o = 0;
32958
+ let { reconnectionDelayGrowFactor: t = Re.reconnectionDelayGrowFactor, minReconnectionDelay: n = Re.minReconnectionDelay, maxReconnectionDelay: i2 = Re.maxReconnectionDelay } = this._options, o = 0;
32958
32959
  return this._retryCount > 0 && (o = n * Math.pow(t, this._retryCount - 1), o > i2 && (o = i2)), this._debug("next delay", o), o;
32959
32960
  }
32960
32961
  _wait() {
@@ -32965,7 +32966,7 @@ var qt = class r extends J {
32965
32966
  _connect() {
32966
32967
  if (this._connectLock || !this._shouldReconnect) return;
32967
32968
  this._connectLock = true;
32968
- let { maxRetries: t = Ee.maxRetries, connectionTimeout: n = Ee.connectionTimeout } = this._options;
32969
+ let { maxRetries: t = Re.maxRetries, connectionTimeout: n = Re.connectionTimeout } = this._options;
32969
32970
  if (this._retryCount >= t) {
32970
32971
  this._debug("max retries reached", this._retryCount, ">=", t);
32971
32972
  return;
@@ -32975,21 +32976,21 @@ var qt = class r extends J {
32975
32976
  this._connectLock = false;
32976
32977
  return;
32977
32978
  }
32978
- !this._options.WebSocket && typeof WebSocket > "u" && !Di && (console.error("\u203C\uFE0F No WebSocket implementation available. You should define options.WebSocket."), Di = true);
32979
+ !this._options.WebSocket && typeof WebSocket > "u" && !Vi && (console.error("\u203C\uFE0F No WebSocket implementation available. You should define options.WebSocket."), Vi = true);
32979
32980
  let i2 = this._options.WebSocket || WebSocket;
32980
32981
  this._debug("connect", { url: this._url, protocols: this._protocols }), this._ws = this._protocols ? new i2(this._url, this._protocols) : new i2(this._url), this._ws.binaryType = this._binaryType, this._connectLock = false, this._addListeners(), this._connectTimeout = setTimeout(() => this._handleTimeout(), n);
32981
32982
  }).catch((i2) => {
32982
- this._connectLock = false, this._handleError(new Le.ErrorEvent(Error(i2.message), this));
32983
+ this._connectLock = false, this._handleError(new Ne.ErrorEvent(Error(i2.message), this));
32983
32984
  });
32984
32985
  }
32985
32986
  _handleTimeout() {
32986
- this._debug("timeout event"), this._handleError(new Le.ErrorEvent(Error("TIMEOUT"), this));
32987
+ this._debug("timeout event"), this._handleError(new Ne.ErrorEvent(Error("TIMEOUT"), this));
32987
32988
  }
32988
32989
  _disconnect(t = 1e3, n) {
32989
32990
  if (this._clearTimeouts(), !!this._ws) {
32990
32991
  this._removeListeners();
32991
32992
  try {
32992
- this._ws.close(t, n), this._handleClose(new Le.CloseEvent(t, n, this));
32993
+ this._ws.close(t, n), this._handleClose(new Ne.CloseEvent(t, n, this));
32993
32994
  } catch {
32994
32995
  }
32995
32996
  }
@@ -33007,8 +33008,8 @@ var qt = class r extends J {
33007
33008
  clearTimeout(this._connectTimeout), clearTimeout(this._uptimeTimeout);
33008
33009
  }
33009
33010
  };
33010
- var la = 5e3;
33011
- var Xe = class extends J {
33011
+ var da = 5e3;
33012
+ var Ye = class extends J {
33012
33013
  constructor(...e) {
33013
33014
  super(), this.criteria = new Set(e);
33014
33015
  }
@@ -33025,25 +33026,25 @@ var Xe = class extends J {
33025
33026
  var Xr = class {
33026
33027
  constructor(e, t) {
33027
33028
  this.connecting = false;
33028
- this.criteria = e, this.emitter = new Xe(e), this.refCount = 1, this.subscriptionProps = t ? { ...t } : void 0;
33029
+ this.criteria = e, this.emitter = new Ye(e), this.refCount = 1, this.subscriptionProps = t ? { ...t } : void 0;
33029
33030
  }
33030
33031
  clearAttachedSubscription() {
33031
33032
  this.subscriptionId = void 0, this.token = void 0;
33032
33033
  }
33033
33034
  };
33034
- var jt = class {
33035
+ var $t = class {
33035
33036
  constructor(e, t, n) {
33036
33037
  this.pingTimer = void 0;
33037
33038
  this.waitingForPong = false;
33038
- if (!(e instanceof $t)) throw new p(y("First arg of constructor should be a `MedplumClient`"));
33039
+ if (!(e instanceof Gt)) throw new p(y("First arg of constructor should be a `MedplumClient`"));
33039
33040
  let i2;
33040
33041
  try {
33041
33042
  i2 = new URL(t).toString();
33042
33043
  } catch {
33043
33044
  throw new p(y("Not a valid URL"));
33044
33045
  }
33045
- let o = n?.ReconnectingWebSocket ? new n.ReconnectingWebSocket(i2, void 0, { debug: n?.debug, debugLogger: n?.debugLogger }) : new qt(i2, void 0, { debug: n?.debug, debugLogger: n?.debugLogger });
33046
- this.medplum = e, this.ws = o, this.masterSubEmitter = new Xe(), this.criteriaEntries = /* @__PURE__ */ new Map(), this.criteriaEntriesBySubscriptionId = /* @__PURE__ */ new Map(), this.wsClosed = false, this.pingIntervalMs = n?.pingIntervalMs ?? la, this.currentProfile = e.getProfile(), this.setupListeners();
33046
+ let o = n?.ReconnectingWebSocket ? new n.ReconnectingWebSocket(i2, void 0, { debug: n?.debug, debugLogger: n?.debugLogger }) : new jt(i2, void 0, { debug: n?.debug, debugLogger: n?.debugLogger });
33047
+ this.medplum = e, this.ws = o, this.masterSubEmitter = new Ye(), this.criteriaEntries = /* @__PURE__ */ new Map(), this.criteriaEntriesBySubscriptionId = /* @__PURE__ */ new Map(), this.wsClosed = false, this.pingIntervalMs = n?.pingIntervalMs ?? da, this.currentProfile = e.getProfile(), this.setupListeners();
33047
33048
  }
33048
33049
  setupListeners() {
33049
33050
  let e = this.ws;
@@ -33084,7 +33085,7 @@ var jt = class {
33084
33085
  for (let o of this.getAllCriteriaEmitters()) o.dispatchEvent({ ...i2 });
33085
33086
  }
33086
33087
  }), e.addEventListener("error", () => {
33087
- let t = { type: "error", payload: new p(Sn(new Error("WebSocket error"))) };
33088
+ let t = { type: "error", payload: new p(Tn(new Error("WebSocket error"))) };
33088
33089
  this.masterSubEmitter?.dispatchEvent(t);
33089
33090
  for (let n of this.getAllCriteriaEmitters()) n.dispatchEvent({ ...t });
33090
33091
  }), e.addEventListener("close", () => {
@@ -33162,7 +33163,7 @@ var jt = class {
33162
33163
  let [t, n] = await this.getTokenForCriteria(e);
33163
33164
  e.subscriptionId = t, e.token = n, this.criteriaEntriesBySubscriptionId.set(t, e), this.ws.send(JSON.stringify({ type: "bind-with-token", payload: { token: n } }));
33164
33165
  } catch (t) {
33165
- console.error(Ae(t)), this.emitError(e, t), this.removeCriteriaEntry(e);
33166
+ console.error(Oe(t)), this.emitError(e, t), this.removeCriteriaEntry(e);
33166
33167
  }
33167
33168
  }
33168
33169
  }
@@ -33198,27 +33199,27 @@ var jt = class {
33198
33199
  return this.getAllCriteriaEmitters().length;
33199
33200
  }
33200
33201
  getMasterEmitter() {
33201
- return this.masterSubEmitter || (this.masterSubEmitter = new Xe(...Array.from(this.criteriaEntries.keys()))), this.masterSubEmitter;
33202
+ return this.masterSubEmitter || (this.masterSubEmitter = new Ye(...Array.from(this.criteriaEntries.keys()))), this.masterSubEmitter;
33202
33203
  }
33203
33204
  };
33204
- var Zr = "4.1.8-da4c6bf86";
33205
- var fa = w.FHIR_JSON + ", */*; q=0.1";
33206
- var ha = "https://api.medplum.com/";
33207
- var ma = 1e3;
33208
- var ya = 6e4;
33209
- var ga = 0;
33210
- var xa = 3e5;
33211
- var va = "Binary/";
33212
- var Vi = { resourceType: "Device", id: "system", deviceName: [{ type: "model-name", name: "System" }] };
33213
- var Ne = { ClientCredentials: "client_credentials", AuthorizationCode: "authorization_code", RefreshToken: "refresh_token", JwtBearer: "urn:ietf:params:oauth:grant-type:jwt-bearer", TokenExchange: "urn:ietf:params:oauth:grant-type:token-exchange" };
33214
- var Ta = { AccessToken: "urn:ietf:params:oauth:token-type:access_token", RefreshToken: "urn:ietf:params:oauth:token-type:refresh_token", IdToken: "urn:ietf:params:oauth:token-type:id_token", Saml1Token: "urn:ietf:params:oauth:token-type:saml1", Saml2Token: "urn:ietf:params:oauth:token-type:saml2" };
33215
- var Sa = { JwtBearer: "urn:ietf:params:oauth:client-assertion-type:jwt-bearer" };
33216
- var $t = class extends J {
33205
+ var Yr = "4.1.10-b8a9c246d";
33206
+ var ha = w.FHIR_JSON + ", */*; q=0.1";
33207
+ var ma = "https://api.medplum.com/";
33208
+ var ya = 1e3;
33209
+ var ga = 6e4;
33210
+ var xa = 0;
33211
+ var va = 3e5;
33212
+ var Ta = "Binary/";
33213
+ var Mi = { resourceType: "Device", id: "system", deviceName: [{ type: "model-name", name: "System" }] };
33214
+ var Ue = { ClientCredentials: "client_credentials", AuthorizationCode: "authorization_code", RefreshToken: "refresh_token", JwtBearer: "urn:ietf:params:oauth:grant-type:jwt-bearer", TokenExchange: "urn:ietf:params:oauth:grant-type:token-exchange" };
33215
+ var Sa = { AccessToken: "urn:ietf:params:oauth:token-type:access_token", RefreshToken: "urn:ietf:params:oauth:token-type:refresh_token", IdToken: "urn:ietf:params:oauth:token-type:id_token", Saml1Token: "urn:ietf:params:oauth:token-type:saml1", Saml2Token: "urn:ietf:params:oauth:token-type:saml2" };
33216
+ var ba = { JwtBearer: "urn:ietf:params:oauth:client-assertion-type:jwt-bearer" };
33217
+ var Gt = class extends J {
33217
33218
  constructor(t) {
33218
33219
  super();
33219
33220
  this.initComplete = true;
33220
33221
  if (t?.baseUrl && !t.baseUrl.startsWith("http")) throw new Error("Base URL must start with http or https");
33221
- this.options = t ?? {}, this.fetch = t?.fetch ?? ba(), this.storage = t?.storage ?? new Ye(), this.createPdfImpl = t?.createPdf, this.baseUrl = Fr(t?.baseUrl ?? ha), this.fhirBaseUrl = W(this.baseUrl, t?.fhirUrlPath ?? "fhir/R4"), this.authorizeUrl = W(this.baseUrl, t?.authorizeUrl ?? "oauth2/authorize"), this.tokenUrl = W(this.baseUrl, t?.tokenUrl ?? "oauth2/token"), this.logoutUrl = W(this.baseUrl, t?.logoutUrl ?? "oauth2/logout"), this.fhircastHubUrl = W(this.baseUrl, t?.fhircastHubUrl ?? "fhircast/STU3"), this.clientId = t?.clientId ?? "", this.clientSecret = t?.clientSecret ?? "", this.credentialsInHeader = t?.authCredentialsMethod === "header", this.defaultHeaders = t?.defaultHeaders ?? {}, this.onUnauthenticated = t?.onUnauthenticated, this.refreshGracePeriod = t?.refreshGracePeriod ?? xa, this.cacheTime = t?.cacheTime ?? (typeof window > "u" ? ga : ya), this.cacheTime > 0 ? this.requestCache = new Ce(t?.resourceCacheSize ?? ma) : this.requestCache = void 0, t?.autoBatchTime ? (this.autoBatchTime = t.autoBatchTime, this.autoBatchQueue = []) : (this.autoBatchTime = 0, this.autoBatchQueue = void 0), t?.accessToken && this.setAccessToken(t.accessToken), this.storage.getInitPromise === void 0 ? (t?.accessToken || this.attemptResumeActiveLogin().catch(console.error), this.initPromise = Promise.resolve(), this.dispatchEvent({ type: "storageInitialized" })) : (this.initComplete = false, this.initPromise = this.storage.getInitPromise(), this.initPromise.then(() => {
33222
+ this.options = t ?? {}, this.fetch = t?.fetch ?? Ea(), this.storage = t?.storage ?? new Xe(), this.createPdfImpl = t?.createPdf, this.baseUrl = Fr(t?.baseUrl ?? ma), this.fhirBaseUrl = W(this.baseUrl, t?.fhirUrlPath ?? "fhir/R4"), this.authorizeUrl = W(this.baseUrl, t?.authorizeUrl ?? "oauth2/authorize"), this.tokenUrl = W(this.baseUrl, t?.tokenUrl ?? "oauth2/token"), this.logoutUrl = W(this.baseUrl, t?.logoutUrl ?? "oauth2/logout"), this.fhircastHubUrl = W(this.baseUrl, t?.fhircastHubUrl ?? "fhircast/STU3"), this.clientId = t?.clientId ?? "", this.clientSecret = t?.clientSecret ?? "", this.credentialsInHeader = t?.authCredentialsMethod === "header", this.defaultHeaders = t?.defaultHeaders ?? {}, this.onUnauthenticated = t?.onUnauthenticated, this.refreshGracePeriod = t?.refreshGracePeriod ?? va, this.cacheTime = t?.cacheTime ?? (typeof window > "u" ? xa : ga), this.cacheTime > 0 ? this.requestCache = new Pe(t?.resourceCacheSize ?? ya) : this.requestCache = void 0, t?.autoBatchTime ? (this.autoBatchTime = t.autoBatchTime, this.autoBatchQueue = []) : (this.autoBatchTime = 0, this.autoBatchQueue = void 0), t?.accessToken && this.setAccessToken(t.accessToken), this.storage.getInitPromise === void 0 ? (t?.accessToken || this.attemptResumeActiveLogin().catch(console.error), this.initPromise = Promise.resolve(), this.dispatchEvent({ type: "storageInitialized" })) : (this.initComplete = false, this.initPromise = this.storage.getInitPromise(), this.initPromise.then(() => {
33222
33223
  t?.accessToken || this.attemptResumeActiveLogin().catch(console.error), this.initComplete = true, this.dispatchEvent({ type: "storageInitialized" });
33223
33224
  }).catch((n) => {
33224
33225
  console.error(n), this.initComplete = true, this.dispatchEvent({ type: "storageInitFailed", payload: { error: n } });
@@ -33330,7 +33331,7 @@ var $t = class extends J {
33330
33331
  }
33331
33332
  async exchangeExternalAccessToken(t, n) {
33332
33333
  if (n = n ?? this.clientId, !n) throw new Error("MedplumClient is missing clientId");
33333
- return this.fetchTokens({ grant_type: Ne.TokenExchange, subject_token_type: Ta.AccessToken, client_id: n, subject_token: t });
33334
+ return this.fetchTokens({ grant_type: Ue.TokenExchange, subject_token_type: Sa.AccessToken, client_id: n, subject_token: t });
33334
33335
  }
33335
33336
  getExternalAuthRedirectUri(t, n, i2, o, s = true) {
33336
33337
  let a2 = new URL(t);
@@ -33347,7 +33348,7 @@ var $t = class extends J {
33347
33348
  }
33348
33349
  fhirSearchUrl(t, n) {
33349
33350
  let i2 = this.fhirUrl(t);
33350
- return n && (i2.search = si(n)), i2;
33351
+ return n && (i2.search = oi(n)), i2;
33351
33352
  }
33352
33353
  search(t, n, i2) {
33353
33354
  let o = this.fhirSearchUrl(t, n), s = "search-" + o.toString(), a2 = this.getCacheEntry(s, i2);
@@ -33372,7 +33373,9 @@ var $t = class extends J {
33372
33373
  async *searchResourcePages(t, n, i2) {
33373
33374
  let o = this.fhirSearchUrl(t, n);
33374
33375
  for (; o; ) {
33375
- let s = new URL(o).searchParams, a2 = await this.search(t, s, i2), c = a2.link?.find((u2) => u2.relation === "next");
33376
+ let s = new URL(o).searchParams;
33377
+ s.has("_count") || s.set("_count", "1000");
33378
+ let a2 = await this.search(t, s, i2), c = a2.link?.find((u2) => u2.relation === "next");
33376
33379
  if (!a2.entry?.length && !c) break;
33377
33380
  yield Fi(a2), o = c?.url ? new URL(c.url) : void 0;
33378
33381
  }
@@ -33388,7 +33391,7 @@ var $t = class extends J {
33388
33391
  getCachedReference(t) {
33389
33392
  let n = t.reference;
33390
33393
  if (!n) return;
33391
- if (n === "system") return Vi;
33394
+ if (n === "system") return Mi;
33392
33395
  let [i2, o] = n.split("/");
33393
33396
  if (!(!i2 || !o)) return this.getCached(i2, o);
33394
33397
  }
@@ -33399,12 +33402,12 @@ var $t = class extends J {
33399
33402
  readReference(t, n) {
33400
33403
  let i2 = t.reference;
33401
33404
  if (!i2) return new V(Promise.reject(new Error("Missing reference")));
33402
- if (i2 === "system") return new V(Promise.resolve(Vi));
33405
+ if (i2 === "system") return new V(Promise.resolve(Mi));
33403
33406
  let [o, s] = i2.split("/");
33404
33407
  return !o || !s ? new V(Promise.reject(new Error("Invalid reference"))) : this.readResource(o, s, n);
33405
33408
  }
33406
33409
  requestSchema(t) {
33407
- if (Vn(t)) return Promise.resolve();
33410
+ if (Dn(t)) return Promise.resolve();
33408
33411
  let n = t + "-requestSchema", i2 = this.getCacheEntry(n, void 0);
33409
33412
  if (i2) return i2.value;
33410
33413
  let o = new V((async () => {
@@ -33449,13 +33452,13 @@ var $t = class extends J {
33449
33452
  target
33450
33453
  }
33451
33454
  }`.replace(/\s+/g, " "), a2 = await this.graphql(s);
33452
- yr(a2.data.StructureDefinitionList);
33453
- for (let c of a2.data.SearchParameterList) Ur(c);
33455
+ gr(a2.data.StructureDefinitionList);
33456
+ for (let c of a2.data.SearchParameterList) Br(c);
33454
33457
  })());
33455
33458
  return this.setCacheEntry(n, o), o;
33456
33459
  }
33457
33460
  requestProfileSchema(t, n) {
33458
- if (!n?.expandProfile && _n(t)) return Promise.resolve();
33461
+ if (!n?.expandProfile && Mn(t)) return Promise.resolve();
33459
33462
  let i2 = t + "-requestSchema" + (n?.expandProfile ? "-nested" : ""), o = this.getCacheEntry(i2, void 0);
33460
33463
  if (o) return o.value;
33461
33464
  let s = new V((async () => {
@@ -33463,14 +33466,14 @@ var $t = class extends J {
33463
33466
  let a2 = this.fhirUrl("StructureDefinition", "$expand-profile");
33464
33467
  a2.search = new URLSearchParams({ url: t }).toString();
33465
33468
  let c = await this.post(a2.toString(), {});
33466
- yr(c);
33469
+ gr(c);
33467
33470
  } else {
33468
33471
  let a2 = await this.searchOne("StructureDefinition", { url: t, _sort: "-_lastUpdated" });
33469
33472
  if (!a2) {
33470
33473
  console.warn(`No StructureDefinition found for ${t}!`);
33471
33474
  return;
33472
33475
  }
33473
- gr(a2);
33476
+ xr(a2);
33474
33477
  }
33475
33478
  })());
33476
33479
  return this.setCacheEntry(i2, s), s;
@@ -33502,7 +33505,7 @@ var $t = class extends J {
33502
33505
  return s || (s = t), this.cacheResource(s), this.invalidateUrl(this.fhirUrl(t.resourceType, t.id, "_history")), this.invalidateSearches(t.resourceType), s;
33503
33506
  }
33504
33507
  async createAttachment(t, n, i2, o, s) {
33505
- let a2 = Li(t, n, i2, o);
33508
+ let a2 = Ni(t, n, i2, o);
33506
33509
  if (a2.contentType === w.XML) {
33507
33510
  let d2 = a2.data, m2;
33508
33511
  d2 instanceof Blob ? m2 = await new Promise((x, U) => {
@@ -33520,7 +33523,7 @@ var $t = class extends J {
33520
33523
  return { contentType: a2.contentType, url: u2.url, title: a2.filename };
33521
33524
  }
33522
33525
  createBinary(t, n, i2, o, s) {
33523
- let a2 = Li(t, n, i2, o), c = s ?? (typeof n == "object" ? n : {}), { data: u2, contentType: d2, filename: m2, securityContext: x, onProgress: U } = a2, $ = this.fhirUrl("Binary");
33526
+ let a2 = Ni(t, n, i2, o), c = s ?? (typeof n == "object" ? n : {}), { data: u2, contentType: d2, filename: m2, securityContext: x, onProgress: U } = a2, $ = this.fhirUrl("Binary");
33524
33527
  return m2 && $.searchParams.set("_filename", m2), x?.reference && this.setRequestHeader(c, "X-Security-Context", x.reference), U ? this.uploadwithProgress($, u2, d2, U, c) : this.post($, u2, d2, c);
33525
33528
  }
33526
33529
  uploadwithProgress(t, n, i2, o, s) {
@@ -33541,7 +33544,7 @@ var $t = class extends J {
33541
33544
  }
33542
33545
  async createPdf(t, n, i2, o) {
33543
33546
  if (!this.createPdfImpl) throw new Error("PDF creation not enabled");
33544
- let s = Ca(t, n, i2, o), a2 = typeof n == "object" ? n : {}, { docDefinition: c, tableLayouts: u2, fonts: d2, ...m2 } = s, x = await this.createPdfImpl(c, u2, d2), U = { ...m2, data: x, contentType: "application/pdf" };
33547
+ let s = Pa(t, n, i2, o), a2 = typeof n == "object" ? n : {}, { docDefinition: c, tableLayouts: u2, fonts: d2, ...m2 } = s, x = await this.createPdfImpl(c, u2, d2), U = { ...m2, data: x, contentType: "application/pdf" };
33545
33548
  return this.createBinary(U, a2);
33546
33549
  }
33547
33550
  createComment(t, n, i2) {
@@ -33603,7 +33606,7 @@ var $t = class extends J {
33603
33606
  return this.accessTokenExpires !== void 0 && Date.now() < this.accessTokenExpires - (t ?? this.refreshGracePeriod);
33604
33607
  }
33605
33608
  setAccessToken(t, n) {
33606
- this.accessToken = t, this.refreshToken = n, this.accessTokenExpires = Ai(t), this.medplumServer = wi(t);
33609
+ this.accessToken = t, this.refreshToken = n, this.accessTokenExpires = Oi(t), this.medplumServer = Ai(t);
33607
33610
  }
33608
33611
  getLogins() {
33609
33612
  return this.storage.getObject("logins") ?? [];
@@ -33651,7 +33654,7 @@ var $t = class extends J {
33651
33654
  async download(t, n = {}) {
33652
33655
  this.refreshPromise && await this.refreshPromise;
33653
33656
  let i2 = t.toString();
33654
- i2.startsWith(va) && (t = this.fhirUrl(i2));
33657
+ i2.startsWith(Ta) && (t = this.fhirUrl(i2));
33655
33658
  let o = n.headers;
33656
33659
  return o || (o = {}, n.headers = o), o.Accept || (o.Accept = "*/*"), this.addFetchOptionsDefaults(n), (await this.fetchWithRetry(t.toString(), n)).blob();
33657
33660
  }
@@ -33680,7 +33683,7 @@ var $t = class extends J {
33680
33683
  return i2.Prefer = "respond-async", this.request("POST", t, n);
33681
33684
  }
33682
33685
  get keyValue() {
33683
- return this.keyValueClient || (this.keyValueClient = new Bt(this)), this.keyValueClient;
33686
+ return this.keyValueClient || (this.keyValueClient = new Wt(this)), this.keyValueClient;
33684
33687
  }
33685
33688
  getBundle(t, n) {
33686
33689
  return new V((async () => {
@@ -33709,14 +33712,14 @@ var $t = class extends J {
33709
33712
  if (s.status === 401) return this.handleUnauthenticated(t, n, i2);
33710
33713
  if (s.status === 204 || s.status === 304) return;
33711
33714
  let c = s.headers.get("content-type")?.includes("json");
33712
- if (s.status === 404 && !c) throw new p(vn);
33715
+ if (s.status === 404 && !c) throw new p(xn);
33713
33716
  let u2 = await this.parseBody(s, c);
33714
33717
  if (s.status === 200 && i2.followRedirectOnOk || s.status === 201 && i2.followRedirectOnCreated) {
33715
- let d2 = await _i(s, u2);
33718
+ let d2 = await Li(s, u2);
33716
33719
  if (d2) return this.request("GET", d2, { ...i2, body: void 0 });
33717
33720
  }
33718
33721
  if (s.status === 202 && i2.pollStatusOnAccepted) {
33719
- let m2 = await _i(s, u2) ?? o.statusUrl;
33722
+ let m2 = await Li(s, u2) ?? o.statusUrl;
33720
33723
  if (m2) return this.pollStatus(m2, i2, o);
33721
33724
  }
33722
33725
  if (s.status >= 400) throw new p(st(u2));
@@ -33740,10 +33743,10 @@ var $t = class extends J {
33740
33743
  for (let o = 0; o <= i2; o++) try {
33741
33744
  this.options.verbose && this.logRequest(t, n);
33742
33745
  let s = await this.fetch(t, n);
33743
- if (this.options.verbose && this.logResponse(s), this.setCurrentRateLimit(s), o >= i2 || !Pa(s)) return s;
33746
+ if (this.options.verbose && this.logResponse(s), this.setCurrentRateLimit(s), o >= i2 || !wa(s)) return s;
33744
33747
  let a2 = this.getRetryDelay(o), c = n.maxRetryTime ?? 2e3;
33745
33748
  if (a2 > c) return s;
33746
- await Mr(a2);
33749
+ await _r(a2);
33747
33750
  } catch (s) {
33748
33751
  if (s.message === "Failed to fetch" && o === 0 && this.dispatchEvent({ type: "offline" }), s.name === "AbortError" || o === i2) throw s;
33749
33752
  }
@@ -33783,7 +33786,7 @@ var $t = class extends J {
33783
33786
  if (i2.pollCount === void 0) n.headers && typeof n.headers == "object" && "Prefer" in n.headers && (o.headers = { ...n.headers }, delete o.headers.Prefer), i2.statusUrl = t, i2.pollCount = 1;
33784
33787
  else {
33785
33788
  let s = n.pollStatusPeriod ?? 1e3;
33786
- await Mr(s), i2.pollCount++;
33789
+ await _r(s), i2.pollCount++;
33787
33790
  }
33788
33791
  return this.request("GET", t, o, i2);
33789
33792
  }
@@ -33802,13 +33805,13 @@ var $t = class extends J {
33802
33805
  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, n);
33803
33806
  for (let o = 0; o < t.length; o++) {
33804
33807
  let s = t[o], a2 = i2.entry?.[o];
33805
- a2?.response?.outcome && !lr(a2.response.outcome) ? s.reject(new p(a2.response.outcome)) : s.resolve(a2?.resource);
33808
+ a2?.response?.outcome && !dr(a2.response.outcome) ? s.reject(new p(a2.response.outcome)) : s.resolve(a2?.resource);
33806
33809
  }
33807
33810
  }
33808
33811
  addFetchOptionsDefaults(t) {
33809
33812
  Object.entries(this.defaultHeaders).forEach(([n, i2]) => {
33810
33813
  this.setRequestHeader(t, n, i2);
33811
- }), this.setRequestHeader(t, "Accept", fa, true), this.options.extendedMode !== false && this.setRequestHeader(t, "X-Medplum", "extended"), t.body && this.setRequestHeader(t, "Content-Type", w.FHIR_JSON, true), this.accessToken ? this.setRequestHeader(t, "Authorization", "Bearer " + this.accessToken) : this.basicAuth && this.setRequestHeader(t, "Authorization", "Basic " + this.basicAuth), t.cache || (t.cache = "no-cache"), t.credentials || (t.credentials = "include");
33814
+ }), this.setRequestHeader(t, "Accept", ha, true), this.options.extendedMode !== false && this.setRequestHeader(t, "X-Medplum", "extended"), t.body && this.setRequestHeader(t, "Content-Type", w.FHIR_JSON, true), this.accessToken ? this.setRequestHeader(t, "Authorization", "Bearer " + this.accessToken) : this.basicAuth && this.setRequestHeader(t, "Authorization", "Basic " + this.basicAuth), t.cache || (t.cache = "no-cache"), t.credentials || (t.credentials = "include");
33812
33815
  }
33813
33816
  setRequestContentType(t, n) {
33814
33817
  this.setRequestHeader(t, "Content-Type", n);
@@ -33822,22 +33825,22 @@ var $t = class extends J {
33822
33825
  typeof n == "string" || typeof Blob < "u" && (n instanceof Blob || n?.constructor.name === "Blob") || typeof File < "u" && (n instanceof File || n?.constructor.name === "File") || typeof Uint8Array < "u" && (n instanceof Uint8Array || n?.constructor.name === "Uint8Array") ? t.body = n : n && (t.body = JSON.stringify(n));
33823
33826
  }
33824
33827
  handleUnauthenticated(t, n, i2) {
33825
- return this.refresh() ? this.request(t, n, i2) : (this.clear(), this.onUnauthenticated && this.onUnauthenticated(), Promise.reject(new p(Pe)));
33828
+ return this.refresh() ? this.request(t, n, i2) : (this.clear(), this.onUnauthenticated && this.onUnauthenticated(), Promise.reject(new p(we)));
33826
33829
  }
33827
33830
  async startPkce() {
33828
- let t = Hr();
33831
+ let t = $r();
33829
33832
  sessionStorage.setItem("pkceState", t);
33830
- let n = Hr().slice(0, 128);
33833
+ let n = $r().slice(0, 128);
33831
33834
  sessionStorage.setItem("codeVerifier", n);
33832
- let i2 = await Si(n), o = ei(i2).replaceAll("+", "-").replaceAll("/", "_").replaceAll("=", "");
33835
+ let i2 = await bi(n), o = Zn(i2).replaceAll("+", "-").replaceAll("/", "_").replaceAll("=", "");
33833
33836
  return sessionStorage.setItem("codeChallenge", o), { codeChallengeMethod: "S256", codeChallenge: o };
33834
33837
  }
33835
33838
  async requestAuthorization(t) {
33836
33839
  let n = await this.ensureCodeChallenge(t ?? {}), i2 = new URL(this.authorizeUrl);
33837
- 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 ?? Mi()), 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());
33840
+ 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 ?? _i()), 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());
33838
33841
  }
33839
33842
  processCode(t, n) {
33840
- let i2 = { grant_type: Ne.AuthorizationCode, code: t, client_id: n?.clientId ?? this.clientId ?? "", redirect_uri: n?.redirectUri ?? Mi() };
33843
+ let i2 = { grant_type: Ue.AuthorizationCode, code: t, client_id: n?.clientId ?? this.clientId ?? "", redirect_uri: n?.redirectUri ?? _i() };
33841
33844
  if (typeof sessionStorage < "u") {
33842
33845
  let o = sessionStorage.getItem("codeVerifier");
33843
33846
  o && (i2.code_verifier = o);
@@ -33849,38 +33852,38 @@ var $t = class extends J {
33849
33852
  }
33850
33853
  refresh() {
33851
33854
  if (this.refreshPromise) return this.refreshPromise;
33852
- if (this.refreshToken) return this.refreshPromise = this.fetchTokens({ grant_type: Ne.RefreshToken, client_id: this.clientId ?? "", refresh_token: this.refreshToken }), this.refreshPromise;
33855
+ if (this.refreshToken) return this.refreshPromise = this.fetchTokens({ grant_type: Ue.RefreshToken, client_id: this.clientId ?? "", refresh_token: this.refreshToken }), this.refreshPromise;
33853
33856
  if (this.clientId && this.clientSecret) return this.refreshPromise = this.startClientLogin(this.clientId, this.clientSecret), this.refreshPromise;
33854
33857
  }
33855
33858
  async startClientLogin(t, n) {
33856
- return this.clientId = t, this.clientSecret = n, this.fetchTokens({ grant_type: Ne.ClientCredentials, client_id: t, client_secret: n });
33859
+ return this.clientId = t, this.clientSecret = n, this.fetchTokens({ grant_type: Ue.ClientCredentials, client_id: t, client_secret: n });
33857
33860
  }
33858
33861
  async startJwtBearerLogin(t, n, i2) {
33859
- return this.clientId = t, this.fetchTokens({ grant_type: Ne.JwtBearer, client_id: t, assertion: n, scope: i2 });
33862
+ return this.clientId = t, this.fetchTokens({ grant_type: Ue.JwtBearer, client_id: t, assertion: n, scope: i2 });
33860
33863
  }
33861
33864
  async startJwtAssertionLogin(t) {
33862
- return this.fetchTokens({ grant_type: Ne.ClientCredentials, client_assertion_type: Sa.JwtBearer, client_assertion: t });
33865
+ return this.fetchTokens({ grant_type: Ue.ClientCredentials, client_assertion_type: ba.JwtBearer, client_assertion: t });
33863
33866
  }
33864
33867
  setBasicAuth(t, n) {
33865
- this.clientId = t, this.clientSecret = n, this.basicAuth = $r(t + ":" + n);
33868
+ this.clientId = t, this.clientSecret = n, this.basicAuth = Ft(t + ":" + n);
33866
33869
  }
33867
33870
  async fhircastSubscribe(t, n) {
33868
33871
  if (!(typeof t == "string" && t !== "")) throw new p(y("Invalid topic provided. Topic must be a valid string."));
33869
33872
  if (!(typeof n == "object" && Array.isArray(n) && n.length > 0)) throw new p(y("Invalid events provided. Events must be an array of event names containing at least one event."));
33870
- let i2 = { channelType: "websocket", mode: "subscribe", topic: t, events: n }, s = (await this.post(this.fhircastHubUrl, Jr(i2), w.FORM_URL_ENCODED))["hub.channel.endpoint"];
33873
+ let i2 = { channelType: "websocket", mode: "subscribe", topic: t, events: n }, s = (await this.post(this.fhircastHubUrl, zr(i2), w.FORM_URL_ENCODED))["hub.channel.endpoint"];
33871
33874
  if (!s) throw new Error("Invalid response!");
33872
33875
  return i2.endpoint = s, i2;
33873
33876
  }
33874
33877
  async fhircastUnsubscribe(t) {
33875
- if (!Nt(t)) throw new p(y("Invalid topic or subscriptionRequest. SubscriptionRequest must be an object."));
33878
+ if (!Ut(t)) throw new p(y("Invalid topic or subscriptionRequest. SubscriptionRequest must be an object."));
33876
33879
  if (!(t.endpoint && typeof t.endpoint == "string" && t.endpoint.startsWith("ws"))) throw new p(y("Provided subscription request must have an endpoint in order to unsubscribe."));
33877
- t.mode = "unsubscribe", await this.post(this.fhircastHubUrl, Jr(t), w.FORM_URL_ENCODED);
33880
+ t.mode = "unsubscribe", await this.post(this.fhircastHubUrl, zr(t), w.FORM_URL_ENCODED);
33878
33881
  }
33879
33882
  fhircastConnect(t) {
33880
- return new Lt(t);
33883
+ return new Nt(t);
33881
33884
  }
33882
33885
  async fhircastPublish(t, n, i2, o) {
33883
- return Ei(n) ? this.post(this.fhircastHubUrl, Kr(t, n, i2, o), w.JSON) : (Ri(n), this.post(this.fhircastHubUrl, Kr(t, n, i2), w.JSON));
33886
+ return Ri(n) ? this.post(this.fhircastHubUrl, Jr(t, n, i2, o), w.JSON) : (Ci(n), this.post(this.fhircastHubUrl, Jr(t, n, i2), w.JSON));
33884
33887
  }
33885
33888
  async fhircastGetContext(t) {
33886
33889
  return this.get(`${this.fhircastHubUrl}/${t}`, { cache: "no-cache" });
@@ -33890,7 +33893,7 @@ var $t = class extends J {
33890
33893
  }
33891
33894
  async fetchTokens(t) {
33892
33895
  let n = new URLSearchParams(t), i2 = { ...this.defaultHeaders, "Content-Type": w.FORM_URL_ENCODED };
33893
- this.basicAuth && (i2.Authorization = `Basic ${this.basicAuth}`), this.credentialsInHeader && (n.delete("client_id"), n.delete("client_secret"), !this.basicAuth && t.client_id && t.client_secret && (i2.Authorization = `Basic ${$r(t.client_id + ":" + t.client_secret)}`));
33896
+ this.basicAuth && (i2.Authorization = `Basic ${this.basicAuth}`), this.credentialsInHeader && (n.delete("client_id"), n.delete("client_secret"), !this.basicAuth && t.client_id && t.client_secret && (i2.Authorization = `Basic ${Ft(t.client_id + ":" + t.client_secret)}`));
33894
33897
  let o = { method: "POST", headers: i2, body: n.toString(), credentials: "include" }, s;
33895
33898
  try {
33896
33899
  s = await this.fetchWithRetry(this.tokenUrl, o);
@@ -33911,12 +33914,12 @@ var $t = class extends J {
33911
33914
  }
33912
33915
  async verifyTokens(t) {
33913
33916
  let n = t.access_token;
33914
- if (Pi(n)) {
33915
- let i2 = Ut(n);
33916
- if (Date.now() >= i2.exp * 1e3) throw this.clearActiveLogin(), new p(Tn);
33917
+ if (wi(n)) {
33918
+ let i2 = Bt(n);
33919
+ if (Date.now() >= i2.exp * 1e3) throw this.clearActiveLogin(), new p(vn);
33917
33920
  if (i2.cid) {
33918
- if (i2.cid !== this.clientId) throw this.clearActiveLogin(), new p(ur);
33919
- } else if (this.clientId && i2.client_id !== this.clientId) throw this.clearActiveLogin(), new p(ur);
33921
+ if (i2.cid !== this.clientId) throw this.clearActiveLogin(), new p(lr);
33922
+ } else if (this.clientId && i2.client_id !== this.clientId) throw this.clearActiveLogin(), new p(lr);
33920
33923
  }
33921
33924
  return this.setActiveLogin({ accessToken: n, refreshToken: t.refresh_token, project: t.project, profile: t.profile });
33922
33925
  }
@@ -33936,7 +33939,7 @@ var $t = class extends J {
33936
33939
  }
33937
33940
  }
33938
33941
  getSubscriptionManager() {
33939
- return this.subscriptionManager || (this.subscriptionManager = new jt(this, oi(this.baseUrl, "/ws/subscriptions-r4"))), this.subscriptionManager;
33942
+ return this.subscriptionManager || (this.subscriptionManager = new $t(this, ii(this.baseUrl, "/ws/subscriptions-r4"))), this.subscriptionManager;
33940
33943
  }
33941
33944
  subscribeToCriteria(t, n) {
33942
33945
  return this.getSubscriptionManager().addCriteria(t, n);
@@ -33948,46 +33951,46 @@ var $t = class extends J {
33948
33951
  return this.getSubscriptionManager().getMasterEmitter();
33949
33952
  }
33950
33953
  };
33951
- function ba() {
33954
+ function Ea() {
33952
33955
  if (!globalThis.fetch) throw new Error("Fetch not available in this environment");
33953
33956
  return globalThis.fetch.bind(globalThis);
33954
33957
  }
33955
- function Mi() {
33958
+ function _i() {
33956
33959
  return typeof window > "u" ? "" : window.location.protocol + "//" + window.location.host + "/";
33957
33960
  }
33958
- async function _i(r6, e) {
33961
+ async function Li(r6, e) {
33959
33962
  let t = r6.headers.get("content-location");
33960
33963
  if (t) return t;
33961
33964
  let n = r6.headers.get("location");
33962
33965
  if (n) return n;
33963
- if (we(e) && e.issue?.[0]?.diagnostics) return e.issue[0].diagnostics;
33966
+ if (Ae(e) && e.issue?.[0]?.diagnostics) return e.issue[0].diagnostics;
33964
33967
  }
33965
33968
  function Fi(r6) {
33966
33969
  let e = r6.entry?.map((t) => t.resource) ?? [];
33967
33970
  return Object.assign(e, { bundle: r6 });
33968
33971
  }
33969
- function Ea(r6) {
33972
+ function Ra(r6) {
33970
33973
  return E(r6) && "data" in r6 && "contentType" in r6;
33971
33974
  }
33972
- function Li(r6, e, t, n) {
33973
- return Ea(r6) ? r6 : { data: r6, filename: e, contentType: t, onProgress: n };
33975
+ function Ni(r6, e, t, n) {
33976
+ return Ra(r6) ? r6 : { data: r6, filename: e, contentType: t, onProgress: n };
33974
33977
  }
33975
- function Ra(r6) {
33978
+ function Ca(r6) {
33976
33979
  return E(r6) && "docDefinition" in r6;
33977
33980
  }
33978
- function Ca(r6, e, t, n) {
33979
- return Ra(r6) ? r6 : { docDefinition: r6, filename: e, tableLayouts: t, fonts: n };
33981
+ function Pa(r6, e, t, n) {
33982
+ return Ca(r6) ? r6 : { docDefinition: r6, filename: e, tableLayouts: t, fonts: n };
33980
33983
  }
33981
- function Pa(r6) {
33984
+ function wa(r6) {
33982
33985
  return r6.status === 429 || r6.status >= 500;
33983
33986
  }
33984
- var Ua = [...Qe, "->", "<<", ">>", "=="];
33985
- var qa = ze().registerInfix("->", { precedence: g.Arrow }).registerInfix(";", { precedence: g.Semicolon });
33986
- var sc = " ".repeat(2);
33987
- var cc = [...Qe, "eq", "ne", "co"];
33988
- var uc = { eq: f.EXACT, ne: f.NOT_EQUALS, co: f.CONTAINS, sw: f.STARTS_WITH, ew: void 0, gt: f.GREATER_THAN, lt: f.LESS_THAN, ge: f.GREATER_THAN_OR_EQUALS, le: f.LESS_THAN_OR_EQUALS, ap: f.APPROXIMATELY, sa: f.STARTS_AFTER, eb: f.ENDS_BEFORE, pr: f.PRESENT, po: void 0, ss: void 0, sb: void 0, in: f.IN, ni: f.NOT_IN, re: f.EQUALS, identifier: f.IDENTIFIER };
33989
- var dc = ze();
33990
- var pc = { AA: "OK", AE: "Application Error", AR: "Application Reject", CA: "Commit Accept", CE: "Commit Error", CR: "Commit Reject" };
33987
+ var Ba = [...ze, "->", "<<", ">>", "=="];
33988
+ var ja = Je().registerInfix("->", { precedence: g.Arrow }).registerInfix(";", { precedence: g.Semicolon });
33989
+ var ac = " ".repeat(2);
33990
+ var uc = [...ze, "eq", "ne", "co"];
33991
+ var lc = { eq: f.EXACT, ne: f.NOT_EQUALS, co: f.CONTAINS, sw: f.STARTS_WITH, ew: void 0, gt: f.GREATER_THAN, lt: f.LESS_THAN, ge: f.GREATER_THAN_OR_EQUALS, le: f.LESS_THAN_OR_EQUALS, ap: f.APPROXIMATELY, sa: f.STARTS_AFTER, eb: f.ENDS_BEFORE, pr: f.PRESENT, po: void 0, ss: void 0, sb: void 0, in: f.IN, ni: f.NOT_IN, re: f.EQUALS, identifier: f.IDENTIFIER };
33992
+ var pc = Je();
33993
+ var fc = { AA: "OK", AE: "Application Error", AR: "Application Reject", CA: "Commit Accept", CE: "Commit Error", CR: "Commit Reject" };
33991
33994
  var de = class {
33992
33995
  constructor(e = "\r", t = "|", n = "^", i2 = "~", o = "\\", s = "&") {
33993
33996
  this.segmentSeparator = e, this.fieldSeparator = t, this.componentSeparator = n, this.repetitionSeparator = i2, this.escapeCharacter = o, this.subcomponentSeparator = s;
@@ -33999,7 +34002,7 @@ var de = class {
33999
34002
  return this.componentSeparator + this.repetitionSeparator + this.escapeCharacter + this.subcomponentSeparator;
34000
34003
  }
34001
34004
  };
34002
- var no = class r2 {
34005
+ var io = class r2 {
34003
34006
  constructor(e, t = new de()) {
34004
34007
  this.context = t, this.segments = e;
34005
34008
  }
@@ -34023,7 +34026,7 @@ var no = class r2 {
34023
34026
  }
34024
34027
  buildAck(e) {
34025
34028
  let t = /* @__PURE__ */ new Date(), n = this.getSegment("MSH"), i2 = n?.getField(3)?.toString() ?? "", o = n?.getField(4)?.toString() ?? "", s = n?.getField(5)?.toString() ?? "", a2 = n?.getField(6)?.toString() ?? "", c = n?.getField(10)?.toString() ?? "", u2 = n?.getField(12)?.toString() ?? "2.5.1", d2 = e?.ackCode ?? "AA";
34026
- return new r2([new tt(["MSH", this.context.getMsh2(), s, a2, i2, o, hc(t), "", this.buildAckMessageType(n), t.getTime().toString(), "P", u2], this.context), new tt(["MSA", d2, c, pc[d2]], this.context), ...e?.errSegment ? [e.errSegment] : []]);
34029
+ return new r2([new tt(["MSH", this.context.getMsh2(), s, a2, i2, o, mc(t), "", this.buildAckMessageType(n), t.getTime().toString(), "P", u2], this.context), new tt(["MSA", d2, c, fc[d2]], this.context), ...e?.errSegment ? [e.errSegment] : []]);
34027
34030
  }
34028
34031
  buildAckMessageType(e) {
34029
34032
  let t = e?.getField(9), n = t?.getComponent(2), i2 = t?.getComponent(3), o = "ACK";
@@ -34050,7 +34053,7 @@ var no = class r2 {
34050
34053
  };
34051
34054
  var tt = class r3 {
34052
34055
  constructor(e, t = new de()) {
34053
- this.context = t, Yn(e) ? this.fields = e.map((n) => K.parse(n, t)) : this.fields = e, this.name = this.fields[0].components[0][0];
34056
+ this.context = t, Kn(e) ? this.fields = e.map((n) => K.parse(n, t)) : this.fields = e, this.name = this.fields[0].components[0][0];
34054
34057
  }
34055
34058
  get(e) {
34056
34059
  return this.fields[e];
@@ -34118,14 +34121,14 @@ var K = class r4 {
34118
34121
  return true;
34119
34122
  }
34120
34123
  };
34121
- function hc(r6) {
34124
+ function mc(r6) {
34122
34125
  let e = r6 instanceof Date ? r6 : new Date(r6), n = e.toISOString().replace(/[-:T]/g, "").replace(/(\.\d+)?Z$/, ""), i2 = e.getUTCMilliseconds();
34123
34126
  return i2 > 0 && (n += "." + i2.toString()), n;
34124
34127
  }
34125
- var Ue = { NONE: 0, ERROR: 1, WARN: 2, INFO: 3, DEBUG: 4 };
34126
- var mc = ["NONE", "ERROR", "WARN", "INFO", "DEBUG"];
34127
- var io = class r5 {
34128
- constructor(e, t = {}, n = Ue.INFO, i2 = {}) {
34128
+ var Be = { NONE: 0, ERROR: 1, WARN: 2, INFO: 3, DEBUG: 4 };
34129
+ var yc = ["NONE", "ERROR", "WARN", "INFO", "DEBUG"];
34130
+ var oo = class r5 {
34131
+ constructor(e, t = {}, n = Be.INFO, i2 = {}) {
34129
34132
  this.write = e, this.metadata = t, this.level = n, this.options = i2, i2?.prefix && (this.prefix = i2.prefix), this.error = this.error.bind(this), this.warn = this.warn.bind(this), this.info = this.info.bind(this), this.debug = this.debug.bind(this), this.log = this.log.bind(this);
34130
34133
  }
34131
34134
  clone(e) {
@@ -34137,30 +34140,30 @@ var io = class r5 {
34137
34140
  return { write: e, metadata: t, level: n, options: i2 };
34138
34141
  }
34139
34142
  error(e, t) {
34140
- this.log(Ue.ERROR, e, t);
34143
+ this.log(Be.ERROR, e, t);
34141
34144
  }
34142
34145
  warn(e, t) {
34143
- this.log(Ue.WARN, e, t);
34146
+ this.log(Be.WARN, e, t);
34144
34147
  }
34145
34148
  info(e, t) {
34146
- this.log(Ue.INFO, e, t);
34149
+ this.log(Be.INFO, e, t);
34147
34150
  }
34148
34151
  debug(e, t) {
34149
- this.log(Ue.DEBUG, e, t);
34152
+ this.log(Be.DEBUG, e, t);
34150
34153
  }
34151
34154
  log(e, t, n) {
34152
34155
  e > this.level || (n instanceof Error && (n = { error: n.toString(), stack: n.stack?.split(`
34153
- `) }), this.write(JSON.stringify({ level: mc[e], timestamp: (/* @__PURE__ */ new Date()).toISOString(), msg: this.prefix ? `${this.prefix}${t}` : t, ...n, ...this.metadata })));
34156
+ `) }), this.write(JSON.stringify({ level: yc[e], timestamp: (/* @__PURE__ */ new Date()).toISOString(), msg: this.prefix ? `${this.prefix}${t}` : t, ...n, ...this.metadata })));
34154
34157
  }
34155
34158
  };
34156
- function Bh(r6) {
34157
- let e = Ue[r6.toUpperCase()];
34159
+ function jh(r6) {
34160
+ let e = Be[r6.toUpperCase()];
34158
34161
  if (e === void 0) throw new Error(`Invalid log level: ${r6}`);
34159
34162
  return e;
34160
34163
  }
34161
- var bc = "https://meta.medplum.com/releases";
34162
- var er = /* @__PURE__ */ new Map();
34163
- function Ec(r6) {
34164
+ var Ec = "https://meta.medplum.com/releases";
34165
+ var tr = /* @__PURE__ */ new Map();
34166
+ function Rc(r6) {
34164
34167
  let e = r6;
34165
34168
  if (!e.tag_name) throw new Error("Manifest missing tag_name");
34166
34169
  let t = e.assets;
@@ -34170,40 +34173,40 @@ function Ec(r6) {
34170
34173
  if (!n.name) throw new Error("Asset missing name");
34171
34174
  }
34172
34175
  }
34173
- async function dn(r6, e, t) {
34174
- let n = er.get(e ?? "latest");
34176
+ async function ln(r6, e, t) {
34177
+ let n = tr.get(e ?? "latest");
34175
34178
  if (!n) {
34176
- let i2 = e ? `v${e}` : "latest", o = new URL(`${bc}/${i2}.json`);
34177
- if (o.searchParams.set("a", r6), o.searchParams.set("c", Zr), t) for (let [c, u2] of Object.entries(t)) o.searchParams.set(c, u2);
34179
+ let i2 = e ? `v${e}` : "latest", o = new URL(`${Ec}/${i2}.json`);
34180
+ if (o.searchParams.set("a", r6), o.searchParams.set("c", Yr), t) for (let [c, u2] of Object.entries(t)) o.searchParams.set(c, u2);
34178
34181
  let s = await fetch(o.toString());
34179
34182
  if (s.status !== 200) {
34180
34183
  let c;
34181
34184
  try {
34182
34185
  c = (await s.json()).message;
34183
34186
  } catch (u2) {
34184
- console.error(`Failed to parse message from body: ${Ae(u2)}`);
34187
+ console.error(`Failed to parse message from body: ${Oe(u2)}`);
34185
34188
  }
34186
34189
  throw new Error(`Received status code ${s.status} while fetching manifest for version '${e ?? "latest"}'. Message: ${c}`);
34187
34190
  }
34188
34191
  let a2 = await s.json();
34189
- Ec(a2), n = a2, er.set(e ?? "latest", n), e || er.set(n.tag_name.slice(1), n);
34192
+ Rc(a2), n = a2, tr.set(e ?? "latest", n), e || tr.set(n.tag_name.slice(1), n);
34190
34193
  }
34191
34194
  return n;
34192
34195
  }
34193
- function Rc(r6) {
34196
+ function Cc(r6) {
34194
34197
  return /^\d+\.\d+\.\d+$/.test(r6);
34195
34198
  }
34196
- async function tm(r6, e) {
34197
- if (!Rc(e)) return false;
34199
+ async function im(r6, e) {
34200
+ if (!Cc(e)) return false;
34198
34201
  try {
34199
- await dn(r6, e);
34202
+ await ln(r6, e);
34200
34203
  } catch {
34201
34204
  return false;
34202
34205
  }
34203
34206
  return true;
34204
34207
  }
34205
- async function rm(r6) {
34206
- let e = await dn(r6);
34208
+ async function om(r6) {
34209
+ let e = await ln(r6);
34207
34210
  if (!e.tag_name.startsWith("v")) throw new Error(`Invalid release name found. Release tag '${e.tag_name}' did not start with 'v'`);
34208
34211
  return e.tag_name.slice(1);
34209
34212
  }
@@ -34246,7 +34249,7 @@ var d = class extends a {
34246
34249
  this.socket = e, this.encoding = s, this.enhancedMode = r6, e.on("data", (n) => {
34247
34250
  try {
34248
34251
  if (this.appendData(n), n.at(-2) === 28 && n.at(-1) === 13) {
34249
- let o = Buffer.concat(this.chunks), g2 = o.subarray(1, o.length - 2), E2 = import_iconv_lite.default.decode(g2, this.encoding), k2 = no.parse(E2);
34252
+ let o = Buffer.concat(this.chunks), g2 = o.subarray(1, o.length - 2), E2 = import_iconv_lite.default.decode(g2, this.encoding), k2 = io.parse(E2);
34250
34253
  this.dispatchEvent(new h2(this, k2)), this.resetBuffer();
34251
34254
  }
34252
34255
  } catch (o) {
@@ -34521,7 +34524,7 @@ var AgentDicomChannel = class extends BaseChannel {
34521
34524
  });
34522
34525
  response2.setStatus(dimse.constants.Status.Success);
34523
34526
  } catch (err) {
34524
- DcmjsDimseScp.channel.log.error(`DICOM error: ${Ae(err)}`);
34527
+ DcmjsDimseScp.channel.log.error(`DICOM error: ${Oe(err)}`);
34525
34528
  response2.setStatus(dimse.constants.Status.ProcessingFailure);
34526
34529
  }
34527
34530
  return response2;
@@ -34597,7 +34600,7 @@ var AgentHl7Channel = class extends BaseChannel {
34597
34600
  sendToRemote(msg) {
34598
34601
  const connection = this.connections.get(msg.remote);
34599
34602
  if (connection) {
34600
- connection.hl7Connection.send(no.parse(msg.body));
34603
+ connection.hl7Connection.send(io.parse(msg.body));
34601
34604
  }
34602
34605
  }
34603
34606
  handleNewConnection(connection) {
@@ -34626,7 +34629,7 @@ var AgentHl7ChannelConnection = class {
34626
34629
  callback: `Agent/${this.channel.app.agentId}-${(0, import_node_crypto2.randomUUID)()}`
34627
34630
  });
34628
34631
  } catch (err) {
34629
- this.channel.log.error(`HL7 error: ${Ae(err)}`);
34632
+ this.channel.log.error(`HL7 error: ${Oe(err)}`);
34630
34633
  }
34631
34634
  }
34632
34635
  close() {
@@ -34646,7 +34649,7 @@ var UPGRADER_LOG_PATH = (0, import_node_path2.resolve)(
34646
34649
  );
34647
34650
  var RELEASES_PATH = (0, import_node_path2.resolve)(__dirname);
34648
34651
  async function downloadRelease(version, path3) {
34649
- const release = await dn("agent-upgrader", version);
34652
+ const release = await ln("agent-upgrader", version);
34650
34653
  const downloadUrl = parseDownloadUrl(release, (0, import_node_os2.platform)());
34651
34654
  const { body } = await fetch(downloadUrl);
34652
34655
  if (!body) {
@@ -34658,9 +34661,9 @@ async function downloadRelease(version, path3) {
34658
34661
  writeStream.once("close", resolve2);
34659
34662
  });
34660
34663
  }
34661
- function parseDownloadUrl(release, os2) {
34664
+ function parseDownloadUrl(release, os) {
34662
34665
  let endingToMatch;
34663
- switch (os2) {
34666
+ switch (os) {
34664
34667
  case "win32":
34665
34668
  endingToMatch = ".exe";
34666
34669
  break;
@@ -34668,14 +34671,14 @@ function parseDownloadUrl(release, os2) {
34668
34671
  endingToMatch = "linux";
34669
34672
  break;
34670
34673
  default:
34671
- throw new Error(`Unsupported platform: ${os2}`);
34674
+ throw new Error(`Unsupported platform: ${os}`);
34672
34675
  }
34673
34676
  for (const asset of release.assets) {
34674
34677
  if (asset.name.endsWith(endingToMatch)) {
34675
34678
  return asset.browser_download_url;
34676
34679
  }
34677
34680
  }
34678
- throw new Error(`No download URL found for release '${release.tag_name}' for ${os2}`);
34681
+ throw new Error(`No download URL found for release '${release.tag_name}' for ${os}`);
34679
34682
  }
34680
34683
  function getReleaseBinPath(version) {
34681
34684
  let binaryName;
@@ -34720,7 +34723,7 @@ var App = class _App {
34720
34723
  this.medplum = medplum;
34721
34724
  this.agentId = agentId;
34722
34725
  this.logLevel = logLevel;
34723
- this.log = new io((msg) => console.log(msg), void 0, logLevel);
34726
+ this.log = new oo((msg) => console.log(msg), void 0, logLevel);
34724
34727
  }
34725
34728
  async start() {
34726
34729
  this.log.info("Medplum service starting...");
@@ -34740,7 +34743,7 @@ var App = class _App {
34740
34743
  if ((0, import_node_fs3.existsSync)(UPGRADE_MANIFEST_PATH)) {
34741
34744
  const upgradeFile = (0, import_node_fs3.readFileSync)(UPGRADE_MANIFEST_PATH, { encoding: "utf-8" });
34742
34745
  const upgradeDetails = JSON.parse(upgradeFile);
34743
- if (upgradeDetails.targetVersion === Zr.split("-")[0]) {
34746
+ if (upgradeDetails.targetVersion === Yr.split("-")[0]) {
34744
34747
  await this.sendToWebSocket({
34745
34748
  type: "agent:upgrade:response",
34746
34749
  statusCode: 200,
@@ -34748,7 +34751,7 @@ var App = class _App {
34748
34751
  });
34749
34752
  this.log.info(`Successfully upgraded to version ${upgradeDetails.targetVersion}`);
34750
34753
  } else {
34751
- const errMsg = `Failed to upgrade to version ${upgradeDetails.targetVersion}. Agent still running with version ${Zr}`;
34754
+ const errMsg = `Failed to upgrade to version ${upgradeDetails.targetVersion}. Agent still running with version ${Yr}`;
34752
34755
  await this.sendToWebSocket({
34753
34756
  type: "agent:error",
34754
34757
  body: errMsg,
@@ -34785,7 +34788,7 @@ var App = class _App {
34785
34788
  webSocketUrl.protocol = webSocketUrl.protocol === "https:" ? "wss:" : "ws:";
34786
34789
  webSocketUrl.pathname = "/ws/agent";
34787
34790
  this.log.info(`Connecting to WebSocket: ${webSocketUrl.href}`);
34788
- this.webSocket = new qt(webSocketUrl.toString(), void 0, {
34791
+ this.webSocket = new jt(webSocketUrl.toString(), void 0, {
34789
34792
  WebSocket: wrapper_default,
34790
34793
  binaryType: "nodebuffer"
34791
34794
  });
@@ -34823,7 +34826,7 @@ var App = class _App {
34823
34826
  break;
34824
34827
  case "agent:heartbeat:request":
34825
34828
  this.outstandingHeartbeats = 0;
34826
- await this.sendToWebSocket({ type: "agent:heartbeat:response", version: Zr });
34829
+ await this.sendToWebSocket({ type: "agent:heartbeat:response", version: Yr });
34827
34830
  break;
34828
34831
  case "agent:heartbeat:response":
34829
34832
  this.outstandingHeartbeats = 0;
@@ -34832,7 +34835,7 @@ var App = class _App {
34832
34835
  case "transmit":
34833
34836
  case "agent:transmit:response": {
34834
34837
  if (!command.callback) {
34835
- throw new Error("Transmit response missing callback");
34838
+ this.log.warn("Transmit response missing callback");
34836
34839
  }
34837
34840
  if (this.config?.status !== "active") {
34838
34841
  this.sendAgentDisabledError(command);
@@ -34866,7 +34869,7 @@ var App = class _App {
34866
34869
  } catch (err) {
34867
34870
  await this.sendToWebSocket({
34868
34871
  type: "agent:error",
34869
- body: Ae(err),
34872
+ body: Oe(err),
34870
34873
  callback: command.callback
34871
34874
  });
34872
34875
  }
@@ -34881,7 +34884,7 @@ var App = class _App {
34881
34884
  this.log.error(`Unknown message type: ${command.type}`);
34882
34885
  }
34883
34886
  } catch (err) {
34884
- this.log.error(`WebSocket error on incoming message: ${Ae(err)}`);
34887
+ this.log.error(`WebSocket error on incoming message: ${Oe(err)}`);
34885
34888
  }
34886
34889
  });
34887
34890
  return new Promise((resolve2) => {
@@ -34953,7 +34956,7 @@ var App = class _App {
34953
34956
  try {
34954
34957
  await this.startOrReloadChannel(definition, endpoint);
34955
34958
  } catch (err) {
34956
- this.log.error(Ae(err));
34959
+ this.log.error(Oe(err));
34957
34960
  }
34958
34961
  }
34959
34962
  }
@@ -34979,7 +34982,7 @@ var App = class _App {
34979
34982
  parsedEndpoint = new URL(endpoint.address);
34980
34983
  } catch (err) {
34981
34984
  throw new Error(
34982
- `Error while validating endpoint address for channel '${channel.name}': ${Ae(err)}`
34985
+ `Error while validating endpoint address for channel '${channel.name}': ${Oe(err)}`
34983
34986
  );
34984
34987
  }
34985
34988
  if (seenPorts.has(parsedEndpoint.port)) {
@@ -35058,7 +35061,7 @@ var App = class _App {
35058
35061
  try {
35059
35062
  await this.sendToWebSocket(msg);
35060
35063
  } catch (err) {
35061
- this.log.error(`WebSocket error while attempting to send message: ${Ae(err)}`);
35064
+ this.log.error(`WebSocket error while attempting to send message: ${Oe(err)}`);
35062
35065
  this.webSocketQueue.unshift(msg);
35063
35066
  throw err;
35064
35067
  }
@@ -35095,7 +35098,7 @@ IPv6 is currently unsupported.`;
35095
35098
  this.log.error(errMsg);
35096
35099
  throw new Error(errMsg);
35097
35100
  }
35098
- if (!((0, import_node_net3.isIPv4)(message.remote) || bl(message.remote))) {
35101
+ if (!((0, import_node_net3.isIPv4)(message.remote) || El(message.remote))) {
35099
35102
  const errMsg = `Attempted to ping an invalid host.
35100
35103
 
35101
35104
  "${message.remote}" is not a valid IPv4 address or a resolvable hostname.`;
@@ -35134,7 +35137,7 @@ ${result}`);
35134
35137
  body: result
35135
35138
  });
35136
35139
  } catch (err) {
35137
- this.log.error(`Error during ping attempt to ${message.remote ?? "NO_HOST_GIVEN"}: ${Ae(err)}`);
35140
+ this.log.error(`Error during ping attempt to ${message.remote ?? "NO_HOST_GIVEN"}: ${Oe(err)}`);
35138
35141
  this.addToWebSocketQueue({
35139
35142
  type: "agent:transmit:response",
35140
35143
  channel: message.channel,
@@ -35142,7 +35145,7 @@ ${result}`);
35142
35145
  remote: message.remote,
35143
35146
  callback: message.callback,
35144
35147
  statusCode: 400,
35145
- body: Ae(err)
35148
+ body: Oe(err)
35146
35149
  });
35147
35150
  }
35148
35151
  }
@@ -35158,7 +35161,7 @@ ${result}`);
35158
35161
  return;
35159
35162
  }
35160
35163
  let child;
35161
- if (message.version && !await tm("agent-upgrader", message.version)) {
35164
+ if (message.version && !await im("agent-upgrader", message.version)) {
35162
35165
  const versionTag = message.version ? `v${message.version}` : "latest";
35163
35166
  const errMsg = `Error during upgrading to version '${versionTag}'. '${message.version}' is not a valid version`;
35164
35167
  this.log.error(errMsg);
@@ -35169,8 +35172,8 @@ ${result}`);
35169
35172
  });
35170
35173
  return;
35171
35174
  }
35172
- const targetVersion = message.version ?? await rm("agent-upgrader");
35173
- if (Zr.startsWith(targetVersion)) {
35175
+ const targetVersion = message.version ?? await om("agent-upgrader");
35176
+ if (Yr.startsWith(targetVersion)) {
35174
35177
  if (!message?.force) {
35175
35178
  this.log.info(`Attempted to upgrade to version ${targetVersion}, but agent is already on that version`);
35176
35179
  await this.sendToWebSocket({
@@ -35180,7 +35183,7 @@ ${result}`);
35180
35183
  });
35181
35184
  return;
35182
35185
  }
35183
- this.log.info(`Forcing upgrade from ${Zr} to ${targetVersion}`);
35186
+ this.log.info(`Forcing upgrade from ${Yr} to ${targetVersion}`);
35184
35187
  }
35185
35188
  try {
35186
35189
  const command = __filename;
@@ -35202,11 +35205,11 @@ ${result}`);
35202
35205
  });
35203
35206
  });
35204
35207
  child.on("error", (err) => {
35205
- this.log.error(Ae(err));
35208
+ this.log.error(Oe(err));
35206
35209
  });
35207
35210
  } catch (err) {
35208
35211
  const versionTag = message.version ? `v${message.version}` : "latest";
35209
- const errMsg = `Error during upgrading to version '${versionTag}': ${Ae(err)}`;
35212
+ const errMsg = `Error during upgrading to version '${versionTag}': ${Oe(err)}`;
35210
35213
  this.log.error(errMsg);
35211
35214
  await this.sendToWebSocket({
35212
35215
  type: "agent:error",
@@ -35218,11 +35221,11 @@ ${result}`);
35218
35221
  try {
35219
35222
  await this.stop();
35220
35223
  this.log.info("Successfully stopped agent network services");
35221
- this.log.info("Writing upgrade manifest...", { previousVersion: Zr, targetVersion });
35224
+ this.log.info("Writing upgrade manifest...", { previousVersion: Yr, targetVersion });
35222
35225
  (0, import_node_fs3.writeFileSync)(
35223
35226
  UPGRADE_MANIFEST_PATH,
35224
35227
  JSON.stringify({
35225
- previousVersion: Zr,
35228
+ previousVersion: Yr,
35226
35229
  targetVersion,
35227
35230
  callback: message.callback ?? null
35228
35231
  }),
@@ -35232,7 +35235,7 @@ ${result}`);
35232
35235
  child.disconnect();
35233
35236
  } catch (err) {
35234
35237
  this.log.error(
35235
- `Error while stopping agent or messaging child process as part of upgrade: ${Ae(err)}`
35238
+ `Error while stopping agent or messaging child process as part of upgrade: ${Oe(err)}`
35236
35239
  );
35237
35240
  import_node_process.default.exit(1);
35238
35241
  }
@@ -35290,7 +35293,7 @@ ${result}`);
35290
35293
  });
35291
35294
  }
35292
35295
  }
35293
- client.sendAndWait(no.parse(message.body)).then((response2) => {
35296
+ client.sendAndWait(io.parse(message.body)).then((response2) => {
35294
35297
  this.log.info(`Response: ${response2.toString().replaceAll("\r", "\n")}`);
35295
35298
  this.addToWebSocketQueue({
35296
35299
  type: "agent:transmit:response",
@@ -35302,7 +35305,7 @@ ${result}`);
35302
35305
  body: response2.toString()
35303
35306
  });
35304
35307
  }).catch((err) => {
35305
- this.log.error(`HL7 error: ${Ae(err)}`);
35308
+ this.log.error(`HL7 error: ${Oe(err)}`);
35306
35309
  this.addToWebSocketQueue({
35307
35310
  type: "agent:transmit:response",
35308
35311
  channel: message.channel,
@@ -35310,7 +35313,7 @@ ${result}`);
35310
35313
  callback: message.callback,
35311
35314
  contentType: w.TEXT,
35312
35315
  statusCode: 400,
35313
- body: Ae(err)
35316
+ body: Oe(err)
35314
35317
  });
35315
35318
  if (client.keepAlive) {
35316
35319
  this.hl7Clients.delete(message.remote);
@@ -35357,19 +35360,19 @@ async function agentMain(argv) {
35357
35360
  process.exit(1);
35358
35361
  }
35359
35362
  const { baseUrl, clientId, clientSecret, agentId } = args;
35360
- const medplum = new $t({ baseUrl, clientId });
35363
+ const medplum = new Gt({ baseUrl, clientId });
35361
35364
  let loggedIn = false;
35362
35365
  while (!loggedIn) {
35363
35366
  try {
35364
35367
  await medplum.startClientLogin(clientId, clientSecret);
35365
35368
  loggedIn = true;
35366
35369
  } catch (err) {
35367
- console.error("Failed to login", { err: Ae(err) });
35370
+ console.error("Failed to login", { err: Oe(err) });
35368
35371
  console.log("Retrying login in 10 seconds...");
35369
- await Mr(RETRY_WAIT_DURATION_MS);
35372
+ await _r(RETRY_WAIT_DURATION_MS);
35370
35373
  }
35371
35374
  }
35372
- const app = new App(medplum, agentId, Bh(args.logLevel ?? "INFO"));
35375
+ const app = new App(medplum, agentId, jh(args.logLevel ?? "INFO"));
35373
35376
  await app.start();
35374
35377
  process.on("SIGINT", async () => {
35375
35378
  console.log("Gracefully shutting down from SIGINT (Ctrl-C)");
@@ -35394,7 +35397,7 @@ var import_node_os4 = require("node:os");
35394
35397
  var import_node_path3 = __toESM(require("node:path"));
35395
35398
  var import_node_process2 = __toESM(require("node:process"));
35396
35399
  var EXIT_SIGNALS = ["SIGINT", "SIGTERM", "SIGHUP"];
35397
- var pidLogger = new io((msg) => `[PID]: ${msg}`);
35400
+ var pidLogger = new oo((msg) => `[PID]: ${msg}`);
35398
35401
  var pidFilePaths = /* @__PURE__ */ new Set();
35399
35402
  var processExitListener = () => {
35400
35403
  removeAllPidFiles();
@@ -35496,7 +35499,7 @@ async function upgraderMain(argv) {
35496
35499
  if ((0, import_node_os5.platform)() !== "win32") {
35497
35500
  throw new Error(`Unsupported platform: ${(0, import_node_os5.platform)()}. Agent upgrader currently only supports Windows`);
35498
35501
  }
35499
- const globalLogger = new io((msg) => console.log(msg));
35502
+ const globalLogger = new oo((msg) => console.log(msg));
35500
35503
  if (!import_node_process3.default.send) {
35501
35504
  globalLogger.error("Upgrader not started as a child process with Node IPC enabled. Aborting...");
35502
35505
  import_node_process3.default.exit(1);
@@ -35509,10 +35512,10 @@ async function upgraderMain(argv) {
35509
35512
  });
35510
35513
  });
35511
35514
  import_node_process3.default.send({ type: "STARTED" });
35512
- if (argv[3] && !Rc(argv[3])) {
35515
+ if (argv[3] && !Cc(argv[3])) {
35513
35516
  throw new Error("Invalid version specified");
35514
35517
  }
35515
- const version = argv[3] ?? await rm("agent-upgrader");
35518
+ const version = argv[3] ?? await om("agent-upgrader");
35516
35519
  const binPath = getReleaseBinPath(version);
35517
35520
  if (!(0, import_node_fs6.existsSync)(binPath)) {
35518
35521
  globalLogger.info(`Could not find binary at "${binPath}". Downloading release from GitHub...`);
@@ -35535,7 +35538,7 @@ async function upgraderMain(argv) {
35535
35538
  (0, import_node_child_process2.spawnSync)(binPath, ["/S"]);
35536
35539
  globalLogger.info(`Agent version ${version} successfully installed`);
35537
35540
  } catch (err) {
35538
- globalLogger.error(`Error while attempting to run installer: ${Ae(err)}`);
35541
+ globalLogger.error(`Error while attempting to run installer: ${Oe(err)}`);
35539
35542
  globalLogger.error("Failed to run installer, attempting to restart agent service...");
35540
35543
  try {
35541
35544
  (0, import_node_child_process2.execSync)('net start "Medplum Agent"');