@medplum/agent 4.3.11 → 4.3.13
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.
- package/dist/cjs/index.cjs +1001 -834
- package/package.json +6 -6
package/dist/cjs/index.cjs
CHANGED
|
@@ -126,12 +126,14 @@ var require_bom_handling = __commonJS({
|
|
|
126
126
|
}
|
|
127
127
|
StripBOMWrapper.prototype.write = function(buf) {
|
|
128
128
|
var res = this.decoder.write(buf);
|
|
129
|
-
if (this.pass || !res)
|
|
129
|
+
if (this.pass || !res) {
|
|
130
130
|
return res;
|
|
131
|
+
}
|
|
131
132
|
if (res[0] === BOMChar) {
|
|
132
133
|
res = res.slice(1);
|
|
133
|
-
if (typeof this.options.stripBOM === "function")
|
|
134
|
+
if (typeof this.options.stripBOM === "function") {
|
|
134
135
|
this.options.stripBOM();
|
|
136
|
+
}
|
|
135
137
|
}
|
|
136
138
|
this.pass = true;
|
|
137
139
|
return res;
|
|
@@ -142,6 +144,22 @@ var require_bom_handling = __commonJS({
|
|
|
142
144
|
}
|
|
143
145
|
});
|
|
144
146
|
|
|
147
|
+
// ../../node_modules/iconv-lite/lib/helpers/merge-exports.js
|
|
148
|
+
var require_merge_exports = __commonJS({
|
|
149
|
+
"../../node_modules/iconv-lite/lib/helpers/merge-exports.js"(exports2, module2) {
|
|
150
|
+
"use strict";
|
|
151
|
+
var hasOwn = typeof Object.hasOwn === "undefined" ? Function.call.bind(Object.prototype.hasOwnProperty) : Object.hasOwn;
|
|
152
|
+
function mergeModules(target, module3) {
|
|
153
|
+
for (var key in module3) {
|
|
154
|
+
if (hasOwn(module3, key)) {
|
|
155
|
+
target[key] = module3[key];
|
|
156
|
+
}
|
|
157
|
+
}
|
|
158
|
+
}
|
|
159
|
+
module2.exports = mergeModules;
|
|
160
|
+
}
|
|
161
|
+
});
|
|
162
|
+
|
|
145
163
|
// ../../node_modules/iconv-lite/encodings/internal.js
|
|
146
164
|
var require_internal = __commonJS({
|
|
147
165
|
"../../node_modules/iconv-lite/encodings/internal.js"(exports2, module2) {
|
|
@@ -163,9 +181,11 @@ var require_internal = __commonJS({
|
|
|
163
181
|
function InternalCodec(codecOptions, iconv) {
|
|
164
182
|
this.enc = codecOptions.encodingName;
|
|
165
183
|
this.bomAware = codecOptions.bomAware;
|
|
166
|
-
if (this.enc === "base64")
|
|
184
|
+
if (this.enc === "base64") {
|
|
167
185
|
this.encoder = InternalEncoderBase64;
|
|
168
|
-
else if (this.enc === "
|
|
186
|
+
} else if (this.enc === "utf8") {
|
|
187
|
+
this.encoder = InternalEncoderUtf8;
|
|
188
|
+
} else if (this.enc === "cesu8") {
|
|
169
189
|
this.enc = "utf8";
|
|
170
190
|
this.encoder = InternalEncoderCesu8;
|
|
171
191
|
if (Buffer2.from("eda0bdedb2a9", "hex").toString() !== "\u{1F4A9}") {
|
|
@@ -177,9 +197,6 @@ var require_internal = __commonJS({
|
|
|
177
197
|
InternalCodec.prototype.encoder = InternalEncoder;
|
|
178
198
|
InternalCodec.prototype.decoder = InternalDecoder;
|
|
179
199
|
var StringDecoder = require("string_decoder").StringDecoder;
|
|
180
|
-
if (!StringDecoder.prototype.end)
|
|
181
|
-
StringDecoder.prototype.end = function() {
|
|
182
|
-
};
|
|
183
200
|
function InternalDecoder(options, codec) {
|
|
184
201
|
this.decoder = new StringDecoder(codec.enc);
|
|
185
202
|
}
|
|
@@ -216,12 +233,13 @@ var require_internal = __commonJS({
|
|
|
216
233
|
function InternalEncoderCesu8(options, codec) {
|
|
217
234
|
}
|
|
218
235
|
InternalEncoderCesu8.prototype.write = function(str) {
|
|
219
|
-
var buf = Buffer2.alloc(str.length * 3)
|
|
236
|
+
var buf = Buffer2.alloc(str.length * 3);
|
|
237
|
+
var bufIdx = 0;
|
|
220
238
|
for (var i = 0; i < str.length; i++) {
|
|
221
239
|
var charCode = str.charCodeAt(i);
|
|
222
|
-
if (charCode < 128)
|
|
240
|
+
if (charCode < 128) {
|
|
223
241
|
buf[bufIdx++] = charCode;
|
|
224
|
-
else if (charCode < 2048) {
|
|
242
|
+
} else if (charCode < 2048) {
|
|
225
243
|
buf[bufIdx++] = 192 + (charCode >>> 6);
|
|
226
244
|
buf[bufIdx++] = 128 + (charCode & 63);
|
|
227
245
|
} else {
|
|
@@ -241,7 +259,10 @@ var require_internal = __commonJS({
|
|
|
241
259
|
this.defaultCharUnicode = codec.defaultCharUnicode;
|
|
242
260
|
}
|
|
243
261
|
InternalDecoderCesu8.prototype.write = function(buf) {
|
|
244
|
-
var acc = this.acc
|
|
262
|
+
var acc = this.acc;
|
|
263
|
+
var contBytes = this.contBytes;
|
|
264
|
+
var accBytes = this.accBytes;
|
|
265
|
+
var res = "";
|
|
245
266
|
for (var i = 0; i < buf.length; i++) {
|
|
246
267
|
var curByte = buf[i];
|
|
247
268
|
if ((curByte & 192) !== 128) {
|
|
@@ -268,12 +289,13 @@ var require_internal = __commonJS({
|
|
|
268
289
|
contBytes--;
|
|
269
290
|
accBytes++;
|
|
270
291
|
if (contBytes === 0) {
|
|
271
|
-
if (accBytes === 2 && acc < 128 && acc > 0)
|
|
292
|
+
if (accBytes === 2 && acc < 128 && acc > 0) {
|
|
272
293
|
res += this.defaultCharUnicode;
|
|
273
|
-
else if (accBytes === 3 && acc < 2048)
|
|
294
|
+
} else if (accBytes === 3 && acc < 2048) {
|
|
274
295
|
res += this.defaultCharUnicode;
|
|
275
|
-
else
|
|
296
|
+
} else {
|
|
276
297
|
res += String.fromCharCode(acc);
|
|
298
|
+
}
|
|
277
299
|
}
|
|
278
300
|
} else {
|
|
279
301
|
res += this.defaultCharUnicode;
|
|
@@ -287,10 +309,35 @@ var require_internal = __commonJS({
|
|
|
287
309
|
};
|
|
288
310
|
InternalDecoderCesu8.prototype.end = function() {
|
|
289
311
|
var res = 0;
|
|
290
|
-
if (this.contBytes > 0)
|
|
312
|
+
if (this.contBytes > 0) {
|
|
291
313
|
res += this.defaultCharUnicode;
|
|
314
|
+
}
|
|
292
315
|
return res;
|
|
293
316
|
};
|
|
317
|
+
function InternalEncoderUtf8(options, codec) {
|
|
318
|
+
this.highSurrogate = "";
|
|
319
|
+
}
|
|
320
|
+
InternalEncoderUtf8.prototype.write = function(str) {
|
|
321
|
+
if (this.highSurrogate) {
|
|
322
|
+
str = this.highSurrogate + str;
|
|
323
|
+
this.highSurrogate = "";
|
|
324
|
+
}
|
|
325
|
+
if (str.length > 0) {
|
|
326
|
+
var charCode = str.charCodeAt(str.length - 1);
|
|
327
|
+
if (charCode >= 55296 && charCode < 56320) {
|
|
328
|
+
this.highSurrogate = str[str.length - 1];
|
|
329
|
+
str = str.slice(0, str.length - 1);
|
|
330
|
+
}
|
|
331
|
+
}
|
|
332
|
+
return Buffer2.from(str, this.enc);
|
|
333
|
+
};
|
|
334
|
+
InternalEncoderUtf8.prototype.end = function() {
|
|
335
|
+
if (this.highSurrogate) {
|
|
336
|
+
var str = this.highSurrogate;
|
|
337
|
+
this.highSurrogate = "";
|
|
338
|
+
return Buffer2.from(str, this.enc);
|
|
339
|
+
}
|
|
340
|
+
};
|
|
294
341
|
}
|
|
295
342
|
});
|
|
296
343
|
|
|
@@ -322,8 +369,8 @@ var require_utf32 = __commonJS({
|
|
|
322
369
|
var offset = 0;
|
|
323
370
|
for (var i = 0; i < src.length; i += 2) {
|
|
324
371
|
var code = src.readUInt16LE(i);
|
|
325
|
-
var isHighSurrogate =
|
|
326
|
-
var isLowSurrogate =
|
|
372
|
+
var isHighSurrogate = code >= 55296 && code < 56320;
|
|
373
|
+
var isLowSurrogate = code >= 56320 && code < 57344;
|
|
327
374
|
if (this.highSurrogate) {
|
|
328
375
|
if (isHighSurrogate || !isLowSurrogate) {
|
|
329
376
|
write32.call(dst, this.highSurrogate, offset);
|
|
@@ -336,26 +383,29 @@ var require_utf32 = __commonJS({
|
|
|
336
383
|
continue;
|
|
337
384
|
}
|
|
338
385
|
}
|
|
339
|
-
if (isHighSurrogate)
|
|
386
|
+
if (isHighSurrogate) {
|
|
340
387
|
this.highSurrogate = code;
|
|
341
|
-
else {
|
|
388
|
+
} else {
|
|
342
389
|
write32.call(dst, code, offset);
|
|
343
390
|
offset += 4;
|
|
344
391
|
this.highSurrogate = 0;
|
|
345
392
|
}
|
|
346
393
|
}
|
|
347
|
-
if (offset < dst.length)
|
|
394
|
+
if (offset < dst.length) {
|
|
348
395
|
dst = dst.slice(0, offset);
|
|
396
|
+
}
|
|
349
397
|
return dst;
|
|
350
398
|
};
|
|
351
399
|
Utf32Encoder.prototype.end = function() {
|
|
352
|
-
if (!this.highSurrogate)
|
|
400
|
+
if (!this.highSurrogate) {
|
|
353
401
|
return;
|
|
402
|
+
}
|
|
354
403
|
var buf = Buffer2.alloc(4);
|
|
355
|
-
if (this.isLE)
|
|
404
|
+
if (this.isLE) {
|
|
356
405
|
buf.writeUInt32LE(this.highSurrogate, 0);
|
|
357
|
-
else
|
|
406
|
+
} else {
|
|
358
407
|
buf.writeUInt32BE(this.highSurrogate, 0);
|
|
408
|
+
}
|
|
359
409
|
this.highSurrogate = 0;
|
|
360
410
|
return buf;
|
|
361
411
|
};
|
|
@@ -365,8 +415,9 @@ var require_utf32 = __commonJS({
|
|
|
365
415
|
this.overflow = [];
|
|
366
416
|
}
|
|
367
417
|
Utf32Decoder.prototype.write = function(src) {
|
|
368
|
-
if (src.length === 0)
|
|
418
|
+
if (src.length === 0) {
|
|
369
419
|
return "";
|
|
420
|
+
}
|
|
370
421
|
var i = 0;
|
|
371
422
|
var codepoint = 0;
|
|
372
423
|
var dst = Buffer2.alloc(src.length + 4);
|
|
@@ -375,8 +426,9 @@ var require_utf32 = __commonJS({
|
|
|
375
426
|
var overflow = this.overflow;
|
|
376
427
|
var badChar = this.badChar;
|
|
377
428
|
if (overflow.length > 0) {
|
|
378
|
-
for (; i < src.length && overflow.length < 4; i++)
|
|
429
|
+
for (; i < src.length && overflow.length < 4; i++) {
|
|
379
430
|
overflow.push(src[i]);
|
|
431
|
+
}
|
|
380
432
|
if (overflow.length === 4) {
|
|
381
433
|
if (isLE) {
|
|
382
434
|
codepoint = overflow[i] | overflow[i + 1] << 8 | overflow[i + 2] << 16 | overflow[i + 3] << 24;
|
|
@@ -427,8 +479,9 @@ var require_utf32 = __commonJS({
|
|
|
427
479
|
Utf32AutoCodec.prototype.decoder = Utf32AutoDecoder;
|
|
428
480
|
function Utf32AutoEncoder(options, codec) {
|
|
429
481
|
options = options || {};
|
|
430
|
-
if (options.addBOM === void 0)
|
|
482
|
+
if (options.addBOM === void 0) {
|
|
431
483
|
options.addBOM = true;
|
|
484
|
+
}
|
|
432
485
|
this.encoder = codec.iconv.getEncoder(options.defaultEncoding || "utf-32le", options);
|
|
433
486
|
}
|
|
434
487
|
Utf32AutoEncoder.prototype.write = function(str) {
|
|
@@ -448,13 +501,15 @@ var require_utf32 = __commonJS({
|
|
|
448
501
|
if (!this.decoder) {
|
|
449
502
|
this.initialBufs.push(buf);
|
|
450
503
|
this.initialBufsLen += buf.length;
|
|
451
|
-
if (this.initialBufsLen < 32)
|
|
504
|
+
if (this.initialBufsLen < 32) {
|
|
452
505
|
return "";
|
|
506
|
+
}
|
|
453
507
|
var encoding = detectEncoding(this.initialBufs, this.options.defaultEncoding);
|
|
454
508
|
this.decoder = this.iconv.getDecoder(encoding, this.options);
|
|
455
509
|
var resStr = "";
|
|
456
|
-
for (var i = 0; i < this.initialBufs.length; i++)
|
|
510
|
+
for (var i = 0; i < this.initialBufs.length; i++) {
|
|
457
511
|
resStr += this.decoder.write(this.initialBufs[i]);
|
|
512
|
+
}
|
|
458
513
|
this.initialBufs.length = this.initialBufsLen = 0;
|
|
459
514
|
return resStr;
|
|
460
515
|
}
|
|
@@ -465,11 +520,13 @@ var require_utf32 = __commonJS({
|
|
|
465
520
|
var encoding = detectEncoding(this.initialBufs, this.options.defaultEncoding);
|
|
466
521
|
this.decoder = this.iconv.getDecoder(encoding, this.options);
|
|
467
522
|
var resStr = "";
|
|
468
|
-
for (var i = 0; i < this.initialBufs.length; i++)
|
|
523
|
+
for (var i = 0; i < this.initialBufs.length; i++) {
|
|
469
524
|
resStr += this.decoder.write(this.initialBufs[i]);
|
|
525
|
+
}
|
|
470
526
|
var trail = this.decoder.end();
|
|
471
|
-
if (trail)
|
|
527
|
+
if (trail) {
|
|
472
528
|
resStr += trail;
|
|
529
|
+
}
|
|
473
530
|
this.initialBufs.length = this.initialBufsLen = 0;
|
|
474
531
|
return resStr;
|
|
475
532
|
}
|
|
@@ -478,9 +535,11 @@ var require_utf32 = __commonJS({
|
|
|
478
535
|
function detectEncoding(bufs, defaultEncoding) {
|
|
479
536
|
var b2 = [];
|
|
480
537
|
var charsProcessed = 0;
|
|
481
|
-
var invalidLE = 0
|
|
482
|
-
var
|
|
483
|
-
|
|
538
|
+
var invalidLE = 0;
|
|
539
|
+
var invalidBE = 0;
|
|
540
|
+
var bmpCharsLE = 0;
|
|
541
|
+
var bmpCharsBE = 0;
|
|
542
|
+
outerLoop:
|
|
484
543
|
for (var i = 0; i < bufs.length; i++) {
|
|
485
544
|
var buf = bufs[i];
|
|
486
545
|
for (var j2 = 0; j2 < buf.length; j2++) {
|
|
@@ -501,7 +560,7 @@ var require_utf32 = __commonJS({
|
|
|
501
560
|
b2.length = 0;
|
|
502
561
|
charsProcessed++;
|
|
503
562
|
if (charsProcessed >= 100) {
|
|
504
|
-
break
|
|
563
|
+
break outerLoop;
|
|
505
564
|
}
|
|
506
565
|
}
|
|
507
566
|
}
|
|
@@ -541,9 +600,12 @@ var require_utf16 = __commonJS({
|
|
|
541
600
|
this.overflowByte = -1;
|
|
542
601
|
}
|
|
543
602
|
Utf16BEDecoder.prototype.write = function(buf) {
|
|
544
|
-
if (buf.length == 0)
|
|
603
|
+
if (buf.length == 0) {
|
|
545
604
|
return "";
|
|
546
|
-
|
|
605
|
+
}
|
|
606
|
+
var buf2 = Buffer2.alloc(buf.length + 1);
|
|
607
|
+
var i = 0;
|
|
608
|
+
var j2 = 0;
|
|
547
609
|
if (this.overflowByte !== -1) {
|
|
548
610
|
buf2[0] = buf[0];
|
|
549
611
|
buf2[1] = this.overflowByte;
|
|
@@ -568,8 +630,9 @@ var require_utf16 = __commonJS({
|
|
|
568
630
|
Utf16Codec.prototype.decoder = Utf16Decoder;
|
|
569
631
|
function Utf16Encoder(options, codec) {
|
|
570
632
|
options = options || {};
|
|
571
|
-
if (options.addBOM === void 0)
|
|
633
|
+
if (options.addBOM === void 0) {
|
|
572
634
|
options.addBOM = true;
|
|
635
|
+
}
|
|
573
636
|
this.encoder = codec.iconv.getEncoder("utf-16le", options);
|
|
574
637
|
}
|
|
575
638
|
Utf16Encoder.prototype.write = function(str) {
|
|
@@ -589,13 +652,15 @@ var require_utf16 = __commonJS({
|
|
|
589
652
|
if (!this.decoder) {
|
|
590
653
|
this.initialBufs.push(buf);
|
|
591
654
|
this.initialBufsLen += buf.length;
|
|
592
|
-
if (this.initialBufsLen < 16)
|
|
655
|
+
if (this.initialBufsLen < 16) {
|
|
593
656
|
return "";
|
|
657
|
+
}
|
|
594
658
|
var encoding = detectEncoding(this.initialBufs, this.options.defaultEncoding);
|
|
595
659
|
this.decoder = this.iconv.getDecoder(encoding, this.options);
|
|
596
660
|
var resStr = "";
|
|
597
|
-
for (var i = 0; i < this.initialBufs.length; i++)
|
|
661
|
+
for (var i = 0; i < this.initialBufs.length; i++) {
|
|
598
662
|
resStr += this.decoder.write(this.initialBufs[i]);
|
|
663
|
+
}
|
|
599
664
|
this.initialBufs.length = this.initialBufsLen = 0;
|
|
600
665
|
return resStr;
|
|
601
666
|
}
|
|
@@ -606,11 +671,13 @@ var require_utf16 = __commonJS({
|
|
|
606
671
|
var encoding = detectEncoding(this.initialBufs, this.options.defaultEncoding);
|
|
607
672
|
this.decoder = this.iconv.getDecoder(encoding, this.options);
|
|
608
673
|
var resStr = "";
|
|
609
|
-
for (var i = 0; i < this.initialBufs.length; i++)
|
|
674
|
+
for (var i = 0; i < this.initialBufs.length; i++) {
|
|
610
675
|
resStr += this.decoder.write(this.initialBufs[i]);
|
|
676
|
+
}
|
|
611
677
|
var trail = this.decoder.end();
|
|
612
|
-
if (trail)
|
|
678
|
+
if (trail) {
|
|
613
679
|
resStr += trail;
|
|
680
|
+
}
|
|
614
681
|
this.initialBufs.length = this.initialBufsLen = 0;
|
|
615
682
|
return resStr;
|
|
616
683
|
}
|
|
@@ -619,8 +686,9 @@ var require_utf16 = __commonJS({
|
|
|
619
686
|
function detectEncoding(bufs, defaultEncoding) {
|
|
620
687
|
var b2 = [];
|
|
621
688
|
var charsProcessed = 0;
|
|
622
|
-
var asciiCharsLE = 0
|
|
623
|
-
|
|
689
|
+
var asciiCharsLE = 0;
|
|
690
|
+
var asciiCharsBE = 0;
|
|
691
|
+
outerLoop:
|
|
624
692
|
for (var i = 0; i < bufs.length; i++) {
|
|
625
693
|
var buf = bufs[i];
|
|
626
694
|
for (var j2 = 0; j2 < buf.length; j2++) {
|
|
@@ -635,7 +703,7 @@ var require_utf16 = __commonJS({
|
|
|
635
703
|
b2.length = 0;
|
|
636
704
|
charsProcessed++;
|
|
637
705
|
if (charsProcessed >= 100) {
|
|
638
|
-
break
|
|
706
|
+
break outerLoop;
|
|
639
707
|
}
|
|
640
708
|
}
|
|
641
709
|
}
|
|
@@ -678,14 +746,18 @@ var require_utf7 = __commonJS({
|
|
|
678
746
|
}
|
|
679
747
|
var base64Regex = /[A-Za-z0-9\/+]/;
|
|
680
748
|
var base64Chars = [];
|
|
681
|
-
for (i = 0; i < 256; i++)
|
|
749
|
+
for (i = 0; i < 256; i++) {
|
|
682
750
|
base64Chars[i] = base64Regex.test(String.fromCharCode(i));
|
|
751
|
+
}
|
|
683
752
|
var i;
|
|
684
753
|
var plusChar = "+".charCodeAt(0);
|
|
685
754
|
var minusChar = "-".charCodeAt(0);
|
|
686
755
|
var andChar = "&".charCodeAt(0);
|
|
687
756
|
Utf7Decoder.prototype.write = function(buf) {
|
|
688
|
-
var res = ""
|
|
757
|
+
var res = "";
|
|
758
|
+
var lastI = 0;
|
|
759
|
+
var inBase64 = this.inBase64;
|
|
760
|
+
var base64Accum = this.base64Accum;
|
|
689
761
|
for (var i2 = 0; i2 < buf.length; i2++) {
|
|
690
762
|
if (!inBase64) {
|
|
691
763
|
if (buf[i2] == plusChar) {
|
|
@@ -701,8 +773,9 @@ var require_utf7 = __commonJS({
|
|
|
701
773
|
var b64str = base64Accum + this.iconv.decode(buf.slice(lastI, i2), "ascii");
|
|
702
774
|
res += this.iconv.decode(Buffer2.from(b64str, "base64"), "utf16-be");
|
|
703
775
|
}
|
|
704
|
-
if (buf[i2] != minusChar)
|
|
776
|
+
if (buf[i2] != minusChar) {
|
|
705
777
|
i2--;
|
|
778
|
+
}
|
|
706
779
|
lastI = i2 + 1;
|
|
707
780
|
inBase64 = false;
|
|
708
781
|
base64Accum = "";
|
|
@@ -724,8 +797,9 @@ var require_utf7 = __commonJS({
|
|
|
724
797
|
};
|
|
725
798
|
Utf7Decoder.prototype.end = function() {
|
|
726
799
|
var res = "";
|
|
727
|
-
if (this.inBase64 && this.base64Accum.length > 0)
|
|
800
|
+
if (this.inBase64 && this.base64Accum.length > 0) {
|
|
728
801
|
res = this.iconv.decode(Buffer2.from(this.base64Accum, "base64"), "utf16-be");
|
|
802
|
+
}
|
|
729
803
|
this.inBase64 = false;
|
|
730
804
|
this.base64Accum = "";
|
|
731
805
|
return res;
|
|
@@ -744,10 +818,14 @@ var require_utf7 = __commonJS({
|
|
|
744
818
|
this.base64AccumIdx = 0;
|
|
745
819
|
}
|
|
746
820
|
Utf7IMAPEncoder.prototype.write = function(str) {
|
|
747
|
-
var inBase64 = this.inBase64
|
|
821
|
+
var inBase64 = this.inBase64;
|
|
822
|
+
var base64Accum = this.base64Accum;
|
|
823
|
+
var base64AccumIdx = this.base64AccumIdx;
|
|
824
|
+
var buf = Buffer2.alloc(str.length * 5 + 10);
|
|
825
|
+
var bufIdx = 0;
|
|
748
826
|
for (var i2 = 0; i2 < str.length; i2++) {
|
|
749
827
|
var uChar = str.charCodeAt(i2);
|
|
750
|
-
if (
|
|
828
|
+
if (uChar >= 32 && uChar <= 126) {
|
|
751
829
|
if (inBase64) {
|
|
752
830
|
if (base64AccumIdx > 0) {
|
|
753
831
|
bufIdx += buf.write(base64Accum.slice(0, base64AccumIdx).toString("base64").replace(/\//g, ",").replace(/=+$/, ""), bufIdx);
|
|
@@ -758,8 +836,9 @@ var require_utf7 = __commonJS({
|
|
|
758
836
|
}
|
|
759
837
|
if (!inBase64) {
|
|
760
838
|
buf[bufIdx++] = uChar;
|
|
761
|
-
if (uChar === andChar)
|
|
839
|
+
if (uChar === andChar) {
|
|
762
840
|
buf[bufIdx++] = minusChar;
|
|
841
|
+
}
|
|
763
842
|
}
|
|
764
843
|
} else {
|
|
765
844
|
if (!inBase64) {
|
|
@@ -781,7 +860,8 @@ var require_utf7 = __commonJS({
|
|
|
781
860
|
return buf.slice(0, bufIdx);
|
|
782
861
|
};
|
|
783
862
|
Utf7IMAPEncoder.prototype.end = function() {
|
|
784
|
-
var buf = Buffer2.alloc(10)
|
|
863
|
+
var buf = Buffer2.alloc(10);
|
|
864
|
+
var bufIdx = 0;
|
|
785
865
|
if (this.inBase64) {
|
|
786
866
|
if (this.base64AccumIdx > 0) {
|
|
787
867
|
bufIdx += buf.write(this.base64Accum.slice(0, this.base64AccumIdx).toString("base64").replace(/\//g, ",").replace(/=+$/, ""), bufIdx);
|
|
@@ -800,7 +880,10 @@ var require_utf7 = __commonJS({
|
|
|
800
880
|
var base64IMAPChars = base64Chars.slice();
|
|
801
881
|
base64IMAPChars[",".charCodeAt(0)] = true;
|
|
802
882
|
Utf7IMAPDecoder.prototype.write = function(buf) {
|
|
803
|
-
var res = ""
|
|
883
|
+
var res = "";
|
|
884
|
+
var lastI = 0;
|
|
885
|
+
var inBase64 = this.inBase64;
|
|
886
|
+
var base64Accum = this.base64Accum;
|
|
804
887
|
for (var i2 = 0; i2 < buf.length; i2++) {
|
|
805
888
|
if (!inBase64) {
|
|
806
889
|
if (buf[i2] == andChar) {
|
|
@@ -816,8 +899,9 @@ var require_utf7 = __commonJS({
|
|
|
816
899
|
var b64str = base64Accum + this.iconv.decode(buf.slice(lastI, i2), "ascii").replace(/,/g, "/");
|
|
817
900
|
res += this.iconv.decode(Buffer2.from(b64str, "base64"), "utf16-be");
|
|
818
901
|
}
|
|
819
|
-
if (buf[i2] != minusChar)
|
|
902
|
+
if (buf[i2] != minusChar) {
|
|
820
903
|
i2--;
|
|
904
|
+
}
|
|
821
905
|
lastI = i2 + 1;
|
|
822
906
|
inBase64 = false;
|
|
823
907
|
base64Accum = "";
|
|
@@ -839,8 +923,9 @@ var require_utf7 = __commonJS({
|
|
|
839
923
|
};
|
|
840
924
|
Utf7IMAPDecoder.prototype.end = function() {
|
|
841
925
|
var res = "";
|
|
842
|
-
if (this.inBase64 && this.base64Accum.length > 0)
|
|
926
|
+
if (this.inBase64 && this.base64Accum.length > 0) {
|
|
843
927
|
res = this.iconv.decode(Buffer2.from(this.base64Accum, "base64"), "utf16-be");
|
|
928
|
+
}
|
|
844
929
|
this.inBase64 = false;
|
|
845
930
|
this.base64Accum = "";
|
|
846
931
|
return res;
|
|
@@ -855,20 +940,24 @@ var require_sbcs_codec = __commonJS({
|
|
|
855
940
|
var Buffer2 = require_safer().Buffer;
|
|
856
941
|
exports2._sbcs = SBCSCodec;
|
|
857
942
|
function SBCSCodec(codecOptions, iconv) {
|
|
858
|
-
if (!codecOptions)
|
|
943
|
+
if (!codecOptions) {
|
|
859
944
|
throw new Error("SBCS codec is called without the data.");
|
|
860
|
-
|
|
945
|
+
}
|
|
946
|
+
if (!codecOptions.chars || codecOptions.chars.length !== 128 && codecOptions.chars.length !== 256) {
|
|
861
947
|
throw new Error("Encoding '" + codecOptions.type + "' has incorrect 'chars' (must be of len 128 or 256)");
|
|
948
|
+
}
|
|
862
949
|
if (codecOptions.chars.length === 128) {
|
|
863
950
|
var asciiString = "";
|
|
864
|
-
for (var i = 0; i < 128; i++)
|
|
951
|
+
for (var i = 0; i < 128; i++) {
|
|
865
952
|
asciiString += String.fromCharCode(i);
|
|
953
|
+
}
|
|
866
954
|
codecOptions.chars = asciiString + codecOptions.chars;
|
|
867
955
|
}
|
|
868
956
|
this.decodeBuf = Buffer2.from(codecOptions.chars, "ucs2");
|
|
869
957
|
var encodeBuf = Buffer2.alloc(65536, iconv.defaultCharSingleByte.charCodeAt(0));
|
|
870
|
-
for (var i = 0; i < codecOptions.chars.length; i++)
|
|
958
|
+
for (var i = 0; i < codecOptions.chars.length; i++) {
|
|
871
959
|
encodeBuf[codecOptions.chars.charCodeAt(i)] = i;
|
|
960
|
+
}
|
|
872
961
|
this.encodeBuf = encodeBuf;
|
|
873
962
|
}
|
|
874
963
|
SBCSCodec.prototype.encoder = SBCSEncoder;
|
|
@@ -878,8 +967,9 @@ var require_sbcs_codec = __commonJS({
|
|
|
878
967
|
}
|
|
879
968
|
SBCSEncoder.prototype.write = function(str) {
|
|
880
969
|
var buf = Buffer2.alloc(str.length);
|
|
881
|
-
for (var i = 0; i < str.length; i++)
|
|
970
|
+
for (var i = 0; i < str.length; i++) {
|
|
882
971
|
buf[i] = this.encodeBuf[str.charCodeAt(i)];
|
|
972
|
+
}
|
|
883
973
|
return buf;
|
|
884
974
|
};
|
|
885
975
|
SBCSEncoder.prototype.end = function() {
|
|
@@ -890,7 +980,8 @@ var require_sbcs_codec = __commonJS({
|
|
|
890
980
|
SBCSDecoder.prototype.write = function(buf) {
|
|
891
981
|
var decodeBuf = this.decodeBuf;
|
|
892
982
|
var newBuf = Buffer2.alloc(buf.length * 2);
|
|
893
|
-
var idx1 = 0
|
|
983
|
+
var idx1 = 0;
|
|
984
|
+
var idx2 = 0;
|
|
894
985
|
for (var i = 0; i < buf.length; i++) {
|
|
895
986
|
idx1 = buf[i] * 2;
|
|
896
987
|
idx2 = i * 2;
|
|
@@ -910,149 +1001,149 @@ var require_sbcs_data = __commonJS({
|
|
|
910
1001
|
"use strict";
|
|
911
1002
|
module2.exports = {
|
|
912
1003
|
// Not supported by iconv, not sure why.
|
|
913
|
-
|
|
914
|
-
|
|
915
|
-
|
|
916
|
-
|
|
1004
|
+
10029: "maccenteuro",
|
|
1005
|
+
maccenteuro: {
|
|
1006
|
+
type: "_sbcs",
|
|
1007
|
+
chars: "\xC4\u0100\u0101\xC9\u0104\xD6\xDC\xE1\u0105\u010C\xE4\u010D\u0106\u0107\xE9\u0179\u017A\u010E\xED\u010F\u0112\u0113\u0116\xF3\u0117\xF4\xF6\xF5\xFA\u011A\u011B\xFC\u2020\xB0\u0118\xA3\xA7\u2022\xB6\xDF\xAE\xA9\u2122\u0119\xA8\u2260\u0123\u012E\u012F\u012A\u2264\u2265\u012B\u0136\u2202\u2211\u0142\u013B\u013C\u013D\u013E\u0139\u013A\u0145\u0146\u0143\xAC\u221A\u0144\u0147\u2206\xAB\xBB\u2026\xA0\u0148\u0150\xD5\u0151\u014C\u2013\u2014\u201C\u201D\u2018\u2019\xF7\u25CA\u014D\u0154\u0155\u0158\u2039\u203A\u0159\u0156\u0157\u0160\u201A\u201E\u0161\u015A\u015B\xC1\u0164\u0165\xCD\u017D\u017E\u016A\xD3\xD4\u016B\u016E\xDA\u016F\u0170\u0171\u0172\u0173\xDD\xFD\u0137\u017B\u0141\u017C\u0122\u02C7"
|
|
917
1008
|
},
|
|
918
|
-
|
|
919
|
-
|
|
920
|
-
|
|
921
|
-
|
|
922
|
-
|
|
1009
|
+
808: "cp808",
|
|
1010
|
+
ibm808: "cp808",
|
|
1011
|
+
cp808: {
|
|
1012
|
+
type: "_sbcs",
|
|
1013
|
+
chars: "\u0410\u0411\u0412\u0413\u0414\u0415\u0416\u0417\u0418\u0419\u041A\u041B\u041C\u041D\u041E\u041F\u0420\u0421\u0422\u0423\u0424\u0425\u0426\u0427\u0428\u0429\u042A\u042B\u042C\u042D\u042E\u042F\u0430\u0431\u0432\u0433\u0434\u0435\u0436\u0437\u0438\u0439\u043A\u043B\u043C\u043D\u043E\u043F\u2591\u2592\u2593\u2502\u2524\u2561\u2562\u2556\u2555\u2563\u2551\u2557\u255D\u255C\u255B\u2510\u2514\u2534\u252C\u251C\u2500\u253C\u255E\u255F\u255A\u2554\u2569\u2566\u2560\u2550\u256C\u2567\u2568\u2564\u2565\u2559\u2558\u2552\u2553\u256B\u256A\u2518\u250C\u2588\u2584\u258C\u2590\u2580\u0440\u0441\u0442\u0443\u0444\u0445\u0446\u0447\u0448\u0449\u044A\u044B\u044C\u044D\u044E\u044F\u0401\u0451\u0404\u0454\u0407\u0457\u040E\u045E\xB0\u2219\xB7\u221A\u2116\u20AC\u25A0\xA0"
|
|
923
1014
|
},
|
|
924
|
-
|
|
925
|
-
|
|
926
|
-
|
|
1015
|
+
mik: {
|
|
1016
|
+
type: "_sbcs",
|
|
1017
|
+
chars: "\u0410\u0411\u0412\u0413\u0414\u0415\u0416\u0417\u0418\u0419\u041A\u041B\u041C\u041D\u041E\u041F\u0420\u0421\u0422\u0423\u0424\u0425\u0426\u0427\u0428\u0429\u042A\u042B\u042C\u042D\u042E\u042F\u0430\u0431\u0432\u0433\u0434\u0435\u0436\u0437\u0438\u0439\u043A\u043B\u043C\u043D\u043E\u043F\u0440\u0441\u0442\u0443\u0444\u0445\u0446\u0447\u0448\u0449\u044A\u044B\u044C\u044D\u044E\u044F\u2514\u2534\u252C\u251C\u2500\u253C\u2563\u2551\u255A\u2554\u2569\u2566\u2560\u2550\u256C\u2510\u2591\u2592\u2593\u2502\u2524\u2116\xA7\u2557\u255D\u2518\u250C\u2588\u2584\u258C\u2590\u2580\u03B1\xDF\u0393\u03C0\u03A3\u03C3\xB5\u03C4\u03A6\u0398\u03A9\u03B4\u221E\u03C6\u03B5\u2229\u2261\xB1\u2265\u2264\u2320\u2321\xF7\u2248\xB0\u2219\xB7\u221A\u207F\xB2\u25A0\xA0"
|
|
927
1018
|
},
|
|
928
|
-
|
|
929
|
-
|
|
930
|
-
|
|
1019
|
+
cp720: {
|
|
1020
|
+
type: "_sbcs",
|
|
1021
|
+
chars: "\x80\x81\xE9\xE2\x84\xE0\x86\xE7\xEA\xEB\xE8\xEF\xEE\x8D\x8E\x8F\x90\u0651\u0652\xF4\xA4\u0640\xFB\xF9\u0621\u0622\u0623\u0624\xA3\u0625\u0626\u0627\u0628\u0629\u062A\u062B\u062C\u062D\u062E\u062F\u0630\u0631\u0632\u0633\u0634\u0635\xAB\xBB\u2591\u2592\u2593\u2502\u2524\u2561\u2562\u2556\u2555\u2563\u2551\u2557\u255D\u255C\u255B\u2510\u2514\u2534\u252C\u251C\u2500\u253C\u255E\u255F\u255A\u2554\u2569\u2566\u2560\u2550\u256C\u2567\u2568\u2564\u2565\u2559\u2558\u2552\u2553\u256B\u256A\u2518\u250C\u2588\u2584\u258C\u2590\u2580\u0636\u0637\u0638\u0639\u063A\u0641\xB5\u0642\u0643\u0644\u0645\u0646\u0647\u0648\u0649\u064A\u2261\u064B\u064C\u064D\u064E\u064F\u0650\u2248\xB0\u2219\xB7\u221A\u207F\xB2\u25A0\xA0"
|
|
931
1022
|
},
|
|
932
1023
|
// Aliases of generated encodings.
|
|
933
|
-
|
|
934
|
-
|
|
935
|
-
|
|
936
|
-
|
|
937
|
-
|
|
938
|
-
|
|
939
|
-
|
|
940
|
-
|
|
941
|
-
|
|
942
|
-
|
|
943
|
-
|
|
944
|
-
|
|
945
|
-
|
|
946
|
-
|
|
947
|
-
|
|
948
|
-
|
|
949
|
-
|
|
950
|
-
|
|
951
|
-
|
|
952
|
-
|
|
953
|
-
|
|
954
|
-
|
|
955
|
-
|
|
956
|
-
|
|
957
|
-
|
|
958
|
-
|
|
959
|
-
|
|
960
|
-
|
|
961
|
-
|
|
962
|
-
|
|
963
|
-
|
|
964
|
-
|
|
965
|
-
|
|
966
|
-
|
|
967
|
-
|
|
968
|
-
|
|
969
|
-
|
|
970
|
-
|
|
971
|
-
|
|
972
|
-
|
|
973
|
-
|
|
974
|
-
|
|
975
|
-
|
|
976
|
-
|
|
977
|
-
|
|
978
|
-
|
|
979
|
-
|
|
980
|
-
|
|
981
|
-
|
|
982
|
-
|
|
983
|
-
|
|
984
|
-
|
|
985
|
-
|
|
986
|
-
|
|
987
|
-
|
|
988
|
-
|
|
989
|
-
|
|
990
|
-
|
|
991
|
-
|
|
992
|
-
|
|
993
|
-
|
|
994
|
-
|
|
995
|
-
|
|
996
|
-
|
|
997
|
-
|
|
998
|
-
|
|
999
|
-
|
|
1000
|
-
|
|
1001
|
-
|
|
1002
|
-
|
|
1003
|
-
|
|
1004
|
-
|
|
1005
|
-
|
|
1006
|
-
|
|
1007
|
-
|
|
1008
|
-
|
|
1009
|
-
|
|
1010
|
-
|
|
1011
|
-
|
|
1012
|
-
|
|
1013
|
-
|
|
1014
|
-
|
|
1015
|
-
|
|
1016
|
-
|
|
1017
|
-
|
|
1018
|
-
|
|
1019
|
-
|
|
1020
|
-
|
|
1021
|
-
|
|
1022
|
-
|
|
1023
|
-
|
|
1024
|
-
|
|
1025
|
-
|
|
1026
|
-
|
|
1027
|
-
|
|
1028
|
-
|
|
1029
|
-
|
|
1030
|
-
|
|
1031
|
-
|
|
1032
|
-
|
|
1033
|
-
|
|
1034
|
-
|
|
1035
|
-
|
|
1036
|
-
|
|
1037
|
-
|
|
1038
|
-
|
|
1039
|
-
|
|
1040
|
-
|
|
1041
|
-
|
|
1042
|
-
|
|
1043
|
-
|
|
1044
|
-
|
|
1045
|
-
|
|
1046
|
-
|
|
1047
|
-
|
|
1048
|
-
|
|
1049
|
-
|
|
1050
|
-
|
|
1051
|
-
|
|
1052
|
-
|
|
1053
|
-
|
|
1054
|
-
|
|
1055
|
-
|
|
1024
|
+
ascii8bit: "ascii",
|
|
1025
|
+
usascii: "ascii",
|
|
1026
|
+
ansix34: "ascii",
|
|
1027
|
+
ansix341968: "ascii",
|
|
1028
|
+
ansix341986: "ascii",
|
|
1029
|
+
csascii: "ascii",
|
|
1030
|
+
cp367: "ascii",
|
|
1031
|
+
ibm367: "ascii",
|
|
1032
|
+
isoir6: "ascii",
|
|
1033
|
+
iso646us: "ascii",
|
|
1034
|
+
iso646irv: "ascii",
|
|
1035
|
+
us: "ascii",
|
|
1036
|
+
latin1: "iso88591",
|
|
1037
|
+
latin2: "iso88592",
|
|
1038
|
+
latin3: "iso88593",
|
|
1039
|
+
latin4: "iso88594",
|
|
1040
|
+
latin5: "iso88599",
|
|
1041
|
+
latin6: "iso885910",
|
|
1042
|
+
latin7: "iso885913",
|
|
1043
|
+
latin8: "iso885914",
|
|
1044
|
+
latin9: "iso885915",
|
|
1045
|
+
latin10: "iso885916",
|
|
1046
|
+
csisolatin1: "iso88591",
|
|
1047
|
+
csisolatin2: "iso88592",
|
|
1048
|
+
csisolatin3: "iso88593",
|
|
1049
|
+
csisolatin4: "iso88594",
|
|
1050
|
+
csisolatincyrillic: "iso88595",
|
|
1051
|
+
csisolatinarabic: "iso88596",
|
|
1052
|
+
csisolatingreek: "iso88597",
|
|
1053
|
+
csisolatinhebrew: "iso88598",
|
|
1054
|
+
csisolatin5: "iso88599",
|
|
1055
|
+
csisolatin6: "iso885910",
|
|
1056
|
+
l1: "iso88591",
|
|
1057
|
+
l2: "iso88592",
|
|
1058
|
+
l3: "iso88593",
|
|
1059
|
+
l4: "iso88594",
|
|
1060
|
+
l5: "iso88599",
|
|
1061
|
+
l6: "iso885910",
|
|
1062
|
+
l7: "iso885913",
|
|
1063
|
+
l8: "iso885914",
|
|
1064
|
+
l9: "iso885915",
|
|
1065
|
+
l10: "iso885916",
|
|
1066
|
+
isoir14: "iso646jp",
|
|
1067
|
+
isoir57: "iso646cn",
|
|
1068
|
+
isoir100: "iso88591",
|
|
1069
|
+
isoir101: "iso88592",
|
|
1070
|
+
isoir109: "iso88593",
|
|
1071
|
+
isoir110: "iso88594",
|
|
1072
|
+
isoir144: "iso88595",
|
|
1073
|
+
isoir127: "iso88596",
|
|
1074
|
+
isoir126: "iso88597",
|
|
1075
|
+
isoir138: "iso88598",
|
|
1076
|
+
isoir148: "iso88599",
|
|
1077
|
+
isoir157: "iso885910",
|
|
1078
|
+
isoir166: "tis620",
|
|
1079
|
+
isoir179: "iso885913",
|
|
1080
|
+
isoir199: "iso885914",
|
|
1081
|
+
isoir203: "iso885915",
|
|
1082
|
+
isoir226: "iso885916",
|
|
1083
|
+
cp819: "iso88591",
|
|
1084
|
+
ibm819: "iso88591",
|
|
1085
|
+
cyrillic: "iso88595",
|
|
1086
|
+
arabic: "iso88596",
|
|
1087
|
+
arabic8: "iso88596",
|
|
1088
|
+
ecma114: "iso88596",
|
|
1089
|
+
asmo708: "iso88596",
|
|
1090
|
+
greek: "iso88597",
|
|
1091
|
+
greek8: "iso88597",
|
|
1092
|
+
ecma118: "iso88597",
|
|
1093
|
+
elot928: "iso88597",
|
|
1094
|
+
hebrew: "iso88598",
|
|
1095
|
+
hebrew8: "iso88598",
|
|
1096
|
+
turkish: "iso88599",
|
|
1097
|
+
turkish8: "iso88599",
|
|
1098
|
+
thai: "iso885911",
|
|
1099
|
+
thai8: "iso885911",
|
|
1100
|
+
celtic: "iso885914",
|
|
1101
|
+
celtic8: "iso885914",
|
|
1102
|
+
isoceltic: "iso885914",
|
|
1103
|
+
tis6200: "tis620",
|
|
1104
|
+
tis62025291: "tis620",
|
|
1105
|
+
tis62025330: "tis620",
|
|
1106
|
+
1e4: "macroman",
|
|
1107
|
+
10006: "macgreek",
|
|
1108
|
+
10007: "maccyrillic",
|
|
1109
|
+
10079: "maciceland",
|
|
1110
|
+
10081: "macturkish",
|
|
1111
|
+
cspc8codepage437: "cp437",
|
|
1112
|
+
cspc775baltic: "cp775",
|
|
1113
|
+
cspc850multilingual: "cp850",
|
|
1114
|
+
cspcp852: "cp852",
|
|
1115
|
+
cspc862latinhebrew: "cp862",
|
|
1116
|
+
cpgr: "cp869",
|
|
1117
|
+
msee: "cp1250",
|
|
1118
|
+
mscyrl: "cp1251",
|
|
1119
|
+
msansi: "cp1252",
|
|
1120
|
+
msgreek: "cp1253",
|
|
1121
|
+
msturk: "cp1254",
|
|
1122
|
+
mshebr: "cp1255",
|
|
1123
|
+
msarab: "cp1256",
|
|
1124
|
+
winbaltrim: "cp1257",
|
|
1125
|
+
cp20866: "koi8r",
|
|
1126
|
+
20866: "koi8r",
|
|
1127
|
+
ibm878: "koi8r",
|
|
1128
|
+
cskoi8r: "koi8r",
|
|
1129
|
+
cp21866: "koi8u",
|
|
1130
|
+
21866: "koi8u",
|
|
1131
|
+
ibm1168: "koi8u",
|
|
1132
|
+
strk10482002: "rk1048",
|
|
1133
|
+
tcvn5712: "tcvn",
|
|
1134
|
+
tcvn57121: "tcvn",
|
|
1135
|
+
gb198880: "iso646cn",
|
|
1136
|
+
cn: "iso646cn",
|
|
1137
|
+
csiso14jisc6220ro: "iso646jp",
|
|
1138
|
+
jisc62201969ro: "iso646jp",
|
|
1139
|
+
jp: "iso646jp",
|
|
1140
|
+
cshproman8: "hproman8",
|
|
1141
|
+
r8: "hproman8",
|
|
1142
|
+
roman8: "hproman8",
|
|
1143
|
+
xroman8: "hproman8",
|
|
1144
|
+
ibm1051: "hproman8",
|
|
1145
|
+
mac: "macintosh",
|
|
1146
|
+
csmacintosh: "macintosh"
|
|
1056
1147
|
};
|
|
1057
1148
|
}
|
|
1058
1149
|
});
|
|
@@ -1524,21 +1615,25 @@ var require_dbcs_codec = __commonJS({
|
|
|
1524
1615
|
var NODE_START = -1e3;
|
|
1525
1616
|
var UNASSIGNED_NODE = new Array(256);
|
|
1526
1617
|
var DEF_CHAR = -1;
|
|
1527
|
-
for (i = 0; i < 256; i++)
|
|
1618
|
+
for (i = 0; i < 256; i++) {
|
|
1528
1619
|
UNASSIGNED_NODE[i] = UNASSIGNED;
|
|
1620
|
+
}
|
|
1529
1621
|
var i;
|
|
1530
1622
|
function DBCSCodec(codecOptions, iconv) {
|
|
1531
1623
|
this.encodingName = codecOptions.encodingName;
|
|
1532
|
-
if (!codecOptions)
|
|
1624
|
+
if (!codecOptions) {
|
|
1533
1625
|
throw new Error("DBCS codec is called without the data.");
|
|
1534
|
-
|
|
1626
|
+
}
|
|
1627
|
+
if (!codecOptions.table) {
|
|
1535
1628
|
throw new Error("Encoding '" + this.encodingName + "' has no data.");
|
|
1629
|
+
}
|
|
1536
1630
|
var mappingTable = codecOptions.table();
|
|
1537
1631
|
this.decodeTables = [];
|
|
1538
1632
|
this.decodeTables[0] = UNASSIGNED_NODE.slice(0);
|
|
1539
1633
|
this.decodeTableSeq = [];
|
|
1540
|
-
for (var i2 = 0; i2 < mappingTable.length; i2++)
|
|
1634
|
+
for (var i2 = 0; i2 < mappingTable.length; i2++) {
|
|
1541
1635
|
this._addDecodeChunk(mappingTable[i2]);
|
|
1636
|
+
}
|
|
1542
1637
|
if (typeof codecOptions.gb18030 === "function") {
|
|
1543
1638
|
this.gb18030 = codecOptions.gb18030();
|
|
1544
1639
|
var commonThirdByteNodeIdx = this.decodeTables.length;
|
|
@@ -1565,8 +1660,9 @@ var require_dbcs_codec = __commonJS({
|
|
|
1565
1660
|
}
|
|
1566
1661
|
var fourthByteNode = this.decodeTables[NODE_START - thirdByteNode[k3]];
|
|
1567
1662
|
for (var l3 = 48; l3 <= 57; l3++) {
|
|
1568
|
-
if (fourthByteNode[l3] === UNASSIGNED)
|
|
1663
|
+
if (fourthByteNode[l3] === UNASSIGNED) {
|
|
1569
1664
|
fourthByteNode[l3] = GB18030_CODE;
|
|
1665
|
+
}
|
|
1570
1666
|
}
|
|
1571
1667
|
}
|
|
1572
1668
|
}
|
|
@@ -1576,20 +1672,25 @@ var require_dbcs_codec = __commonJS({
|
|
|
1576
1672
|
this.encodeTable = [];
|
|
1577
1673
|
this.encodeTableSeq = [];
|
|
1578
1674
|
var skipEncodeChars = {};
|
|
1579
|
-
if (codecOptions.encodeSkipVals)
|
|
1675
|
+
if (codecOptions.encodeSkipVals) {
|
|
1580
1676
|
for (var i2 = 0; i2 < codecOptions.encodeSkipVals.length; i2++) {
|
|
1581
1677
|
var val = codecOptions.encodeSkipVals[i2];
|
|
1582
|
-
if (typeof val === "number")
|
|
1678
|
+
if (typeof val === "number") {
|
|
1583
1679
|
skipEncodeChars[val] = true;
|
|
1584
|
-
else
|
|
1585
|
-
for (var j2 = val.from; j2 <= val.to; j2++)
|
|
1680
|
+
} else {
|
|
1681
|
+
for (var j2 = val.from; j2 <= val.to; j2++) {
|
|
1586
1682
|
skipEncodeChars[j2] = true;
|
|
1683
|
+
}
|
|
1684
|
+
}
|
|
1587
1685
|
}
|
|
1686
|
+
}
|
|
1588
1687
|
this._fillEncodeTable(0, 0, skipEncodeChars);
|
|
1589
1688
|
if (codecOptions.encodeAdd) {
|
|
1590
|
-
for (var uChar in codecOptions.encodeAdd)
|
|
1591
|
-
if (Object.prototype.hasOwnProperty.call(codecOptions.encodeAdd, uChar))
|
|
1689
|
+
for (var uChar in codecOptions.encodeAdd) {
|
|
1690
|
+
if (Object.prototype.hasOwnProperty.call(codecOptions.encodeAdd, uChar)) {
|
|
1592
1691
|
this._setEncodeChar(uChar.charCodeAt(0), codecOptions.encodeAdd[uChar]);
|
|
1692
|
+
}
|
|
1693
|
+
}
|
|
1593
1694
|
}
|
|
1594
1695
|
this.defCharSB = this.encodeTable[0][iconv.defaultCharSingleByte.charCodeAt(0)];
|
|
1595
1696
|
if (this.defCharSB === UNASSIGNED) this.defCharSB = this.encodeTable[0]["?"];
|
|
@@ -1599,10 +1700,12 @@ var require_dbcs_codec = __commonJS({
|
|
|
1599
1700
|
DBCSCodec.prototype.decoder = DBCSDecoder;
|
|
1600
1701
|
DBCSCodec.prototype._getDecodeTrieNode = function(addr) {
|
|
1601
1702
|
var bytes = [];
|
|
1602
|
-
for (; addr > 0; addr >>>= 8)
|
|
1703
|
+
for (; addr > 0; addr >>>= 8) {
|
|
1603
1704
|
bytes.push(addr & 255);
|
|
1604
|
-
|
|
1705
|
+
}
|
|
1706
|
+
if (bytes.length == 0) {
|
|
1605
1707
|
bytes.push(0);
|
|
1708
|
+
}
|
|
1606
1709
|
var node = this.decodeTables[0];
|
|
1607
1710
|
for (var i2 = bytes.length - 1; i2 > 0; i2--) {
|
|
1608
1711
|
var val = node[bytes[i2]];
|
|
@@ -1611,8 +1714,9 @@ var require_dbcs_codec = __commonJS({
|
|
|
1611
1714
|
this.decodeTables.push(node = UNASSIGNED_NODE.slice(0));
|
|
1612
1715
|
} else if (val <= NODE_START) {
|
|
1613
1716
|
node = this.decodeTables[NODE_START - val];
|
|
1614
|
-
} else
|
|
1717
|
+
} else {
|
|
1615
1718
|
throw new Error("Overwrite byte in " + this.encodingName + ", addr: " + addr.toString(16));
|
|
1719
|
+
}
|
|
1616
1720
|
}
|
|
1617
1721
|
return node;
|
|
1618
1722
|
};
|
|
@@ -1625,45 +1729,53 @@ var require_dbcs_codec = __commonJS({
|
|
|
1625
1729
|
if (typeof part === "string") {
|
|
1626
1730
|
for (var l3 = 0; l3 < part.length; ) {
|
|
1627
1731
|
var code = part.charCodeAt(l3++);
|
|
1628
|
-
if (
|
|
1732
|
+
if (code >= 55296 && code < 56320) {
|
|
1629
1733
|
var codeTrail = part.charCodeAt(l3++);
|
|
1630
|
-
if (
|
|
1734
|
+
if (codeTrail >= 56320 && codeTrail < 57344) {
|
|
1631
1735
|
writeTable[curAddr++] = 65536 + (code - 55296) * 1024 + (codeTrail - 56320);
|
|
1632
|
-
else
|
|
1736
|
+
} else {
|
|
1633
1737
|
throw new Error("Incorrect surrogate pair in " + this.encodingName + " at chunk " + chunk[0]);
|
|
1634
|
-
|
|
1738
|
+
}
|
|
1739
|
+
} else if (code > 4080 && code <= 4095) {
|
|
1635
1740
|
var len = 4095 - code + 2;
|
|
1636
1741
|
var seq = [];
|
|
1637
|
-
for (var m2 = 0; m2 < len; m2++)
|
|
1742
|
+
for (var m2 = 0; m2 < len; m2++) {
|
|
1638
1743
|
seq.push(part.charCodeAt(l3++));
|
|
1744
|
+
}
|
|
1639
1745
|
writeTable[curAddr++] = SEQ_START - this.decodeTableSeq.length;
|
|
1640
1746
|
this.decodeTableSeq.push(seq);
|
|
1641
|
-
} else
|
|
1747
|
+
} else {
|
|
1642
1748
|
writeTable[curAddr++] = code;
|
|
1749
|
+
}
|
|
1643
1750
|
}
|
|
1644
1751
|
} else if (typeof part === "number") {
|
|
1645
1752
|
var charCode = writeTable[curAddr - 1] + 1;
|
|
1646
|
-
for (var l3 = 0; l3 < part; l3++)
|
|
1753
|
+
for (var l3 = 0; l3 < part; l3++) {
|
|
1647
1754
|
writeTable[curAddr++] = charCode++;
|
|
1648
|
-
|
|
1755
|
+
}
|
|
1756
|
+
} else {
|
|
1649
1757
|
throw new Error("Incorrect type '" + typeof part + "' given in " + this.encodingName + " at chunk " + chunk[0]);
|
|
1758
|
+
}
|
|
1650
1759
|
}
|
|
1651
|
-
if (curAddr > 255)
|
|
1760
|
+
if (curAddr > 255) {
|
|
1652
1761
|
throw new Error("Incorrect chunk in " + this.encodingName + " at addr " + chunk[0] + ": too long" + curAddr);
|
|
1762
|
+
}
|
|
1653
1763
|
};
|
|
1654
1764
|
DBCSCodec.prototype._getEncodeBucket = function(uCode) {
|
|
1655
1765
|
var high = uCode >> 8;
|
|
1656
|
-
if (this.encodeTable[high] === void 0)
|
|
1766
|
+
if (this.encodeTable[high] === void 0) {
|
|
1657
1767
|
this.encodeTable[high] = UNASSIGNED_NODE.slice(0);
|
|
1768
|
+
}
|
|
1658
1769
|
return this.encodeTable[high];
|
|
1659
1770
|
};
|
|
1660
1771
|
DBCSCodec.prototype._setEncodeChar = function(uCode, dbcsCode) {
|
|
1661
1772
|
var bucket = this._getEncodeBucket(uCode);
|
|
1662
1773
|
var low = uCode & 255;
|
|
1663
|
-
if (bucket[low] <= SEQ_START)
|
|
1774
|
+
if (bucket[low] <= SEQ_START) {
|
|
1664
1775
|
this.encodeTableSeq[SEQ_START - bucket[low]][DEF_CHAR] = dbcsCode;
|
|
1665
|
-
else if (bucket[low] == UNASSIGNED)
|
|
1776
|
+
} else if (bucket[low] == UNASSIGNED) {
|
|
1666
1777
|
bucket[low] = dbcsCode;
|
|
1778
|
+
}
|
|
1667
1779
|
};
|
|
1668
1780
|
DBCSCodec.prototype._setEncodeSequence = function(seq, dbcsCode) {
|
|
1669
1781
|
var uCode = seq[0];
|
|
@@ -1680,12 +1792,13 @@ var require_dbcs_codec = __commonJS({
|
|
|
1680
1792
|
}
|
|
1681
1793
|
for (var j2 = 1; j2 < seq.length - 1; j2++) {
|
|
1682
1794
|
var oldVal = node[uCode];
|
|
1683
|
-
if (typeof oldVal === "object")
|
|
1795
|
+
if (typeof oldVal === "object") {
|
|
1684
1796
|
node = oldVal;
|
|
1685
|
-
else {
|
|
1797
|
+
} else {
|
|
1686
1798
|
node = node[uCode] = {};
|
|
1687
|
-
if (oldVal !== void 0)
|
|
1799
|
+
if (oldVal !== void 0) {
|
|
1688
1800
|
node[DEF_CHAR] = oldVal;
|
|
1801
|
+
}
|
|
1689
1802
|
}
|
|
1690
1803
|
}
|
|
1691
1804
|
uCode = seq[seq.length - 1];
|
|
@@ -1698,8 +1811,9 @@ var require_dbcs_codec = __commonJS({
|
|
|
1698
1811
|
for (var i2 = 0; i2 < 256; i2++) {
|
|
1699
1812
|
var uCode = node[i2];
|
|
1700
1813
|
var mbCode = prefix + i2;
|
|
1701
|
-
if (skipEncodeChars[mbCode])
|
|
1814
|
+
if (skipEncodeChars[mbCode]) {
|
|
1702
1815
|
continue;
|
|
1816
|
+
}
|
|
1703
1817
|
if (uCode >= 0) {
|
|
1704
1818
|
this._setEncodeChar(uCode, mbCode);
|
|
1705
1819
|
hasValues = true;
|
|
@@ -1707,10 +1821,11 @@ var require_dbcs_codec = __commonJS({
|
|
|
1707
1821
|
var subNodeIdx = NODE_START - uCode;
|
|
1708
1822
|
if (!subNodeEmpty[subNodeIdx]) {
|
|
1709
1823
|
var newPrefix = mbCode << 8 >>> 0;
|
|
1710
|
-
if (this._fillEncodeTable(subNodeIdx, newPrefix, skipEncodeChars))
|
|
1824
|
+
if (this._fillEncodeTable(subNodeIdx, newPrefix, skipEncodeChars)) {
|
|
1711
1825
|
hasValues = true;
|
|
1712
|
-
else
|
|
1826
|
+
} else {
|
|
1713
1827
|
subNodeEmpty[subNodeIdx] = true;
|
|
1828
|
+
}
|
|
1714
1829
|
}
|
|
1715
1830
|
} else if (uCode <= SEQ_START) {
|
|
1716
1831
|
this._setEncodeSequence(this.decodeTableSeq[SEQ_START - uCode], mbCode);
|
|
@@ -1728,7 +1843,12 @@ var require_dbcs_codec = __commonJS({
|
|
|
1728
1843
|
this.gb18030 = codec.gb18030;
|
|
1729
1844
|
}
|
|
1730
1845
|
DBCSEncoder.prototype.write = function(str) {
|
|
1731
|
-
var newBuf = Buffer2.alloc(str.length * (this.gb18030 ? 4 : 3))
|
|
1846
|
+
var newBuf = Buffer2.alloc(str.length * (this.gb18030 ? 4 : 3));
|
|
1847
|
+
var leadSurrogate = this.leadSurrogate;
|
|
1848
|
+
var seqObj = this.seqObj;
|
|
1849
|
+
var nextChar = -1;
|
|
1850
|
+
var i2 = 0;
|
|
1851
|
+
var j2 = 0;
|
|
1732
1852
|
while (true) {
|
|
1733
1853
|
if (nextChar === -1) {
|
|
1734
1854
|
if (i2 == str.length) break;
|
|
@@ -1737,7 +1857,7 @@ var require_dbcs_codec = __commonJS({
|
|
|
1737
1857
|
var uCode = nextChar;
|
|
1738
1858
|
nextChar = -1;
|
|
1739
1859
|
}
|
|
1740
|
-
if (
|
|
1860
|
+
if (uCode >= 55296 && uCode < 57344) {
|
|
1741
1861
|
if (uCode < 56320) {
|
|
1742
1862
|
if (leadSurrogate === -1) {
|
|
1743
1863
|
leadSurrogate = uCode;
|
|
@@ -1765,7 +1885,7 @@ var require_dbcs_codec = __commonJS({
|
|
|
1765
1885
|
if (typeof resCode === "object") {
|
|
1766
1886
|
seqObj = resCode;
|
|
1767
1887
|
continue;
|
|
1768
|
-
} else if (typeof resCode
|
|
1888
|
+
} else if (typeof resCode === "number") {
|
|
1769
1889
|
dbcsCode = resCode;
|
|
1770
1890
|
} else if (resCode == void 0) {
|
|
1771
1891
|
resCode = seqObj[DEF_CHAR];
|
|
@@ -1778,8 +1898,9 @@ var require_dbcs_codec = __commonJS({
|
|
|
1778
1898
|
seqObj = void 0;
|
|
1779
1899
|
} else if (uCode >= 0) {
|
|
1780
1900
|
var subtable = this.encodeTable[uCode >> 8];
|
|
1781
|
-
if (subtable !== void 0)
|
|
1901
|
+
if (subtable !== void 0) {
|
|
1782
1902
|
dbcsCode = subtable[uCode & 255];
|
|
1903
|
+
}
|
|
1783
1904
|
if (dbcsCode <= SEQ_START) {
|
|
1784
1905
|
seqObj = this.encodeTableSeq[SEQ_START - dbcsCode];
|
|
1785
1906
|
continue;
|
|
@@ -1799,8 +1920,9 @@ var require_dbcs_codec = __commonJS({
|
|
|
1799
1920
|
}
|
|
1800
1921
|
}
|
|
1801
1922
|
}
|
|
1802
|
-
if (dbcsCode === UNASSIGNED)
|
|
1923
|
+
if (dbcsCode === UNASSIGNED) {
|
|
1803
1924
|
dbcsCode = this.defaultCharSingleByte;
|
|
1925
|
+
}
|
|
1804
1926
|
if (dbcsCode < 256) {
|
|
1805
1927
|
newBuf[j2++] = dbcsCode;
|
|
1806
1928
|
} else if (dbcsCode < 65536) {
|
|
@@ -1822,9 +1944,11 @@ var require_dbcs_codec = __commonJS({
|
|
|
1822
1944
|
return newBuf.slice(0, j2);
|
|
1823
1945
|
};
|
|
1824
1946
|
DBCSEncoder.prototype.end = function() {
|
|
1825
|
-
if (this.leadSurrogate === -1 && this.seqObj === void 0)
|
|
1947
|
+
if (this.leadSurrogate === -1 && this.seqObj === void 0) {
|
|
1826
1948
|
return;
|
|
1827
|
-
|
|
1949
|
+
}
|
|
1950
|
+
var newBuf = Buffer2.alloc(10);
|
|
1951
|
+
var j2 = 0;
|
|
1828
1952
|
if (this.seqObj) {
|
|
1829
1953
|
var dbcsCode = this.seqObj[DEF_CHAR];
|
|
1830
1954
|
if (dbcsCode !== void 0) {
|
|
@@ -1854,7 +1978,12 @@ var require_dbcs_codec = __commonJS({
|
|
|
1854
1978
|
this.gb18030 = codec.gb18030;
|
|
1855
1979
|
}
|
|
1856
1980
|
DBCSDecoder.prototype.write = function(buf) {
|
|
1857
|
-
var newBuf = Buffer2.alloc(buf.length * 2)
|
|
1981
|
+
var newBuf = Buffer2.alloc(buf.length * 2);
|
|
1982
|
+
var nodeIdx = this.nodeIdx;
|
|
1983
|
+
var prevBytes = this.prevBytes;
|
|
1984
|
+
var prevOffset = this.prevBytes.length;
|
|
1985
|
+
var seqStart = -this.prevBytes.length;
|
|
1986
|
+
var uCode;
|
|
1858
1987
|
for (var i2 = 0, j2 = 0; i2 < buf.length; i2++) {
|
|
1859
1988
|
var curByte = i2 >= 0 ? buf[i2] : prevBytes[i2 + prevOffset];
|
|
1860
1989
|
var uCode = this.decodeTables[nodeIdx][curByte];
|
|
@@ -1881,8 +2010,9 @@ var require_dbcs_codec = __commonJS({
|
|
|
1881
2010
|
newBuf[j2++] = uCode >> 8;
|
|
1882
2011
|
}
|
|
1883
2012
|
uCode = seq[seq.length - 1];
|
|
1884
|
-
} else
|
|
2013
|
+
} else {
|
|
1885
2014
|
throw new Error("iconv-lite internal error: invalid decoding table value " + uCode + " at " + nodeIdx + "/" + curByte);
|
|
2015
|
+
}
|
|
1886
2016
|
if (uCode >= 65536) {
|
|
1887
2017
|
uCode -= 65536;
|
|
1888
2018
|
var uCodeLead = 55296 | uCode >> 10;
|
|
@@ -1906,23 +2036,27 @@ var require_dbcs_codec = __commonJS({
|
|
|
1906
2036
|
var bytesArr = this.prevBytes.slice(1);
|
|
1907
2037
|
this.prevBytes = [];
|
|
1908
2038
|
this.nodeIdx = 0;
|
|
1909
|
-
if (bytesArr.length > 0)
|
|
2039
|
+
if (bytesArr.length > 0) {
|
|
1910
2040
|
ret += this.write(bytesArr);
|
|
2041
|
+
}
|
|
1911
2042
|
}
|
|
1912
2043
|
this.prevBytes = [];
|
|
1913
2044
|
this.nodeIdx = 0;
|
|
1914
2045
|
return ret;
|
|
1915
2046
|
};
|
|
1916
2047
|
function findIdx(table, val) {
|
|
1917
|
-
if (table[0] > val)
|
|
2048
|
+
if (table[0] > val) {
|
|
1918
2049
|
return -1;
|
|
1919
|
-
|
|
2050
|
+
}
|
|
2051
|
+
var l3 = 0;
|
|
2052
|
+
var r6 = table.length;
|
|
1920
2053
|
while (l3 < r6 - 1) {
|
|
1921
2054
|
var mid = l3 + (r6 - l3 + 1 >> 1);
|
|
1922
|
-
if (table[mid] <= val)
|
|
2055
|
+
if (table[mid] <= val) {
|
|
1923
2056
|
l3 = mid;
|
|
1924
|
-
else
|
|
2057
|
+
} else {
|
|
1925
2058
|
r6 = mid;
|
|
2059
|
+
}
|
|
1926
2060
|
}
|
|
1927
2061
|
return l3;
|
|
1928
2062
|
}
|
|
@@ -3185,7 +3319,7 @@ var require_dbcs_data = __commonJS({
|
|
|
3185
3319
|
// == Japanese/ShiftJIS ====================================================
|
|
3186
3320
|
// All japanese encodings are based on JIS X set of standards:
|
|
3187
3321
|
// JIS X 0201 - Single-byte encoding of ASCII + ¥ + Kana chars at 0xA1-0xDF.
|
|
3188
|
-
// JIS X 0208 - Main set of 6879 characters, placed in 94x94 plane, to be encoded by 2 bytes.
|
|
3322
|
+
// JIS X 0208 - Main set of 6879 characters, placed in 94x94 plane, to be encoded by 2 bytes.
|
|
3189
3323
|
// Has several variations in 1978, 1983, 1990 and 1997.
|
|
3190
3324
|
// JIS X 0212 - Supplementary plane of 6067 chars in 94x94 plane. 1990. Effectively dead.
|
|
3191
3325
|
// JIS X 0213 - Extension and modern replacement of 0208 and 0212. Total chars: 11233.
|
|
@@ -3202,7 +3336,7 @@ var require_dbcs_data = __commonJS({
|
|
|
3202
3336
|
// 0x8F, (0xA1-0xFE)x2 - 0212 plane (94x94).
|
|
3203
3337
|
// * JIS X 208: 7-bit, direct encoding of 0208. Byte ranges: 0x21-0x7E (94 values). Uncommon.
|
|
3204
3338
|
// Used as-is in ISO2022 family.
|
|
3205
|
-
// * ISO2022-JP: Stateful encoding, with escape sequences to switch between ASCII,
|
|
3339
|
+
// * ISO2022-JP: Stateful encoding, with escape sequences to switch between ASCII,
|
|
3206
3340
|
// 0201-1976 Roman, 0208-1978, 0208-1983.
|
|
3207
3341
|
// * ISO2022-JP-1: Adds esc seq for 0212-1990.
|
|
3208
3342
|
// * ISO2022-JP-2: Adds esc seq for GB2313-1980, KSX1001-1992, ISO8859-1, ISO8859-7.
|
|
@@ -3212,7 +3346,7 @@ var require_dbcs_data = __commonJS({
|
|
|
3212
3346
|
// After JIS X 0213 appeared, Shift_JIS-2004, EUC-JISX0213 and ISO2022-JP-2004 followed, with just changing the planes.
|
|
3213
3347
|
//
|
|
3214
3348
|
// Overall, it seems that it's a mess :( http://www8.plala.or.jp/tkubota1/unicode-symbols-map2.html
|
|
3215
|
-
|
|
3349
|
+
shiftjis: {
|
|
3216
3350
|
type: "_dbcs",
|
|
3217
3351
|
table: function() {
|
|
3218
3352
|
return require_shiftjis();
|
|
@@ -3220,17 +3354,17 @@ var require_dbcs_data = __commonJS({
|
|
|
3220
3354
|
encodeAdd: { "\xA5": 92, "\u203E": 126 },
|
|
3221
3355
|
encodeSkipVals: [{ from: 60736, to: 63808 }]
|
|
3222
3356
|
},
|
|
3223
|
-
|
|
3224
|
-
|
|
3225
|
-
|
|
3226
|
-
|
|
3227
|
-
|
|
3228
|
-
|
|
3229
|
-
|
|
3230
|
-
|
|
3231
|
-
|
|
3232
|
-
|
|
3233
|
-
|
|
3357
|
+
csshiftjis: "shiftjis",
|
|
3358
|
+
mskanji: "shiftjis",
|
|
3359
|
+
sjis: "shiftjis",
|
|
3360
|
+
windows31j: "shiftjis",
|
|
3361
|
+
ms31j: "shiftjis",
|
|
3362
|
+
xsjis: "shiftjis",
|
|
3363
|
+
windows932: "shiftjis",
|
|
3364
|
+
ms932: "shiftjis",
|
|
3365
|
+
932: "shiftjis",
|
|
3366
|
+
cp932: "shiftjis",
|
|
3367
|
+
eucjp: {
|
|
3234
3368
|
type: "_dbcs",
|
|
3235
3369
|
table: function() {
|
|
3236
3370
|
return require_eucjp();
|
|
@@ -3244,37 +3378,37 @@ var require_dbcs_data = __commonJS({
|
|
|
3244
3378
|
// http://en.wikipedia.org/wiki/GBK
|
|
3245
3379
|
// We mostly implement W3C recommendation: https://www.w3.org/TR/encoding/#gbk-encoder
|
|
3246
3380
|
// Oldest GB2312 (1981, ~7600 chars) is a subset of CP936
|
|
3247
|
-
|
|
3248
|
-
|
|
3249
|
-
|
|
3250
|
-
|
|
3251
|
-
|
|
3252
|
-
|
|
3381
|
+
gb2312: "cp936",
|
|
3382
|
+
gb231280: "cp936",
|
|
3383
|
+
gb23121980: "cp936",
|
|
3384
|
+
csgb2312: "cp936",
|
|
3385
|
+
csiso58gb231280: "cp936",
|
|
3386
|
+
euccn: "cp936",
|
|
3253
3387
|
// Microsoft's CP936 is a subset and approximation of GBK.
|
|
3254
|
-
|
|
3255
|
-
|
|
3256
|
-
|
|
3257
|
-
|
|
3388
|
+
windows936: "cp936",
|
|
3389
|
+
ms936: "cp936",
|
|
3390
|
+
936: "cp936",
|
|
3391
|
+
cp936: {
|
|
3258
3392
|
type: "_dbcs",
|
|
3259
3393
|
table: function() {
|
|
3260
3394
|
return require_cp936();
|
|
3261
3395
|
}
|
|
3262
3396
|
},
|
|
3263
3397
|
// GBK (~22000 chars) is an extension of CP936 that added user-mapped chars and some other.
|
|
3264
|
-
|
|
3398
|
+
gbk: {
|
|
3265
3399
|
type: "_dbcs",
|
|
3266
3400
|
table: function() {
|
|
3267
3401
|
return require_cp936().concat(require_gbk_added());
|
|
3268
3402
|
}
|
|
3269
3403
|
},
|
|
3270
|
-
|
|
3271
|
-
|
|
3404
|
+
xgbk: "gbk",
|
|
3405
|
+
isoir58: "gbk",
|
|
3272
3406
|
// GB18030 is an algorithmic extension of GBK.
|
|
3273
3407
|
// Main source: https://www.w3.org/TR/encoding/#gbk-encoder
|
|
3274
3408
|
// http://icu-project.org/docs/papers/gb18030.html
|
|
3275
3409
|
// http://source.icu-project.org/repos/icu/data/trunk/charset/data/xml/gb-18030-2000.xml
|
|
3276
3410
|
// http://www.khngai.com/chinese/charmap/tblgbk.php?page=0
|
|
3277
|
-
|
|
3411
|
+
gb18030: {
|
|
3278
3412
|
type: "_dbcs",
|
|
3279
3413
|
table: function() {
|
|
3280
3414
|
return require_cp936().concat(require_gbk_added());
|
|
@@ -3285,26 +3419,26 @@ var require_dbcs_data = __commonJS({
|
|
|
3285
3419
|
encodeSkipVals: [128],
|
|
3286
3420
|
encodeAdd: { "\u20AC": 41699 }
|
|
3287
3421
|
},
|
|
3288
|
-
|
|
3422
|
+
chinese: "gb18030",
|
|
3289
3423
|
// == Korean ===============================================================
|
|
3290
3424
|
// EUC-KR, KS_C_5601 and KS X 1001 are exactly the same.
|
|
3291
|
-
|
|
3292
|
-
|
|
3293
|
-
|
|
3294
|
-
|
|
3425
|
+
windows949: "cp949",
|
|
3426
|
+
ms949: "cp949",
|
|
3427
|
+
949: "cp949",
|
|
3428
|
+
cp949: {
|
|
3295
3429
|
type: "_dbcs",
|
|
3296
3430
|
table: function() {
|
|
3297
3431
|
return require_cp949();
|
|
3298
3432
|
}
|
|
3299
3433
|
},
|
|
3300
|
-
|
|
3301
|
-
|
|
3302
|
-
|
|
3303
|
-
|
|
3304
|
-
|
|
3305
|
-
|
|
3306
|
-
|
|
3307
|
-
|
|
3434
|
+
cseuckr: "cp949",
|
|
3435
|
+
csksc56011987: "cp949",
|
|
3436
|
+
euckr: "cp949",
|
|
3437
|
+
isoir149: "cp949",
|
|
3438
|
+
korean: "cp949",
|
|
3439
|
+
ksc56011987: "cp949",
|
|
3440
|
+
ksc56011989: "cp949",
|
|
3441
|
+
ksc5601: "cp949",
|
|
3308
3442
|
// == Big5/Taiwan/Hong Kong ================================================
|
|
3309
3443
|
// There are lots of tables for Big5 and cp950. Please see the following links for history:
|
|
3310
3444
|
// http://moztw.org/docs/big5/ http://www.haible.de/bruno/charsets/conversion-tables/Big5.html
|
|
@@ -3313,7 +3447,7 @@ var require_dbcs_data = __commonJS({
|
|
|
3313
3447
|
// * Windows CP 951: Microsoft variant of Big5-HKSCS-2001. Seems to be never public. http://me.abelcheung.org/articles/research/what-is-cp951/
|
|
3314
3448
|
// * Big5-2003 (Taiwan standard) almost superset of cp950.
|
|
3315
3449
|
// * Unicode-at-on (UAO) / Mozilla 1.8. Falling out of use on the Web. Not supported by other browsers.
|
|
3316
|
-
// * Big5-HKSCS (-2001, -2004, -2008). Hong Kong standard.
|
|
3450
|
+
// * Big5-HKSCS (-2001, -2004, -2008). Hong Kong standard.
|
|
3317
3451
|
// many unicode code points moved from PUA to Supplementary plane (U+2XXXX) over the years.
|
|
3318
3452
|
// Plus, it has 4 combining sequences.
|
|
3319
3453
|
// Seems that Mozilla refused to support it for 10 yrs. https://bugzilla.mozilla.org/show_bug.cgi?id=162431 https://bugzilla.mozilla.org/show_bug.cgi?id=310299
|
|
@@ -3324,21 +3458,21 @@ var require_dbcs_data = __commonJS({
|
|
|
3324
3458
|
// In the encoder, it might make sense to support encoding old PUA mappings to Big5 bytes seq-s.
|
|
3325
3459
|
// Official spec: http://www.ogcio.gov.hk/en/business/tech_promotion/ccli/terms/doc/2003cmp_2008.txt
|
|
3326
3460
|
// http://www.ogcio.gov.hk/tc/business/tech_promotion/ccli/terms/doc/hkscs-2008-big5-iso.txt
|
|
3327
|
-
//
|
|
3461
|
+
//
|
|
3328
3462
|
// Current understanding of how to deal with Big5(-HKSCS) is in the Encoding Standard, http://encoding.spec.whatwg.org/#big5-encoder
|
|
3329
3463
|
// Unicode mapping (http://www.unicode.org/Public/MAPPINGS/OBSOLETE/EASTASIA/OTHER/BIG5.TXT) is said to be wrong.
|
|
3330
|
-
|
|
3331
|
-
|
|
3332
|
-
|
|
3333
|
-
|
|
3464
|
+
windows950: "cp950",
|
|
3465
|
+
ms950: "cp950",
|
|
3466
|
+
950: "cp950",
|
|
3467
|
+
cp950: {
|
|
3334
3468
|
type: "_dbcs",
|
|
3335
3469
|
table: function() {
|
|
3336
3470
|
return require_cp950();
|
|
3337
3471
|
}
|
|
3338
3472
|
},
|
|
3339
3473
|
// Big5 has many variations and is an extension of cp950. We use Encoding Standard's as a consensus.
|
|
3340
|
-
|
|
3341
|
-
|
|
3474
|
+
big5: "big5hkscs",
|
|
3475
|
+
big5hkscs: {
|
|
3342
3476
|
type: "_dbcs",
|
|
3343
3477
|
table: function() {
|
|
3344
3478
|
return require_cp950().concat(require_big5_added());
|
|
@@ -3417,9 +3551,9 @@ var require_dbcs_data = __commonJS({
|
|
|
3417
3551
|
41678
|
|
3418
3552
|
]
|
|
3419
3553
|
},
|
|
3420
|
-
|
|
3421
|
-
|
|
3422
|
-
|
|
3554
|
+
cnbig5: "big5hkscs",
|
|
3555
|
+
csbig5: "big5hkscs",
|
|
3556
|
+
xxbig5: "big5hkscs"
|
|
3423
3557
|
};
|
|
3424
3558
|
}
|
|
3425
3559
|
});
|
|
@@ -3428,6 +3562,7 @@ var require_dbcs_data = __commonJS({
|
|
|
3428
3562
|
var require_encodings = __commonJS({
|
|
3429
3563
|
"../../node_modules/iconv-lite/encodings/index.js"(exports2, module2) {
|
|
3430
3564
|
"use strict";
|
|
3565
|
+
var mergeModules = require_merge_exports();
|
|
3431
3566
|
var modules = [
|
|
3432
3567
|
require_internal(),
|
|
3433
3568
|
require_utf32(),
|
|
@@ -3441,12 +3576,9 @@ var require_encodings = __commonJS({
|
|
|
3441
3576
|
];
|
|
3442
3577
|
for (i = 0; i < modules.length; i++) {
|
|
3443
3578
|
module2 = modules[i];
|
|
3444
|
-
|
|
3445
|
-
if (Object.prototype.hasOwnProperty.call(module2, enc))
|
|
3446
|
-
exports2[enc] = module2[enc];
|
|
3579
|
+
mergeModules(exports2, module2);
|
|
3447
3580
|
}
|
|
3448
3581
|
var module2;
|
|
3449
|
-
var enc;
|
|
3450
3582
|
var i;
|
|
3451
3583
|
}
|
|
3452
3584
|
});
|
|
@@ -3456,8 +3588,8 @@ var require_streams = __commonJS({
|
|
|
3456
3588
|
"../../node_modules/iconv-lite/lib/streams.js"(exports2, module2) {
|
|
3457
3589
|
"use strict";
|
|
3458
3590
|
var Buffer2 = require_safer().Buffer;
|
|
3459
|
-
module2.exports = function(
|
|
3460
|
-
var Transform =
|
|
3591
|
+
module2.exports = function(streamModule) {
|
|
3592
|
+
var Transform = streamModule.Transform;
|
|
3461
3593
|
function IconvLiteEncoderStream(conv, options) {
|
|
3462
3594
|
this.conv = conv;
|
|
3463
3595
|
options = options || {};
|
|
@@ -3468,8 +3600,9 @@ var require_streams = __commonJS({
|
|
|
3468
3600
|
constructor: { value: IconvLiteEncoderStream }
|
|
3469
3601
|
});
|
|
3470
3602
|
IconvLiteEncoderStream.prototype._transform = function(chunk, encoding, done) {
|
|
3471
|
-
if (typeof chunk
|
|
3603
|
+
if (typeof chunk !== "string") {
|
|
3472
3604
|
return done(new Error("Iconv encoding stream needs strings as its input."));
|
|
3605
|
+
}
|
|
3473
3606
|
try {
|
|
3474
3607
|
var res = this.conv.write(chunk);
|
|
3475
3608
|
if (res && res.length) this.push(res);
|
|
@@ -3508,8 +3641,9 @@ var require_streams = __commonJS({
|
|
|
3508
3641
|
constructor: { value: IconvLiteDecoderStream }
|
|
3509
3642
|
});
|
|
3510
3643
|
IconvLiteDecoderStream.prototype._transform = function(chunk, encoding, done) {
|
|
3511
|
-
if (!Buffer2.isBuffer(chunk) && !(chunk instanceof Uint8Array))
|
|
3644
|
+
if (!Buffer2.isBuffer(chunk) && !(chunk instanceof Uint8Array)) {
|
|
3512
3645
|
return done(new Error("Iconv decoding stream needs buffers as its input."));
|
|
3646
|
+
}
|
|
3513
3647
|
try {
|
|
3514
3648
|
var res = this.conv.write(chunk);
|
|
3515
3649
|
if (res && res.length) this.push(res, this.encoding);
|
|
@@ -3552,6 +3686,7 @@ var require_lib = __commonJS({
|
|
|
3552
3686
|
"use strict";
|
|
3553
3687
|
var Buffer2 = require_safer().Buffer;
|
|
3554
3688
|
var bomHandling = require_bom_handling();
|
|
3689
|
+
var mergeModules = require_merge_exports();
|
|
3555
3690
|
var iconv = module2.exports;
|
|
3556
3691
|
iconv.encodings = null;
|
|
3557
3692
|
iconv.defaultCharUnicode = "\uFFFD";
|
|
@@ -3586,31 +3721,38 @@ var require_lib = __commonJS({
|
|
|
3586
3721
|
};
|
|
3587
3722
|
iconv.toEncoding = iconv.encode;
|
|
3588
3723
|
iconv.fromEncoding = iconv.decode;
|
|
3589
|
-
iconv._codecDataCache = {};
|
|
3724
|
+
iconv._codecDataCache = { __proto__: null };
|
|
3590
3725
|
iconv.getCodec = function getCodec(encoding) {
|
|
3591
|
-
if (!iconv.encodings)
|
|
3592
|
-
|
|
3726
|
+
if (!iconv.encodings) {
|
|
3727
|
+
var raw = require_encodings();
|
|
3728
|
+
iconv.encodings = { __proto__: null };
|
|
3729
|
+
mergeModules(iconv.encodings, raw);
|
|
3730
|
+
}
|
|
3593
3731
|
var enc = iconv._canonicalizeEncoding(encoding);
|
|
3594
3732
|
var codecOptions = {};
|
|
3595
3733
|
while (true) {
|
|
3596
3734
|
var codec = iconv._codecDataCache[enc];
|
|
3597
|
-
if (codec)
|
|
3735
|
+
if (codec) {
|
|
3598
3736
|
return codec;
|
|
3737
|
+
}
|
|
3599
3738
|
var codecDef = iconv.encodings[enc];
|
|
3600
3739
|
switch (typeof codecDef) {
|
|
3601
3740
|
case "string":
|
|
3602
3741
|
enc = codecDef;
|
|
3603
3742
|
break;
|
|
3604
3743
|
case "object":
|
|
3605
|
-
for (var key in codecDef)
|
|
3744
|
+
for (var key in codecDef) {
|
|
3606
3745
|
codecOptions[key] = codecDef[key];
|
|
3607
|
-
|
|
3746
|
+
}
|
|
3747
|
+
if (!codecOptions.encodingName) {
|
|
3608
3748
|
codecOptions.encodingName = enc;
|
|
3749
|
+
}
|
|
3609
3750
|
enc = codecDef.type;
|
|
3610
3751
|
break;
|
|
3611
3752
|
case "function":
|
|
3612
|
-
if (!codecOptions.encodingName)
|
|
3753
|
+
if (!codecOptions.encodingName) {
|
|
3613
3754
|
codecOptions.encodingName = enc;
|
|
3755
|
+
}
|
|
3614
3756
|
codec = new codecDef(codecOptions, iconv);
|
|
3615
3757
|
iconv._codecDataCache[codecOptions.encodingName] = codec;
|
|
3616
3758
|
return codec;
|
|
@@ -3623,21 +3765,26 @@ var require_lib = __commonJS({
|
|
|
3623
3765
|
return ("" + encoding).toLowerCase().replace(/:\d{4}$|[^0-9a-z]/g, "");
|
|
3624
3766
|
};
|
|
3625
3767
|
iconv.getEncoder = function getEncoder(encoding, options) {
|
|
3626
|
-
var codec = iconv.getCodec(encoding)
|
|
3627
|
-
|
|
3768
|
+
var codec = iconv.getCodec(encoding);
|
|
3769
|
+
var encoder = new codec.encoder(options, codec);
|
|
3770
|
+
if (codec.bomAware && options && options.addBOM) {
|
|
3628
3771
|
encoder = new bomHandling.PrependBOM(encoder, options);
|
|
3772
|
+
}
|
|
3629
3773
|
return encoder;
|
|
3630
3774
|
};
|
|
3631
3775
|
iconv.getDecoder = function getDecoder(encoding, options) {
|
|
3632
|
-
var codec = iconv.getCodec(encoding)
|
|
3633
|
-
|
|
3776
|
+
var codec = iconv.getCodec(encoding);
|
|
3777
|
+
var decoder = new codec.decoder(options, codec);
|
|
3778
|
+
if (codec.bomAware && !(options && options.stripBOM === false)) {
|
|
3634
3779
|
decoder = new bomHandling.StripBOM(decoder, options);
|
|
3780
|
+
}
|
|
3635
3781
|
return decoder;
|
|
3636
3782
|
};
|
|
3637
|
-
iconv.enableStreamingAPI = function enableStreamingAPI(
|
|
3638
|
-
if (iconv.supportsStreams)
|
|
3783
|
+
iconv.enableStreamingAPI = function enableStreamingAPI(streamModule2) {
|
|
3784
|
+
if (iconv.supportsStreams) {
|
|
3639
3785
|
return;
|
|
3640
|
-
|
|
3786
|
+
}
|
|
3787
|
+
var streams = require_streams()(streamModule2);
|
|
3641
3788
|
iconv.IconvLiteEncoderStream = streams.IconvLiteEncoderStream;
|
|
3642
3789
|
iconv.IconvLiteDecoderStream = streams.IconvLiteDecoderStream;
|
|
3643
3790
|
iconv.encodeStream = function encodeStream(encoding, options) {
|
|
@@ -3648,13 +3795,13 @@ var require_lib = __commonJS({
|
|
|
3648
3795
|
};
|
|
3649
3796
|
iconv.supportsStreams = true;
|
|
3650
3797
|
};
|
|
3651
|
-
var
|
|
3798
|
+
var streamModule;
|
|
3652
3799
|
try {
|
|
3653
|
-
|
|
3800
|
+
streamModule = require("stream");
|
|
3654
3801
|
} catch (e) {
|
|
3655
3802
|
}
|
|
3656
|
-
if (
|
|
3657
|
-
iconv.enableStreamingAPI(
|
|
3803
|
+
if (streamModule && streamModule.Transform) {
|
|
3804
|
+
iconv.enableStreamingAPI(streamModule);
|
|
3658
3805
|
} else {
|
|
3659
3806
|
iconv.encodeStream = iconv.decodeStream = function() {
|
|
3660
3807
|
throw new Error("iconv-lite Streaming API is not enabled. Use iconv.enableStreamingAPI(require('stream')); to enable it.");
|
|
@@ -10094,7 +10241,7 @@ var require_dcmjs = __commonJS({
|
|
|
10094
10241
|
};
|
|
10095
10242
|
const compress_block = (s, ltree, dtree) => {
|
|
10096
10243
|
let dist2;
|
|
10097
|
-
let
|
|
10244
|
+
let lc;
|
|
10098
10245
|
let sx = 0;
|
|
10099
10246
|
let code;
|
|
10100
10247
|
let extra;
|
|
@@ -10102,16 +10249,16 @@ var require_dcmjs = __commonJS({
|
|
|
10102
10249
|
do {
|
|
10103
10250
|
dist2 = s.pending_buf[s.sym_buf + sx++] & 255;
|
|
10104
10251
|
dist2 += (s.pending_buf[s.sym_buf + sx++] & 255) << 8;
|
|
10105
|
-
|
|
10252
|
+
lc = s.pending_buf[s.sym_buf + sx++];
|
|
10106
10253
|
if (dist2 === 0) {
|
|
10107
|
-
send_code(s,
|
|
10254
|
+
send_code(s, lc, ltree);
|
|
10108
10255
|
} else {
|
|
10109
|
-
code = _length_code[
|
|
10256
|
+
code = _length_code[lc];
|
|
10110
10257
|
send_code(s, code + LITERALS$1 + 1, ltree);
|
|
10111
10258
|
extra = extra_lbits[code];
|
|
10112
10259
|
if (extra !== 0) {
|
|
10113
|
-
|
|
10114
|
-
send_bits(s,
|
|
10260
|
+
lc -= base_length[code];
|
|
10261
|
+
send_bits(s, lc, extra);
|
|
10115
10262
|
}
|
|
10116
10263
|
dist2--;
|
|
10117
10264
|
code = d_code(dist2);
|
|
@@ -10396,16 +10543,16 @@ var require_dcmjs = __commonJS({
|
|
|
10396
10543
|
bi_windup(s);
|
|
10397
10544
|
}
|
|
10398
10545
|
};
|
|
10399
|
-
const _tr_tally$1 = (s, dist2,
|
|
10546
|
+
const _tr_tally$1 = (s, dist2, lc) => {
|
|
10400
10547
|
s.pending_buf[s.sym_buf + s.sym_next++] = dist2;
|
|
10401
10548
|
s.pending_buf[s.sym_buf + s.sym_next++] = dist2 >> 8;
|
|
10402
|
-
s.pending_buf[s.sym_buf + s.sym_next++] =
|
|
10549
|
+
s.pending_buf[s.sym_buf + s.sym_next++] = lc;
|
|
10403
10550
|
if (dist2 === 0) {
|
|
10404
|
-
s.dyn_ltree[
|
|
10551
|
+
s.dyn_ltree[lc * 2]++;
|
|
10405
10552
|
} else {
|
|
10406
10553
|
s.matches++;
|
|
10407
10554
|
dist2--;
|
|
10408
|
-
s.dyn_ltree[(_length_code[
|
|
10555
|
+
s.dyn_ltree[(_length_code[lc] + LITERALS$1 + 1) * 2]++;
|
|
10409
10556
|
s.dyn_dtree[d_code(dist2) * 2]++;
|
|
10410
10557
|
}
|
|
10411
10558
|
return s.sym_next === s.sym_end;
|
|
@@ -15888,8 +16035,8 @@ var require_dcmjs = __commonJS({
|
|
|
15888
16035
|
key: "writeBytes",
|
|
15889
16036
|
value: function writeBytes(stream, value, writeOptions) {
|
|
15890
16037
|
var _this8 = this;
|
|
15891
|
-
var val = Array.isArray(value) ? value.map(function(
|
|
15892
|
-
return _this8.convertToString(
|
|
16038
|
+
var val = Array.isArray(value) ? value.map(function(ds) {
|
|
16039
|
+
return _this8.convertToString(ds);
|
|
15893
16040
|
}) : [this.convertToString(value)];
|
|
15894
16041
|
return _get(_getPrototypeOf(DecimalString2.prototype), "writeBytes", this).call(this, stream, val, writeOptions);
|
|
15895
16042
|
}
|
|
@@ -17677,8 +17824,8 @@ var require_dcmjs = __commonJS({
|
|
|
17677
17824
|
}, {
|
|
17678
17825
|
key: "isMultiframeDataset",
|
|
17679
17826
|
value: function isMultiframeDataset() {
|
|
17680
|
-
var
|
|
17681
|
-
var sopClassUID =
|
|
17827
|
+
var ds = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : this.dataset;
|
|
17828
|
+
var sopClassUID = ds.SOPClassUID.replace(/[^0-9.]/g, "");
|
|
17682
17829
|
return Normalizer2.isMultiframeSOPClassUID(sopClassUID);
|
|
17683
17830
|
}
|
|
17684
17831
|
}, {
|
|
@@ -17718,16 +17865,16 @@ var require_dcmjs = __commonJS({
|
|
|
17718
17865
|
}
|
|
17719
17866
|
this.derivation = new DerivedImage(this.datasets);
|
|
17720
17867
|
this.dataset = this.derivation.dataset;
|
|
17721
|
-
var
|
|
17868
|
+
var ds = this.dataset;
|
|
17722
17869
|
var referenceDataset = this.datasets[0];
|
|
17723
|
-
|
|
17724
|
-
|
|
17725
|
-
|
|
17726
|
-
|
|
17727
|
-
|
|
17728
|
-
|
|
17729
|
-
|
|
17730
|
-
|
|
17870
|
+
ds.NumberOfFrames = this.datasets.length;
|
|
17871
|
+
ds.SOPClassUID = referenceDataset.SOPClassUID;
|
|
17872
|
+
ds.Rows = referenceDataset.Rows;
|
|
17873
|
+
ds.Columns = referenceDataset.Columns;
|
|
17874
|
+
ds.BitsAllocated = referenceDataset.BitsAllocated;
|
|
17875
|
+
ds.PixelRepresentation = referenceDataset.PixelRepresentation;
|
|
17876
|
+
ds.RescaleSlope = referenceDataset.RescaleSlope || "1";
|
|
17877
|
+
ds.RescaleIntercept = referenceDataset.RescaleIntercept || "0";
|
|
17731
17878
|
var referencePosition = referenceDataset.ImagePositionPatient;
|
|
17732
17879
|
var rowVector = referenceDataset.ImageOrientationPatient.slice(0, 3);
|
|
17733
17880
|
var columnVector = referenceDataset.ImageOrientationPatient.slice(3, 6);
|
|
@@ -17742,43 +17889,43 @@ var require_dcmjs = __commonJS({
|
|
|
17742
17889
|
distanceDatasetPairs.sort(function(a, b2) {
|
|
17743
17890
|
return b2[0] - a[0];
|
|
17744
17891
|
});
|
|
17745
|
-
if (
|
|
17892
|
+
if (ds.BitsAllocated !== 16) {
|
|
17746
17893
|
log2.error("Only works with 16 bit data, not " + String(this.dataset.BitsAllocated));
|
|
17747
17894
|
}
|
|
17748
17895
|
if (referenceDataset._vrMap && !referenceDataset._vrMap.PixelData) {
|
|
17749
17896
|
log2.warn("No vr map given for pixel data, using OW");
|
|
17750
|
-
|
|
17897
|
+
ds._vrMap = {
|
|
17751
17898
|
PixelData: "OW"
|
|
17752
17899
|
};
|
|
17753
17900
|
} else {
|
|
17754
|
-
|
|
17901
|
+
ds._vrMap = {
|
|
17755
17902
|
PixelData: referenceDataset._vrMap.PixelData
|
|
17756
17903
|
};
|
|
17757
17904
|
}
|
|
17758
17905
|
var frameSize = referenceDataset.PixelData.byteLength;
|
|
17759
|
-
|
|
17906
|
+
ds.PixelData = new ArrayBuffer(ds.NumberOfFrames * frameSize);
|
|
17760
17907
|
var frame = 0;
|
|
17761
17908
|
distanceDatasetPairs.forEach(function(pair) {
|
|
17762
17909
|
var dataset = pair[1];
|
|
17763
17910
|
var pixels = new Uint16Array(dataset.PixelData);
|
|
17764
|
-
var frameView = new Uint16Array(
|
|
17911
|
+
var frameView = new Uint16Array(ds.PixelData, frame * frameSize, frameSize / 2);
|
|
17765
17912
|
try {
|
|
17766
17913
|
frameView.set(pixels);
|
|
17767
17914
|
} catch (e) {
|
|
17768
17915
|
if (e instanceof RangeError) {
|
|
17769
|
-
var message2 = "Error inserting pixels in PixelData\n" + "frameSize ".concat(frameSize, "\n") + "NumberOfFrames ".concat(
|
|
17916
|
+
var message2 = "Error inserting pixels in PixelData\n" + "frameSize ".concat(frameSize, "\n") + "NumberOfFrames ".concat(ds.NumberOfFrames, "\n") + "pair ".concat(pair, "\n") + "dataset PixelData size ".concat(dataset.PixelData.length);
|
|
17770
17917
|
log2.error(message2);
|
|
17771
17918
|
}
|
|
17772
17919
|
}
|
|
17773
17920
|
frame++;
|
|
17774
17921
|
});
|
|
17775
|
-
if (
|
|
17922
|
+
if (ds.NumberOfFrames < 2) {
|
|
17776
17923
|
log2.error("Cannot populate shared groups uniquely without multiple frames");
|
|
17777
17924
|
}
|
|
17778
17925
|
var _distanceDatasetPairs = _slicedToArray(distanceDatasetPairs[0], 2), distance0 = _distanceDatasetPairs[0], dataset0 = _distanceDatasetPairs[1];
|
|
17779
17926
|
var distance1 = distanceDatasetPairs[1][0];
|
|
17780
17927
|
var SpacingBetweenSlices = Math.abs(distance1 - distance0);
|
|
17781
|
-
|
|
17928
|
+
ds.SharedFunctionalGroupsSequence = {
|
|
17782
17929
|
PlaneOrientationSequence: {
|
|
17783
17930
|
ImageOrientationPatient: dataset0.ImageOrientationPatient
|
|
17784
17931
|
},
|
|
@@ -17788,14 +17935,14 @@ var require_dcmjs = __commonJS({
|
|
|
17788
17935
|
SliceThickness: SpacingBetweenSlices
|
|
17789
17936
|
}
|
|
17790
17937
|
};
|
|
17791
|
-
|
|
17938
|
+
ds.ReferencedSeriesSequence = {
|
|
17792
17939
|
SeriesInstanceUID: dataset0.SeriesInstanceUID,
|
|
17793
17940
|
ReferencedInstanceSequence: []
|
|
17794
17941
|
};
|
|
17795
|
-
|
|
17942
|
+
ds.PerFrameFunctionalGroupsSequence = [];
|
|
17796
17943
|
distanceDatasetPairs.forEach(function(pair) {
|
|
17797
17944
|
var dataset = pair[1];
|
|
17798
|
-
|
|
17945
|
+
ds.PerFrameFunctionalGroupsSequence.push({
|
|
17799
17946
|
PlanePositionSequence: {
|
|
17800
17947
|
ImagePositionPatient: dataset.ImagePositionPatient
|
|
17801
17948
|
},
|
|
@@ -17804,7 +17951,7 @@ var require_dcmjs = __commonJS({
|
|
|
17804
17951
|
WindowWidth: dataset.WindowWidth
|
|
17805
17952
|
}
|
|
17806
17953
|
});
|
|
17807
|
-
|
|
17954
|
+
ds.ReferencedSeriesSequence.ReferencedInstanceSequence.push({
|
|
17808
17955
|
ReferencedSOPClassUID: dataset.SOPClassUID,
|
|
17809
17956
|
ReferencedSOPInstanceUID: dataset.SOPInstanceUID
|
|
17810
17957
|
});
|
|
@@ -17824,29 +17971,29 @@ var require_dcmjs = __commonJS({
|
|
|
17824
17971
|
}, {
|
|
17825
17972
|
key: "normalizeMultiframe",
|
|
17826
17973
|
value: function normalizeMultiframe() {
|
|
17827
|
-
var
|
|
17828
|
-
if (!
|
|
17974
|
+
var ds = this.dataset;
|
|
17975
|
+
if (!ds.NumberOfFrames) {
|
|
17829
17976
|
log2.error("Missing number or frames not supported");
|
|
17830
17977
|
return;
|
|
17831
17978
|
}
|
|
17832
|
-
if (!
|
|
17833
|
-
|
|
17979
|
+
if (!ds.PixelRepresentation) {
|
|
17980
|
+
ds.PixelRepresentation = 1;
|
|
17834
17981
|
}
|
|
17835
|
-
if (!
|
|
17836
|
-
|
|
17982
|
+
if (!ds.StudyID || ds.StudyID === "") {
|
|
17983
|
+
ds.StudyID = "No Study ID";
|
|
17837
17984
|
}
|
|
17838
17985
|
var validLateralities = ["R", "L"];
|
|
17839
|
-
if (validLateralities.indexOf(
|
|
17840
|
-
delete
|
|
17986
|
+
if (validLateralities.indexOf(ds.Laterality) === -1) {
|
|
17987
|
+
delete ds.Laterality;
|
|
17841
17988
|
}
|
|
17842
|
-
if (!
|
|
17843
|
-
|
|
17989
|
+
if (!ds.PresentationLUTShape) {
|
|
17990
|
+
ds.PresentationLUTShape = "IDENTITY";
|
|
17844
17991
|
}
|
|
17845
|
-
if (!
|
|
17992
|
+
if (!ds.SharedFunctionalGroupsSequence) {
|
|
17846
17993
|
log2.error("Can only process multiframe data with SharedFunctionalGroupsSequence");
|
|
17847
17994
|
}
|
|
17848
|
-
if (
|
|
17849
|
-
|
|
17995
|
+
if (ds.BodyPartExamined === "PROSTATE") {
|
|
17996
|
+
ds.SharedFunctionalGroupsSequence.FrameAnatomySequence = {
|
|
17850
17997
|
AnatomicRegionSequence: {
|
|
17851
17998
|
CodeValue: "T-9200B",
|
|
17852
17999
|
CodingSchemeDesignator: "SRT",
|
|
@@ -17855,17 +18002,17 @@ var require_dcmjs = __commonJS({
|
|
|
17855
18002
|
FrameLaterality: "U"
|
|
17856
18003
|
};
|
|
17857
18004
|
}
|
|
17858
|
-
var rescaleIntercept =
|
|
17859
|
-
var rescaleSlope =
|
|
17860
|
-
|
|
18005
|
+
var rescaleIntercept = ds.RescaleIntercept || 0;
|
|
18006
|
+
var rescaleSlope = ds.RescaleSlope || 1;
|
|
18007
|
+
ds.SharedFunctionalGroupsSequence.PixelValueTransformationSequence = {
|
|
17861
18008
|
RescaleIntercept: rescaleIntercept,
|
|
17862
18009
|
RescaleSlope: rescaleSlope,
|
|
17863
18010
|
RescaleType: "US"
|
|
17864
18011
|
};
|
|
17865
18012
|
var frameNumber = 1;
|
|
17866
18013
|
this.datasets.forEach(function(dataset) {
|
|
17867
|
-
if (
|
|
17868
|
-
|
|
18014
|
+
if (ds.NumberOfFrames === 1) ds.PerFrameFunctionalGroupsSequence = [ds.PerFrameFunctionalGroupsSequence];
|
|
18015
|
+
ds.PerFrameFunctionalGroupsSequence[frameNumber - 1].FrameContentSequence = {
|
|
17869
18016
|
FrameAcquisitionDuration: 0,
|
|
17870
18017
|
StackID: 1,
|
|
17871
18018
|
InStackPositionNumber: frameNumber,
|
|
@@ -17873,30 +18020,30 @@ var require_dcmjs = __commonJS({
|
|
|
17873
18020
|
};
|
|
17874
18021
|
var frameTime = dataset.AcquisitionDate + dataset.AcquisitionTime;
|
|
17875
18022
|
if (!isNaN(frameTime)) {
|
|
17876
|
-
var frameContentSequence =
|
|
18023
|
+
var frameContentSequence = ds.PerFrameFunctionalGroupsSequence[frameNumber - 1].FrameContentSequence;
|
|
17877
18024
|
frameContentSequence.FrameAcquisitionDateTime = frameTime;
|
|
17878
18025
|
frameContentSequence.FrameReferenceDateTime = frameTime;
|
|
17879
18026
|
}
|
|
17880
18027
|
frameNumber++;
|
|
17881
18028
|
});
|
|
17882
|
-
if (
|
|
17883
|
-
if (!Array.isArray(
|
|
17884
|
-
|
|
18029
|
+
if (ds.WindowCenter && ds.WindowWidth) {
|
|
18030
|
+
if (!Array.isArray(ds.WindowCenter)) {
|
|
18031
|
+
ds.WindowCenter = [ds.WindowCenter];
|
|
17885
18032
|
}
|
|
17886
|
-
if (!Array.isArray(
|
|
17887
|
-
|
|
18033
|
+
if (!Array.isArray(ds.WindowWidth)) {
|
|
18034
|
+
ds.WindowWidth = [ds.WindowWidth];
|
|
17888
18035
|
}
|
|
17889
18036
|
}
|
|
17890
|
-
if (!
|
|
17891
|
-
|
|
17892
|
-
|
|
17893
|
-
if (
|
|
18037
|
+
if (!ds.WindowCenter || !ds.WindowWidth) {
|
|
18038
|
+
ds.WindowCenter = [];
|
|
18039
|
+
ds.WindowWidth = [];
|
|
18040
|
+
if (ds.PerFrameFunctionalGroupsSequence) {
|
|
17894
18041
|
var wcww = {
|
|
17895
18042
|
center: 0,
|
|
17896
18043
|
width: 0,
|
|
17897
18044
|
count: 0
|
|
17898
18045
|
};
|
|
17899
|
-
|
|
18046
|
+
ds.PerFrameFunctionalGroupsSequence.forEach(function(functionalGroup) {
|
|
17900
18047
|
if (functionalGroup.FrameVOILUT) {
|
|
17901
18048
|
var wc = functionalGroup.FrameVOILUTSequence.WindowCenter;
|
|
17902
18049
|
var ww = functionalGroup.FrameVOILUTSequence.WindowWidth;
|
|
@@ -17914,16 +18061,16 @@ var require_dcmjs = __commonJS({
|
|
|
17914
18061
|
}
|
|
17915
18062
|
});
|
|
17916
18063
|
if (wcww.count > 0) {
|
|
17917
|
-
|
|
17918
|
-
|
|
18064
|
+
ds.WindowCenter.push(String(wcww.center / wcww.count));
|
|
18065
|
+
ds.WindowWidth.push(String(wcww.width / wcww.count));
|
|
17919
18066
|
}
|
|
17920
18067
|
}
|
|
17921
18068
|
}
|
|
17922
|
-
if (
|
|
17923
|
-
|
|
18069
|
+
if (ds.WindowCenter.length === 0) {
|
|
18070
|
+
ds.WindowCenter = [300];
|
|
17924
18071
|
}
|
|
17925
|
-
if (
|
|
17926
|
-
|
|
18072
|
+
if (ds.WindowWidth.length === 0) {
|
|
18073
|
+
ds.WindowWidth = [500];
|
|
17927
18074
|
}
|
|
17928
18075
|
}
|
|
17929
18076
|
}], [{
|
|
@@ -17969,12 +18116,12 @@ var require_dcmjs = __commonJS({
|
|
|
17969
18116
|
key: "normalizeMultiframe",
|
|
17970
18117
|
value: function normalizeMultiframe() {
|
|
17971
18118
|
_get(_getPrototypeOf(MRImageNormalizer2.prototype), "normalizeMultiframe", this).call(this);
|
|
17972
|
-
var
|
|
17973
|
-
if (!
|
|
17974
|
-
|
|
18119
|
+
var ds = this.dataset;
|
|
18120
|
+
if (!ds.ImageType || !ds.ImageType.constructor || ds.ImageType.constructor.name != "Array" || ds.ImageType.length != 4) {
|
|
18121
|
+
ds.ImageType = ["ORIGINAL", "PRIMARY", "OTHER", "NONE"];
|
|
17975
18122
|
}
|
|
17976
|
-
|
|
17977
|
-
FrameType:
|
|
18123
|
+
ds.SharedFunctionalGroupsSequence.MRImageFrameTypeSequence = {
|
|
18124
|
+
FrameType: ds.ImageType,
|
|
17978
18125
|
PixelPresentation: "MONOCHROME",
|
|
17979
18126
|
VolumetricProperties: "VOLUME",
|
|
17980
18127
|
VolumeBasedCalculationTechnique: "NONE",
|
|
@@ -18099,9 +18246,9 @@ var require_dcmjs = __commonJS({
|
|
|
18099
18246
|
key: "normalize",
|
|
18100
18247
|
value: function normalize2() {
|
|
18101
18248
|
_get(_getPrototypeOf(PMImageNormalizer2.prototype), "normalize", this).call(this);
|
|
18102
|
-
var
|
|
18103
|
-
if (
|
|
18104
|
-
log2.error("Only works with 32 bit data, not " + String(
|
|
18249
|
+
var ds = this.datasets[0];
|
|
18250
|
+
if (ds.BitsAllocated !== 32) {
|
|
18251
|
+
log2.error("Only works with 32 bit data, not " + String(ds.BitsAllocated));
|
|
18105
18252
|
}
|
|
18106
18253
|
}
|
|
18107
18254
|
}]);
|
|
@@ -27068,7 +27215,7 @@ var require_dcmjs = __commonJS({
|
|
|
27068
27215
|
__proto__: null,
|
|
27069
27216
|
Comprehensive3DSR
|
|
27070
27217
|
});
|
|
27071
|
-
var
|
|
27218
|
+
var sr2 = {
|
|
27072
27219
|
coding,
|
|
27073
27220
|
contentItems,
|
|
27074
27221
|
documents,
|
|
@@ -27380,7 +27527,7 @@ var require_dcmjs = __commonJS({
|
|
|
27380
27527
|
data: data2,
|
|
27381
27528
|
derivations,
|
|
27382
27529
|
normalizers,
|
|
27383
|
-
sr,
|
|
27530
|
+
sr: sr2,
|
|
27384
27531
|
utilities,
|
|
27385
27532
|
log: log2,
|
|
27386
27533
|
anonymizer
|
|
@@ -27397,7 +27544,7 @@ var require_dcmjs = __commonJS({
|
|
|
27397
27544
|
exports3.derivations = derivations;
|
|
27398
27545
|
exports3.log = log2;
|
|
27399
27546
|
exports3.normalizers = normalizers;
|
|
27400
|
-
exports3.sr =
|
|
27547
|
+
exports3.sr = sr2;
|
|
27401
27548
|
exports3.utilities = utilities;
|
|
27402
27549
|
Object.defineProperty(exports3, "__esModule", { value: true });
|
|
27403
27550
|
}));
|
|
@@ -28471,17 +28618,17 @@ var require_decorator = __commonJS({
|
|
|
28471
28618
|
return mergedObject;
|
|
28472
28619
|
};
|
|
28473
28620
|
var mergePropertyAndMethodDecorators = (d1, d2) => {
|
|
28474
|
-
var _a, _b,
|
|
28621
|
+
var _a, _b, _c2, _d;
|
|
28475
28622
|
return {
|
|
28476
28623
|
property: mergeObjectsOfDecorators((_a = d1 === null || d1 === void 0 ? void 0 : d1.property) !== null && _a !== void 0 ? _a : {}, (_b = d2 === null || d2 === void 0 ? void 0 : d2.property) !== null && _b !== void 0 ? _b : {}),
|
|
28477
|
-
method: mergeObjectsOfDecorators((
|
|
28624
|
+
method: mergeObjectsOfDecorators((_c2 = d1 === null || d1 === void 0 ? void 0 : d1.method) !== null && _c2 !== void 0 ? _c2 : {}, (_d = d2 === null || d2 === void 0 ? void 0 : d2.method) !== null && _d !== void 0 ? _d : {})
|
|
28478
28625
|
};
|
|
28479
28626
|
};
|
|
28480
28627
|
var mergeDecorators = (d1, d2) => {
|
|
28481
|
-
var _a, _b,
|
|
28628
|
+
var _a, _b, _c2, _d, _e2, _f;
|
|
28482
28629
|
return {
|
|
28483
28630
|
class: (0, util_1.unique)([...(_a = d1 === null || d1 === void 0 ? void 0 : d1.class) !== null && _a !== void 0 ? _a : [], ...(_b = d2 === null || d2 === void 0 ? void 0 : d2.class) !== null && _b !== void 0 ? _b : []]),
|
|
28484
|
-
static: mergePropertyAndMethodDecorators((
|
|
28631
|
+
static: mergePropertyAndMethodDecorators((_c2 = d1 === null || d1 === void 0 ? void 0 : d1.static) !== null && _c2 !== void 0 ? _c2 : {}, (_d = d2 === null || d2 === void 0 ? void 0 : d2.static) !== null && _d !== void 0 ? _d : {}),
|
|
28485
28632
|
instance: mergePropertyAndMethodDecorators((_e2 = d1 === null || d1 === void 0 ? void 0 : d1.instance) !== null && _e2 !== void 0 ? _e2 : {}, (_f = d2 === null || d2 === void 0 ? void 0 : d2.instance) !== null && _f !== void 0 ? _f : {})
|
|
28486
28633
|
};
|
|
28487
28634
|
};
|
|
@@ -28542,7 +28689,7 @@ var require_decorator = __commonJS({
|
|
|
28542
28689
|
return decorator(clazz);
|
|
28543
28690
|
});
|
|
28544
28691
|
var decorateMember = (decorator) => ((object, key, ...otherArgs) => {
|
|
28545
|
-
var _a, _b,
|
|
28692
|
+
var _a, _b, _c2;
|
|
28546
28693
|
const decoratorTargetType = typeof object === "function" ? "static" : "instance";
|
|
28547
28694
|
const decoratorType = typeof object[key] === "function" ? "method" : "property";
|
|
28548
28695
|
const clazz = decoratorTargetType === "static" ? object : object.constructor;
|
|
@@ -28551,7 +28698,7 @@ var require_decorator = __commonJS({
|
|
|
28551
28698
|
decoratorsForClass[decoratorTargetType] = decoratorsForTargetType;
|
|
28552
28699
|
let decoratorsForType = (_b = decoratorsForTargetType === null || decoratorsForTargetType === void 0 ? void 0 : decoratorsForTargetType[decoratorType]) !== null && _b !== void 0 ? _b : {};
|
|
28553
28700
|
decoratorsForTargetType[decoratorType] = decoratorsForType;
|
|
28554
|
-
let decoratorsForKey = (
|
|
28701
|
+
let decoratorsForKey = (_c2 = decoratorsForType === null || decoratorsForType === void 0 ? void 0 : decoratorsForType[key]) !== null && _c2 !== void 0 ? _c2 : [];
|
|
28555
28702
|
decoratorsForType[key] = decoratorsForKey;
|
|
28556
28703
|
decoratorsForKey.push(decorator);
|
|
28557
28704
|
return decorator(object, key, ...otherArgs);
|
|
@@ -28577,7 +28724,7 @@ var require_mixins = __commonJS({
|
|
|
28577
28724
|
var decorator_1 = require_decorator();
|
|
28578
28725
|
var mixin_tracking_1 = require_mixin_tracking();
|
|
28579
28726
|
function Mixin(...constructors) {
|
|
28580
|
-
var _a, _b,
|
|
28727
|
+
var _a, _b, _c2;
|
|
28581
28728
|
const prototypes = constructors.map((constructor) => constructor.prototype);
|
|
28582
28729
|
const initFunctionName = settings_1.settings.initFunction;
|
|
28583
28730
|
if (initFunctionName !== null) {
|
|
@@ -28607,7 +28754,7 @@ var require_mixins = __commonJS({
|
|
|
28607
28754
|
}
|
|
28608
28755
|
}
|
|
28609
28756
|
applyPropAndMethodDecorators((_b = classDecorators === null || classDecorators === void 0 ? void 0 : classDecorators.static) !== null && _b !== void 0 ? _b : {}, DecoratedMixedClass);
|
|
28610
|
-
applyPropAndMethodDecorators((
|
|
28757
|
+
applyPropAndMethodDecorators((_c2 = classDecorators === null || classDecorators === void 0 ? void 0 : classDecorators.instance) !== null && _c2 !== void 0 ? _c2 : {}, DecoratedMixedClass.prototype);
|
|
28611
28758
|
}
|
|
28612
28759
|
(0, mixin_tracking_1.registerMixins)(DecoratedMixedClass, constructors);
|
|
28613
28760
|
return DecoratedMixedClass;
|
|
@@ -29577,7 +29724,7 @@ var require_dcmjs2 = __commonJS({
|
|
|
29577
29724
|
};
|
|
29578
29725
|
const compress_block = (s, ltree, dtree) => {
|
|
29579
29726
|
let dist2;
|
|
29580
|
-
let
|
|
29727
|
+
let lc;
|
|
29581
29728
|
let sx = 0;
|
|
29582
29729
|
let code;
|
|
29583
29730
|
let extra;
|
|
@@ -29585,16 +29732,16 @@ var require_dcmjs2 = __commonJS({
|
|
|
29585
29732
|
do {
|
|
29586
29733
|
dist2 = s.pending_buf[s.sym_buf + sx++] & 255;
|
|
29587
29734
|
dist2 += (s.pending_buf[s.sym_buf + sx++] & 255) << 8;
|
|
29588
|
-
|
|
29735
|
+
lc = s.pending_buf[s.sym_buf + sx++];
|
|
29589
29736
|
if (dist2 === 0) {
|
|
29590
|
-
send_code(s,
|
|
29737
|
+
send_code(s, lc, ltree);
|
|
29591
29738
|
} else {
|
|
29592
|
-
code = _length_code[
|
|
29739
|
+
code = _length_code[lc];
|
|
29593
29740
|
send_code(s, code + LITERALS$1 + 1, ltree);
|
|
29594
29741
|
extra = extra_lbits[code];
|
|
29595
29742
|
if (extra !== 0) {
|
|
29596
|
-
|
|
29597
|
-
send_bits(s,
|
|
29743
|
+
lc -= base_length[code];
|
|
29744
|
+
send_bits(s, lc, extra);
|
|
29598
29745
|
}
|
|
29599
29746
|
dist2--;
|
|
29600
29747
|
code = d_code(dist2);
|
|
@@ -29879,16 +30026,16 @@ var require_dcmjs2 = __commonJS({
|
|
|
29879
30026
|
bi_windup(s);
|
|
29880
30027
|
}
|
|
29881
30028
|
};
|
|
29882
|
-
const _tr_tally$1 = (s, dist2,
|
|
30029
|
+
const _tr_tally$1 = (s, dist2, lc) => {
|
|
29883
30030
|
s.pending_buf[s.sym_buf + s.sym_next++] = dist2;
|
|
29884
30031
|
s.pending_buf[s.sym_buf + s.sym_next++] = dist2 >> 8;
|
|
29885
|
-
s.pending_buf[s.sym_buf + s.sym_next++] =
|
|
30032
|
+
s.pending_buf[s.sym_buf + s.sym_next++] = lc;
|
|
29886
30033
|
if (dist2 === 0) {
|
|
29887
|
-
s.dyn_ltree[
|
|
30034
|
+
s.dyn_ltree[lc * 2]++;
|
|
29888
30035
|
} else {
|
|
29889
30036
|
s.matches++;
|
|
29890
30037
|
dist2--;
|
|
29891
|
-
s.dyn_ltree[(_length_code[
|
|
30038
|
+
s.dyn_ltree[(_length_code[lc] + LITERALS$1 + 1) * 2]++;
|
|
29892
30039
|
s.dyn_dtree[d_code(dist2) * 2]++;
|
|
29893
30040
|
}
|
|
29894
30041
|
return s.sym_next === s.sym_end;
|
|
@@ -35065,8 +35212,8 @@ var require_dcmjs2 = __commonJS({
|
|
|
35065
35212
|
key: "writeBytes",
|
|
35066
35213
|
value: function writeBytes(stream, value, writeOptions) {
|
|
35067
35214
|
var _this8 = this;
|
|
35068
|
-
var val = Array.isArray(value) ? value.map(function(
|
|
35069
|
-
return _this8.convertToString(
|
|
35215
|
+
var val = Array.isArray(value) ? value.map(function(ds) {
|
|
35216
|
+
return _this8.convertToString(ds);
|
|
35070
35217
|
}) : [this.convertToString(value)];
|
|
35071
35218
|
return _get(_getPrototypeOf(DecimalString2.prototype), "writeBytes", this).call(this, stream, val, writeOptions);
|
|
35072
35219
|
}
|
|
@@ -36839,8 +36986,8 @@ var require_dcmjs2 = __commonJS({
|
|
|
36839
36986
|
}, {
|
|
36840
36987
|
key: "isMultiframeDataset",
|
|
36841
36988
|
value: function isMultiframeDataset() {
|
|
36842
|
-
var
|
|
36843
|
-
var sopClassUID =
|
|
36989
|
+
var ds = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : this.dataset;
|
|
36990
|
+
var sopClassUID = ds.SOPClassUID.replace(/[^0-9.]/g, "");
|
|
36844
36991
|
return Normalizer2.isMultiframeSOPClassUID(sopClassUID);
|
|
36845
36992
|
}
|
|
36846
36993
|
}, {
|
|
@@ -36880,16 +37027,16 @@ var require_dcmjs2 = __commonJS({
|
|
|
36880
37027
|
}
|
|
36881
37028
|
this.derivation = new DerivedImage(this.datasets);
|
|
36882
37029
|
this.dataset = this.derivation.dataset;
|
|
36883
|
-
var
|
|
37030
|
+
var ds = this.dataset;
|
|
36884
37031
|
var referenceDataset = this.datasets[0];
|
|
36885
|
-
|
|
36886
|
-
|
|
36887
|
-
|
|
36888
|
-
|
|
36889
|
-
|
|
36890
|
-
|
|
36891
|
-
|
|
36892
|
-
|
|
37032
|
+
ds.NumberOfFrames = this.datasets.length;
|
|
37033
|
+
ds.SOPClassUID = referenceDataset.SOPClassUID;
|
|
37034
|
+
ds.Rows = referenceDataset.Rows;
|
|
37035
|
+
ds.Columns = referenceDataset.Columns;
|
|
37036
|
+
ds.BitsAllocated = referenceDataset.BitsAllocated;
|
|
37037
|
+
ds.PixelRepresentation = referenceDataset.PixelRepresentation;
|
|
37038
|
+
ds.RescaleSlope = referenceDataset.RescaleSlope || "1";
|
|
37039
|
+
ds.RescaleIntercept = referenceDataset.RescaleIntercept || "0";
|
|
36893
37040
|
var referencePosition = referenceDataset.ImagePositionPatient;
|
|
36894
37041
|
var rowVector = referenceDataset.ImageOrientationPatient.slice(0, 3);
|
|
36895
37042
|
var columnVector = referenceDataset.ImageOrientationPatient.slice(3, 6);
|
|
@@ -36904,43 +37051,43 @@ var require_dcmjs2 = __commonJS({
|
|
|
36904
37051
|
distanceDatasetPairs.sort(function(a, b2) {
|
|
36905
37052
|
return b2[0] - a[0];
|
|
36906
37053
|
});
|
|
36907
|
-
if (
|
|
37054
|
+
if (ds.BitsAllocated !== 16) {
|
|
36908
37055
|
log2.error("Only works with 16 bit data, not " + String(this.dataset.BitsAllocated));
|
|
36909
37056
|
}
|
|
36910
37057
|
if (referenceDataset._vrMap && !referenceDataset._vrMap.PixelData) {
|
|
36911
37058
|
log2.warn("No vr map given for pixel data, using OW");
|
|
36912
|
-
|
|
37059
|
+
ds._vrMap = {
|
|
36913
37060
|
PixelData: "OW"
|
|
36914
37061
|
};
|
|
36915
37062
|
} else {
|
|
36916
|
-
|
|
37063
|
+
ds._vrMap = {
|
|
36917
37064
|
PixelData: referenceDataset._vrMap.PixelData
|
|
36918
37065
|
};
|
|
36919
37066
|
}
|
|
36920
37067
|
var frameSize = referenceDataset.PixelData.byteLength;
|
|
36921
|
-
|
|
37068
|
+
ds.PixelData = new ArrayBuffer(ds.NumberOfFrames * frameSize);
|
|
36922
37069
|
var frame = 0;
|
|
36923
37070
|
distanceDatasetPairs.forEach(function(pair) {
|
|
36924
37071
|
var dataset = pair[1];
|
|
36925
37072
|
var pixels = new Uint16Array(dataset.PixelData);
|
|
36926
|
-
var frameView = new Uint16Array(
|
|
37073
|
+
var frameView = new Uint16Array(ds.PixelData, frame * frameSize, frameSize / 2);
|
|
36927
37074
|
try {
|
|
36928
37075
|
frameView.set(pixels);
|
|
36929
37076
|
} catch (e) {
|
|
36930
37077
|
if (e instanceof RangeError) {
|
|
36931
|
-
var message2 = "Error inserting pixels in PixelData\n" + "frameSize ".concat(frameSize, "\n") + "NumberOfFrames ".concat(
|
|
37078
|
+
var message2 = "Error inserting pixels in PixelData\n" + "frameSize ".concat(frameSize, "\n") + "NumberOfFrames ".concat(ds.NumberOfFrames, "\n") + "pair ".concat(pair, "\n") + "dataset PixelData size ".concat(dataset.PixelData.length);
|
|
36932
37079
|
log2.error(message2);
|
|
36933
37080
|
}
|
|
36934
37081
|
}
|
|
36935
37082
|
frame++;
|
|
36936
37083
|
});
|
|
36937
|
-
if (
|
|
37084
|
+
if (ds.NumberOfFrames < 2) {
|
|
36938
37085
|
log2.error("Cannot populate shared groups uniquely without multiple frames");
|
|
36939
37086
|
}
|
|
36940
37087
|
var _distanceDatasetPairs = _slicedToArray(distanceDatasetPairs[0], 2), distance0 = _distanceDatasetPairs[0], dataset0 = _distanceDatasetPairs[1];
|
|
36941
37088
|
var distance1 = distanceDatasetPairs[1][0];
|
|
36942
37089
|
var SpacingBetweenSlices = Math.abs(distance1 - distance0);
|
|
36943
|
-
|
|
37090
|
+
ds.SharedFunctionalGroupsSequence = {
|
|
36944
37091
|
PlaneOrientationSequence: {
|
|
36945
37092
|
ImageOrientationPatient: dataset0.ImageOrientationPatient
|
|
36946
37093
|
},
|
|
@@ -36950,14 +37097,14 @@ var require_dcmjs2 = __commonJS({
|
|
|
36950
37097
|
SliceThickness: SpacingBetweenSlices
|
|
36951
37098
|
}
|
|
36952
37099
|
};
|
|
36953
|
-
|
|
37100
|
+
ds.ReferencedSeriesSequence = {
|
|
36954
37101
|
SeriesInstanceUID: dataset0.SeriesInstanceUID,
|
|
36955
37102
|
ReferencedInstanceSequence: []
|
|
36956
37103
|
};
|
|
36957
|
-
|
|
37104
|
+
ds.PerFrameFunctionalGroupsSequence = [];
|
|
36958
37105
|
distanceDatasetPairs.forEach(function(pair) {
|
|
36959
37106
|
var dataset = pair[1];
|
|
36960
|
-
|
|
37107
|
+
ds.PerFrameFunctionalGroupsSequence.push({
|
|
36961
37108
|
PlanePositionSequence: {
|
|
36962
37109
|
ImagePositionPatient: dataset.ImagePositionPatient
|
|
36963
37110
|
},
|
|
@@ -36966,7 +37113,7 @@ var require_dcmjs2 = __commonJS({
|
|
|
36966
37113
|
WindowWidth: dataset.WindowWidth
|
|
36967
37114
|
}
|
|
36968
37115
|
});
|
|
36969
|
-
|
|
37116
|
+
ds.ReferencedSeriesSequence.ReferencedInstanceSequence.push({
|
|
36970
37117
|
ReferencedSOPClassUID: dataset.SOPClassUID,
|
|
36971
37118
|
ReferencedSOPInstanceUID: dataset.SOPInstanceUID
|
|
36972
37119
|
});
|
|
@@ -36986,29 +37133,29 @@ var require_dcmjs2 = __commonJS({
|
|
|
36986
37133
|
}, {
|
|
36987
37134
|
key: "normalizeMultiframe",
|
|
36988
37135
|
value: function normalizeMultiframe() {
|
|
36989
|
-
var
|
|
36990
|
-
if (!
|
|
37136
|
+
var ds = this.dataset;
|
|
37137
|
+
if (!ds.NumberOfFrames) {
|
|
36991
37138
|
log2.error("Missing number or frames not supported");
|
|
36992
37139
|
return;
|
|
36993
37140
|
}
|
|
36994
|
-
if (!
|
|
36995
|
-
|
|
37141
|
+
if (!ds.PixelRepresentation) {
|
|
37142
|
+
ds.PixelRepresentation = 1;
|
|
36996
37143
|
}
|
|
36997
|
-
if (!
|
|
36998
|
-
|
|
37144
|
+
if (!ds.StudyID || ds.StudyID === "") {
|
|
37145
|
+
ds.StudyID = "No Study ID";
|
|
36999
37146
|
}
|
|
37000
37147
|
var validLateralities = ["R", "L"];
|
|
37001
|
-
if (validLateralities.indexOf(
|
|
37002
|
-
delete
|
|
37148
|
+
if (validLateralities.indexOf(ds.Laterality) === -1) {
|
|
37149
|
+
delete ds.Laterality;
|
|
37003
37150
|
}
|
|
37004
|
-
if (!
|
|
37005
|
-
|
|
37151
|
+
if (!ds.PresentationLUTShape) {
|
|
37152
|
+
ds.PresentationLUTShape = "IDENTITY";
|
|
37006
37153
|
}
|
|
37007
|
-
if (!
|
|
37154
|
+
if (!ds.SharedFunctionalGroupsSequence) {
|
|
37008
37155
|
log2.error("Can only process multiframe data with SharedFunctionalGroupsSequence");
|
|
37009
37156
|
}
|
|
37010
|
-
if (
|
|
37011
|
-
|
|
37157
|
+
if (ds.BodyPartExamined === "PROSTATE") {
|
|
37158
|
+
ds.SharedFunctionalGroupsSequence.FrameAnatomySequence = {
|
|
37012
37159
|
AnatomicRegionSequence: {
|
|
37013
37160
|
CodeValue: "T-9200B",
|
|
37014
37161
|
CodingSchemeDesignator: "SRT",
|
|
@@ -37017,17 +37164,17 @@ var require_dcmjs2 = __commonJS({
|
|
|
37017
37164
|
FrameLaterality: "U"
|
|
37018
37165
|
};
|
|
37019
37166
|
}
|
|
37020
|
-
var rescaleIntercept =
|
|
37021
|
-
var rescaleSlope =
|
|
37022
|
-
|
|
37167
|
+
var rescaleIntercept = ds.RescaleIntercept || 0;
|
|
37168
|
+
var rescaleSlope = ds.RescaleSlope || 1;
|
|
37169
|
+
ds.SharedFunctionalGroupsSequence.PixelValueTransformationSequence = {
|
|
37023
37170
|
RescaleIntercept: rescaleIntercept,
|
|
37024
37171
|
RescaleSlope: rescaleSlope,
|
|
37025
37172
|
RescaleType: "US"
|
|
37026
37173
|
};
|
|
37027
37174
|
var frameNumber = 1;
|
|
37028
37175
|
this.datasets.forEach(function(dataset) {
|
|
37029
|
-
if (
|
|
37030
|
-
|
|
37176
|
+
if (ds.NumberOfFrames === 1) ds.PerFrameFunctionalGroupsSequence = [ds.PerFrameFunctionalGroupsSequence];
|
|
37177
|
+
ds.PerFrameFunctionalGroupsSequence[frameNumber - 1].FrameContentSequence = {
|
|
37031
37178
|
FrameAcquisitionDuration: 0,
|
|
37032
37179
|
StackID: 1,
|
|
37033
37180
|
InStackPositionNumber: frameNumber,
|
|
@@ -37035,30 +37182,30 @@ var require_dcmjs2 = __commonJS({
|
|
|
37035
37182
|
};
|
|
37036
37183
|
var frameTime = dataset.AcquisitionDate + dataset.AcquisitionTime;
|
|
37037
37184
|
if (!isNaN(frameTime)) {
|
|
37038
|
-
var frameContentSequence =
|
|
37185
|
+
var frameContentSequence = ds.PerFrameFunctionalGroupsSequence[frameNumber - 1].FrameContentSequence;
|
|
37039
37186
|
frameContentSequence.FrameAcquisitionDateTime = frameTime;
|
|
37040
37187
|
frameContentSequence.FrameReferenceDateTime = frameTime;
|
|
37041
37188
|
}
|
|
37042
37189
|
frameNumber++;
|
|
37043
37190
|
});
|
|
37044
|
-
if (
|
|
37045
|
-
if (!Array.isArray(
|
|
37046
|
-
|
|
37191
|
+
if (ds.WindowCenter && ds.WindowWidth) {
|
|
37192
|
+
if (!Array.isArray(ds.WindowCenter)) {
|
|
37193
|
+
ds.WindowCenter = [ds.WindowCenter];
|
|
37047
37194
|
}
|
|
37048
|
-
if (!Array.isArray(
|
|
37049
|
-
|
|
37195
|
+
if (!Array.isArray(ds.WindowWidth)) {
|
|
37196
|
+
ds.WindowWidth = [ds.WindowWidth];
|
|
37050
37197
|
}
|
|
37051
37198
|
}
|
|
37052
|
-
if (!
|
|
37053
|
-
|
|
37054
|
-
|
|
37055
|
-
if (
|
|
37199
|
+
if (!ds.WindowCenter || !ds.WindowWidth) {
|
|
37200
|
+
ds.WindowCenter = [];
|
|
37201
|
+
ds.WindowWidth = [];
|
|
37202
|
+
if (ds.PerFrameFunctionalGroupsSequence) {
|
|
37056
37203
|
var wcww = {
|
|
37057
37204
|
center: 0,
|
|
37058
37205
|
width: 0,
|
|
37059
37206
|
count: 0
|
|
37060
37207
|
};
|
|
37061
|
-
|
|
37208
|
+
ds.PerFrameFunctionalGroupsSequence.forEach(function(functionalGroup) {
|
|
37062
37209
|
if (functionalGroup.FrameVOILUT) {
|
|
37063
37210
|
var wc = functionalGroup.FrameVOILUTSequence.WindowCenter;
|
|
37064
37211
|
var ww = functionalGroup.FrameVOILUTSequence.WindowWidth;
|
|
@@ -37076,16 +37223,16 @@ var require_dcmjs2 = __commonJS({
|
|
|
37076
37223
|
}
|
|
37077
37224
|
});
|
|
37078
37225
|
if (wcww.count > 0) {
|
|
37079
|
-
|
|
37080
|
-
|
|
37226
|
+
ds.WindowCenter.push(String(wcww.center / wcww.count));
|
|
37227
|
+
ds.WindowWidth.push(String(wcww.width / wcww.count));
|
|
37081
37228
|
}
|
|
37082
37229
|
}
|
|
37083
37230
|
}
|
|
37084
|
-
if (
|
|
37085
|
-
|
|
37231
|
+
if (ds.WindowCenter.length === 0) {
|
|
37232
|
+
ds.WindowCenter = [300];
|
|
37086
37233
|
}
|
|
37087
|
-
if (
|
|
37088
|
-
|
|
37234
|
+
if (ds.WindowWidth.length === 0) {
|
|
37235
|
+
ds.WindowWidth = [500];
|
|
37089
37236
|
}
|
|
37090
37237
|
}
|
|
37091
37238
|
}], [{
|
|
@@ -37131,12 +37278,12 @@ var require_dcmjs2 = __commonJS({
|
|
|
37131
37278
|
key: "normalizeMultiframe",
|
|
37132
37279
|
value: function normalizeMultiframe() {
|
|
37133
37280
|
_get(_getPrototypeOf(MRImageNormalizer2.prototype), "normalizeMultiframe", this).call(this);
|
|
37134
|
-
var
|
|
37135
|
-
if (!
|
|
37136
|
-
|
|
37281
|
+
var ds = this.dataset;
|
|
37282
|
+
if (!ds.ImageType || !ds.ImageType.constructor || ds.ImageType.constructor.name != "Array" || ds.ImageType.length != 4) {
|
|
37283
|
+
ds.ImageType = ["ORIGINAL", "PRIMARY", "OTHER", "NONE"];
|
|
37137
37284
|
}
|
|
37138
|
-
|
|
37139
|
-
FrameType:
|
|
37285
|
+
ds.SharedFunctionalGroupsSequence.MRImageFrameTypeSequence = {
|
|
37286
|
+
FrameType: ds.ImageType,
|
|
37140
37287
|
PixelPresentation: "MONOCHROME",
|
|
37141
37288
|
VolumetricProperties: "VOLUME",
|
|
37142
37289
|
VolumeBasedCalculationTechnique: "NONE",
|
|
@@ -37261,9 +37408,9 @@ var require_dcmjs2 = __commonJS({
|
|
|
37261
37408
|
key: "normalize",
|
|
37262
37409
|
value: function normalize2() {
|
|
37263
37410
|
_get(_getPrototypeOf(PMImageNormalizer2.prototype), "normalize", this).call(this);
|
|
37264
|
-
var
|
|
37265
|
-
if (
|
|
37266
|
-
log2.error("Only works with 32 bit data, not " + String(
|
|
37411
|
+
var ds = this.datasets[0];
|
|
37412
|
+
if (ds.BitsAllocated !== 32) {
|
|
37413
|
+
log2.error("Only works with 32 bit data, not " + String(ds.BitsAllocated));
|
|
37267
37414
|
}
|
|
37268
37415
|
}
|
|
37269
37416
|
}]);
|
|
@@ -46230,7 +46377,7 @@ var require_dcmjs2 = __commonJS({
|
|
|
46230
46377
|
__proto__: null,
|
|
46231
46378
|
Comprehensive3DSR
|
|
46232
46379
|
});
|
|
46233
|
-
var
|
|
46380
|
+
var sr2 = {
|
|
46234
46381
|
coding,
|
|
46235
46382
|
contentItems,
|
|
46236
46383
|
documents,
|
|
@@ -46542,7 +46689,7 @@ var require_dcmjs2 = __commonJS({
|
|
|
46542
46689
|
data: data2,
|
|
46543
46690
|
derivations,
|
|
46544
46691
|
normalizers,
|
|
46545
|
-
sr,
|
|
46692
|
+
sr: sr2,
|
|
46546
46693
|
utilities,
|
|
46547
46694
|
log: log2,
|
|
46548
46695
|
anonymizer
|
|
@@ -46559,7 +46706,7 @@ var require_dcmjs2 = __commonJS({
|
|
|
46559
46706
|
exports3.derivations = derivations;
|
|
46560
46707
|
exports3.log = log2;
|
|
46561
46708
|
exports3.normalizers = normalizers;
|
|
46562
|
-
exports3.sr =
|
|
46709
|
+
exports3.sr = sr2;
|
|
46563
46710
|
exports3.utilities = utilities;
|
|
46564
46711
|
Object.defineProperty(exports3, "__esModule", { value: true });
|
|
46565
46712
|
}));
|
|
@@ -50985,10 +51132,10 @@ var ot = class {
|
|
|
50985
51132
|
}, precedence: t });
|
|
50986
51133
|
}
|
|
50987
51134
|
construct(e) {
|
|
50988
|
-
return new
|
|
51135
|
+
return new or(e, this.prefixParselets, this.infixParselets);
|
|
50989
51136
|
}
|
|
50990
51137
|
};
|
|
50991
|
-
var
|
|
51138
|
+
var or = class {
|
|
50992
51139
|
constructor(e, t, n) {
|
|
50993
51140
|
this.tokens = e, this.prefixParselets = t, this.infixParselets = n;
|
|
50994
51141
|
}
|
|
@@ -51060,104 +51207,104 @@ var we = class {
|
|
|
51060
51207
|
return this.cache.keys().next().value;
|
|
51061
51208
|
}
|
|
51062
51209
|
};
|
|
51063
|
-
var
|
|
51210
|
+
var sr = "ok";
|
|
51064
51211
|
var st = "created";
|
|
51065
|
-
var
|
|
51066
|
-
var
|
|
51067
|
-
var
|
|
51212
|
+
var cr = "not-modified";
|
|
51213
|
+
var lr = "not-found";
|
|
51214
|
+
var pr = "unauthorized";
|
|
51068
51215
|
var at = "accepted";
|
|
51069
|
-
var
|
|
51070
|
-
var Ae = { resourceType: "OperationOutcome", id:
|
|
51071
|
-
var
|
|
51072
|
-
var
|
|
51216
|
+
var xn = { resourceType: "OperationOutcome", id: lr, issue: [{ severity: "error", code: "not-found", details: { text: "Not found" } }] };
|
|
51217
|
+
var Ae = { resourceType: "OperationOutcome", id: pr, issue: [{ severity: "error", code: "login", details: { text: "Unauthorized" } }] };
|
|
51218
|
+
var vn = { ...Ae, issue: [...Ae.issue, { severity: "error", code: "expired", details: { text: "Token expired" } }] };
|
|
51219
|
+
var fr = { ...Ae, issue: [...Ae.issue, { severity: "error", code: "invalid", details: { text: "Token not issued for this audience" } }] };
|
|
51073
51220
|
function b(r6, e) {
|
|
51074
51221
|
return { resourceType: "OperationOutcome", issue: [{ severity: "error", code: "invalid", details: { text: r6 }, ...e ? { expression: [e] } : void 0 }] };
|
|
51075
51222
|
}
|
|
51076
51223
|
function y(r6) {
|
|
51077
51224
|
return { resourceType: "OperationOutcome", issue: [{ severity: "error", code: "structure", details: { text: r6 } }] };
|
|
51078
51225
|
}
|
|
51079
|
-
function
|
|
51226
|
+
function Tn(r6) {
|
|
51080
51227
|
return { resourceType: "OperationOutcome", issue: [{ severity: "error", code: "exception", details: { text: "Internal server error" }, diagnostics: r6.toString() }] };
|
|
51081
51228
|
}
|
|
51082
|
-
function
|
|
51229
|
+
function fo(r6) {
|
|
51083
51230
|
return !r6 || typeof r6 != "object" ? false : r6 instanceof Error || typeof DOMException < "u" && r6 instanceof DOMException ? true : Object.prototype.toString.call(r6) === "[object Error]";
|
|
51084
51231
|
}
|
|
51085
51232
|
function Oe(r6) {
|
|
51086
51233
|
return typeof r6 == "object" && r6 !== null && r6.resourceType === "OperationOutcome";
|
|
51087
51234
|
}
|
|
51088
|
-
function
|
|
51089
|
-
return r6.id ===
|
|
51235
|
+
function hr(r6) {
|
|
51236
|
+
return r6.id === sr || r6.id === st || r6.id === cr || r6.id === at;
|
|
51090
51237
|
}
|
|
51091
51238
|
var p = class extends Error {
|
|
51092
51239
|
constructor(e, t) {
|
|
51093
|
-
super(
|
|
51240
|
+
super(Sn(e)), this.outcome = e, this.cause = t;
|
|
51094
51241
|
}
|
|
51095
51242
|
};
|
|
51096
51243
|
function ct(r6) {
|
|
51097
51244
|
return r6 instanceof p ? r6.outcome : Oe(r6) ? r6 : b(Ie(r6));
|
|
51098
51245
|
}
|
|
51099
51246
|
function Ie(r6) {
|
|
51100
|
-
return r6 ? typeof r6 == "string" ? r6 :
|
|
51247
|
+
return r6 ? typeof r6 == "string" ? r6 : fo(r6) ? r6.message : Oe(r6) ? Sn(r6) : typeof r6 == "object" && "code" in r6 && typeof r6.code == "string" ? r6.code : JSON.stringify(r6) : "Unknown error";
|
|
51101
51248
|
}
|
|
51102
|
-
function
|
|
51103
|
-
let e = r6.issue?.map(
|
|
51249
|
+
function Sn(r6) {
|
|
51250
|
+
let e = r6.issue?.map(ho) ?? [];
|
|
51104
51251
|
return e.length > 0 ? e.join("; ") : "Unknown error";
|
|
51105
51252
|
}
|
|
51106
|
-
function
|
|
51253
|
+
function ho(r6) {
|
|
51107
51254
|
let e;
|
|
51108
51255
|
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;
|
|
51109
51256
|
}
|
|
51110
|
-
function
|
|
51257
|
+
function yo(r6, e) {
|
|
51111
51258
|
let t = e.max && e.max === Number.MAX_SAFE_INTEGER ? Number.POSITIVE_INFINITY : e.max;
|
|
51112
51259
|
return { path: r6, description: "", type: e.type ?? [], min: e.min ?? 0, max: t ?? 1, isArray: !!t && t > 1, constraints: [] };
|
|
51113
51260
|
}
|
|
51114
|
-
function
|
|
51261
|
+
function Rn(r6) {
|
|
51115
51262
|
let e = /* @__PURE__ */ Object.create(null);
|
|
51116
|
-
for (let [t, n] of Object.entries(r6)) e[t] = { name: t, type: t, path: t, elements: Object.fromEntries(Object.entries(n.elements).map(([i, o]) => [i,
|
|
51263
|
+
for (let [t, n] of Object.entries(r6)) e[t] = { name: t, type: t, path: t, elements: Object.fromEntries(Object.entries(n.elements).map(([i, o]) => [i, yo(i, o)])), constraints: [], innerTypes: [] };
|
|
51117
51264
|
return e;
|
|
51118
51265
|
}
|
|
51119
|
-
var Rn = { 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" }] } } } };
|
|
51120
|
-
function
|
|
51121
|
-
return new
|
|
51266
|
+
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" }] } } } };
|
|
51267
|
+
function xr(r6) {
|
|
51268
|
+
return new yr(r6).parse();
|
|
51122
51269
|
}
|
|
51123
|
-
var fe =
|
|
51124
|
-
var
|
|
51125
|
-
var
|
|
51126
|
-
var
|
|
51127
|
-
function
|
|
51270
|
+
var fe = Rn(Cn);
|
|
51271
|
+
var vr = /* @__PURE__ */ Object.create(null);
|
|
51272
|
+
var Pn = /* @__PURE__ */ Object.create(null);
|
|
51273
|
+
var xo = { "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" };
|
|
51274
|
+
function In(r6) {
|
|
51128
51275
|
let e;
|
|
51129
|
-
return e =
|
|
51276
|
+
return e = Pn[r6], e || (e = Pn[r6] = /* @__PURE__ */ Object.create(null)), e;
|
|
51130
51277
|
}
|
|
51131
|
-
function
|
|
51278
|
+
function Tr(r6) {
|
|
51132
51279
|
let t = (Array.isArray(r6) ? r6 : r6.entry?.map((n) => n.resource) ?? []).filter((n) => n?.resourceType === "StructureDefinition");
|
|
51133
|
-
|
|
51134
|
-
for (let n of t)
|
|
51280
|
+
Ln(t);
|
|
51281
|
+
for (let n of t) Sr(n);
|
|
51135
51282
|
}
|
|
51136
|
-
function
|
|
51283
|
+
function Sr(r6) {
|
|
51137
51284
|
if (!r6?.name) throw new Error("Failed loading StructureDefinition from bundle");
|
|
51138
51285
|
if (r6.resourceType !== "StructureDefinition") return;
|
|
51139
|
-
let e =
|
|
51140
|
-
t ? (n = fe, i = t) : r6.url === `http://hl7.org/fhir/StructureDefinition/${r6.type}` || r6.url === `https://medplum.com/fhir/StructureDefinition/${r6.type}` || r6.type?.startsWith("http://") || r6.type?.startsWith("https://") ? (n = fe, i = r6.type) : (n =
|
|
51286
|
+
let e = xr(r6), t = xo[r6.url], n, i;
|
|
51287
|
+
t ? (n = fe, i = t) : r6.url === `http://hl7.org/fhir/StructureDefinition/${r6.type}` || r6.url === `https://medplum.com/fhir/StructureDefinition/${r6.type}` || r6.type?.startsWith("http://") || r6.type?.startsWith("https://") ? (n = fe, i = r6.type) : (n = In(r6.url), i = r6.type), n[i] = e;
|
|
51141
51288
|
for (let o of e.innerTypes) o.parentType = e, n[o.name] = o;
|
|
51142
|
-
|
|
51289
|
+
vr[r6.url] = e;
|
|
51143
51290
|
}
|
|
51144
|
-
function
|
|
51291
|
+
function Vn(r6) {
|
|
51145
51292
|
return !!fe[r6];
|
|
51146
51293
|
}
|
|
51147
51294
|
function We(r6, e) {
|
|
51148
51295
|
if (e) {
|
|
51149
|
-
let t =
|
|
51296
|
+
let t = In(e)[r6];
|
|
51150
51297
|
if (t) return t;
|
|
51151
51298
|
}
|
|
51152
51299
|
return fe[r6];
|
|
51153
51300
|
}
|
|
51154
|
-
function
|
|
51155
|
-
return !!
|
|
51301
|
+
function Mn(r6) {
|
|
51302
|
+
return !!vr[r6];
|
|
51156
51303
|
}
|
|
51157
|
-
var
|
|
51304
|
+
var yr = class {
|
|
51158
51305
|
constructor(e) {
|
|
51159
51306
|
if (!e.snapshot?.element || e.snapshot.element.length === 0) throw new Error(`No snapshot defined for StructureDefinition '${e.name}'`);
|
|
51160
|
-
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:
|
|
51307
|
+
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: bo(e), elements: {}, constraints: this.parseElementDefinition(this.root).constraints, innerTypes: [], summaryProperties: /* @__PURE__ */ new Set(), mandatoryProperties: /* @__PURE__ */ new Set() }, this.innerTypes = [];
|
|
51161
51308
|
}
|
|
51162
51309
|
parse() {
|
|
51163
51310
|
let e = this.next();
|
|
@@ -51165,7 +51312,7 @@ var mr = class {
|
|
|
51165
51312
|
if (e.sliceName) this.parseSliceStart(e);
|
|
51166
51313
|
else if (e.id?.includes(":")) {
|
|
51167
51314
|
if (this.slicingContext?.current) {
|
|
51168
|
-
let t =
|
|
51315
|
+
let t = mr(e, this.slicingContext.path);
|
|
51169
51316
|
this.slicingContext.current.elements[t] = this.parseElementDefinition(e);
|
|
51170
51317
|
}
|
|
51171
51318
|
} else {
|
|
@@ -51174,13 +51321,13 @@ var mr = class {
|
|
|
51174
51321
|
let n = this.backboneContext;
|
|
51175
51322
|
for (; n; ) {
|
|
51176
51323
|
if (e.path?.startsWith(n.path + ".")) {
|
|
51177
|
-
n.type.elements[
|
|
51324
|
+
n.type.elements[mr(e, n.path)] = t;
|
|
51178
51325
|
break;
|
|
51179
51326
|
}
|
|
51180
51327
|
n = n.parent;
|
|
51181
51328
|
}
|
|
51182
51329
|
if (!n) {
|
|
51183
|
-
let i =
|
|
51330
|
+
let i = mr(e, this.root.path);
|
|
51184
51331
|
e.isSummary && this.resourceSchema.summaryProperties?.add(i.replace("[x]", "")), t.min > 0 && this.resourceSchema.mandatoryProperties?.add(i.replace("[x]", "")), this.resourceSchema.elements[i] = t;
|
|
51185
51332
|
}
|
|
51186
51333
|
this.checkFieldExit(e);
|
|
@@ -51194,11 +51341,11 @@ var mr = class {
|
|
|
51194
51341
|
}
|
|
51195
51342
|
enterInnerType(e) {
|
|
51196
51343
|
for (; this.backboneContext && !ke(this.backboneContext?.path, e.path); ) this.innerTypes.push(this.backboneContext.type), this.backboneContext = this.backboneContext.parent;
|
|
51197
|
-
let t =
|
|
51344
|
+
let t = gr(e);
|
|
51198
51345
|
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: ke(this.backboneContext?.path, e.path) ? this.backboneContext : this.backboneContext?.parent };
|
|
51199
51346
|
}
|
|
51200
51347
|
enterSlice(e, t) {
|
|
51201
|
-
|
|
51348
|
+
So(e) && !this.peek()?.sliceName || (t.slicing = { discriminator: (e.slicing?.discriminator ?? []).map((n) => {
|
|
51202
51349
|
if (n.type !== "value" && n.type !== "pattern" && n.type !== "type") throw new Error(`Unsupported slicing discriminator type: ${n.type}`);
|
|
51203
51350
|
return { path: n.path, type: n.type };
|
|
51204
51351
|
}), slices: [], ordered: e.slicing?.ordered ?? false, rule: e.slicing?.rules }, this.slicingContext = { field: t.slicing, path: e.path ?? "" });
|
|
@@ -51234,44 +51381,44 @@ var mr = class {
|
|
|
51234
51381
|
parseElementDefinitionType(e) {
|
|
51235
51382
|
return (e.type ?? []).map((t) => {
|
|
51236
51383
|
let n;
|
|
51237
|
-
return (t.code === "BackboneElement" || t.code === "Element") && (n =
|
|
51384
|
+
return (t.code === "BackboneElement" || t.code === "Element") && (n = gr(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 };
|
|
51238
51385
|
});
|
|
51239
51386
|
}
|
|
51240
51387
|
parseElementDefinition(e) {
|
|
51241
|
-
let t =
|
|
51242
|
-
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:
|
|
51388
|
+
let t = An(e.max), n = e.base?.max ? An(e.base.max) : t, i = { type: "ElementDefinition", value: e };
|
|
51389
|
+
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(P(i, "fixed[x]")), pattern: On(P(i, "pattern[x]")), binding: e.binding };
|
|
51243
51390
|
}
|
|
51244
51391
|
};
|
|
51245
|
-
function
|
|
51392
|
+
function An(r6) {
|
|
51246
51393
|
return r6 === "*" ? Number.POSITIVE_INFINITY : Number.parseInt(r6, 10);
|
|
51247
51394
|
}
|
|
51248
|
-
function
|
|
51249
|
-
return
|
|
51395
|
+
function mr(r6, e = "") {
|
|
51396
|
+
return To(r6.path, e);
|
|
51250
51397
|
}
|
|
51251
|
-
function
|
|
51398
|
+
function To(r6, e) {
|
|
51252
51399
|
return r6 ? e && r6.startsWith(e) ? r6.substring(e.length + 1) : r6 : "";
|
|
51253
51400
|
}
|
|
51254
51401
|
function ke(r6, e) {
|
|
51255
51402
|
return !r6 || !e ? false : e.startsWith(r6 + ".") || e === r6;
|
|
51256
51403
|
}
|
|
51257
|
-
function
|
|
51404
|
+
function On(r6) {
|
|
51258
51405
|
return Array.isArray(r6) && r6.length > 0 ? r6[0] : S(r6) ? void 0 : r6;
|
|
51259
51406
|
}
|
|
51260
|
-
function
|
|
51407
|
+
function So(r6) {
|
|
51261
51408
|
let e = r6.slicing?.discriminator;
|
|
51262
51409
|
return !!(r6.type?.some((t) => t.code === "Extension") && e?.length === 1 && e[0].type === "value" && e[0].path === "url");
|
|
51263
51410
|
}
|
|
51264
|
-
function
|
|
51411
|
+
function bo(r6) {
|
|
51265
51412
|
let e = r6.description;
|
|
51266
51413
|
return e?.startsWith(`Base StructureDefinition for ${r6.name} Type: `) && (e = e.substring(`Base StructureDefinition for ${r6.name} Type: `.length)), e;
|
|
51267
51414
|
}
|
|
51268
|
-
var
|
|
51415
|
+
var Co = new we(1e3);
|
|
51269
51416
|
var dt = { 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: /.*/ };
|
|
51270
51417
|
function h(r6) {
|
|
51271
51418
|
return [{ type: l.boolean, value: r6 }];
|
|
51272
51419
|
}
|
|
51273
51420
|
function v(r6) {
|
|
51274
|
-
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 } : w(r6) ? { type: l.Quantity, value: r6 } : O(r6) ? { type: r6.resourceType, value: r6 } :
|
|
51421
|
+
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 } : w(r6) ? { type: l.Quantity, value: r6 } : O(r6) ? { type: r6.resourceType, value: r6 } : Vr(r6) ? { type: l.CodeableConcept, value: r6 } : kr(r6) ? { type: l.Coding, value: r6 } : { type: l.BackboneElement, value: r6 };
|
|
51275
51422
|
}
|
|
51276
51423
|
function L(r6) {
|
|
51277
51424
|
return r6.length === 0 ? false : !!r6[0].value;
|
|
@@ -51285,9 +51432,9 @@ function G(r6, e) {
|
|
|
51285
51432
|
function P(r6, e, t) {
|
|
51286
51433
|
if (!r6.value) return;
|
|
51287
51434
|
let n = yt(r6.type, e, t?.profileUrl);
|
|
51288
|
-
return n ?
|
|
51435
|
+
return n ? Vo(r6, e, n) : Do(r6, e);
|
|
51289
51436
|
}
|
|
51290
|
-
function
|
|
51437
|
+
function Vo(r6, e, t) {
|
|
51291
51438
|
let n = r6.value, i = t.type;
|
|
51292
51439
|
if (!i || i.length === 0) return;
|
|
51293
51440
|
let o, s = "undefined", a, c2 = t.path.lastIndexOf("."), u = t.path.substring(c2 + 1);
|
|
@@ -51300,14 +51447,14 @@ function ko(r6, e, t) {
|
|
|
51300
51447
|
}
|
|
51301
51448
|
if (a) if (Array.isArray(o)) {
|
|
51302
51449
|
o = o.slice();
|
|
51303
|
-
for (let d = 0; d < Math.max(o.length, a.length); d++) o[d] =
|
|
51304
|
-
} else o =
|
|
51305
|
-
if (!S(o)) return (s === "Element" || s === "BackboneElement") && (s = t.type[0].code), Array.isArray(o) ? o.map((d) =>
|
|
51450
|
+
for (let d = 0; d < Math.max(o.length, a.length); d++) o[d] = Bn(o[d], a[d]);
|
|
51451
|
+
} else o = Bn(o, a);
|
|
51452
|
+
if (!S(o)) return (s === "Element" || s === "BackboneElement") && (s = t.type[0].code), Array.isArray(o) ? o.map((d) => Fn(d, s)) : Fn(o, s);
|
|
51306
51453
|
}
|
|
51307
|
-
function
|
|
51454
|
+
function Fn(r6, e) {
|
|
51308
51455
|
return e === "Resource" && O(r6) && (e = r6.resourceType), { type: e, value: r6 };
|
|
51309
51456
|
}
|
|
51310
|
-
function
|
|
51457
|
+
function Do(r6, e) {
|
|
51311
51458
|
let t = r6.value;
|
|
51312
51459
|
if (!t || typeof t != "object") return;
|
|
51313
51460
|
let n;
|
|
@@ -51342,27 +51489,27 @@ function ft(r6) {
|
|
|
51342
51489
|
}
|
|
51343
51490
|
return e;
|
|
51344
51491
|
}
|
|
51345
|
-
function
|
|
51492
|
+
function Wn(r6) {
|
|
51346
51493
|
return h(!L(r6));
|
|
51347
51494
|
}
|
|
51348
|
-
function
|
|
51495
|
+
function qn(r6, e) {
|
|
51349
51496
|
return r6.length === 0 || e.length === 0 ? [] : r6.length !== e.length ? h(false) : h(r6.every((t, n) => L($e(t, e[n]))));
|
|
51350
51497
|
}
|
|
51351
|
-
function
|
|
51498
|
+
function jn(r6, e) {
|
|
51352
51499
|
return r6.length === 0 || e.length === 0 ? [] : r6.length !== e.length ? h(true) : h(r6.some((t, n) => !L($e(t, e[n]))));
|
|
51353
51500
|
}
|
|
51354
51501
|
function $e(r6, e) {
|
|
51355
51502
|
let t = r6.value?.valueOf(), n = e.value?.valueOf();
|
|
51356
|
-
return typeof t == "number" && typeof n == "number" ? h(Math.abs(t - n) < 1e-8) : w(t) && w(n) ? h(
|
|
51503
|
+
return typeof t == "number" && typeof n == "number" ? h(Math.abs(t - n) < 1e-8) : w(t) && w(n) ? h(Hn(t, n)) : h(typeof t == "object" && typeof n == "object" ? Ir(r6, e) : t === n);
|
|
51357
51504
|
}
|
|
51358
|
-
function
|
|
51359
|
-
return r6.length === 0 && e.length === 0 ? h(true) : r6.length !== e.length ? h(false) : (r6.sort(
|
|
51505
|
+
function Or(r6, e) {
|
|
51506
|
+
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) => L(Mo(t, e[n])))));
|
|
51360
51507
|
}
|
|
51361
|
-
function
|
|
51508
|
+
function Mo(r6, e) {
|
|
51362
51509
|
let { type: t, value: n } = r6, { type: i, value: o } = e, s = n?.valueOf(), a = o?.valueOf();
|
|
51363
|
-
return typeof s == "number" && typeof a == "number" ? h(Math.abs(s - a) < 0.01) : w(s) && w(a) ? h(
|
|
51510
|
+
return typeof s == "number" && typeof a == "number" ? h(Math.abs(s - a) < 0.01) : w(s) && w(a) ? h(Hn(s, a)) : h(t === "Coding" && i === "Coding" ? typeof s != "object" || typeof a != "object" ? false : s.code === a.code && s.system === a.system : typeof s == "object" && typeof a == "object" ? Ir({ ...s, id: void 0 }, { ...a, id: void 0 }) : typeof s == "string" && typeof a == "string" ? s.toLowerCase() === a.toLowerCase() : s === a);
|
|
51364
51511
|
}
|
|
51365
|
-
function
|
|
51512
|
+
function Nn(r6, e) {
|
|
51366
51513
|
let t = r6.value?.valueOf(), n = e.value?.valueOf();
|
|
51367
51514
|
return typeof t == "number" && typeof n == "number" ? t - n : typeof t == "string" && typeof n == "string" ? t.localeCompare(n) : 0;
|
|
51368
51515
|
}
|
|
@@ -51377,63 +51524,63 @@ function ht(r6, e) {
|
|
|
51377
51524
|
case "Integer":
|
|
51378
51525
|
return typeof t == "number";
|
|
51379
51526
|
case "Date":
|
|
51380
|
-
return
|
|
51527
|
+
return $n(t);
|
|
51381
51528
|
case "DateTime":
|
|
51382
51529
|
return De(t);
|
|
51383
51530
|
case "Time":
|
|
51384
51531
|
return typeof t == "string" && !!/^T\d/.exec(t);
|
|
51385
51532
|
case "Period":
|
|
51386
|
-
return
|
|
51533
|
+
return Gn(t);
|
|
51387
51534
|
case "Quantity":
|
|
51388
51535
|
return w(t);
|
|
51389
51536
|
default:
|
|
51390
51537
|
return r6.type === n || typeof t == "object" && t?.resourceType === n;
|
|
51391
51538
|
}
|
|
51392
51539
|
}
|
|
51393
|
-
function
|
|
51540
|
+
function $n(r6) {
|
|
51394
51541
|
return typeof r6 == "string" && !!dt.date.exec(r6);
|
|
51395
51542
|
}
|
|
51396
51543
|
function De(r6) {
|
|
51397
51544
|
return typeof r6 == "string" && !!dt.dateTime.exec(r6);
|
|
51398
51545
|
}
|
|
51399
|
-
function
|
|
51546
|
+
function Gn(r6) {
|
|
51400
51547
|
return !!(r6 && typeof r6 == "object" && ("start" in r6 && De(r6.start) || "end" in r6 && De(r6.end)));
|
|
51401
51548
|
}
|
|
51402
51549
|
function w(r6) {
|
|
51403
51550
|
return !!(r6 && typeof r6 == "object" && "value" in r6 && typeof r6.value == "number");
|
|
51404
51551
|
}
|
|
51405
|
-
function
|
|
51552
|
+
function Hn(r6, e) {
|
|
51406
51553
|
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);
|
|
51407
51554
|
}
|
|
51408
|
-
function
|
|
51555
|
+
function Ir(r6, e) {
|
|
51409
51556
|
let t = Object.keys(r6), n = Object.keys(e);
|
|
51410
51557
|
if (t.length !== n.length) return false;
|
|
51411
51558
|
for (let i of t) {
|
|
51412
51559
|
let o = r6[i], s = e[i];
|
|
51413
|
-
if (
|
|
51414
|
-
if (!
|
|
51560
|
+
if (Un(o) && Un(s)) {
|
|
51561
|
+
if (!Ir(o, s)) return false;
|
|
51415
51562
|
} else if (o !== s) return false;
|
|
51416
51563
|
}
|
|
51417
51564
|
return true;
|
|
51418
51565
|
}
|
|
51419
|
-
function
|
|
51566
|
+
function Un(r6) {
|
|
51420
51567
|
return r6 !== null && typeof r6 == "object";
|
|
51421
51568
|
}
|
|
51422
|
-
function
|
|
51569
|
+
function Bn(r6, e) {
|
|
51423
51570
|
if (e) {
|
|
51424
51571
|
if (typeof e != "object") throw new Error("Primitive extension must be an object");
|
|
51425
|
-
return
|
|
51572
|
+
return _o(r6 ?? {}, e);
|
|
51426
51573
|
}
|
|
51427
51574
|
return r6;
|
|
51428
51575
|
}
|
|
51429
|
-
function
|
|
51576
|
+
function _o(r6, e) {
|
|
51430
51577
|
return delete e.__proto__, delete e.constructor, Object.assign(r6, e);
|
|
51431
51578
|
}
|
|
51432
51579
|
function He(r6, e) {
|
|
51433
51580
|
return O(r6, e) && "id" in r6 && typeof r6.id == "string";
|
|
51434
51581
|
}
|
|
51435
51582
|
function he(r6) {
|
|
51436
|
-
let e = D(r6) ?? "undefined/undefined", t =
|
|
51583
|
+
let e = D(r6) ?? "undefined/undefined", t = Fo(r6);
|
|
51437
51584
|
return t === e ? { reference: e } : { reference: e, display: t };
|
|
51438
51585
|
}
|
|
51439
51586
|
function D(r6) {
|
|
@@ -51443,16 +51590,16 @@ function D(r6) {
|
|
|
51443
51590
|
function me(r6) {
|
|
51444
51591
|
if (r6) return W(r6) ? r6.reference.split("/")[1] : r6.id;
|
|
51445
51592
|
}
|
|
51446
|
-
function
|
|
51593
|
+
function Lo(r6) {
|
|
51447
51594
|
return r6.resourceType === "Patient" || r6.resourceType === "Practitioner" || r6.resourceType === "RelatedPerson";
|
|
51448
51595
|
}
|
|
51449
|
-
function
|
|
51450
|
-
if (
|
|
51451
|
-
let e =
|
|
51596
|
+
function Fo(r6) {
|
|
51597
|
+
if (Lo(r6)) {
|
|
51598
|
+
let e = No(r6);
|
|
51452
51599
|
if (e) return e;
|
|
51453
51600
|
}
|
|
51454
51601
|
if (r6.resourceType === "Device") {
|
|
51455
|
-
let e =
|
|
51602
|
+
let e = Uo(r6);
|
|
51456
51603
|
if (e) return e;
|
|
51457
51604
|
}
|
|
51458
51605
|
if (r6.resourceType === "MedicationRequest" && r6.medicationCodeableConcept) return Ge(r6.medicationCodeableConcept);
|
|
@@ -51461,16 +51608,16 @@ function Lo(r6) {
|
|
|
51461
51608
|
if ("name" in r6 && r6.name && typeof r6.name == "string") return r6.name;
|
|
51462
51609
|
if ("code" in r6 && r6.code) {
|
|
51463
51610
|
let e = r6.code;
|
|
51464
|
-
if (Array.isArray(e) && (e = e[0]),
|
|
51465
|
-
if (
|
|
51611
|
+
if (Array.isArray(e) && (e = e[0]), Vr(e)) return Ge(e);
|
|
51612
|
+
if (Qo(e)) return e.text;
|
|
51466
51613
|
}
|
|
51467
51614
|
return D(r6) ?? "";
|
|
51468
51615
|
}
|
|
51469
|
-
function
|
|
51616
|
+
function No(r6) {
|
|
51470
51617
|
let e = r6.name;
|
|
51471
51618
|
if (e && e.length > 0) return Qe(e[0]);
|
|
51472
51619
|
}
|
|
51473
|
-
function
|
|
51620
|
+
function Uo(r6) {
|
|
51474
51621
|
let e = r6.deviceName;
|
|
51475
51622
|
if (e && e.length > 0) return e[0].name;
|
|
51476
51623
|
}
|
|
@@ -51492,26 +51639,26 @@ function ne(r6, ...e) {
|
|
|
51492
51639
|
return t;
|
|
51493
51640
|
}
|
|
51494
51641
|
function xt(r6, e) {
|
|
51495
|
-
let t =
|
|
51642
|
+
let t = Mr(r6);
|
|
51496
51643
|
return JSON.stringify(t, null, e ? 2 : void 0) ?? "";
|
|
51497
51644
|
}
|
|
51498
|
-
function
|
|
51499
|
-
if (!(r6 == null || r6 === "")) return typeof r6 == "object" ? Array.isArray(r6) ?
|
|
51645
|
+
function Mr(r6) {
|
|
51646
|
+
if (!(r6 == null || r6 === "")) return typeof r6 == "object" ? Array.isArray(r6) ? Wo(r6) : qo(r6) : r6;
|
|
51500
51647
|
}
|
|
51501
|
-
function
|
|
51648
|
+
function Wo(r6) {
|
|
51502
51649
|
let e = r6.length;
|
|
51503
51650
|
if (e === 0) return;
|
|
51504
51651
|
let t, n = 0;
|
|
51505
51652
|
for (let i = 0; i < e; i++) {
|
|
51506
|
-
let o = r6[i], s =
|
|
51653
|
+
let o = r6[i], s = Mr(o);
|
|
51507
51654
|
s !== o && !t && (t = Array.from(r6)), s === void 0 ? t && (t[i] = null) : (t && (t[i] = s), n++);
|
|
51508
51655
|
}
|
|
51509
51656
|
if (n !== 0) return t ?? r6;
|
|
51510
51657
|
}
|
|
51511
|
-
function
|
|
51658
|
+
function qo(r6) {
|
|
51512
51659
|
let e, t = 0;
|
|
51513
51660
|
for (let n in r6) {
|
|
51514
|
-
let i = r6[n], o =
|
|
51661
|
+
let i = r6[n], o = Mr(i);
|
|
51515
51662
|
o !== i && !e && (e = { ...r6 }), o === void 0 ? e && delete e[n] : (e && (e[n] = o), t++);
|
|
51516
51663
|
}
|
|
51517
51664
|
if (t !== 0) return e ?? r6;
|
|
@@ -51527,14 +51674,14 @@ function X(r6) {
|
|
|
51527
51674
|
return e === "string" && r6 !== "" || e === "object" && ("length" in r6 && r6.length > 0 || Object.keys(r6).length > 0);
|
|
51528
51675
|
}
|
|
51529
51676
|
function ie(r6, e, t) {
|
|
51530
|
-
return r6 === e || S(r6) && S(e) ? true : S(r6) || S(e) ? false : Array.isArray(r6) && Array.isArray(e) ?
|
|
51677
|
+
return r6 === e || S(r6) && S(e) ? true : S(r6) || S(e) ? false : Array.isArray(r6) && Array.isArray(e) ? jo(r6, e) : Array.isArray(r6) || Array.isArray(e) ? false : R(r6) && R(e) ? $o(r6, e, t) : (R(r6) || R(e), false);
|
|
51531
51678
|
}
|
|
51532
|
-
function
|
|
51679
|
+
function jo(r6, e) {
|
|
51533
51680
|
if (r6.length !== e.length) return false;
|
|
51534
51681
|
for (let t = 0; t < r6.length; t++) if (!ie(r6[t], e[t])) return false;
|
|
51535
51682
|
return true;
|
|
51536
51683
|
}
|
|
51537
|
-
function
|
|
51684
|
+
function $o(r6, e, t) {
|
|
51538
51685
|
let n = /* @__PURE__ */ new Set();
|
|
51539
51686
|
Object.keys(r6).forEach((i) => n.add(i)), Object.keys(e).forEach((i) => n.add(i)), t === "meta" && (n.delete("versionId"), n.delete("lastUpdated"), n.delete("author"));
|
|
51540
51687
|
for (let i of n) {
|
|
@@ -51546,63 +51693,63 @@ function jo(r6, e, t) {
|
|
|
51546
51693
|
function R(r6) {
|
|
51547
51694
|
return r6 !== null && typeof r6 == "object";
|
|
51548
51695
|
}
|
|
51549
|
-
function
|
|
51696
|
+
function Kn(r6) {
|
|
51550
51697
|
return r6.every(vt);
|
|
51551
51698
|
}
|
|
51552
51699
|
function vt(r6) {
|
|
51553
51700
|
return typeof r6 == "string";
|
|
51554
51701
|
}
|
|
51555
|
-
function
|
|
51702
|
+
function kr(r6) {
|
|
51556
51703
|
return R(r6) && "code" in r6 && typeof r6.code == "string";
|
|
51557
51704
|
}
|
|
51558
|
-
function
|
|
51559
|
-
return R(r6) && "coding" in r6 && Array.isArray(r6.coding) && r6.coding.every(
|
|
51705
|
+
function Vr(r6) {
|
|
51706
|
+
return R(r6) && "coding" in r6 && Array.isArray(r6.coding) && r6.coding.every(kr);
|
|
51560
51707
|
}
|
|
51561
|
-
function
|
|
51708
|
+
function Qo(r6) {
|
|
51562
51709
|
return R(r6) && "text" in r6 && typeof r6.text == "string";
|
|
51563
51710
|
}
|
|
51564
|
-
var
|
|
51565
|
-
for (let r6 = 0; r6 < 256; r6++)
|
|
51566
|
-
function
|
|
51567
|
-
let e =
|
|
51568
|
-
for (let i = 0; i < t.length; i++) n[i] =
|
|
51711
|
+
var Xn = [];
|
|
51712
|
+
for (let r6 = 0; r6 < 256; r6++) Xn.push(r6.toString(16).padStart(2, "0"));
|
|
51713
|
+
function Yn(r6) {
|
|
51714
|
+
let e = ei(r6), t = new Uint8Array(e), n = new Array(t.length);
|
|
51715
|
+
for (let i = 0; i < t.length; i++) n[i] = Xn[t[i]];
|
|
51569
51716
|
return n.join("");
|
|
51570
51717
|
}
|
|
51571
|
-
function
|
|
51572
|
-
let e =
|
|
51718
|
+
function Zn(r6) {
|
|
51719
|
+
let e = ei(r6), t = new Uint8Array(e), n = new Array(t.length);
|
|
51573
51720
|
for (let i = 0; i < t.length; i++) n[i] = String.fromCharCode(t[i]);
|
|
51574
51721
|
return window.btoa(n.join(""));
|
|
51575
51722
|
}
|
|
51576
|
-
function
|
|
51723
|
+
function ei(r6) {
|
|
51577
51724
|
return ArrayBuffer.isView(r6) ? r6.buffer : r6;
|
|
51578
51725
|
}
|
|
51579
51726
|
function k(r6) {
|
|
51580
51727
|
return r6 ? r6.charAt(0).toUpperCase() + r6.substring(1) : "";
|
|
51581
51728
|
}
|
|
51582
|
-
var
|
|
51729
|
+
var Lr = (r6) => new Promise((e) => {
|
|
51583
51730
|
setTimeout(e, r6);
|
|
51584
51731
|
});
|
|
51585
51732
|
function Tt(r6) {
|
|
51586
51733
|
return r6.sort((e, t) => e.localeCompare(t));
|
|
51587
51734
|
}
|
|
51588
|
-
function
|
|
51735
|
+
function Nr(r6) {
|
|
51589
51736
|
return r6.endsWith("/") ? r6 : r6 + "/";
|
|
51590
51737
|
}
|
|
51591
|
-
function
|
|
51738
|
+
function es(r6) {
|
|
51592
51739
|
return r6.startsWith("/") ? r6.slice(1) : r6;
|
|
51593
51740
|
}
|
|
51594
51741
|
function q(r6, e) {
|
|
51595
|
-
return new URL(
|
|
51742
|
+
return new URL(es(e), Nr(r6.toString())).toString();
|
|
51596
51743
|
}
|
|
51597
|
-
function
|
|
51744
|
+
function ii(r6, e) {
|
|
51598
51745
|
return q(r6, e).toString().replace("http://", "ws://").replace("https://", "wss://");
|
|
51599
51746
|
}
|
|
51600
|
-
function
|
|
51747
|
+
function oi(r6) {
|
|
51601
51748
|
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();
|
|
51602
51749
|
}
|
|
51603
|
-
var
|
|
51604
|
-
function
|
|
51605
|
-
return
|
|
51750
|
+
var ts = /^(([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])$/;
|
|
51751
|
+
function Dl(r6) {
|
|
51752
|
+
return ts.test(r6);
|
|
51606
51753
|
}
|
|
51607
51754
|
function Qe(r6, e) {
|
|
51608
51755
|
if (!r6) return "";
|
|
@@ -51616,9 +51763,9 @@ function Qe(r6, e) {
|
|
|
51616
51763
|
function Ge(r6) {
|
|
51617
51764
|
if (!r6) return "";
|
|
51618
51765
|
let e = ge(r6.text);
|
|
51619
|
-
return e || (r6.coding ? r6.coding.map((t) =>
|
|
51766
|
+
return e || (r6.coding ? r6.coding.map((t) => ai(t)).join(", ") : "");
|
|
51620
51767
|
}
|
|
51621
|
-
function
|
|
51768
|
+
function ai(r6, e) {
|
|
51622
51769
|
let t = ge(r6?.display);
|
|
51623
51770
|
if (t) {
|
|
51624
51771
|
let n = e ? ge(r6?.code) : void 0;
|
|
@@ -51630,32 +51777,32 @@ function ge(r6) {
|
|
|
51630
51777
|
return typeof r6 == "string" ? r6 : void 0;
|
|
51631
51778
|
}
|
|
51632
51779
|
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" };
|
|
51633
|
-
function
|
|
51780
|
+
function Ln(r6) {
|
|
51634
51781
|
let e = Array.isArray(r6) ? r6 : r6.entry?.map((t) => t.resource) ?? [];
|
|
51635
|
-
for (let t of e) t?.resourceType === "StructureDefinition" && t.kind === "resource" &&
|
|
51782
|
+
for (let t of e) t?.resourceType === "StructureDefinition" && t.kind === "resource" && li(t.type);
|
|
51636
51783
|
}
|
|
51637
|
-
function
|
|
51784
|
+
function li(r6) {
|
|
51638
51785
|
let e = F.types[r6];
|
|
51639
51786
|
return e || (e = { searchParamsDetails: {} }, F.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;
|
|
51640
51787
|
}
|
|
51641
|
-
function
|
|
51788
|
+
function Wr(r6) {
|
|
51642
51789
|
for (let e of r6.base ?? []) {
|
|
51643
|
-
let t =
|
|
51790
|
+
let t = li(e);
|
|
51644
51791
|
t.searchParams || (t.searchParams = {}), t.searchParams[r6.code] = r6;
|
|
51645
51792
|
}
|
|
51646
51793
|
}
|
|
51647
|
-
function
|
|
51794
|
+
function gr(r6) {
|
|
51648
51795
|
let e = r6.type?.[0]?.code;
|
|
51649
|
-
return e === "BackboneElement" || e === "Element" ?
|
|
51796
|
+
return e === "BackboneElement" || e === "Element" ? ps((r6.base?.path ?? r6.path)?.split(".")) : e;
|
|
51650
51797
|
}
|
|
51651
|
-
function
|
|
51798
|
+
function ps(r6) {
|
|
51652
51799
|
return r6.length === 1 ? r6[0] : r6.map(k).join("");
|
|
51653
51800
|
}
|
|
51654
51801
|
function yt(r6, e, t) {
|
|
51655
51802
|
let n = We(r6, t);
|
|
51656
|
-
if (n) return
|
|
51803
|
+
if (n) return ys(n.elements, e);
|
|
51657
51804
|
}
|
|
51658
|
-
function
|
|
51805
|
+
function ys(r6, e) {
|
|
51659
51806
|
let t = r6[e] ?? r6[e + "[x]"];
|
|
51660
51807
|
if (t) return t;
|
|
51661
51808
|
for (let n = 0; n < e.length; n++) {
|
|
@@ -51994,7 +52141,7 @@ var Pt = class extends C {
|
|
|
51994
52141
|
}
|
|
51995
52142
|
eval(e, t) {
|
|
51996
52143
|
let n = this.left.eval(e, t), i = this.right.eval(e, t);
|
|
51997
|
-
return
|
|
52144
|
+
return qn(n, i);
|
|
51998
52145
|
}
|
|
51999
52146
|
};
|
|
52000
52147
|
var wt = class extends C {
|
|
@@ -52003,7 +52150,7 @@ var wt = class extends C {
|
|
|
52003
52150
|
}
|
|
52004
52151
|
eval(e, t) {
|
|
52005
52152
|
let n = this.left.eval(e, t), i = this.right.eval(e, t);
|
|
52006
|
-
return
|
|
52153
|
+
return jn(n, i);
|
|
52007
52154
|
}
|
|
52008
52155
|
};
|
|
52009
52156
|
var At = class extends C {
|
|
@@ -52012,7 +52159,7 @@ var At = class extends C {
|
|
|
52012
52159
|
}
|
|
52013
52160
|
eval(e, t) {
|
|
52014
52161
|
let n = this.left.eval(e, t), i = this.right.eval(e, t);
|
|
52015
|
-
return
|
|
52162
|
+
return Or(n, i);
|
|
52016
52163
|
}
|
|
52017
52164
|
};
|
|
52018
52165
|
var Ot = class extends C {
|
|
@@ -52021,7 +52168,7 @@ var Ot = class extends C {
|
|
|
52021
52168
|
}
|
|
52022
52169
|
eval(e, t) {
|
|
52023
52170
|
let n = this.left.eval(e, t), i = this.right.eval(e, t);
|
|
52024
|
-
return
|
|
52171
|
+
return Wn(Or(n, i));
|
|
52025
52172
|
}
|
|
52026
52173
|
};
|
|
52027
52174
|
var Te = class extends C {
|
|
@@ -52102,37 +52249,37 @@ var Se = class {
|
|
|
52102
52249
|
};
|
|
52103
52250
|
var Je = ["!=", "!~", "<=", ">=", "{}", "->"];
|
|
52104
52251
|
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 };
|
|
52105
|
-
var
|
|
52252
|
+
var vs = { parse(r6) {
|
|
52106
52253
|
let e = r6.consumeAndParse();
|
|
52107
52254
|
if (!r6.match(")")) throw new Error("Parse error: expected `)` got `" + r6.peek()?.value + "`");
|
|
52108
52255
|
return e;
|
|
52109
52256
|
} };
|
|
52110
|
-
var
|
|
52257
|
+
var Ts = { parse(r6, e) {
|
|
52111
52258
|
let t = r6.consumeAndParse();
|
|
52112
52259
|
if (!r6.match("]")) throw new Error("Parse error: expected `]`");
|
|
52113
52260
|
return new Se(e, t);
|
|
52114
52261
|
}, precedence: g.Indexer };
|
|
52115
|
-
var
|
|
52262
|
+
var Ss = { parse(r6, e) {
|
|
52116
52263
|
if (!(e instanceof j)) throw new Error("Unexpected parentheses");
|
|
52117
52264
|
let t = [];
|
|
52118
52265
|
for (; !r6.match(")"); ) t.push(r6.consumeAndParse()), r6.match(",");
|
|
52119
52266
|
return new Z(e.name, t);
|
|
52120
52267
|
}, precedence: g.FunctionCall };
|
|
52121
|
-
function
|
|
52268
|
+
function bs(r6) {
|
|
52122
52269
|
let e = r6.split(" "), t = parseFloat(e[0]), n = e[1];
|
|
52123
52270
|
return n?.startsWith("'") && n.endsWith("'") ? n = n.substring(1, n.length - 1) : n = "{" + n + "}", { value: t, unit: n };
|
|
52124
52271
|
}
|
|
52125
52272
|
function Ke() {
|
|
52126
|
-
return new ot().registerPrefix("String", { parse: (r6, e) => new U({ type: l.string, value: e.value }) }).registerPrefix("DateTime", { parse: (r6, e) => new U({ type: l.dateTime, value: _e(e.value) }) }).registerPrefix("Quantity", { parse: (r6, e) => new U({ type: l.Quantity, value:
|
|
52273
|
+
return new ot().registerPrefix("String", { parse: (r6, e) => new U({ type: l.string, value: e.value }) }).registerPrefix("DateTime", { parse: (r6, e) => new U({ type: l.dateTime, value: _e(e.value) }) }).registerPrefix("Quantity", { parse: (r6, e) => new U({ type: l.Quantity, value: bs(e.value) }) }).registerPrefix("Number", { parse: (r6, e) => new U({ type: e.value.includes(".") ? l.decimal : l.integer, value: parseFloat(e.value) }) }).registerPrefix("true", { parse: () => new U({ type: l.boolean, value: true }) }).registerPrefix("false", { parse: () => new U({ type: l.boolean, value: false }) }).registerPrefix("Symbol", { parse: (r6, e) => new j(e.value) }).registerPrefix("{}", { parse: () => new St() }).registerPrefix("(", vs).registerInfix("[", Ts).registerInfix("(", Ss).prefix("+", g.UnaryAdd, (r6, e) => new bt("+", e, (t) => t)).prefix("-", g.UnarySubtract, (r6, e) => new V("-", e, e, (t, n) => -n)).infixLeft(".", g.Dot, (r6, e, t) => new ae(r6, t)).infixLeft("/", g.Divide, (r6, e, t) => new V("/", r6, t, (n, i) => n / i)).infixLeft("*", g.Multiply, (r6, e, t) => new V("*", r6, t, (n, i) => n * i)).infixLeft("+", g.Add, (r6, e, t) => new V("+", r6, t, (n, i) => n + i)).infixLeft("-", g.Subtract, (r6, e, t) => new V("-", r6, t, (n, i) => n - i)).infixLeft("|", g.Union, (r6, e, t) => new ve(r6, t)).infixLeft("=", g.Equals, (r6, e, t) => new Pt(r6, t)).infixLeft("!=", g.NotEquals, (r6, e, t) => new wt(r6, t)).infixLeft("~", g.Equivalent, (r6, e, t) => new At(r6, t)).infixLeft("!~", g.NotEquivalent, (r6, e, t) => new Ot(r6, t)).infixLeft("<", g.LessThan, (r6, e, t) => new V("<", r6, t, (n, i) => n < i)).infixLeft("<=", g.LessThanOrEquals, (r6, e, t) => new V("<=", r6, t, (n, i) => n <= i)).infixLeft(">", g.GreaterThan, (r6, e, t) => new V(">", r6, t, (n, i) => n > i)).infixLeft(">=", g.GreaterThanOrEquals, (r6, e, t) => new V(">=", r6, t, (n, i) => n >= i)).infixLeft("&", g.Ampersand, (r6, e, t) => new Et(r6, t)).infixLeft("and", g.And, (r6, e, t) => new It(r6, t)).infixLeft("as", g.As, (r6, e, t) => new ce(r6, t)).infixLeft("contains", g.Contains, (r6, e, t) => new Rt(r6, t)).infixLeft("div", g.Divide, (r6, e, t) => new V("div", r6, t, (n, i) => n / i | 0)).infixLeft("in", g.In, (r6, e, t) => new Ct(r6, t)).infixLeft("is", g.Is, (r6, e, t) => new Te(r6, t)).infixLeft("mod", g.Modulo, (r6, e, t) => new V("mod", r6, t, (n, i) => n % i)).infixLeft("or", g.Or, (r6, e, t) => new kt(r6, t)).infixLeft("xor", g.Xor, (r6, e, t) => new Vt(r6, t)).infixLeft("implies", g.Implies, (r6, e, t) => new Dt(r6, t));
|
|
52127
52274
|
}
|
|
52128
|
-
var
|
|
52275
|
+
var Es = Ke();
|
|
52129
52276
|
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" };
|
|
52130
|
-
var
|
|
52131
|
-
var
|
|
52132
|
-
var
|
|
52277
|
+
var Si = { 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 };
|
|
52278
|
+
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 };
|
|
52279
|
+
var ks = [f.MISSING, f.PRESENT];
|
|
52133
52280
|
var Ee = { READ: "read", VREAD: "vread", UPDATE: "update", DELETE: "delete", HISTORY: "history", CREATE: "create", SEARCH: "search" };
|
|
52134
|
-
var
|
|
52135
|
-
function
|
|
52281
|
+
var Xs = [Ee.READ, Ee.VREAD, Ee.HISTORY, Ee.SEARCH];
|
|
52282
|
+
function ea(r6) {
|
|
52136
52283
|
if (typeof window < "u") {
|
|
52137
52284
|
let e = window.atob(r6), t = Uint8Array.from(e, (n) => n.charCodeAt(0));
|
|
52138
52285
|
return new window.TextDecoder().decode(t);
|
|
@@ -52148,16 +52295,16 @@ function Ft(r6) {
|
|
|
52148
52295
|
if (typeof Buffer < "u") return Buffer.from(r6, "utf8").toString("base64");
|
|
52149
52296
|
throw new Error("Unable to encode base64");
|
|
52150
52297
|
}
|
|
52151
|
-
function
|
|
52298
|
+
function Ri(r6) {
|
|
52152
52299
|
r6 = r6.padEnd(r6.length + (4 - r6.length % 4) % 4, "=");
|
|
52153
52300
|
let e = r6.replace(/-/g, "+").replace(/_/g, "/");
|
|
52154
|
-
return
|
|
52301
|
+
return ea(e);
|
|
52155
52302
|
}
|
|
52156
|
-
function
|
|
52303
|
+
function jr() {
|
|
52157
52304
|
let r6 = new Uint32Array(28);
|
|
52158
|
-
return crypto.getRandomValues(r6),
|
|
52305
|
+
return crypto.getRandomValues(r6), Yn(r6.buffer);
|
|
52159
52306
|
}
|
|
52160
|
-
async function
|
|
52307
|
+
async function Ci(r6) {
|
|
52161
52308
|
return crypto.subtle.digest("SHA-256", new TextEncoder().encode(r6));
|
|
52162
52309
|
}
|
|
52163
52310
|
function Re() {
|
|
@@ -52167,7 +52314,7 @@ function Re() {
|
|
|
52167
52314
|
});
|
|
52168
52315
|
}
|
|
52169
52316
|
var A = { CSS: "text/css", DICOM: "application/dicom", FAVICON: "image/vnd.microsoft.icon", FHIR_JSON: "application/fhir+json", FORM_URL_ENCODED: "application/x-www-form-urlencoded", HL7_V2: "x-application/hl7-v2+er7", HTML: "text/html", JAVASCRIPT: "text/javascript", JSON: "application/json", JSON_PATCH: "application/json-patch+json", JWT: "application/jwt", MULTIPART_FORM_DATA: "multipart/form-data", PNG: "image/png", SCIM_JSON: "application/scim+json", SVG: "image/svg+xml", TEXT: "text/plain", TYPESCRIPT: "text/typescript", PING: "x-application/ping", XML: "text/xml", CDA_XML: "application/cda+xml" };
|
|
52170
|
-
var
|
|
52317
|
+
var $r = class {
|
|
52171
52318
|
constructor() {
|
|
52172
52319
|
this.listeners = {};
|
|
52173
52320
|
}
|
|
@@ -52194,7 +52341,7 @@ var jr = class {
|
|
|
52194
52341
|
};
|
|
52195
52342
|
var J = class {
|
|
52196
52343
|
constructor() {
|
|
52197
|
-
this.emitter = new
|
|
52344
|
+
this.emitter = new $r();
|
|
52198
52345
|
}
|
|
52199
52346
|
dispatchEvent(e) {
|
|
52200
52347
|
this.emitter.dispatchEvent(e);
|
|
@@ -52209,68 +52356,68 @@ var J = class {
|
|
|
52209
52356
|
this.emitter.removeAllListeners();
|
|
52210
52357
|
}
|
|
52211
52358
|
};
|
|
52212
|
-
var
|
|
52213
|
-
var
|
|
52214
|
-
var
|
|
52215
|
-
function Pi(r6) {
|
|
52216
|
-
return Gr.includes(r6);
|
|
52217
|
-
}
|
|
52359
|
+
var Gr = { "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" };
|
|
52360
|
+
var sa = ["Patient", "Encounter", "ImagingStudy", "DiagnosticReport", "OperationOutcome", "Bundle"];
|
|
52361
|
+
var Hr = ["DiagnosticReport-update"];
|
|
52218
52362
|
function wi(r6) {
|
|
52219
|
-
|
|
52220
|
-
}
|
|
52221
|
-
var sa = { "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" } } };
|
|
52222
|
-
function aa(r6) {
|
|
52223
|
-
return oa.includes(r6);
|
|
52363
|
+
return Hr.includes(r6);
|
|
52224
52364
|
}
|
|
52225
52365
|
function Ai(r6) {
|
|
52366
|
+
if (Hr.includes(r6)) throw new p(y(`'context.version' is required for '${r6}'.`));
|
|
52367
|
+
}
|
|
52368
|
+
var aa = { "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" } } };
|
|
52369
|
+
function ca(r6) {
|
|
52370
|
+
return sa.includes(r6);
|
|
52371
|
+
}
|
|
52372
|
+
function Oi(r6) {
|
|
52226
52373
|
return !!r6.endpoint;
|
|
52227
52374
|
}
|
|
52228
|
-
function
|
|
52375
|
+
function Qr(r6) {
|
|
52229
52376
|
if (!Ut(r6)) throw new p(y("subscriptionRequest must be an object conforming to SubscriptionRequest type."));
|
|
52230
52377
|
let { channelType: e, mode: t, topic: n, events: i } = r6, o = { "hub.channel.type": e, "hub.mode": t, "hub.topic": n, "hub.events": i.join(",") };
|
|
52231
|
-
return
|
|
52378
|
+
return Oi(r6) && (o.endpoint = r6.endpoint), new URLSearchParams(o).toString();
|
|
52232
52379
|
}
|
|
52233
52380
|
function Ut(r6) {
|
|
52234
52381
|
if (typeof r6 != "object") return false;
|
|
52235
52382
|
let { channelType: e, mode: t, topic: n, events: i } = r6;
|
|
52236
52383
|
if (!(e && t && n && i) || typeof n != "string" || typeof i != "object" || !Array.isArray(i) || i.length < 1 || e !== "websocket" || t !== "subscribe" && t !== "unsubscribe") return false;
|
|
52237
|
-
for (let o of i) if (
|
|
52238
|
-
return !(
|
|
52384
|
+
for (let o of i) if (!Gr[o]) return false;
|
|
52385
|
+
return !(Oi(r6) && !(typeof r6.endpoint == "string" && r6.endpoint.startsWith("ws")));
|
|
52239
52386
|
}
|
|
52240
|
-
function
|
|
52387
|
+
function ua(r6, e, t, n) {
|
|
52241
52388
|
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.`));
|
|
52242
52389
|
if (!(e.id && typeof e.id == "string")) throw new p(y(`context[${t}] is invalid. Resource must contain a valid string ID.`));
|
|
52243
52390
|
if (!e.resourceType) throw new p(y(`context[${t}] is invalid. Resource must contain a resource type. No resource type found.`));
|
|
52244
52391
|
let i = n.resourceType;
|
|
52245
52392
|
if (i !== "*") {
|
|
52246
|
-
if (!
|
|
52393
|
+
if (!ca(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.`));
|
|
52247
52394
|
if (i && e.resourceType !== i) throw new p(y(`context[${t}] is invalid. context[${t}] for the '${r6}' event should contain resource of type ${i}.`));
|
|
52248
52395
|
}
|
|
52249
52396
|
}
|
|
52250
|
-
function
|
|
52397
|
+
function la(r6, e, t, n, i) {
|
|
52251
52398
|
if (i.set(e.key, (i.get(e.key) ?? 0) + 1), n.reference) {
|
|
52252
52399
|
if (!W(e.reference)) throw new p(y(`context[${t}] is invalid. Expected key '${e.key}' to be a reference.`));
|
|
52253
|
-
} else
|
|
52400
|
+
} else ua(r6, e.resource, t, n);
|
|
52254
52401
|
}
|
|
52255
|
-
function
|
|
52256
|
-
let t = /* @__PURE__ */ new Map(), n =
|
|
52402
|
+
function da(r6, e) {
|
|
52403
|
+
let t = /* @__PURE__ */ new Map(), n = aa[r6];
|
|
52257
52404
|
for (let i = 0; i < e.length; i++) {
|
|
52258
52405
|
let o = e[i].key;
|
|
52259
52406
|
if (!n[o]) throw new p(y(`Key '${o}' not found for event '${r6}'. Make sure to add only valid keys.`));
|
|
52260
|
-
|
|
52407
|
+
la(r6, e[i], i, n[o], t);
|
|
52261
52408
|
}
|
|
52262
52409
|
for (let [i, o] of Object.entries(n)) {
|
|
52263
52410
|
if (!(o.optional || t.has(i))) throw new p(y(`Missing required key '${i}' on context for '${r6}' event.`));
|
|
52264
52411
|
if (!o.manyAllowed && (t.get(i) ?? 0) > 1) throw new p(y(`${t.get(i)} context entries with key '${i}' found for the '${r6}' event when schema only allows for 1.`));
|
|
52265
52412
|
}
|
|
52266
52413
|
}
|
|
52267
|
-
function
|
|
52414
|
+
function zr(r6, e, t, n) {
|
|
52268
52415
|
if (!(r6 && typeof r6 == "string")) throw new p(y("Must provide a topic."));
|
|
52269
|
-
if (
|
|
52416
|
+
if (!Gr[e]) throw new p(y(`Must provide a valid FHIRcast event name. Supported events: ${Object.keys(Gr).join(", ")}`));
|
|
52270
52417
|
if (typeof t != "object") throw new p(y("context must be a context object or array of context objects."));
|
|
52271
|
-
if (
|
|
52418
|
+
if (Hr.includes(e) && !n) throw new p(y(`The '${e}' event must contain a 'context.versionId'.`));
|
|
52272
52419
|
let i = Array.isArray(t) ? t : [t];
|
|
52273
|
-
return
|
|
52420
|
+
return da(e, i), { timestamp: (/* @__PURE__ */ new Date()).toISOString(), id: Re(), event: { "hub.topic": r6, "hub.event": e, context: i, ...n ? { "context.versionId": n } : {} } };
|
|
52274
52421
|
}
|
|
52275
52422
|
var Nt = class extends J {
|
|
52276
52423
|
constructor(e) {
|
|
@@ -52292,24 +52439,24 @@ var Nt = class extends J {
|
|
|
52292
52439
|
this.websocket.close();
|
|
52293
52440
|
}
|
|
52294
52441
|
};
|
|
52295
|
-
function
|
|
52296
|
-
return JSON.parse(
|
|
52442
|
+
function pa(r6) {
|
|
52443
|
+
return JSON.parse(Ri(r6));
|
|
52297
52444
|
}
|
|
52298
|
-
function
|
|
52445
|
+
function Ii(r6) {
|
|
52299
52446
|
return r6.split(".").length === 3;
|
|
52300
52447
|
}
|
|
52301
52448
|
function Bt(r6) {
|
|
52302
52449
|
let [e, t, n] = r6.split(".");
|
|
52303
|
-
return
|
|
52450
|
+
return pa(t);
|
|
52304
52451
|
}
|
|
52305
|
-
function
|
|
52452
|
+
function ki(r6) {
|
|
52306
52453
|
try {
|
|
52307
52454
|
return typeof Bt(r6).login_id == "string";
|
|
52308
52455
|
} catch {
|
|
52309
52456
|
return false;
|
|
52310
52457
|
}
|
|
52311
52458
|
}
|
|
52312
|
-
function
|
|
52459
|
+
function Vi(r6) {
|
|
52313
52460
|
try {
|
|
52314
52461
|
let t = Bt(r6).exp;
|
|
52315
52462
|
return typeof t == "number" ? t * 1e3 : void 0;
|
|
@@ -52331,11 +52478,11 @@ var Wt = class {
|
|
|
52331
52478
|
await this.medplum.delete(`keyvalue/v1/${e}`);
|
|
52332
52479
|
}
|
|
52333
52480
|
};
|
|
52334
|
-
var
|
|
52335
|
-
|
|
52481
|
+
var Di;
|
|
52482
|
+
Di = Symbol.toStringTag;
|
|
52336
52483
|
var M = class {
|
|
52337
52484
|
constructor(e) {
|
|
52338
|
-
this[
|
|
52485
|
+
this[Di] = "ReadablePromise";
|
|
52339
52486
|
this.status = "pending";
|
|
52340
52487
|
this.suspender = e.then((t) => (this.status = "success", this.response = t, t), (t) => {
|
|
52341
52488
|
throw this.status = "error", this.error = t, t;
|
|
@@ -52369,7 +52516,7 @@ var M = class {
|
|
|
52369
52516
|
};
|
|
52370
52517
|
var Ze = class {
|
|
52371
52518
|
constructor(e) {
|
|
52372
|
-
this.storage = e ?? (typeof localStorage < "u" ? localStorage : new
|
|
52519
|
+
this.storage = e ?? (typeof localStorage < "u" ? localStorage : new Jr());
|
|
52373
52520
|
}
|
|
52374
52521
|
clear() {
|
|
52375
52522
|
this.storage.clear();
|
|
@@ -52388,7 +52535,7 @@ var Ze = class {
|
|
|
52388
52535
|
this.setString(e, t ? xt(t) : void 0);
|
|
52389
52536
|
}
|
|
52390
52537
|
};
|
|
52391
|
-
var
|
|
52538
|
+
var Jr = class {
|
|
52392
52539
|
constructor() {
|
|
52393
52540
|
this.data = /* @__PURE__ */ new Map();
|
|
52394
52541
|
}
|
|
@@ -52412,8 +52559,8 @@ var zr = class {
|
|
|
52412
52559
|
}
|
|
52413
52560
|
};
|
|
52414
52561
|
var Ne = { Event: typeof globalThis.Event < "u" ? globalThis.Event : void 0, ErrorEvent: void 0, CloseEvent: void 0 };
|
|
52415
|
-
var
|
|
52416
|
-
function
|
|
52562
|
+
var _i = false;
|
|
52563
|
+
function fa() {
|
|
52417
52564
|
if (typeof globalThis.Event > "u") throw new Error("Unable to lazy init events for ReconnectingWebSocket. globalThis.Event is not defined yet");
|
|
52418
52565
|
Ne.Event = globalThis.Event, Ne.ErrorEvent = class extends Event {
|
|
52419
52566
|
constructor(e, t) {
|
|
@@ -52427,17 +52574,17 @@ function pa() {
|
|
|
52427
52574
|
}
|
|
52428
52575
|
};
|
|
52429
52576
|
}
|
|
52430
|
-
function
|
|
52577
|
+
function ha(r6, e) {
|
|
52431
52578
|
if (!r6) throw new Error(e);
|
|
52432
52579
|
}
|
|
52433
52580
|
function qt(r6) {
|
|
52434
52581
|
return new r6.constructor(r6.type, r6);
|
|
52435
52582
|
}
|
|
52436
52583
|
var Ce = { maxReconnectionDelay: 1e4, minReconnectionDelay: 1e3 + Math.random() * 4e3, minUptime: 5e3, reconnectionDelayGrowFactor: 1.3, connectionTimeout: 4e3, maxRetries: 1 / 0, maxEnqueuedMessages: 1 / 0, startClosed: false, debug: false };
|
|
52437
|
-
var
|
|
52584
|
+
var Li = false;
|
|
52438
52585
|
var jt = class r extends J {
|
|
52439
52586
|
constructor(t, n, i = {}) {
|
|
52440
|
-
|
|
52587
|
+
_i || (fa(), _i = true);
|
|
52441
52588
|
super();
|
|
52442
52589
|
this._retryCount = -1;
|
|
52443
52590
|
this._shouldReconnect = true;
|
|
@@ -52452,7 +52599,7 @@ var jt = class r extends J {
|
|
|
52452
52599
|
this._handleOpen = (t2) => {
|
|
52453
52600
|
this._debug("open event");
|
|
52454
52601
|
let { minUptime: n2 = Ce.minUptime } = this._options;
|
|
52455
|
-
clearTimeout(this._connectTimeout), this._uptimeTimeout = setTimeout(() => this._acceptOpen(), n2),
|
|
52602
|
+
clearTimeout(this._connectTimeout), this._uptimeTimeout = setTimeout(() => this._acceptOpen(), n2), ha(this._ws, "WebSocket is not defined"), this._ws.binaryType = this._binaryType, this._messageQueue.forEach((i2) => this._ws?.send(i2)), this._messageQueue = [], this.onopen && this.onopen(t2), this.dispatchEvent(qt(t2));
|
|
52456
52603
|
};
|
|
52457
52604
|
this._handleMessage = (t2) => {
|
|
52458
52605
|
this._debug("message event"), this.onmessage && this.onmessage(t2), this.dispatchEvent(qt(t2));
|
|
@@ -52562,7 +52709,7 @@ var jt = class r extends J {
|
|
|
52562
52709
|
this._connectLock = false;
|
|
52563
52710
|
return;
|
|
52564
52711
|
}
|
|
52565
|
-
!this._options.WebSocket && typeof WebSocket > "u" && !
|
|
52712
|
+
!this._options.WebSocket && typeof WebSocket > "u" && !Li && (console.error("\u203C\uFE0F No WebSocket implementation available. You should define options.WebSocket."), Li = true);
|
|
52566
52713
|
let i = this._options.WebSocket || WebSocket;
|
|
52567
52714
|
this._debug("connect", { url: this._url, protocols: this._protocols }), this._ws = this._protocols ? new i(this._url, this._protocols) : new i(this._url), this._ws.binaryType = this._binaryType, this._connectLock = false, this._addListeners(), this._connectTimeout = setTimeout(() => this._handleTimeout(), n);
|
|
52568
52715
|
}).catch((i) => {
|
|
@@ -52594,7 +52741,7 @@ var jt = class r extends J {
|
|
|
52594
52741
|
clearTimeout(this._connectTimeout), clearTimeout(this._uptimeTimeout);
|
|
52595
52742
|
}
|
|
52596
52743
|
};
|
|
52597
|
-
var
|
|
52744
|
+
var ma = 5e3;
|
|
52598
52745
|
var et = class extends J {
|
|
52599
52746
|
constructor(...e) {
|
|
52600
52747
|
super(), this.criteria = new Set(e);
|
|
@@ -52609,7 +52756,7 @@ var et = class extends J {
|
|
|
52609
52756
|
this.criteria.delete(e);
|
|
52610
52757
|
}
|
|
52611
52758
|
};
|
|
52612
|
-
var
|
|
52759
|
+
var Kr = class {
|
|
52613
52760
|
constructor(e, t) {
|
|
52614
52761
|
this.connecting = false;
|
|
52615
52762
|
this.criteria = e, this.emitter = new et(e), this.refCount = 1, this.subscriptionProps = t ? { ...t } : void 0;
|
|
@@ -52630,7 +52777,7 @@ var $t = class {
|
|
|
52630
52777
|
throw new p(y("Not a valid URL"));
|
|
52631
52778
|
}
|
|
52632
52779
|
let o = n?.ReconnectingWebSocket ? new n.ReconnectingWebSocket(i, void 0, { debug: n?.debug, debugLogger: n?.debugLogger }) : new jt(i, void 0, { debug: n?.debug, debugLogger: n?.debugLogger });
|
|
52633
|
-
this.medplum = e, this.ws = o, this.masterSubEmitter = new et(), this.criteriaEntries = /* @__PURE__ */ new Map(), this.criteriaEntriesBySubscriptionId = /* @__PURE__ */ new Map(), this.wsClosed = false, this.pingIntervalMs = n?.pingIntervalMs ??
|
|
52780
|
+
this.medplum = e, this.ws = o, this.masterSubEmitter = new et(), this.criteriaEntries = /* @__PURE__ */ new Map(), this.criteriaEntriesBySubscriptionId = /* @__PURE__ */ new Map(), this.wsClosed = false, this.pingIntervalMs = n?.pingIntervalMs ?? ma, this.currentProfile = e.getProfile(), this.setupListeners();
|
|
52634
52781
|
}
|
|
52635
52782
|
setupListeners() {
|
|
52636
52783
|
let e = this.ws;
|
|
@@ -52671,7 +52818,7 @@ var $t = class {
|
|
|
52671
52818
|
for (let o of this.getAllCriteriaEmitters()) o.dispatchEvent({ ...i });
|
|
52672
52819
|
}
|
|
52673
52820
|
}), e.addEventListener("error", () => {
|
|
52674
|
-
let t = { type: "error", payload: new p(
|
|
52821
|
+
let t = { type: "error", payload: new p(Tn(new Error("WebSocket error"))) };
|
|
52675
52822
|
this.masterSubEmitter?.dispatchEvent(t);
|
|
52676
52823
|
for (let n of this.getAllCriteriaEmitters()) n.dispatchEvent({ ...t });
|
|
52677
52824
|
}), e.addEventListener("close", () => {
|
|
@@ -52761,7 +52908,7 @@ var $t = class {
|
|
|
52761
52908
|
this.masterSubEmitter && this.masterSubEmitter._addCriteria(e);
|
|
52762
52909
|
let n = this.maybeGetCriteriaEntry(e, t);
|
|
52763
52910
|
if (n) return n.refCount += 1, n.emitter;
|
|
52764
|
-
let i = new
|
|
52911
|
+
let i = new Kr(e, t);
|
|
52765
52912
|
return this.addCriteriaEntry(i), this.subscribeToCriteria(i).catch(console.error), i.emitter;
|
|
52766
52913
|
}
|
|
52767
52914
|
removeCriteria(e, t) {
|
|
@@ -52788,24 +52935,24 @@ var $t = class {
|
|
|
52788
52935
|
return this.masterSubEmitter || (this.masterSubEmitter = new et(...Array.from(this.criteriaEntries.keys()))), this.masterSubEmitter;
|
|
52789
52936
|
}
|
|
52790
52937
|
};
|
|
52791
|
-
var
|
|
52792
|
-
var
|
|
52793
|
-
var
|
|
52794
|
-
var
|
|
52795
|
-
var
|
|
52796
|
-
var
|
|
52797
|
-
var
|
|
52798
|
-
var
|
|
52799
|
-
var
|
|
52938
|
+
var Xr = "4.3.13-a753654fa";
|
|
52939
|
+
var xa = A.FHIR_JSON + ", */*; q=0.1";
|
|
52940
|
+
var va = "https://api.medplum.com/";
|
|
52941
|
+
var Ta = 1e3;
|
|
52942
|
+
var Sa = 6e4;
|
|
52943
|
+
var ba = 0;
|
|
52944
|
+
var Ea = 3e5;
|
|
52945
|
+
var Ra = "Binary/";
|
|
52946
|
+
var Fi = { resourceType: "Device", id: "system", deviceName: [{ type: "model-name", name: "System" }] };
|
|
52800
52947
|
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" };
|
|
52801
|
-
var
|
|
52802
|
-
var
|
|
52948
|
+
var Ca = { 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" };
|
|
52949
|
+
var Pa = { JwtBearer: "urn:ietf:params:oauth:client-assertion-type:jwt-bearer" };
|
|
52803
52950
|
var Gt = class extends J {
|
|
52804
52951
|
constructor(t) {
|
|
52805
52952
|
super();
|
|
52806
52953
|
this.initComplete = true;
|
|
52807
52954
|
if (t?.baseUrl && !t.baseUrl.startsWith("http")) throw new Error("Base URL must start with http or https");
|
|
52808
|
-
this.options = t ?? {}, this.fetch = t?.fetch ??
|
|
52955
|
+
this.options = t ?? {}, this.fetch = t?.fetch ?? wa(), this.storage = t?.storage ?? new Ze(), this.createPdfImpl = t?.createPdf, this.baseUrl = Nr(t?.baseUrl ?? va), this.fhirBaseUrl = q(this.baseUrl, t?.fhirUrlPath ?? "fhir/R4"), this.authorizeUrl = q(this.baseUrl, t?.authorizeUrl ?? "oauth2/authorize"), this.tokenUrl = q(this.baseUrl, t?.tokenUrl ?? "oauth2/token"), this.logoutUrl = q(this.baseUrl, t?.logoutUrl ?? "oauth2/logout"), this.fhircastHubUrl = q(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 ?? Ea, this.cacheTime = t?.cacheTime ?? (typeof window > "u" ? ba : Sa), this.cacheTime > 0 ? this.requestCache = new we(t?.resourceCacheSize ?? Ta) : 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(() => {
|
|
52809
52956
|
t?.accessToken || this.attemptResumeActiveLogin().catch(console.error), this.initComplete = true, this.dispatchEvent({ type: "storageInitialized" });
|
|
52810
52957
|
}).catch((n) => {
|
|
52811
52958
|
console.error(n), this.initComplete = true, this.dispatchEvent({ type: "storageInitFailed", payload: { error: n } });
|
|
@@ -52917,7 +53064,7 @@ var Gt = class extends J {
|
|
|
52917
53064
|
}
|
|
52918
53065
|
async exchangeExternalAccessToken(t, n) {
|
|
52919
53066
|
if (n = n ?? this.clientId, !n) throw new Error("MedplumClient is missing clientId");
|
|
52920
|
-
return this.fetchTokens({ grant_type: Ue.TokenExchange, subject_token_type:
|
|
53067
|
+
return this.fetchTokens({ grant_type: Ue.TokenExchange, subject_token_type: Ca.AccessToken, client_id: n, subject_token: t });
|
|
52921
53068
|
}
|
|
52922
53069
|
getExternalAuthRedirectUri(t, n, i, o, s = true) {
|
|
52923
53070
|
let a = new URL(t);
|
|
@@ -52934,7 +53081,7 @@ var Gt = class extends J {
|
|
|
52934
53081
|
}
|
|
52935
53082
|
fhirSearchUrl(t, n) {
|
|
52936
53083
|
let i = this.fhirUrl(t);
|
|
52937
|
-
return n && (i.search =
|
|
53084
|
+
return n && (i.search = oi(n)), i;
|
|
52938
53085
|
}
|
|
52939
53086
|
search(t, n, i) {
|
|
52940
53087
|
let o = this.fhirSearchUrl(t, n), s = "search-" + o.toString(), a = this.getCacheEntry(s, i);
|
|
@@ -52953,7 +53100,7 @@ var Gt = class extends J {
|
|
|
52953
53100
|
searchResources(t, n, i) {
|
|
52954
53101
|
let s = "searchResources-" + this.fhirSearchUrl(t, n).toString(), a = this.getCacheEntry(s, i);
|
|
52955
53102
|
if (a) return a.value;
|
|
52956
|
-
let c2 = new M(this.search(t, n, i).then(
|
|
53103
|
+
let c2 = new M(this.search(t, n, i).then(Bi));
|
|
52957
53104
|
return this.setCacheEntry(s, c2), c2;
|
|
52958
53105
|
}
|
|
52959
53106
|
async *searchResourcePages(t, n, i) {
|
|
@@ -52963,7 +53110,7 @@ var Gt = class extends J {
|
|
|
52963
53110
|
s.has("_count") || s.set("_count", "1000");
|
|
52964
53111
|
let a = await this.search(t, s, i), c2 = a.link?.find((u) => u.relation === "next");
|
|
52965
53112
|
if (!a.entry?.length && !c2) break;
|
|
52966
|
-
yield
|
|
53113
|
+
yield Bi(a), o = c2?.url ? new URL(c2.url) : void 0;
|
|
52967
53114
|
}
|
|
52968
53115
|
}
|
|
52969
53116
|
valueSetExpand(t, n) {
|
|
@@ -52977,7 +53124,7 @@ var Gt = class extends J {
|
|
|
52977
53124
|
getCachedReference(t) {
|
|
52978
53125
|
let n = t.reference;
|
|
52979
53126
|
if (!n) return;
|
|
52980
|
-
if (n === "system") return
|
|
53127
|
+
if (n === "system") return Fi;
|
|
52981
53128
|
let [i, o] = n.split("/");
|
|
52982
53129
|
if (!(!i || !o)) return this.getCached(i, o);
|
|
52983
53130
|
}
|
|
@@ -52988,12 +53135,12 @@ var Gt = class extends J {
|
|
|
52988
53135
|
readReference(t, n) {
|
|
52989
53136
|
let i = t.reference;
|
|
52990
53137
|
if (!i) return new M(Promise.reject(new Error("Missing reference")));
|
|
52991
|
-
if (i === "system") return new M(Promise.resolve(
|
|
53138
|
+
if (i === "system") return new M(Promise.resolve(Fi));
|
|
52992
53139
|
let [o, s] = i.split("/");
|
|
52993
53140
|
return !o || !s ? new M(Promise.reject(new Error("Invalid reference"))) : this.readResource(o, s, n);
|
|
52994
53141
|
}
|
|
52995
53142
|
requestSchema(t) {
|
|
52996
|
-
if (
|
|
53143
|
+
if (Vn(t)) return Promise.resolve();
|
|
52997
53144
|
let n = t + "-requestSchema", i = this.getCacheEntry(n, void 0);
|
|
52998
53145
|
if (i) return i.value;
|
|
52999
53146
|
let o = new M((async () => {
|
|
@@ -53038,13 +53185,13 @@ var Gt = class extends J {
|
|
|
53038
53185
|
target
|
|
53039
53186
|
}
|
|
53040
53187
|
}`.replace(/\s+/g, " "), a = await this.graphql(s);
|
|
53041
|
-
|
|
53042
|
-
for (let c2 of a.data.SearchParameterList)
|
|
53188
|
+
Tr(a.data.StructureDefinitionList);
|
|
53189
|
+
for (let c2 of a.data.SearchParameterList) Wr(c2);
|
|
53043
53190
|
})());
|
|
53044
53191
|
return this.setCacheEntry(n, o), o;
|
|
53045
53192
|
}
|
|
53046
53193
|
requestProfileSchema(t, n) {
|
|
53047
|
-
if (!n?.expandProfile &&
|
|
53194
|
+
if (!n?.expandProfile && Mn(t)) return Promise.resolve();
|
|
53048
53195
|
let i = t + "-requestSchema" + (n?.expandProfile ? "-nested" : ""), o = this.getCacheEntry(i, void 0);
|
|
53049
53196
|
if (o) return o.value;
|
|
53050
53197
|
let s = new M((async () => {
|
|
@@ -53052,20 +53199,21 @@ var Gt = class extends J {
|
|
|
53052
53199
|
let a = this.fhirUrl("StructureDefinition", "$expand-profile");
|
|
53053
53200
|
a.search = new URLSearchParams({ url: t }).toString();
|
|
53054
53201
|
let c2 = await this.post(a.toString(), {});
|
|
53055
|
-
|
|
53202
|
+
Tr(c2);
|
|
53056
53203
|
} else {
|
|
53057
53204
|
let a = await this.searchOne("StructureDefinition", { url: t, _sort: "-_lastUpdated" });
|
|
53058
53205
|
if (!a) {
|
|
53059
53206
|
console.warn(`No StructureDefinition found for ${t}!`);
|
|
53060
53207
|
return;
|
|
53061
53208
|
}
|
|
53062
|
-
|
|
53209
|
+
Sr(a);
|
|
53063
53210
|
}
|
|
53064
53211
|
})());
|
|
53065
53212
|
return this.setCacheEntry(i, s), s;
|
|
53066
53213
|
}
|
|
53067
|
-
readHistory(t, n, i) {
|
|
53068
|
-
|
|
53214
|
+
readHistory(t, n, i, o) {
|
|
53215
|
+
let s = this.fhirUrl(t, n, "_history");
|
|
53216
|
+
return i?.count && s.searchParams.set("_count", i.count.toString()), i?.offset && s.searchParams.set("_offset", i.offset.toString()), this.get(s.toString(), o);
|
|
53069
53217
|
}
|
|
53070
53218
|
readVersion(t, n, i, o) {
|
|
53071
53219
|
return this.get(this.fhirUrl(t, n, "_history", i), o);
|
|
@@ -53091,7 +53239,7 @@ var Gt = class extends J {
|
|
|
53091
53239
|
return s || (s = t), this.cacheResource(s), this.invalidateUrl(this.fhirUrl(t.resourceType, t.id, "_history")), this.invalidateSearches(t.resourceType), s;
|
|
53092
53240
|
}
|
|
53093
53241
|
async createAttachment(t, n, i, o, s) {
|
|
53094
|
-
let a =
|
|
53242
|
+
let a = Wi(t, n, i, o);
|
|
53095
53243
|
if (a.contentType === A.XML) {
|
|
53096
53244
|
let d = a.data, m2;
|
|
53097
53245
|
d instanceof Blob ? m2 = await new Promise((x, B) => {
|
|
@@ -53109,7 +53257,7 @@ var Gt = class extends J {
|
|
|
53109
53257
|
return { contentType: a.contentType, url: u.url, title: a.filename };
|
|
53110
53258
|
}
|
|
53111
53259
|
createBinary(t, n, i, o, s) {
|
|
53112
|
-
let a =
|
|
53260
|
+
let a = Wi(t, n, i, o), c2 = s ?? (typeof n == "object" ? n : {}), { data: u, contentType: d, filename: m2, securityContext: x, onProgress: B } = a, $ = this.fhirUrl("Binary");
|
|
53113
53261
|
return m2 && $.searchParams.set("_filename", m2), x?.reference && this.setRequestHeader(c2, "X-Security-Context", x.reference), B ? this.uploadwithProgress($, u, d, B, c2) : this.post($, u, d, c2);
|
|
53114
53262
|
}
|
|
53115
53263
|
uploadwithProgress(t, n, i, o, s) {
|
|
@@ -53130,7 +53278,7 @@ var Gt = class extends J {
|
|
|
53130
53278
|
}
|
|
53131
53279
|
async createPdf(t, n, i, o) {
|
|
53132
53280
|
if (!this.createPdfImpl) throw new Error("PDF creation not enabled");
|
|
53133
|
-
let s =
|
|
53281
|
+
let s = Ia(t, n, i, o), a = typeof n == "object" ? n : {}, { docDefinition: c2, tableLayouts: u, fonts: d, ...m2 } = s, x = await this.createPdfImpl(c2, u, d), B = { ...m2, data: x, contentType: "application/pdf" };
|
|
53134
53282
|
return this.createBinary(B, a);
|
|
53135
53283
|
}
|
|
53136
53284
|
createComment(t, n, i) {
|
|
@@ -53193,7 +53341,7 @@ var Gt = class extends J {
|
|
|
53193
53341
|
return this.accessTokenExpires !== void 0 && Date.now() < this.accessTokenExpires - (t ?? this.refreshGracePeriod);
|
|
53194
53342
|
}
|
|
53195
53343
|
setAccessToken(t, n) {
|
|
53196
|
-
this.accessToken = t, this.refreshToken = n, this.accessTokenExpires =
|
|
53344
|
+
this.accessToken = t, this.refreshToken = n, this.accessTokenExpires = Vi(t), this.medplumServer = ki(t);
|
|
53197
53345
|
}
|
|
53198
53346
|
getLogins() {
|
|
53199
53347
|
return this.storage.getObject("logins") ?? [];
|
|
@@ -53241,7 +53389,7 @@ var Gt = class extends J {
|
|
|
53241
53389
|
async download(t, n = {}) {
|
|
53242
53390
|
this.refreshPromise && await this.refreshPromise;
|
|
53243
53391
|
let i = t.toString();
|
|
53244
|
-
i.startsWith(
|
|
53392
|
+
i.startsWith(Ra) && (t = this.fhirUrl(i));
|
|
53245
53393
|
let o = n.headers;
|
|
53246
53394
|
return o || (o = {}, n.headers = o), o.Accept || (o.Accept = "*/*"), this.addFetchOptionsDefaults(n), (await this.fetchWithRetry(t.toString(), n)).blob();
|
|
53247
53395
|
}
|
|
@@ -53299,14 +53447,14 @@ var Gt = class extends J {
|
|
|
53299
53447
|
if (s.status === 401) return this.handleUnauthenticated(t, n, i);
|
|
53300
53448
|
if (s.status === 204 || s.status === 304) return;
|
|
53301
53449
|
let c2 = s.headers.get("content-type")?.includes("json");
|
|
53302
|
-
if (s.status === 404 && !c2) throw new p(
|
|
53450
|
+
if (s.status === 404 && !c2) throw new p(xn);
|
|
53303
53451
|
let u = await this.parseBody(s, c2);
|
|
53304
53452
|
if (s.status === 200 && i.followRedirectOnOk || s.status === 201 && i.followRedirectOnCreated) {
|
|
53305
|
-
let d = await
|
|
53453
|
+
let d = await Ui(s, u);
|
|
53306
53454
|
if (d) return this.request("GET", d, { ...i, body: void 0 });
|
|
53307
53455
|
}
|
|
53308
53456
|
if (s.status === 202 && i.pollStatusOnAccepted) {
|
|
53309
|
-
let m2 = await
|
|
53457
|
+
let m2 = await Ui(s, u) ?? o.statusUrl;
|
|
53310
53458
|
if (m2) return this.pollStatus(m2, i, o);
|
|
53311
53459
|
}
|
|
53312
53460
|
if (s.status >= 400) throw new p(ct(u));
|
|
@@ -53330,10 +53478,10 @@ var Gt = class extends J {
|
|
|
53330
53478
|
for (let o = 0; o <= i; o++) try {
|
|
53331
53479
|
this.options.verbose && this.logRequest(t, n);
|
|
53332
53480
|
let s = await this.fetch(t, n);
|
|
53333
|
-
if (this.options.verbose && this.logResponse(s), this.setCurrentRateLimit(s), o >= i || !
|
|
53481
|
+
if (this.options.verbose && this.logResponse(s), this.setCurrentRateLimit(s), o >= i || !ka(s)) return s;
|
|
53334
53482
|
let a = this.getRetryDelay(o), c2 = n.maxRetryTime ?? 2e3;
|
|
53335
53483
|
if (a > c2) return s;
|
|
53336
|
-
await
|
|
53484
|
+
await Lr(a);
|
|
53337
53485
|
} catch (s) {
|
|
53338
53486
|
if (s.message === "Failed to fetch" && o === 0 && this.dispatchEvent({ type: "offline" }), s.name === "AbortError" || o === i) throw s;
|
|
53339
53487
|
}
|
|
@@ -53373,7 +53521,7 @@ var Gt = class extends J {
|
|
|
53373
53521
|
if (i.pollCount === void 0) n.headers && typeof n.headers == "object" && "Prefer" in n.headers && (o.headers = { ...n.headers }, delete o.headers.Prefer), i.statusUrl = t, i.pollCount = 1;
|
|
53374
53522
|
else {
|
|
53375
53523
|
let s = n.pollStatusPeriod ?? 1e3;
|
|
53376
|
-
await
|
|
53524
|
+
await Lr(s), i.pollCount++;
|
|
53377
53525
|
}
|
|
53378
53526
|
return this.request("GET", t, o, i);
|
|
53379
53527
|
}
|
|
@@ -53392,13 +53540,13 @@ var Gt = class extends J {
|
|
|
53392
53540
|
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 })) }, i = await this.post(this.fhirBaseUrl, n);
|
|
53393
53541
|
for (let o = 0; o < t.length; o++) {
|
|
53394
53542
|
let s = t[o], a = i.entry?.[o];
|
|
53395
|
-
a?.response?.outcome && !
|
|
53543
|
+
a?.response?.outcome && !hr(a.response.outcome) ? s.reject(new p(a.response.outcome)) : s.resolve(a?.resource);
|
|
53396
53544
|
}
|
|
53397
53545
|
}
|
|
53398
53546
|
addFetchOptionsDefaults(t) {
|
|
53399
53547
|
Object.entries(this.defaultHeaders).forEach(([n, i]) => {
|
|
53400
53548
|
this.setRequestHeader(t, n, i);
|
|
53401
|
-
}), this.setRequestHeader(t, "Accept",
|
|
53549
|
+
}), this.setRequestHeader(t, "Accept", xa, true), this.options.extendedMode !== false && this.setRequestHeader(t, "X-Medplum", "extended"), t.body && this.setRequestHeader(t, "Content-Type", A.FHIR_JSON, true), this.accessToken ? this.setRequestHeader(t, "Authorization", "Bearer " + this.accessToken) : this.basicAuth && this.setRequestHeader(t, "Authorization", "Basic " + this.basicAuth), t.cache || (t.cache = "no-cache"), t.credentials || (t.credentials = "include");
|
|
53402
53550
|
}
|
|
53403
53551
|
setRequestContentType(t, n) {
|
|
53404
53552
|
this.setRequestHeader(t, "Content-Type", n);
|
|
@@ -53415,23 +53563,23 @@ var Gt = class extends J {
|
|
|
53415
53563
|
return this.refresh() ? this.request(t, n, i) : (this.clear(), this.onUnauthenticated && this.onUnauthenticated(), Promise.reject(new p(Ae)));
|
|
53416
53564
|
}
|
|
53417
53565
|
async startPkce() {
|
|
53418
|
-
let t =
|
|
53566
|
+
let t = jr();
|
|
53419
53567
|
sessionStorage.setItem("pkceState", t);
|
|
53420
|
-
let n =
|
|
53568
|
+
let n = jr().slice(0, 128);
|
|
53421
53569
|
sessionStorage.setItem("codeVerifier", n);
|
|
53422
53570
|
try {
|
|
53423
|
-
let i = await
|
|
53424
|
-
return { codeChallengeMethod: "S256", codeChallenge:
|
|
53571
|
+
let i = await Ci(n);
|
|
53572
|
+
return { codeChallengeMethod: "S256", codeChallenge: Zn(i).replaceAll("+", "-").replaceAll("/", "_").replaceAll("=", "") };
|
|
53425
53573
|
} catch (i) {
|
|
53426
53574
|
return console.warn("Failed to hash code verifier. Falling back to 'plain' code challenge method", i), { codeChallengeMethod: "plain", codeChallenge: n };
|
|
53427
53575
|
}
|
|
53428
53576
|
}
|
|
53429
53577
|
async requestAuthorization(t) {
|
|
53430
53578
|
let n = await this.ensureCodeChallenge(t ?? {}), i = new URL(this.authorizeUrl);
|
|
53431
|
-
i.searchParams.set("response_type", "code"), i.searchParams.set("state", sessionStorage.getItem("pkceState")), i.searchParams.set("client_id", n.clientId ?? this.clientId), i.searchParams.set("redirect_uri", n.redirectUri ??
|
|
53579
|
+
i.searchParams.set("response_type", "code"), i.searchParams.set("state", sessionStorage.getItem("pkceState")), i.searchParams.set("client_id", n.clientId ?? this.clientId), i.searchParams.set("redirect_uri", n.redirectUri ?? Ni()), i.searchParams.set("code_challenge_method", n.codeChallengeMethod), i.searchParams.set("code_challenge", n.codeChallenge), i.searchParams.set("scope", n.scope ?? "openid profile"), window.location.assign(i.toString());
|
|
53432
53580
|
}
|
|
53433
53581
|
processCode(t, n) {
|
|
53434
|
-
let i = { grant_type: Ue.AuthorizationCode, code: t, client_id: n?.clientId ?? this.clientId ?? "", redirect_uri: n?.redirectUri ??
|
|
53582
|
+
let i = { grant_type: Ue.AuthorizationCode, code: t, client_id: n?.clientId ?? this.clientId ?? "", redirect_uri: n?.redirectUri ?? Ni() };
|
|
53435
53583
|
if (typeof sessionStorage < "u") {
|
|
53436
53584
|
let o = sessionStorage.getItem("codeVerifier");
|
|
53437
53585
|
o && (i.code_verifier = o);
|
|
@@ -53453,7 +53601,7 @@ var Gt = class extends J {
|
|
|
53453
53601
|
return this.clientId = t, this.fetchTokens({ grant_type: Ue.JwtBearer, client_id: t, assertion: n, scope: i });
|
|
53454
53602
|
}
|
|
53455
53603
|
async startJwtAssertionLogin(t) {
|
|
53456
|
-
return this.fetchTokens({ grant_type: Ue.ClientCredentials, client_assertion_type:
|
|
53604
|
+
return this.fetchTokens({ grant_type: Ue.ClientCredentials, client_assertion_type: Pa.JwtBearer, client_assertion: t });
|
|
53457
53605
|
}
|
|
53458
53606
|
setBasicAuth(t, n) {
|
|
53459
53607
|
this.clientId = t, this.clientSecret = n, this.basicAuth = Ft(t + ":" + n);
|
|
@@ -53461,20 +53609,20 @@ var Gt = class extends J {
|
|
|
53461
53609
|
async fhircastSubscribe(t, n) {
|
|
53462
53610
|
if (!(typeof t == "string" && t !== "")) throw new p(y("Invalid topic provided. Topic must be a valid string."));
|
|
53463
53611
|
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."));
|
|
53464
|
-
let i = { channelType: "websocket", mode: "subscribe", topic: t, events: n }, s = (await this.post(this.fhircastHubUrl,
|
|
53612
|
+
let i = { channelType: "websocket", mode: "subscribe", topic: t, events: n }, s = (await this.post(this.fhircastHubUrl, Qr(i), A.FORM_URL_ENCODED))["hub.channel.endpoint"];
|
|
53465
53613
|
if (!s) throw new Error("Invalid response!");
|
|
53466
53614
|
return i.endpoint = s, i;
|
|
53467
53615
|
}
|
|
53468
53616
|
async fhircastUnsubscribe(t) {
|
|
53469
53617
|
if (!Ut(t)) throw new p(y("Invalid topic or subscriptionRequest. SubscriptionRequest must be an object."));
|
|
53470
53618
|
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."));
|
|
53471
|
-
t.mode = "unsubscribe", await this.post(this.fhircastHubUrl,
|
|
53619
|
+
t.mode = "unsubscribe", await this.post(this.fhircastHubUrl, Qr(t), A.FORM_URL_ENCODED);
|
|
53472
53620
|
}
|
|
53473
53621
|
fhircastConnect(t) {
|
|
53474
53622
|
return new Nt(t);
|
|
53475
53623
|
}
|
|
53476
53624
|
async fhircastPublish(t, n, i, o) {
|
|
53477
|
-
return
|
|
53625
|
+
return wi(n) ? this.post(this.fhircastHubUrl, zr(t, n, i, o), A.JSON) : (Ai(n), this.post(this.fhircastHubUrl, zr(t, n, i), A.JSON));
|
|
53478
53626
|
}
|
|
53479
53627
|
async fhircastGetContext(t) {
|
|
53480
53628
|
return this.get(`${this.fhircastHubUrl}/${t}`, { cache: "no-cache" });
|
|
@@ -53505,12 +53653,12 @@ var Gt = class extends J {
|
|
|
53505
53653
|
}
|
|
53506
53654
|
async verifyTokens(t) {
|
|
53507
53655
|
let n = t.access_token;
|
|
53508
|
-
if (
|
|
53656
|
+
if (Ii(n)) {
|
|
53509
53657
|
let i = Bt(n);
|
|
53510
|
-
if (Date.now() >= i.exp * 1e3) throw this.clearActiveLogin(), new p(
|
|
53658
|
+
if (Date.now() >= i.exp * 1e3) throw this.clearActiveLogin(), new p(vn);
|
|
53511
53659
|
if (i.cid) {
|
|
53512
|
-
if (i.cid !== this.clientId) throw this.clearActiveLogin(), new p(
|
|
53513
|
-
} else if (this.clientId && i.client_id !== this.clientId) throw this.clearActiveLogin(), new p(
|
|
53660
|
+
if (i.cid !== this.clientId) throw this.clearActiveLogin(), new p(fr);
|
|
53661
|
+
} else if (this.clientId && i.client_id !== this.clientId) throw this.clearActiveLogin(), new p(fr);
|
|
53514
53662
|
}
|
|
53515
53663
|
return this.setActiveLogin({ accessToken: n, refreshToken: t.refresh_token, project: t.project, profile: t.profile });
|
|
53516
53664
|
}
|
|
@@ -53530,7 +53678,7 @@ var Gt = class extends J {
|
|
|
53530
53678
|
}
|
|
53531
53679
|
}
|
|
53532
53680
|
getSubscriptionManager() {
|
|
53533
|
-
return this.subscriptionManager || (this.subscriptionManager = new $t(this,
|
|
53681
|
+
return this.subscriptionManager || (this.subscriptionManager = new $t(this, ii(this.baseUrl, "/ws/subscriptions-r4"))), this.subscriptionManager;
|
|
53534
53682
|
}
|
|
53535
53683
|
subscribeToCriteria(t, n) {
|
|
53536
53684
|
return this.getSubscriptionManager().addCriteria(t, n);
|
|
@@ -53542,46 +53690,46 @@ var Gt = class extends J {
|
|
|
53542
53690
|
return this.getSubscriptionManager().getMasterEmitter();
|
|
53543
53691
|
}
|
|
53544
53692
|
};
|
|
53545
|
-
function
|
|
53693
|
+
function wa() {
|
|
53546
53694
|
if (!globalThis.fetch) throw new Error("Fetch not available in this environment");
|
|
53547
53695
|
return globalThis.fetch.bind(globalThis);
|
|
53548
53696
|
}
|
|
53549
|
-
function
|
|
53697
|
+
function Ni() {
|
|
53550
53698
|
return typeof window > "u" ? "" : window.location.protocol + "//" + window.location.host + "/";
|
|
53551
53699
|
}
|
|
53552
|
-
async function
|
|
53700
|
+
async function Ui(r6, e) {
|
|
53553
53701
|
let t = r6.headers.get("content-location");
|
|
53554
53702
|
if (t) return t;
|
|
53555
53703
|
let n = r6.headers.get("location");
|
|
53556
53704
|
if (n) return n;
|
|
53557
53705
|
if (Oe(e) && e.issue?.[0]?.diagnostics) return e.issue[0].diagnostics;
|
|
53558
53706
|
}
|
|
53559
|
-
function
|
|
53707
|
+
function Bi(r6) {
|
|
53560
53708
|
let e = r6.entry?.map((t) => t.resource) ?? [];
|
|
53561
53709
|
return Object.assign(e, { bundle: r6 });
|
|
53562
53710
|
}
|
|
53563
|
-
function
|
|
53711
|
+
function Aa(r6) {
|
|
53564
53712
|
return R(r6) && "data" in r6 && "contentType" in r6;
|
|
53565
53713
|
}
|
|
53566
|
-
function
|
|
53567
|
-
return
|
|
53714
|
+
function Wi(r6, e, t, n) {
|
|
53715
|
+
return Aa(r6) ? r6 : { data: r6, filename: e, contentType: t, onProgress: n };
|
|
53568
53716
|
}
|
|
53569
|
-
function
|
|
53717
|
+
function Oa(r6) {
|
|
53570
53718
|
return R(r6) && "docDefinition" in r6;
|
|
53571
53719
|
}
|
|
53572
|
-
function
|
|
53573
|
-
return
|
|
53720
|
+
function Ia(r6, e, t, n) {
|
|
53721
|
+
return Oa(r6) ? r6 : { docDefinition: r6, filename: e, tableLayouts: t, fonts: n };
|
|
53574
53722
|
}
|
|
53575
|
-
function
|
|
53723
|
+
function ka(r6) {
|
|
53576
53724
|
return r6.status === 429 || r6.status >= 500;
|
|
53577
53725
|
}
|
|
53578
|
-
var
|
|
53579
|
-
var
|
|
53580
|
-
var
|
|
53581
|
-
var
|
|
53582
|
-
var
|
|
53583
|
-
var
|
|
53584
|
-
var
|
|
53726
|
+
var $a = [...Je, "->", "<<", ">>", "=="];
|
|
53727
|
+
var Qa = Ke().registerInfix("->", { precedence: g.Arrow }).registerInfix(";", { precedence: g.Semicolon });
|
|
53728
|
+
var dc = " ".repeat(2);
|
|
53729
|
+
var fc = [...Je, "eq", "ne", "co"];
|
|
53730
|
+
var hc = { 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 };
|
|
53731
|
+
var yc = Ke();
|
|
53732
|
+
var gc = { AA: "OK", AE: "Application Error", AR: "Application Reject", CA: "Commit Accept", CE: "Commit Error", CR: "Commit Reject" };
|
|
53585
53733
|
var de = class {
|
|
53586
53734
|
constructor(e = "\r", t = "|", n = "^", i = "~", o = "\\", s = "&") {
|
|
53587
53735
|
this.segmentSeparator = e, this.fieldSeparator = t, this.componentSeparator = n, this.repetitionSeparator = i, this.escapeCharacter = o, this.subcomponentSeparator = s;
|
|
@@ -53593,7 +53741,7 @@ var de = class {
|
|
|
53593
53741
|
return this.componentSeparator + this.repetitionSeparator + this.escapeCharacter + this.subcomponentSeparator;
|
|
53594
53742
|
}
|
|
53595
53743
|
};
|
|
53596
|
-
var
|
|
53744
|
+
var ao = class r2 {
|
|
53597
53745
|
constructor(e, t = new de()) {
|
|
53598
53746
|
this.context = t, this.segments = e;
|
|
53599
53747
|
}
|
|
@@ -53617,7 +53765,7 @@ var so = class r2 {
|
|
|
53617
53765
|
}
|
|
53618
53766
|
buildAck(e) {
|
|
53619
53767
|
let t = /* @__PURE__ */ new Date(), n = this.getSegment("MSH"), i = n?.getField(3)?.toString() ?? "", o = n?.getField(4)?.toString() ?? "", s = n?.getField(5)?.toString() ?? "", a = n?.getField(6)?.toString() ?? "", c2 = n?.getField(10)?.toString() ?? "", u = n?.getField(12)?.toString() ?? "2.5.1", d = e?.ackCode ?? "AA";
|
|
53620
|
-
return new r2([new nt(["MSH", this.context.getMsh2(), s, a, i, o,
|
|
53768
|
+
return new r2([new nt(["MSH", this.context.getMsh2(), s, a, i, o, vc(t), "", this.buildAckMessageType(n), t.getTime().toString(), "P", u], this.context), new nt(["MSA", d, c2, gc[d]], this.context), ...e?.errSegment ? [e.errSegment] : []]);
|
|
53621
53769
|
}
|
|
53622
53770
|
buildAckMessageType(e) {
|
|
53623
53771
|
let t = e?.getField(9), n = t?.getComponent(2), i = t?.getComponent(3), o = "ACK";
|
|
@@ -53644,7 +53792,7 @@ var so = class r2 {
|
|
|
53644
53792
|
};
|
|
53645
53793
|
var nt = class r3 {
|
|
53646
53794
|
constructor(e, t = new de()) {
|
|
53647
|
-
this.context = t,
|
|
53795
|
+
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];
|
|
53648
53796
|
}
|
|
53649
53797
|
get(e) {
|
|
53650
53798
|
return this.fields[e];
|
|
@@ -53712,13 +53860,13 @@ var K = class r4 {
|
|
|
53712
53860
|
return true;
|
|
53713
53861
|
}
|
|
53714
53862
|
};
|
|
53715
|
-
function
|
|
53863
|
+
function vc(r6) {
|
|
53716
53864
|
let e = r6 instanceof Date ? r6 : new Date(r6), n = e.toISOString().replace(/[-:T]/g, "").replace(/(\.\d+)?Z$/, ""), i = e.getUTCMilliseconds();
|
|
53717
53865
|
return i > 0 && (n += "." + i.toString()), n;
|
|
53718
53866
|
}
|
|
53719
53867
|
var Be = { NONE: 0, ERROR: 1, WARN: 2, INFO: 3, DEBUG: 4 };
|
|
53720
|
-
var
|
|
53721
|
-
var
|
|
53868
|
+
var Tc = ["NONE", "ERROR", "WARN", "INFO", "DEBUG"];
|
|
53869
|
+
var co = class r5 {
|
|
53722
53870
|
constructor(e, t = {}, n = Be.INFO, i = {}) {
|
|
53723
53871
|
this.write = e, this.metadata = t, this.level = n, this.options = i, i?.prefix && (this.prefix = i.prefix), this.error = this.error.bind(this), this.warn = this.warn.bind(this), this.info = this.info.bind(this), this.debug = this.debug.bind(this), this.log = this.log.bind(this);
|
|
53724
53872
|
}
|
|
@@ -53743,18 +53891,37 @@ var ao = class r5 {
|
|
|
53743
53891
|
this.log(Be.DEBUG, e, t);
|
|
53744
53892
|
}
|
|
53745
53893
|
log(e, t, n) {
|
|
53746
|
-
e > this.level
|
|
53747
|
-
|
|
53894
|
+
if (e > this.level) return;
|
|
53895
|
+
let i;
|
|
53896
|
+
if (n instanceof Error) i = tr(n);
|
|
53897
|
+
else if (n) {
|
|
53898
|
+
i = { ...n };
|
|
53899
|
+
for (let [o, s] of Object.entries(i)) s instanceof Error && (i[o] = tr(s));
|
|
53900
|
+
}
|
|
53901
|
+
this.write(JSON.stringify({ level: Tc[e], timestamp: (/* @__PURE__ */ new Date()).toISOString(), msg: this.prefix ? `${this.prefix}${t}` : t, ...i, ...this.metadata }));
|
|
53748
53902
|
}
|
|
53749
53903
|
};
|
|
53750
|
-
function
|
|
53904
|
+
function nm(r6) {
|
|
53751
53905
|
let e = Be[r6.toUpperCase()];
|
|
53752
53906
|
if (e === void 0) throw new Error(`Invalid log level: ${r6}`);
|
|
53753
53907
|
return e;
|
|
53754
53908
|
}
|
|
53755
|
-
|
|
53756
|
-
|
|
53757
|
-
|
|
53909
|
+
function tr(r6, e = 0, t = 10) {
|
|
53910
|
+
if (e >= t) return { error: "Max error depth reached" };
|
|
53911
|
+
let n = { error: r6.toString(), stack: r6.stack?.split(`
|
|
53912
|
+
`) };
|
|
53913
|
+
r6.name && r6.name !== "Error" && (n.name = r6.name), r6.message && (n.message = r6.message), "cause" in r6 && r6.cause !== void 0 && (r6.cause instanceof Error ? n.cause = tr(r6.cause, e + 1, t) : n.cause = r6.cause);
|
|
53914
|
+
let i = Object.getOwnPropertyNames(r6).filter((o) => !["name", "message", "stack", "cause"].includes(o));
|
|
53915
|
+
for (let o of i) try {
|
|
53916
|
+
let s = r6[o];
|
|
53917
|
+
s instanceof Error ? n[o] = tr(s, e + 1, t) : n[o] = s;
|
|
53918
|
+
} catch {
|
|
53919
|
+
}
|
|
53920
|
+
return n;
|
|
53921
|
+
}
|
|
53922
|
+
var Dc = "https://meta.medplum.com/releases";
|
|
53923
|
+
var ir = /* @__PURE__ */ new Map();
|
|
53924
|
+
function Mc(r6) {
|
|
53758
53925
|
let e = r6;
|
|
53759
53926
|
if (!e.tag_name) throw new Error("Manifest missing tag_name");
|
|
53760
53927
|
let t = e.assets;
|
|
@@ -53764,11 +53931,11 @@ function Dc(r6) {
|
|
|
53764
53931
|
if (!n.name) throw new Error("Asset missing name");
|
|
53765
53932
|
}
|
|
53766
53933
|
}
|
|
53767
|
-
async function
|
|
53768
|
-
let n =
|
|
53934
|
+
async function un(r6, e, t) {
|
|
53935
|
+
let n = ir.get(e ?? "latest");
|
|
53769
53936
|
if (!n) {
|
|
53770
|
-
let i = e ? `v${e}` : "latest", o = new URL(`${
|
|
53771
|
-
if (o.searchParams.set("a", r6), o.searchParams.set("c",
|
|
53937
|
+
let i = e ? `v${e}` : "latest", o = new URL(`${Dc}/${i}.json`);
|
|
53938
|
+
if (o.searchParams.set("a", r6), o.searchParams.set("c", Xr), t) for (let [c2, u] of Object.entries(t)) o.searchParams.set(c2, u);
|
|
53772
53939
|
let s = await fetch(o.toString());
|
|
53773
53940
|
if (s.status !== 200) {
|
|
53774
53941
|
let c2;
|
|
@@ -53780,24 +53947,24 @@ async function cn(r6, e, t) {
|
|
|
53780
53947
|
throw new Error(`Received status code ${s.status} while fetching manifest for version '${e ?? "latest"}'. Message: ${c2}`);
|
|
53781
53948
|
}
|
|
53782
53949
|
let a = await s.json();
|
|
53783
|
-
|
|
53950
|
+
Mc(a), n = a, ir.set(e ?? "latest", n), e || ir.set(n.tag_name.slice(1), n);
|
|
53784
53951
|
}
|
|
53785
53952
|
return n;
|
|
53786
53953
|
}
|
|
53787
|
-
function
|
|
53954
|
+
function _c(r6) {
|
|
53788
53955
|
return /^\d+\.\d+\.\d+(-[0-9a-z]{7})?$/.test(r6);
|
|
53789
53956
|
}
|
|
53790
|
-
async function
|
|
53791
|
-
if (!
|
|
53957
|
+
async function Cm(r6, e) {
|
|
53958
|
+
if (!_c(e)) return false;
|
|
53792
53959
|
try {
|
|
53793
|
-
await
|
|
53960
|
+
await un(r6, e);
|
|
53794
53961
|
} catch {
|
|
53795
53962
|
return false;
|
|
53796
53963
|
}
|
|
53797
53964
|
return true;
|
|
53798
53965
|
}
|
|
53799
|
-
async function
|
|
53800
|
-
let e = await
|
|
53966
|
+
async function Pm(r6) {
|
|
53967
|
+
let e = await un(r6);
|
|
53801
53968
|
if (!e.tag_name.startsWith("v")) throw new Error(`Invalid release name found. Release tag '${e.tag_name}' did not start with 'v'`);
|
|
53802
53969
|
return e.tag_name.slice(1);
|
|
53803
53970
|
}
|
|
@@ -53853,7 +54020,7 @@ var p2 = class extends l2 {
|
|
|
53853
54020
|
this.socket = e, this.encoding = n, this.enhancedMode = s, this.messagesPerMin = o.messagesPerMin, e.on("data", (i) => {
|
|
53854
54021
|
try {
|
|
53855
54022
|
if (this.appendData(i), i.at(-2) === 28 && i.at(-1) === 13) {
|
|
53856
|
-
let r6 = Buffer.concat(this.chunks), d = r6.subarray(1, r6.length - 2), g2 = import_iconv_lite.default.decode(d, this.encoding), w2 =
|
|
54023
|
+
let r6 = Buffer.concat(this.chunks), d = r6.subarray(1, r6.length - 2), g2 = import_iconv_lite.default.decode(d, this.encoding), w2 = ao.parse(g2);
|
|
53857
54024
|
this.responseQueue.push(new m(this, w2)), this.resetBuffer(), this.processResponseQueue().catch((y2) => {
|
|
53858
54025
|
this.dispatchEvent(new c(y2));
|
|
53859
54026
|
});
|
|
@@ -53890,7 +54057,7 @@ var p2 = class extends l2 {
|
|
|
53890
54057
|
for (this.responseQueueProcessing = true; this.responseQueue.length; ) {
|
|
53891
54058
|
if (this.messagesPerMin) {
|
|
53892
54059
|
let n = L2 / this.messagesPerMin, s = Date.now() - this.lastMessageDispatchedTime;
|
|
53893
|
-
n > s && await
|
|
54060
|
+
n > s && await Lr(n - s);
|
|
53894
54061
|
}
|
|
53895
54062
|
let e = this.responseQueue.shift();
|
|
53896
54063
|
e && this.dispatchEvent(e), this.lastMessageDispatchedTime = Date.now();
|
|
@@ -54039,7 +54206,7 @@ var H = class {
|
|
|
54039
54206
|
let d = new p2(r6, this.encoding, this.enhancedMode, { messagesPerMin: this.messagesPerMin });
|
|
54040
54207
|
this.handler(d);
|
|
54041
54208
|
}), i = async (r6) => {
|
|
54042
|
-
r6?.code === "EADDRINUSE" && (await
|
|
54209
|
+
r6?.code === "EADDRINUSE" && (await Lr(50), o.close(), o.listen(t));
|
|
54043
54210
|
};
|
|
54044
54211
|
o.on("error", i), o.once("listening", () => {
|
|
54045
54212
|
o.off("error", i);
|
|
@@ -54159,8 +54326,8 @@ var AgentDicomChannel = class extends BaseChannel {
|
|
|
54159
54326
|
this.association = association;
|
|
54160
54327
|
association.setMaxPduLength(65536);
|
|
54161
54328
|
association.getPresentationContexts().forEach(({ context }) => {
|
|
54162
|
-
context.getTransferSyntaxUids().forEach((
|
|
54163
|
-
context.setResult(dimse.constants.PresentationContextResult.Accept,
|
|
54329
|
+
context.getTransferSyntaxUids().forEach((ts2) => {
|
|
54330
|
+
context.setResult(dimse.constants.PresentationContextResult.Accept, ts2);
|
|
54164
54331
|
});
|
|
54165
54332
|
});
|
|
54166
54333
|
this.sendAssociationAccept();
|
|
@@ -54274,7 +54441,7 @@ var AgentDicomChannel = class extends BaseChannel {
|
|
|
54274
54441
|
this.server.on("networkError", async (err) => {
|
|
54275
54442
|
this.log.error("Network error: ", { err });
|
|
54276
54443
|
if (err?.code === "EADDRINUSE") {
|
|
54277
|
-
await
|
|
54444
|
+
await Lr(50);
|
|
54278
54445
|
this.server.close();
|
|
54279
54446
|
this.server.listen(port);
|
|
54280
54447
|
}
|
|
@@ -54348,7 +54515,7 @@ var AgentHl7Channel = class extends BaseChannel {
|
|
|
54348
54515
|
sendToRemote(msg) {
|
|
54349
54516
|
const connection = this.connections.get(msg.remote);
|
|
54350
54517
|
if (connection) {
|
|
54351
|
-
connection.hl7Connection.send(
|
|
54518
|
+
connection.hl7Connection.send(ao.parse(msg.body));
|
|
54352
54519
|
} else {
|
|
54353
54520
|
this.log.warn(`Attempted to send message to disconnected remote: ${msg.remote}`);
|
|
54354
54521
|
}
|
|
@@ -54448,7 +54615,7 @@ var import_node_os2 = require("node:os");
|
|
|
54448
54615
|
var import_node_path2 = __toESM(require("node:path"));
|
|
54449
54616
|
var import_node_process = __toESM(require("node:process"));
|
|
54450
54617
|
var EXIT_SIGNALS = ["SIGINT", "SIGTERM", "SIGHUP"];
|
|
54451
|
-
var pidLogger = new
|
|
54618
|
+
var pidLogger = new co((msg) => `[PID]: ${msg}`);
|
|
54452
54619
|
var pidFileApps = /* @__PURE__ */ new Set();
|
|
54453
54620
|
var processExitListener = () => {
|
|
54454
54621
|
removeAllPidFiles();
|
|
@@ -54566,7 +54733,7 @@ async function waitForPidFile(appName, timeoutMs = 3e3) {
|
|
|
54566
54733
|
if (Date.now() - startTime > timeoutMs) {
|
|
54567
54734
|
throw new Error("Timeout while waiting for PID file");
|
|
54568
54735
|
}
|
|
54569
|
-
await
|
|
54736
|
+
await Lr(0);
|
|
54570
54737
|
}
|
|
54571
54738
|
}
|
|
54572
54739
|
function removeAllPidFiles() {
|
|
@@ -54597,7 +54764,7 @@ var UPGRADER_LOG_PATH = (0, import_node_path3.resolve)(
|
|
|
54597
54764
|
);
|
|
54598
54765
|
var RELEASES_PATH = (0, import_node_path3.resolve)(__dirname);
|
|
54599
54766
|
async function downloadRelease(version, path4) {
|
|
54600
|
-
const release = await
|
|
54767
|
+
const release = await un("agent-upgrader", version);
|
|
54601
54768
|
const downloadUrl = parseDownloadUrl(release, (0, import_node_os3.platform)());
|
|
54602
54769
|
const { body } = await fetch(downloadUrl);
|
|
54603
54770
|
if (!body) {
|
|
@@ -54672,7 +54839,7 @@ var App = class _App {
|
|
|
54672
54839
|
this.medplum = medplum;
|
|
54673
54840
|
this.agentId = agentId;
|
|
54674
54841
|
this.logLevel = logLevel;
|
|
54675
|
-
this.log = new
|
|
54842
|
+
this.log = new co((msg) => console.log(msg), void 0, logLevel);
|
|
54676
54843
|
}
|
|
54677
54844
|
async start() {
|
|
54678
54845
|
this.log.info("Medplum service starting...");
|
|
@@ -54692,7 +54859,7 @@ var App = class _App {
|
|
|
54692
54859
|
if ((0, import_node_fs4.existsSync)(UPGRADE_MANIFEST_PATH)) {
|
|
54693
54860
|
const upgradeFile = (0, import_node_fs4.readFileSync)(UPGRADE_MANIFEST_PATH, { encoding: "utf-8" });
|
|
54694
54861
|
const upgradeDetails = JSON.parse(upgradeFile);
|
|
54695
|
-
if (
|
|
54862
|
+
if (Xr.startsWith(upgradeDetails.targetVersion)) {
|
|
54696
54863
|
await this.sendToWebSocket({
|
|
54697
54864
|
type: "agent:upgrade:response",
|
|
54698
54865
|
statusCode: 200,
|
|
@@ -54700,7 +54867,7 @@ var App = class _App {
|
|
|
54700
54867
|
});
|
|
54701
54868
|
this.log.info(`Successfully upgraded to version ${upgradeDetails.targetVersion}`);
|
|
54702
54869
|
} else {
|
|
54703
|
-
const errMsg = `Failed to upgrade to version ${upgradeDetails.targetVersion}. Agent still running with version ${
|
|
54870
|
+
const errMsg = `Failed to upgrade to version ${upgradeDetails.targetVersion}. Agent still running with version ${Xr}`;
|
|
54704
54871
|
await this.sendToWebSocket({
|
|
54705
54872
|
type: "agent:error",
|
|
54706
54873
|
body: errMsg,
|
|
@@ -54728,7 +54895,7 @@ var App = class _App {
|
|
|
54728
54895
|
if (attempt === maxAttempts) {
|
|
54729
54896
|
throw new Error("Too many unsuccessful attempts to create agent PID file");
|
|
54730
54897
|
}
|
|
54731
|
-
await
|
|
54898
|
+
await Lr(500);
|
|
54732
54899
|
}
|
|
54733
54900
|
}
|
|
54734
54901
|
}
|
|
@@ -54796,7 +54963,7 @@ var App = class _App {
|
|
|
54796
54963
|
break;
|
|
54797
54964
|
case "agent:heartbeat:request":
|
|
54798
54965
|
this.outstandingHeartbeats = 0;
|
|
54799
|
-
await this.sendToWebSocket({ type: "agent:heartbeat:response", version:
|
|
54966
|
+
await this.sendToWebSocket({ type: "agent:heartbeat:response", version: Xr });
|
|
54800
54967
|
break;
|
|
54801
54968
|
case "agent:heartbeat:response":
|
|
54802
54969
|
this.outstandingHeartbeats = 0;
|
|
@@ -55101,7 +55268,7 @@ IPv6 is currently unsupported.`;
|
|
|
55101
55268
|
this.log.error(errMsg);
|
|
55102
55269
|
throw new Error(errMsg);
|
|
55103
55270
|
}
|
|
55104
|
-
if (!((0, import_node_net3.isIPv4)(message.remote) ||
|
|
55271
|
+
if (!((0, import_node_net3.isIPv4)(message.remote) || Dl(message.remote))) {
|
|
55105
55272
|
const errMsg = `Attempted to ping an invalid host.
|
|
55106
55273
|
|
|
55107
55274
|
"${message.remote}" is not a valid IPv4 address or a resolvable hostname.`;
|
|
@@ -55153,7 +55320,7 @@ ${result}`);
|
|
|
55153
55320
|
}
|
|
55154
55321
|
}
|
|
55155
55322
|
async tryUpgradeAgent(message) {
|
|
55156
|
-
this.log.info(`Attempting to upgrade from ${
|
|
55323
|
+
this.log.info(`Attempting to upgrade from ${Xr} to ${message.version ?? "latest"}...`);
|
|
55157
55324
|
if ((0, import_node_os4.platform)() !== "win32") {
|
|
55158
55325
|
const errMsg = "Auto-upgrading is currently only supported on Windows";
|
|
55159
55326
|
this.log.error(errMsg);
|
|
@@ -55176,7 +55343,7 @@ ${result}`);
|
|
|
55176
55343
|
return;
|
|
55177
55344
|
}
|
|
55178
55345
|
let child;
|
|
55179
|
-
if (message.version && !await
|
|
55346
|
+
if (message.version && !await Cm("agent-upgrader", message.version)) {
|
|
55180
55347
|
const versionTag = message.version ? `v${message.version}` : "latest";
|
|
55181
55348
|
const errMsg = `Error during upgrading to version '${versionTag}'. '${message.version}' is not a valid version`;
|
|
55182
55349
|
this.log.error(errMsg);
|
|
@@ -55187,8 +55354,8 @@ ${result}`);
|
|
|
55187
55354
|
});
|
|
55188
55355
|
return;
|
|
55189
55356
|
}
|
|
55190
|
-
const targetVersion = message.version ?? await
|
|
55191
|
-
if (
|
|
55357
|
+
const targetVersion = message.version ?? await Pm("agent-upgrader");
|
|
55358
|
+
if (Xr.startsWith(targetVersion)) {
|
|
55192
55359
|
if (!message?.force) {
|
|
55193
55360
|
this.log.info(`Attempted to upgrade to version ${targetVersion}, but agent is already on that version`);
|
|
55194
55361
|
await this.sendToWebSocket({
|
|
@@ -55198,7 +55365,7 @@ ${result}`);
|
|
|
55198
55365
|
});
|
|
55199
55366
|
return;
|
|
55200
55367
|
}
|
|
55201
|
-
this.log.info(`Forcing upgrade from ${
|
|
55368
|
+
this.log.info(`Forcing upgrade from ${Xr} to ${targetVersion}`);
|
|
55202
55369
|
}
|
|
55203
55370
|
if (semver.lt(targetVersion, "4.2.4") && !message.force) {
|
|
55204
55371
|
const errMsg = `WARNING: ${targetVersion} predates the zero-downtime upgrade feature. Downgrading to this version will 1) incur downtime during the downgrade process, as the current agent must stop itself before installing the older agent, and 2) incur downtime on any subsequent upgrade to a later version. We recommend against downgrading to this version, but if you must, reissue the command with force set to true to downgrade.`;
|
|
@@ -55258,11 +55425,11 @@ ${result}`);
|
|
|
55258
55425
|
return;
|
|
55259
55426
|
}
|
|
55260
55427
|
try {
|
|
55261
|
-
this.log.info("Writing upgrade manifest...", { previousVersion:
|
|
55428
|
+
this.log.info("Writing upgrade manifest...", { previousVersion: Xr, targetVersion });
|
|
55262
55429
|
(0, import_node_fs4.writeFileSync)(
|
|
55263
55430
|
UPGRADE_MANIFEST_PATH,
|
|
55264
55431
|
JSON.stringify({
|
|
55265
|
-
previousVersion:
|
|
55432
|
+
previousVersion: Xr,
|
|
55266
55433
|
targetVersion,
|
|
55267
55434
|
callback: message.callback ?? null
|
|
55268
55435
|
}),
|
|
@@ -55336,7 +55503,7 @@ ${result}`);
|
|
|
55336
55503
|
});
|
|
55337
55504
|
}
|
|
55338
55505
|
}
|
|
55339
|
-
const requestMsg =
|
|
55506
|
+
const requestMsg = ao.parse(message.body);
|
|
55340
55507
|
const msh10 = requestMsg.getSegment("MSH")?.getField(10);
|
|
55341
55508
|
if (!msh10) {
|
|
55342
55509
|
this.log.error("MSH.10 is missing but required");
|
|
@@ -55432,10 +55599,10 @@ async function agentMain(argv) {
|
|
|
55432
55599
|
} catch (err) {
|
|
55433
55600
|
console.error("Failed to login", { err: Ie(err) });
|
|
55434
55601
|
console.log("Retrying login in 10 seconds...");
|
|
55435
|
-
await
|
|
55602
|
+
await Lr(RETRY_WAIT_DURATION_MS);
|
|
55436
55603
|
}
|
|
55437
55604
|
}
|
|
55438
|
-
const app = new App(medplum, agentId,
|
|
55605
|
+
const app = new App(medplum, agentId, nm(args.logLevel ?? "INFO"));
|
|
55439
55606
|
await app.start();
|
|
55440
55607
|
process.on("SIGINT", async () => {
|
|
55441
55608
|
console.log("Gracefully shutting down from SIGINT (Ctrl-C)");
|
|
@@ -55464,7 +55631,7 @@ async function upgraderMain(argv) {
|
|
|
55464
55631
|
if ((0, import_node_os5.platform)() !== "win32") {
|
|
55465
55632
|
throw new Error(`Unsupported platform: ${(0, import_node_os5.platform)()}. Agent upgrader currently only supports Windows`);
|
|
55466
55633
|
}
|
|
55467
|
-
const globalLogger = new
|
|
55634
|
+
const globalLogger = new co((msg) => console.log(msg));
|
|
55468
55635
|
if (!import_node_process3.default.send) {
|
|
55469
55636
|
globalLogger.error("Upgrader not started as a child process with Node IPC enabled. Aborting...");
|
|
55470
55637
|
import_node_process3.default.exit(1);
|
|
@@ -55474,10 +55641,10 @@ async function upgraderMain(argv) {
|
|
|
55474
55641
|
rejectOnTimeout = () => reject(new Error("Timed out while waiting for IPC to disconnect"));
|
|
55475
55642
|
import_node_process3.default.once("disconnect", resolve2);
|
|
55476
55643
|
});
|
|
55477
|
-
if (argv[3] && !
|
|
55644
|
+
if (argv[3] && !_c(argv[3])) {
|
|
55478
55645
|
throw new Error("Invalid version specified");
|
|
55479
55646
|
}
|
|
55480
|
-
const version = argv[3] ?? await
|
|
55647
|
+
const version = argv[3] ?? await Pm("agent-upgrader");
|
|
55481
55648
|
const binPath = getReleaseBinPath(version);
|
|
55482
55649
|
if (!(0, import_node_fs6.existsSync)(binPath)) {
|
|
55483
55650
|
globalLogger.info(`Could not find binary at "${binPath}". Downloading release from GitHub...`);
|
|
@@ -55528,7 +55695,7 @@ async function main(argv) {
|
|
|
55528
55695
|
} else if (argv[2] === "--remove-old-services") {
|
|
55529
55696
|
const logFileFd = (0, import_node_fs7.openSync)(TEMP_LOG_FILE, "a");
|
|
55530
55697
|
let allAgentServices = [];
|
|
55531
|
-
const currentServiceName = `MedplumAgent_${
|
|
55698
|
+
const currentServiceName = `MedplumAgent_${Xr}`;
|
|
55532
55699
|
while (!allAgentServices.includes(currentServiceName)) {
|
|
55533
55700
|
const output = (0, import_node_child_process3.execSync)('cmd.exe /c sc query type= service state= all | findstr /i "SERVICE_NAME.*MedplumAgent"');
|
|
55534
55701
|
(0, import_node_fs7.appendFileSync)(logFileFd, `${output}\r
|
|
@@ -55538,8 +55705,8 @@ async function main(argv) {
|
|
|
55538
55705
|
${allAgentServices.join("\r\n")}\r
|
|
55539
55706
|
`, { encoding: "utf-8" });
|
|
55540
55707
|
}
|
|
55541
|
-
const servicesToRemove = argv[3] === "--all" ? allAgentServices : allAgentServices.filter((serviceName) => serviceName !== `MedplumAgent_${
|
|
55542
|
-
(0, import_node_fs7.appendFileSync)(logFileFd, `Medplum agent service to filter out: MedplumAgent_${
|
|
55708
|
+
const servicesToRemove = argv[3] === "--all" ? allAgentServices : allAgentServices.filter((serviceName) => serviceName !== `MedplumAgent_${Xr}`);
|
|
55709
|
+
(0, import_node_fs7.appendFileSync)(logFileFd, `Medplum agent service to filter out: MedplumAgent_${Xr}\r
|
|
55543
55710
|
`, {
|
|
55544
55711
|
encoding: "utf-8"
|
|
55545
55712
|
});
|