1import{L as c}from"./NativeScrollArea-rWlNMW3d.js";import{t as m}from"./chunk-62JRHF6Z-B_bjtN1J.js";import{u as S}from"./IdentityProvider-DJouuX1J.js";import"./i18n-BQ-6rFBr.js";import"./links-CoOM0JQD.js";import"./singletons-B6uXVtua.js";import{D as O,S as N}from"./patientportalapi-Cyg47WIi.js";import{h as y}from"./authority-Du9SCisR.js";import{r as g}from"./reportClientError-BWUJ8Ln5.js";import{r as R}from"./consentHistoryCookie-BhOkTODH.js";import{C as D,a as _}from"./cookiePolicy-DsdYdTsg.js";import{a as L,o as k,b as P,C as a,i as h}from"./cookieScript-2PpOQP0C.js";import{u as U}from"./useCookieConsent-D89jRtk9.js";const C={ACCEPT_ALL:"ACCEPT_ALL",ACCEPT_SELECTED:"ACCEPT_SELECTED",REJECT:"REJECT"},r={STRICT:"STRICT",PERFORMANCE:"PERFORMANCE",TARGETING:"TARGETING",FUNCTIONALITY:"FUNCTIONALITY",UNCLASSIFIED:"UNCLASSIFIED"},p={COOKIE_BANNER:"COOKIE_BANNER",DEVICE_HISTORY_UPLOAD:"DEVICE_HISTORY_UPLOAD"},V={acceptAll:C.ACCEPT_ALL,acceptSelected:C.ACCEPT_SELECTED,reject:C.REJECT},E={strict:r.STRICT,performance:r.PERFORMANCE,targeting:r.TARGETING,functionality:r.FUNCTIONALITY,unclassified:r.UNCLASSIFIED};function f(t){return Object.keys(E).find(e=>E[e]===t)}function l(t,e){return t.length===e.length&&t.every(o=>e.includes(o))}function w(t,{now:e,policyVersion:o}){return t.documentVersion===o&&Date.parse(t.decidedAt)+D>e.getTime()}function F(t,e,o){const n=e.latest?Date.parse(e.latest.decidedAt):null,i=t.history.filter(s=>n===null||s.decidedAt.getTime()>n);if(i.length>0)return{kind:"upload",entries:i};if(!e.latest||!w(e.latest,o))return{kind:"noop"};const d=(e.latest.cookieCategories??[]).map(f);if(t.categories!==null){const s=d.filter(I=>o.offered.includes(I));if(l(t.categories,s))return{kind:"noop"};const u=t.history.at(-1);if(!u||!l(u.categories,t.categories))return{kind:"noop"}}return{kind:"applyToDevice",categories:d}}function G(t,e){return{decidedAt:t.decidedAt.toISOString(),action:V[t.action],categories:t.categories.map(o=>E[o]),documentVersion:t.policyVersion,source:e}}function $(t,e){const o=(t.cookieCategories??[]).map(f);return{decidedAt:new Date(t.decidedAt),action:L(o,e),categories:o,policyVersion:t.documentVersion}}const Y="MedonCookieConsentSynced";function K(){const t=window.CookieScript?.instance?.currentState();return{categories:t?.action?t.categories:null,history:R(document.cookie)}}async function M(t){const{data:e}=await O(),o=F(K(),e.cookies,{now:new Date,policyVersion:_,offered:k()});o.kind!=="noop"&&(o.kind==="upload"?await N({entries:o.entries.map(n=>G(n,t))}):P(o.categories),window.dispatchEvent(new Event(Y)))}let A=Promise.resolve();function T(t){A=A.then(()=>M(t)).catch(g)}function tt(){const t=S(),{consent:e}=U(),o=t.status==="ready"&&y(t.identity,"PATIENT")?t.identity.userId:null,n=e.status!=="loading";m.useEffect(()=>{o&&n&&T(p.DEVICE_HISTORY_UPLOAD)},[o,n]);const i=()=>{o&&!h()&&T(p.COOKIE_BANNER)};return c(a.accept,i),c(a.acceptAll,i),c(a.reject,i),null}export{Y as C,tt as a,$ as t};
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.