1import{i as l,o as i}from"./singletons-vULbMcpX.js";import{u as a,v as m}from"./chunk-62JRHF6Z-B_bjtN1J.js";import{l as s}from"./i18n-BQ-6rFBr.js";import{m as d}from"./links-CKg8ZY3X.js";import{b as c}from"./authenticationapi-BT871eS7.js";import{J as p}from"./patientportalapi-CIm4Nx9l.js";import{h as f}from"./authority-Du9SCisR.js";function L(t){return new URL(t.url).pathname}const h={DOCTOR_PORTAL_LOGIN_REQUIRED:"DOCTOR_PORTAL_LOGIN_REQUIRED",EMAIL_LOGIN_DISABLED:"EMAIL_LOGIN_DISABLED"};function I(t){const n=t?.response;if(n?.status!==401)return null;const o=n.data?.code;return Object.values(h).includes(o)?o:null}function g(t){return/^(?:\/[a-z]{2})?\/my(?:\/|$)/.test(t)}function w(t,n,o){const r=`${t}${n}`;if(g(t)){const e=o?`&reason=${o}`:"";return`/${s(t)}/login?rp=${encodeURIComponent(r)}${e}`}return r}async function T(t,n){const o=new URLSearchParams({username:t,password:n,portal:"MAIN"});let r=null;return await i({url:"/login",method:"POST",headers:{"Content-Type":"application/x-www-form-urlencoded"},data:o}).catch(u=>{r=I(u)}),{identity:(await c()).data,formLoginError:r}}async function y(){await i({url:"/logout",method:"POST"}).catch(()=>{})}async function _(t){const n=(await c()).data,o=d(s(t)).login();if(!n.isAuthenticated)throw a(`${o}?rp=${encodeURIComponent(t)}`);if(!f(n,"PATIENT"))throw a(`${o}?rp=${encodeURIComponent(t)}&reason=patient-required`);return n}async function U(t){const n=await p().then(o=>o.data).catch(o=>{if(l(o)&&o.response?.status===401)return null;throw o});if(!n?.onboarding)throw await y(),m(w(L(t),new URL(t.url).search));return n}export{h as D,L as a,y as b,U as c,T as l,w as p,_ as r};
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.