1!function(){try{var e="undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof globalThis?globalThis:"undefined"!=typeof self?self:{},l=(new e.Error).stack;l&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[l]="1906e45a-2151-4214-b9b5-f5b8dfada216",e._sentryDebugIdIdentifier="sentry-dbid-1906e45a-2151-4214-b9b5-f5b8dfada216")}catch(e){}}();"use strict";(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[6542],{2297:(e,l,n)=>{n.d(l,{u:()=>t});let t=(0,n(14232).createContext)(null)},10433:(e,l,n)=>{n.d(l,{P:()=>i});var t=n(74359),a=n(49912),r=n(82517);let i=e=>(0,t.I)({queryFn:()=>(0,r.sJ)(e),queryKey:a.e.searchPhotonMedication(e).queryKey,staleTime:1/0,enabled:e.length>2})},16383:(e,l,n)=>{n.d(l,{c:()=>r});var t=n(37876),a=n(82777);let r=e=>{let{children:l}=e;return(0,t.jsx)(a.A,{variant:"bodyXSRegularSansSerif",sx:e=>({color:e.palette["text-neutral-default"],letterSpacing:"1%"}),children:l})}},23082:(e,l,n)=>{n.d(l,{A:()=>a});var t=n(37876);n(14232);let a=()=>(0,t.jsx)("svg",{xmlns:"http://www.w3.org/2000/svg",width:"16",height:"18",viewBox:"0 0 16 18",fill:"none",children:(0,t.jsx)("path",{d:"M3.30775 17.5C2.80908 17.5 2.38308 17.3234 2.02975 16.9702C1.67658 16.6169 1.5 16.1909 1.5 15.6922V2.99998H1.25C1.03717 2.99998 0.859 2.92815 0.7155 2.78448C0.571833 2.64098 0.5 2.46281 0.5 2.24998C0.5 2.03715 0.571833 1.85898 0.7155 1.71548C0.859 1.57181 1.03717 1.49998 1.25 1.49998H5C5 1.25515 5.08625 1.04648 5.25875 0.873979C5.43108 0.701646 5.63967 0.615479 5.8845 0.615479H10.1155C10.3603 0.615479 10.5689 0.701646 10.7413 0.873979C10.9138 1.04648 11 1.25515 11 1.49998H14.75C14.9628 1.49998 15.141 1.57181 15.2845 1.71548C15.4282 1.85898 15.5 2.03715 15.5 2.24998C15.5 2.46281 15.4282 2.64098 15.2845 2.78448C15.141 2.92815 14.9628 2.99998 14.75 2.99998H14.5V15.6922C14.5 16.1909 14.3234 16.6169 13.9703 16.9702C13.6169 17.3234 13.1909 17.5 12.6923 17.5H3.30775ZM13 2.99998H3V15.6922C3 15.7821 3.02883 15.8558 3.0865 15.9135C3.14417 15.9711 3.21792 16 3.30775 16H12.6923C12.7821 16 12.8558 15.9711 12.9135 15.9135C12.9712 15.8558 13 15.7821 13 15.6922V2.99998ZM8 10.5537L10.073 12.627C10.2115 12.7653 10.3856 12.8361 10.5953 12.8395C10.8048 12.8426 10.982 12.7718 11.127 12.627C11.2718 12.482 11.3443 12.3063 11.3443 12.1C11.3443 11.8936 11.2718 11.718 11.127 11.573L9.05375 9.49998L11.127 7.42698C11.2653 7.28848 11.3362 7.1144 11.3395 6.90473C11.3427 6.69523 11.2718 6.51798 11.127 6.37298C10.982 6.22815 10.8063 6.15573 10.6 6.15573C10.3937 6.15573 10.218 6.22815 10.073 6.37298L8 8.44623L5.927 6.37298C5.7885 6.23464 5.61442 6.16381 5.40475 6.16048C5.19525 6.15731 5.018 6.22815 4.873 6.37298C4.72817 6.51798 4.65575 6.69365 4.65575 6.89998C4.65575 7.10631 4.72817 7.28198 4.873 7.42698L6.94625 9.49998L4.873 11.573C4.73467 11.7115 4.66383 11.8856 4.6605 12.0952C4.65733 12.3047 4.72817 12.482 4.873 12.627C5.018 12.7718 5.19367 12.8442 5.4 12.8442C5.60633 12.8442 5.782 12.7718 5.927 12.627L8 10.5537Z",fill:"#93908E"})})},46542:(e,l,n)=>{n.r(l),n.d(l,{SurveyMedicationSearch:()=>v});var t=n(37876),a=n(93265),r=n(82777),i=n(98625),d=n(7497),o=n(51804),u=n(51705),s=n(69585),c=n(49251),p=n(14232),x=n(10433),h=n(1729),C=n(23082),g=n(16383),f=n(91796),y=n(47298);let m=(0,a.Z)(),b=e=>{var l;let{fields:n,fieldState:a,onChange:g,value:b,handleSubmit:v,submitPage:S,getCurrentMedications:j}=e,[w,A]=(0,p.useState)(null),k=(0,c.d)((null==w?void 0:w.name)||"",200),{results:T}=(0,y.Y)(),V=(0,p.useMemo)(()=>{var e;return null!=(e=null==j?void 0:j(T))?e:[]},[j,T]),L=(0,p.useMemo)(()=>Array.isArray(b)?b:[],[b]),{data:{medications:H}={medications:[]},isLoading:I}=(0,x.P)(k),E=(0,p.useCallback)(e=>{g&&e.name.trim()&&g([...L,e]),A(null)},[g,L]),M=(0,p.useCallback)(e=>{g&&g(L.filter(l=>l.name!==e.name))},[g,L]),_=(0,p.useCallback)((e,l)=>{l&&"string"!=typeof l&&(l.inputValue?E({name:l.inputValue}):E(l))},[E]),F=(0,p.useCallback)((e,l)=>{A({name:l})},[A]),B=(0,p.useCallback)((e,l)=>{let n=m(e,l);return l.inputValue.length>2&&!I&&n.push({inputValue:l.inputValue,name:'Add "'.concat(l.inputValue,'"')}),n},[I]),D=(0,p.useCallback)(e=>"string"==typeof e?e:e.inputValue?e.inputValue:e.name,[]),R=(0,p.useCallback)((e,l)=>(0,t.jsx)("li",{...e,children:(0,t.jsx)(r.A,{sx:e=>({...e.typography.bodySRegularSansSerif}),children:l.name})}),[]),O=(0,p.useCallback)((e,l,n)=>{var a,r,i;return(0,t.jsx)(f.o,{...e,placeholder:null==l||null==(a=l[0])?void 0:a.placeholder,error:null==n?void 0:n.invalid,helperText:(null==n?void 0:n.invalid)?null==l||null==(r=l[0])?void 0:r.helperText:void 0,autoFocus:null==l||null==(i=l[0])?void 0:i.autoFocus})},[]);
1return(0,t.jsxs)(i.A,{sx:{gap:"4px",width:"100%"},children:[V.length>0&&(0,t.jsxs)(i.A,{sx:{gap:"8px",marginBottom:"16px"},children:[(0,t.jsx)(r.A,{sx:e=>({...e.typography.bodySRegularSansSerif}),children:"You have selected"}),(0,t.jsx)(i.A,{direction:"row",sx:{flexWrap:"wrap",gap:"8px"},children:V.map((e,l)=>(0,t.jsx)(r.A,{sx:e=>({...e.typography.bodyXSBoldSansSerif,color:e.palette["bg-success-strong"],backgroundColor:e.palette["bg-primary-weaker"],borderRadius:"4px",padding:"2px 4px"}),children:e},"current-med-".concat(l)))})]}),(0,t.jsx)(r.A,{sx:e=>({...e.typography.bodySmRegular,color:e.palette["text-neutral-default"]}),children:(null==n||null==(l=n[0])?void 0:l.multiRowTitle)||"Write medication name"}),(0,t.jsx)(d.A,{value:w,onInputChange:F,onChange:_,filterOptions:B,options:H||[],getOptionLabel:D,selectOnFocus:!0,clearOnBlur:!0,handleHomeEndKeys:!0,renderOption:R,freeSolo:!0,loading:I,loadingText:"Searching medications...",onKeyDown:e=>{"Enter"===e.key&&(e.preventDefault(),w&&w.name.trim()?E(w):v&&S&&v(S)())},renderInput:e=>O(e,n,a)}),(0,t.jsx)(h.FoundButton,{flavor:h.FoundButtonFlavor.Tertiary,onClick:()=>{w&&w.name.trim()&&E(w)},sx:{alignSelf:"center",marginTop:"16px"},disabled:!w||!w.name.trim(),children:(null==n?void 0:n[0].addText)?n[0].addText:"Add medication"}),L.length>0&&(0,t.jsx)(o.A,{children:L.map((e,l)=>(0,t.jsx)(u.Ay,{secondaryAction:(0,t.jsx)(s.A,{edge:"end","aria-label":"delete",onClick:()=>M(e),children:(0,t.jsx)(C.A,{})}),sx:{paddingLeft:0,width:"100%",display:"flex",justifyContent:"space-between",alignItems:"center"},children:(0,t.jsxs)(r.A,{sx:e=>({...e.typography.textSmall100,color:e.palette["text-neutral-strong"],flex:1}),children:["\xb7 ",e.name]})},"".concat(e.name,"-").concat(l)))})]})},v=e=>{let{field:{onChange:l,value:n},fields:a,fieldState:r,handleSubmit:d,submitPage:o,getCurrentMedications:u}=e;return(0,t.jsxs)(i.A,{direction:"column",sx:{gap:"4px",flex:1},children:[(0,t.jsx)(g.c,{children:null==a?void 0:a[0].label}),(0,t.jsx)(b,{fields:a,fieldState:r,onChange:l,value:n,handleSubmit:d,submitPage:o,getCurrentMedications:u})]})}},47298:(e,l,n)=>{n.d(l,{Y:()=>r});var t=n(14232),a=n(2297);function r(){let e=(0,t.useContext)(a.u);if(!e)throw Error("useSurvey must be used within a SurveyProvider");return e}},49251:(e,l,n)=>{n.d(l,{d:()=>a});var t=n(14232);let a=(e,l)=>{let[n,a]=(0,t.useState)(e);return(0,t.useEffect)(()=>{let n=setTimeout(()=>{a(e)},l);return()=>{clearTimeout(n)}},[e,l]),n}}}]); 2//# sourceMappingURL=6542.4261c1e482e6d226.js.map
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.