@medplum/core 1.0.5 → 1.0.6
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/README.md +9 -7
- package/dist/cjs/format.d.ts +2 -1
- package/dist/cjs/{index.js → index.cjs} +325 -363
- package/dist/cjs/index.cjs.map +1 -0
- package/dist/cjs/index.min.cjs +1 -0
- package/dist/cjs/search.d.ts +2 -1
- package/dist/esm/{base-schema.json.js → base-schema.json.mjs} +1 -1
- package/dist/esm/{base-schema.json.js.map → base-schema.json.mjs.map} +1 -1
- package/dist/esm/{cache.js → cache.mjs} +2 -2
- package/dist/esm/cache.mjs.map +1 -0
- package/dist/esm/{client.js → client.mjs} +241 -246
- package/dist/esm/client.mjs.map +1 -0
- package/dist/esm/{crypto.js → crypto.mjs} +4 -7
- package/dist/esm/crypto.mjs.map +1 -0
- package/dist/esm/{eventtarget.js → eventtarget.mjs} +2 -2
- package/dist/esm/eventtarget.mjs.map +1 -0
- package/dist/esm/fhirlexer/{parse.js → parse.mjs} +5 -6
- package/dist/esm/fhirlexer/parse.mjs.map +1 -0
- package/dist/esm/fhirlexer/{tokenize.js → tokenize.mjs} +11 -11
- package/dist/esm/fhirlexer/tokenize.mjs.map +1 -0
- package/dist/esm/fhirpath/{atoms.js → atoms.mjs} +11 -12
- package/dist/esm/fhirpath/atoms.mjs.map +1 -0
- package/dist/esm/fhirpath/{date.js → date.mjs} +1 -1
- package/dist/esm/fhirpath/date.mjs.map +1 -0
- package/dist/esm/fhirpath/{functions.js → functions.mjs} +16 -22
- package/dist/esm/fhirpath/functions.mjs.map +1 -0
- package/dist/esm/fhirpath/{parse.js → parse.mjs} +9 -10
- package/dist/esm/fhirpath/parse.mjs.map +1 -0
- package/dist/esm/fhirpath/{tokenize.js → tokenize.mjs} +3 -3
- package/dist/esm/fhirpath/tokenize.mjs.map +1 -0
- package/dist/esm/fhirpath/{utils.js → utils.mjs} +6 -7
- package/dist/esm/fhirpath/utils.mjs.map +1 -0
- package/dist/esm/format.d.ts +2 -1
- package/dist/esm/{format.js → format.mjs} +29 -21
- package/dist/esm/format.mjs.map +1 -0
- package/dist/esm/{hl7.js → hl7.mjs} +8 -9
- package/dist/esm/hl7.mjs.map +1 -0
- package/dist/esm/index.min.mjs +1 -0
- package/dist/esm/{index.js → index.mjs} +17 -17
- package/dist/esm/index.mjs.map +1 -0
- package/dist/esm/{jwt.js → jwt.mjs} +1 -1
- package/dist/esm/jwt.mjs.map +1 -0
- package/dist/esm/{match.js → match.mjs} +12 -13
- package/dist/esm/match.mjs.map +1 -0
- package/dist/esm/node_modules/tslib/{tslib.es6.js → tslib.es6.mjs} +2 -12
- package/dist/esm/node_modules/tslib/tslib.es6.mjs.map +1 -0
- package/dist/esm/{outcomes.js → outcomes.mjs} +3 -5
- package/dist/esm/outcomes.mjs.map +1 -0
- package/dist/esm/{readablepromise.js → readablepromise.mjs} +2 -2
- package/dist/esm/readablepromise.mjs.map +1 -0
- package/dist/esm/search.d.ts +2 -1
- package/dist/esm/{search.js → search.mjs} +1 -1
- package/dist/esm/search.mjs.map +1 -0
- package/dist/esm/{searchparams.js → searchparams.mjs} +8 -9
- package/dist/esm/searchparams.mjs.map +1 -0
- package/dist/esm/{storage.js → storage.mjs} +4 -5
- package/dist/esm/storage.mjs.map +1 -0
- package/dist/esm/{types.js → types.mjs} +6 -9
- package/dist/esm/types.mjs.map +1 -0
- package/dist/esm/{utils.js → utils.mjs} +15 -26
- package/dist/esm/utils.mjs.map +1 -0
- package/package.json +5 -5
- package/rollup.config.mjs +6 -7
- package/dist/cjs/fhirmapper/testall.d.ts +0 -1
- package/dist/cjs/index.js.map +0 -1
- package/dist/cjs/index.min.js +0 -2
- package/dist/cjs/index.min.js.map +0 -1
- package/dist/esm/cache.js.map +0 -1
- package/dist/esm/client.js.map +0 -1
- package/dist/esm/crypto.js.map +0 -1
- package/dist/esm/eventtarget.js.map +0 -1
- package/dist/esm/fhirlexer/parse.js.map +0 -1
- package/dist/esm/fhirlexer/tokenize.js.map +0 -1
- package/dist/esm/fhirmapper/testall.d.ts +0 -1
- package/dist/esm/fhirpath/atoms.js.map +0 -1
- package/dist/esm/fhirpath/date.js.map +0 -1
- package/dist/esm/fhirpath/functions.js.map +0 -1
- package/dist/esm/fhirpath/parse.js.map +0 -1
- package/dist/esm/fhirpath/tokenize.js.map +0 -1
- package/dist/esm/fhirpath/utils.js.map +0 -1
- package/dist/esm/format.js.map +0 -1
- package/dist/esm/hl7.js.map +0 -1
- package/dist/esm/index.js.map +0 -1
- package/dist/esm/index.min.js +0 -2
- package/dist/esm/index.min.js.map +0 -1
- package/dist/esm/jwt.js.map +0 -1
- package/dist/esm/match.js.map +0 -1
- package/dist/esm/node_modules/tslib/tslib.es6.js.map +0 -1
- package/dist/esm/outcomes.js.map +0 -1
- package/dist/esm/readablepromise.js.map +0 -1
- package/dist/esm/search.js.map +0 -1
- package/dist/esm/searchparams.js.map +0 -1
- package/dist/esm/storage.js.map +0 -1
- package/dist/esm/types.js.map +0 -1
- package/dist/esm/utils.js.map +0 -1
package/dist/cjs/index.min.js
DELETED
|
@@ -1,2 +0,0 @@
|
|
|
1
|
-
!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?t(exports):"function"==typeof define&&define.amd?define(["exports"],t):t(((e="undefined"!=typeof globalThis?globalThis:e||self).medplum=e.medplum||{},e.medplum.core={}))}(this,(function(e){"use strict";function t(e,t,n,i){return new(n||(n=Promise))((function(o,r){function a(e){try{c(i.next(e))}catch(e){r(e)}}function s(e){try{c(i.throw(e))}catch(e){r(e)}}function c(e){var t;e.done?o(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(a,s)}c((i=i.apply(e,t||[])).next())}))}function n(e,t,n,i){if("a"===n&&!i)throw new TypeError("Private accessor was defined without a getter");if("function"==typeof t?e!==t||!i:!t.has(e))throw new TypeError("Cannot read private member from an object whose class did not declare it");return"m"===n?i:"a"===n?i.call(e):i?i.value:t.get(e)}function i(e,t,n,i,o){if("m"===i)throw new TypeError("Private method is not writable");if("a"===i&&!o)throw new TypeError("Private accessor was defined without a setter");if("function"==typeof t?e!==t||!o:!t.has(e))throw new TypeError("Cannot write private member to an object whose class did not declare it");return"a"===i?o.call(e,n):o?o.value=n:t.set(e,n),n}var o,r,a,s;class c{constructor(e=10){o.add(this),r.set(this,void 0),a.set(this,void 0),i(this,r,e,"f"),i(this,a,new Map,"f")}clear(){n(this,a,"f").clear()}get(e){const t=n(this,a,"f").get(e);return t&&(n(this,a,"f").delete(e),n(this,a,"f").set(e,t)),t}set(e,t){n(this,a,"f").has(e)?n(this,a,"f").delete(e):n(this,a,"f").size>=n(this,r,"f")&&n(this,a,"f").delete(n(this,o,"m",s).call(this)),n(this,a,"f").set(e,t)}delete(e){n(this,a,"f").delete(e)}keys(){return n(this,a,"f").keys()}}function d(e,t){const n=[];return e.prefix&&!1!==(null==t?void 0:t.prefix)&&n.push(...e.prefix),e.given&&n.push(...e.given),e.family&&n.push(e.family),e.suffix&&!1!==(null==t?void 0:t.suffix)&&n.push(...e.suffix),e.use&&((null==t?void 0:t.all)||(null==t?void 0:t.use))&&n.push("["+e.use+"]"),n.join(" ").trim()}function l(e){return e instanceof Date&&!isNaN(e.getTime())}function u(e,t,n){if(!e)return"";const i=new Date("2000-01-01T"+e+"Z");return l(i)?i.toLocaleTimeString(t,n):""}function p(e,t,n){if(!e)return"";const i=new Date(e);return l(i)?i.toLocaleString(t,n):""}r=new WeakMap,a=new WeakMap,o=new WeakSet,s=function(){return n(this,a,"f").keys().next().value};const m={s:"every second",min:"every minute",h:"hourly",d:"daily",wk:"weekly",mo:"monthly",a:"annually"},h={s:"second",min:"minute",h:"hour",d:"day",wk:"week",mo:"month",a:"year"},f={s:"seconds",min:"minutes",h:"hours",d:"days",wk:"weeks",mo:"months",a:"years"};function y(e,t){if(!e)return"";const n=[];return e.comparator&&(n.push(e.comparator),n.push(" ")),void 0!==e.value&&(void 0!==t?n.push(e.value.toFixed(t)):n.push(e.value)),e.unit&&("%"!==e.unit&&" "!==n[n.length-1]&&n.push(" "),n.push(e.unit)),n.join("").trim()}function g(e){return e?e.text?e.text:e.coding?e.coding.map((e=>x(e))).join(", "):"":""}function x(e){return(null==e?void 0:e.display)||(null==e?void 0:e.code)||""}function v(e,t){return void 0===t?e:Math.round(e*Math.pow(10,t))}function S(e){const t=T(e),n=E(e);return n===t?{reference:t}:{reference:t,display:n}}function T(e){return e.resourceType+"/"+e.id}function w(e){return"Patient"===e.resourceType||"Practitioner"===e.resourceType||"RelatedPerson"===e.resourceType}function E(e){var t;if(w(e)){const t=function(e){const t=e.name;if(t&&t.length>0)return d(t[0]);return}(e);if(t)return t}if("Device"===e.resourceType){const t=function(e){const t=e.deviceName;if(t&&t.length>0)return t[0].name;return}(e);if(t)return t}return"Observation"===e.resourceType&&"code"in e&&(null===(t=e.code)||void 0===t?void 0:t.text)?e.code.text:"User"===e.resourceType&&e.email?e.email:"name"in e&&e.name&&"string"==typeof e.name?e.name:T(e)}function b(e){if(e.url&&e.contentType&&e.contentType.startsWith("image/"))return e.url}function P(e,t){const n=new Date(e);n.setUTCHours(0,0,0,0);const i=t?new Date(t):new Date;i.setUTCHours(0,0,0,0);const o=n.getUTCFullYear(),r=n.getUTCMonth(),a=n.getUTCDate(),s=i.getUTCFullYear(),c=i.getUTCMonth(),d=i.getUTCDate();let l=s-o;(c<r||c===r&&d<a)&&l--;let u=12*s+c-(12*o+r);d<a&&u--;return{years:l,months:u,days:Math.floor((i.getTime()-n.getTime())/864e5)}}function D(e,t){if(e)for(const n of e)n.linkId&&n.answer&&n.answer.length>0&&(t[n.linkId]=n.answer[0]),D(n.item,t)}function C(e,t){return JSON.stringify(e,A,t?2:void 0)}function A(e,t){return!function(e){return!!e.match(/\d+$/)}(e)&&R(t)?void 0:t}function R(e){if(null==e)return!0;const t=typeof e;return"string"===t&&""===e||"object"===t&&0===Object.keys(e).length}function O(e,t,n){return e===t||(!(!R(e)||!R(t))||!R(e)&&!R(t)&&(Array.isArray(e)&&Array.isArray(t)?function(e,t){if(e.length!==t.length)return!1;for(let n=0;n<e.length;n++)if(!O(e[n],t[n]))return!1;return!0}(e,t):!Array.isArray(e)&&!Array.isArray(t)&&(k(e)&&k(t)?function(e,t,n){const i=new Set;Object.keys(e).forEach((e=>i.add(e))),Object.keys(t).forEach((e=>i.add(e))),"meta"===n&&(i.delete("versionId"),i.delete("lastUpdated"),i.delete("author"));for(const n of i){if(!O(e[n],t[n],n))return!1}return!0}(e,t,n):(k(e)||k(t),!1))))}function k(e){return null!==e&&"object"==typeof e}function I(e){return e.every((e=>"string"==typeof e))}const M=[];for(let e=0;e<256;e++)M.push(e.toString(16).padStart(2,"0"));function U(e){const t=new Uint8Array(e),n=new Array(t.length);for(let e=0;e<t.length;e++)n[e]=M[t[e]];return n.join("")}function L(e){const t=new Uint8Array(e),n=[];for(let e=0;e<t.length;e++)n[e]=String.fromCharCode(t[e]);return window.btoa(n.join(""))}function N(e){return e.charAt(0).toUpperCase()+e.substring(1)}function j(e,t){return function(e,t){return!e.gender||e.gender===t.gender}(e,t)&&function(e,t){return!e.age||_(P(t.birthDate).years,e.age)}(e,t)}function _(e,t,n){var i,o;return(void 0===(null===(i=t.low)||void 0===i?void 0:i.value)||B(e,t.low.value,n))&&(void 0===(null===(o=t.high)||void 0===o?void 0:o.value)||Q(e,t.high.value,n))}function Q(e,t,n){return W(e,n)<=W(t,n)}function B(e,t,n){return W(e,n)>=W(t,n)}function W(e,t){return void 0===t?e:Math.round(e*Math.pow(10,t))}function q(){const e=new Uint32Array(28);return crypto.getRandomValues(e),U(e.buffer)}var $,F,H,z,V,G,X,Y;class J{constructor(){$.set(this,void 0),i(this,$,{},"f")}addEventListener(e,t){n(this,$,"f")[e]||(n(this,$,"f")[e]=[]),n(this,$,"f")[e].push(t)}removeEventListeneer(e,t){const i=n(this,$,"f")[e];if(i)for(let e=0;e<i.length;e++)if(i[e]===t)return void i.splice(e,1)}dispatchEvent(e){const t=n(this,$,"f")[e.type];return t&&t.forEach((t=>t.call(this,e))),!e.defaultPrevented}}function Z(e){const t=function(e){if("undefined"!=typeof window)return window.atob(e);if("undefined"!=typeof Buffer)return Buffer.from(e,"base64").toString("binary");throw new Error("Unable to decode base64")}(e.replace(/-/g,"+").replace(/_/g,"/")),n=Array.from(t).reduce(((e,t)=>`${e}%${("00"+t.charCodeAt(0).toString(16)).slice(-2)}`),""),i=decodeURIComponent(n);return JSON.parse(i)}function K(e){const[t,n,i]=e.split(".");return Z(n)}$=new WeakMap;class ee{constructor(e){this[G]="ReadablePromise",F.set(this,void 0),H.set(this,"pending"),z.set(this,void 0),V.set(this,void 0),i(this,F,e.then((e=>(i(this,H,"success","f"),i(this,z,e,"f"),e)),(e=>{throw i(this,H,"error","f"),i(this,V,e,"f"),e})),"f")}isPending(){return"pending"===n(this,H,"f")}isOk(){return"success"===n(this,H,"f")}read(){switch(n(this,H,"f")){case"pending":throw n(this,F,"f");case"error":throw n(this,V,"f");default:return n(this,z,"f")}}then(e,t){return n(this,F,"f").then(e,t)}catch(e){return n(this,F,"f").catch(e)}finally(e){return n(this,F,"f").finally(e)}}F=new WeakMap,H=new WeakMap,z=new WeakMap,V=new WeakMap,G=Symbol.toStringTag;class te{constructor(){X.set(this,void 0),i(this,X,"undefined"!=typeof localStorage?localStorage:new ne,"f")}clear(){n(this,X,"f").clear()}getString(e){return n(this,X,"f").getItem(e)||void 0}setString(e,t){t?n(this,X,"f").setItem(e,t):n(this,X,"f").removeItem(e)}getObject(e){const t=this.getString(e);return t?JSON.parse(t):void 0}setObject(e,t){this.setString(e,t?C(t):void 0)}}X=new WeakMap;class ne{constructor(){Y.set(this,void 0),i(this,Y,new Map,"f")}get length(){return n(this,Y,"f").size}clear(){n(this,Y,"f").clear()}getItem(e){var t;return null!==(t=n(this,Y,"f").get(e))&&void 0!==t?t:null}setItem(e,t){t?n(this,Y,"f").set(e,t):n(this,Y,"f").delete(e)}removeItem(e){n(this,Y,"f").delete(e)}key(e){return Array.from(n(this,Y,"f").keys())[e]}}Y=new WeakMap;var ie,oe={types:{Element:{display:"Element",properties:{id:{min:0,max:"1",type:[{code:"string"}]},extension:{min:0,max:"*",type:[{code:"Extension"}]}}},BackboneElement:{display:"BackboneElement",properties:{id:{min:0,max:"1",type:[{code:"string"}]},extension:{min:0,max:"*",type:[{code:"Extension"}]},modifierExtension:{min:0,max:"*",type:[{code:"Extension"}]}}},Address:{display:"Address",properties:{id:{min:0,max:"1",type:[{code:"string"}]},extension:{min:0,max:"*",type:[{code:"Extension"}]},use:{min:0,max:"1",type:[{code:"code"}]},type:{min:0,max:"1",type:[{code:"code"}]},text:{min:0,max:"1",type:[{code:"string"}]},line:{min:0,max:"*",type:[{code:"string"}]},city:{min:0,max:"1",type:[{code:"string"}]},district:{min:0,max:"1",type:[{code:"string"}]},state:{min:0,max:"1",type:[{code:"string"}]},postalCode:{min:0,max:"1",type:[{code:"string"}]},country:{min:0,max:"1",type:[{code:"string"}]},period:{min:0,max:"1",type:[{code:"Period"}]}}},Age:{display:"Age",properties:{id:{min:0,max:"1",type:[{code:"string"}]},extension:{min:0,max:"*",type:[{code:"Extension"}]},value:{min:0,max:"1",type:[{code:"decimal"}]},comparator:{min:0,max:"1",type:[{code:"code"}]},unit:{min:0,max:"1",type:[{code:"string"}]},system:{min:0,max:"1",type:[{code:"uri"}]},code:{min:0,max:"1",type:[{code:"code"}]}}},Annotation:{display:"Annotation",properties:{id:{min:0,max:"1",type:[{code:"string"}]},extension:{min:0,max:"*",type:[{code:"Extension"}]},"author[x]":{min:0,max:"1",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:{min:0,max:"1",type:[{code:"dateTime"}]},text:{min:1,max:"1",type:[{code:"markdown"}]}}},Attachment:{display:"Attachment",properties:{id:{min:0,max:"1",type:[{code:"string"}]},extension:{min:0,max:"*",type:[{code:"Extension"}]},contentType:{min:0,max:"1",type:[{code:"code"}]},language:{min:0,max:"1",type:[{code:"code"}]},data:{min:0,max:"1",type:[{code:"base64Binary"}]},url:{min:0,max:"1",type:[{code:"url"}]},size:{min:0,max:"1",type:[{code:"unsignedInt"}]},hash:{min:0,max:"1",type:[{code:"base64Binary"}]},title:{min:0,max:"1",type:[{code:"string"}]},creation:{min:0,max:"1",type:[{code:"dateTime"}]}}},CodeableConcept:{display:"CodeableConcept",properties:{id:{min:0,max:"1",type:[{code:"string"}]},extension:{min:0,max:"*",type:[{code:"Extension"}]},coding:{min:0,max:"*",type:[{code:"Coding"}]},text:{min:0,max:"1",type:[{code:"string"}]}}},Coding:{display:"Coding",properties:{id:{min:0,max:"1",type:[{code:"string"}]},extension:{min:0,max:"*",type:[{code:"Extension"}]},system:{min:0,max:"1",type:[{code:"uri"}]},version:{min:0,max:"1",type:[{code:"string"}]},code:{min:0,max:"1",type:[{code:"code"}]},display:{min:0,max:"1",type:[{code:"string"}]},userSelected:{min:0,max:"1",type:[{code:"boolean"}]}}},ContactDetail:{display:"ContactDetail",properties:{id:{min:0,max:"1",type:[{code:"string"}]},extension:{min:0,max:"*",type:[{code:"Extension"}]},name:{min:0,max:"1",type:[{code:"string"}]},telecom:{min:0,max:"*",type:[{code:"ContactPoint"}]}}},ContactPoint:{display:"ContactPoint",properties:{id:{min:0,max:"1",type:[{code:"string"}]},extension:{min:0,max:"*",type:[{code:"Extension"}]},system:{min:0,max:"1",type:[{code:"code"}]},value:{min:0,max:"1",type:[{code:"string"}]},use:{min:0,max:"1",type:[{code:"code"}]},rank:{min:0,max:"1",type:[{code:"positiveInt"}]},period:{min:0,max:"1",type:[{code:"Period"}]}}},Contributor:{display:"Contributor",properties:{id:{min:0,max:"1",type:[{code:"string"}]},extension:{min:0,max:"*",type:[{code:"Extension"}]},type:{min:1,max:"1",type:[{code:"code"}]},name:{min:1,max:"1",type:[{code:"string"}]},contact:{min:0,max:"*",type:[{code:"ContactDetail"}]}}},Count:{display:"Count",properties:{id:{min:0,max:"1",type:[{code:"string"}]},extension:{min:0,max:"*",type:[{code:"Extension"}]},value:{min:0,max:"1",type:[{code:"decimal"}]},comparator:{min:0,max:"1",type:[{code:"code"}]},unit:{min:0,max:"1",type:[{code:"string"}]},system:{min:0,max:"1",type:[{code:"uri"}]},code:{min:0,max:"1",type:[{code:"code"}]}}},DataRequirement:{display:"DataRequirement",properties:{id:{min:0,max:"1",type:[{code:"string"}]},extension:{min:0,max:"*",type:[{code:"Extension"}]},type:{min:1,max:"1",type:[{code:"code"}]},profile:{min:0,max:"*",type:[{code:"canonical",targetProfile:["http://hl7.org/fhir/StructureDefinition/StructureDefinition"]}]},"subject[x]":{min:0,max:"1",type:[{code:"CodeableConcept"},{code:"Reference",targetProfile:["http://hl7.org/fhir/StructureDefinition/Group"]}]},mustSupport:{min:0,max:"*",type:[{code:"string"}]},codeFilter:{min:0,max:"*",type:[{code:"Element"}]},dateFilter:{min:0,max:"*",type:[{code:"Element"}]},limit:{min:0,max:"1",type:[{code:"positiveInt"}]},sort:{min:0,max:"*",type:[{code:"Element"}]}}},DataRequirementCodeFilter:{display:"DataRequirementCodeFilter",properties:{id:{min:0,max:"1",type:[{code:"string"}]},extension:{min:0,max:"*",type:[{code:"Extension"}]},path:{min:0,max:"1",type:[{code:"string"}]},searchParam:{min:0,max:"1",type:[{code:"string"}]},valueSet:{min:0,max:"1",type:[{code:"canonical",targetProfile:["http://hl7.org/fhir/StructureDefinition/ValueSet"]}]},code:{min:0,max:"*",type:[{code:"Coding"}]}},parentType:"DataRequirement"},DataRequirementDateFilter:{display:"DataRequirementDateFilter",properties:{id:{min:0,max:"1",type:[{code:"string"}]},extension:{min:0,max:"*",type:[{code:"Extension"}]},path:{min:0,max:"1",type:[{code:"string"}]},searchParam:{min:0,max:"1",type:[{code:"string"}]},"value[x]":{min:0,max:"1",type:[{code:"dateTime"},{code:"Period"},{code:"Duration"}]}},parentType:"DataRequirement"},DataRequirementSort:{display:"DataRequirementSort",properties:{id:{min:0,max:"1",type:[{code:"string"}]},extension:{min:0,max:"*",type:[{code:"Extension"}]},path:{min:1,max:"1",type:[{code:"string"}]},direction:{min:1,max:"1",type:[{code:"code"}]}},parentType:"DataRequirement"},Distance:{display:"Distance",properties:{id:{min:0,max:"1",type:[{code:"string"}]},extension:{min:0,max:"*",type:[{code:"Extension"}]},value:{min:0,max:"1",type:[{code:"decimal"}]},comparator:{min:0,max:"1",type:[{code:"code"}]},unit:{min:0,max:"1",type:[{code:"string"}]},system:{min:0,max:"1",type:[{code:"uri"}]},code:{min:0,max:"1",type:[{code:"code"}]}}},Dosage:{display:"Dosage",properties:{id:{min:0,max:"1",type:[{code:"string"}]},extension:{min:0,max:"*",type:[{code:"Extension"}]},modifierExtension:{min:0,max:"*",type:[{code:"Extension"}]},sequence:{min:0,max:"1",type:[{code:"integer"}]},text:{min:0,max:"1",type:[{code:"string"}]},additionalInstruction:{min:0,max:"*",type:[{code:"CodeableConcept"}]},patientInstruction:{min:0,max:"1",type:[{code:"string"}]},timing:{min:0,max:"1",type:[{code:"Timing"}]},"asNeeded[x]":{min:0,max:"1",type:[{code:"boolean"},{code:"CodeableConcept"}]},site:{min:0,max:"1",type:[{code:"CodeableConcept"}]},route:{min:0,max:"1",type:[{code:"CodeableConcept"}]},method:{min:0,max:"1",type:[{code:"CodeableConcept"}]},doseAndRate:{min:0,max:"*",type:[{code:"Element"}]},maxDosePerPeriod:{min:0,max:"1",type:[{code:"Ratio"}]},maxDosePerAdministration:{min:0,max:"1",type:[{code:"Quantity",profile:["http://hl7.org/fhir/StructureDefinition/SimpleQuantity"]}]},maxDosePerLifetime:{min:0,max:"1",type:[{code:"Quantity",profile:["http://hl7.org/fhir/StructureDefinition/SimpleQuantity"]}]}}},DosageDoseAndRate:{display:"DosageDoseAndRate",properties:{id:{min:0,max:"1",type:[{code:"string"}]},extension:{min:0,max:"*",type:[{code:"Extension"}]},type:{min:0,max:"1",type:[{code:"CodeableConcept"}]},"dose[x]":{min:0,max:"1",type:[{code:"Range"},{code:"Quantity",profile:["http://hl7.org/fhir/StructureDefinition/SimpleQuantity"]}]},"rate[x]":{min:0,max:"1",type:[{code:"Ratio"},{code:"Range"},{code:"Quantity",profile:["http://hl7.org/fhir/StructureDefinition/SimpleQuantity"]}]}},parentType:"Dosage"},Duration:{display:"Duration",properties:{id:{min:0,max:"1",type:[{code:"string"}]},extension:{min:0,max:"*",type:[{code:"Extension"}]},value:{min:0,max:"1",type:[{code:"decimal"}]},comparator:{min:0,max:"1",type:[{code:"code"}]},unit:{min:0,max:"1",type:[{code:"string"}]},system:{min:0,max:"1",type:[{code:"uri"}]},code:{min:0,max:"1",type:[{code:"code"}]}}},ElementDefinition:{display:"ElementDefinition",properties:{id:{min:0,max:"1",type:[{code:"string"}]},extension:{min:0,max:"*",type:[{code:"Extension"}]},modifierExtension:{min:0,max:"*",type:[{code:"Extension"}]},path:{min:1,max:"1",type:[{code:"string"}]},representation:{min:0,max:"*",type:[{code:"code"}]},sliceName:{min:0,max:"1",type:[{code:"string"}]},sliceIsConstraining:{min:0,max:"1",type:[{code:"boolean"}]},label:{min:0,max:"1",type:[{code:"string"}]},code:{min:0,max:"*",type:[{code:"Coding"}]},slicing:{min:0,max:"1",type:[{code:"Element"}]},short:{min:0,max:"1",type:[{code:"string"}]},definition:{min:0,max:"1",type:[{code:"markdown"}]},comment:{min:0,max:"1",type:[{code:"markdown"}]},requirements:{min:0,max:"1",type:[{code:"markdown"}]},alias:{min:0,max:"*",type:[{code:"string"}]},min:{min:0,max:"1",type:[{code:"unsignedInt"}]},max:{min:0,max:"1",type:[{code:"string"}]},base:{min:0,max:"1",type:[{code:"Element"}]},contentReference:{min:0,max:"1",type:[{code:"uri"}]},type:{min:0,max:"*",type:[{code:"Element"}]},"defaultValue[x]":{min:0,max:"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"}]},meaningWhenMissing:{min:0,max:"1",type:[{code:"markdown"}]},orderMeaning:{min:0,max:"1",type:[{code:"string"}]},"fixed[x]":{min:0,max:"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"}]},"pattern[x]":{min:0,max:"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"}]},example:{min:0,max:"*",type:[{code:"Element"}]},"minValue[x]":{min:0,max:"1",type:[{code:"date"},{code:"dateTime"},{code:"instant"},{code:"time"},{code:"decimal"},{code:"integer"},{code:"positiveInt"},{code:"unsignedInt"},{code:"Quantity"}]},"maxValue[x]":{min:0,max:"1",type:[{code:"date"},{code:"dateTime"},{code:"instant"},{code:"time"},{code:"decimal"},{code:"integer"},{code:"positiveInt"},{code:"unsignedInt"},{code:"Quantity"}]},maxLength:{min:0,max:"1",type:[{code:"integer"}]},condition:{min:0,max:"*",type:[{code:"id"}]},constraint:{min:0,max:"*",type:[{code:"Element"}]},mustSupport:{min:0,max:"1",type:[{code:"boolean"}]},isModifier:{min:0,max:"1",type:[{code:"boolean"}]},isModifierReason:{min:0,max:"1",type:[{code:"string"}]},isSummary:{min:0,max:"1",type:[{code:"boolean"}]},binding:{min:0,max:"1",type:[{code:"Element"}]},mapping:{min:0,max:"*",type:[{code:"Element"}]}}},ElementDefinitionSlicing:{display:"ElementDefinitionSlicing",properties:{id:{min:0,max:"1",type:[{code:"string"}]},extension:{min:0,max:"*",type:[{code:"Extension"}]},discriminator:{min:0,max:"*",type:[{code:"Element"}]},description:{min:0,max:"1",type:[{code:"string"}]},ordered:{min:0,max:"1",type:[{code:"boolean"}]},rules:{min:1,max:"1",type:[{code:"code"}]}},parentType:"ElementDefinition"},ElementDefinitionSlicingDiscriminator:{display:"ElementDefinitionSlicingDiscriminator",properties:{id:{min:0,max:"1",type:[{code:"string"}]},extension:{min:0,max:"*",type:[{code:"Extension"}]},type:{min:1,max:"1",type:[{code:"code"}]},path:{min:1,max:"1",type:[{code:"string"}]}},parentType:"ElementDefinitionSlicing"},ElementDefinitionBase:{display:"ElementDefinitionBase",properties:{id:{min:0,max:"1",type:[{code:"string"}]},extension:{min:0,max:"*",type:[{code:"Extension"}]},path:{min:1,max:"1",type:[{code:"string"}]},min:{min:1,max:"1",type:[{code:"unsignedInt"}]},max:{min:1,max:"1",type:[{code:"string"}]}},parentType:"ElementDefinition"},ElementDefinitionType:{display:"ElementDefinitionType",properties:{id:{min:0,max:"1",type:[{code:"string"}]},extension:{min:0,max:"*",type:[{code:"Extension"}]},code:{min:1,max:"1",type:[{code:"uri"}]},profile:{min:0,max:"*",type:[{code:"canonical",targetProfile:["http://hl7.org/fhir/StructureDefinition/StructureDefinition","http://hl7.org/fhir/StructureDefinition/ImplementationGuide"]}]},targetProfile:{min:0,max:"*",type:[{code:"canonical",targetProfile:["http://hl7.org/fhir/StructureDefinition/StructureDefinition","http://hl7.org/fhir/StructureDefinition/ImplementationGuide"]}]},aggregation:{min:0,max:"*",type:[{code:"code"}]},versioning:{min:0,max:"1",type:[{code:"code"}]}},parentType:"ElementDefinition"},ElementDefinitionExample:{display:"ElementDefinitionExample",properties:{id:{min:0,max:"1",type:[{code:"string"}]},extension:{min:0,max:"*",type:[{code:"Extension"}]},label:{min:1,max:"1",type:[{code:"string"}]},"value[x]":{min:1,max:"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"}]}},parentType:"ElementDefinition"},ElementDefinitionConstraint:{display:"ElementDefinitionConstraint",properties:{id:{min:0,max:"1",type:[{code:"string"}]},extension:{min:0,max:"*",type:[{code:"Extension"}]},key:{min:1,max:"1",type:[{code:"id"}]},requirements:{min:0,max:"1",type:[{code:"string"}]},severity:{min:1,max:"1",type:[{code:"code"}]},human:{min:1,max:"1",type:[{code:"string"}]},expression:{min:0,max:"1",type:[{code:"string"}]},xpath:{min:0,max:"1",type:[{code:"string"}]},source:{min:0,max:"1",type:[{code:"canonical",targetProfile:["http://hl7.org/fhir/StructureDefinition/StructureDefinition"]}]}},parentType:"ElementDefinition"},ElementDefinitionBinding:{display:"ElementDefinitionBinding",properties:{id:{min:0,max:"1",type:[{code:"string"}]},extension:{min:0,max:"*",type:[{code:"Extension"}]},strength:{min:1,max:"1",type:[{code:"code"}]},description:{min:0,max:"1",type:[{code:"string"}]},valueSet:{min:0,max:"1",type:[{code:"canonical",targetProfile:["http://hl7.org/fhir/StructureDefinition/ValueSet"]}]}},parentType:"ElementDefinition"},ElementDefinitionMapping:{display:"ElementDefinitionMapping",properties:{id:{min:0,max:"1",type:[{code:"string"}]},extension:{min:0,max:"*",type:[{code:"Extension"}]},identity:{min:1,max:"1",type:[{code:"id"}]},language:{min:0,max:"1",type:[{code:"code"}]},map:{min:1,max:"1",type:[{code:"string"}]},comment:{min:0,max:"1",type:[{code:"string"}]}},parentType:"ElementDefinition"},Expression:{display:"Expression",properties:{id:{min:0,max:"1",type:[{code:"string"}]},extension:{min:0,max:"*",type:[{code:"Extension"}]},description:{min:0,max:"1",type:[{code:"string"}]},name:{min:0,max:"1",type:[{code:"id"}]},language:{min:1,max:"1",type:[{code:"code"}]},expression:{min:0,max:"1",type:[{code:"string"}]},reference:{min:0,max:"1",type:[{code:"uri"}]}}},Extension:{display:"Extension",properties:{id:{min:0,max:"1",type:[{code:"string"}]},extension:{min:0,max:"*",type:[{code:"Extension"}]},url:{min:1,max:"1",type:[{code:"string"}]},"value[x]":{min:0,max:"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"}]}}},HumanName:{display:"HumanName",properties:{id:{min:0,max:"1",type:[{code:"string"}]},extension:{min:0,max:"*",type:[{code:"Extension"}]},use:{min:0,max:"1",type:[{code:"code"}]},text:{min:0,max:"1",type:[{code:"string"}]},family:{min:0,max:"1",type:[{code:"string"}]},given:{min:0,max:"*",type:[{code:"string"}]},prefix:{min:0,max:"*",type:[{code:"string"}]},suffix:{min:0,max:"*",type:[{code:"string"}]},period:{min:0,max:"1",type:[{code:"Period"}]}}},Identifier:{display:"Identifier",properties:{id:{min:0,max:"1",type:[{code:"string"}]},extension:{min:0,max:"*",type:[{code:"Extension"}]},use:{min:0,max:"1",type:[{code:"code"}]},type:{min:0,max:"1",type:[{code:"CodeableConcept"}]},system:{min:0,max:"1",type:[{code:"uri"}]},value:{min:0,max:"1",type:[{code:"string"}]},period:{min:0,max:"1",type:[{code:"Period"}]},assigner:{min:0,max:"1",type:[{code:"Reference",targetProfile:["http://hl7.org/fhir/StructureDefinition/Organization"]}]}}},MarketingStatus:{display:"MarketingStatus",properties:{id:{min:0,max:"1",type:[{code:"string"}]},extension:{min:0,max:"*",type:[{code:"Extension"}]},modifierExtension:{min:0,max:"*",type:[{code:"Extension"}]},country:{min:1,max:"1",type:[{code:"CodeableConcept"}]},jurisdiction:{min:0,max:"1",type:[{code:"CodeableConcept"}]},status:{min:1,max:"1",type:[{code:"CodeableConcept"}]},dateRange:{min:1,max:"1",type:[{code:"Period"}]},restoreDate:{min:0,max:"1",type:[{code:"dateTime"}]}}},Meta:{display:"Meta",properties:{id:{min:0,max:"1",type:[{code:"string"}]},extension:{min:0,max:"*",type:[{code:"Extension"}]},versionId:{min:0,max:"1",type:[{code:"id"}]},lastUpdated:{min:0,max:"1",type:[{code:"instant"}]},source:{min:0,max:"1",type:[{code:"uri"}]},profile:{min:0,max:"*",type:[{code:"canonical",targetProfile:["http://hl7.org/fhir/StructureDefinition/StructureDefinition"]}]},security:{min:0,max:"*",type:[{code:"Coding"}]},tag:{min:0,max:"*",type:[{code:"Coding"}]},project:{min:0,max:"1",type:[{code:"uri"}]},author:{min:0,max:"1",type:[{code:"Reference"}]},account:{min:0,max:"1",type:[{code:"Reference"}]}}},Money:{display:"Money",properties:{id:{min:0,max:"1",type:[{code:"string"}]},extension:{min:0,max:"*",type:[{code:"Extension"}]},value:{min:0,max:"1",type:[{code:"decimal"}]},currency:{min:0,max:"1",type:[{code:"code"}]}}},Narrative:{display:"Narrative",properties:{id:{min:0,max:"1",type:[{code:"string"}]},extension:{min:0,max:"*",type:[{code:"Extension"}]},status:{min:1,max:"1",type:[{code:"code"}]},div:{min:1,max:"1",type:[{code:"xhtml"}]}}},ParameterDefinition:{display:"ParameterDefinition",properties:{id:{min:0,max:"1",type:[{code:"string"}]},extension:{min:0,max:"*",type:[{code:"Extension"}]},name:{min:0,max:"1",type:[{code:"code"}]},use:{min:1,max:"1",type:[{code:"code"}]},min:{min:0,max:"1",type:[{code:"integer"}]},max:{min:0,max:"1",type:[{code:"string"}]},documentation:{min:0,max:"1",type:[{code:"string"}]},type:{min:1,max:"1",type:[{code:"code"}]},profile:{min:0,max:"1",type:[{code:"canonical",targetProfile:["http://hl7.org/fhir/StructureDefinition/StructureDefinition"]}]}}},Period:{display:"Period",properties:{id:{min:0,max:"1",type:[{code:"string"}]},extension:{min:0,max:"*",type:[{code:"Extension"}]},start:{min:0,max:"1",type:[{code:"dateTime"}]},end:{min:0,max:"1",type:[{code:"dateTime"}]}}},Population:{display:"Population",properties:{id:{min:0,max:"1",type:[{code:"string"}]},extension:{min:0,max:"*",type:[{code:"Extension"}]},modifierExtension:{min:0,max:"*",type:[{code:"Extension"}]},"age[x]":{min:0,max:"1",type:[{code:"Range"},{code:"CodeableConcept"}]},gender:{min:0,max:"1",type:[{code:"CodeableConcept"}]},race:{min:0,max:"1",type:[{code:"CodeableConcept"}]},physiologicalCondition:{min:0,max:"1",type:[{code:"CodeableConcept"}]}}},ProdCharacteristic:{display:"ProdCharacteristic",properties:{id:{min:0,max:"1",type:[{code:"string"}]},extension:{min:0,max:"*",type:[{code:"Extension"}]},modifierExtension:{min:0,max:"*",type:[{code:"Extension"}]},height:{min:0,max:"1",type:[{code:"Quantity"}]},width:{min:0,max:"1",type:[{code:"Quantity"}]},depth:{min:0,max:"1",type:[{code:"Quantity"}]},weight:{min:0,max:"1",type:[{code:"Quantity"}]},nominalVolume:{min:0,max:"1",type:[{code:"Quantity"}]},externalDiameter:{min:0,max:"1",type:[{code:"Quantity"}]},shape:{min:0,max:"1",type:[{code:"string"}]},color:{min:0,max:"*",type:[{code:"string"}]},imprint:{min:0,max:"*",type:[{code:"string"}]},image:{min:0,max:"*",type:[{code:"Attachment"}]},scoring:{min:0,max:"1",type:[{code:"CodeableConcept"}]}}},ProductShelfLife:{display:"ProductShelfLife",properties:{id:{min:0,max:"1",type:[{code:"string"}]},extension:{min:0,max:"*",type:[{code:"Extension"}]},modifierExtension:{min:0,max:"*",type:[{code:"Extension"}]},identifier:{min:0,max:"1",type:[{code:"Identifier"}]},type:{min:1,max:"1",type:[{code:"CodeableConcept"}]},period:{min:1,max:"1",type:[{code:"Quantity"}]},specialPrecautionsForStorage:{min:0,max:"*",type:[{code:"CodeableConcept"}]}}},Quantity:{display:"Quantity",properties:{id:{min:0,max:"1",type:[{code:"string"}]},extension:{min:0,max:"*",type:[{code:"Extension"}]},value:{min:0,max:"1",type:[{code:"decimal"}]},comparator:{min:0,max:"0",type:[{code:"code"}]},unit:{min:0,max:"1",type:[{code:"string"}]},system:{min:0,max:"1",type:[{code:"uri"}]},code:{min:0,max:"1",type:[{code:"code"}]}}},Range:{display:"Range",properties:{id:{min:0,max:"1",type:[{code:"string"}]},extension:{min:0,max:"*",type:[{code:"Extension"}]},low:{min:0,max:"1",type:[{code:"Quantity",profile:["http://hl7.org/fhir/StructureDefinition/SimpleQuantity"]}]},high:{min:0,max:"1",type:[{code:"Quantity",profile:["http://hl7.org/fhir/StructureDefinition/SimpleQuantity"]}]}}},Ratio:{display:"Ratio",properties:{id:{min:0,max:"1",type:[{code:"string"}]},extension:{min:0,max:"*",type:[{code:"Extension"}]},numerator:{min:0,max:"1",type:[{code:"Quantity"}]},denominator:{min:0,max:"1",type:[{code:"Quantity"}]}}},Reference:{display:"Reference",properties:{id:{min:0,max:"1",type:[{code:"string"}]},extension:{min:0,max:"*",type:[{code:"Extension"}]},reference:{min:0,max:"1",type:[{code:"string"}]},type:{min:0,max:"1",type:[{code:"uri"}]},identifier:{min:0,max:"1",type:[{code:"Identifier"}]},display:{min:0,max:"1",type:[{code:"string"}]}}},RelatedArtifact:{display:"RelatedArtifact",properties:{id:{min:0,max:"1",type:[{code:"string"}]},extension:{min:0,max:"*",type:[{code:"Extension"}]},type:{min:1,max:"1",type:[{code:"code"}]},label:{min:0,max:"1",type:[{code:"string"}]},display:{min:0,max:"1",type:[{code:"string"}]},citation:{min:0,max:"1",type:[{code:"markdown"}]},url:{min:0,max:"1",type:[{code:"url"}]},document:{min:0,max:"1",type:[{code:"Attachment"}]},resource:{min:0,max:"1",type:[{code:"canonical",targetProfile:["http://hl7.org/fhir/StructureDefinition/Resource"]}]}}},SampledData:{display:"SampledData",properties:{id:{min:0,max:"1",type:[{code:"string"}]},extension:{min:0,max:"*",type:[{code:"Extension"}]},origin:{min:1,max:"1",type:[{code:"Quantity",profile:["http://hl7.org/fhir/StructureDefinition/SimpleQuantity"]}]},period:{min:1,max:"1",type:[{code:"decimal"}]},factor:{min:0,max:"1",type:[{code:"decimal"}]},lowerLimit:{min:0,max:"1",type:[{code:"decimal"}]},upperLimit:{min:0,max:"1",type:[{code:"decimal"}]},dimensions:{min:1,max:"1",type:[{code:"positiveInt"}]},data:{min:0,max:"1",type:[{code:"string"}]}}},Signature:{display:"Signature",properties:{id:{min:0,max:"1",type:[{code:"string"}]},extension:{min:0,max:"*",type:[{code:"Extension"}]},type:{min:1,max:"*",type:[{code:"Coding"}]},when:{min:1,max:"1",type:[{code:"instant"}]},who:{min:1,max:"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:{min:0,max:"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"]}]},targetFormat:{min:0,max:"1",type:[{code:"code"}]},sigFormat:{min:0,max:"1",type:[{code:"code"}]},data:{min:0,max:"1",type:[{code:"base64Binary"}]}}},SubstanceAmount:{display:"SubstanceAmount",properties:{id:{min:0,max:"1",type:[{code:"string"}]},extension:{min:0,max:"*",type:[{code:"Extension"}]},modifierExtension:{min:0,max:"*",type:[{code:"Extension"}]},"amount[x]":{min:0,max:"1",type:[{code:"Quantity"},{code:"Range"},{code:"string"}]},amountType:{min:0,max:"1",type:[{code:"CodeableConcept"}]},amountText:{min:0,max:"1",type:[{code:"string"}]},referenceRange:{min:0,max:"1",type:[{code:"Element"}]}}},SubstanceAmountReferenceRange:{display:"SubstanceAmountReferenceRange",properties:{id:{min:0,max:"1",type:[{code:"string"}]},extension:{min:0,max:"*",type:[{code:"Extension"}]},lowLimit:{min:0,max:"1",type:[{code:"Quantity"}]},highLimit:{min:0,max:"1",type:[{code:"Quantity"}]}},parentType:"SubstanceAmount"},Timing:{display:"Timing",properties:{id:{min:0,max:"1",type:[{code:"string"}]},extension:{min:0,max:"*",type:[{code:"Extension"}]},modifierExtension:{min:0,max:"*",type:[{code:"Extension"}]},event:{min:0,max:"*",type:[{code:"dateTime"}]},repeat:{min:0,max:"1",type:[{code:"Element"}]},code:{min:0,max:"1",type:[{code:"CodeableConcept"}]}}},TimingRepeat:{display:"TimingRepeat",properties:{id:{min:0,max:"1",type:[{code:"string"}]},extension:{min:0,max:"*",type:[{code:"Extension"}]},"bounds[x]":{min:0,max:"1",type:[{code:"Duration"},{code:"Range"},{code:"Period"}]},count:{min:0,max:"1",type:[{code:"positiveInt"}]},countMax:{min:0,max:"1",type:[{code:"positiveInt"}]},duration:{min:0,max:"1",type:[{code:"decimal"}]},durationMax:{min:0,max:"1",type:[{code:"decimal"}]},durationUnit:{min:0,max:"1",type:[{code:"code"}]},frequency:{min:0,max:"1",type:[{code:"positiveInt"}]},frequencyMax:{min:0,max:"1",type:[{code:"positiveInt"}]},period:{min:0,max:"1",type:[{code:"decimal"}]},periodMax:{min:0,max:"1",type:[{code:"decimal"}]},periodUnit:{min:0,max:"1",type:[{code:"code"}]},dayOfWeek:{min:0,max:"*",type:[{code:"code"}]},timeOfDay:{min:0,max:"*",type:[{code:"time"}]},when:{min:0,max:"*",type:[{code:"code"}]},offset:{min:0,max:"1",type:[{code:"unsignedInt"}]}},parentType:"Timing"},TriggerDefinition:{display:"TriggerDefinition",properties:{id:{min:0,max:"1",type:[{code:"string"}]},extension:{min:0,max:"*",type:[{code:"Extension"}]},type:{min:1,max:"1",type:[{code:"code"}]},name:{min:0,max:"1",type:[{code:"string"}]},"timing[x]":{min:0,max:"1",type:[{code:"Timing"},{code:"Reference",targetProfile:["http://hl7.org/fhir/StructureDefinition/Schedule"]},{code:"date"},{code:"dateTime"}]},data:{min:0,max:"*",type:[{code:"DataRequirement"}]},condition:{min:0,max:"1",type:[{code:"Expression"}]}}},UsageContext:{display:"UsageContext",properties:{id:{min:0,max:"1",type:[{code:"string"}]},extension:{min:0,max:"*",type:[{code:"Extension"}]},code:{min:1,max:"1",type:[{code:"Coding"}]},"value[x]":{min:1,max:"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"]}]}}}}};function re(e){var t;if(!e.name)return;const n=null===(t=e.snapshot)||void 0===t?void 0:t.element;n&&(n.forEach((t=>function(e,t){var n,i;const o=t.path,r=null===(i=null===(n=t.type)||void 0===n?void 0:n[0])||void 0===i?void 0:i.code;if(void 0!==r&&"Element"!==r&&"BackboneElement"!==r)return;const a=o.split("."),s=se(a);de.types[s]=function(e,t,n){return{structureDefinition:t,elementDefinition:n,display:e,description:n.definition,properties:{}}}(s,e,t),de.types[s].parentType=se(a.slice(0,a.length-1))}(e,t))),n.forEach((e=>function(e){const t=e.path,n=t.split(".");if(1===n.length)return;const i=se(n.slice(0,n.length-1)),o=de.types[i];if(!o)return;const r=n[n.length-1];o.properties[r]=e}(e))))}function ae(e){if(e.base)for(const t of e.base){const n=de.types[t];n&&(n.searchParams||(n.searchParams={_id:{base:[t],code:"_id",type:"token",expression:t+".id"},_lastUpdated:{base:[t],code:"_lastUpdated",type:"date",expression:t+".meta.lastUpdated"},_compartment:{base:[t],code:"_compartment",type:"reference",expression:t+".meta.compartment"}}),n.searchParams[e.code]=e)}}function se(e){return 1===e.length?e[0]:e.map(N).join("")}function ce(e,t){var n;const i=de.types[e];if(!i)return;const o=null!==(n=i.properties[t])&&void 0!==n?n:i.properties[t+"[x]"];if(o){if(o.contentReference){const e=o.contentReference.substring(1).split("."),t=e.pop();return ce(se(e),t)}return o}}e.PropertyType=void 0,(ie=e.PropertyType||(e.PropertyType={})).Address="Address",ie.Age="Age",ie.Annotation="Annotation",ie.Attachment="Attachment",ie.BackboneElement="BackboneElement",ie.CodeableConcept="CodeableConcept",ie.Coding="Coding",ie.ContactDetail="ContactDetail",ie.ContactPoint="ContactPoint",ie.Contributor="Contributor",ie.Count="Count",ie.DataRequirement="DataRequirement",ie.Distance="Distance",ie.Dosage="Dosage",ie.Duration="Duration",ie.Expression="Expression",ie.Extension="Extension",ie.HumanName="HumanName",ie.Identifier="Identifier",ie.MarketingStatus="MarketingStatus",ie.Meta="Meta",ie.Money="Money",ie.Narrative="Narrative",ie.ParameterDefinition="ParameterDefinition",ie.Period="Period",ie.Population="Population",ie.ProdCharacteristic="ProdCharacteristic",ie.ProductShelfLife="ProductShelfLife",ie.Quantity="Quantity",ie.Range="Range",ie.Ratio="Ratio",ie.Reference="Reference",ie.RelatedArtifact="RelatedArtifact",ie.SampledData="SampledData",ie.Signature="Signature",ie.SubstanceAmount="SubstanceAmount",ie.SystemString="http://hl7.org/fhirpath/System.String",ie.Timing="Timing",ie.TriggerDefinition="TriggerDefinition",ie.UsageContext="UsageContext",ie.base64Binary="base64Binary",ie.boolean="boolean",ie.canonical="canonical",ie.code="code",ie.date="date",ie.dateTime="dateTime",ie.decimal="decimal",ie.id="id",ie.instant="instant",ie.integer="integer",ie.markdown="markdown",ie.oid="oid",ie.positiveInt="positiveInt",ie.string="string",ie.time="time",ie.unsignedInt="unsignedInt",ie.uri="uri",ie.url="url",ie.uuid="uuid";const de=oe;var le,ue,pe,me,he,fe,ye,ge,xe,ve,Se,Te,we,Ee,be,Pe,De,Ce,Ae,Re,Oe,ke,Ie,Me,Ue,Le,Ne,je,_e,Qe,Be,We,qe;function $e(){return window.location.protocol+"//"+window.location.host+"/"}var Fe,He,ze,Ve,Ge,Xe,Ye,Je,Ze,Ke,et,tt,nt,it,ot,rt,at,st,ct,dt,lt,ut,pt,mt,ht,ft,yt,gt,xt,vt,St,Tt;ue=new WeakMap,pe=new WeakMap,me=new WeakMap,he=new WeakMap,fe=new WeakMap,ye=new WeakMap,ge=new WeakMap,xe=new WeakMap,ve=new WeakMap,Se=new WeakMap,Te=new WeakMap,we=new WeakMap,Ee=new WeakMap,be=new WeakMap,Pe=new WeakMap,De=new WeakMap,Ce=new WeakMap,Ae=new WeakMap,le=new WeakSet,Re=function(e){const t=this.getLogins().filter((t=>{var n,i;return(null===(n=t.profile)||void 0===n?void 0:n.reference)!==(null===(i=e.profile)||void 0===i?void 0:i.reference)}));t.push(e),n(this,me,"f").setObject("logins",t)},Oe=function(){return t(this,void 0,void 0,(function*(){return i(this,De,new Promise(((e,t)=>{this.get("auth/me").then((t=>{i(this,De,void 0,"f"),i(this,Ce,t.profile,"f"),i(this,Ae,t.config,"f"),this.dispatchEvent({type:"change"}),e(n(this,Ce,"f"))})).catch(t)})),"f"),n(this,De,"f")}))},ke=function(e,t){if(n(this,fe,"f")<=0||"no-cache"===(null==t?void 0:t.cache)||"reload"===(null==t?void 0:t.cache))return;const i=n(this,he,"f").get(e);return!i||i.requestTime+n(this,fe,"f")<Date.now()?void 0:i},Ie=function(e,t){n(this,fe,"f")>0&&n(this,he,"f").set(e,{requestTime:Date.now(),value:t})},Me=function(e,i,o={}){return t(this,void 0,void 0,(function*(){n(this,Pe,"f")&&(yield n(this,Pe,"f")),i.startsWith("http")||(i=n(this,ye,"f")+i),o.method=e,n(this,le,"m",Ue).call(this,o);const t=yield n(this,ue,"f").call(this,i,o);if(401===t.status)return n(this,le,"m",je).call(this,e,i,o);if(204===t.status||304===t.status)return;const r=yield t.json();if(t.status>=400)throw r;return r}))},Ue=function(e){e.headers||(e.headers={});const t=e.headers;t["X-Medplum"]="extended",t["Content-Type"]||(t["Content-Type"]="application/fhir+json"),n(this,Ee,"f")&&(t.Authorization="Bearer "+n(this,Ee,"f")),e.cache||(e.cache="no-cache"),e.credentials||(e.credentials="include")},Le=function(e,t){e.headers||(e.headers={});e.headers["Content-Type"]=t},Ne=function(e,t){"string"==typeof t||"undefined"!=typeof Blob&&t instanceof Blob||"undefined"!=typeof File&&t instanceof File||"undefined"!=typeof Uint8Array&&t instanceof Uint8Array?e.body=t:t&&(e.body=JSON.stringify(t))},je=function(e,t,i){return n(this,le,"m",Qe).call(this)?n(this,le,"m",Me).call(this,e,t,i):(this.clear(),n(this,Se,"f")&&n(this,Se,"f").call(this),Promise.reject(new Error("Unauthenticated")))},_e=function(){return t(this,void 0,void 0,(function*(){yield this.startPkce();const e=new URL(n(this,ge,"f"));e.searchParams.set("response_type","code"),e.searchParams.set("state",sessionStorage.getItem("pkceState")),e.searchParams.set("client_id",n(this,Te,"f")),e.searchParams.set("redirect_uri",$e()),e.searchParams.set("code_challenge_method","S256"),e.searchParams.set("code_challenge",sessionStorage.getItem("codeChallenge")),window.location.assign(e.toString())}))},Qe=function(){if(n(this,Pe,"f"))return n(this,Pe,"f");if(n(this,be,"f")){const e=new URLSearchParams;return e.set("grant_type","refresh_token"),e.set("client_id",n(this,Te,"f")),e.set("refresh_token",n(this,be,"f")),i(this,Pe,n(this,le,"m",Be).call(this,e),"f"),n(this,Pe,"f")}return n(this,Te,"f")&&n(this,we,"f")?(i(this,Pe,this.startClientLogin(n(this,Te,"f"),n(this,we,"f")),"f"),n(this,Pe,"f")):void 0},Be=function(e){return t(this,void 0,void 0,(function*(){return n(this,ue,"f").call(this,n(this,xe,"f"),{method:"POST",headers:{"Content-Type":"application/x-www-form-urlencoded"},body:e,credentials:"include"}).then((e=>{if(!e.ok)throw new Error("Failed to fetch tokens");return e.json()})).then((e=>n(this,le,"m",We).call(this,e))).then((()=>this.getProfile()))}))},We=function(e){return t(this,void 0,void 0,(function*(){const t=e.access_token,i=K(t);if(Date.now()>=1e3*i.exp)throw this.clear(),new Error("Token expired");if(n(this,Te,"f")&&i.client_id!==n(this,Te,"f"))throw this.clear(),new Error("Token was not issued for this audience");yield this.setActiveLogin({accessToken:t,refreshToken:e.refresh_token,project:e.project,profile:e.profile})}))},qe=function(){try{window.addEventListener("storage",(e=>{null!==e.key&&"activeLogin"!==e.key||window.location.reload()}))}catch(e){}};class wt{constructor(e,t){this.operator=e,this.child=t}toString(){return`${this.operator}(${this.child.toString()})`}}class Et{constructor(e,t,n){this.operator=e,this.left=t,this.right=n}toString(){return`${this.left.toString()} ${this.operator} ${this.right.toString()}`}}class bt{constructor(){Fe.set(this,{}),He.set(this,{})}registerInfix(e,t){return n(this,He,"f")[e]=t,this}registerPrefix(e,t){return n(this,Fe,"f")[e]=t,this}prefix(e,t,n){return this.registerPrefix(e,{parse(e,i){const o=e.consumeAndParse(t);return n(i,o)}})}infixLeft(e,t,n){return this.registerInfix(e,{parse(e,i,o){const r=e.consumeAndParse(t);return n(i,o,r)},precedence:t})}construct(e){return new Pt(e,n(this,Fe,"f"),n(this,He,"f"))}}Fe=new WeakMap,He=new WeakMap;class Pt{constructor(e,t,n){ze.set(this,void 0),Ve.set(this,void 0),Ge.set(this,void 0),i(this,ze,e,"f"),i(this,Ve,t,"f"),i(this,Ge,n,"f")}hasMore(){return n(this,ze,"f").length>0}match(e){const t=this.peek();return(null==t?void 0:t.id)===e&&(this.consume(),!0)}consumeAndParse(e=1/0){const t=this.consume(),i=n(this,Ve,"f")[t.id];if(!i)throw Error(`Parse error at "${t.value}" (line ${t.line}, column ${t.column}). No matching prefix parselet.`);let o=i.parse(this,t);for(;e>this.getPrecedence();){const e=this.consume();o=this.getInfixParselet(e).parse(this,o,e)}return o}getPrecedence(){const e=this.peek();if(!e)return 1/0;const t=this.getInfixParselet(e);return t?t.precedence:1/0}consume(e,t){var i,o;if(!n(this,ze,"f").length)throw Error("Cant consume unknown more tokens.");if(e&&(null===(i=this.peek())||void 0===i?void 0:i.id)!==e){const t=this.peek();throw Error(`Expected ${e} but got "${t.id}" at line ${t.line} column ${t.column}.`)}if(t&&(null===(o=this.peek())||void 0===o?void 0:o.value)!==t){const e=this.peek();throw Error(`Expected "${t}" but got "${e.value}" at line ${e.line} column ${e.column}.`)}return n(this,ze,"f").shift()}peek(){return n(this,ze,"f").length>0?n(this,ze,"f")[0]:void 0}removeComments(){i(this,ze,n(this,ze,"f").filter((e=>"Comment"!==e.id)),"f")}getInfixParselet(e){return n(this,Ge,"f")["Symbol"===e.id?e.value:e.id]}}ze=new WeakMap,Ve=new WeakMap,Ge=new WeakMap;const Dt=["year","years","month","months","week","weeks","day","days","hour","hours","minute","minutes","second","seconds","millisecond","milliseconds"];class Ct{constructor(e,t,n){Xe.add(this),Ye.set(this,void 0),Je.set(this,void 0),Ze.set(this,void 0),Ke.set(this,[]),et.set(this,{index:0,line:1,column:0}),tt.set(this,[]),i(this,Ye,e,"f"),i(this,Je,t,"f"),i(this,Ze,n,"f")}tokenize(){for(;n(this,et,"f").index<n(this,Ye,"f").length;){const e=n(this,Xe,"m",ot).call(this);e&&n(this,Ke,"f").push(e)}return n(this,Ke,"f")}}function At(e){if(e.startsWith("T"))return e+"T00:00:00.000Z".substring(e.length);if(e.length<=10)return e;try{return new Date(e).toISOString()}catch(t){return e}}function Rt(t){return[{type:e.PropertyType.boolean,value:t}]}function Ot(t){return null==t?{type:"undefined",value:void 0}:Number.isSafeInteger(t)?{type:e.PropertyType.integer,value:t}:"number"==typeof t?{type:e.PropertyType.decimal,value:t}:"boolean"==typeof t?{type:e.PropertyType.boolean,value:t}:"string"==typeof t?{type:e.PropertyType.string,value:t}:$t(t)?{type:e.PropertyType.Quantity,value:t}:"object"==typeof t&&"resourceType"in t?{type:t.resourceType,value:t}:{type:e.PropertyType.BackboneElement,value:t}}function kt(e){return 0!==e.length&&!!e[0].value}function It(t,n){if(!(null==t?void 0:t.value))return;const i=ce(t.type,n);if(i){const e=function(e,t,n){var i;const o=n.type;if(!o||0===o.length)return;let r,a="undefined";if(1===o.length)r=e.value[t],a=o[0].code;else for(const n of o){const i=t.replace("[x]","")+N(n.code);if(i in e.value){r=e.value[i],a=n.code;break}}if(R(r))return;"Element"!==a&&"BackboneElement"!==a||(a=se(null===(i=n.path)||void 0===i?void 0:i.split(".")));return Array.isArray(r)?r.map((e=>Mt(e,a))):Mt(r,a)}(t,n,i);if(e)return e}return function(t,n){const i=t.value;if(!i||"object"!=typeof i)return;let o;if(n in i)o=i[n];else for(const t in e.PropertyType){const e=n+N(t);if(e in i){o=i[e];break}}if(R(o))return;return Array.isArray(o)?o.map(Ot):Ot(o)}(t,n)}function Mt(e,t){return"Resource"===t&&"object"==typeof e&&"resourceType"in e&&(t=e.resourceType),{type:t,value:e}}function Ut(e){const t=[];for(const n of e){let e=!1;for(const i of t)if(kt(jt(n,i))){e=!0;break}e||t.push(n)}return t}function Lt(e){return Rt(!kt(e))}function Nt(e,t){return 0===e.length||0===t.length?[]:e.length!==t.length?Rt(!1):Rt(e.every(((e,n)=>kt(jt(e,t[n])))))}function jt(e,t){const n=e.value,i=t.value;return"number"==typeof n&&"number"==typeof i?Rt(Math.abs(n-i)<1e-8):$t(n)&&$t(i)?Rt(Ft(n,i)):Rt("object"==typeof n&&"object"==typeof i?Ht(e,t):n===i)}function _t(e,t){return 0===e.length&&0===t.length?Rt(!0):e.length!==t.length?Rt(!1):(e.sort(Bt),t.sort(Bt),Rt(e.every(((e,n)=>kt(Qt(e,t[n]))))))}function Qt(e,t){const n=e.value,i=t.value;return"number"==typeof n&&"number"==typeof i?Rt(Math.abs(n-i)<.01):$t(n)&&$t(i)?Rt(Ft(n,i)):Rt("object"==typeof n&&"object"==typeof i?Ht(n,i):"string"==typeof n&&"string"==typeof i?n.toLowerCase()===i.toLowerCase():n===i)}function Bt(e,t){const n=e.value,i=t.value;return"number"==typeof n&&"number"==typeof i?n-i:"string"==typeof n&&"string"==typeof i?n.localeCompare(i):0}function Wt(e,t){const{value:n}=e;if(null==n)return!1;switch(t){case"Boolean":return"boolean"==typeof n;case"Decimal":case"Integer":return"number"==typeof n;case"Date":return"string"==typeof n&&!!n.match(/^\d{4}(-\d{2}(-\d{2})?)?/);case"DateTime":return"string"==typeof n&&!!n.match(/^\d{4}(-\d{2}(-\d{2})?)?T/);case"Time":return"string"==typeof n&&!!n.match(/^T\d/);case"Period":return qt(n);case"Quantity":return $t(n);default:return"object"==typeof n&&(null==n?void 0:n.resourceType)===t}}function qt(e){return!(!e||"object"!=typeof e||!("start"in e))}function $t(e){return!(!e||"object"!=typeof e||!("value"in e)||"number"!=typeof e.value)}function Ft(e,t){return Math.abs(e.value-t.value)<.01&&(e.unit===t.unit||e.code===t.code||e.unit===t.code||e.code===t.unit)}function Ht(e,t){const n=Object.keys(e),i=Object.keys(t);if(n.length!==i.length)return!1;for(const i of n){const n=e[i],o=t[i];if(zt(n)&&zt(o)){if(!Ht(n,o))return!1}else if(n!==o)return!1}return!0}function zt(e){return null!==e&&"object"==typeof e}Ye=new WeakMap,Je=new WeakMap,Ze=new WeakMap,Ke=new WeakMap,et=new WeakMap,tt=new WeakMap,Xe=new WeakSet,nt=function(){return n(this,Ke,"f").slice(-1)[0]},it=function(){n(this,Xe,"m",xt).call(this);const e=n(this,Xe,"m",ot).call(this);return n(this,Xe,"m",vt).call(this),e},ot=function(){n(this,Xe,"m",rt).call(this);const e=n(this,Xe,"m",ft).call(this);if(!e)return;n(this,Xe,"m",xt).call(this);const t=n(this,Xe,"m",gt).call(this);return"/"===e&&"*"===t?n(this,Xe,"m",at).call(this):"/"===e&&"/"===t?n(this,Xe,"m",st).call(this):"'"===e||'"'===e?n(this,Xe,"m",ct).call(this,e):"`"===e?n(this,Xe,"m",dt).call(this):"@"===e?n(this,Xe,"m",lt).call(this):e.match(/\d/)?n(this,Xe,"m",ut).call(this):e.match(/\w/)||"$"===e&&t.match(/\w/)?n(this,Xe,"m",pt).call(this):n(this,Xe,"m",mt).call(this)},rt=function(){n(this,Xe,"m",ht).call(this,(()=>n(this,Xe,"m",ft).call(this).match(/\s/)))},at=function(){const e=n(this,et,"f").index;return n(this,Xe,"m",ht).call(this,(()=>"*"!==n(this,Xe,"m",ft).call(this)||"/"!==n(this,Xe,"m",gt).call(this))),n(this,Xe,"m",St).call(this),n(this,Xe,"m",St).call(this),n(this,Xe,"m",Tt).call(this,"Comment",n(this,Ye,"f").substring(e,n(this,et,"f").index))},st=function(){return n(this,Xe,"m",Tt).call(this,"Comment",n(this,Xe,"m",ht).call(this,(()=>"\n"!==n(this,Xe,"m",ft).call(this))))},ct=function(e){n(this,Xe,"m",St).call(this);const t=n(this,Xe,"m",Tt).call(this,"String",n(this,Xe,"m",ht).call(this,(()=>"\\"===n(this,Xe,"m",yt).call(this)||n(this,Xe,"m",ft).call(this)!==e)));return n(this,Xe,"m",St).call(this),t},dt=function(){n(this,Xe,"m",St).call(this);const e=n(this,Xe,"m",Tt).call(this,"Symbol",n(this,Xe,"m",ht).call(this,(()=>"`"!==n(this,Xe,"m",ft).call(this))));return n(this,Xe,"m",St).call(this),e},lt=function(){n(this,Xe,"m",St).call(this);const e=n(this,et,"f").index;return n(this,Xe,"m",ht).call(this,(()=>n(this,Xe,"m",ft).call(this).match(/[\d-]/))),"T"===n(this,Xe,"m",ft).call(this)&&(n(this,Xe,"m",St).call(this),n(this,Xe,"m",ht).call(this,(()=>n(this,Xe,"m",ft).call(this).match(/[\d:]/))),"."===n(this,Xe,"m",ft).call(this)&&n(this,Xe,"m",gt).call(this).match(/\d/)&&(n(this,Xe,"m",St).call(this),n(this,Xe,"m",ht).call(this,(()=>n(this,Xe,"m",ft).call(this).match(/\d/)))),"Z"===n(this,Xe,"m",ft).call(this)?n(this,Xe,"m",St).call(this):"+"!==n(this,Xe,"m",ft).call(this)&&"-"!==n(this,Xe,"m",ft).call(this)||(n(this,Xe,"m",St).call(this),n(this,Xe,"m",ht).call(this,(()=>n(this,Xe,"m",ft).call(this).match(/[\d:]/))))),n(this,Xe,"m",Tt).call(this,"DateTime",n(this,Ye,"f").substring(e,n(this,et,"f").index))},ut=function(){const e=n(this,et,"f").index;let t="Number";return n(this,Xe,"m",ht).call(this,(()=>n(this,Xe,"m",ft).call(this).match(/\d/))),"."===n(this,Xe,"m",ft).call(this)&&n(this,Xe,"m",gt).call(this).match(/\d/)&&(n(this,Xe,"m",St).call(this),n(this,Xe,"m",ht).call(this,(()=>n(this,Xe,"m",ft).call(this).match(/\d/))))," "===n(this,Xe,"m",ft).call(this)&&function(e){if(e){if("String"===e.id)return!0;if("Symbol"===e.id&&Dt.includes(e.value))return!0}return!1}(n(this,Xe,"m",it).call(this))&&(t="Quantity",n(this,Xe,"m",ot).call(this)),n(this,Xe,"m",Tt).call(this,t,n(this,Ye,"f").substring(e,n(this,et,"f").index))},pt=function(){var e;const t=n(this,Xe,"m",ht).call(this,(()=>n(this,Xe,"m",ft).call(this).match(/[$\w]/)));return"."!==(null===(e=n(this,Xe,"m",nt).call(this))||void 0===e?void 0:e.value)&&n(this,Je,"f").includes(t)?n(this,Xe,"m",Tt).call(this,t,t):n(this,Xe,"m",Tt).call(this,"Symbol",t)},mt=function(){const e=n(this,Xe,"m",ft).call(this),t=e+n(this,Xe,"m",gt).call(this);return n(this,Ze,"f").includes(t)?(n(this,Xe,"m",St).call(this),n(this,Xe,"m",St).call(this),n(this,Xe,"m",Tt).call(this,t,t)):(n(this,Xe,"m",St).call(this),n(this,Xe,"m",Tt).call(this,e,e))},ht=function(e){const t=n(this,et,"f").index;for(;n(this,et,"f").index<n(this,Ye,"f").length&&e();)n(this,Xe,"m",St).call(this);return n(this,Ye,"f").substring(t,n(this,et,"f").index)},ft=function(){return n(this,Ye,"f")[n(this,et,"f").index]},yt=function(){var e;return null!==(e=n(this,Ye,"f")[n(this,et,"f").index-1])&&void 0!==e?e:""},gt=function(){var e;return null!==(e=n(this,Ye,"f")[n(this,et,"f").index+1])&&void 0!==e?e:""},xt=function(){n(this,tt,"f").push(Object.assign({},n(this,et,"f")))},vt=function(){const e=n(this,tt,"f").pop();if(!e)throw new Error("No mark to reset to");n(this,et,"f").index=e.index,n(this,et,"f").line=e.line,n(this,et,"f").column=e.column},St=function(){n(this,et,"f").index++,"\n"===n(this,Xe,"m",ft).call(this)?(n(this,et,"f").line++,n(this,et,"f").column=0):n(this,et,"f").column++},Tt=function(e,t){const i=n(this,tt,"f").pop();if(!i)throw new Error("No mark for token");return Object.assign({id:e,value:t},i)};const Vt=()=>[],Gt={empty:e=>Rt(0===e.length),exists:(e,t)=>Rt(t?e.filter((e=>kt(t.eval([e])))).length>0:e.length>0),all:(e,t)=>Rt(e.every((e=>kt(t.eval([e]))))),allTrue:e=>{for(const t of e)if(!t.value)return Rt(!1);return Rt(!0)},anyTrue:e=>{for(const t of e)if(t.value)return Rt(!0);return Rt(!1)},allFalse:e=>{for(const t of e)if(t.value)return Rt(!1);return Rt(!0)},anyFalse:e=>{for(const t of e)if(!t.value)return Rt(!0);return Rt(!1)},subsetOf:Vt,supersetOf:Vt,count:t=>[{type:e.PropertyType.integer,value:t.length}],distinct:e=>{const t=[];for(const n of e)t.some((e=>e.value===n.value))||t.push(n);return t},isDistinct:e=>Rt(e.length===Gt.distinct(e).length),where:(e,t)=>e.filter((e=>kt(t.eval([e])))),select:(e,t)=>e.map((e=>t.eval([e]))).flat(),repeat:Vt,ofType:(e,t)=>e.filter((e=>e.type===t.name)),single:e=>{if(e.length>1)throw new Error("Expected input length one for single()");return 0===e.length?[]:e.slice(0,1)},first:e=>0===e.length?[]:e.slice(0,1),last:e=>0===e.length?[]:e.slice(e.length-1,e.length),tail:e=>0===e.length?[]:e.slice(1,e.length),skip:(e,t)=>{var n;const i=null===(n=t.eval(e)[0])||void 0===n?void 0:n.value;if("number"!=typeof i)throw new Error("Expected a number for skip(num)");return i>=e.length?[]:i<=0?e:e.slice(i,e.length)},take:(e,t)=>{var n;const i=null===(n=t.eval(e)[0])||void 0===n?void 0:n.value;if("number"!=typeof i)throw new Error("Expected a number for take(num)");return i>=e.length?e:i<=0?[]:e.slice(0,i)},intersect:(e,t)=>{if(!t)return e;const n=t.eval(e),i=[];for(const t of e)!i.some((e=>e.value===t.value))&&n.some((e=>e.value===t.value))&&i.push(t);return i},exclude:(e,t)=>{if(!t)return e;const n=t.eval(e),i=[];for(const t of e)n.some((e=>e.value===t.value))||i.push(t);return i},union:(e,t)=>{if(!t)return e;const n=t.eval(e);return Ut([...e,...n])},combine:(e,t)=>{if(!t)return e;const n=t.eval(e);return[...e,...n]},iif:(e,t,n,i)=>{const o=t.eval(e);if(o.length>1||1===o.length&&"boolean"!=typeof o[0].value)throw new Error("Expected criterion to evaluate to a Boolean");return kt(o)?n.eval(e):i?i.eval(e):[]},toBoolean:t=>{if(0===t.length)return[];const[{value:n}]=Jt(t,1);if("boolean"==typeof n)return[{type:e.PropertyType.boolean,value:n}];if("number"==typeof n&&(0===n||1===n))return Rt(!!n);if("string"==typeof n){const e=n.toLowerCase();if(["true","t","yes","y","1","1.0"].includes(e))return Rt(!0);if(["false","f","no","n","0","0.0"].includes(e))return Rt(!1)}return[]},convertsToBoolean:e=>0===e.length?[]:Rt(1===Gt.toBoolean(e).length),toInteger:t=>{if(0===t.length)return[];const[{value:n}]=Jt(t,1);return"number"==typeof n?[{type:e.PropertyType.integer,value:n}]:"string"==typeof n&&n.match(/^[+-]?\d+$/)?[{type:e.PropertyType.integer,value:parseInt(n,10)}]:"boolean"==typeof n?[{type:e.PropertyType.integer,value:n?1:0}]:[]},convertsToInteger:e=>0===e.length?[]:Rt(1===Gt.toInteger(e).length),toDate:t=>{if(0===t.length)return[];const[{value:n}]=Jt(t,1);return"string"==typeof n&&n.match(/^\d{4}(-\d{2}(-\d{2})?)?/)?[{type:e.PropertyType.date,value:At(n)}]:[]},convertsToDate:e=>0===e.length?[]:Rt(1===Gt.toDate(e).length),toDateTime:t=>{if(0===t.length)return[];const[{value:n}]=Jt(t,1);return"string"==typeof n&&n.match(/^\d{4}(-\d{2}(-\d{2})?)?/)?[{type:e.PropertyType.dateTime,value:At(n)}]:[]},convertsToDateTime:e=>0===e.length?[]:Rt(1===Gt.toDateTime(e).length),toDecimal:t=>{if(0===t.length)return[];const[{value:n}]=Jt(t,1);return"number"==typeof n?[{type:e.PropertyType.decimal,value:n}]:"string"==typeof n&&n.match(/^-?\d{1,9}(\.\d{1,9})?$/)?[{type:e.PropertyType.decimal,value:parseFloat(n)}]:"boolean"==typeof n?[{type:e.PropertyType.decimal,value:n?1:0}]:[]},convertsToDecimal:e=>0===e.length?[]:Rt(1===Gt.toDecimal(e).length),toQuantity:t=>{if(0===t.length)return[];const[{value:n}]=Jt(t,1);return $t(n)?[{type:e.PropertyType.Quantity,value:n}]:"number"==typeof n?[{type:e.PropertyType.Quantity,value:{value:n,unit:"1"}}]:"string"==typeof n&&n.match(/^-?\d{1,9}(\.\d{1,9})?/)?[{type:e.PropertyType.Quantity,value:{value:parseFloat(n),unit:"1"}}]:"boolean"==typeof n?[{type:e.PropertyType.Quantity,value:{value:n?1:0,unit:"1"}}]:[]},convertsToQuantity:e=>0===e.length?[]:Rt(1===Gt.toQuantity(e).length),toString:t=>{if(0===t.length)return[];const[{value:n}]=Jt(t,1);return null==n?[]:$t(n)?[{type:e.PropertyType.string,value:`${n.value} '${n.unit}'`}]:[{type:e.PropertyType.string,value:n.toString()}]},convertsToString:e=>0===e.length?[]:Rt(1===Gt.toString(e).length),toTime:t=>{if(0===t.length)return[];const[{value:n}]=Jt(t,1);if("string"==typeof n){const t=n.match(/^T?(\d{2}(:\d{2}(:\d{2})?)?)/);if(t)return[{type:e.PropertyType.time,value:At("T"+t[1])}]}return[]},convertsToTime:e=>0===e.length?[]:Rt(1===Gt.toTime(e).length),indexOf:(e,t)=>Xt(((e,t)=>e.indexOf(t)),e,t),substring:(e,t,n)=>Xt(((e,t,n)=>{const i=t,o=n?i+n:e.length;return i<0||i>=e.length?void 0:e.substring(i,o)}),e,t,n),startsWith:(e,t)=>Xt(((e,t)=>e.startsWith(t)),e,t),endsWith:(e,t)=>Xt(((e,t)=>e.endsWith(t)),e,t),contains:(e,t)=>Xt(((e,t)=>e.includes(t)),e,t),upper:e=>Xt((e=>e.toUpperCase()),e),lower:e=>Xt((e=>e.toLowerCase()),e),replace:(e,t,n)=>Xt(((e,t,n)=>e.replaceAll(t,n)),e,t,n),matches:(e,t)=>Xt(((e,t)=>!!e.match(t)),e,t),replaceMatches:(e,t,n)=>Xt(((e,t,n)=>e.replaceAll(t,n)),e,t,n),length:e=>Xt((e=>e.length),e),toChars:e=>Xt((e=>e?e.split(""):void 0),e),abs:e=>Yt(Math.abs,e),ceiling:e=>Yt(Math.ceil,e),exp:e=>Yt(Math.exp,e),floor:e=>Yt(Math.floor,e),ln:e=>Yt(Math.log,e),log:(e,t)=>Yt(((e,t)=>Math.log(e)/Math.log(t)),e,t),power:(e,t)=>Yt(Math.pow,e,t),round:e=>Yt(Math.round,e),sqrt:e=>Yt(Math.sqrt,e),truncate:e=>Yt((e=>0|e),e),children:Vt,descendants:Vt,trace:(e,t)=>(console.log("trace",e,t),e),now:()=>[{type:e.PropertyType.dateTime,value:(new Date).toISOString()}],timeOfDay:()=>[{type:e.PropertyType.time,value:(new Date).toISOString().substring(11)}],today:()=>[{type:e.PropertyType.date,value:(new Date).toISOString().substring(0,10)}],between:(t,n,i,o)=>{var r;const a=Gt.toDateTime(n.eval(t));if(0===a.length)throw new Error("Invalid start date");const s=Gt.toDateTime(i.eval(t));if(0===s.length)throw new Error("Invalid end date");const c=null===(r=o.eval(t)[0])||void 0===r?void 0:r.value;if("years"!==c&&"months"!==c&&"days"!==c)throw new Error("Invalid units");const d=P(a[0].value,s[0].value);return[{type:e.PropertyType.Quantity,value:{value:d[c],unit:c}}]},is:(t,n)=>{let i="";return n instanceof nn?i=n.name:n instanceof un&&(i=n.left.name+"."+n.right.name),i?t.map((t=>({type:e.PropertyType.boolean,value:Wt(t,i)}))):[]},not:t=>Gt.toBoolean(t).map((t=>({type:e.PropertyType.boolean,value:!t.value}))),resolve:t=>t.map((t=>{const n=t.value;let i;if("string"==typeof n)i=n;else if("object"==typeof n){const e=n;if(e.resource)return Ot(e.resource);i=e.reference}if(!i)return{type:e.PropertyType.BackboneElement,value:null};const[o,r]=i.split("/");return{type:e.PropertyType.BackboneElement,value:{resourceType:o,id:r}}})).filter((e=>!!e.value)),as:e=>e,type:t=>t.map((({value:t})=>"boolean"==typeof t?{type:e.PropertyType.BackboneElement,value:{namespace:"System",name:"Boolean"}}:"number"==typeof t?{type:e.PropertyType.BackboneElement,value:{namespace:"System",name:"Integer"}}:t&&"object"==typeof t&&"resourceType"in t?{type:e.PropertyType.BackboneElement,value:{namespace:"FHIR",name:t.resourceType}}:{type:e.PropertyType.BackboneElement,value:null})),conformsTo:(t,n)=>{const i=n.eval(t)[0].value;if(!i.startsWith("http://hl7.org/fhir/StructureDefinition/"))throw new Error("Expected a StructureDefinition URL");const o=i.replace("http://hl7.org/fhir/StructureDefinition/","");return t.map((t=>{var n;return{type:e.PropertyType.boolean,value:(null===(n=t.value)||void 0===n?void 0:n.resourceType)===o}}))}};function Xt(e,t,...n){if(0===t.length)return[];const[{value:i}]=Jt(t,1);if("string"!=typeof i)throw new Error("String function cannot be called with non-string");const o=e(i,...n.map((e=>{var n,i;return e&&(null===(i=null===(n=e.eval(t))||void 0===n?void 0:n[0])||void 0===i?void 0:i.value)})));return void 0===o?[]:Array.isArray(o)?o.map(Ot):[Ot(o)]}function Yt(t,n,...i){if(0===n.length)return[];const[{value:o}]=Jt(n,1),r=$t(o),a=r?o.value:o;if("number"!=typeof a)throw new Error("Math function cannot be called with non-number");const s=t(a,...i.map((e=>{var t,i;return null===(i=null===(t=e.eval(n))||void 0===t?void 0:t[0])||void 0===i?void 0:i.value})));return[{type:r?e.PropertyType.Quantity:n[0].type,value:r?Object.assign(Object.assign({},o),{value:s}):s}]}function Jt(e,t){if(e.length!==t)throw new Error(`Expected ${t} arguments`);for(const t of e)if(null==t)throw new Error("Expected non-null argument");return e}var Zt,Kt;class en{constructor(e,t){this.original=e,this.child=t}eval(e){try{return e.length>0?e.map((e=>this.child.eval([e]))).flat():this.child.eval([])}catch(e){throw new Error(`FhirPathError on "${this.original}": ${e}`)}}toString(){return this.child.toString()}}class tn{constructor(e){this.value=e}eval(){return[this.value]}toString(){const e=this.value.value;return"string"==typeof e?`'${e}'`:e.toString()}}class nn{constructor(e){this.name=e,Zt.add(this)}eval(e){return"$this"===this.name?e:e.map((e=>n(this,Zt,"m",Kt).call(this,e))).flat().filter((e=>void 0!==(null==e?void 0:e.value)))}toString(){return this.name}}Zt=new WeakSet,Kt=function(e){const t=e.value;if(t&&"object"==typeof t)return"resourceType"in t&&t.resourceType===this.name?e:It(e,this.name)};class on{eval(){return[]}toString(){return"{}"}}class rn extends wt{constructor(e,t,n){super(e,t),this.impl=n}eval(e){return this.impl(this.child.eval(e))}toString(){return this.child.toString()}}class an extends Et{constructor(e,t){super("as",e,t)}eval(e){return Gt.ofType(this.left.eval(e),this.right)}}class sn extends Et{constructor(e,t,n,i){super(e,t,n),this.impl=i}eval(t){const n=this.left.eval(t);if(1!==n.length)return[];const i=this.right.eval(t);if(1!==i.length)return[];const o=n[0].value,r=i[0].value,a=$t(o)?o.value:o,s=$t(r)?r.value:r,c=this.impl(a,s);return"boolean"==typeof c?Rt(c):$t(o)?[{type:e.PropertyType.Quantity,value:Object.assign(Object.assign({},o),{value:c})}]:[Ot(c)]}}class cn extends Et{constructor(e,t){super("&",e,t)}eval(t){const n=[...this.left.eval(t),...this.right.eval(t)];return n.length>0&&n.every((e=>"string"==typeof e.value))?[{type:e.PropertyType.string,value:n.map((e=>e.value)).join("")}]:n}}class dn extends Et{constructor(e,t){super("contains",e,t)}eval(e){const t=this.left.eval(e),n=this.right.eval(e);return Rt(t.some((e=>e.value===n[0].value)))}}class ln extends Et{constructor(e,t){super("in",e,t)}eval(e){const t=this.left.eval(e);return Rt(this.right.eval(e).some((e=>e.value===t[0].value)))}}class un extends Et{constructor(e,t){super(".",e,t)}eval(e){return this.right.eval(this.left.eval(e))}toString(){return`${this.left.toString()}.${this.right.toString()}`}}class pn extends Et{constructor(e,t){super("|",e,t)}eval(e){return Ut([...this.left.eval(e),...this.right.eval(e)])}}class mn extends Et{constructor(e,t){super("=",e,t)}eval(e){return Nt(this.left.eval(e),this.right.eval(e))}}class hn extends Et{constructor(e,t){super("!=",e,t)}eval(e){return Lt(Nt(this.left.eval(e),this.right.eval(e)))}}class fn extends Et{constructor(e,t){super("~",e,t)}eval(e){return _t(this.left.eval(e),this.right.eval(e))}}class yn extends Et{constructor(e,t){super("!~",e,t)}eval(e){return Lt(_t(this.left.eval(e),this.right.eval(e)))}}class gn extends Et{constructor(e,t){super("is",e,t)}eval(e){const t=this.left.eval(e);if(1!==t.length)return[];const n=this.right.name;return Rt(Wt(t[0],n))}}class xn extends Et{constructor(e,t){super("and",e,t)}eval(e){var t,n,i,o;const r=this.left.eval(e),a=this.right.eval(e);return!0===(null===(t=r[0])||void 0===t?void 0:t.value)&&!0===(null===(n=a[0])||void 0===n?void 0:n.value)?Rt(!0):!1===(null===(i=r[0])||void 0===i?void 0:i.value)||!1===(null===(o=a[0])||void 0===o?void 0:o.value)?Rt(!1):[]}}class vn extends Et{constructor(e,t){super("or",e,t)}eval(e){const t=this.left.eval(e);if(kt(t))return t;const n=this.right.eval(e);return kt(n)?n:[]}}class Sn extends Et{constructor(e,t){super("xor",e,t)}eval(e){const t=this.left.eval(e),n=this.right.eval(e);if(0===t.length&&0===n.length)return[];const i=0===t.length?null:t[0].value,o=0===n.length?null:n[0].value;return!0===i&&!0!==o||!0!==i&&!0===o?Rt(!0):!0===i&&!0===o||!1===i&&!1===o?Rt(!1):[]}}class Tn{constructor(e,t){this.name=e,this.args=t}eval(e){const t=Gt[this.name];if(!t)throw new Error("Unrecognized function: "+this.name);return t(e,...this.args)}toString(){return`${this.name}(${this.args.map((e=>e.toString())).join(", ")})`}}class wn{constructor(e,t){this.left=e,this.expr=t}eval(e){const t=this.expr.eval(e);if(1!==t.length)return[];const n=t[0].value;if("number"!=typeof n)throw new Error("Invalid indexer expression: should return integer}");const i=this.left.eval(e);return n in i?[i[n]]:[]}toString(){return`${this.left.toString()}[${this.expr.toString()}]`}}const En=["true","false"],bn=["!=","!~","<=",">=","{}","->"];function Pn(e){return new Ct(e,En,bn).tokenize()}const Dn={parse(e){var t;const n=e.consumeAndParse();if(!e.match(")"))throw new Error("Parse error: expected `)` got `"+(null===(t=e.peek())||void 0===t?void 0:t.value)+"`");return n}},Cn={parse(e,t){const n=e.consumeAndParse();if(!e.match("]"))throw new Error("Parse error: expected `]`");return new wn(t,n)},precedence:2},An={parse(e,t){if(!(t instanceof nn))throw new Error("Unexpected parentheses");const n=[];for(;!e.match(")");)n.push(e.consumeAndParse()),e.match(",");return new Tn(t.name,n)},precedence:0};function Rn(e){const t=e.split(" "),n=parseFloat(t[0]);let i=t[1];return i=i&&i.startsWith("'")&&i.endsWith("'")?i.substring(1,i.length-1):"{"+i+"}",{value:n,unit:i}}function On(){return(new bt).registerPrefix("String",{parse:(t,n)=>new tn({type:e.PropertyType.string,value:n.value})}).registerPrefix("DateTime",{parse:(t,n)=>new tn({type:e.PropertyType.dateTime,value:At(n.value)})}).registerPrefix("Quantity",{parse:(t,n)=>new tn({type:e.PropertyType.Quantity,value:Rn(n.value)})}).registerPrefix("Number",{parse:(t,n)=>new tn({type:e.PropertyType.decimal,value:parseFloat(n.value)})}).registerPrefix("true",{parse:()=>new tn({type:e.PropertyType.boolean,value:!0})}).registerPrefix("false",{parse:()=>new tn({type:e.PropertyType.boolean,value:!1})}).registerPrefix("Symbol",{parse:(e,t)=>new nn(t.value)}).registerPrefix("{}",{parse:()=>new on}).registerPrefix("(",Dn).registerInfix("[",Cn).registerInfix("(",An).prefix("+",3,((e,t)=>new rn("+",t,(e=>e)))).prefix("-",3,((e,t)=>new sn("-",t,t,((e,t)=>-t)))).infixLeft(".",1,((e,t,n)=>new un(e,n))).infixLeft("/",4,((e,t,n)=>new sn("/",e,n,((e,t)=>e/t)))).infixLeft("*",4,((e,t,n)=>new sn("*",e,n,((e,t)=>e*t)))).infixLeft("+",5,((e,t,n)=>new sn("+",e,n,((e,t)=>e+t)))).infixLeft("-",5,((e,t,n)=>new sn("-",e,n,((e,t)=>e-t)))).infixLeft("|",7,((e,t,n)=>new pn(e,n))).infixLeft("=",9,((e,t,n)=>new mn(e,n))).infixLeft("!=",9,((e,t,n)=>new hn(e,n))).infixLeft("~",9,((e,t,n)=>new fn(e,n))).infixLeft("!~",9,((e,t,n)=>new yn(e,n))).infixLeft("<",8,((e,t,n)=>new sn("<",e,n,((e,t)=>e<t)))).infixLeft("<=",8,((e,t,n)=>new sn("<=",e,n,((e,t)=>e<=t)))).infixLeft(">",8,((e,t,n)=>new sn(">",e,n,((e,t)=>e>t)))).infixLeft(">=",8,((e,t,n)=>new sn(">=",e,n,((e,t)=>e>=t)))).infixLeft("&",5,((e,t,n)=>new cn(e,n))).infixLeft("and",6,((e,t,n)=>new xn(e,n))).infixLeft("as",6,((e,t,n)=>new an(e,n))).infixLeft("contains",6,((e,t,n)=>new dn(e,n))).infixLeft("div",6,((e,t,n)=>new sn("div",e,n,((e,t)=>e/t|0)))).infixLeft("in",6,((e,t,n)=>new ln(e,n))).infixLeft("is",6,((e,t,n)=>new gn(e,n))).infixLeft("mod",6,((e,t,n)=>new sn("mod",e,n,((e,t)=>e%t)))).infixLeft("or",6,((e,t,n)=>new vn(e,n))).infixLeft("xor",6,((e,t,n)=>new Sn(e,n)))}const kn=On();function In(e){return new en(e,kn.construct(Pn(e)).consumeAndParse())}function Mn(e,t){const n=Array.isArray(t)?t:[t];for(let e=0;e<n.length;e++){const t=n[e];"object"==typeof t&&"type"in t&&"value"in t||(n[e]=Ot(n[e]))}return Un(e,n).map((e=>e.value))}function Un(e,t){return In(e).eval(t)}class Ln{constructor(e="\r",t="|",n="^",i="~",o="\\",r="&"){this.segmentSeparator=e,this.fieldSeparator=t,this.componentSeparator=n,this.repetitionSeparator=i,this.escapeCharacter=o,this.subcomponentSeparator=r}getMsh2(){return this.fieldSeparator+this.componentSeparator+this.repetitionSeparator+this.escapeCharacter+this.subcomponentSeparator}}class Nn{constructor(e,t=new Ln){this.context=t,this.segments=e}get(e){return"number"==typeof e?this.segments[e]:this.segments.find((t=>t.name===e))}getAll(e){return this.segments.filter((t=>t.name===e))}toString(){return this.segments.map((e=>e.toString())).join(this.context.segmentSeparator)}buildAck(){var e,t,n,i,o,r;const a=new Date,s=this.get("MSH"),c=(null===(e=null==s?void 0:s.get(2))||void 0===e?void 0:e.toString())||"",d=(null===(t=null==s?void 0:s.get(3))||void 0===t?void 0:t.toString())||"",l=(null===(n=null==s?void 0:s.get(4))||void 0===n?void 0:n.toString())||"",u=(null===(i=null==s?void 0:s.get(5))||void 0===i?void 0:i.toString())||"",p=(null===(o=null==s?void 0:s.get(9))||void 0===o?void 0:o.toString())||"",m=(null===(r=null==s?void 0:s.get(12))||void 0===r?void 0:r.toString())||"2.5.1";return new Nn([new jn(["MSH",this.context.getMsh2(),l,u,c,d,a.toISOString(),"","ACK",a.getTime().toString(),"P",m],this.context),new jn(["MSA","AA",p,"OK"],this.context)])}static parse(e){if(!e.startsWith("MSH")){const e=new Error("Invalid HL7 message");throw e.type="entity.parse.failed",e}const t=new Ln("\r",e.charAt(3),e.charAt(4),e.charAt(5),e.charAt(6),e.charAt(7));return new Nn(e.split(/[\r\n]+/).map((e=>jn.parse(e,t))),t)}}class jn{constructor(e,t=new Ln){this.context=t,I(e)?this.fields=e.map((e=>_n.parse(e))):this.fields=e,this.name=this.fields[0].components[0][0]}get(e){return this.fields[e]}toString(){return this.fields.map((e=>e.toString())).join(this.context.fieldSeparator)}static parse(e,t=new Ln){return new jn(e.split(t.fieldSeparator).map((e=>_n.parse(e,t))),t)}}class _n{constructor(e,t=new Ln){this.context=t,this.components=e}get(e,t,n=0){let i=this.components[n][e]||"";return void 0!==t&&(i=i.split(this.context.subcomponentSeparator)[t]||""),i}toString(){return this.components.map((e=>e.join(this.context.componentSeparator))).join(this.context.repetitionSeparator)}static parse(e,t=new Ln){return new _n(e.split(t.repetitionSeparator).map((e=>e.split(t.componentSeparator))),t)}}var Qn;e.Operator=void 0,(Qn=e.Operator||(e.Operator={})).EQUALS="eq",Qn.NOT_EQUALS="ne",Qn.GREATER_THAN="gt",Qn.LESS_THAN="lt",Qn.GREATER_THAN_OR_EQUALS="ge",Qn.LESS_THAN_OR_EQUALS="le",Qn.STARTS_AFTER="sa",Qn.ENDS_BEFORE="eb",Qn.APPROXIMATELY="ap",Qn.CONTAINS="contains",Qn.EXACT="exact",Qn.TEXT="text",Qn.NOT="not",Qn.ABOVE="above",Qn.BELOW="below",Qn.IN="in",Qn.NOT_IN="not-in",Qn.OF_TYPE="of-type",Qn.MISSING="missing";const Bn=[e.Operator.CONTAINS,e.Operator.EXACT,e.Operator.TEXT,e.Operator.NOT,e.Operator.ABOVE,e.Operator.BELOW,e.Operator.IN,e.Operator.NOT_IN,e.Operator.OF_TYPE,e.Operator.MISSING],Wn=[e.Operator.NOT_EQUALS,e.Operator.GREATER_THAN,e.Operator.LESS_THAN,e.Operator.GREATER_THAN_OR_EQUALS,e.Operator.LESS_THAN_OR_EQUALS,e.Operator.STARTS_AFTER,e.Operator.ENDS_BEFORE,e.Operator.APPROXIMATELY];var qn;function $n(t,n){var i,o;let r=null===(o=null===(i=de.types[t])||void 0===i?void 0:i.searchParamsDetails)||void 0===o?void 0:o[n.code];return r||(r=function(t,n){var i,o,r,a,s,c,d;if("_lastUpdated"===n.code)return{columnName:"lastUpdated",type:e.SearchParameterType.DATETIME};const l=n.code,u=function(e){return e.split("-").reduce(((e,t,n)=>e+(n?N(t):t)),"")}(l),p=null===(i=Hn(t,n.expression))||void 0===i?void 0:i.split(".");if(!p)return{columnName:u,type:e.SearchParameterType.TEXT};const m=Fn(n);let h,f,y=t,g=!1;for(let e=1;e<p.length;e++){const i=p[e];if(h=null!==(a=null===(r=null===(o=de.types[y])||void 0===o?void 0:o.properties)||void 0===r?void 0:r[i])&&void 0!==a?a:null===(c=null===(s=de.types[y])||void 0===s?void 0:s.properties)||void 0===c?void 0:c[i+"[x]"],!h)throw new Error(`Element definition not found for ${t} ${n.code}`);if("*"===h.max&&(g=!0),f=null===(d=h.type)||void 0===d?void 0:d[0].code,!f)return{columnName:u,type:m,array:g};e<p.length-1&&("Element"===f||"BackboneElement"===f?y+=N(i):y=f)}const x=Fn(n,f),v={columnName:u,type:x,elementDefinition:h,array:g};return function(e,t,n){const i=de.types[e];i.searchParamsDetails||(i.searchParamsDetails={});i.searchParamsDetails[t]=n}(t,l,v),v}(t,n)),r}function Fn(t,n){let i=e.SearchParameterType.TEXT;switch(t.type){case"date":i=n===e.PropertyType.dateTime||n===e.PropertyType.instant?e.SearchParameterType.DATETIME:e.SearchParameterType.DATE;break;case"number":i=e.SearchParameterType.NUMBER;break;case"quantity":i=e.SearchParameterType.QUANTITY;break;case"reference":i=e.SearchParameterType.REFERENCE;break;case"token":"boolean"===n&&(i=e.SearchParameterType.BOOLEAN)}return i}function Hn(e,t){const n=t.split(" | ");for(const t of n){if((i=t).includes(" as Period")||i.includes(" as SampledDate"))continue;const n=zn(t);if(n.startsWith(e+"."))return n}var i}function zn(e){let t=e.trim();t.startsWith("(")&&t.endsWith(")")&&(t=t.substring(1,t.length-1)),t.includes("[0]")&&(t=t.replaceAll("[0]",""));const n=[" != "," as ",".as(",".exists(",".where("];for(const e of n)t.includes(e)&&(t=t.substring(0,t.indexOf(e)));return t}function Vn(t,n,i){var o,r;const a=null===(r=null===(o=de.types[n.resourceType])||void 0===o?void 0:o.searchParams)||void 0===r?void 0:r[i.code];switch(null==a?void 0:a.type){case"reference":return function(t,n,i){const o=Mn(i.expression,t),r=Jn(n.operator);if(""===n.value&&0===o.length)return n.operator===e.Operator.EQUALS;const a=o.map((e=>"string"==typeof e?e:e.reference));for(const e of n.value.split(",")){let t=a.includes(e);if(t||"_compartment"!==n.code||(t=a.some((t=>null==t?void 0:t.endsWith("/"+e)))),t)return!r}return r}(t,i,a);case"string":return Gn(t,i,a);case"token":return function(t,n,i){const o=$n(t.resourceType,i);return o.type===e.SearchParameterType.BOOLEAN?function(e,t,n){const i=Mn(n.expression,e),o="true"===t.value,r=i.includes(o);return Jn(t.operator)?!r:r}(t,n,i):Gn(t,n,i)}(t,i,a);case"date":return function(e,t,n){const i=Mn(n.expression,e),o=t.value.split(","),r=Jn(t.operator);for(const e of i)for(const n of o){if(Yn(e,t.operator,n))return!r}return r}(t,i,a)}return!1}function Gn(e,t,n){const i=Mn(n.expression,e),o=t.value.split(","),r=Jn(t.operator);for(const e of i)for(const n of o){if(Xn(e,t.operator,n))return!r}return r}function Xn(e,t,n){let i="";return e&&("string"==typeof e?i=e:"object"==typeof e&&(i=JSON.stringify(e))),i.toLowerCase().includes(n.toLowerCase())}function Yn(t,n,i){switch(n){case e.Operator.STARTS_AFTER:case e.Operator.GREATER_THAN:return t>i;case e.Operator.GREATER_THAN_OR_EQUALS:return t>=i;case e.Operator.ENDS_BEFORE:case e.Operator.LESS_THAN:return t<i;case e.Operator.LESS_THAN_OR_EQUALS:return t<=i;case e.Operator.EQUALS:case e.Operator.NOT_EQUALS:return t===i}return!1}function Jn(t){return t===e.Operator.NOT_EQUALS||t===e.Operator.NOT}e.SearchParameterType=void 0,(qn=e.SearchParameterType||(e.SearchParameterType={})).BOOLEAN="BOOLEAN",qn.NUMBER="NUMBER",qn.QUANTITY="QUANTITY",qn.TEXT="TEXT",qn.REFERENCE="REFERENCE",qn.DATE="DATE",qn.DATETIME="DATETIME",qn.PERIOD="PERIOD";const Zn="ok",Kn="created",ei="gone",ti="not-modified",ni="not-found",ii="unauthorized",oi="forbidden",ri="too-many-requests",ai={resourceType:"OperationOutcome",id:Zn,issue:[{severity:"information",code:"informational",details:{text:"All OK"}}]},si={resourceType:"OperationOutcome",id:Kn,issue:[{severity:"information",code:"informational",details:{text:"Created"}}]},ci={resourceType:"OperationOutcome",id:ti,issue:[{severity:"information",code:"informational",details:{text:"Not Modified"}}]},di={resourceType:"OperationOutcome",id:ni,issue:[{severity:"error",code:"not-found",details:{text:"Not found"}}]},li={resourceType:"OperationOutcome",id:ii,issue:[{severity:"error",code:"login",details:{text:"Unauthorized"}}]},ui={resourceType:"OperationOutcome",id:oi,issue:[{severity:"error",code:"forbidden",details:{text:"Forbidden"}}]},pi={resourceType:"OperationOutcome",id:ei,issue:[{severity:"error",code:"deleted",details:{text:"Gone"}}]},mi={resourceType:"OperationOutcome",id:ri,issue:[{severity:"error",code:"throttled",details:{text:"Too Many Requests"}}]};function hi(e){return e.id===Zn||e.id===Kn||e.id===ti}class fi extends Error{constructor(e){var t,n;super(null===(n=null===(t=null==e?void 0:e.issue)||void 0===t?void 0:t[0].details)||void 0===n?void 0:n.text),this.outcome=e}}e.AndAtom=xn,e.ArithemticOperatorAtom=sn,e.AsAtom=an,e.ConcatAtom=cn,e.ContainsAtom=dn,e.DEFAULT_SEARCH_COUNT=20,e.DotAtom=un,e.EmptySetAtom=on,e.EqualsAtom=mn,e.EquivalentAtom=fn,e.FHIRPATH_KEYWORDS=En,e.FHIRPATH_OPERATORS=bn,e.FhirPathAtom=en,e.FunctionAtom=Tn,e.Hl7Context=Ln,e.Hl7Field=_n,e.Hl7Message=Nn,e.Hl7Segment=jn,e.InAtom=ln,e.IndexerAtom=wn,e.IsAtom=gn,e.LRUCache=c,e.LiteralAtom=tn,e.MEDPLUM_VERSION="1.0.5-53328b63",e.MedplumClient=class extends J{constructor(e){var t,o;if(super(),le.add(this),ue.set(this,void 0),pe.set(this,void 0),me.set(this,void 0),he.set(this,void 0),fe.set(this,void 0),ye.set(this,void 0),ge.set(this,void 0),xe.set(this,void 0),ve.set(this,void 0),Se.set(this,void 0),Te.set(this,void 0),we.set(this,void 0),Ee.set(this,void 0),be.set(this,void 0),Pe.set(this,void 0),De.set(this,void 0),Ce.set(this,void 0),Ae.set(this,void 0),(null==e?void 0:e.baseUrl)&&!e.baseUrl.startsWith("http"))throw new Error("Base URL must start with http or https");i(this,ue,(null==e?void 0:e.fetch)||window.fetch.bind(window),"f"),i(this,pe,null==e?void 0:e.createPdf,"f"),i(this,me,new te,"f"),i(this,he,new c(null!==(t=null==e?void 0:e.resourceCacheSize)&&void 0!==t?t:1e3),"f"),i(this,fe,null!==(o=null==e?void 0:e.cacheTime)&&void 0!==o?o:6e4,"f"),i(this,ye,function(e){if(!e)return e;return e.endsWith("/")?e:e+"/"}(null==e?void 0:e.baseUrl)||"https://api.medplum.com/","f"),i(this,Te,(null==e?void 0:e.clientId)||"","f"),i(this,ge,(null==e?void 0:e.authorizeUrl)||n(this,ye,"f")+"oauth2/authorize","f"),i(this,xe,(null==e?void 0:e.tokenUrl)||n(this,ye,"f")+"oauth2/token","f"),i(this,ve,(null==e?void 0:e.logoutUrl)||n(this,ye,"f")+"oauth2/logout","f"),i(this,Se,null==e?void 0:e.onUnauthenticated,"f");const r=this.getActiveLogin();r&&(i(this,Ee,r.accessToken,"f"),i(this,be,r.refreshToken,"f"),n(this,le,"m",Oe).call(this).catch(console.log)),n(this,le,"m",qe).call(this)}getBaseUrl(){return n(this,ye,"f")}clear(){n(this,me,"f").clear(),n(this,he,"f").clear(),i(this,Ee,void 0,"f"),i(this,be,void 0,"f"),i(this,Ce,void 0,"f"),i(this,Ae,void 0,"f"),this.dispatchEvent({type:"change"})}invalidateUrl(e){e=e.toString(),n(this,he,"f").delete(e)}invalidateSearches(e){const t="fhir/R4/"+e;for(const e of n(this,he,"f").keys())(e.endsWith(t)||e.includes(t+"?"))&&n(this,he,"f").delete(e)}get(e,t={}){e=e.toString();const i=n(this,le,"m",ke).call(this,e,t);if(i)return i.value;const o=new ee(n(this,le,"m",Me).call(this,"GET",e,t));return n(this,le,"m",Ie).call(this,e,o),o}post(e,t,i,o={}){return e=e.toString(),t&&n(this,le,"m",Ne).call(this,o,t),i&&n(this,le,"m",Le).call(this,o,i),this.invalidateUrl(e),n(this,le,"m",Me).call(this,"POST",e,o)}put(e,t,i,o={}){return e=e.toString(),t&&n(this,le,"m",Ne).call(this,o,t),i&&n(this,le,"m",Le).call(this,o,i),this.invalidateUrl(e),n(this,le,"m",Me).call(this,"PUT",e,o)}patch(e,t,i={}){return e=e.toString(),n(this,le,"m",Ne).call(this,i,t),n(this,le,"m",Le).call(this,i,"application/json-patch+json"),this.invalidateUrl(e),n(this,le,"m",Me).call(this,"PATCH",e,i)}delete(e,t={}){return e=e.toString(),this.invalidateUrl(e),n(this,le,"m",Me).call(this,"DELETE",e,t)}startNewUser(e){return t(this,void 0,void 0,(function*(){return yield this.startPkce(),this.post("auth/newuser",Object.assign(Object.assign({},e),{codeChallengeMethod:"S256",codeChallenge:sessionStorage.getItem("codeChallenge")}))}))}startNewProject(e){return t(this,void 0,void 0,(function*(){return this.post("auth/newproject",e)}))}startNewPatient(e){return t(this,void 0,void 0,(function*(){return this.post("auth/newpatient",e)}))}startLogin(e){var i;return t(this,void 0,void 0,(function*(){const{codeChallenge:t,codeChallengeMethod:o}=this.getCodeChallenge(e);return this.post("auth/login",Object.assign(Object.assign({},e),{clientId:null!==(i=e.clientId)&&void 0!==i?i:n(this,Te,"f"),scope:e.scope,codeChallengeMethod:o,codeChallenge:t}))}))}startGoogleLogin(e){var i;return t(this,void 0,void 0,(function*(){const{codeChallenge:t,codeChallengeMethod:o}=this.getCodeChallenge(e);return this.post("auth/google",Object.assign(Object.assign({},e),{clientId:null!==(i=e.clientId)&&void 0!==i?i:n(this,Te,"f"),scope:e.scope,codeChallengeMethod:o,codeChallenge:t}))}))}getCodeChallenge(e){if(e.codeChallenge)return{codeChallenge:e.codeChallenge,codeChallengeMethod:e.codeChallengeMethod};const t=sessionStorage.getItem("codeChallenge");return t?{codeChallenge:t,codeChallengeMethod:"S256"}:{}}signOut(){this.clear()}signInWithRedirect(){return t(this,void 0,void 0,(function*(){const e=new URLSearchParams(window.location.search).get("code");return e?this.processCode(e):void(yield n(this,le,"m",_e).call(this))}))}signOutWithRedirect(){window.location.assign(n(this,ve,"f"))}fhirUrl(...e){return new URL(n(this,ye,"f")+"fhir/R4/"+e.join("/"))}fhirSearchUrl(e,t){const n=this.fhirUrl(e);return t&&(n.search=t.toString()),n}search(e,t,n={}){return this.get(this.fhirSearchUrl(e,t),n)}searchOne(e,t,i={}){const o=this.fhirSearchUrl(e,t);o.searchParams.set("_count","1"),o.searchParams.sort();const r=o.toString()+"-searchOne",a=n(this,le,"m",ke).call(this,r,i);if(a)return a.value;const s=new ee(this.search(e,o.searchParams,i).then((e=>{var t,n;return null===(n=null===(t=e.entry)||void 0===t?void 0:t[0])||void 0===n?void 0:n.resource})));return n(this,le,"m",Ie).call(this,r,s),s}searchResources(e,t,i={}){const o=this.fhirSearchUrl(e,t).toString()+"-searchResources",r=n(this,le,"m",ke).call(this,o,i);if(r)return r.value;const a=new ee(this.search(e,t,i).then((e=>{var t,n;return null!==(n=null===(t=e.entry)||void 0===t?void 0:t.map((e=>e.resource)))&&void 0!==n?n:[]})));return n(this,le,"m",Ie).call(this,o,a),a}searchValueSet(e,t,n={}){const i=this.fhirUrl("ValueSet","$expand");return i.searchParams.set("url",e),i.searchParams.set("filter",t),this.get(i.toString(),n)}getCached(e,t){var i;const o=null===(i=n(this,he,"f").get(this.fhirUrl(e,t).toString()))||void 0===i?void 0:i.value;return o&&o.isOk()?o.read():void 0}getCachedReference(e){const t=e.reference;if(!t)return;const[n,i]=t.split("/");return n&&i?this.getCached(n,i):void 0}readResource(e,t,n={}){return this.get(this.fhirUrl(e,t),n)}readReference(e,t={}){const n=null==e?void 0:e.reference;if(!n)return new ee(Promise.reject(new Error("Missing reference")));const[i,o]=n.split("/");return i&&o?this.readResource(i,o,t):new ee(Promise.reject(new Error("Invalid reference")))}getSchema(){return de}requestSchema(e){return t(this,void 0,void 0,(function*(){if(e in de.types)return de;const t=`{\n StructureDefinitionList(name: "${e}") {\n name,\n description,\n snapshot {\n element {\n id,\n path,\n min,\n max,\n type {\n code,\n targetProfile\n },\n binding {\n valueSet\n },\n definition\n }\n }\n }\n SearchParameterList(base: "${e}", _count: 100) {\n base,\n code,\n type,\n expression,\n target\n }\n }`.replace(/\s+/g," "),n=yield this.graphql(t);for(const e of n.data.StructureDefinitionList)re(e);for(const e of n.data.SearchParameterList)ae(e);return de}))}readHistory(e,t,n={}){return this.get(this.fhirUrl(e,t,"_history"),n)}readVersion(e,t,n,i={}){return this.get(this.fhirUrl(e,t,"_history",n),i)}readPatientEverything(e,t={}){return this.get(this.fhirUrl("Patient",e,"$everything"),t)}createResource(e){if(!e.resourceType)throw new Error("Missing resourceType");return this.invalidateSearches(e.resourceType),this.post(this.fhirUrl(e.resourceType),e)}createResourceIfNoneExist(e,n){var i;return t(this,void 0,void 0,(function*(){return null!==(i=yield this.searchOne(e.resourceType,n))&&void 0!==i?i:this.createResource(e)}))}createBinary(e,t,n,i){const o=this.fhirUrl("Binary");return t&&o.searchParams.set("_filename",t),i?this.uploadwithProgress(o,e,n,i):this.post(o,e,n)}uploadwithProgress(e,t,i,o){return new Promise(((r,a)=>{const s=new XMLHttpRequest;s.responseType="json",s.onabort=()=>a(new Error("Request aborted")),s.onerror=()=>a(new Error("Request error")),o&&(s.upload.onprogress=e=>o(e),s.upload.onload=e=>o(e)),s.onload=()=>{s.status>=200&&s.status<300?r(s.response):a(new Error(s.statusText))},s.open("POST",e),s.withCredentials=!0,s.setRequestHeader("Authorization","Bearer "+n(this,Ee,"f")),s.setRequestHeader("Cache-Control","no-cache, no-store, max-age=0"),s.setRequestHeader("Content-Type",i),s.setRequestHeader("X-Medplum","extended"),s.send(t)}))}createPdf(e,i,o,r){return t(this,void 0,void 0,(function*(){if(!n(this,pe,"f"))throw new Error("PDF creation not enabled");const t=yield n(this,pe,"f").call(this,e,o,r);return this.createBinary(t,i,"application/pdf")}))}createComment(e,t){const n=this.getProfile();let i,o;return"Encounter"===e.resourceType&&(i=S(e),o=e.subject),"ServiceRequest"===e.resourceType&&(i=e.encounter,o=e.subject),"Patient"===e.resourceType&&(o=S(e)),this.createResource({resourceType:"Communication",basedOn:[S(e)],encounter:i,subject:o,sender:n?S(n):void 0,sent:(new Date).toISOString(),payload:[{contentString:t}]})}updateResource(e){return t(this,void 0,void 0,(function*(){if(!e.resourceType)throw new Error("Missing resourceType");if(!e.id)throw new Error("Missing id");this.invalidateSearches(e.resourceType);const t=yield this.put(this.fhirUrl(e.resourceType,e.id),e);return null!=t?t:e}))}patchResource(e,t,n){return this.invalidateSearches(e),this.patch(this.fhirUrl(e,t),n)}deleteResource(e,t){return this.invalidateSearches(e),this.delete(this.fhirUrl(e,t))}validateResource(e){return this.post(this.fhirUrl(e.resourceType,"$validate"),e)}executeBatch(e){return this.post("fhir/R4",e)}sendEmail(e){return this.post("email/v1/send",e,"application/json")}graphql(e,t,n,i){return this.post(this.fhirUrl("$graphql"),{query:e,operationName:t,variables:n},"application/json",i)}readResourceGraph(e,t,n){return this.get(`${this.fhirUrl(e,t)}/$graph?graph=${n}`)}getActiveLogin(){return n(this,me,"f").getObject("activeLogin")}setActiveLogin(e){return t(this,void 0,void 0,(function*(){i(this,Ee,e.accessToken,"f"),i(this,be,e.refreshToken,"f"),i(this,Ce,void 0,"f"),i(this,Ae,void 0,"f"),n(this,me,"f").setObject("activeLogin",e),n(this,le,"m",Re).call(this,e),n(this,he,"f").clear(),i(this,Pe,void 0,"f"),yield n(this,le,"m",Oe).call(this)}))}getAccessToken(){return n(this,Ee,"f")}setAccessToken(e){i(this,Ee,e,"f"),i(this,be,void 0,"f"),i(this,Ce,void 0,"f"),i(this,Ae,void 0,"f")}getLogins(){var e;return null!==(e=n(this,me,"f").getObject("logins"))&&void 0!==e?e:[]}isLoading(){return!!n(this,De,"f")}getProfile(){return n(this,Ce,"f")}getProfileAsync(){return t(this,void 0,void 0,(function*(){return n(this,De,"f")&&(yield n(this,De,"f")),this.getProfile()}))}getUserConfiguration(){return n(this,Ae,"f")}download(e,i={}){return t(this,void 0,void 0,(function*(){n(this,Pe,"f")&&(yield n(this,Pe,"f")),n(this,le,"m",Ue).call(this,i);return(yield n(this,ue,"f").call(this,e.toString(),i)).blob()}))}startPkce(){return t(this,void 0,void 0,(function*(){const e=q();sessionStorage.setItem("pkceState",e);const n=q();sessionStorage.setItem("codeVerifier",n);const i=L(yield function(e){return t(this,void 0,void 0,(function*(){return crypto.subtle.digest("SHA-256",(new TextEncoder).encode(e))}))}(n)).replace(/\+/g,"-").replace(/\//g,"_").replace(/=/g,"");sessionStorage.setItem("codeChallenge",i)}))}processCode(e){const t=new URLSearchParams;t.set("grant_type","authorization_code"),t.set("client_id",n(this,Te,"f")),t.set("code",e),t.set("redirect_uri",$e());const i=sessionStorage.getItem("codeVerifier");return i&&t.set("code_verifier",i),n(this,le,"m",Be).call(this,t)}startClientLogin(e,o){return t(this,void 0,void 0,(function*(){i(this,Te,e,"f"),i(this,we,o,"f");const t=new URLSearchParams;return t.set("grant_type","client_credentials"),t.set("client_id",e),t.set("client_secret",o),n(this,le,"m",Be).call(this,t)}))}},e.NotEqualsAtom=hn,e.NotEquivalentAtom=yn,e.OperationOutcomeError=fi,e.OrAtom=vn,e.ReadablePromise=ee,e.SymbolAtom=nn,e.UnaryOperatorAtom=rn,e.UnionAtom=pn,e.XorAtom=Sn,e.allOk=ai,e.arrayBufferToBase64=L,e.arrayBufferToHex=U,e.assertOk=function(e,t){if(!hi(e)||void 0===t)throw new fi(e)},e.badRequest=function(e,t){return{resourceType:"OperationOutcome",issue:[{severity:"error",code:"invalid",details:{text:e},expression:t?[t]:void 0}]}},e.booleanToTypedValue=Rt,e.buildTypeName=se,e.calculateAge=P,e.calculateAgeString=function(e,t){const{years:n,months:i,days:o}=P(e,t);return n>=2?n.toString().padStart(3,"0")+"Y":i>=1?i.toString().padStart(3,"0")+"M":o.toString().padStart(3,"0")+"D"},e.capitalize=N,e.createReference=S,e.createSchema=function(){return{types:{}}},e.created=si,e.deepClone=function(e){return JSON.parse(JSON.stringify(e))},e.deepEquals=O,e.evalFhirPath=Mn,e.evalFhirPathTyped=Un,e.fhirPathArrayEquals=Nt,e.fhirPathArrayEquivalent=_t,e.fhirPathEquals=jt,e.fhirPathEquivalent=Qt,e.fhirPathIs=Wt,e.fhirPathNot=Lt,e.findObservationInterval=function(e,t,n,i){var o;return null===(o=e.qualifiedInterval)||void 0===o?void 0:o.find((o=>{var r;return j(o,t)&&function(e,t,n){return!!e.range&&_(t,e.range,n)}(o,n,null===(r=e.quantitativeDetails)||void 0===r?void 0:r.decimalPrecision)&&(void 0===i||o.category===i)}))},e.findObservationReferenceRange=function(e,t,n){var i;return null===(i=e.qualifiedInterval)||void 0===i?void 0:i.find((e=>j(e,t)&&n.includes(e.condition)))},e.forbidden=ui,e.formatAddress=function(e,t){const n=[];if(e.line&&n.push(...e.line),e.city||e.state||e.postalCode){const t=[];e.city&&t.push(e.city),e.state&&t.push(e.state),e.postalCode&&t.push(e.postalCode),n.push(t.join(", "))}return e.use&&((null==t?void 0:t.all)||(null==t?void 0:t.use))&&n.push("["+e.use+"]"),n.join((null==t?void 0:t.lineSeparator)||", ").trim()},e.formatCodeableConcept=g,e.formatCoding=x,e.formatDate=function(e,t,n){if(!e)return"";const i=new Date(e);return l(i)?(i.setUTCHours(0,0,0,0),i.toLocaleDateString(t,Object.assign({timeZone:"UTC"},n))):""},e.formatDateTime=p,e.formatFamilyName=function(e){return e.family||""},e.formatGivenName=function(e){const t=[];return e.given&&t.push(...e.given),t.join(" ").trim()},e.formatHumanName=d,e.formatObservationValue=function e(t){return t?"component"in t?t.component.map((t=>e(t))).join(" / "):(null==t?void 0:t.valueQuantity)?y(t.valueQuantity):t.valueCodeableConcept?g(t.valueCodeableConcept):t.valueString?t.valueString:"":""},e.formatPeriod=function(e,t,n){return e&&(e.start||e.end)?p(e.start,t,n)+" - "+p(e.end,t,n):""},e.formatQuantity=y,e.formatRange=function(e,t,n=!1){var i,o,r,a;if(n&&void 0===t)throw new Error("Precision must be specified for exclusive ranges");const s=(null==e?void 0:e.low)&&Object.assign({},e.low),c=(null==e?void 0:e.high)&&Object.assign({},e.high);return!e||void 0===(null==s?void 0:s.value)&&void 0===(null==c?void 0:c.value)?"":void 0!==(null===(i=e.low)||void 0===i?void 0:i.value)&&void 0===(null===(o=e.high)||void 0===o?void 0:o.value)?n&&void 0!==t?(e.low.value=function(e,t,n=1){return(v(e,t)-n)*Math.pow(10,-t)}(e.low.value,t),`> ${y(e.low,t)}`):`>= ${y(e.low,t)}`:void 0===(null===(r=e.low)||void 0===r?void 0:r.value)&&void 0!==(null===(a=e.high)||void 0===a?void 0:a.value)?n&&void 0!==t?(e.high.value=function(e,t,n=1){return(v(e,t)+n)*Math.pow(10,-t)}(e.high.value,t),`< ${y(e.high,t)}`):`<= ${y(e.high,t)}`:((null==s?void 0:s.unit)===(null==c?void 0:c.unit)&&(null==s||delete s.unit),`${y(s,t)} - ${y(c,t)}`)},e.formatSearchQuery=function(e){const t=[];return e.fields&&t.push("_fields="+e.fields.join(",")),e.filters&&e.filters.forEach((e=>t.push(function(e){const t=Bn.includes(e.operator)?":"+e.operator:"",n=Wn.includes(e.operator)?e.operator:"";return`${e.code}${t}=${n}${encodeURIComponent(e.value)}`}(e)))),e.sortRules&&e.sortRules.length>0&&t.push(function(e){if(!e||0===e.length)return"";return"_sort="+e.map((e=>e.descending?"-"+e.code:e.code)).join(",")}(e.sortRules)),void 0!==e.offset&&t.push("_offset="+e.offset),void 0!==e.count&&t.push("_count="+e.count),void 0!==e.total&&t.push("_total="+e.total),0===t.length?"":(t.sort(),"?"+t.join("&"))},e.formatTime=u,e.formatTiming=function(e){var t;if(!e)return"";const n=[];if(null===(t=e.repeat)||void 0===t?void 0:t.periodUnit){const t=e.repeat.frequency||1,i=e.repeat.period||1,o=e.repeat.periodUnit;1===t&&1===i?n.push(m[o]):(1===t?n.push("once"):n.push(t+" times"),1===i?n.push("per "+h[o]):n.push("per "+i+" "+f[o])),e.repeat.dayOfWeek&&n.push("on "+e.repeat.dayOfWeek.map(N).join(", ")),e.repeat.timeOfDay&&n.push("at "+e.repeat.timeOfDay.map((e=>u(e))).join(", "))}return e.event&&n.push(e.event.map((e=>p(e))).join(", ")),N(n.join(" ").trim())},e.getCodeBySystem=function(e,t){var n,i;return null===(i=null===(n=null==e?void 0:e.coding)||void 0===n?void 0:n.find((e=>e.system===t)))||void 0===i?void 0:i.code},e.getDateProperty=function(e){return e?new Date(e):void 0},e.getDisplayString=E,e.getElementDefinition=ce,e.getExpressionForResourceType=Hn,e.getExtensionValue=function(e,...t){var n;let i=e;for(let e=0;e<t.length&&i;e++)i=null===(n=null==i?void 0:i.extension)||void 0===n?void 0:n.find((n=>n.url===t[e]));return null==i?void 0:i.valueString},e.getIdentifier=function(e,t){const n=e.identifier;if(!n)return;const i=Array.isArray(n)?n:[n];for(const e of i)if(e.system===t)return e.value},e.getImageSrc=function(e){if(!("photo"in e))return;const t=e.photo;if(t){if(!Array.isArray(t))return b(t);for(const e of t){const t=b(e);if(t)return t}}},e.getPropertyDisplayName=function(e){const t=e.replaceAll("[x]","").split(".").pop();return"id"===t?"ID":t.split(/(?=[A-Z])/).map(N).join(" ").replace("_"," ").replace(/\s+/g," ")},e.getQuestionnaireAnswers=function(e){const t={};return D(e.item,t),t},e.getReferenceString=T,e.getSearchParameterDetails=$n,e.getStatus=function(e){return e.id===Zn?200:e.id===Kn?201:e.id===ti?304:e.id===ii?401:e.id===oi?403:e.id===ni?404:e.id===ei?410:e.id===ri?429:400},e.getTypedPropertyValue=It,e.globalSchema=de,e.gone=pi,e.indexSearchParameter=ae,e.indexSearchParameterBundle=function(e){for(const t of e.entry){const e=t.resource;"SearchParameter"===e.resourceType&&ae(e)}},e.indexStructureDefinition=re,e.indexStructureDefinitionBundle=function(e){for(const t of e.entry){const e=t.resource;"StructureDefinition"===e.resourceType&&re(e)}},e.initFhirPathParserBuilder=On,e.isEmpty=R,e.isGone=function(e){return e.id===ei},e.isLowerCase=function(e){return e===e.toLowerCase()&&e!==e.toUpperCase()},e.isNotFound=function(e){return e.id===ni},e.isObject=k,e.isOk=hi,e.isPeriod=qt,e.isProfileResource=w,e.isQuantity=$t,e.isQuantityEquivalent=Ft,e.isStringArray=I,e.isUUID=function(e){return!!e.match(/^\w{8}-\w{4}-\w{4}-\w{4}-\w{12}$/i)},e.isValidDate=l,e.matchesRange=_,e.matchesSearchRequest=function(e,t){if(t.resourceType!==e.resourceType)return!1;if(t.filters)for(const n of t.filters)if(!Vn(e,t,n))return!1;return!0},e.normalizeErrorString=function(e){var t,n,i,o;if(!e)return"Unknown error";if("string"==typeof e)return e;if(e instanceof Error)return e.message;if("object"==typeof e&&"resourceType"in e){return null!==(o=null===(i=null===(n=null===(t=e.issue)||void 0===t?void 0:t[0])||void 0===n?void 0:n.details)||void 0===i?void 0:i.text)&&void 0!==o?o:"Unknown error"}return JSON.stringify(e)},e.notFound=di,e.notModified=ci,e.parseFhirPath=In,e.parseJWTPayload=K,e.parseSearchDefinition=function(t){const n=new URL(t,"https://example.com/"),i=n.pathname.replace(/(^\/)|(\/$)/g,"").split("/").pop();let o,r,a,s,c,d;return new URLSearchParams(n.search).forEach(((t,n)=>{"_fields"===n?a=t.split(","):"_offset"===n?s=parseInt(t):"_count"===n?c=parseInt(t):"_total"===n?d=t:"_sort"===n?(r=r||[],r.push(function(e){return e.startsWith("-")?{code:e.substring(1),descending:!0}:{code:e}}(t))):(o=o||[],o.push(function(t,n){let i=t,o=e.Operator.EQUALS;for(const e of Bn){const t=i.indexOf(":"+e);-1!==t&&(o=e,i=i.substring(0,t))}for(const e of Wn)n.match(new RegExp("^"+e+"\\d"))&&(o=e,n=n.substring(e.length));return{code:i,operator:o,value:n}}(n,t)))})),{resourceType:i,filters:o,fields:a,offset:s,count:c,total:d,sortRules:r}},e.preciseEquals=function(e,t,n){return W(e,n)===W(t,n)},e.preciseGreaterThan=function(e,t,n){return W(e,n)>W(t,n)},e.preciseGreaterThanOrEquals=B,e.preciseLessThan=function(e,t,n){return W(e,n)<W(t,n)},e.preciseLessThanOrEquals=Q,e.preciseRound=function(e,t){return parseFloat(e.toFixed(t))},e.removeDuplicates=Ut,e.resolveId=function(e){var t;return null===(t=null==e?void 0:e.reference)||void 0===t?void 0:t.split("/")[1]},e.setCodeBySystem=function(e,t,n){var i,o;e.coding||(e.coding=[]);const r=null===(i=e.coding)||void 0===i?void 0:i.find((e=>e.system===t));r?r.code=n:null===(o=e.coding)||void 0===o||o.push({system:t,code:n})},e.stringify=C,e.toJsBoolean=kt,e.toTypedValue=Ot,e.tokenize=Pn,e.tooManyRequests=mi,e.unauthorized=li}));
|
|
2
|
-
//# sourceMappingURL=index.min.js.map
|