1try{let e="undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof globalThis?globalThis:"undefined"!=typeof self?self:{},o=(new e.Error).stack;o&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[o]="3693a54a-b8de-4628-9921-308420268617",e._sentryDebugIdIdentifier="sentry-dbid-3693a54a-b8de-4628-9921-308420268617")}catch(e){}"use strict";(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[983],{73169:function(e,o,t){t.d(o,{Z:function(){return M}});var r=t(85893),n=t(33041),l=t(99274),a=t(90612),i=t(49773),c=t(19645),s=t(51055),d=t(58460),u=t(22618),h=t(66350),p=t(28782),x=t(71124),f=t(6812),g=t(50319),m=t(84653),b=t(11163),v=t(67294),R=t(32743),y=t(12201),S=t(28747),j=t(8689);let C=(e,o)=>{var t,r;return{display:"flex",alignItems:"center",gap:e.spacing(3),padding:e.spacing(3),borderRadius:"".concat(e.shape.borderRadiusTokens[x.cM.SMALL],"px"),backgroundColor:o?null===(t=e.palette["layout-accent"])||void 0===t?void 0:t.main:e.palette.layout.card,border:"1px solid ".concat(o?null===(r=e.palette["layout-accent"])||void 0===r?void 0:r.foreground:e.palette.layout.border),cursor:"pointer",boxSizing:"border-box"}},E={display:"flex",flexDirection:"column",minWidth:0};var Z=e=>{let{collection:o,checked:t,onToggle:n}=e,l=(0,j.F)(),a=(0,y.Mr)(l,o.color),i=(0,y.Bg)(o.icon).solid;return(0,r.jsxs)(m.Z,{sx:C(l,t),onClick:()=>n(!t),children:[(0,r.jsx)(m.Z,{sx:{display:"flex"},onClick:e=>e.stopPropagation(),children:(0,r.jsx)(S.Z,{checked:t,onChange:n,ariaLabel:"Add to ".concat(o.name)})}),(0,r.jsx)(R.Z,{icon:i,chipColors:a}),(0,r.jsxs)(m.Z,{sx:E,children:[(0,r.jsx)(s.Z,{fontWeight:"semibold",colorScheme:x.eL.LAYOUT,colorProperty:x.g8.FOREGROUND,children:o.name}),(0,r.jsx)(s.Z,{size:"sm",colorScheme:x.eL.LAYOUT,colorProperty:x.g8.MUTED_FOREGROUND,children:"".concat(o.entryCount," record").concat(1===o.entryCount?"":"s")})]})]})},w=t(51039);let k=e=>(0,w.ty)(e.map(e=>e.name)),L=e=>{if(0===e.length)return"Records added.";if(1===e.length)return"Records added to ".concat(e[0],".");if(2===e.length)return"Records added to ".concat(e[0],", ").concat(e[1],".");let o=e.length-2;return"Records added to ".concat(e[0],", ").concat(e[1]," + ").concat(o,".")},D=(e,o)=>{let t=new Set(e),r=new Set(o);return{toAdd:o.filter(e=>!t.has(e)),toRemove:e.filter(e=>!r.has(e))}},T="Unable to add records. Please try again.",O=e=>({display:"flex",flexDirection:"column",gap:e.spacing(4)}),A=e=>({display:"flex",flexDirection:"column",gap:e.spacing(3)});var M=e=>{let{open:o,onClose:t,selectedRecords:R,onSuccess:y,mode:S="add",currentCollectionIds:j}=e,{showToast:C}=(0,h.p)(),E=(0,b.useRouter)(),{data:w,loading:M,refetch:P}=(0,f.aM)(d.L,{fetchPolicy:"cache-and-network"}),[U]=(0,g.D)(u.f3,{refetchQueries:"active",awaitRefetchQueries:!0}),[I]=(0,g.D)(u.Sf,{refetchQueries:"active",awaitRefetchQueries:!0}),N="manage"===S,[F,_]=(0,v.useState)(""),[W,V]=(0,v.useState)(new Set),[Y,z]=(0,v.useState)(!1),[G,Q]=(0,v.useState)(!1),H=(0,v.useRef)(!0);(0,v.useEffect)(()=>(H.current=!0,()=>{H.current=!1}),[]);let K=(0,v.useRef)(!1),X=(0,v.useMemo)(()=>N&&null!=j?j:[],[N,j]);(0,v.useEffect)(()=>{o&&(_(""),V(new Set(X)),Q(!1))},[o]);let $=(0,v.useMemo)(()=>{var e;return null!==(e=null==w?void 0:w.resourceCollections)&&void 0!==e?e:[]},[w]);(0,v.useEffect)(()=>{if(!o){K.current=!1;return}N||M||K.current||0!==$.length||(K.current=!0,z(!0))},[o,M,N,$.length]);let B=(0,v.useMemo)(()=>{let e=F.trim().toLowerCase();return e?$.filter(o=>o.name.toLowerCase().includes(e)):$},[$,F]),q=(0,v.useMemo)(()=>R.map(e=>({novelliaResourceId:e.novelliaResourceId,patientPortalResourceType:e.patientPortalResourceType})),[R]),{toAdd:J,toRemove:ee}=(0,v.useMemo)(()=>D(X,Array.from(W)),[X,W]),eo=J.length>0||ee.length>0,et=G||(N?!eo:0===W.size),er=(e,o)=>{V(t=>{let r=new Set(t);return o?r.add(e):r.delete(e),r})},en=async()=>{if(et)return;p.j.button.clicked({name:p.EK.AddToCollection,label:N?"manage":"add"}),Q(!0);let e=N?await Promise.all([...J.map(e=>U({variables:{input:{resourceCollectionId:e,resources:q}}})),...ee.map(e=>I({variables:{input:{resourceCollectionId:e,resources:q}}}))]):await Promise.all(Array.from(W).map(e=>U({variables:{input:{resourceCollectionId:e,resources:q}}})));if(!H.current)return;Q(!1);let o=e.find(e=>{let{errors:o}=e;return o&&o.length>0});if(o){var r,n;C({colorScheme:x.eL.ERROR,header:(null===(n=o.errors)||void 0===n?void 0:null===(r=n[0])||void 0===r?void 0:r.message)||(N?"Unable to update collections. Please try again.":T)});return}if(N)C({colorScheme:x.eL.SUCCESS,colorVariant:x.bo.REVERSED,header:"Collections updated"});else{let e=$.filter(e=>W.has(e.id)),o=1===e.length?e[0]:void 0;C({colorScheme:x.eL.SUCCESS,colorVariant:x.bo.REVERSED,header:L(e.map(e=>e.name)),...o?{action:{label:"View collection",onClick:()=>E.push("/patient/collections/".concat(o.id))}}:{}})}null==y||y(),t()},el=async(e,o)=>{Q(!0);let{errors:r}=await U({variables:{input:{resourceCollectionId:e,resources:q}}});if(H.current){if(Q(!1),r&&r.length>0){var n;C({colorScheme:x.eL.ERROR,header:(null===(n=r[0])||void 0===n?void 0:n.message)||T});return}C({colorScheme:x.eL.SUCCESS,colorVariant:x.bo.REVERSED,header:L(o?[o]:[]),action:{label:"View collection",onClick:()=>E.push("/patient/collections/".concat(e))}}),null==y||y(),t()}},ea=0===B.length&&F.trim().length>0;return(0,r.jsxs)(r.Fragment,{children:[(0,r.jsx)(i.ZP,{open:o,onClose:t,title:N?"Manage collections":"Add to collection",subheader:k(R),showHeaderDivider:!0,showFooterDivi
1der:!0,maxWidth:600,testId:"add-to-collection-modal",footer:(0,r.jsxs)(r.Fragment,{children:[(0,r.jsx)(l.ZP,{variant:l.Wu.OUTLINED,onClick:t,testId:"add-to-collection-cancel",children:"Cancel"}),(0,r.jsx)(l.ZP,{variant:l.Wu.SECONDARY,onClick:()=>{p.j.button.clicked({name:p.EK.CreateCollection,label:"add_modal"}),z(!0)},testId:"add-to-collection-create",children:"Create new collection"}),(0,r.jsx)(l.ZP,{variant:l.Wu.PRIMARY,onClick:en,disabled:et,testId:"add-to-collection-submit",children:N?"Save":"Add to collection"})]}),children:(0,r.jsxs)(m.Z,{sx:O,children:[(0,r.jsx)(a.Z,{placeholder:"Search collections",inputValue:F,onInputChange:_,freeSolo:!0}),ea?(0,r.jsxs)(m.Z,{children:[(0,r.jsx)(s.Z,{fontWeight:"semibold",colorScheme:x.eL.LAYOUT,colorProperty:x.g8.FOREGROUND,children:'No collections match "'.concat(F.trim(),'"')}),(0,r.jsx)(s.Z,{size:"sm",colorScheme:x.eL.LAYOUT,colorProperty:x.g8.MUTED_FOREGROUND,children:"Check your spelling or create a new collection"})]}):(0,r.jsxs)(r.Fragment,{children:[(0,r.jsx)(c.__,{fontWeight:"semibold",colorScheme:x.eL.LAYOUT,colorProperty:x.g8.MUTED_FOREGROUND,textTransform:"uppercase",children:"Suggested collections"}),(0,r.jsx)(m.Z,{sx:A,children:B.map(e=>(0,r.jsx)(Z,{collection:e,checked:W.has(e.id),onToggle:o=>er(e.id,o)},e.id))})]})]})}),(0,r.jsx)(n.Z,{open:Y,collection:null,onClose:()=>z(!1),onSaved:(e,o)=>{if(z(!1),void 0===e){P();return}if(!N&&0===$.length){el(e,null!=o?o:"");return}_(""),V(o=>new Set(o).add(e)),P()}})]})}},32743:function(e,o,t){var r=t(85893),n=t(64115),l=t(99324),a=t(71124),i=t(8689),c=t(84653);let s={sm:6,md:8},d={sm:l.E.SM,md:l.E.REG},u=(e,o,t)=>({display:"flex",alignItems:"center",justifyContent:"center",width:e.spacing(s[o]),height:e.spacing(s[o]),minWidth:e.spacing(s[o]),borderRadius:"".concat(e.shape.borderRadiusTokens[a.cM.SMALL],"px"),backgroundColor:t,flexShrink:0});o.Z=e=>{let{icon:o,chipColors:t,size:l="md"}=e,a=(0,i.F)();return(0,r.jsx)(c.Z,{sx:u(a,l,t.background),style:{color:t.foreground},children:(0,r.jsx)(n.AY,{icon:o,size:d[l],useCurrentColor:!0})})}},52394:function(e,o,t){var r=t(85893),n=t(53703),l=t(3144),a=t(27121),i=t(38762),c=t(26189),s=t(18838),d=t(72375),u=t(71124),h=t(8689),p=t(29592),x=t(84653);o.Z=e=>{let{currType:o,children:t,title:f,fullBleed:g,refetch:m}=e,b=(0,h.F)(),{showEnvBanner:v,envLabel:R,onDismiss:y}=(0,d.L)();return(0,r.jsxs)(p.f,{children:[(0,r.jsx)(s.Z,{currType:o,refetch:m}),(0,r.jsxs)(x.Z,{sx:{display:"flex",minHeight:"calc(100dvh - 64px)",backgroundColor:b.palette.greyC},children:[(0,r.jsx)(l.Z,{}),(0,r.jsxs)(x.Z,{sx:{flex:1,minWidth:0,display:"flex",flexDirection:"column",overflowX:"clip",backgroundColor:b.palette.neutral25},children:[v&&(0,r.jsx)(i.Z,{colorScheme:u.eL.WARNING,header:R,dismiss:{onClose:y}}),(0,r.jsx)(n.Z,{}),f&&(0,r.jsx)(a.LN,{children:(0,r.jsx)(a.HE,{children:(0,r.jsx)(a.lu,{className:"no-margin",children:(0,r.jsx)(a.V$,{children:f})})})}),g?(0,r.jsx)(x.Z,{sx:{flex:1,display:"flex",flexDirection:"column"},children:(0,r.jsx)(c.Z,{children:t})}):(0,r.jsx)(a.LN,{sx:{flex:1},children:(0,r.jsx)(a.$h,{children:(0,r.jsx)(c.Z,{children:t})})})]})]})]})}},40247:function(e,o,t){var r=t(85893),n=t(71124),l=t(8689),a=t(46558);let i=(e,o,t)=>{var r;return{borderRadius:"".concat(e.shape.borderRadiusTokens[n.cM.SMALL],"px"),boxShadow:"0px 8px 16px 0px rgba(22, 34, 51, 0.08)",border:"1px solid ".concat(null===(r=e.palette.layout)||void 0===r?void 0:r.border),minWidth:t,overflowX:"hidden",overflowY:"auto",boxSizing:"border-box",marginTop:e.spacing(2),...!1!==o&&{maxHeight:o}}};o.Z=e=>{let{onClose:o,anchorEl:t,open:n,onClick:c,id:s,children:d,maxHeight:u=280,minWidth:h="128px",anchorOrigin:p={horizontal:"left",vertical:"bottom"},transformOrigin:x={horizontal:"left",vertical:"top"}}=e,f=(0,l.F)();return(0,r.jsx)(a.Z,{anchorEl:t,id:s,open:n,onClose:o,onClick:c,slotProps:{paper:{elevation:0,sx:i(f,u,h)},list:{sx:{padding:0}}},anchorOrigin:p,transformOrigin:x,children:d})}},25211:function(e,o,t){var r=t(85893),n=t(8689),l=t(9098);let a=(e,o,t)=>{var r,n;return{bgcolor:null===(r=e.palette.layout)||void 0===r?void 0:r.muted,transform:"none",...void 0!==o&&{borderRadius:"".concat(e.shape.borderRadiusTokens[o],"px")},..."wave"===t&&{"&::after":{background:"linear-gradient(90deg, transparent, ".concat(null===(n=e.palette.layout)||void 0===n?void 0:n.card,", transparent)"),animationDuration:"1.2s"}}}};o.Z=e=>{let{borderRadius:o,...t}=e,i=(0,n.F)();return(0,r.jsx)(l.Z,{sx:a(i,o,t.animation),...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.