@medplum/core 2.0.0 → 2.0.1

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