@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
|
@@ -0,0 +1 @@
|
|
|
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){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 n(e,t,n,i,r){if("m"===i)throw new TypeError("Private method is not writable");if("a"===i&&!r)throw new TypeError("Private accessor was defined without a setter");if("function"==typeof t?e!==t||!r:!t.has(e))throw new TypeError("Cannot write private member to an object whose class did not declare it");return"a"===i?r.call(e,n):r?r.value=n:t.set(e,n),n}var i,r,o,a;class s{constructor(e=10){i.add(this),r.set(this,void 0),o.set(this,void 0),n(this,r,e,"f"),n(this,o,new Map,"f")}clear(){t(this,o,"f").clear()}get(e){const n=t(this,o,"f").get(e);return n&&(t(this,o,"f").delete(e),t(this,o,"f").set(e,n)),n}set(e,n){t(this,o,"f").has(e)?t(this,o,"f").delete(e):t(this,o,"f").size>=t(this,r,"f")&&t(this,o,"f").delete(t(this,i,"m",a).call(this)),t(this,o,"f").set(e,n)}delete(e){t(this,o,"f").delete(e)}keys(){return t(this,o,"f").keys()}}function c(e,t){const n=[];return e.prefix&&!1!==t?.prefix&&n.push(...e.prefix),e.given&&n.push(...e.given),e.family&&n.push(e.family),e.suffix&&!1!==t?.suffix&&n.push(...e.suffix),e.use&&(t?.all||t?.use)&&n.push("["+e.use+"]"),n.join(" ").trim()}function d(e){return e instanceof Date&&!isNaN(e.getTime())}function l(e,t,n){if(!e)return"";const i=new Date("2000-01-01T"+e+"Z");return d(i)?i.toLocaleTimeString(t,n):""}function u(e,t,n){if(!e)return"";const i=new Date(e);return d(i)?i.toLocaleString(t,n):""}r=new WeakMap,o=new WeakMap,i=new WeakSet,a=function(){return t(this,o,"f").keys().next().value};const m={s:"every second",min:"every minute",h:"hourly",d:"daily",wk:"weekly",mo:"monthly",a:"annually"},p={s:"second",min:"minute",h:"hour",d:"day",wk:"week",mo:"month",a:"year"},h={s:"seconds",min:"minutes",h:"hours",d:"days",wk:"weeks",mo:"months",a:"years"};function f(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 y(e){return e?e.text?e.text:e.coding?e.coding.map((e=>g(e))).join(", "):"":""}function g(e){return e?.display||e?.code||""}function x(e,t){return void 0===t?e:Math.round(e*Math.pow(10,t))}function v(e){const t=S(e),n=T(e);return n===t?{reference:t}:{reference:t,display:n}}function S(e){return e.resourceType+"/"+e.id}function w(e){return"Patient"===e.resourceType||"Practitioner"===e.resourceType||"RelatedPerson"===e.resourceType}function T(e){if(w(e)){const t=function(e){const t=e.name;if(t&&t.length>0)return c(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&&e.code?.text?e.code.text:"User"===e.resourceType&&e.email?e.email:"name"in e&&e.name&&"string"==typeof e.name?e.name:S(e)}function E(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 r=n.getUTCFullYear(),o=n.getUTCMonth(),a=n.getUTCDate(),s=i.getUTCFullYear(),c=i.getUTCMonth(),d=i.getUTCDate();let l=s-r;(c<o||c===o&&d<a)&&l--;let u=12*s+c-(12*r+o);d<a&&u--;return{years:l,months:u,days:Math.floor((i.getTime()-n.getTime())/864e5)}}function b(e,t){if(e)for(const n of e)n.linkId&&n.answer&&n.answer.length>0&&(t[n.linkId]=n.answer[0]),b(n.item,t)}function D(e,t){return JSON.stringify(e,C,t?2:void 0)}function C(e,t){return!function(e){return!!e.match(/\d+$/)}(e)&&A(t)?void 0:t}function A(e){if(null==e)return!0;const t=typeof e;return"string"===t&&""===e||"object"===t&&0===Object.keys(e).length}function R(e,t,n){return e===t||(!(!A(e)||!A(t))||!A(e)&&!A(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(!R(e[n],t[n]))return!1;return!0}(e,t):!Array.isArray(e)&&!Array.isArray(t)&&(O(e)&&O(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(!R(e[n],t[n],n))return!1}return!0}(e,t,n):(O(e)||O(t),!1))))}function O(e){return null!==e&&"object"==typeof e}function k(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 I(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 U(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 L(e){return e.charAt(0).toUpperCase()+e.substring(1)}function N(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){return(void 0===t.low?.value||Q(e,t.low.value,n))&&(void 0===t.high?.value||j(e,t.high.value,n))}function j(e,t,n){return B(e,n)<=B(t,n)}function Q(e,t,n){return B(e,n)>=B(t,n)}function B(e,t){return void 0===t?e:Math.round(e*Math.pow(10,t))}function W(){const e=new Uint32Array(28);return crypto.getRandomValues(e),I(e.buffer)}var q,$,F,H,z,V,G,X;class Y{constructor(){q.set(this,void 0),n(this,q,{},"f")}addEventListener(e,n){t(this,q,"f")[e]||(t(this,q,"f")[e]=[]),t(this,q,"f")[e].push(n)}removeEventListeneer(e,n){const i=t(this,q,"f")[e];if(i)for(let e=0;e<i.length;e++)if(i[e]===n)return void i.splice(e,1)}dispatchEvent(e){const n=t(this,q,"f")[e.type];return n&&n.forEach((t=>t.call(this,e))),!e.defaultPrevented}}function J(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 Z(e){const[t,n,i]=e.split(".");return J(n)}q=new WeakMap;class K{constructor(e){this[V]="ReadablePromise",$.set(this,void 0),F.set(this,"pending"),H.set(this,void 0),z.set(this,void 0),n(this,$,e.then((e=>(n(this,F,"success","f"),n(this,H,e,"f"),e)),(e=>{throw n(this,F,"error","f"),n(this,z,e,"f"),e})),"f")}isPending(){return"pending"===t(this,F,"f")}isOk(){return"success"===t(this,F,"f")}read(){switch(t(this,F,"f")){case"pending":throw t(this,$,"f");case"error":throw t(this,z,"f");default:return t(this,H,"f")}}then(e,n){return t(this,$,"f").then(e,n)}catch(e){return t(this,$,"f").catch(e)}finally(e){return t(this,$,"f").finally(e)}}$=new WeakMap,F=new WeakMap,H=new WeakMap,z=new WeakMap,V=Symbol.toStringTag;class ee{constructor(){G.set(this,void 0),n(this,G,"undefined"!=typeof localStorage?localStorage:new te,"f")}clear(){t(this,G,"f").clear()}getString(e){return t(this,G,"f").getItem(e)||void 0}setString(e,n){n?t(this,G,"f").setItem(e,n):t(this,G,"f").removeItem(e)}getObject(e){const t=this.getString(e);return t?JSON.parse(t):void 0}setObject(e,t){this.setString(e,t?D(t):void 0)}}G=new WeakMap;class te{constructor(){X.set(this,void 0),n(this,X,new Map,"f")}get length(){return t(this,X,"f").size}clear(){t(this,X,"f").clear()}getItem(e){return t(this,X,"f").get(e)??null}setItem(e,n){n?t(this,X,"f").set(e,n):t(this,X,"f").delete(e)}removeItem(e){t(this,X,"f").delete(e)}key(e){return Array.from(t(this,X,"f").keys())[e]}}X=new WeakMap;var ne,ie={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){if(!e.name)return;const t=e.snapshot?.element;t&&(t.forEach((t=>function(e,t){const n=t.path,i=t.type?.[0]?.code;if(void 0!==i&&"Element"!==i&&"BackboneElement"!==i)return;const r=n.split("."),o=ae(r);ce.types[o]=function(e,t,n){return{structureDefinition:t,elementDefinition:n,display:e,description:n.definition,properties:{}}}(o,e,t),ce.types[o].parentType=ae(r.slice(0,r.length-1))}(e,t))),t.forEach((e=>function(e){const t=e.path,n=t.split(".");if(1===n.length)return;const i=ae(n.slice(0,n.length-1)),r=ce.types[i];if(!r)return;const o=n[n.length-1];r.properties[o]=e}(e))))}function oe(e){if(e.base)for(const t of e.base){const n=ce.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 ae(e){return 1===e.length?e[0]:e.map(L).join("")}function se(e,t){const n=ce.types[e];if(!n)return;const i=n.properties[t]??n.properties[t+"[x]"];if(i){if(i.contentReference){const e=i.contentReference.substring(1).split("."),t=e.pop();return se(ae(e),t)}return i}}e.PropertyType=void 0,(ne=e.PropertyType||(e.PropertyType={})).Address="Address",ne.Age="Age",ne.Annotation="Annotation",ne.Attachment="Attachment",ne.BackboneElement="BackboneElement",ne.CodeableConcept="CodeableConcept",ne.Coding="Coding",ne.ContactDetail="ContactDetail",ne.ContactPoint="ContactPoint",ne.Contributor="Contributor",ne.Count="Count",ne.DataRequirement="DataRequirement",ne.Distance="Distance",ne.Dosage="Dosage",ne.Duration="Duration",ne.Expression="Expression",ne.Extension="Extension",ne.HumanName="HumanName",ne.Identifier="Identifier",ne.MarketingStatus="MarketingStatus",ne.Meta="Meta",ne.Money="Money",ne.Narrative="Narrative",ne.ParameterDefinition="ParameterDefinition",ne.Period="Period",ne.Population="Population",ne.ProdCharacteristic="ProdCharacteristic",ne.ProductShelfLife="ProductShelfLife",ne.Quantity="Quantity",ne.Range="Range",ne.Ratio="Ratio",ne.Reference="Reference",ne.RelatedArtifact="RelatedArtifact",ne.SampledData="SampledData",ne.Signature="Signature",ne.SubstanceAmount="SubstanceAmount",ne.SystemString="http://hl7.org/fhirpath/System.String",ne.Timing="Timing",ne.TriggerDefinition="TriggerDefinition",ne.UsageContext="UsageContext",ne.base64Binary="base64Binary",ne.boolean="boolean",ne.canonical="canonical",ne.code="code",ne.date="date",ne.dateTime="dateTime",ne.decimal="decimal",ne.id="id",ne.instant="instant",ne.integer="integer",ne.markdown="markdown",ne.oid="oid",ne.positiveInt="positiveInt",ne.string="string",ne.time="time",ne.unsignedInt="unsignedInt",ne.uri="uri",ne.url="url",ne.uuid="uuid";const ce=ie;var de,le,ue,me,pe,he,fe,ye,ge,xe,ve,Se,we,Te,Ee,Pe,be,De,Ce,Ae,Re,Oe,ke,Me,Ie,Ue,Le,Ne,_e,je,Qe,Be,We;function qe(){return window.location.protocol+"//"+window.location.host+"/"}var $e,Fe,He,ze,Ve,Ge,Xe,Ye,Je,Ze,Ke,et,tt,nt,it,rt,ot,at,st,ct,dt,lt,ut,mt,pt,ht,ft,yt,gt,xt,vt,St;le=new WeakMap,ue=new WeakMap,me=new WeakMap,pe=new WeakMap,he=new WeakMap,fe=new WeakMap,ye=new WeakMap,ge=new WeakMap,xe=new WeakMap,ve=new WeakMap,Se=new WeakMap,we=new WeakMap,Te=new WeakMap,Ee=new WeakMap,Pe=new WeakMap,be=new WeakMap,De=new WeakMap,Ce=new WeakMap,de=new WeakSet,Ae=function(e){const n=this.getLogins().filter((t=>t.profile?.reference!==e.profile?.reference));n.push(e),t(this,me,"f").setObject("logins",n)},Re=async function(){return n(this,be,new Promise(((e,i)=>{this.get("auth/me").then((i=>{n(this,be,void 0,"f"),n(this,De,i.profile,"f"),n(this,Ce,i.config,"f"),this.dispatchEvent({type:"change"}),e(t(this,De,"f"))})).catch(i)})),"f"),t(this,be,"f")},Oe=function(e,n){if(t(this,he,"f")<=0||"no-cache"===n?.cache||"reload"===n?.cache)return;const i=t(this,pe,"f").get(e);return!i||i.requestTime+t(this,he,"f")<Date.now()?void 0:i},ke=function(e,n){t(this,he,"f")>0&&t(this,pe,"f").set(e,{requestTime:Date.now(),value:n})},Me=async function(e,n,i={}){t(this,Pe,"f")&&await t(this,Pe,"f"),n.startsWith("http")||(n=t(this,fe,"f")+n),i.method=e,t(this,de,"m",Ie).call(this,i);const r=await t(this,le,"f").call(this,n,i);if(401===r.status)return t(this,de,"m",Ne).call(this,e,n,i);if(204===r.status||304===r.status)return;const o=await r.json();if(r.status>=400)throw o;return o},Ie=function(e){e.headers||(e.headers={});const n=e.headers;n["X-Medplum"]="extended",n["Content-Type"]||(n["Content-Type"]="application/fhir+json"),t(this,Te,"f")&&(n.Authorization="Bearer "+t(this,Te,"f")),e.cache||(e.cache="no-cache"),e.credentials||(e.credentials="include")},Ue=function(e,t){e.headers||(e.headers={});e.headers["Content-Type"]=t},Le=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))},Ne=function(e,n,i){return t(this,de,"m",je).call(this)?t(this,de,"m",Me).call(this,e,n,i):(this.clear(),t(this,ve,"f")&&t(this,ve,"f").call(this),Promise.reject(new Error("Unauthenticated")))},_e=async function(){await this.startPkce();const e=new URL(t(this,ye,"f"));e.searchParams.set("response_type","code"),e.searchParams.set("state",sessionStorage.getItem("pkceState")),e.searchParams.set("client_id",t(this,Se,"f")),e.searchParams.set("redirect_uri",qe()),e.searchParams.set("code_challenge_method","S256"),e.searchParams.set("code_challenge",sessionStorage.getItem("codeChallenge")),window.location.assign(e.toString())},je=function(){if(t(this,Pe,"f"))return t(this,Pe,"f");if(t(this,Ee,"f")){const e=new URLSearchParams;return e.set("grant_type","refresh_token"),e.set("client_id",t(this,Se,"f")),e.set("refresh_token",t(this,Ee,"f")),n(this,Pe,t(this,de,"m",Qe).call(this,e),"f"),t(this,Pe,"f")}return t(this,Se,"f")&&t(this,we,"f")?(n(this,Pe,this.startClientLogin(t(this,Se,"f"),t(this,we,"f")),"f"),t(this,Pe,"f")):void 0},Qe=async function(e){return t(this,le,"f").call(this,t(this,ge,"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=>t(this,de,"m",Be).call(this,e))).then((()=>this.getProfile()))},Be=async function(e){const n=e.access_token,i=Z(n);if(Date.now()>=1e3*i.exp)throw this.clear(),new Error("Token expired");if(t(this,Se,"f")&&i.client_id!==t(this,Se,"f"))throw this.clear(),new Error("Token was not issued for this audience");await this.setActiveLogin({accessToken:n,refreshToken:e.refresh_token,project:e.project,profile:e.profile})},We=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 Tt{constructor(e,t,n){this.operator=e,this.left=t,this.right=n}toString(){return`${this.left.toString()} ${this.operator} ${this.right.toString()}`}}class Et{constructor(){$e.set(this,{}),Fe.set(this,{})}registerInfix(e,n){return t(this,Fe,"f")[e]=n,this}registerPrefix(e,n){return t(this,$e,"f")[e]=n,this}prefix(e,t,n){return this.registerPrefix(e,{parse(e,i){const r=e.consumeAndParse(t);return n(i,r)}})}infixLeft(e,t,n){return this.registerInfix(e,{parse(e,i,r){const o=e.consumeAndParse(t);return n(i,r,o)},precedence:t})}construct(e){return new Pt(e,t(this,$e,"f"),t(this,Fe,"f"))}}$e=new WeakMap,Fe=new WeakMap;class Pt{constructor(e,t,i){He.set(this,void 0),ze.set(this,void 0),Ve.set(this,void 0),n(this,He,e,"f"),n(this,ze,t,"f"),n(this,Ve,i,"f")}hasMore(){return t(this,He,"f").length>0}match(e){return this.peek()?.id===e&&(this.consume(),!0)}consumeAndParse(e=1/0){const n=this.consume(),i=t(this,ze,"f")[n.id];if(!i)throw Error(`Parse error at "${n.value}" (line ${n.line}, column ${n.column}). No matching prefix parselet.`);let r=i.parse(this,n);for(;e>this.getPrecedence();){const e=this.consume();r=this.getInfixParselet(e).parse(this,r,e)}return r}getPrecedence(){const e=this.peek();if(!e)return 1/0;const t=this.getInfixParselet(e);return t?t.precedence:1/0}consume(e,n){if(!t(this,He,"f").length)throw Error("Cant consume unknown more tokens.");if(e&&this.peek()?.id!==e){const t=this.peek();throw Error(`Expected ${e} but got "${t.id}" at line ${t.line} column ${t.column}.`)}if(n&&this.peek()?.value!==n){const e=this.peek();throw Error(`Expected "${n}" but got "${e.value}" at line ${e.line} column ${e.column}.`)}return t(this,He,"f").shift()}peek(){return t(this,He,"f").length>0?t(this,He,"f")[0]:void 0}removeComments(){n(this,He,t(this,He,"f").filter((e=>"Comment"!==e.id)),"f")}getInfixParselet(e){return t(this,Ve,"f")["Symbol"===e.id?e.value:e.id]}}He=new WeakMap,ze=new WeakMap,Ve=new WeakMap;const bt=["year","years","month","months","week","weeks","day","days","hour","hours","minute","minutes","second","seconds","millisecond","milliseconds"];class Dt{constructor(e,t,i){Ge.add(this),Xe.set(this,void 0),Ye.set(this,void 0),Je.set(this,void 0),Ze.set(this,[]),Ke.set(this,{index:0,line:1,column:0}),et.set(this,[]),n(this,Xe,e,"f"),n(this,Ye,t,"f"),n(this,Je,i,"f")}tokenize(){for(;t(this,Ke,"f").index<t(this,Xe,"f").length;){const e=t(this,Ge,"m",it).call(this);e&&t(this,Ze,"f").push(e)}return t(this,Ze,"f")}}function Ct(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 At(t){return[{type:e.PropertyType.boolean,value:t}]}function Rt(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}:qt(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 Ot(e){return 0!==e.length&&!!e[0].value}function kt(t,n){if(!t?.value)return;const i=se(t.type,n);if(i){const e=function(e,t,n){const i=n.type;if(!i||0===i.length)return;let r,o="undefined";if(1===i.length)r=e.value[t],o=i[0].code;else for(const n of i){const i=t.replace("[x]","")+L(n.code);if(i in e.value){r=e.value[i],o=n.code;break}}if(A(r))return;"Element"!==o&&"BackboneElement"!==o||(o=ae(n.path?.split(".")));return Array.isArray(r)?r.map((e=>Mt(e,o))):Mt(r,o)}(t,n,i);if(e)return e}return function(t,n){const i=t.value;if(!i||"object"!=typeof i)return;let r;if(n in i)r=i[n];else for(const t in e.PropertyType){const e=n+L(t);if(e in i){r=i[e];break}}if(A(r))return;return Array.isArray(r)?r.map(Rt):Rt(r)}(t,n)}function Mt(e,t){return"Resource"===t&&"object"==typeof e&&"resourceType"in e&&(t=e.resourceType),{type:t,value:e}}function It(e){const t=[];for(const n of e){let e=!1;for(const i of t)if(Ot(Nt(n,i))){e=!0;break}e||t.push(n)}return t}function Ut(e){return At(!Ot(e))}function Lt(e,t){return 0===e.length||0===t.length?[]:e.length!==t.length?At(!1):At(e.every(((e,n)=>Ot(Nt(e,t[n])))))}function Nt(e,t){const n=e.value,i=t.value;return"number"==typeof n&&"number"==typeof i?At(Math.abs(n-i)<1e-8):qt(n)&&qt(i)?At($t(n,i)):At("object"==typeof n&&"object"==typeof i?Ft(e,t):n===i)}function _t(e,t){return 0===e.length&&0===t.length?At(!0):e.length!==t.length?At(!1):(e.sort(Qt),t.sort(Qt),At(e.every(((e,n)=>Ot(jt(e,t[n]))))))}function jt(e,t){const n=e.value,i=t.value;return"number"==typeof n&&"number"==typeof i?At(Math.abs(n-i)<.01):qt(n)&&qt(i)?At($t(n,i)):At("object"==typeof n&&"object"==typeof i?Ft(n,i):"string"==typeof n&&"string"==typeof i?n.toLowerCase()===i.toLowerCase():n===i)}function Qt(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 Bt(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 Wt(n);case"Quantity":return qt(n);default:return"object"==typeof n&&n?.resourceType===t}}function Wt(e){return!(!e||"object"!=typeof e||!("start"in e))}function qt(e){return!(!e||"object"!=typeof e||!("value"in e)||"number"!=typeof e.value)}function $t(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 Ft(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],r=t[i];if(Ht(n)&&Ht(r)){if(!Ft(n,r))return!1}else if(n!==r)return!1}return!0}function Ht(e){return null!==e&&"object"==typeof e}Xe=new WeakMap,Ye=new WeakMap,Je=new WeakMap,Ze=new WeakMap,Ke=new WeakMap,et=new WeakMap,Ge=new WeakSet,tt=function(){return t(this,Ze,"f").slice(-1)[0]},nt=function(){t(this,Ge,"m",gt).call(this);const e=t(this,Ge,"m",it).call(this);return t(this,Ge,"m",xt).call(this),e},it=function(){t(this,Ge,"m",rt).call(this);const e=t(this,Ge,"m",ht).call(this);if(!e)return;t(this,Ge,"m",gt).call(this);const n=t(this,Ge,"m",yt).call(this);return"/"===e&&"*"===n?t(this,Ge,"m",ot).call(this):"/"===e&&"/"===n?t(this,Ge,"m",at).call(this):"'"===e||'"'===e?t(this,Ge,"m",st).call(this,e):"`"===e?t(this,Ge,"m",ct).call(this):"@"===e?t(this,Ge,"m",dt).call(this):e.match(/\d/)?t(this,Ge,"m",lt).call(this):e.match(/\w/)||"$"===e&&n.match(/\w/)?t(this,Ge,"m",ut).call(this):t(this,Ge,"m",mt).call(this)},rt=function(){t(this,Ge,"m",pt).call(this,(()=>t(this,Ge,"m",ht).call(this).match(/\s/)))},ot=function(){const e=t(this,Ke,"f").index;return t(this,Ge,"m",pt).call(this,(()=>"*"!==t(this,Ge,"m",ht).call(this)||"/"!==t(this,Ge,"m",yt).call(this))),t(this,Ge,"m",vt).call(this),t(this,Ge,"m",vt).call(this),t(this,Ge,"m",St).call(this,"Comment",t(this,Xe,"f").substring(e,t(this,Ke,"f").index))},at=function(){return t(this,Ge,"m",St).call(this,"Comment",t(this,Ge,"m",pt).call(this,(()=>"\n"!==t(this,Ge,"m",ht).call(this))))},st=function(e){t(this,Ge,"m",vt).call(this);const n=t(this,Ge,"m",St).call(this,"String",t(this,Ge,"m",pt).call(this,(()=>"\\"===t(this,Ge,"m",ft).call(this)||t(this,Ge,"m",ht).call(this)!==e)));return t(this,Ge,"m",vt).call(this),n},ct=function(){t(this,Ge,"m",vt).call(this);const e=t(this,Ge,"m",St).call(this,"Symbol",t(this,Ge,"m",pt).call(this,(()=>"`"!==t(this,Ge,"m",ht).call(this))));return t(this,Ge,"m",vt).call(this),e},dt=function(){t(this,Ge,"m",vt).call(this);const e=t(this,Ke,"f").index;return t(this,Ge,"m",pt).call(this,(()=>t(this,Ge,"m",ht).call(this).match(/[\d-]/))),"T"===t(this,Ge,"m",ht).call(this)&&(t(this,Ge,"m",vt).call(this),t(this,Ge,"m",pt).call(this,(()=>t(this,Ge,"m",ht).call(this).match(/[\d:]/))),"."===t(this,Ge,"m",ht).call(this)&&t(this,Ge,"m",yt).call(this).match(/\d/)&&(t(this,Ge,"m",vt).call(this),t(this,Ge,"m",pt).call(this,(()=>t(this,Ge,"m",ht).call(this).match(/\d/)))),"Z"===t(this,Ge,"m",ht).call(this)?t(this,Ge,"m",vt).call(this):"+"!==t(this,Ge,"m",ht).call(this)&&"-"!==t(this,Ge,"m",ht).call(this)||(t(this,Ge,"m",vt).call(this),t(this,Ge,"m",pt).call(this,(()=>t(this,Ge,"m",ht).call(this).match(/[\d:]/))))),t(this,Ge,"m",St).call(this,"DateTime",t(this,Xe,"f").substring(e,t(this,Ke,"f").index))},lt=function(){const e=t(this,Ke,"f").index;let n="Number";return t(this,Ge,"m",pt).call(this,(()=>t(this,Ge,"m",ht).call(this).match(/\d/))),"."===t(this,Ge,"m",ht).call(this)&&t(this,Ge,"m",yt).call(this).match(/\d/)&&(t(this,Ge,"m",vt).call(this),t(this,Ge,"m",pt).call(this,(()=>t(this,Ge,"m",ht).call(this).match(/\d/))))," "===t(this,Ge,"m",ht).call(this)&&function(e){if(e){if("String"===e.id)return!0;if("Symbol"===e.id&&bt.includes(e.value))return!0}return!1}(t(this,Ge,"m",nt).call(this))&&(n="Quantity",t(this,Ge,"m",it).call(this)),t(this,Ge,"m",St).call(this,n,t(this,Xe,"f").substring(e,t(this,Ke,"f").index))},ut=function(){const e=t(this,Ge,"m",pt).call(this,(()=>t(this,Ge,"m",ht).call(this).match(/[$\w]/)));return"."!==t(this,Ge,"m",tt).call(this)?.value&&t(this,Ye,"f").includes(e)?t(this,Ge,"m",St).call(this,e,e):t(this,Ge,"m",St).call(this,"Symbol",e)},mt=function(){const e=t(this,Ge,"m",ht).call(this),n=e+t(this,Ge,"m",yt).call(this);return t(this,Je,"f").includes(n)?(t(this,Ge,"m",vt).call(this),t(this,Ge,"m",vt).call(this),t(this,Ge,"m",St).call(this,n,n)):(t(this,Ge,"m",vt).call(this),t(this,Ge,"m",St).call(this,e,e))},pt=function(e){const n=t(this,Ke,"f").index;for(;t(this,Ke,"f").index<t(this,Xe,"f").length&&e();)t(this,Ge,"m",vt).call(this);return t(this,Xe,"f").substring(n,t(this,Ke,"f").index)},ht=function(){return t(this,Xe,"f")[t(this,Ke,"f").index]},ft=function(){return t(this,Xe,"f")[t(this,Ke,"f").index-1]??""},yt=function(){return t(this,Xe,"f")[t(this,Ke,"f").index+1]??""},gt=function(){t(this,et,"f").push({...t(this,Ke,"f")})},xt=function(){const e=t(this,et,"f").pop();if(!e)throw new Error("No mark to reset to");t(this,Ke,"f").index=e.index,t(this,Ke,"f").line=e.line,t(this,Ke,"f").column=e.column},vt=function(){t(this,Ke,"f").index++,"\n"===t(this,Ge,"m",ht).call(this)?(t(this,Ke,"f").line++,t(this,Ke,"f").column=0):t(this,Ke,"f").column++},St=function(e,n){const i=t(this,et,"f").pop();if(!i)throw new Error("No mark for token");return{id:e,value:n,...i}};const zt=()=>[],Vt={empty:e=>At(0===e.length),exists:(e,t)=>At(t?e.filter((e=>Ot(t.eval([e])))).length>0:e.length>0),all:(e,t)=>At(e.every((e=>Ot(t.eval([e]))))),allTrue:e=>{for(const t of e)if(!t.value)return At(!1);return At(!0)},anyTrue:e=>{for(const t of e)if(t.value)return At(!0);return At(!1)},allFalse:e=>{for(const t of e)if(t.value)return At(!1);return At(!0)},anyFalse:e=>{for(const t of e)if(!t.value)return At(!0);return At(!1)},subsetOf:zt,supersetOf:zt,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=>At(e.length===Vt.distinct(e).length),where:(e,t)=>e.filter((e=>Ot(t.eval([e])))),select:(e,t)=>e.map((e=>t.eval([e]))).flat(),repeat:zt,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)=>{const n=t.eval(e)[0]?.value;if("number"!=typeof n)throw new Error("Expected a number for skip(num)");return n>=e.length?[]:n<=0?e:e.slice(n,e.length)},take:(e,t)=>{const n=t.eval(e)[0]?.value;if("number"!=typeof n)throw new Error("Expected a number for take(num)");return n>=e.length?e:n<=0?[]:e.slice(0,n)},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 It([...e,...n])},combine:(e,t)=>{if(!t)return e;const n=t.eval(e);return[...e,...n]},iif:(e,t,n,i)=>{const r=t.eval(e);if(r.length>1||1===r.length&&"boolean"!=typeof r[0].value)throw new Error("Expected criterion to evaluate to a Boolean");return Ot(r)?n.eval(e):i?i.eval(e):[]},toBoolean:t=>{if(0===t.length)return[];const[{value:n}]=Yt(t,1);if("boolean"==typeof n)return[{type:e.PropertyType.boolean,value:n}];if("number"==typeof n&&(0===n||1===n))return At(!!n);if("string"==typeof n){const e=n.toLowerCase();if(["true","t","yes","y","1","1.0"].includes(e))return At(!0);if(["false","f","no","n","0","0.0"].includes(e))return At(!1)}return[]},convertsToBoolean:e=>0===e.length?[]:At(1===Vt.toBoolean(e).length),toInteger:t=>{if(0===t.length)return[];const[{value:n}]=Yt(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?[]:At(1===Vt.toInteger(e).length),toDate:t=>{if(0===t.length)return[];const[{value:n}]=Yt(t,1);return"string"==typeof n&&n.match(/^\d{4}(-\d{2}(-\d{2})?)?/)?[{type:e.PropertyType.date,value:Ct(n)}]:[]},convertsToDate:e=>0===e.length?[]:At(1===Vt.toDate(e).length),toDateTime:t=>{if(0===t.length)return[];const[{value:n}]=Yt(t,1);return"string"==typeof n&&n.match(/^\d{4}(-\d{2}(-\d{2})?)?/)?[{type:e.PropertyType.dateTime,value:Ct(n)}]:[]},convertsToDateTime:e=>0===e.length?[]:At(1===Vt.toDateTime(e).length),toDecimal:t=>{if(0===t.length)return[];const[{value:n}]=Yt(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?[]:At(1===Vt.toDecimal(e).length),toQuantity:t=>{if(0===t.length)return[];const[{value:n}]=Yt(t,1);return qt(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?[]:At(1===Vt.toQuantity(e).length),toString:t=>{if(0===t.length)return[];const[{value:n}]=Yt(t,1);return null==n?[]:qt(n)?[{type:e.PropertyType.string,value:`${n.value} '${n.unit}'`}]:[{type:e.PropertyType.string,value:n.toString()}]},convertsToString:e=>0===e.length?[]:At(1===Vt.toString(e).length),toTime:t=>{if(0===t.length)return[];const[{value:n}]=Yt(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:Ct("T"+t[1])}]}return[]},convertsToTime:e=>0===e.length?[]:At(1===Vt.toTime(e).length),indexOf:(e,t)=>Gt(((e,t)=>e.indexOf(t)),e,t),substring:(e,t,n)=>Gt(((e,t,n)=>{const i=t,r=n?i+n:e.length;return i<0||i>=e.length?void 0:e.substring(i,r)}),e,t,n),startsWith:(e,t)=>Gt(((e,t)=>e.startsWith(t)),e,t),endsWith:(e,t)=>Gt(((e,t)=>e.endsWith(t)),e,t),contains:(e,t)=>Gt(((e,t)=>e.includes(t)),e,t),upper:e=>Gt((e=>e.toUpperCase()),e),lower:e=>Gt((e=>e.toLowerCase()),e),replace:(e,t,n)=>Gt(((e,t,n)=>e.replaceAll(t,n)),e,t,n),matches:(e,t)=>Gt(((e,t)=>!!e.match(t)),e,t),replaceMatches:(e,t,n)=>Gt(((e,t,n)=>e.replaceAll(t,n)),e,t,n),length:e=>Gt((e=>e.length),e),toChars:e=>Gt((e=>e?e.split(""):void 0),e),abs:e=>Xt(Math.abs,e),ceiling:e=>Xt(Math.ceil,e),exp:e=>Xt(Math.exp,e),floor:e=>Xt(Math.floor,e),ln:e=>Xt(Math.log,e),log:(e,t)=>Xt(((e,t)=>Math.log(e)/Math.log(t)),e,t),power:(e,t)=>Xt(Math.pow,e,t),round:e=>Xt(Math.round,e),sqrt:e=>Xt(Math.sqrt,e),truncate:e=>Xt((e=>0|e),e),children:zt,descendants:zt,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,r)=>{const o=Vt.toDateTime(n.eval(t));if(0===o.length)throw new Error("Invalid start date");const a=Vt.toDateTime(i.eval(t));if(0===a.length)throw new Error("Invalid end date");const s=r.eval(t)[0]?.value;if("years"!==s&&"months"!==s&&"days"!==s)throw new Error("Invalid units");const c=P(o[0].value,a[0].value);return[{type:e.PropertyType.Quantity,value:{value:c[s],unit:s}}]},is:(t,n)=>{let i="";return n instanceof tn?i=n.name:n instanceof ln&&(i=n.left.name+"."+n.right.name),i?t.map((t=>({type:e.PropertyType.boolean,value:Bt(t,i)}))):[]},not:t=>Vt.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 Rt(e.resource);i=e.reference}if(!i)return{type:e.PropertyType.BackboneElement,value:null};const[r,o]=i.split("/");return{type:e.PropertyType.BackboneElement,value:{resourceType:r,id:o}}})).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 r=i.replace("http://hl7.org/fhir/StructureDefinition/","");return t.map((t=>({type:e.PropertyType.boolean,value:t.value?.resourceType===r})))}};function Gt(e,t,...n){if(0===t.length)return[];const[{value:i}]=Yt(t,1);if("string"!=typeof i)throw new Error("String function cannot be called with non-string");const r=e(i,...n.map((e=>e&&e.eval(t)?.[0]?.value)));return void 0===r?[]:Array.isArray(r)?r.map(Rt):[Rt(r)]}function Xt(t,n,...i){if(0===n.length)return[];const[{value:r}]=Yt(n,1),o=qt(r),a=o?r.value:r;if("number"!=typeof a)throw new Error("Math function cannot be called with non-number");const s=t(a,...i.map((e=>e.eval(n)?.[0]?.value)));return[{type:o?e.PropertyType.Quantity:n[0].type,value:o?{...r,value:s}:s}]}function Yt(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 Jt,Zt;class Kt{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 en{constructor(e){this.value=e}eval(){return[this.value]}toString(){const e=this.value.value;return"string"==typeof e?`'${e}'`:e.toString()}}class tn{constructor(e){this.name=e,Jt.add(this)}eval(e){return"$this"===this.name?e:e.map((e=>t(this,Jt,"m",Zt).call(this,e))).flat().filter((e=>void 0!==e?.value))}toString(){return this.name}}Jt=new WeakSet,Zt=function(e){const t=e.value;if(t&&"object"==typeof t)return"resourceType"in t&&t.resourceType===this.name?e:kt(e,this.name)};class nn{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 on extends Tt{constructor(e,t){super("as",e,t)}eval(e){return Vt.ofType(this.left.eval(e),this.right)}}class an extends Tt{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 r=n[0].value,o=i[0].value,a=qt(r)?r.value:r,s=qt(o)?o.value:o,c=this.impl(a,s);return"boolean"==typeof c?At(c):qt(r)?[{type:e.PropertyType.Quantity,value:{...r,value:c}}]:[Rt(c)]}}class sn extends Tt{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 cn extends Tt{constructor(e,t){super("contains",e,t)}eval(e){const t=this.left.eval(e),n=this.right.eval(e);return At(t.some((e=>e.value===n[0].value)))}}class dn extends Tt{constructor(e,t){super("in",e,t)}eval(e){const t=this.left.eval(e);return At(this.right.eval(e).some((e=>e.value===t[0].value)))}}class ln extends Tt{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 un extends Tt{constructor(e,t){super("|",e,t)}eval(e){return It([...this.left.eval(e),...this.right.eval(e)])}}class mn extends Tt{constructor(e,t){super("=",e,t)}eval(e){return Lt(this.left.eval(e),this.right.eval(e))}}class pn extends Tt{constructor(e,t){super("!=",e,t)}eval(e){return Ut(Lt(this.left.eval(e),this.right.eval(e)))}}class hn extends Tt{constructor(e,t){super("~",e,t)}eval(e){return _t(this.left.eval(e),this.right.eval(e))}}class fn extends Tt{constructor(e,t){super("!~",e,t)}eval(e){return Ut(_t(this.left.eval(e),this.right.eval(e)))}}class yn extends Tt{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 At(Bt(t[0],n))}}class gn extends Tt{constructor(e,t){super("and",e,t)}eval(e){const t=this.left.eval(e),n=this.right.eval(e);return!0===t[0]?.value&&!0===n[0]?.value?At(!0):!1===t[0]?.value||!1===n[0]?.value?At(!1):[]}}class xn extends Tt{constructor(e,t){super("or",e,t)}eval(e){const t=this.left.eval(e);if(Ot(t))return t;const n=this.right.eval(e);return Ot(n)?n:[]}}class vn extends Tt{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,r=0===n.length?null:n[0].value;return!0===i&&!0!==r||!0!==i&&!0===r?At(!0):!0===i&&!0===r||!1===i&&!1===r?At(!1):[]}}class Sn{constructor(e,t){this.name=e,this.args=t}eval(e){const t=Vt[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 Tn=["true","false"],En=["!=","!~","<=",">=","{}","->"];function Pn(e){return new Dt(e,Tn,En).tokenize()}const bn={parse(e){const t=e.consumeAndParse();if(!e.match(")"))throw new Error("Parse error: expected `)` got `"+e.peek()?.value+"`");return t}},Dn={parse(e,t){const n=e.consumeAndParse();if(!e.match("]"))throw new Error("Parse error: expected `]`");return new wn(t,n)},precedence:2},Cn={parse(e,t){if(!(t instanceof tn))throw new Error("Unexpected parentheses");const n=[];for(;!e.match(")");)n.push(e.consumeAndParse()),e.match(",");return new Sn(t.name,n)},precedence:0};function An(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 Rn(){return(new Et).registerPrefix("String",{parse:(t,n)=>new en({type:e.PropertyType.string,value:n.value})}).registerPrefix("DateTime",{parse:(t,n)=>new en({type:e.PropertyType.dateTime,value:Ct(n.value)})}).registerPrefix("Quantity",{parse:(t,n)=>new en({type:e.PropertyType.Quantity,value:An(n.value)})}).registerPrefix("Number",{parse:(t,n)=>new en({type:e.PropertyType.decimal,value:parseFloat(n.value)})}).registerPrefix("true",{parse:()=>new en({type:e.PropertyType.boolean,value:!0})}).registerPrefix("false",{parse:()=>new en({type:e.PropertyType.boolean,value:!1})}).registerPrefix("Symbol",{parse:(e,t)=>new tn(t.value)}).registerPrefix("{}",{parse:()=>new nn}).registerPrefix("(",bn).registerInfix("[",Dn).registerInfix("(",Cn).prefix("+",3,((e,t)=>new rn("+",t,(e=>e)))).prefix("-",3,((e,t)=>new an("-",t,t,((e,t)=>-t)))).infixLeft(".",1,((e,t,n)=>new ln(e,n))).infixLeft("/",4,((e,t,n)=>new an("/",e,n,((e,t)=>e/t)))).infixLeft("*",4,((e,t,n)=>new an("*",e,n,((e,t)=>e*t)))).infixLeft("+",5,((e,t,n)=>new an("+",e,n,((e,t)=>e+t)))).infixLeft("-",5,((e,t,n)=>new an("-",e,n,((e,t)=>e-t)))).infixLeft("|",7,((e,t,n)=>new un(e,n))).infixLeft("=",9,((e,t,n)=>new mn(e,n))).infixLeft("!=",9,((e,t,n)=>new pn(e,n))).infixLeft("~",9,((e,t,n)=>new hn(e,n))).infixLeft("!~",9,((e,t,n)=>new fn(e,n))).infixLeft("<",8,((e,t,n)=>new an("<",e,n,((e,t)=>e<t)))).infixLeft("<=",8,((e,t,n)=>new an("<=",e,n,((e,t)=>e<=t)))).infixLeft(">",8,((e,t,n)=>new an(">",e,n,((e,t)=>e>t)))).infixLeft(">=",8,((e,t,n)=>new an(">=",e,n,((e,t)=>e>=t)))).infixLeft("&",5,((e,t,n)=>new sn(e,n))).infixLeft("and",6,((e,t,n)=>new gn(e,n))).infixLeft("as",6,((e,t,n)=>new on(e,n))).infixLeft("contains",6,((e,t,n)=>new cn(e,n))).infixLeft("div",6,((e,t,n)=>new an("div",e,n,((e,t)=>e/t|0)))).infixLeft("in",6,((e,t,n)=>new dn(e,n))).infixLeft("is",6,((e,t,n)=>new yn(e,n))).infixLeft("mod",6,((e,t,n)=>new an("mod",e,n,((e,t)=>e%t)))).infixLeft("or",6,((e,t,n)=>new xn(e,n))).infixLeft("xor",6,((e,t,n)=>new vn(e,n)))}const On=Rn();function kn(e){return new Kt(e,On.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]=Rt(n[e]))}return In(e,n).map((e=>e.value))}function In(e,t){return kn(e).eval(t)}class Un{constructor(e="\r",t="|",n="^",i="~",r="\\",o="&"){this.segmentSeparator=e,this.fieldSeparator=t,this.componentSeparator=n,this.repetitionSeparator=i,this.escapeCharacter=r,this.subcomponentSeparator=o}getMsh2(){return this.fieldSeparator+this.componentSeparator+this.repetitionSeparator+this.escapeCharacter+this.subcomponentSeparator}}class Ln{constructor(e,t=new Un){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(){const e=new Date,t=this.get("MSH"),n=t?.get(2)?.toString()||"",i=t?.get(3)?.toString()||"",r=t?.get(4)?.toString()||"",o=t?.get(5)?.toString()||"",a=t?.get(9)?.toString()||"",s=t?.get(12)?.toString()||"2.5.1";return new Ln([new Nn(["MSH",this.context.getMsh2(),r,o,n,i,e.toISOString(),"","ACK",e.getTime().toString(),"P",s],this.context),new Nn(["MSA","AA",a,"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 Un("\r",e.charAt(3),e.charAt(4),e.charAt(5),e.charAt(6),e.charAt(7));return new Ln(e.split(/[\r\n]+/).map((e=>Nn.parse(e,t))),t)}}class Nn{constructor(e,t=new Un){this.context=t,k(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 Un){return new Nn(e.split(t.fieldSeparator).map((e=>_n.parse(e,t))),t)}}class _n{constructor(e,t=new Un){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 Un){return new _n(e.split(t.repetitionSeparator).map((e=>e.split(t.componentSeparator))),t)}}var jn;e.Operator=void 0,(jn=e.Operator||(e.Operator={})).EQUALS="eq",jn.NOT_EQUALS="ne",jn.GREATER_THAN="gt",jn.LESS_THAN="lt",jn.GREATER_THAN_OR_EQUALS="ge",jn.LESS_THAN_OR_EQUALS="le",jn.STARTS_AFTER="sa",jn.ENDS_BEFORE="eb",jn.APPROXIMATELY="ap",jn.CONTAINS="contains",jn.EXACT="exact",jn.TEXT="text",jn.NOT="not",jn.ABOVE="above",jn.BELOW="below",jn.IN="in",jn.NOT_IN="not-in",jn.OF_TYPE="of-type",jn.MISSING="missing";const Qn=[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],Bn=[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 Wn;function qn(t,n){let i=ce.types[t]?.searchParamsDetails?.[n.code];return i||(i=function(t,n){if("_lastUpdated"===n.code)return{columnName:"lastUpdated",type:e.SearchParameterType.DATETIME};const i=n.code,r=function(e){return e.split("-").reduce(((e,t,n)=>e+(n?L(t):t)),"")}(i),o=Fn(t,n.expression)?.split(".");if(!o)return{columnName:r,type:e.SearchParameterType.TEXT};const a=$n(n);let s,c,d=t,l=!1;for(let e=1;e<o.length;e++){const i=o[e];if(s=ce.types[d]?.properties?.[i]??ce.types[d]?.properties?.[i+"[x]"],!s)throw new Error(`Element definition not found for ${t} ${n.code}`);if("*"===s.max&&(l=!0),c=s.type?.[0].code,!c)return{columnName:r,type:a,array:l};e<o.length-1&&("Element"===c||"BackboneElement"===c?d+=L(i):d=c)}const u=$n(n,c),m={columnName:r,type:u,elementDefinition:s,array:l};return function(e,t,n){const i=ce.types[e];i.searchParamsDetails||(i.searchParamsDetails={});i.searchParamsDetails[t]=n}(t,i,m),m}(t,n)),i}function $n(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 Fn(e,t){const n=t.split(" | ");for(const t of n){if((i=t).includes(" as Period")||i.includes(" as SampledDate"))continue;const n=Hn(t);if(n.startsWith(e+"."))return n}var i}function Hn(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 zn(t,n,i){const r=ce.types[n.resourceType]?.searchParams?.[i.code];switch(r?.type){case"reference":return function(t,n,i){const r=Mn(i.expression,t),o=Yn(n.operator);if(""===n.value&&0===r.length)return n.operator===e.Operator.EQUALS;const a=r.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=>t?.endsWith("/"+e)))),t)return!o}return o}(t,i,r);case"string":return Vn(t,i,r);case"token":return function(t,n,i){const r=qn(t.resourceType,i);return r.type===e.SearchParameterType.BOOLEAN?function(e,t,n){const i=Mn(n.expression,e),r="true"===t.value,o=i.includes(r);return Yn(t.operator)?!o:o}(t,n,i):Vn(t,n,i)}(t,i,r);case"date":return function(e,t,n){const i=Mn(n.expression,e),r=t.value.split(","),o=Yn(t.operator);for(const e of i)for(const n of r){if(Xn(e,t.operator,n))return!o}return o}(t,i,r)}return!1}function Vn(e,t,n){const i=Mn(n.expression,e),r=t.value.split(","),o=Yn(t.operator);for(const e of i)for(const n of r){if(Gn(e,t.operator,n))return!o}return o}function Gn(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 Xn(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 Yn(t){return t===e.Operator.NOT_EQUALS||t===e.Operator.NOT}e.SearchParameterType=void 0,(Wn=e.SearchParameterType||(e.SearchParameterType={})).BOOLEAN="BOOLEAN",Wn.NUMBER="NUMBER",Wn.QUANTITY="QUANTITY",Wn.TEXT="TEXT",Wn.REFERENCE="REFERENCE",Wn.DATE="DATE",Wn.DATETIME="DATETIME",Wn.PERIOD="PERIOD";const Jn="ok",Zn="created",Kn="gone",ei="not-modified",ti="not-found",ni="unauthorized",ii="forbidden",ri="too-many-requests",oi={resourceType:"OperationOutcome",id:Jn,issue:[{severity:"information",code:"informational",details:{text:"All OK"}}]},ai={resourceType:"OperationOutcome",id:Zn,issue:[{severity:"information",code:"informational",details:{text:"Created"}}]},si={resourceType:"OperationOutcome",id:ei,issue:[{severity:"information",code:"informational",details:{text:"Not Modified"}}]},ci={resourceType:"OperationOutcome",id:ti,issue:[{severity:"error",code:"not-found",details:{text:"Not found"}}]},di={resourceType:"OperationOutcome",id:ni,issue:[{severity:"error",code:"login",details:{text:"Unauthorized"}}]},li={resourceType:"OperationOutcome",id:ii,issue:[{severity:"error",code:"forbidden",details:{text:"Forbidden"}}]},ui={resourceType:"OperationOutcome",id:Kn,issue:[{severity:"error",code:"deleted",details:{text:"Gone"}}]},mi={resourceType:"OperationOutcome",id:ri,issue:[{severity:"error",code:"throttled",details:{text:"Too Many Requests"}}]};function pi(e){return e.id===Jn||e.id===Zn||e.id===ei}class hi extends Error{constructor(e){super(e?.issue?.[0].details?.text),this.outcome=e}}e.AndAtom=gn,e.ArithemticOperatorAtom=an,e.AsAtom=on,e.ConcatAtom=sn,e.ContainsAtom=cn,e.DEFAULT_SEARCH_COUNT=20,e.DotAtom=ln,e.EmptySetAtom=nn,e.EqualsAtom=mn,e.EquivalentAtom=hn,e.FHIRPATH_KEYWORDS=Tn,e.FHIRPATH_OPERATORS=En,e.FhirPathAtom=Kt,e.FunctionAtom=Sn,e.Hl7Context=Un,e.Hl7Field=_n,e.Hl7Message=Ln,e.Hl7Segment=Nn,e.InAtom=dn,e.IndexerAtom=wn,e.IsAtom=yn,e.LRUCache=s,e.LiteralAtom=en,e.MEDPLUM_VERSION="1.0.6-5860113c",e.MedplumClient=class extends Y{constructor(e){if(super(),de.add(this),le.set(this,void 0),ue.set(this,void 0),me.set(this,void 0),pe.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),we.set(this,void 0),Te.set(this,void 0),Ee.set(this,void 0),Pe.set(this,void 0),be.set(this,void 0),De.set(this,void 0),Ce.set(this,void 0),e?.baseUrl&&!e.baseUrl.startsWith("http"))throw new Error("Base URL must start with http or https");n(this,le,e?.fetch||window.fetch.bind(window),"f"),n(this,ue,e?.createPdf,"f"),n(this,me,new ee,"f"),n(this,pe,new s(e?.resourceCacheSize??1e3),"f"),n(this,he,e?.cacheTime??6e4,"f"),n(this,fe,function(e){if(!e)return e;return e.endsWith("/")?e:e+"/"}(e?.baseUrl)||"https://api.medplum.com/","f"),n(this,Se,e?.clientId||"","f"),n(this,ye,e?.authorizeUrl||t(this,fe,"f")+"oauth2/authorize","f"),n(this,ge,e?.tokenUrl||t(this,fe,"f")+"oauth2/token","f"),n(this,xe,e?.logoutUrl||t(this,fe,"f")+"oauth2/logout","f"),n(this,ve,e?.onUnauthenticated,"f");const i=this.getActiveLogin();i&&(n(this,Te,i.accessToken,"f"),n(this,Ee,i.refreshToken,"f"),t(this,de,"m",Re).call(this).catch(console.log)),t(this,de,"m",We).call(this)}getBaseUrl(){return t(this,fe,"f")}clear(){t(this,me,"f").clear(),t(this,pe,"f").clear(),n(this,Te,void 0,"f"),n(this,Ee,void 0,"f"),n(this,De,void 0,"f"),n(this,Ce,void 0,"f"),this.dispatchEvent({type:"change"})}invalidateUrl(e){e=e.toString(),t(this,pe,"f").delete(e)}invalidateSearches(e){const n="fhir/R4/"+e;for(const e of t(this,pe,"f").keys())(e.endsWith(n)||e.includes(n+"?"))&&t(this,pe,"f").delete(e)}get(e,n={}){e=e.toString();const i=t(this,de,"m",Oe).call(this,e,n);if(i)return i.value;const r=new K(t(this,de,"m",Me).call(this,"GET",e,n));return t(this,de,"m",ke).call(this,e,r),r}post(e,n,i,r={}){return e=e.toString(),n&&t(this,de,"m",Le).call(this,r,n),i&&t(this,de,"m",Ue).call(this,r,i),this.invalidateUrl(e),t(this,de,"m",Me).call(this,"POST",e,r)}put(e,n,i,r={}){return e=e.toString(),n&&t(this,de,"m",Le).call(this,r,n),i&&t(this,de,"m",Ue).call(this,r,i),this.invalidateUrl(e),t(this,de,"m",Me).call(this,"PUT",e,r)}patch(e,n,i={}){return e=e.toString(),t(this,de,"m",Le).call(this,i,n),t(this,de,"m",Ue).call(this,i,"application/json-patch+json"),this.invalidateUrl(e),t(this,de,"m",Me).call(this,"PATCH",e,i)}delete(e,n={}){return e=e.toString(),this.invalidateUrl(e),t(this,de,"m",Me).call(this,"DELETE",e,n)}async startNewUser(e){return await this.startPkce(),this.post("auth/newuser",{...e,codeChallengeMethod:"S256",codeChallenge:sessionStorage.getItem("codeChallenge")})}async startNewProject(e){return this.post("auth/newproject",e)}async startNewPatient(e){return this.post("auth/newpatient",e)}async startLogin(e){const{codeChallenge:n,codeChallengeMethod:i}=this.getCodeChallenge(e);return this.post("auth/login",{...e,clientId:e.clientId??t(this,Se,"f"),scope:e.scope,codeChallengeMethod:i,codeChallenge:n})}async startGoogleLogin(e){const{codeChallenge:n,codeChallengeMethod:i}=this.getCodeChallenge(e);return this.post("auth/google",{...e,clientId:e.clientId??t(this,Se,"f"),scope:e.scope,codeChallengeMethod:i,codeChallenge:n})}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()}async signInWithRedirect(){const e=new URLSearchParams(window.location.search).get("code");return e?this.processCode(e):void await t(this,de,"m",_e).call(this)}signOutWithRedirect(){window.location.assign(t(this,xe,"f"))}fhirUrl(...e){return new URL(t(this,fe,"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,n,i={}){const r=this.fhirSearchUrl(e,n);r.searchParams.set("_count","1"),r.searchParams.sort();const o=r.toString()+"-searchOne",a=t(this,de,"m",Oe).call(this,o,i);if(a)return a.value;const s=new K(this.search(e,r.searchParams,i).then((e=>e.entry?.[0]?.resource)));return t(this,de,"m",ke).call(this,o,s),s}searchResources(e,n,i={}){const r=this.fhirSearchUrl(e,n).toString()+"-searchResources",o=t(this,de,"m",Oe).call(this,r,i);if(o)return o.value;const a=new K(this.search(e,n,i).then((e=>e.entry?.map((e=>e.resource))??[])));return t(this,de,"m",ke).call(this,r,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,n){const i=t(this,pe,"f").get(this.fhirUrl(e,n).toString())?.value;return i&&i.isOk()?i.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=e?.reference;if(!n)return new K(Promise.reject(new Error("Missing reference")));const[i,r]=n.split("/");return i&&r?this.readResource(i,r,t):new K(Promise.reject(new Error("Invalid reference")))}getSchema(){return ce}async requestSchema(e){if(e in ce.types)return ce;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=await this.graphql(t);for(const e of n.data.StructureDefinitionList)re(e);for(const e of n.data.SearchParameterList)oe(e);return ce}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)}async createResourceIfNoneExist(e,t){return await this.searchOne(e.resourceType,t)??this.createResource(e)}createBinary(e,t,n,i){const r=this.fhirUrl("Binary");return t&&r.searchParams.set("_filename",t),i?this.uploadwithProgress(r,e,n,i):this.post(r,e,n)}uploadwithProgress(e,n,i,r){return new Promise(((o,a)=>{const s=new XMLHttpRequest;s.responseType="json",s.onabort=()=>a(new Error("Request aborted")),s.onerror=()=>a(new Error("Request error")),r&&(s.upload.onprogress=e=>r(e),s.upload.onload=e=>r(e)),s.onload=()=>{s.status>=200&&s.status<300?o(s.response):a(new Error(s.statusText))},s.open("POST",e),s.withCredentials=!0,s.setRequestHeader("Authorization","Bearer "+t(this,Te,"f")),s.setRequestHeader("Cache-Control","no-cache, no-store, max-age=0"),s.setRequestHeader("Content-Type",i),s.setRequestHeader("X-Medplum","extended"),s.send(n)}))}async createPdf(e,n,i,r){if(!t(this,ue,"f"))throw new Error("PDF creation not enabled");const o=await t(this,ue,"f").call(this,e,i,r);return this.createBinary(o,n,"application/pdf")}createComment(e,t){const n=this.getProfile();let i,r;return"Encounter"===e.resourceType&&(i=v(e),r=e.subject),"ServiceRequest"===e.resourceType&&(i=e.encounter,r=e.subject),"Patient"===e.resourceType&&(r=v(e)),this.createResource({resourceType:"Communication",basedOn:[v(e)],encounter:i,subject:r,sender:n?v(n):void 0,sent:(new Date).toISOString(),payload:[{contentString:t}]})}async updateResource(e){if(!e.resourceType)throw new Error("Missing resourceType");if(!e.id)throw new Error("Missing id");this.invalidateSearches(e.resourceType);return await this.put(this.fhirUrl(e.resourceType,e.id),e)??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 t(this,me,"f").getObject("activeLogin")}async setActiveLogin(e){n(this,Te,e.accessToken,"f"),n(this,Ee,e.refreshToken,"f"),n(this,De,void 0,"f"),n(this,Ce,void 0,"f"),t(this,me,"f").setObject("activeLogin",e),t(this,de,"m",Ae).call(this,e),t(this,pe,"f").clear(),n(this,Pe,void 0,"f"),await t(this,de,"m",Re).call(this)}getAccessToken(){return t(this,Te,"f")}setAccessToken(e){n(this,Te,e,"f"),n(this,Ee,void 0,"f"),n(this,De,void 0,"f"),n(this,Ce,void 0,"f")}getLogins(){return t(this,me,"f").getObject("logins")??[]}isLoading(){return!!t(this,be,"f")}getProfile(){return t(this,De,"f")}async getProfileAsync(){return t(this,be,"f")&&await t(this,be,"f"),this.getProfile()}getUserConfiguration(){return t(this,Ce,"f")}async download(e,n={}){t(this,Pe,"f")&&await t(this,Pe,"f"),t(this,de,"m",Ie).call(this,n);return(await t(this,le,"f").call(this,e.toString(),n)).blob()}async startPkce(){const e=W();sessionStorage.setItem("pkceState",e);const t=W();sessionStorage.setItem("codeVerifier",t);const n=U(await async function(e){return crypto.subtle.digest("SHA-256",(new TextEncoder).encode(e))}(t)).replace(/\+/g,"-").replace(/\//g,"_").replace(/=/g,"");sessionStorage.setItem("codeChallenge",n)}processCode(e){const n=new URLSearchParams;n.set("grant_type","authorization_code"),n.set("client_id",t(this,Se,"f")),n.set("code",e),n.set("redirect_uri",qe());const i=sessionStorage.getItem("codeVerifier");return i&&n.set("code_verifier",i),t(this,de,"m",Qe).call(this,n)}async startClientLogin(e,i){n(this,Se,e,"f"),n(this,we,i,"f");const r=new URLSearchParams;return r.set("grant_type","client_credentials"),r.set("client_id",e),r.set("client_secret",i),t(this,de,"m",Qe).call(this,r)}},e.NotEqualsAtom=pn,e.NotEquivalentAtom=fn,e.OperationOutcomeError=hi,e.OrAtom=xn,e.ReadablePromise=K,e.SymbolAtom=tn,e.UnaryOperatorAtom=rn,e.UnionAtom=un,e.XorAtom=vn,e.allOk=oi,e.arrayBufferToBase64=U,e.arrayBufferToHex=I,e.assertOk=function(e,t){if(!pi(e)||void 0===t)throw new hi(e)},e.badRequest=function(e,t){return{resourceType:"OperationOutcome",issue:[{severity:"error",code:"invalid",details:{text:e},expression:t?[t]:void 0}]}},e.booleanToTypedValue=At,e.buildTypeName=ae,e.calculateAge=P,e.calculateAgeString=function(e,t){const{years:n,months:i,days:r}=P(e,t);return n>=2?n.toString().padStart(3,"0")+"Y":i>=1?i.toString().padStart(3,"0")+"M":r.toString().padStart(3,"0")+"D"},e.capitalize=L,e.createReference=v,e.createSchema=function(){return{types:{}}},e.created=ai,e.deepClone=function(e){return JSON.parse(JSON.stringify(e))},e.deepEquals=R,e.evalFhirPath=Mn,e.evalFhirPathTyped=In,e.fhirPathArrayEquals=Lt,e.fhirPathArrayEquivalent=_t,e.fhirPathEquals=Nt,e.fhirPathEquivalent=jt,e.fhirPathIs=Bt,e.fhirPathNot=Ut,e.findObservationInterval=function(e,t,n,i){return e.qualifiedInterval?.find((r=>N(r,t)&&function(e,t,n){return!!e.range&&_(t,e.range,n)}(r,n,e.quantitativeDetails?.decimalPrecision)&&(void 0===i||r.category===i)))},e.findObservationReferenceRange=function(e,t,n){return e.qualifiedInterval?.find((e=>N(e,t)&&n.includes(e.condition)))},e.forbidden=li,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&&(t?.all||t?.use)&&n.push("["+e.use+"]"),n.join(t?.lineSeparator||", ").trim()},e.formatCodeableConcept=y,e.formatCoding=g,e.formatDate=function(e,t,n){if(!e)return"";const i=new Date(e);return d(i)?(i.setUTCHours(0,0,0,0),i.toLocaleDateString(t,{timeZone:"UTC",...n})):""},e.formatDateTime=u,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=c,e.formatMoney=function(e){return void 0===e?.value?"":e.value.toLocaleString(void 0,{style:"currency",currency:e.currency||"USD",currencyDisplay:"narrowSymbol"})},e.formatObservationValue=function e(t){return t?"component"in t?t.component.map((t=>e(t))).join(" / "):t?.valueQuantity?f(t.valueQuantity):t.valueCodeableConcept?y(t.valueCodeableConcept):t.valueString?t.valueString:"":""},e.formatPeriod=function(e,t,n){return e&&(e.start||e.end)?u(e.start,t,n)+" - "+u(e.end,t,n):""},e.formatQuantity=f,e.formatRange=function(e,t,n=!1){if(n&&void 0===t)throw new Error("Precision must be specified for exclusive ranges");const i=e?.low&&{...e.low},r=e?.high&&{...e.high};return!e||void 0===i?.value&&void 0===r?.value?"":void 0!==e.low?.value&&void 0===e.high?.value?n&&void 0!==t?(e.low.value=function(e,t,n=1){return(x(e,t)-n)*Math.pow(10,-t)}(e.low.value,t),`> ${f(e.low,t)}`):`>= ${f(e.low,t)}`:void 0===e.low?.value&&void 0!==e.high?.value?n&&void 0!==t?(e.high.value=function(e,t,n=1){return(x(e,t)+n)*Math.pow(10,-t)}(e.high.value,t),`< ${f(e.high,t)}`):`<= ${f(e.high,t)}`:(i?.unit===r?.unit&&delete i?.unit,`${f(i,t)} - ${f(r,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=Qn.includes(e.operator)?":"+e.operator:"",n=Bn.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=l,e.formatTiming=function(e){if(!e)return"";const t=[];if(e.repeat?.periodUnit){const n=e.repeat.frequency||1,i=e.repeat.period||1,r=e.repeat.periodUnit;1===n&&1===i?t.push(m[r]):(1===n?t.push("once"):t.push(n+" times"),1===i?t.push("per "+p[r]):t.push("per "+i+" "+h[r])),e.repeat.dayOfWeek&&t.push("on "+e.repeat.dayOfWeek.map(L).join(", ")),e.repeat.timeOfDay&&t.push("at "+e.repeat.timeOfDay.map((e=>l(e))).join(", "))}return e.event&&t.push(e.event.map((e=>u(e))).join(", ")),L(t.join(" ").trim())},e.getCodeBySystem=function(e,t){return e?.coding?.find((e=>e.system===t))?.code},e.getDateProperty=function(e){return e?new Date(e):void 0},e.getDisplayString=T,e.getElementDefinition=se,e.getExpressionForResourceType=Fn,e.getExtensionValue=function(e,...t){let n=e;for(let e=0;e<t.length&&n;e++)n=n?.extension?.find((n=>n.url===t[e]));return n?.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 E(t);for(const e of t){const t=E(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(L).join(" ").replace("_"," ").replace(/\s+/g," ")},e.getQuestionnaireAnswers=function(e){const t={};return b(e.item,t),t},e.getReferenceString=S,e.getSearchParameterDetails=qn,e.getStatus=function(e){return e.id===Jn?200:e.id===Zn?201:e.id===ei?304:e.id===ni?401:e.id===ii?403:e.id===ti?404:e.id===Kn?410:e.id===ri?429:400},e.getTypedPropertyValue=kt,e.globalSchema=ce,e.gone=ui,e.indexSearchParameter=oe,e.indexSearchParameterBundle=function(e){for(const t of e.entry){const e=t.resource;"SearchParameter"===e.resourceType&&oe(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=Rn,e.isEmpty=A,e.isGone=function(e){return e.id===Kn},e.isLowerCase=function(e){return e===e.toLowerCase()&&e!==e.toUpperCase()},e.isNotFound=function(e){return e.id===ti},e.isObject=O,e.isOk=pi,e.isPeriod=Wt,e.isProfileResource=w,e.isQuantity=qt,e.isQuantityEquivalent=$t,e.isStringArray=k,e.isUUID=function(e){return!!e.match(/^\w{8}-\w{4}-\w{4}-\w{4}-\w{12}$/i)},e.isValidDate=d,e.matchesRange=_,e.matchesSearchRequest=function(e,t){if(t.resourceType!==e.resourceType)return!1;if(t.filters)for(const n of t.filters)if(!zn(e,t,n))return!1;return!0},e.normalizeErrorString=function(e){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 e.issue?.[0]?.details?.text??"Unknown error"}return JSON.stringify(e)},e.notFound=ci,e.notModified=si,e.parseFhirPath=kn,e.parseJWTPayload=Z,e.parseSearchDefinition=function(t){const n=new URL(t,"https://example.com/"),i=n.pathname.replace(/(^\/)|(\/$)/g,"").split("/").pop();let r,o,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?(o=o||[],o.push(function(e){return e.startsWith("-")?{code:e.substring(1),descending:!0}:{code:e}}(t))):(r=r||[],r.push(function(t,n){let i=t,r=e.Operator.EQUALS;for(const e of Qn){const t=i.indexOf(":"+e);-1!==t&&(r=e,i=i.substring(0,t))}for(const e of Bn)n.match(new RegExp("^"+e+"\\d"))&&(r=e,n=n.substring(e.length));return{code:i,operator:r,value:n}}(n,t)))})),{resourceType:i,filters:r,fields:a,offset:s,count:c,total:d,sortRules:o}},e.preciseEquals=function(e,t,n){return B(e,n)===B(t,n)},e.preciseGreaterThan=function(e,t,n){return B(e,n)>B(t,n)},e.preciseGreaterThanOrEquals=Q,e.preciseLessThan=function(e,t,n){return B(e,n)<B(t,n)},e.preciseLessThanOrEquals=j,e.preciseRound=function(e,t){return parseFloat(e.toFixed(t))},e.removeDuplicates=It,e.resolveId=function(e){return e?.reference?.split("/")[1]},e.setCodeBySystem=function(e,t,n){e.coding||(e.coding=[]);const i=e.coding?.find((e=>e.system===t));i?i.code=n:e.coding?.push({system:t,code:n})},e.stringify=D,e.toJsBoolean=Ot,e.toTypedValue=Rt,e.tokenize=Pn,e.tooManyRequests=mi,e.unauthorized=di}));
|
package/dist/cjs/search.d.ts
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
|
+
import { ResourceType } from '@medplum/fhirtypes';
|
|
1
2
|
export declare const DEFAULT_SEARCH_COUNT = 20;
|
|
2
3
|
export interface SearchRequest {
|
|
3
|
-
readonly resourceType:
|
|
4
|
+
readonly resourceType: ResourceType;
|
|
4
5
|
filters?: Filter[];
|
|
5
6
|
sortRules?: SortRule[];
|
|
6
7
|
offset?: number;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"base-schema.json.
|
|
1
|
+
{"version":3,"file":"base-schema.json.mjs","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { __classPrivateFieldSet, __classPrivateFieldGet } from './node_modules/tslib/tslib.es6.
|
|
1
|
+
import { __classPrivateFieldSet, __classPrivateFieldGet } from './node_modules/tslib/tslib.es6.mjs';
|
|
2
2
|
|
|
3
3
|
var _LRUCache_instances, _LRUCache_max, _LRUCache_cache, _LRUCache_first;
|
|
4
4
|
/**
|
|
@@ -67,4 +67,4 @@ _LRUCache_max = new WeakMap(), _LRUCache_cache = new WeakMap(), _LRUCache_instan
|
|
|
67
67
|
};
|
|
68
68
|
|
|
69
69
|
export { LRUCache };
|
|
70
|
-
//# sourceMappingURL=cache.
|
|
70
|
+
//# sourceMappingURL=cache.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"cache.mjs","sources":["../../src/cache.ts"],"sourcesContent":["/**\n * LRU cache (least recently used)\n * Source: https://stackoverflow.com/a/46432113\n */\nexport class LRUCache<T> {\n readonly #max: number;\n readonly #cache: Map<string, T>;\n\n constructor(max = 10) {\n this.#max = max;\n this.#cache = new Map();\n }\n\n /**\n * Deletes all values from the cache.\n */\n clear(): void {\n this.#cache.clear();\n }\n\n /**\n * Returns the value for the given key.\n * @param key The key to retrieve.\n * @returns The value if found; undefined otherwise.\n */\n get(key: string): T | undefined {\n const item = this.#cache.get(key);\n if (item) {\n this.#cache.delete(key);\n this.#cache.set(key, item);\n }\n return item;\n }\n\n /**\n * Sets the value for the given key.\n * @param key The key to set.\n * @param val The value to set.\n */\n set(key: string, val: T): void {\n if (this.#cache.has(key)) {\n this.#cache.delete(key);\n } else if (this.#cache.size >= this.#max) {\n this.#cache.delete(this.#first());\n }\n this.#cache.set(key, val);\n }\n\n /**\n * Deletes the value for the given key.\n * @param key The key to delete.\n */\n delete(key: string): void {\n this.#cache.delete(key);\n }\n\n /**\n * Returns the list of all keys in the cache.\n * @returns The array of keys in the cache.\n */\n keys(): IterableIterator<string> {\n return this.#cache.keys();\n }\n\n #first(): string {\n // This works because the Map class maintains ordered keys.\n return this.#cache.keys().next().value;\n }\n}\n"],"names":[],"mappings":";;;AAAA;;;AAGG;MACU,QAAQ,CAAA;IAInB,WAAY,CAAA,GAAG,GAAG,EAAE,EAAA;;QAHpB,aAAsB,CAAA,GAAA,CAAA,IAAA,EAAA,KAAA,CAAA,CAAA,CAAA;QACtB,eAAgC,CAAA,GAAA,CAAA,IAAA,EAAA,KAAA,CAAA,CAAA,CAAA;AAG9B,QAAA,sBAAA,CAAA,IAAI,EAAA,aAAA,EAAQ,GAAG,EAAA,GAAA,CAAA,CAAC;AAChB,QAAA,sBAAA,CAAA,IAAI,EAAU,eAAA,EAAA,IAAI,GAAG,EAAE,MAAA,CAAC;KACzB;AAED;;AAEG;IACH,KAAK,GAAA;AACH,QAAA,sBAAA,CAAA,IAAI,EAAA,eAAA,EAAA,GAAA,CAAO,CAAC,KAAK,EAAE,CAAC;KACrB;AAED;;;;AAIG;AACH,IAAA,GAAG,CAAC,GAAW,EAAA;QACb,MAAM,IAAI,GAAG,sBAAA,CAAA,IAAI,EAAA,eAAA,EAAA,GAAA,CAAO,CAAC,GAAG,CAAC,GAAG,CAAC,CAAC;AAClC,QAAA,IAAI,IAAI,EAAE;AACR,YAAA,sBAAA,CAAA,IAAI,EAAO,eAAA,EAAA,GAAA,CAAA,CAAC,MAAM,CAAC,GAAG,CAAC,CAAC;YACxB,sBAAA,CAAA,IAAI,uBAAO,CAAC,GAAG,CAAC,GAAG,EAAE,IAAI,CAAC,CAAC;AAC5B,SAAA;AACD,QAAA,OAAO,IAAI,CAAC;KACb;AAED;;;;AAIG;IACH,GAAG,CAAC,GAAW,EAAE,GAAM,EAAA;QACrB,IAAI,sBAAA,CAAA,IAAI,EAAO,eAAA,EAAA,GAAA,CAAA,CAAC,GAAG,CAAC,GAAG,CAAC,EAAE;AACxB,YAAA,sBAAA,CAAA,IAAI,EAAO,eAAA,EAAA,GAAA,CAAA,CAAC,MAAM,CAAC,GAAG,CAAC,CAAC;AACzB,SAAA;aAAM,IAAI,sBAAA,CAAA,IAAI,EAAO,eAAA,EAAA,GAAA,CAAA,CAAC,IAAI,IAAI,sBAAA,CAAA,IAAI,EAAA,aAAA,EAAA,GAAA,CAAK,EAAE;AACxC,YAAA,sBAAA,CAAA,IAAI,EAAA,eAAA,EAAA,GAAA,CAAO,CAAC,MAAM,CAAC,sBAAA,CAAA,IAAI,EAAA,mBAAA,EAAA,GAAA,EAAA,eAAA,CAAO,CAAX,IAAA,CAAA,IAAI,CAAS,CAAC,CAAC;AACnC,SAAA;QACD,sBAAA,CAAA,IAAI,uBAAO,CAAC,GAAG,CAAC,GAAG,EAAE,GAAG,CAAC,CAAC;KAC3B;AAED;;;AAGG;AACH,IAAA,MAAM,CAAC,GAAW,EAAA;AAChB,QAAA,sBAAA,CAAA,IAAI,EAAO,eAAA,EAAA,GAAA,CAAA,CAAC,MAAM,CAAC,GAAG,CAAC,CAAC;KACzB;AAED;;;AAGG;IACH,IAAI,GAAA;AACF,QAAA,OAAO,uBAAA,IAAI,EAAA,eAAA,EAAA,GAAA,CAAO,CAAC,IAAI,EAAE,CAAC;KAC3B;AAMF,CAAA;;;IAFG,OAAO,sBAAA,CAAA,IAAI,EAAA,eAAA,EAAA,GAAA,CAAO,CAAC,IAAI,EAAE,CAAC,IAAI,EAAE,CAAC,KAAK,CAAC;AACzC,CAAC;;;;"}
|