@photonhealth/elements 0.16.1 → 0.16.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.js CHANGED
@@ -1430,7 +1430,7 @@ Description:
1430
1430
  }
1431
1431
  }
1432
1432
  }
1433
- `,iQ={CatalogTreatmentsFieldsComponentFragment:nQ};class aQ{sdk;setStore;store;authentication;getSDK;clinical;autoLogin;constructor(t,r=!1){this.sdk=t,this.autoLogin=r;const[n,i]=sa({authentication:{isAuthenticated:!1,isInOrg:!1,permissions:[],isLoading:!0,error:void 0,user:void 0},catalog:{isLoading:!1,treatments:[],templates:[]},catalogs:{isLoading:!1,catalogs:[]},dispenseUnits:{isLoading:!1,dispenseUnits:new Array},patients:{isLoading:!1,patients:[],finished:!1},patient:{isLoading:!1,patient:void 0},prescription:{isLoading:!1,errors:[],error:void 0,data:void 0}});this.setStore=i,this.store=n,this.authentication={state:n.authentication,handleRedirect:async a=>{try{const o=await this.sdk.authentication.handleRedirect(a);rQ(o?.appState),await this.authentication.checkSession()}catch(o){const s=new URLSearchParams(window.location.search).get("error_description");o.message.includes("must be an organization id")?this.setStore("authentication",{...this.store.authentication,error:"The provided organization id is invalid or does not exist"}):s?.includes("is not part of the org")?this.setStore("authentication",{...this.store.authentication,error:"User is not authorized",isLoading:!1}):this.setStore("authentication",{...this.store.authentication,error:o.message})}},checkSession:this.checkSession.bind(this),login:this.login.bind(this),logout:this.logout.bind(this)},this.getSDK=this._getSDK.bind(this),this.clinical={catalog:{state:n.catalog,getCatalog:this.getCatalog.bind(this)},catalogs:{state:n.catalogs,getCatalogs:this.getCatalogs.bind(this)},dispenseUnits:{state:n.dispenseUnits,getDispenseUnits:this.getDispenseUnits.bind(this)},patients:{state:n.patients,getPatients:this.getPatients.bind(this)},patient:{state:n.patient,getPatient:this.getPatient.bind(this)},prescription:{state:n.prescription,createPrescription:this.createPrescription.bind(this)}}}_getSDK(){return this.sdk}async checkSession(){try{await this.sdk.authentication.checkSession();const t=await this.sdk.authentication.isAuthenticated();this.setStore("authentication",{...this.store.authentication,isAuthenticated:t});const r=await this.sdk.authentication.getUser(),n=!!this.sdk?.organization&&!!r?.org_id;let i=[];if(this.autoLogin||t)try{const o=await this.sdk.authentication.getAccessToken();i=tQ(o)?.permissions||[]}catch{i=[]}const a=t&&n&&this.sdk.organization===r.org_id;this.setStore("authentication",{...this.store.authentication,user:r,isLoading:!1,isInOrg:a,permissions:i||[]})}catch{this.setStore("authentication",{...this.store.authentication,isLoading:!1})}}async login(t={}){await this.sdk.authentication.login(t),await this.checkSession()}async logout(t={}){await this.sdk.authentication.logout(t),this.setStore("authentication",{...this.store.authentication,isAuthenticated:!1,isInOrg:!1,permissions:[],user:void 0})}async getPatients(t){t||(t={}),this.setStore("patients",{...this.store.patients,isLoading:!0});const{data:r}=await this.sdk.clinical.patient.getPatients(t);this.setStore("patients",{...this.store.patients,isLoading:!1,patients:t.clear?r.patients:this.store.patients.patients.concat(r.patients),finished:r.patients.length==0})}async getPatient(t){this.setStore("patient",{...this.store.patient,isLoading:!0});const{data:r}=await this.sdk.clinical.patient.getPatient(t);return this.setStore("patient",{...this.store.patient,isLoading:!1,patient:r.patient}),r.patient}async getCatalog(t){this.setStore("catalog",{...this.store.catalog,isLoading:!0});const{data:r}=await this.sdk.clinical.catalog.getCatalog({id:t.id,fragment:iQ});this.setStore("catalog",{...this.store.catalog,isLoading:!1,treatments:r.catalog.treatments.map(n=>n)||[],templates:r.catalog.templates.map(n=>n)||[]})}async getCatalogs(){this.setStore("catalogs",{...this.store.catalogs,isLoading:!0});const{data:t}=await this.sdk.clinical.catalog.getCatalogs();this.setStore("catalogs",{...this.store.catalogs,isLoading:!1,catalogs:t.catalogs})}async getDispenseUnits(){this.setStore("dispenseUnits",{...this.store.dispenseUnits,isLoading:!0});const{data:t}=await this.sdk.clinical.prescription.getDispenseUnits();this.setStore("dispenseUnits",{...this.store.dispenseUnits,isLoading:!1,dispenseUnits:t.dispenseUnits.map((r,n)=>({id:String(n),...r}))})}async createPrescription(t){this.setStore("prescription",{...this.store.prescription,isLoading:!0});const r=this.sdk.clinical.prescription.createPrescription({});try{const{data:n,errors:i}=await r({variables:t,refetchQueries:[],awaitRefetchQueries:!1});return i&&i.length>0&&this.setStore("prescription",{...this.store.prescription,errors:[...i]}),n?.createPrescription&&this.setStore("prescription",{...this.store.prescription,data:n.createPrescription}),this.setStore("prescription",{...this.store.prescription,isLoading:!1}),{data:n,errors:i}}catch(n){return this.setStore("prescription",{...this.store.prescription,error:n,isLoading:!1}),{data:null,errors:[]}}}}const oQ=(e,t,r)=>{const n=r(e,t);return Er(()=>clearInterval(n))},z6="%[a-f0-9]{2}",gg=new RegExp("("+z6+")|([^%]+?)","gi"),vg=new RegExp("("+z6+")+","gi");function Sh(e,t){try{return[decodeURIComponent(e.join(""))]}catch{}if(e.length===1)return e;t=t||1;const r=e.slice(0,t),n=e.slice(t);return Array.prototype.concat.call([],Sh(r),Sh(n))}function sQ(e){try{return decodeURIComponent(e)}catch{let t=e.match(gg)||[];for(let r=1;r<t.length;r++)e=Sh(t,r).join(""),t=e.match(gg)||[];return e}}function lQ(e){const t={"%FE%FF":"��","%FF%FE":"��"};let r=vg.exec(e);for(;r;){try{t[r[0]]=decodeURIComponent(r[0])}catch{const i=sQ(r[0]);i!==r[0]&&(t[r[0]]=i)}r=vg.exec(e)}t["%C2"]="�";const n=Object.keys(t);for(const i of n)e=e.replace(new RegExp(i,"g"),t[i]);return e}function dQ(e){if(typeof e!="string")throw new TypeError("Expected `encodedURI` to be of type `string`, got `"+typeof e+"`");try{return decodeURIComponent(e)}catch{return lQ(e)}}function cQ(e,t){const r={};if(Array.isArray(t))for(const n of t){const i=Object.getOwnPropertyDescriptor(e,n);i?.enumerable&&Object.defineProperty(r,n,i)}else for(const n of Reflect.ownKeys(e)){const i=Object.getOwnPropertyDescriptor(e,n);if(i.enumerable){const a=e[n];t(n,a,e)&&Object.defineProperty(r,n,i)}}return r}function j6(e,t){if(!(typeof e=="string"&&typeof t=="string"))throw new TypeError("Expected the arguments to be of type `string`");if(e===""||t==="")return[];const r=e.indexOf(t);return r===-1?[]:[e.slice(0,r),e.slice(r+t.length)]}const uQ=e=>e==null,hQ=e=>encodeURIComponent(e).replaceAll(/[!'()*]/g,t=>`%${t.charCodeAt(0).toString(16).toUpperCase()}`),Eh=Symbol("encodeFragmentIdentifier");function fQ(e){switch(e.arrayFormat){case"index":return t=>(r,n)=>{const i=r.length;return n===void 0||e.skipNull&&n===null||e.skipEmptyString&&n===""?r:n===null?[...r,[Xt(t,e),"[",i,"]"].join("")]:[...r,[Xt(t,e),"[",Xt(i,e),"]=",Xt(n,e)].join("")]};case"bracket":return t=>(r,n)=>n===void 0||e.skipNull&&n===null||e.skipEmptyString&&n===""?r:n===null?[...r,[Xt(t,e),"[]"].join("")]:[...r,[Xt(t,e),"[]=",Xt(n,e)].join("")];case"colon-list-separator":return t=>(r,n)=>n===void 0||e.skipNull&&n===null||e.skipEmptyString&&n===""?r:n===null?[...r,[Xt(t,e),":list="].join("")]:[...r,[Xt(t,e),":list=",Xt(n,e)].join("")];case"comma":case"separator":case"bracket-separator":{const t=e.arrayFormat==="bracket-separator"?"[]=":"=";return r=>(n,i)=>i===void 0||e.skipNull&&i===null||e.skipEmptyString&&i===""?n:(i=i===null?"":i,n.length===0?[[Xt(r,e),t,Xt(i,e)].join("")]:[[n,Xt(i,e)].join(e.arrayFormatSeparator)])}default:return t=>(r,n)=>n===void 0||e.skipNull&&n===null||e.skipEmptyString&&n===""?r:n===null?[...r,Xt(t,e)]:[...r,[Xt(t,e),"=",Xt(n,e)].join("")]}}function pQ(e){let t;switch(e.arrayFormat){case"index":return(r,n,i)=>{if(t=/\[(\d*)]$/.exec(r),r=r.replace(/\[\d*]$/,""),!t){i[r]=n;return}i[r]===void 0&&(i[r]={}),i[r][t[1]]=n};case"bracket":return(r,n,i)=>{if(t=/(\[])$/.exec(r),r=r.replace(/\[]$/,""),!t){i[r]=n;return}if(i[r]===void 0){i[r]=[n];return}i[r]=[...i[r],n]};case"colon-list-separator":return(r,n,i)=>{if(t=/(:list)$/.exec(r),r=r.replace(/:list$/,""),!t){i[r]=n;return}if(i[r]===void 0){i[r]=[n];return}i[r]=[...i[r],n]};case"comma":case"separator":return(r,n,i)=>{const a=typeof n=="string"&&n.includes(e.arrayFormatSeparator),o=typeof n=="string"&&!a&&pi(n,e).includes(e.arrayFormatSeparator);n=o?pi(n,e):n;const s=a||o?n.split(e.arrayFormatSeparator).map(l=>pi(l,e)):n===null?n:pi(n,e);i[r]=s};case"bracket-separator":return(r,n,i)=>{const a=/(\[])$/.test(r);if(r=r.replace(/\[]$/,""),!a){i[r]=n&&pi(n,e);return}const o=n===null?[]:pi(n,e).split(e.arrayFormatSeparator);if(i[r]===void 0){i[r]=o;return}i[r]=[...i[r],...o]};default:return(r,n,i)=>{if(i[r]===void 0){i[r]=n;return}i[r]=[...[i[r]].flat(),n]}}}function V6(e){if(typeof e!="string"||e.length!==1)throw new TypeError("arrayFormatSeparator must be single character string")}function Xt(e,t){return t.encode?t.strict?hQ(e):encodeURIComponent(e):e}function pi(e,t){return t.decode?dQ(e):e}function U6(e){return Array.isArray(e)?e.sort():typeof e=="object"?U6(Object.keys(e)).sort((t,r)=>Number(t)-Number(r)).map(t=>e[t]):e}function q6(e){const t=e.indexOf("#");return t!==-1&&(e=e.slice(0,t)),e}function mQ(e){let t="";const r=e.indexOf("#");return r!==-1&&(t=e.slice(r)),t}function yg(e,t,r){return r==="string"&&typeof e=="string"?e:typeof r=="function"&&typeof e=="string"?r(e):t.parseBooleans&&e!==null&&(e.toLowerCase()==="true"||e.toLowerCase()==="false")?e.toLowerCase()==="true":r==="number"&&!Number.isNaN(Number(e))&&typeof e=="string"&&e.trim()!==""||t.parseNumbers&&!Number.isNaN(Number(e))&&typeof e=="string"&&e.trim()!==""?Number(e):e}function Jf(e){e=q6(e);const t=e.indexOf("?");return t===-1?"":e.slice(t+1)}function ep(e,t){t={decode:!0,sort:!0,arrayFormat:"none",arrayFormatSeparator:",",parseNumbers:!1,parseBooleans:!1,types:Object.create(null),...t},V6(t.arrayFormatSeparator);const r=pQ(t),n=Object.create(null);if(typeof e!="string"||(e=e.trim().replace(/^[?#&]/,""),!e))return n;for(const i of e.split("&")){if(i==="")continue;const a=t.decode?i.replaceAll("+"," "):i;let[o,s]=j6(a,"=");o===void 0&&(o=a),s=s===void 0?null:["comma","separator","bracket-separator"].includes(t.arrayFormat)?s:pi(s,t),r(pi(o,t),s,n)}for(const[i,a]of Object.entries(n))if(typeof a=="object"&&a!==null&&t.types[i]!=="string")for(const[o,s]of Object.entries(a)){const l=t.types[i]?t.types[i].replace("[]",""):void 0;a[o]=yg(s,t,l)}else typeof a=="object"&&a!==null&&t.types[i]==="string"?n[i]=Object.values(a).join(t.arrayFormatSeparator):n[i]=yg(a,t,t.types[i]);return t.sort===!1?n:(t.sort===!0?Object.keys(n).sort():Object.keys(n).sort(t.sort)).reduce((i,a)=>{const o=n[a];return i[a]=o&&typeof o=="object"&&!Array.isArray(o)?U6(o):o,i},Object.create(null))}function B6(e,t){if(!e)return"";t={encode:!0,strict:!0,arrayFormat:"none",arrayFormatSeparator:",",...t},V6(t.arrayFormatSeparator);const r=o=>t.skipNull&&uQ(e[o])||t.skipEmptyString&&e[o]==="",n=fQ(t),i={};for(const[o,s]of Object.entries(e))r(o)||(i[o]=s);const a=Object.keys(i);return t.sort!==!1&&a.sort(t.sort),a.map(o=>{const s=e[o];return s===void 0?"":s===null?Xt(o,t):Array.isArray(s)?s.length===0&&t.arrayFormat==="bracket-separator"?Xt(o,t)+"[]":s.reduce(n(o),[]).join("&"):Xt(o,t)+"="+Xt(s,t)}).filter(o=>o.length>0).join("&")}function H6(e,t){t={decode:!0,...t};let[r,n]=j6(e,"#");return r===void 0&&(r=e),{url:r?.split("?")?.[0]??"",query:ep(Jf(e),t),...t&&t.parseFragmentIdentifier&&n?{fragmentIdentifier:pi(n,t)}:{}}}function W6(e,t){t={encode:!0,strict:!0,[Eh]:!0,...t};const r=q6(e.url).split("?")[0]||"",n=Jf(e.url),i={...ep(n,{sort:!1}),...e.query};let a=B6(i,t);a&&=`?${a}`;let o=mQ(e.url);if(typeof e.fragmentIdentifier=="string"){const s=new URL(r);s.hash=e.fragmentIdentifier,o=t[Eh]?s.hash:`#${e.fragmentIdentifier}`}return`${r}${a}${o}`}function Q6(e,t,r){r={parseFragmentIdentifier:!0,[Eh]:!1,...r};const{url:n,query:i,fragmentIdentifier:a}=H6(e,r);return W6({url:n,query:cQ(i,t),fragmentIdentifier:a},r)}function gQ(e,t,r){const n=Array.isArray(t)?i=>!t.includes(i):(i,a)=>!t(i,a);return Q6(e,n,r)}const G6=Object.freeze(Object.defineProperty({__proto__:null,exclude:gQ,extract:Jf,parse:ep,parseUrl:H6,pick:Q6,stringify:B6,stringifyUrl:W6},Symbol.toStringTag,{value:"Module"})),vQ=(e=window.location.search)=>{if(!e)return!1;const t=G6.parse(e);return"state"in t&&"photon"in t&&("code"in t||"error"in t)},yQ=e=>/^\d+$/.test(e)&&e.length>=5;function Th(e,t){return e.every(r=>t.includes(r))}const bQ="0.16.1",$Q={version:bQ};var wQ=Y("<slot>"),xQ=Y("<div>");const kQ=$Q?.version,_Q=e=>{let t;const r=e.redirectUri?e.redirectUri:window.location.origin,n=G6.stringifyUrl({url:r,query:{photon:!0}}),i=new zk({env:e.env,domain:e.domain,audience:e.audience,connection:e.connection,uri:e.uri,clientId:e.id,redirectURI:n,organization:e.org,developmentMode:e.developmentMode},kQ),a=new aQ(i,e.autoLogin);e.developmentMode&&console.info("[PhotonClient]: Development mode enabled");const[o]=H(a),s=async()=>{await o()?.authentication.handleRedirect(),e.redirectPath&&window.location.replace(e.redirectPath)},l=async()=>{await o()?.authentication.checkSession(),oQ(async()=>{await o()?.authentication.checkSession()},6e4,setInterval)};return fe(()=>{vQ()&&o()?s():o()&&l()}),fe(()=>{if(!o()?.authentication.state.isLoading){if(!o()?.authentication.state.isAuthenticated&&e.autoLogin){const d={appState:{}};e.redirectPath&&(d.appState.returnTo=e.redirectPath),o()?.authentication.login(d)}else if(e.externalUserId!=null&&o().authentication.state.user?.sub?.split("|").reverse()[0]!==e.externalUserId){o()?.authentication.logout();const d={appState:{}};e.redirectPath&&(d.appState.returnTo=e.redirectPath),o()?.authentication.login(d)}}}),(()=>{var d=xQ(),c=t;return typeof c=="function"?ze(c,d):t=d,I(d,b(R6.Provider,{get value(){return o()},get children(){return b(SR,{client:i,get children(){var u=wQ();return u._$owner=ce(),u}})}})),d})()};Et("photon-client",{domain:{attribute:"domain",value:void 0,reflect:!1,notify:!1,parse:!1},id:{attribute:"id",value:void 0,reflect:!1,notify:!1,parse:!1},redirectUri:{attribute:"redirect-uri",value:void 0,reflect:!1,notify:!1,parse:!1},redirectPath:{attribute:"redirect-path",value:void 0,reflect:!1,notify:!1,parse:!1},org:{attribute:"org",value:void 0,reflect:!1,notify:!1,parse:!1},audience:{attribute:"audience",value:void 0,reflect:!1,notify:!1,parse:!1},connection:{attribute:"connection",value:void 0,reflect:!1,notify:!1,parse:!1},uri:{attribute:"uri",value:void 0,reflect:!1,notify:!1,parse:!1},developmentMode:{attribute:"dev-mode",value:!1,reflect:!0,notify:!1,parse:!0},errorMessage:{attribute:"error-message",value:"Oh snap! There was an error loading. Please contact your site's administrator",reflect:!1,notify:!1,parse:!1},autoLogin:{attribute:"auto-login",value:!1,reflect:!1,notify:!1,parse:!0},env:{attribute:"env",value:void 0,reflect:!1,notify:!1,parse:!1},externalUserId:{attribute:"user-id",value:void 0,reflect:!0,notify:!0,parse:!1}},_Q);const Ft='*,:before,:after{box-sizing:border-box;border-width:0;border-style:solid;border-color:#e5e7eb}:before,:after{--tw-content: ""}html,:host{line-height:1.5;-webkit-text-size-adjust:100%;-moz-tab-size:4;-o-tab-size:4;tab-size:4;font-family:ui-sans-serif,system-ui,sans-serif,"Apple Color Emoji","Segoe UI Emoji",Segoe UI Symbol,"Noto Color Emoji";font-feature-settings:normal;font-variation-settings:normal;-webkit-tap-highlight-color:transparent}body{margin:0;line-height:inherit}hr{height:0;color:inherit;border-top-width:1px}abbr:where([title]){-webkit-text-decoration:underline dotted;text-decoration:underline dotted}h1,h2,h3,h4,h5,h6{font-size:inherit;font-weight:inherit}a{color:inherit;text-decoration:inherit}b,strong{font-weight:bolder}code,kbd,samp,pre{font-family:ui-monospace,SFMono-Regular,Menlo,Monaco,Consolas,Liberation Mono,Courier New,monospace;font-feature-settings:normal;font-variation-settings:normal;font-size:1em}small{font-size:80%}sub,sup{font-size:75%;line-height:0;position:relative;vertical-align:baseline}sub{bottom:-.25em}sup{top:-.5em}table{text-indent:0;border-color:inherit;border-collapse:collapse}button,input,optgroup,select,textarea{font-family:inherit;font-feature-settings:inherit;font-variation-settings:inherit;font-size:100%;font-weight:inherit;line-height:inherit;letter-spacing:inherit;color:inherit;margin:0;padding:0}button,select{text-transform:none}button,input:where([type=button]),input:where([type=reset]),input:where([type=submit]){-webkit-appearance:button;background-color:transparent;background-image:none}:-moz-focusring{outline:auto}:-moz-ui-invalid{box-shadow:none}progress{vertical-align:baseline}::-webkit-inner-spin-button,::-webkit-outer-spin-button{height:auto}[type=search]{-webkit-appearance:textfield;outline-offset:-2px}::-webkit-search-decoration{-webkit-appearance:none}::-webkit-file-upload-button{-webkit-appearance:button;font:inherit}summary{display:list-item}blockquote,dl,dd,h1,h2,h3,h4,h5,h6,hr,figure,p,pre{margin:0}fieldset{margin:0;padding:0}legend{padding:0}ol,ul,menu{list-style:none;margin:0;padding:0}dialog{padding:0}textarea{resize:vertical}input::-moz-placeholder,textarea::-moz-placeholder{opacity:1;color:#9ca3af}input::placeholder,textarea::placeholder{opacity:1;color:#9ca3af}button,[role=button]{cursor:pointer}:disabled{cursor:default}img,svg,video,canvas,audio,iframe,embed,object{display:block;vertical-align:middle}img,video{max-width:100%;height:auto}[hidden]{display:none}*,:before,:after{--tw-border-spacing-x: 0;--tw-border-spacing-y: 0;--tw-translate-x: 0;--tw-translate-y: 0;--tw-rotate: 0;--tw-skew-x: 0;--tw-skew-y: 0;--tw-scale-x: 1;--tw-scale-y: 1;--tw-pan-x: ;--tw-pan-y: ;--tw-pinch-zoom: ;--tw-scroll-snap-strictness: proximity;--tw-gradient-from-position: ;--tw-gradient-via-position: ;--tw-gradient-to-position: ;--tw-ordinal: ;--tw-slashed-zero: ;--tw-numeric-figure: ;--tw-numeric-spacing: ;--tw-numeric-fraction: ;--tw-ring-inset: ;--tw-ring-offset-width: 0px;--tw-ring-offset-color: #fff;--tw-ring-color: rgb(59 130 246 / .5);--tw-ring-offset-shadow: 0 0 #0000;--tw-ring-shadow: 0 0 #0000;--tw-shadow: 0 0 #0000;--tw-shadow-colored: 0 0 #0000;--tw-blur: ;--tw-brightness: ;--tw-contrast: ;--tw-grayscale: ;--tw-hue-rotate: ;--tw-invert: ;--tw-saturate: ;--tw-sepia: ;--tw-drop-shadow: ;--tw-backdrop-blur: ;--tw-backdrop-brightness: ;--tw-backdrop-contrast: ;--tw-backdrop-grayscale: ;--tw-backdrop-hue-rotate: ;--tw-backdrop-invert: ;--tw-backdrop-opacity: ;--tw-backdrop-saturate: ;--tw-backdrop-sepia: ;--tw-contain-size: ;--tw-contain-layout: ;--tw-contain-paint: ;--tw-contain-style: }::backdrop{--tw-border-spacing-x: 0;--tw-border-spacing-y: 0;--tw-translate-x: 0;--tw-translate-y: 0;--tw-rotate: 0;--tw-skew-x: 0;--tw-skew-y: 0;--tw-scale-x: 1;--tw-scale-y: 1;--tw-pan-x: ;--tw-pan-y: ;--tw-pinch-zoom: ;--tw-scroll-snap-strictness: proximity;--tw-gradient-from-position: ;--tw-gradient-via-position: ;--tw-gradient-to-position: ;--tw-ordinal: ;--tw-slashed-zero: ;--tw-numeric-figure: ;--tw-numeric-spacing: ;--tw-numeric-fraction: ;--tw-ring-inset: ;--tw-ring-offset-width: 0px;--tw-ring-offset-color: #fff;--tw-ring-color: rgb(59 130 246 / .5);--tw-ring-offset-shadow: 0 0 #0000;--tw-ring-shadow: 0 0 #0000;--tw-shadow: 0 0 #0000;--tw-shadow-colored: 0 0 #0000;--tw-blur: ;--tw-brightness: ;--tw-contrast: ;--tw-grayscale: ;--tw-hue-rotate: ;--tw-invert: ;--tw-saturate: ;--tw-sepia: ;--tw-drop-shadow: ;--tw-backdrop-blur: ;--tw-backdrop-brightness: ;--tw-backdrop-contrast: ;--tw-backdrop-grayscale: ;--tw-backdrop-hue-rotate: ;--tw-backdrop-invert: ;--tw-backdrop-opacity: ;--tw-backdrop-saturate: ;--tw-backdrop-sepia: ;--tw-contain-size: ;--tw-contain-layout: ;--tw-contain-paint: ;--tw-contain-style: }.container{width:100%}@media (min-width: 475px){.container{max-width:475px}}@media (min-width: 640px){.container{max-width:640px}}@media (min-width: 768px){.container{max-width:768px}}@media (min-width: 1024px){.container{max-width:1024px}}@media (min-width: 1280px){.container{max-width:1280px}}@media (min-width: 1536px){.container{max-width:1536px}}.visible{visibility:visible}.fixed{position:fixed}.absolute{position:absolute}.relative{position:relative}.sticky{position:sticky}.left-0{left:0}.left-4{left:1rem}.top-0{top:0}.z-2000{z-index:2000}.z-30{z-index:30}.z-40{z-index:40}.z-50{z-index:50}.order-last{order:9999}.m-3{margin:.75rem}.my-1{margin-top:.25rem;margin-bottom:.25rem}.mb-1{margin-bottom:.25rem}.mb-2{margin-bottom:.5rem}.mb-3{margin-bottom:.75rem}.mb-4{margin-bottom:1rem}.mb-8{margin-bottom:2rem}.ml-1{margin-left:.25rem}.mr-1{margin-right:.25rem}.mt-0{margin-top:0}.mt-2{margin-top:.5rem}.mt-5{margin-top:1.25rem}.mt-6{margin-top:1.5rem}.block{display:block}.inline{display:inline}.flex{display:flex}.hidden{display:none}.h-10{height:2.5rem}.h-\\[21px\\]{height:21px}.h-\\[28px\\]{height:28px}.h-fit{height:-moz-fit-content;height:fit-content}.h-full{height:100%}.h-screen{height:100vh}.max-h-screen{max-height:100vh}.min-h-screen{min-height:100vh}.w-2\\/5{width:40%}.w-fit{width:-moz-fit-content;width:fit-content}.w-full{width:100%}.w-screen{width:100vw}.min-w-\\[40\\%\\]{min-width:40%}.min-w-\\[48\\%\\]{min-width:48%}.max-w-sm{max-width:24rem}.flex-1{flex:1 1 0%}.flex-shrink{flex-shrink:1}.flex-grow{flex-grow:1}.cursor-pointer{cursor:pointer}.flex-row{flex-direction:row}.flex-col{flex-direction:column}.items-start{align-items:flex-start}.items-end{align-items:flex-end}.items-center{align-items:center}.items-stretch{align-items:stretch}.justify-start{justify-content:flex-start}.justify-end{justify-content:flex-end}.justify-center{justify-content:center}.justify-between{justify-content:space-between}.gap-1{gap:.25rem}.gap-2{gap:.5rem}.gap-3{gap:.75rem}.gap-4{gap:1rem}.gap-8{gap:2rem}.space-x-2>:not([hidden])~:not([hidden]){--tw-space-x-reverse: 0;margin-right:calc(.5rem * var(--tw-space-x-reverse));margin-left:calc(.5rem * (1 - var(--tw-space-x-reverse)))}.self-start{align-self:flex-start}.overflow-hidden{overflow:hidden}.overflow-y-auto{overflow-y:auto}.overflow-x-hidden{overflow-x:hidden}.overflow-y-scroll{overflow-y:scroll}.truncate{overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.overflow-ellipsis{text-overflow:ellipsis}.whitespace-normal{white-space:normal}.whitespace-nowrap{white-space:nowrap}.break-words{overflow-wrap:break-word}.rounded{border-radius:.25rem}.rounded-lg{border-radius:.5rem}.border{border-width:1px}.border-2{border-width:2px}.border-none{border-style:none}.border-gray-200{--tw-border-opacity: 1;border-color:rgb(229,231,235,var(--tw-border-opacity))}.border-red-400{--tw-border-opacity: 1;border-color:rgb(248,113,113,var(--tw-border-opacity))}.bg-\\[\\#F9FAFB\\]{--tw-bg-opacity: 1;background-color:rgb(249,250,251,var(--tw-bg-opacity))}.bg-blue-500{--tw-bg-opacity: 1;background-color:rgb(59,130,246,var(--tw-bg-opacity))}.bg-photon-blue{--tw-bg-opacity: 1;background-color:rgb(49,130,206,var(--tw-bg-opacity))}.bg-red-100{--tw-bg-opacity: 1;background-color:rgb(254,226,226,var(--tw-bg-opacity))}.bg-white{--tw-bg-opacity: 1;background-color:rgb(255,255,255,var(--tw-bg-opacity))}.p-0{padding:0}.p-4{padding:1rem}.px-3{padding-left:.75rem;padding-right:.75rem}.px-4{padding-left:1rem;padding-right:1rem}.py-1{padding-top:.25rem;padding-bottom:.25rem}.py-2{padding-top:.5rem;padding-bottom:.5rem}.py-3{padding-top:.75rem;padding-bottom:.75rem}.py-4{padding-top:1rem;padding-bottom:1rem}.pb-2{padding-bottom:.5rem}.pb-4{padding-bottom:1rem}.pb-40{padding-bottom:10rem}.pb-5{padding-bottom:1.25rem}.pl-1{padding-left:.25rem}.pl-2{padding-left:.5rem}.pl-5{padding-left:1.25rem}.pl-\\[19\\.75px\\]{padding-left:19.75px}.pr-2{padding-right:.5rem}.pr-5{padding-right:1.25rem}.pt-1{padding-top:.25rem}.pt-28{padding-top:7rem}.pt-3{padding-top:.75rem}.text-center{text-align:center}.font-sans{font-family:ui-sans-serif,system-ui,sans-serif,"Apple Color Emoji","Segoe UI Emoji",Segoe UI Symbol,"Noto Color Emoji"}.text-3xl{font-size:1.875rem;line-height:2.25rem}.text-lg{font-size:1.125rem;line-height:1.75rem}.text-sm{font-size:.875rem;line-height:1.25rem}.text-xl{font-size:1.25rem;line-height:1.75rem}.text-xs{font-size:.75rem;line-height:1rem}.font-bold{font-weight:700}.font-extrabold{font-weight:800}.font-light{font-weight:300}.font-medium{font-weight:500}.font-semibold{font-weight:600}.uppercase{text-transform:uppercase}.italic{font-style:italic}.leading-snug{line-height:1.375}.text-black{--tw-text-opacity: 1;color:rgb(0,0,0,var(--tw-text-opacity))}.text-blue-600{--tw-text-opacity: 1;color:rgb(37,99,235,var(--tw-text-opacity))}.text-gray-400{--tw-text-opacity: 1;color:rgb(156,163,175,var(--tw-text-opacity))}.text-gray-500{--tw-text-opacity: 1;color:rgb(107,114,128,var(--tw-text-opacity))}.text-gray-600{--tw-text-opacity: 1;color:rgb(75,85,99,var(--tw-text-opacity))}.text-gray-700{--tw-text-opacity: 1;color:rgb(55,65,81,var(--tw-text-opacity))}.text-red-400{--tw-text-opacity: 1;color:rgb(248,113,113,var(--tw-text-opacity))}.text-red-700{--tw-text-opacity: 1;color:rgb(185,28,28,var(--tw-text-opacity))}.text-slate-500{--tw-text-opacity: 1;color:rgb(100,116,139,var(--tw-text-opacity))}.text-teal-600{--tw-text-opacity: 1;color:rgb(13,148,136,var(--tw-text-opacity))}.text-white{--tw-text-opacity: 1;color:rgb(255,255,255,var(--tw-text-opacity))}.shadow-card{--tw-shadow: 0px 0px 1px rgba(48, 49, 51, .05),0px 2px 4px rgba(48, 49, 51, .1);--tw-shadow-colored: 0px 0px 1px var(--tw-shadow-color), 0px 2px 4px var(--tw-shadow-color);box-shadow:var(--tw-ring-offset-shadow, 0 0 rgba(0, 0, 0, 0)),var(--tw-ring-shadow, 0 0 rgba(0, 0, 0, 0)),var(--tw-shadow)}.filter{filter:var(--tw-blur) var(--tw-brightness) var(--tw-contrast) var(--tw-grayscale) var(--tw-hue-rotate) var(--tw-invert) var(--tw-saturate) var(--tw-sepia) var(--tw-drop-shadow)}.transition{transition-property:color,background-color,border-color,text-decoration-color,fill,stroke,opacity,box-shadow,transform,filter,-webkit-backdrop-filter;transition-property:color,background-color,border-color,text-decoration-color,fill,stroke,opacity,box-shadow,transform,filter,backdrop-filter;transition-property:color,background-color,border-color,text-decoration-color,fill,stroke,opacity,box-shadow,transform,filter,backdrop-filter,-webkit-backdrop-filter;transition-timing-function:cubic-bezier(.4,0,.2,1);transition-duration:.15s}.ease-in-out{transition-timing-function:cubic-bezier(.4,0,.2,1)}.hover\\:cursor-pointer:hover{cursor:pointer}.hover\\:bg-blue-700:hover{--tw-bg-opacity: 1;background-color:rgb(29,78,216,var(--tw-bg-opacity))}.hover\\:bg-photon-blue-dark:hover{--tw-bg-opacity: 1;background-color:rgb(43,108,176,var(--tw-bg-opacity))}.hover\\:text-gray-600:hover{--tw-text-opacity: 1;color:rgb(75,85,99,var(--tw-text-opacity))}.hover\\:underline:hover{text-decoration-line:underline}.disabled\\:bg-gray-500:disabled{--tw-bg-opacity: 1;background-color:rgb(107,114,128,var(--tw-bg-opacity))}@media (min-width: 475px){.xs\\:mx-auto{margin-left:auto;margin-right:auto}.xs\\:\\!w-auto{width:auto!important}.xs\\:min-w-\\[40\\%\\]{min-width:40%}.xs\\:min-w-\\[48\\%\\]{min-width:48%}.xs\\:flex-row{flex-direction:row}.xs\\:gap-4{gap:1rem}.xs\\:pb-2{padding-bottom:.5rem}.xs\\:pt-28{padding-top:7rem}.xs\\:text-base{font-size:1rem;line-height:1.5rem}}@media (min-width: 640px){.sm\\:order-first{order:-9999}.sm\\:mt-0{margin-top:0}.sm\\:inline{display:inline}.sm\\:grid{display:grid}.sm\\:w-\\[600px\\]{width:600px}.sm\\:w-auto{width:auto}.sm\\:flex-none{flex:none}.sm\\:grid-cols-2{grid-template-columns:repeat(2,minmax(0,1fr))}.sm\\:gap-3{gap:.75rem}.sm\\:gap-4{gap:1rem}.sm\\:py-2{padding-top:.5rem;padding-bottom:.5rem}}@media (min-width: 768px){.md\\:static{position:static}.md\\:mb-0{margin-bottom:0}.md\\:flex{display:flex}.md\\:flex-1{flex:1 1 0%}.md\\:flex-row{flex-direction:row}.md\\:justify-center{justify-content:center}.md\\:px-4{padding-left:1rem;padding-right:1rem}.md\\:px-8{padding-left:2rem;padding-right:2rem}.md\\:py-2{padding-top:.5rem;padding-bottom:.5rem}.md\\:py-3{padding-top:.75rem;padding-bottom:.75rem}.md\\:pb-52{padding-bottom:13rem}.md\\:pr-2{padding-right:.5rem}.md\\:pt-4{padding-top:1rem}.md\\:text-3xl{font-size:1.875rem;line-height:2.25rem}.md\\:text-xl{font-size:1.25rem;line-height:1.75rem}}@media (min-width: 1024px){.lg\\:gap-2{gap:.5rem}.lg\\:pt-20{padding-top:5rem}}';var CQ=Y("<style>"),SQ=Y('<button class="w-full disabled:bg-gray-500 bg-photon-blue hover:bg-blue-700 text-white h-10 px-4 rounded-lg font-sans hover:bg-photon-blue-dark transition ease-in-out delay-50">');const EQ=e=>{const t=Xr();return fe(()=>{t||console.error("[photon-auth-button] No valid PhotonClient instance was provided. Please ensure you are wrapping the element in a photon-client element")}),[(()=>{var r=CQ();return I(r,Ft),r})(),t?(()=>{var r=SQ();return r.$$click=async()=>{const n={appState:{}};e.redirectPath&&(n.appState.returnTo=e.redirectPath),t.authentication.state.isAuthenticated?await t.authentication.logout():await t.authentication.login(n)},I(r,()=>t.authentication.state.isAuthenticated?"Log out":"Log in"),J(()=>r.disabled=t.authentication.state.isLoading),r})():null]};Et("photon-auth-button",{redirectPath:{attribute:"redirect-path",value:void 0,reflect:!1,notify:!1,parse:!1}},EQ);Ja(["click"]);var TQ=Y("<style>"),AQ=Y(`<div class="flex flex-col w-screen max-w-sm"><svg viewBox="0 0 305 62.61"xmlns=http://www.w3.org/2000/svg class="h-[28px] pl-[19.75px]"><g fill=#273D52><path d="M0 54.1169H6.81375V35.7722H18.0826C29.5481 35.7722 34.3963 30.3343 34.3963 18.7378V17.4275C34.3963 5.76548 29.417 0.655167 18.0826 0.655167H0V54.1169ZM6.81375 30.1377V6.28961H18.2792C24.7653 6.28961 27.386 8.9758 27.386 16.0516V20.0481C27.386 27.1895 24.7653 30.1377 18.2792 30.1377H6.81375Z"></path><path d="M70.9593 54.1169H77.773V0.655167H70.9593V24.4378H50.8456V0.655167H44.0319V54.1169H50.8456V30.3343H70.9593V54.1169Z"></path><path d="M107.146 54.772C119.528 54.772 125.687 46.5169 125.687 34.9205V19.7861C125.687 8.25511 119.528 0 107.146 0C94.6974 0 88.5388 8.25511 88.5388 19.7861V34.9205C88.5388 46.5169 94.6974 54.772 107.146 54.772ZM95.5491 35.9687V18.8033C95.5491 10.7448 99.4801 5.89651 107.146 5.89651C114.745 5.89651 118.677 10.7448 118.677 18.8033V35.9687C118.677 44.0928 114.745 48.8755 107.146 48.8755C99.4801 48.8755 95.5491 44.0928 95.5491 35.9687Z"></path><path d="M144.295 54.1169H151.109V6.48616H164.54V0.655167H130.864V6.48616H144.295V54.1169Z"></path><path d="M188.299 54.772C200.682 54.772 206.841 46.5169 206.841 34.9205V19.7861C206.841 8.25511 200.682 0 188.299 0C175.851 0 169.693 8.25511 169.693 19.7861V34.9205C169.693 46.5169 175.851 54.772 188.299 54.772ZM176.703 35.9687V18.8033C176.703 10.7448 180.634 5.89651 188.299 5.89651C195.899 5.89651 199.83 10.7448 199.83 18.8033V35.9687C199.83 44.0928 195.899 48.8755 188.299 48.8755C180.634 48.8755 176.703 44.0928 176.703 35.9687Z"></path><path d="M217.6 54.1169H224.021V14.3482L245.576 54.1169H252.608L248.058 45.1084L245.641 40.4239L224.086 0.655167H217.6V54.1169Z"></path></g><g fill=#B35724><circle cx=249.798 cy=5.202 r=5.202></circle></g></svg><h1 class="font-medium text-3xl text-center font-sans mt-6 mb-3">Log in to your account</h1><p class="text-gray-500 font-sans text-center mb-8">Don't have an account? <a href=mailto:rado@photon.health class="text-teal-600 hover:underline hover:cursor-pointer font-sans font-light">Contact Sales</a></p><photon-auth-button>`,!0,!1,!1);const OQ=e=>{const t=Xr();return fe(()=>{t||console.error("[photon-login] No valid PhotonClient instance was provided. Please ensure you are wrapping the element in a photon-client element")}),[(()=>{var r=TQ();return I(r,Ft),r})(),(()=>{var r=AQ(),n=r.firstChild,i=n.nextSibling,a=i.nextSibling,o=a.nextSibling;return o._$owner=ce(),J(()=>o.redirectPath=e.redirectPath),r})()]};Et("photon-login",{redirectPath:{attribute:"redirect-path",value:void 0,reflect:!1,notify:!1,parse:!1}},OQ);const yd=(e,t)=>{let r;const n=()=>clearTimeout(r);return ce()&&Er(n),Object.assign((...a)=>{r!==void 0&&n(),r=setTimeout(()=>e(...a),t)},{clear:n})};/**
1433
+ `,iQ={CatalogTreatmentsFieldsComponentFragment:nQ};class aQ{sdk;setStore;store;authentication;getSDK;clinical;autoLogin;constructor(t,r=!1){this.sdk=t,this.autoLogin=r;const[n,i]=sa({authentication:{isAuthenticated:!1,isInOrg:!1,permissions:[],isLoading:!0,error:void 0,user:void 0},catalog:{isLoading:!1,treatments:[],templates:[]},catalogs:{isLoading:!1,catalogs:[]},dispenseUnits:{isLoading:!1,dispenseUnits:new Array},patients:{isLoading:!1,patients:[],finished:!1},patient:{isLoading:!1,patient:void 0},prescription:{isLoading:!1,errors:[],error:void 0,data:void 0}});this.setStore=i,this.store=n,this.authentication={state:n.authentication,handleRedirect:async a=>{try{const o=await this.sdk.authentication.handleRedirect(a);rQ(o?.appState),await this.authentication.checkSession()}catch(o){const s=new URLSearchParams(window.location.search).get("error_description");o.message.includes("must be an organization id")?this.setStore("authentication",{...this.store.authentication,error:"The provided organization id is invalid or does not exist"}):s?.includes("is not part of the org")?this.setStore("authentication",{...this.store.authentication,error:"User is not authorized",isLoading:!1}):this.setStore("authentication",{...this.store.authentication,error:o.message})}},checkSession:this.checkSession.bind(this),login:this.login.bind(this),logout:this.logout.bind(this)},this.getSDK=this._getSDK.bind(this),this.clinical={catalog:{state:n.catalog,getCatalog:this.getCatalog.bind(this)},catalogs:{state:n.catalogs,getCatalogs:this.getCatalogs.bind(this)},dispenseUnits:{state:n.dispenseUnits,getDispenseUnits:this.getDispenseUnits.bind(this)},patients:{state:n.patients,getPatients:this.getPatients.bind(this)},patient:{state:n.patient,getPatient:this.getPatient.bind(this)},prescription:{state:n.prescription,createPrescription:this.createPrescription.bind(this)}}}_getSDK(){return this.sdk}async checkSession(){try{await this.sdk.authentication.checkSession();const t=await this.sdk.authentication.isAuthenticated();this.setStore("authentication",{...this.store.authentication,isAuthenticated:t});const r=await this.sdk.authentication.getUser(),n=!!this.sdk?.organization&&!!r?.org_id;let i=[];if(this.autoLogin||t)try{const o=await this.sdk.authentication.getAccessToken();i=tQ(o)?.permissions||[]}catch{i=[]}const a=t&&n&&this.sdk.organization===r.org_id;this.setStore("authentication",{...this.store.authentication,user:r,isLoading:!1,isInOrg:a,permissions:i||[]})}catch{this.setStore("authentication",{...this.store.authentication,isLoading:!1})}}async login(t={}){await this.sdk.authentication.login(t),await this.checkSession()}async logout(t={}){await this.sdk.authentication.logout(t),this.setStore("authentication",{...this.store.authentication,isAuthenticated:!1,isInOrg:!1,permissions:[],user:void 0})}async getPatients(t){t||(t={}),this.setStore("patients",{...this.store.patients,isLoading:!0});const{data:r}=await this.sdk.clinical.patient.getPatients(t);this.setStore("patients",{...this.store.patients,isLoading:!1,patients:t.clear?r.patients:this.store.patients.patients.concat(r.patients),finished:r.patients.length==0})}async getPatient(t){this.setStore("patient",{...this.store.patient,isLoading:!0});const{data:r}=await this.sdk.clinical.patient.getPatient(t);return this.setStore("patient",{...this.store.patient,isLoading:!1,patient:r.patient}),r.patient}async getCatalog(t){this.setStore("catalog",{...this.store.catalog,isLoading:!0});const{data:r}=await this.sdk.clinical.catalog.getCatalog({id:t.id,fragment:iQ});this.setStore("catalog",{...this.store.catalog,isLoading:!1,treatments:r.catalog.treatments.map(n=>n)||[],templates:r.catalog.templates.map(n=>n)||[]})}async getCatalogs(){this.setStore("catalogs",{...this.store.catalogs,isLoading:!0});const{data:t}=await this.sdk.clinical.catalog.getCatalogs();this.setStore("catalogs",{...this.store.catalogs,isLoading:!1,catalogs:t.catalogs})}async getDispenseUnits(){this.setStore("dispenseUnits",{...this.store.dispenseUnits,isLoading:!0});const{data:t}=await this.sdk.clinical.prescription.getDispenseUnits();this.setStore("dispenseUnits",{...this.store.dispenseUnits,isLoading:!1,dispenseUnits:t.dispenseUnits.map((r,n)=>({id:String(n),...r}))})}async createPrescription(t){this.setStore("prescription",{...this.store.prescription,isLoading:!0});const r=this.sdk.clinical.prescription.createPrescription({});try{const{data:n,errors:i}=await r({variables:t,refetchQueries:[],awaitRefetchQueries:!1});return i&&i.length>0&&this.setStore("prescription",{...this.store.prescription,errors:[...i]}),n?.createPrescription&&this.setStore("prescription",{...this.store.prescription,data:n.createPrescription}),this.setStore("prescription",{...this.store.prescription,isLoading:!1}),{data:n,errors:i}}catch(n){return this.setStore("prescription",{...this.store.prescription,error:n,isLoading:!1}),{data:null,errors:[]}}}}const oQ=(e,t,r)=>{const n=r(e,t);return Er(()=>clearInterval(n))},z6="%[a-f0-9]{2}",gg=new RegExp("("+z6+")|([^%]+?)","gi"),vg=new RegExp("("+z6+")+","gi");function Sh(e,t){try{return[decodeURIComponent(e.join(""))]}catch{}if(e.length===1)return e;t=t||1;const r=e.slice(0,t),n=e.slice(t);return Array.prototype.concat.call([],Sh(r),Sh(n))}function sQ(e){try{return decodeURIComponent(e)}catch{let t=e.match(gg)||[];for(let r=1;r<t.length;r++)e=Sh(t,r).join(""),t=e.match(gg)||[];return e}}function lQ(e){const t={"%FE%FF":"��","%FF%FE":"��"};let r=vg.exec(e);for(;r;){try{t[r[0]]=decodeURIComponent(r[0])}catch{const i=sQ(r[0]);i!==r[0]&&(t[r[0]]=i)}r=vg.exec(e)}t["%C2"]="�";const n=Object.keys(t);for(const i of n)e=e.replace(new RegExp(i,"g"),t[i]);return e}function dQ(e){if(typeof e!="string")throw new TypeError("Expected `encodedURI` to be of type `string`, got `"+typeof e+"`");try{return decodeURIComponent(e)}catch{return lQ(e)}}function cQ(e,t){const r={};if(Array.isArray(t))for(const n of t){const i=Object.getOwnPropertyDescriptor(e,n);i?.enumerable&&Object.defineProperty(r,n,i)}else for(const n of Reflect.ownKeys(e)){const i=Object.getOwnPropertyDescriptor(e,n);if(i.enumerable){const a=e[n];t(n,a,e)&&Object.defineProperty(r,n,i)}}return r}function j6(e,t){if(!(typeof e=="string"&&typeof t=="string"))throw new TypeError("Expected the arguments to be of type `string`");if(e===""||t==="")return[];const r=e.indexOf(t);return r===-1?[]:[e.slice(0,r),e.slice(r+t.length)]}const uQ=e=>e==null,hQ=e=>encodeURIComponent(e).replaceAll(/[!'()*]/g,t=>`%${t.charCodeAt(0).toString(16).toUpperCase()}`),Eh=Symbol("encodeFragmentIdentifier");function fQ(e){switch(e.arrayFormat){case"index":return t=>(r,n)=>{const i=r.length;return n===void 0||e.skipNull&&n===null||e.skipEmptyString&&n===""?r:n===null?[...r,[Xt(t,e),"[",i,"]"].join("")]:[...r,[Xt(t,e),"[",Xt(i,e),"]=",Xt(n,e)].join("")]};case"bracket":return t=>(r,n)=>n===void 0||e.skipNull&&n===null||e.skipEmptyString&&n===""?r:n===null?[...r,[Xt(t,e),"[]"].join("")]:[...r,[Xt(t,e),"[]=",Xt(n,e)].join("")];case"colon-list-separator":return t=>(r,n)=>n===void 0||e.skipNull&&n===null||e.skipEmptyString&&n===""?r:n===null?[...r,[Xt(t,e),":list="].join("")]:[...r,[Xt(t,e),":list=",Xt(n,e)].join("")];case"comma":case"separator":case"bracket-separator":{const t=e.arrayFormat==="bracket-separator"?"[]=":"=";return r=>(n,i)=>i===void 0||e.skipNull&&i===null||e.skipEmptyString&&i===""?n:(i=i===null?"":i,n.length===0?[[Xt(r,e),t,Xt(i,e)].join("")]:[[n,Xt(i,e)].join(e.arrayFormatSeparator)])}default:return t=>(r,n)=>n===void 0||e.skipNull&&n===null||e.skipEmptyString&&n===""?r:n===null?[...r,Xt(t,e)]:[...r,[Xt(t,e),"=",Xt(n,e)].join("")]}}function pQ(e){let t;switch(e.arrayFormat){case"index":return(r,n,i)=>{if(t=/\[(\d*)]$/.exec(r),r=r.replace(/\[\d*]$/,""),!t){i[r]=n;return}i[r]===void 0&&(i[r]={}),i[r][t[1]]=n};case"bracket":return(r,n,i)=>{if(t=/(\[])$/.exec(r),r=r.replace(/\[]$/,""),!t){i[r]=n;return}if(i[r]===void 0){i[r]=[n];return}i[r]=[...i[r],n]};case"colon-list-separator":return(r,n,i)=>{if(t=/(:list)$/.exec(r),r=r.replace(/:list$/,""),!t){i[r]=n;return}if(i[r]===void 0){i[r]=[n];return}i[r]=[...i[r],n]};case"comma":case"separator":return(r,n,i)=>{const a=typeof n=="string"&&n.includes(e.arrayFormatSeparator),o=typeof n=="string"&&!a&&pi(n,e).includes(e.arrayFormatSeparator);n=o?pi(n,e):n;const s=a||o?n.split(e.arrayFormatSeparator).map(l=>pi(l,e)):n===null?n:pi(n,e);i[r]=s};case"bracket-separator":return(r,n,i)=>{const a=/(\[])$/.test(r);if(r=r.replace(/\[]$/,""),!a){i[r]=n&&pi(n,e);return}const o=n===null?[]:pi(n,e).split(e.arrayFormatSeparator);if(i[r]===void 0){i[r]=o;return}i[r]=[...i[r],...o]};default:return(r,n,i)=>{if(i[r]===void 0){i[r]=n;return}i[r]=[...[i[r]].flat(),n]}}}function V6(e){if(typeof e!="string"||e.length!==1)throw new TypeError("arrayFormatSeparator must be single character string")}function Xt(e,t){return t.encode?t.strict?hQ(e):encodeURIComponent(e):e}function pi(e,t){return t.decode?dQ(e):e}function U6(e){return Array.isArray(e)?e.sort():typeof e=="object"?U6(Object.keys(e)).sort((t,r)=>Number(t)-Number(r)).map(t=>e[t]):e}function q6(e){const t=e.indexOf("#");return t!==-1&&(e=e.slice(0,t)),e}function mQ(e){let t="";const r=e.indexOf("#");return r!==-1&&(t=e.slice(r)),t}function yg(e,t,r){return r==="string"&&typeof e=="string"?e:typeof r=="function"&&typeof e=="string"?r(e):t.parseBooleans&&e!==null&&(e.toLowerCase()==="true"||e.toLowerCase()==="false")?e.toLowerCase()==="true":r==="number"&&!Number.isNaN(Number(e))&&typeof e=="string"&&e.trim()!==""||t.parseNumbers&&!Number.isNaN(Number(e))&&typeof e=="string"&&e.trim()!==""?Number(e):e}function Jf(e){e=q6(e);const t=e.indexOf("?");return t===-1?"":e.slice(t+1)}function ep(e,t){t={decode:!0,sort:!0,arrayFormat:"none",arrayFormatSeparator:",",parseNumbers:!1,parseBooleans:!1,types:Object.create(null),...t},V6(t.arrayFormatSeparator);const r=pQ(t),n=Object.create(null);if(typeof e!="string"||(e=e.trim().replace(/^[?#&]/,""),!e))return n;for(const i of e.split("&")){if(i==="")continue;const a=t.decode?i.replaceAll("+"," "):i;let[o,s]=j6(a,"=");o===void 0&&(o=a),s=s===void 0?null:["comma","separator","bracket-separator"].includes(t.arrayFormat)?s:pi(s,t),r(pi(o,t),s,n)}for(const[i,a]of Object.entries(n))if(typeof a=="object"&&a!==null&&t.types[i]!=="string")for(const[o,s]of Object.entries(a)){const l=t.types[i]?t.types[i].replace("[]",""):void 0;a[o]=yg(s,t,l)}else typeof a=="object"&&a!==null&&t.types[i]==="string"?n[i]=Object.values(a).join(t.arrayFormatSeparator):n[i]=yg(a,t,t.types[i]);return t.sort===!1?n:(t.sort===!0?Object.keys(n).sort():Object.keys(n).sort(t.sort)).reduce((i,a)=>{const o=n[a];return i[a]=o&&typeof o=="object"&&!Array.isArray(o)?U6(o):o,i},Object.create(null))}function B6(e,t){if(!e)return"";t={encode:!0,strict:!0,arrayFormat:"none",arrayFormatSeparator:",",...t},V6(t.arrayFormatSeparator);const r=o=>t.skipNull&&uQ(e[o])||t.skipEmptyString&&e[o]==="",n=fQ(t),i={};for(const[o,s]of Object.entries(e))r(o)||(i[o]=s);const a=Object.keys(i);return t.sort!==!1&&a.sort(t.sort),a.map(o=>{const s=e[o];return s===void 0?"":s===null?Xt(o,t):Array.isArray(s)?s.length===0&&t.arrayFormat==="bracket-separator"?Xt(o,t)+"[]":s.reduce(n(o),[]).join("&"):Xt(o,t)+"="+Xt(s,t)}).filter(o=>o.length>0).join("&")}function H6(e,t){t={decode:!0,...t};let[r,n]=j6(e,"#");return r===void 0&&(r=e),{url:r?.split("?")?.[0]??"",query:ep(Jf(e),t),...t&&t.parseFragmentIdentifier&&n?{fragmentIdentifier:pi(n,t)}:{}}}function W6(e,t){t={encode:!0,strict:!0,[Eh]:!0,...t};const r=q6(e.url).split("?")[0]||"",n=Jf(e.url),i={...ep(n,{sort:!1}),...e.query};let a=B6(i,t);a&&=`?${a}`;let o=mQ(e.url);if(typeof e.fragmentIdentifier=="string"){const s=new URL(r);s.hash=e.fragmentIdentifier,o=t[Eh]?s.hash:`#${e.fragmentIdentifier}`}return`${r}${a}${o}`}function Q6(e,t,r){r={parseFragmentIdentifier:!0,[Eh]:!1,...r};const{url:n,query:i,fragmentIdentifier:a}=H6(e,r);return W6({url:n,query:cQ(i,t),fragmentIdentifier:a},r)}function gQ(e,t,r){const n=Array.isArray(t)?i=>!t.includes(i):(i,a)=>!t(i,a);return Q6(e,n,r)}const G6=Object.freeze(Object.defineProperty({__proto__:null,exclude:gQ,extract:Jf,parse:ep,parseUrl:H6,pick:Q6,stringify:B6,stringifyUrl:W6},Symbol.toStringTag,{value:"Module"})),vQ=(e=window.location.search)=>{if(!e)return!1;const t=G6.parse(e);return"state"in t&&"photon"in t&&("code"in t||"error"in t)},yQ=e=>/^\d+$/.test(e)&&e.length>=5;function Th(e,t){return e.every(r=>t.includes(r))}const bQ="0.16.2",$Q={version:bQ};var wQ=Y("<slot>"),xQ=Y("<div>");const kQ=$Q?.version,_Q=e=>{let t;const r=e.redirectUri?e.redirectUri:window.location.origin,n=G6.stringifyUrl({url:r,query:{photon:!0}}),i=new zk({env:e.env,domain:e.domain,audience:e.audience,connection:e.connection,uri:e.uri,clientId:e.id,redirectURI:n,organization:e.org,developmentMode:e.developmentMode},kQ),a=new aQ(i,e.autoLogin);e.developmentMode&&console.info("[PhotonClient]: Development mode enabled");const[o]=H(a),s=async()=>{await o()?.authentication.handleRedirect(),e.redirectPath&&window.location.replace(e.redirectPath)},l=async()=>{await o()?.authentication.checkSession(),oQ(async()=>{await o()?.authentication.checkSession()},6e4,setInterval)};return fe(()=>{vQ()&&o()?s():o()&&l()}),fe(()=>{if(!o()?.authentication.state.isLoading){if(!o()?.authentication.state.isAuthenticated&&e.autoLogin){const d={appState:{}};e.redirectPath&&(d.appState.returnTo=e.redirectPath),o()?.authentication.login(d)}else if(e.externalUserId!=null&&o().authentication.state.user?.sub?.split("|").reverse()[0]!==e.externalUserId){o()?.authentication.logout();const d={appState:{}};e.redirectPath&&(d.appState.returnTo=e.redirectPath),o()?.authentication.login(d)}}}),(()=>{var d=xQ(),c=t;return typeof c=="function"?ze(c,d):t=d,I(d,b(R6.Provider,{get value(){return o()},get children(){return b(SR,{client:i,get children(){var u=wQ();return u._$owner=ce(),u}})}})),d})()};Et("photon-client",{domain:{attribute:"domain",value:void 0,reflect:!1,notify:!1,parse:!1},id:{attribute:"id",value:void 0,reflect:!1,notify:!1,parse:!1},redirectUri:{attribute:"redirect-uri",value:void 0,reflect:!1,notify:!1,parse:!1},redirectPath:{attribute:"redirect-path",value:void 0,reflect:!1,notify:!1,parse:!1},org:{attribute:"org",value:void 0,reflect:!1,notify:!1,parse:!1},audience:{attribute:"audience",value:void 0,reflect:!1,notify:!1,parse:!1},connection:{attribute:"connection",value:void 0,reflect:!1,notify:!1,parse:!1},uri:{attribute:"uri",value:void 0,reflect:!1,notify:!1,parse:!1},developmentMode:{attribute:"dev-mode",value:!1,reflect:!0,notify:!1,parse:!0},errorMessage:{attribute:"error-message",value:"Oh snap! There was an error loading. Please contact your site's administrator",reflect:!1,notify:!1,parse:!1},autoLogin:{attribute:"auto-login",value:!1,reflect:!1,notify:!1,parse:!0},env:{attribute:"env",value:void 0,reflect:!1,notify:!1,parse:!1},externalUserId:{attribute:"user-id",value:void 0,reflect:!0,notify:!0,parse:!1}},_Q);const Ft='*,:before,:after{box-sizing:border-box;border-width:0;border-style:solid;border-color:#e5e7eb}:before,:after{--tw-content: ""}html,:host{line-height:1.5;-webkit-text-size-adjust:100%;-moz-tab-size:4;-o-tab-size:4;tab-size:4;font-family:ui-sans-serif,system-ui,sans-serif,"Apple Color Emoji","Segoe UI Emoji",Segoe UI Symbol,"Noto Color Emoji";font-feature-settings:normal;font-variation-settings:normal;-webkit-tap-highlight-color:transparent}body{margin:0;line-height:inherit}hr{height:0;color:inherit;border-top-width:1px}abbr:where([title]){-webkit-text-decoration:underline dotted;text-decoration:underline dotted}h1,h2,h3,h4,h5,h6{font-size:inherit;font-weight:inherit}a{color:inherit;text-decoration:inherit}b,strong{font-weight:bolder}code,kbd,samp,pre{font-family:ui-monospace,SFMono-Regular,Menlo,Monaco,Consolas,Liberation Mono,Courier New,monospace;font-feature-settings:normal;font-variation-settings:normal;font-size:1em}small{font-size:80%}sub,sup{font-size:75%;line-height:0;position:relative;vertical-align:baseline}sub{bottom:-.25em}sup{top:-.5em}table{text-indent:0;border-color:inherit;border-collapse:collapse}button,input,optgroup,select,textarea{font-family:inherit;font-feature-settings:inherit;font-variation-settings:inherit;font-size:100%;font-weight:inherit;line-height:inherit;letter-spacing:inherit;color:inherit;margin:0;padding:0}button,select{text-transform:none}button,input:where([type=button]),input:where([type=reset]),input:where([type=submit]){-webkit-appearance:button;background-color:transparent;background-image:none}:-moz-focusring{outline:auto}:-moz-ui-invalid{box-shadow:none}progress{vertical-align:baseline}::-webkit-inner-spin-button,::-webkit-outer-spin-button{height:auto}[type=search]{-webkit-appearance:textfield;outline-offset:-2px}::-webkit-search-decoration{-webkit-appearance:none}::-webkit-file-upload-button{-webkit-appearance:button;font:inherit}summary{display:list-item}blockquote,dl,dd,h1,h2,h3,h4,h5,h6,hr,figure,p,pre{margin:0}fieldset{margin:0;padding:0}legend{padding:0}ol,ul,menu{list-style:none;margin:0;padding:0}dialog{padding:0}textarea{resize:vertical}input::-moz-placeholder,textarea::-moz-placeholder{opacity:1;color:#9ca3af}input::placeholder,textarea::placeholder{opacity:1;color:#9ca3af}button,[role=button]{cursor:pointer}:disabled{cursor:default}img,svg,video,canvas,audio,iframe,embed,object{display:block;vertical-align:middle}img,video{max-width:100%;height:auto}[hidden]{display:none}*,:before,:after{--tw-border-spacing-x: 0;--tw-border-spacing-y: 0;--tw-translate-x: 0;--tw-translate-y: 0;--tw-rotate: 0;--tw-skew-x: 0;--tw-skew-y: 0;--tw-scale-x: 1;--tw-scale-y: 1;--tw-pan-x: ;--tw-pan-y: ;--tw-pinch-zoom: ;--tw-scroll-snap-strictness: proximity;--tw-gradient-from-position: ;--tw-gradient-via-position: ;--tw-gradient-to-position: ;--tw-ordinal: ;--tw-slashed-zero: ;--tw-numeric-figure: ;--tw-numeric-spacing: ;--tw-numeric-fraction: ;--tw-ring-inset: ;--tw-ring-offset-width: 0px;--tw-ring-offset-color: #fff;--tw-ring-color: rgb(59 130 246 / .5);--tw-ring-offset-shadow: 0 0 #0000;--tw-ring-shadow: 0 0 #0000;--tw-shadow: 0 0 #0000;--tw-shadow-colored: 0 0 #0000;--tw-blur: ;--tw-brightness: ;--tw-contrast: ;--tw-grayscale: ;--tw-hue-rotate: ;--tw-invert: ;--tw-saturate: ;--tw-sepia: ;--tw-drop-shadow: ;--tw-backdrop-blur: ;--tw-backdrop-brightness: ;--tw-backdrop-contrast: ;--tw-backdrop-grayscale: ;--tw-backdrop-hue-rotate: ;--tw-backdrop-invert: ;--tw-backdrop-opacity: ;--tw-backdrop-saturate: ;--tw-backdrop-sepia: ;--tw-contain-size: ;--tw-contain-layout: ;--tw-contain-paint: ;--tw-contain-style: }::backdrop{--tw-border-spacing-x: 0;--tw-border-spacing-y: 0;--tw-translate-x: 0;--tw-translate-y: 0;--tw-rotate: 0;--tw-skew-x: 0;--tw-skew-y: 0;--tw-scale-x: 1;--tw-scale-y: 1;--tw-pan-x: ;--tw-pan-y: ;--tw-pinch-zoom: ;--tw-scroll-snap-strictness: proximity;--tw-gradient-from-position: ;--tw-gradient-via-position: ;--tw-gradient-to-position: ;--tw-ordinal: ;--tw-slashed-zero: ;--tw-numeric-figure: ;--tw-numeric-spacing: ;--tw-numeric-fraction: ;--tw-ring-inset: ;--tw-ring-offset-width: 0px;--tw-ring-offset-color: #fff;--tw-ring-color: rgb(59 130 246 / .5);--tw-ring-offset-shadow: 0 0 #0000;--tw-ring-shadow: 0 0 #0000;--tw-shadow: 0 0 #0000;--tw-shadow-colored: 0 0 #0000;--tw-blur: ;--tw-brightness: ;--tw-contrast: ;--tw-grayscale: ;--tw-hue-rotate: ;--tw-invert: ;--tw-saturate: ;--tw-sepia: ;--tw-drop-shadow: ;--tw-backdrop-blur: ;--tw-backdrop-brightness: ;--tw-backdrop-contrast: ;--tw-backdrop-grayscale: ;--tw-backdrop-hue-rotate: ;--tw-backdrop-invert: ;--tw-backdrop-opacity: ;--tw-backdrop-saturate: ;--tw-backdrop-sepia: ;--tw-contain-size: ;--tw-contain-layout: ;--tw-contain-paint: ;--tw-contain-style: }.container{width:100%}@media (min-width: 475px){.container{max-width:475px}}@media (min-width: 640px){.container{max-width:640px}}@media (min-width: 768px){.container{max-width:768px}}@media (min-width: 1024px){.container{max-width:1024px}}@media (min-width: 1280px){.container{max-width:1280px}}@media (min-width: 1536px){.container{max-width:1536px}}.visible{visibility:visible}.fixed{position:fixed}.absolute{position:absolute}.relative{position:relative}.sticky{position:sticky}.left-0{left:0}.left-4{left:1rem}.top-0{top:0}.z-2000{z-index:2000}.z-30{z-index:30}.z-40{z-index:40}.z-50{z-index:50}.order-last{order:9999}.m-3{margin:.75rem}.my-1{margin-top:.25rem;margin-bottom:.25rem}.mb-1{margin-bottom:.25rem}.mb-2{margin-bottom:.5rem}.mb-3{margin-bottom:.75rem}.mb-4{margin-bottom:1rem}.mb-8{margin-bottom:2rem}.ml-1{margin-left:.25rem}.mr-1{margin-right:.25rem}.mt-0{margin-top:0}.mt-2{margin-top:.5rem}.mt-5{margin-top:1.25rem}.mt-6{margin-top:1.5rem}.block{display:block}.inline{display:inline}.flex{display:flex}.hidden{display:none}.h-10{height:2.5rem}.h-\\[21px\\]{height:21px}.h-\\[28px\\]{height:28px}.h-fit{height:-moz-fit-content;height:fit-content}.h-full{height:100%}.h-screen{height:100vh}.max-h-screen{max-height:100vh}.min-h-screen{min-height:100vh}.w-2\\/5{width:40%}.w-fit{width:-moz-fit-content;width:fit-content}.w-full{width:100%}.w-screen{width:100vw}.min-w-\\[40\\%\\]{min-width:40%}.min-w-\\[48\\%\\]{min-width:48%}.max-w-sm{max-width:24rem}.flex-1{flex:1 1 0%}.flex-shrink{flex-shrink:1}.flex-grow{flex-grow:1}.cursor-pointer{cursor:pointer}.flex-row{flex-direction:row}.flex-col{flex-direction:column}.items-start{align-items:flex-start}.items-end{align-items:flex-end}.items-center{align-items:center}.items-stretch{align-items:stretch}.justify-start{justify-content:flex-start}.justify-end{justify-content:flex-end}.justify-center{justify-content:center}.justify-between{justify-content:space-between}.gap-1{gap:.25rem}.gap-2{gap:.5rem}.gap-3{gap:.75rem}.gap-4{gap:1rem}.gap-8{gap:2rem}.space-x-2>:not([hidden])~:not([hidden]){--tw-space-x-reverse: 0;margin-right:calc(.5rem * var(--tw-space-x-reverse));margin-left:calc(.5rem * (1 - var(--tw-space-x-reverse)))}.self-start{align-self:flex-start}.overflow-hidden{overflow:hidden}.overflow-y-auto{overflow-y:auto}.overflow-x-hidden{overflow-x:hidden}.overflow-y-scroll{overflow-y:scroll}.truncate{overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.overflow-ellipsis{text-overflow:ellipsis}.whitespace-normal{white-space:normal}.whitespace-nowrap{white-space:nowrap}.break-words{overflow-wrap:break-word}.rounded{border-radius:.25rem}.rounded-lg{border-radius:.5rem}.border{border-width:1px}.border-2{border-width:2px}.border-none{border-style:none}.border-gray-200{--tw-border-opacity: 1;border-color:rgb(229,231,235,var(--tw-border-opacity))}.border-red-400{--tw-border-opacity: 1;border-color:rgb(248,113,113,var(--tw-border-opacity))}.bg-\\[\\#F9FAFB\\]{--tw-bg-opacity: 1;background-color:rgb(249,250,251,var(--tw-bg-opacity))}.bg-blue-500{--tw-bg-opacity: 1;background-color:rgb(59,130,246,var(--tw-bg-opacity))}.bg-photon-blue{--tw-bg-opacity: 1;background-color:rgb(49,130,206,var(--tw-bg-opacity))}.bg-red-100{--tw-bg-opacity: 1;background-color:rgb(254,226,226,var(--tw-bg-opacity))}.bg-white{--tw-bg-opacity: 1;background-color:rgb(255,255,255,var(--tw-bg-opacity))}.p-0{padding:0}.p-4{padding:1rem}.px-3{padding-left:.75rem;padding-right:.75rem}.px-4{padding-left:1rem;padding-right:1rem}.py-1{padding-top:.25rem;padding-bottom:.25rem}.py-2{padding-top:.5rem;padding-bottom:.5rem}.py-3{padding-top:.75rem;padding-bottom:.75rem}.py-4{padding-top:1rem;padding-bottom:1rem}.pb-2{padding-bottom:.5rem}.pb-4{padding-bottom:1rem}.pb-40{padding-bottom:10rem}.pb-5{padding-bottom:1.25rem}.pl-1{padding-left:.25rem}.pl-2{padding-left:.5rem}.pl-5{padding-left:1.25rem}.pl-\\[19\\.75px\\]{padding-left:19.75px}.pr-2{padding-right:.5rem}.pr-5{padding-right:1.25rem}.pt-1{padding-top:.25rem}.pt-28{padding-top:7rem}.pt-3{padding-top:.75rem}.text-center{text-align:center}.font-sans{font-family:ui-sans-serif,system-ui,sans-serif,"Apple Color Emoji","Segoe UI Emoji",Segoe UI Symbol,"Noto Color Emoji"}.text-3xl{font-size:1.875rem;line-height:2.25rem}.text-lg{font-size:1.125rem;line-height:1.75rem}.text-sm{font-size:.875rem;line-height:1.25rem}.text-xl{font-size:1.25rem;line-height:1.75rem}.text-xs{font-size:.75rem;line-height:1rem}.font-bold{font-weight:700}.font-extrabold{font-weight:800}.font-light{font-weight:300}.font-medium{font-weight:500}.font-semibold{font-weight:600}.uppercase{text-transform:uppercase}.italic{font-style:italic}.leading-snug{line-height:1.375}.text-black{--tw-text-opacity: 1;color:rgb(0,0,0,var(--tw-text-opacity))}.text-blue-600{--tw-text-opacity: 1;color:rgb(37,99,235,var(--tw-text-opacity))}.text-gray-400{--tw-text-opacity: 1;color:rgb(156,163,175,var(--tw-text-opacity))}.text-gray-500{--tw-text-opacity: 1;color:rgb(107,114,128,var(--tw-text-opacity))}.text-gray-600{--tw-text-opacity: 1;color:rgb(75,85,99,var(--tw-text-opacity))}.text-gray-700{--tw-text-opacity: 1;color:rgb(55,65,81,var(--tw-text-opacity))}.text-red-400{--tw-text-opacity: 1;color:rgb(248,113,113,var(--tw-text-opacity))}.text-red-700{--tw-text-opacity: 1;color:rgb(185,28,28,var(--tw-text-opacity))}.text-slate-500{--tw-text-opacity: 1;color:rgb(100,116,139,var(--tw-text-opacity))}.text-teal-600{--tw-text-opacity: 1;color:rgb(13,148,136,var(--tw-text-opacity))}.text-white{--tw-text-opacity: 1;color:rgb(255,255,255,var(--tw-text-opacity))}.shadow-card{--tw-shadow: 0px 0px 1px rgba(48, 49, 51, .05),0px 2px 4px rgba(48, 49, 51, .1);--tw-shadow-colored: 0px 0px 1px var(--tw-shadow-color), 0px 2px 4px var(--tw-shadow-color);box-shadow:var(--tw-ring-offset-shadow, 0 0 rgba(0, 0, 0, 0)),var(--tw-ring-shadow, 0 0 rgba(0, 0, 0, 0)),var(--tw-shadow)}.filter{filter:var(--tw-blur) var(--tw-brightness) var(--tw-contrast) var(--tw-grayscale) var(--tw-hue-rotate) var(--tw-invert) var(--tw-saturate) var(--tw-sepia) var(--tw-drop-shadow)}.transition{transition-property:color,background-color,border-color,text-decoration-color,fill,stroke,opacity,box-shadow,transform,filter,-webkit-backdrop-filter;transition-property:color,background-color,border-color,text-decoration-color,fill,stroke,opacity,box-shadow,transform,filter,backdrop-filter;transition-property:color,background-color,border-color,text-decoration-color,fill,stroke,opacity,box-shadow,transform,filter,backdrop-filter,-webkit-backdrop-filter;transition-timing-function:cubic-bezier(.4,0,.2,1);transition-duration:.15s}.ease-in-out{transition-timing-function:cubic-bezier(.4,0,.2,1)}.hover\\:cursor-pointer:hover{cursor:pointer}.hover\\:bg-blue-700:hover{--tw-bg-opacity: 1;background-color:rgb(29,78,216,var(--tw-bg-opacity))}.hover\\:bg-photon-blue-dark:hover{--tw-bg-opacity: 1;background-color:rgb(43,108,176,var(--tw-bg-opacity))}.hover\\:text-gray-600:hover{--tw-text-opacity: 1;color:rgb(75,85,99,var(--tw-text-opacity))}.hover\\:underline:hover{text-decoration-line:underline}.disabled\\:bg-gray-500:disabled{--tw-bg-opacity: 1;background-color:rgb(107,114,128,var(--tw-bg-opacity))}@media (min-width: 475px){.xs\\:mx-auto{margin-left:auto;margin-right:auto}.xs\\:\\!w-auto{width:auto!important}.xs\\:min-w-\\[40\\%\\]{min-width:40%}.xs\\:min-w-\\[48\\%\\]{min-width:48%}.xs\\:flex-row{flex-direction:row}.xs\\:gap-4{gap:1rem}.xs\\:pb-2{padding-bottom:.5rem}.xs\\:pt-28{padding-top:7rem}.xs\\:text-base{font-size:1rem;line-height:1.5rem}}@media (min-width: 640px){.sm\\:order-first{order:-9999}.sm\\:mt-0{margin-top:0}.sm\\:inline{display:inline}.sm\\:grid{display:grid}.sm\\:w-\\[600px\\]{width:600px}.sm\\:w-auto{width:auto}.sm\\:flex-none{flex:none}.sm\\:grid-cols-2{grid-template-columns:repeat(2,minmax(0,1fr))}.sm\\:gap-3{gap:.75rem}.sm\\:gap-4{gap:1rem}.sm\\:py-2{padding-top:.5rem;padding-bottom:.5rem}}@media (min-width: 768px){.md\\:static{position:static}.md\\:mb-0{margin-bottom:0}.md\\:flex{display:flex}.md\\:flex-1{flex:1 1 0%}.md\\:flex-row{flex-direction:row}.md\\:justify-center{justify-content:center}.md\\:px-4{padding-left:1rem;padding-right:1rem}.md\\:px-8{padding-left:2rem;padding-right:2rem}.md\\:py-2{padding-top:.5rem;padding-bottom:.5rem}.md\\:py-3{padding-top:.75rem;padding-bottom:.75rem}.md\\:pb-52{padding-bottom:13rem}.md\\:pr-2{padding-right:.5rem}.md\\:pt-4{padding-top:1rem}.md\\:text-3xl{font-size:1.875rem;line-height:2.25rem}.md\\:text-xl{font-size:1.25rem;line-height:1.75rem}}@media (min-width: 1024px){.lg\\:gap-2{gap:.5rem}.lg\\:pt-20{padding-top:5rem}}';var CQ=Y("<style>"),SQ=Y('<button class="w-full disabled:bg-gray-500 bg-photon-blue hover:bg-blue-700 text-white h-10 px-4 rounded-lg font-sans hover:bg-photon-blue-dark transition ease-in-out delay-50">');const EQ=e=>{const t=Xr();return fe(()=>{t||console.error("[photon-auth-button] No valid PhotonClient instance was provided. Please ensure you are wrapping the element in a photon-client element")}),[(()=>{var r=CQ();return I(r,Ft),r})(),t?(()=>{var r=SQ();return r.$$click=async()=>{const n={appState:{}};e.redirectPath&&(n.appState.returnTo=e.redirectPath),t.authentication.state.isAuthenticated?await t.authentication.logout():await t.authentication.login(n)},I(r,()=>t.authentication.state.isAuthenticated?"Log out":"Log in"),J(()=>r.disabled=t.authentication.state.isLoading),r})():null]};Et("photon-auth-button",{redirectPath:{attribute:"redirect-path",value:void 0,reflect:!1,notify:!1,parse:!1}},EQ);Ja(["click"]);var TQ=Y("<style>"),AQ=Y(`<div class="flex flex-col w-screen max-w-sm"><svg viewBox="0 0 305 62.61"xmlns=http://www.w3.org/2000/svg class="h-[28px] pl-[19.75px]"><g fill=#273D52><path d="M0 54.1169H6.81375V35.7722H18.0826C29.5481 35.7722 34.3963 30.3343 34.3963 18.7378V17.4275C34.3963 5.76548 29.417 0.655167 18.0826 0.655167H0V54.1169ZM6.81375 30.1377V6.28961H18.2792C24.7653 6.28961 27.386 8.9758 27.386 16.0516V20.0481C27.386 27.1895 24.7653 30.1377 18.2792 30.1377H6.81375Z"></path><path d="M70.9593 54.1169H77.773V0.655167H70.9593V24.4378H50.8456V0.655167H44.0319V54.1169H50.8456V30.3343H70.9593V54.1169Z"></path><path d="M107.146 54.772C119.528 54.772 125.687 46.5169 125.687 34.9205V19.7861C125.687 8.25511 119.528 0 107.146 0C94.6974 0 88.5388 8.25511 88.5388 19.7861V34.9205C88.5388 46.5169 94.6974 54.772 107.146 54.772ZM95.5491 35.9687V18.8033C95.5491 10.7448 99.4801 5.89651 107.146 5.89651C114.745 5.89651 118.677 10.7448 118.677 18.8033V35.9687C118.677 44.0928 114.745 48.8755 107.146 48.8755C99.4801 48.8755 95.5491 44.0928 95.5491 35.9687Z"></path><path d="M144.295 54.1169H151.109V6.48616H164.54V0.655167H130.864V6.48616H144.295V54.1169Z"></path><path d="M188.299 54.772C200.682 54.772 206.841 46.5169 206.841 34.9205V19.7861C206.841 8.25511 200.682 0 188.299 0C175.851 0 169.693 8.25511 169.693 19.7861V34.9205C169.693 46.5169 175.851 54.772 188.299 54.772ZM176.703 35.9687V18.8033C176.703 10.7448 180.634 5.89651 188.299 5.89651C195.899 5.89651 199.83 10.7448 199.83 18.8033V35.9687C199.83 44.0928 195.899 48.8755 188.299 48.8755C180.634 48.8755 176.703 44.0928 176.703 35.9687Z"></path><path d="M217.6 54.1169H224.021V14.3482L245.576 54.1169H252.608L248.058 45.1084L245.641 40.4239L224.086 0.655167H217.6V54.1169Z"></path></g><g fill=#B35724><circle cx=249.798 cy=5.202 r=5.202></circle></g></svg><h1 class="font-medium text-3xl text-center font-sans mt-6 mb-3">Log in to your account</h1><p class="text-gray-500 font-sans text-center mb-8">Don't have an account? <a href=mailto:rado@photon.health class="text-teal-600 hover:underline hover:cursor-pointer font-sans font-light">Contact Sales</a></p><photon-auth-button>`,!0,!1,!1);const OQ=e=>{const t=Xr();return fe(()=>{t||console.error("[photon-login] No valid PhotonClient instance was provided. Please ensure you are wrapping the element in a photon-client element")}),[(()=>{var r=TQ();return I(r,Ft),r})(),(()=>{var r=AQ(),n=r.firstChild,i=n.nextSibling,a=i.nextSibling,o=a.nextSibling;return o._$owner=ce(),J(()=>o.redirectPath=e.redirectPath),r})()]};Et("photon-login",{redirectPath:{attribute:"redirect-path",value:void 0,reflect:!1,notify:!1,parse:!1}},OQ);const yd=(e,t)=>{let r;const n=()=>clearTimeout(r);return ce()&&Er(n),Object.assign((...a)=>{r!==void 0&&n(),r=setTimeout(()=>e(...a),t)},{clear:n})};/**
1434
1434
  * @license
1435
1435
  * Copyright 2019 Google LLC
1436
1436
  * SPDX-License-Identifier: BSD-3-Clause
@@ -3721,7 +3721,7 @@ In order to be iterable, non-array objects must have a [Symbol.iterator]() metho
3721
3721
  }
3722
3722
  `;function wJ(e){let t;const{draftPrescriptions:r}=hd(),{routingConstraints:n,tryUpdatePrescriptionStates:i,orderFormData:a}=ao(),o=R(()=>r().map(we=>we.id)),s=Xr(),[l,d]=H(!e.templateIds&&!e.prescriptionIds),[c,u]=H([]),[h,f]=H(!0),[p,m]=H(!1),[v,g]=H(s?.authentication.state.isAuthenticated||!1),[,w]=Is(),[$,_]=H([]),[C,E]=H(!1),[P,M]=H(!1);let F="";e.additionalNotes&&(F=`${e.additionalNotes}
3723
3723
 
3724
- `),e.weight&&(F=`${F}${hJ(e.weight,e?.weightUnit)}`),bt(()=>{e.address&&e.formActions.updateFormValue({key:"address",value:e.address}),t.addEventListener("photon-ticket-created-duplicate",()=>{Ec(e.formActions,F?{notes:F}:void 0)})}),fe(()=>{!s?.authentication.state.isAuthenticated&&!s?.authentication.state.isLoading&&!s?.authentication.state.error&&s?.autoLogin&&s?.authentication.login({appState:{returnTo:window.location.pathname}})}),fe(()=>{f(s?.authentication.state.isLoading||!1)}),fe(()=>{g(s?.authentication.state.isAuthenticated||!1)});const V=R(()=>Th(["write:prescription"],s?.authentication.state.permissions||[])),T=R(()=>{const we=e.formStore?.address?.value??e.formStore?.patient?.value?.address??{},{__typename:De,name:Ze,...ue}=we;return{street2:"",country:"US",...ue}}),L=we=>{const De=new CustomEvent("photon-prescriptions-created",{composed:!0,bubbles:!0,detail:{prescriptions:we}});t?.dispatchEvent(De)},N=we=>{const De=new CustomEvent("photon-draft-prescription-created",{composed:!0,bubbles:!0,detail:{draft:we}});t?.dispatchEvent(De)},A=we=>{const De=new CustomEvent("photon-order-created",{composed:!0,bubbles:!0,detail:{order:we}});t?.dispatchEvent(De)},K=we=>{const De=new Set;return we.filter(Ze=>{const ue=Ze.treatment.id;return De.has(ue)?!1:(De.add(ue),!0)})},X=async()=>{const we=e.formStore.treatment?.value?.id,De=r().map(xJ);we&&De.push({treatment:{id:we}});const Ze=K(De),{data:ue}=await se.query({query:$J,variables:{patientId:e.formStore.patient?.value.id,draftedPrescriptions:Ze}});_(ue?.prescriptionScreen?.alerts??[])},ee=we=>{const De=new CustomEvent("photon-prescriptions-error",{composed:!0,bubbles:!0,detail:{errors:we}});t?.dispatchEvent(De)},q=(we=[])=>{const De=new CustomEvent("photon-order-error",{composed:!0,bubbles:!0,detail:{errors:we}});t?.dispatchEvent(De)},j=we=>{const De=new CustomEvent("photon-form-validate",{composed:!0,bubbles:!0,detail:{canSubmit:we,form:e.formStore,actions:e.formActions}});t?.dispatchEvent(De)},G=()=>{M(!0)},be=()=>w.setIsCombineDialogOpen(!0,()=>Q(e.enableOrder),T()),Q=async we=>{if(h())return;if(u([]),E(!1),!V())return nr({status:"error",header:"Unauthorized",body:"You do not have permission to prescribe"});const De=we?["patient","address"]:["patient"];e.formActions.validate(De);const Ze=e.formActions.getErrors(De);Ze.length===0?(f(!0),e.formActions.updateFormValue({key:"errors",value:[]}),e.enableOrder?await $e():await pe(),L(r())):u(Ze)},pe=async()=>{try{await i(o(),Z8.Active)}catch(we){ee([we])}f(!1)},$e=async()=>{const we=s.getSDK().clinical.order.createOrder({}),De=s.getSDK().clinical.patient.removePatientPreferredPharmacy({}),Ze=s.getSDK().clinical.patient.updatePatient({});try{if(e.formStore.updatePreferredPharmacy?.value&&a.pharmacyId&&e.formStore.fulfillmentType?.value==="PICK_UP"){const Ie=e.formStore.patient?.value;Ie?.preferredPharmacies&&Ie?.preferredPharmacies?.length>0&&De({variables:{patientId:Ie.id,pharmacyId:Ie.preferredPharmacies[0].id},awaitRefetchQueries:!1}),Ze({variables:{id:Ie.id,preferredPharmacies:[a.pharmacyId]},awaitRefetchQueries:!1})}let ue=e.pharmacyId;a.pharmacyId&&(ue=a.pharmacyId);const{data:te,errors:Ee}=await we({variables:{...e.externalOrderId?{externalId:e.externalOrderId}:{},patientId:e.formStore.patient?.value.id,pharmacyId:ue,fulfillmentType:e.formStore.fulfillmentType?.value||"",address:T(),fills:o().map(Ie=>({prescriptionId:Ie}))},refetchQueries:[],awaitRefetchQueries:!1});if(f(!1),Ee){q(Ee);return}A(te.createOrder)}catch(ue){q([ue]),f(!1),nr({status:"error",header:"Error Creating Order",body:ue?.message})}},oe=()=>$().length>0&&C()===!1?G():e.enableCombineAndDuplicate&&w.hasRoutingOrder()?be():Q(e.enableOrder);fe(()=>{e.triggerSubmit&&Re(()=>oe())}),fe(()=>{j(!!(r().length>0&&e.formStore.patient?.value))});const se=s.sdk.apolloClinical;let Pe;const Me=R(()=>!e.patientId||e.patientId===e.formStore.patient?.value?.id||e.patientId===e.formStore.patient?.value?.externalId),at=we=>{N(we),p()&&m(!1)};return(()=>{var we=yJ(),De=we.firstChild,Ze=De.nextSibling,ue=Ze.nextSibling,te=ue.nextSibling,Ee=te.nextSibling,Ie=Ee.nextSibling,ot=Ie.firstChild,Ge=t;return typeof Ge=="function"?ze(Ge,we):t=we,I(De,Ft),I(Ze,Ur),I(ue,qr),I(te,uJ),I(Ee,ai),I(we,b(Z,{get when(){return R(()=>!!(P()&&$().length>0))()&&!C()},get children(){return b(bB,{get alerts(){return $()},get isOpen(){return P()},onIgnoreWarningAndCreateAnyway:()=>{f(!1),E(!0),M(!1);const Be=new CustomEvent("photon-clinical-alert-acknowledge",{composed:!0,bubbles:!0,detail:{alerts:$()}});oe(),t?.dispatchEvent(Be)},onRevisitPrescriptions:()=>{f(!1),M(!1);const Be=new CustomEvent("photon-clinical-alert-cancel",{composed:!0,bubbles:!0,detail:{alerts:$()}});t?.dispatchEvent(Be)}})}}),Ie),I(we,b(Z,{get when(){return e.enableCombineAndDuplicate},get children(){return[b(gi.DuplicateDialog,{}),b(gi.CombineDialog,{}),b(gi.IssueDialog,{})]}}),Ie),I(Ie,b(jW,{get buffer(){return e?.toastBuffer||0}}),ot),I(ot,b(Z,{get when(){return R(()=>!!(!s||h()))()&&!v()},get children(){var Be=pJ();return I(Be,b(ti,{color:"green"})),Be}}),null),I(ot,b(P8,{permissions:["read:patient"],get children(){return b(XW,{client:se,get children(){return[b(Z,{get when(){return!V()},get children(){return b(B2,{type:"warning",header:"You do not have permission to prescribe",message:"You have access to see the form but you will not be able to submit an order."})}}),b(oJ,{get actions(){return e.formActions},get store(){return e.formStore},get patientId(){return e.patientId},client:s,get enableOrder(){return e.enableOrder},get address(){return e.address},get weight(){return e.weight},get weightUnit(){return e.weightUnit},get enableMedHistory(){return e.enableMedHistory},get enableMedHistoryLinks(){return e.enableMedHistoryLinks??!1},get enableMedHistoryRefillButton(){return e.enableMedHistoryRefillButton??!1},get hidePatientCard(){return e.hidePatientCard}}),b(Z,{get when(){return Me()&&(e.formStore.patient?.value?.address||e.formStore.patient?.value?.id&&!e.enableOrder)},get children(){return[b(Z,{get when(){return e.enableCombineAndDuplicate},get children(){return b(gi.Card,{})}}),b(Z,{get when(){return l()||p()},get children(){var Be=mJ(),Xe=Pe;return typeof Xe=="function"?ze(Xe,Be):Pe=Be,I(Be,b(qX,{get hideAddToTemplates(){return e.hideTemplates},get actions(){return e.formActions},get store(){return e.formStore},get weight(){return e.weight},get weightUnit(){return e.weightUnit},prefillNotes:F,get enableCombineAndDuplicate(){return e.enableCombineAndDuplicate},screenDraftedPrescriptions:function(){X()},draftedPrescriptionChanged:function(){X()},onDraftPrescriptionCreated:at,get screeningAlerts(){return $()},get catalogId(){return e.catalogId},get allowOffCatalogSearch(){return e.allowOffCatalogSearch},get enableOrder(){return e.enableOrder}})),Be}}),b(GX,{prescriptionRef:Pe,get actions(){return e.formActions},get store(){return e.formStore},setIsEditing:m,handleDraftPrescriptionsChange:function(){X()},get screeningAlerts(){return $()},get routingConstraints(){return n()},get enableOrder(){return e.enableOrder}}),b(Z,{get when(){return e.enableOrder&&!e.pharmacyId},get children(){return b(XX,{get store(){return e.formStore},get actions(){return e.formActions},get enableLocalPickup(){return e.enableLocalPickup},get enableSendToPatient(){return e.enableSendToPatient},get enableDeliveryPharmacies(){return e.enableDeliveryPharmacies},get mailOrderIds(){return e.mailOrderIds}})}}),b(Z,{get when(){return e.enableOrder&&e.pharmacyId},get children(){return b(cJ,{get pharmacyId(){return e.pharmacyId}})}}),b(Z,{get when(){return!e.hideSubmit},get children(){return[b(Z,{get when(){return c().length>0&&e.enableOrder},get children(){var Be=gJ();return I(Be,b(kt,{get each(){return c()},get fallback(){return bJ()},children:({key:Xe,error:Zt})=>b(B2,{type:"warning",header:`Error with ${Xe}`,message:Zt})})),Be}}),(()=>{var Be=vJ();return I(Be,b(Z,{get when(){return!l()},get children(){return b(lt,{variant:"secondary",onClick:()=>d(!0),children:"Add Prescription"})}}),null),I(Be,b(lt,{get loading(){return h()},onClick:oe,get children(){return e.enableOrder?"Send Order":"Save Prescriptions"}}),null),Be})()]}})]}})]}})}}),null),we})()}const xJ=e=>({dispenseAsWritten:e.dispenseAsWritten||void 0,dispenseQuantity:e.dispenseQuantity,dispenseUnit:e.dispenseUnit,fillsAllowed:e.fillsAllowed,daysSupply:e.daysSupply||void 0,instructions:e.instructions,notes:e.notes||void 0,effectiveDate:e.effectiveDate,treatment:{id:e.treatment.id}}),kJ=e=>{const{actions:t}=xd,{store:r,actions:n}=A8({dispenseAsWritten:!1,patient:void 0,treatment:void 0,pharmacy:void 0,errors:[],address:void 0});return Er(()=>{t.clearSelectedPatient(),n.reset()}),b(lj,{get children(){return b(gi,{get patientId(){return r.patient?.value?.id},get children(){return b(Hq,{get templateIdsPrefill(){return e.templateIds?.split(",").map(i=>i.trim())||[]},get templateOverrides(){return e.templateOverrides||{}},get prescriptionIdsPrefill(){return e.prescriptionIds?.split(",").map(i=>i.trim())||[]},get patientId(){return r.patient?.value?.id},get enableCombineAndDuplicate(){return e.enableCombineAndDuplicate},get enableCoverageCheck(){return e.enableCoverageCheck},get children(){return b(wJ,{get patientId(){return e.patientId},get templateIds(){return e.templateIds},get templateOverrides(){return e.templateOverrides},get prescriptionIds(){return e.prescriptionIds},get hideSubmit(){return e.hideSubmit},get hideTemplates(){return e.hideTemplates},get hidePatientCard(){return e.hidePatientCard},get enableOrder(){return e.enableOrder},get enableLocalPickup(){return e.enableLocalPickup},get enableSendToPatient(){return e.enableSendToPatient},get enableDeliveryPharmacies(){return e.enableDeliveryPharmacies},get enableMedHistory(){return e.enableMedHistory},get enableMedHistoryLinks(){return e.enableMedHistoryLinks},get enableMedHistoryRefillButton(){return e.enableMedHistoryRefillButton},get enableCombineAndDuplicate(){return e.enableCombineAndDuplicate},get enableCoverageCheck(){return e.enableCoverageCheck},get mailOrderIds(){return e.mailOrderIds},get pharmacyId(){return e.pharmacyId},get loading(){return e.loading},get address(){return e.address},get weight(){return e.weight},get weightUnit(){return e.weightUnit},get additionalNotes(){return e.additionalNotes},get triggerSubmit(){return e.triggerSubmit},get toastBuffer(){return e.toastBuffer},formStore:r,formActions:n,get externalOrderId(){return e.externalOrderId},get catalogId(){return e.catalogId},get allowOffCatalogSearch(){return e.allowOffCatalogSearch}})}})}})}})};Et("photon-prescribe-workflow",{patientId:void 0,templateIds:void 0,templateOverrides:void 0,prescriptionIds:void 0,hideSubmit:!1,hideTemplates:!1,hidePatientCard:!1,enableOrder:!1,enableLocalPickup:!1,enableSendToPatient:!1,enableDeliveryPharmacies:!0,enableCombineAndDuplicate:!1,enableMedHistory:!1,enableMedHistoryRefillButton:!1,enableMedHistoryLinks:!1,mailOrderIds:void 0,pharmacyId:void 0,loading:!1,address:void 0,weight:void 0,weightUnit:"lbs",additionalNotes:void 0,triggerSubmit:!1,setTriggerSubmit:void 0,toastBuffer:0,externalOrderId:void 0,catalogId:void 0,allowOffCatalogSearch:!0,enableCoverageCheck:!1},kJ);var _J=Y('<p class="font-sans text-l font-medium mb-2">'),CJ=Y("<sl-icon-button class=self-start>",!0,!1,!1),SJ=Y("<style>"),EJ=Y('<div class="rounded-lg bg-white p-4 shadow-card border border-gray-200">'),TJ=Y('<div class="flex flex-row justify-between">'),AJ=Y("<slot>");const OJ=e=>{const[t,r]=H(!0);let n=null,i=null;return e.title&&(n=(()=>{var a=_J();return I(a,()=>e.title),a})()),e.collapsable&&(i=(()=>{var a=CJ();return le(a,"click",()=>{r(!t())}),a._$owner=ce(),J(()=>a.name=t()?"chevron-right":"chevron-down"),a})()),[(()=>{var a=SJ();return I(a,Ft),a})(),(()=>{var a=EJ();return I(a,n||i?(()=>{var o=TJ();return I(o,n,null),I(o,i,null),o})():null,null),I(a,(()=>{var o=R(()=>!!(e.collapsable&&t()));return()=>o()?null:(()=>{var s=AJ();return s._$owner=ce(),s})()})(),null),J(o=>{var s=!!e.invalid,l=!!e.invalid;return s!==o.e&&a.classList.toggle("border-red-400",o.e=s),l!==o.t&&a.classList.toggle("border-2",o.t=l),o},{e:void 0,t:void 0}),a})()]};Et("photon-card",{invalid:!1,title:null,collapsable:!1},OJ);const IJ=_e`
3724
+ `),e.weight&&(F=`${F}${hJ(e.weight,e?.weightUnit)}`),bt(()=>{e.address&&e.formActions.updateFormValue({key:"address",value:e.address}),t.addEventListener("photon-ticket-created-duplicate",()=>{Ec(e.formActions,F?{notes:F}:void 0)})}),fe(()=>{!s?.authentication.state.isAuthenticated&&!s?.authentication.state.isLoading&&!s?.authentication.state.error&&s?.autoLogin&&s?.authentication.login({appState:{returnTo:window.location.pathname}})}),fe(()=>{f(s?.authentication.state.isLoading||!1)}),fe(()=>{g(s?.authentication.state.isAuthenticated||!1)});const V=R(()=>Th(["write:prescription"],s?.authentication.state.permissions||[])),T=R(()=>{const we=e.formStore?.address?.value??e.formStore?.patient?.value?.address??{},{__typename:De,name:Ze,...ue}=we;return{street2:"",country:"US",...ue}}),L=we=>{const De=new CustomEvent("photon-prescriptions-created",{composed:!0,bubbles:!0,detail:{prescriptions:we}});t?.dispatchEvent(De)},N=we=>{const De=new CustomEvent("photon-draft-prescription-created",{composed:!0,bubbles:!0,detail:{draft:we}});t?.dispatchEvent(De)},A=we=>{const De=new CustomEvent("photon-order-created",{composed:!0,bubbles:!0,detail:{order:we}});t?.dispatchEvent(De)},K=we=>{const De=new Set;return we.filter(Ze=>{const ue=Ze.treatment.id;return De.has(ue)?!1:(De.add(ue),!0)})},X=async()=>{const we=e.formStore.treatment?.value?.id,De=r().map(xJ);we&&De.push({treatment:{id:we}});const Ze=K(De),{data:ue}=await se.query({query:$J,variables:{patientId:e.formStore.patient?.value.id,draftedPrescriptions:Ze}});_(ue?.prescriptionScreen?.alerts??[])},ee=we=>{const De=new CustomEvent("photon-prescriptions-error",{composed:!0,bubbles:!0,detail:{errors:we}});t?.dispatchEvent(De)},q=(we=[])=>{const De=new CustomEvent("photon-order-error",{composed:!0,bubbles:!0,detail:{errors:we}});t?.dispatchEvent(De)},j=we=>{const De=new CustomEvent("photon-form-validate",{composed:!0,bubbles:!0,detail:{canSubmit:we,form:e.formStore,actions:e.formActions}});t?.dispatchEvent(De)},G=()=>{M(!0)},be=()=>w.setIsCombineDialogOpen(!0,()=>Q(e.enableOrder),T()),Q=async we=>{if(h())return;if(u([]),E(!1),!V())return nr({status:"error",header:"Unauthorized",body:"You do not have permission to prescribe"});const De=we?["patient","address"]:["patient"];e.formActions.validate(De);const Ze=e.formActions.getErrors(De);Ze.length===0?(f(!0),e.formActions.updateFormValue({key:"errors",value:[]}),e.enableOrder?await $e():await pe(),L(r())):u(Ze)},pe=async()=>{try{await i(o(),Z8.Active)}catch(we){ee([we])}f(!1)},$e=async()=>{const we=s.getSDK().clinical.order.createOrder({}),De=s.getSDK().clinical.patient.removePatientPreferredPharmacy({}),Ze=s.getSDK().clinical.patient.updatePatient({});try{if(e.formStore.updatePreferredPharmacy?.value&&a.pharmacyId&&e.formStore.fulfillmentType?.value==="PICK_UP"){const Ie=e.formStore.patient?.value;Ie?.preferredPharmacies&&Ie?.preferredPharmacies?.length>0&&De({variables:{patientId:Ie.id,pharmacyId:Ie.preferredPharmacies[0].id},awaitRefetchQueries:!1}),Ze({variables:{id:Ie.id,preferredPharmacies:[a.pharmacyId]},awaitRefetchQueries:!1})}let ue=e.pharmacyId;a.pharmacyId&&(ue=a.pharmacyId),ue||(ue="");const{data:te,errors:Ee}=await we({variables:{...e.externalOrderId?{externalId:e.externalOrderId}:{},patientId:e.formStore.patient?.value.id,pharmacyId:ue,fulfillmentType:e.formStore.fulfillmentType?.value||"",address:T(),fills:o().map(Ie=>({prescriptionId:Ie}))},refetchQueries:[],awaitRefetchQueries:!1});if(f(!1),Ee){q(Ee);return}A(te.createOrder)}catch(ue){q([ue]),f(!1),nr({status:"error",header:"Error Creating Order",body:ue?.message})}},oe=()=>$().length>0&&C()===!1?G():e.enableCombineAndDuplicate&&w.hasRoutingOrder()?be():Q(e.enableOrder);fe(()=>{e.triggerSubmit&&Re(()=>oe())}),fe(()=>{j(!!(r().length>0&&e.formStore.patient?.value))});const se=s.sdk.apolloClinical;let Pe;const Me=R(()=>!e.patientId||e.patientId===e.formStore.patient?.value?.id||e.patientId===e.formStore.patient?.value?.externalId),at=we=>{N(we),p()&&m(!1)};return(()=>{var we=yJ(),De=we.firstChild,Ze=De.nextSibling,ue=Ze.nextSibling,te=ue.nextSibling,Ee=te.nextSibling,Ie=Ee.nextSibling,ot=Ie.firstChild,Ge=t;return typeof Ge=="function"?ze(Ge,we):t=we,I(De,Ft),I(Ze,Ur),I(ue,qr),I(te,uJ),I(Ee,ai),I(we,b(Z,{get when(){return R(()=>!!(P()&&$().length>0))()&&!C()},get children(){return b(bB,{get alerts(){return $()},get isOpen(){return P()},onIgnoreWarningAndCreateAnyway:()=>{f(!1),E(!0),M(!1);const Be=new CustomEvent("photon-clinical-alert-acknowledge",{composed:!0,bubbles:!0,detail:{alerts:$()}});oe(),t?.dispatchEvent(Be)},onRevisitPrescriptions:()=>{f(!1),M(!1);const Be=new CustomEvent("photon-clinical-alert-cancel",{composed:!0,bubbles:!0,detail:{alerts:$()}});t?.dispatchEvent(Be)}})}}),Ie),I(we,b(Z,{get when(){return e.enableCombineAndDuplicate},get children(){return[b(gi.DuplicateDialog,{}),b(gi.CombineDialog,{}),b(gi.IssueDialog,{})]}}),Ie),I(Ie,b(jW,{get buffer(){return e?.toastBuffer||0}}),ot),I(ot,b(Z,{get when(){return R(()=>!!(!s||h()))()&&!v()},get children(){var Be=pJ();return I(Be,b(ti,{color:"green"})),Be}}),null),I(ot,b(P8,{permissions:["read:patient"],get children(){return b(XW,{client:se,get children(){return[b(Z,{get when(){return!V()},get children(){return b(B2,{type:"warning",header:"You do not have permission to prescribe",message:"You have access to see the form but you will not be able to submit an order."})}}),b(oJ,{get actions(){return e.formActions},get store(){return e.formStore},get patientId(){return e.patientId},client:s,get enableOrder(){return e.enableOrder},get address(){return e.address},get weight(){return e.weight},get weightUnit(){return e.weightUnit},get enableMedHistory(){return e.enableMedHistory},get enableMedHistoryLinks(){return e.enableMedHistoryLinks??!1},get enableMedHistoryRefillButton(){return e.enableMedHistoryRefillButton??!1},get hidePatientCard(){return e.hidePatientCard}}),b(Z,{get when(){return Me()&&(e.formStore.patient?.value?.address||e.formStore.patient?.value?.id&&!e.enableOrder)},get children(){return[b(Z,{get when(){return e.enableCombineAndDuplicate},get children(){return b(gi.Card,{})}}),b(Z,{get when(){return l()||p()},get children(){var Be=mJ(),Xe=Pe;return typeof Xe=="function"?ze(Xe,Be):Pe=Be,I(Be,b(qX,{get hideAddToTemplates(){return e.hideTemplates},get actions(){return e.formActions},get store(){return e.formStore},get weight(){return e.weight},get weightUnit(){return e.weightUnit},prefillNotes:F,get enableCombineAndDuplicate(){return e.enableCombineAndDuplicate},screenDraftedPrescriptions:function(){X()},draftedPrescriptionChanged:function(){X()},onDraftPrescriptionCreated:at,get screeningAlerts(){return $()},get catalogId(){return e.catalogId},get allowOffCatalogSearch(){return e.allowOffCatalogSearch},get enableOrder(){return e.enableOrder}})),Be}}),b(GX,{prescriptionRef:Pe,get actions(){return e.formActions},get store(){return e.formStore},setIsEditing:m,handleDraftPrescriptionsChange:function(){X()},get screeningAlerts(){return $()},get routingConstraints(){return n()},get enableOrder(){return e.enableOrder}}),b(Z,{get when(){return e.enableOrder&&!e.pharmacyId},get children(){return b(XX,{get store(){return e.formStore},get actions(){return e.formActions},get enableLocalPickup(){return e.enableLocalPickup},get enableSendToPatient(){return e.enableSendToPatient},get enableDeliveryPharmacies(){return e.enableDeliveryPharmacies},get mailOrderIds(){return e.mailOrderIds}})}}),b(Z,{get when(){return e.enableOrder&&e.pharmacyId},get children(){return b(cJ,{get pharmacyId(){return e.pharmacyId}})}}),b(Z,{get when(){return!e.hideSubmit},get children(){return[b(Z,{get when(){return c().length>0&&e.enableOrder},get children(){var Be=gJ();return I(Be,b(kt,{get each(){return c()},get fallback(){return bJ()},children:({key:Xe,error:Zt})=>b(B2,{type:"warning",header:`Error with ${Xe}`,message:Zt})})),Be}}),(()=>{var Be=vJ();return I(Be,b(Z,{get when(){return!l()},get children(){return b(lt,{variant:"secondary",onClick:()=>d(!0),children:"Add Prescription"})}}),null),I(Be,b(lt,{get loading(){return h()},onClick:oe,get children(){return e.enableOrder?"Send Order":"Save Prescriptions"}}),null),Be})()]}})]}})]}})}}),null),we})()}const xJ=e=>({dispenseAsWritten:e.dispenseAsWritten||void 0,dispenseQuantity:e.dispenseQuantity,dispenseUnit:e.dispenseUnit,fillsAllowed:e.fillsAllowed,daysSupply:e.daysSupply||void 0,instructions:e.instructions,notes:e.notes||void 0,effectiveDate:e.effectiveDate,treatment:{id:e.treatment.id}}),kJ=e=>{const{actions:t}=xd,{store:r,actions:n}=A8({dispenseAsWritten:!1,patient:void 0,treatment:void 0,pharmacy:void 0,errors:[],address:void 0});return Er(()=>{t.clearSelectedPatient(),n.reset()}),b(lj,{get children(){return b(gi,{get patientId(){return r.patient?.value?.id},get children(){return b(Hq,{get templateIdsPrefill(){return e.templateIds?.split(",").map(i=>i.trim())||[]},get templateOverrides(){return e.templateOverrides||{}},get prescriptionIdsPrefill(){return e.prescriptionIds?.split(",").map(i=>i.trim())||[]},get patientId(){return r.patient?.value?.id},get enableCombineAndDuplicate(){return e.enableCombineAndDuplicate},get enableCoverageCheck(){return e.enableCoverageCheck},get children(){return b(wJ,{get patientId(){return e.patientId},get templateIds(){return e.templateIds},get templateOverrides(){return e.templateOverrides},get prescriptionIds(){return e.prescriptionIds},get hideSubmit(){return e.hideSubmit},get hideTemplates(){return e.hideTemplates},get hidePatientCard(){return e.hidePatientCard},get enableOrder(){return e.enableOrder},get enableLocalPickup(){return e.enableLocalPickup},get enableSendToPatient(){return e.enableSendToPatient},get enableDeliveryPharmacies(){return e.enableDeliveryPharmacies},get enableMedHistory(){return e.enableMedHistory},get enableMedHistoryLinks(){return e.enableMedHistoryLinks},get enableMedHistoryRefillButton(){return e.enableMedHistoryRefillButton},get enableCombineAndDuplicate(){return e.enableCombineAndDuplicate},get enableCoverageCheck(){return e.enableCoverageCheck},get mailOrderIds(){return e.mailOrderIds},get pharmacyId(){return e.pharmacyId},get loading(){return e.loading},get address(){return e.address},get weight(){return e.weight},get weightUnit(){return e.weightUnit},get additionalNotes(){return e.additionalNotes},get triggerSubmit(){return e.triggerSubmit},get toastBuffer(){return e.toastBuffer},formStore:r,formActions:n,get externalOrderId(){return e.externalOrderId},get catalogId(){return e.catalogId},get allowOffCatalogSearch(){return e.allowOffCatalogSearch}})}})}})}})};Et("photon-prescribe-workflow",{patientId:void 0,templateIds:void 0,templateOverrides:void 0,prescriptionIds:void 0,hideSubmit:!1,hideTemplates:!1,hidePatientCard:!1,enableOrder:!1,enableLocalPickup:!1,enableSendToPatient:!1,enableDeliveryPharmacies:!0,enableCombineAndDuplicate:!1,enableMedHistory:!1,enableMedHistoryRefillButton:!1,enableMedHistoryLinks:!1,mailOrderIds:void 0,pharmacyId:void 0,loading:!1,address:void 0,weight:void 0,weightUnit:"lbs",additionalNotes:void 0,triggerSubmit:!1,setTriggerSubmit:void 0,toastBuffer:0,externalOrderId:void 0,catalogId:void 0,allowOffCatalogSearch:!0,enableCoverageCheck:!1},kJ);var _J=Y('<p class="font-sans text-l font-medium mb-2">'),CJ=Y("<sl-icon-button class=self-start>",!0,!1,!1),SJ=Y("<style>"),EJ=Y('<div class="rounded-lg bg-white p-4 shadow-card border border-gray-200">'),TJ=Y('<div class="flex flex-row justify-between">'),AJ=Y("<slot>");const OJ=e=>{const[t,r]=H(!0);let n=null,i=null;return e.title&&(n=(()=>{var a=_J();return I(a,()=>e.title),a})()),e.collapsable&&(i=(()=>{var a=CJ();return le(a,"click",()=>{r(!t())}),a._$owner=ce(),J(()=>a.name=t()?"chevron-right":"chevron-down"),a})()),[(()=>{var a=SJ();return I(a,Ft),a})(),(()=>{var a=EJ();return I(a,n||i?(()=>{var o=TJ();return I(o,n,null),I(o,i,null),o})():null,null),I(a,(()=>{var o=R(()=>!!(e.collapsable&&t()));return()=>o()?null:(()=>{var s=AJ();return s._$owner=ce(),s})()})(),null),J(o=>{var s=!!e.invalid,l=!!e.invalid;return s!==o.e&&a.classList.toggle("border-red-400",o.e=s),l!==o.t&&a.classList.toggle("border-2",o.t=l),o},{e:void 0,t:void 0}),a})()]};Et("photon-card",{invalid:!1,title:null,collapsable:!1},OJ);const IJ=_e`
3725
3725
  fragment CatalogFields on Catalog {
3726
3726
  id
3727
3727
  }
package/dist/index.mjs CHANGED
@@ -41077,7 +41077,7 @@ const G6 = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
41077
41077
  function Th(e, t) {
41078
41078
  return e.every((r) => t.includes(r));
41079
41079
  }
41080
- const bQ = "0.16.1", $Q = {
41080
+ const bQ = "0.16.2", $Q = {
41081
41081
  version: bQ
41082
41082
  };
41083
41083
  var wQ = /* @__PURE__ */ Y("<slot>"), xQ = /* @__PURE__ */ Y("<div>");
@@ -53385,7 +53385,7 @@ function wJ(e) {
53385
53385
  });
53386
53386
  }
53387
53387
  let ue = e.pharmacyId;
53388
- a.pharmacyId && (ue = a.pharmacyId);
53388
+ a.pharmacyId && (ue = a.pharmacyId), ue || (ue = "");
53389
53389
  const {
53390
53390
  data: te,
53391
53391
  errors: Ee
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@photonhealth/elements",
3
- "version": "0.16.1",
3
+ "version": "0.16.2",
4
4
  "description": "",
5
5
  "main": "dist/index.js",
6
6
  "types": "./dist/index.d.ts",