1"use strict";(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[8319],{9366:(e,t,n)=>{n.d(t,{CM:()=>p,D1:()=>f,Ep:()=>d,GT:()=>l,Jl:()=>r,OL:()=>m,SY:()=>c,zp:()=>h});var i=n(53812),a=n(57985);let r={transcribeTitle:"Transcribe patient visits",notesTitle:"Get structured documents",templatePrompt:"Select a template or transcribe a visit to generate a note.",generateLabel:"Generate note",gateHeading:"Enjoy the rest of this output on Heidi",gateButtonLabel:"Get Heidi Free",preparingTitle:"Starting your session",preparingDescription:"Hang tight â Heidi is getting ready to listen.",transcribingTitle:"Transcribing your session",transcribingDescription:"Your transcription will appear here in increments during your session"},s=new Set(Object.values(a.Gh).flat().filter(e=>"documents"===e.endpoint).map(e=>b(e.label)));function o(e){let t=b(e);return s.has(t)||/\b(referral|discharge|treatment plan|care plan|insurance|handover|incident report|case summary)\b/i.test(e)?"documents":"consult-note"}function l(e){return"documents"===e?"/api/scribe/document":"/api/scribe/consult-note"}function d(e){var t,n;if(!e)return;let a=(t=e.hiddenSpecialties)?t.map(e=>(0,i.yR)(e)).filter(e=>!!(e&&e.trim())):[],s=(n=e.noteTemplates)?n.map(e=>{let t=(0,i.yR)(e.templateId)?.trim()??"",n=e.label?.trim()??"";return t&&n?{templateId:t,label:n}:null}).filter(e=>null!==e):[],o=function(e){if(!e)return{};let t={};for(let n of Object.keys(r)){let i=e[n];"string"==typeof i&&""!==i.trim()&&(t[n]=i.trim())}return t}(e.copy),l={...a.length>0?{hiddenSpecialties:a}:{},...s.length>0?{noteTemplates:s}:{},...Object.keys(o).length>0?{copy:o}:{}};return Object.keys(l).length>0?l:void 0}function c(e){let t=d(e)?.copy??{};return{...r,...t}}function u(e){return!!e&&a.WF.some(t=>t.key===e)}function m(e){let t=new Set(d(e)?.hiddenSpecialties??[]);return 0===t.size?[...a.WF]:a.WF.filter(e=>!t.has(e.key))}function p(e){if(u(a.lW)&&e.some(e=>e.key===a.lW))return a.lW;let t=e[0]?.key;return u(t)?t:a.lW}function h(e,t){let n=d(t),i=n?.noteTemplates??[];return i.length>0?i.map(e=>({id:e.templateId,label:e.label,endpoint:o(e.label)})):(a.Gh[e]??[]).map(e=>({id:e.templateId,label:e.label,endpoint:e.endpoint}))}function g(e){return/^[a-f0-9]+$/i.test(e)&&!e.startsWith("TEMPLATE_ID_TBD_")}function f(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:2,i=(0===t.length?[...e]:e.map(e=>{var n,i;let a,r;if(g(e.id))return e;let s=(n=e.label,i=t,a=b(n),r=i.find(e=>b(e.name)===a),r?.id??null);return s?{...e,id:s}:e})).filter(e=>g(e.id));if(e.length>0&&e.every(e=>g(e.id))||i.length>=n||0===t.length)return i;let a=new Set(i.map(e=>e.id)),r=[];for(let e of t)if(!a.has(e.id)&&g(e.id)&&(r.push({id:e.id,label:e.name,endpoint:o(e.name)}),a.add(e.id),i.length+r.length>=n))break;return[...i,...r]}function b(e){return e.toLowerCase().replace(/\s+/g," ").trim()}},28319:(e,t,n)=>{n.r(t),n.d(t,{ScribeDemoIsland:()=>eo});var i=n(62172),a=n(73612),r=n(94896),s=n(9366),o=n(34356);function l(e){let t,n,s,l,d,c,u,m,p,h,g,f,b,x=(0,a.c)(37),{open:y,mode:k,onOpenChange:w,onConfirm:v}=e,[I,T]=(0,r.useState)(!1),_=(0,r.useId)(),E="transcribe"===k;x[0]!==w?(t=e=>{e||T(!1),w(e)},x[0]=w,x[1]=t):t=x[1];let j=t;x[2]!==I||x[3]!==v?(n=()=>{I&&(v(),T(!1))},x[2]=I,x[3]=v,x[4]=n):n=x[4];let N=n,D=E?"HeidiMicrophone":"FileAudio";x[5]!==D?(s=(0,i.jsx)("div",{className:"mb-2 flex size-12 items-center justify-center rounded-full bg-sunlight-100 text-bark-900",children:(0,i.jsx)(o.Int,{icon:D,size:"md","aria-hidden":!0})}),x[5]=D,x[6]=s):s=x[6];let A=E?"Before we start transcribing":"Before we process your audio";x[7]!==A?(l=(0,i.jsx)(o.L33,{className:"text-heading-4",children:A}),x[7]=A,x[8]=l):l=x[8],x[9]===Symbol.for("react.memo_cache_sentinel")?(d=(0,i.jsx)(o.rrK,{className:"leading-relaxed",children:"Heidi uses this audio to generate a sample clinical note. The audio is processed for this demo and is not stored after the session ends. Please confirm you have permission to use it and accept our Terms of Use and Privacy Policy. We only ask this once on this device."}),x[9]=d):d=x[9],x[10]!==s||x[11]!==l?(c=(0,i.jsxs)(o.c75,{className:"items-start text-left",children:[s,l,d]}),x[10]=s,x[11]=l,x[12]=c):c=x[12],x[13]===Symbol.for("react.memo_cache_sentinel")?(u=e=>T(!0===e),x[13]=u):u=x[13];let S=E?"I have consent to transcribe this conversation and accept the Terms of Use and Privacy Policy.":"I have consent to use this audio and accept the Terms of Use and Privacy Policy.",C=E?"Next, your browser will ask for microphone access. Transcribing can't start until you allow it.":"Processing begins after you continue.";x[14]!==I||x[15]!==_||x[16]!==S||x[17]!==C?(m=(0,i.jsx)("div",{className:"rounded-xl border border-sand-150 bg-sand-50 p-4 transition-colors focus-within:border-bark-300 focus-within:ring-2 focus-within:ring-ring focus-within:ring-offset-2",children:(0,i.jsx)(o.Sc0,{id:_,checked:I,onCheckedChange:u,label:S,subtext:C})}),x[14]=I,x[15]=_,x[16]=S,x[17]=C,x[18]=m):m=x[18],x[19]!==j?(p=(0,i.jsx)(o.$nd,{variant:"ghost",onClick:()=>j(!1),children:"Cancel"}),x[19]=j,x[20]=p):p=x[20];let P=E?"Mic":"FileAudio",L=!I,R=E?"Start transcribing":"Process audio";return x[21]!==N||x[22]!==P||x[23]!==L||x[24]!==R?(h=(0,i.jsx)(o.$nd,{variant:"sunlight",leadingIcon:P,onClick:N,disabled:L,children:R}),x[21]=N,x[22]=P,x[23]=L,x[24]=R,x[25]=h):h=x[25],x[26]!==p||x[27]!==h?(g=(0,i.jsxs)(o.Esm,{className:"gap-3 sm:gap-3 [&>button]:w-full sm:[&>button]:w-auto",children:[p,h]}),x[26]=p,x[27]=h,x[28]=g):g=x[28],x[29]!==m||x[30]!==g||x[31]!==c?(f=(0,i.jsxs)(o.Cff,{className:"gap-6 border border-color-base bg-foreground p-6 shadow-lg sm:max-w-md
1sm:p-8 md:max-w-md md:p-8",children:[c,m,g]}),x[29]=m,x[30]=g,x[31]=c,x[32]=f):f=x[32],x[33]!==j||x[34]!==y||x[35]!==f?(b=(0,i.jsx)(o.lGe,{open:y,onOpenChange:j,children:f}),x[33]=j,x[34]=y,x[35]=f,x[36]=b):b=x[36],b}var d=n(48963),c=n(57985);let u=[{heading:"Subjective",items:["62-year-old male presenting for follow-up of osteoporosis diagnosed on recent DEXA scan.","Reports uncertainty about ongoing management and seeking guidance on next steps."],detail:["Intermittent lower back ache for several weeks; no falls, fractures, or night pain.","Taking vitamin D most days; no bone-specific therapy commenced to date."]},{heading:"Objective",items:["DEXA scan reviewed: T-score consistent with osteoporosis diagnosis.","Vitals: WNL.","Comfortable at rest; no acute distress.","Gait steady; no postural abnormalities noted.","No spinal tenderness on palpation; height unchanged from prior visit."],detail:["Lumbar spine and femoral neck T-scores documented separately for trend comparison.","Calcium, vitamin D, and renal function from last panel reviewed and within range."]}],m=[{match:e=>e.includes("soap")&&e.includes("including issues"),sections:[{heading:"Issues",items:["Osteoporosis â follow-up after DEXA; management plan to be confirmed.","Lower back ache â mild, several weeks; no red-flag features reported."],detail:["Fracture-risk assessment to be documented alongside the management decision."]},...u]},{match:e=>e.includes("h & p")||e.includes("h&p")||e.includes("history and physical"),sections:[{heading:"Chief complaint",items:["Follow-up for osteoporosis diagnosed on recent DEXA scan; requesting management guidance."],detail:["Patient frames the visit around wanting a clear plan rather than new symptoms."]},{heading:"History of present illness",items:["62-year-old male with known osteoporosis on prior DEXA.","Reports intermittent lower back ache for a few weeks; denies falls or fractures.","Taking vitamin D most days; no bone-specific therapy started yet."],detail:["No family history of hip fracture; non-smoker, alcohol within recommended limits."]},{heading:"Plan",items:["Review DEXA results and discuss bisphosphonate initiation if appropriate.","Continue vitamin D and calcium; follow up in three months."],detail:["Weight-bearing exercise and falls-prevention advice provided verbally."]}]},{match:e=>e.includes("referral"),sections:[{heading:"Referral to",items:["Endocrinology â bone and mineral clinic.","Requested by Dr Goh, Family Medicine."],detail:["Copy to the patient's usual GP for continuity of care."]},{heading:"Reason for referral",items:["62-year-old male with DEXA-confirmed osteoporosis seeking specialist input on therapy selection."],detail:["Patient prefers a shared decision on oral versus infused therapy before starting."]},{heading:"Relevant history and findings",items:["DEXA T-score consistent with osteoporosis; no fragility fractures to date.","Mild intermittent lower back ache; examination unremarkable.","Currently on vitamin D only."],detail:["Recent calcium, vitamin D, and renal function within normal limits."]},{heading:"What I'm asking for",items:["Assessment for bone-protective therapy and advice on monitoring interval."],detail:["Happy to prescribe and monitor locally once a plan is confirmed."]}]},{match:e=>e.includes("discharge"),sections:[{heading:"Reason for presentation",items:["Outpatient review of osteoporosis after DEXA; no acute admission."],detail:["Attended alone; no mobility aids required."]},{heading:"Course of care",items:["DEXA results explained; management options discussed.","No acute intervention required this episode."],detail:["Shared decision-making discussion documented in full."]},{heading:"Medications on discharge",items:["Vitamin D â continue current dose.","Bone-protective therapy â to commence pending bloods."],detail:["No changes to other regular medications."]},{heading:"Follow-up",items:["GP review in three months with repeat bloods.","Return sooner for new back pain, height loss, or a fall."],detail:["Endocrinology referral pending if therapy is not tolerated."]}]},{match:e=>e.includes("treatment plan")||e.includes("care plan")||e.includes("management plan"),sections:[{heading:"Diagnosis",items:["Osteoporosis, confirmed on DEXA; no fragility fracture to date."],detail:["Fracture risk to be reassessed at each review."]},{heading:"Goals of care",items:["Prevent first fragility fracture.","Maintain independence and current activity level."],detail:["Patient goal: stay on the golf course and keep gardening."]},{heading:"Treatment steps",items:["Confirm bloods, then commence bone-protective therapy if suitable.","Continue vitamin D; add calcium if dietary intake is inadequate.","Weight-bearing and balance exercise twice weekly."],detail:["Review adherence and side effects at three months before extending the script."]},{heading:"What the patient does next",items:["Book pathology this week.","Bring current medications and supplements to the next visit."],detail:["Call the clinic if new back pain or a fall occurs before review."]}]},{match:e=>e.includes("handover")||e.includes("handoff")||e.includes("isbar"),sections:[{heading:"Situation",items:["Kieran, 62, seen for osteoporosis follow-up; clinically stable, no acute issues."],detail:["Not for escalation; routine outpatient follow-up only."]}
1,{heading:"Background",items:["Osteoporosis confirmed on DEXA; on vitamin D, no bone-specific therapy yet.","Mild intermittent lower back ache; no falls or fractures."],detail:["Independent with all activities of daily living."]},{heading:"Assessment",items:["Stable chronic bone-health concern; management plan being finalised."],detail:["Awaiting calcium, vitamin D, and renal function before therapy."]},{heading:"Recommendation",items:["Chase bloods, then commence therapy.","Falls-prevention advice reinforced at next contact."],detail:["Flag to the treating GP if bloods are abnormal."]}]},{match:e=>e.includes("insurance")||e.includes("form"),sections:[{heading:"Patient and provider details",items:["Patient: Kieran (62, male). Provider: Dr Goh, Family Medicine.","Date of assessment: this consultation."],detail:["Provider number and practice address auto-filled from profile."]},{heading:"Diagnosis and supporting evidence",items:["Osteoporosis confirmed on DEXA scan; T-score documented.","No fragility fracture to date."],detail:["DEXA report attached as supporting documentation."]},{heading:"Functional impact",items:["Independent with daily activities; mild intermittent lower back ache.","No mobility aids required."],detail:["No time off work or care requirements arising from this condition."]}]},{match:e=>e.includes("incident"),sections:[{heading:"Incident",items:["No incident occurred this episode â routine osteoporosis review only.","Documented for completeness as a falls-risk screen was performed."],detail:["Falls-risk screen: low risk; gait steady, no aids required."]},{heading:"Immediate actions",items:["Falls-prevention advice given; no injury and no intervention required."],detail:["Environmental hazards at home discussed with the patient."]},{heading:"Follow-up and prevention",items:["Bone-protective therapy under consideration to reduce fracture risk.","Re-screen falls risk at the three-month review."],detail:["Escalate to the care manager if a fall occurs before review."]}]},{match:e=>e.includes("case summary")||e.includes("case note"),sections:[{heading:"Presentation",items:["62-year-old male, DEXA-confirmed osteoporosis, presenting for management guidance."],detail:["No fragility fracture; asymptomatic apart from mild back ache."]},{heading:"Investigations reviewed",items:["DEXA: T-score in the osteoporotic range.","Calcium, vitamin D, and renal function reviewed."],detail:["Considered secondary causes; none identified on history."]},{heading:"Management and learning points",items:["Bone-protective therapy pending bloods; vitamin D continued.","Fracture-risk communication matters as much as the prescription."],detail:["Discussion of oral versus infused therapy is a common shared-decision point."]}]},{match:e=>e.includes("progress"),sections:[{heading:"Since last visit",items:["DEXA scan completed; osteoporosis confirmed and discussed with the patient.","No falls or fractures in the interval; mild lower back ache persists."],detail:["Adherence to vitamin D reported as most days, not daily."]},{heading:"Today's assessment",items:["Stable; no new symptoms or red flags on review.","Patient engaged and ready to commit to a bone-health plan."],detail:["Discussed fracture risk in plain language; patient teach-back adequate."]},{heading:"Plan for next interval",items:["Commence bone-protective therapy if bloods support it.","Review in three months with repeat calcium and vitamin D."],detail:["Escalate sooner if new back pain, height loss, or a fall occurs."]}]},{match:e=>e.includes("administration")||e.includes("admin"),sections:[{heading:"Encounter summary",items:["Outpatient follow-up for osteoporosis management counselling.","Patient seeking clear next steps after DEXA confirmation."],detail:["Standard consultation length; no interpreter required."]},{heading:"Actions",items:["Documented shared decision-making discussion regarding bone therapy.","Follow-up visit scheduled in three months.","Patient education materials on calcium / vitamin D provided."],detail:["Pathology request issued; results to be reviewed on receipt."]}]},{match:e=>e.includes("ems")||e.includes("chart"),sections:[{heading:"Presentation",items:["Non-acute clinic visit â osteoporosis follow-up, not an emergency presentation.","Patient ambulatory, comfortable at rest."],detail:["No mechanism of injury; no trauma call criteria met."]},{heading:"Assessment / disposition",items:["Chronic bone health concern; no acute trauma or fall today.","Discharged home with outpatient bone-health plan and GP follow-up."],detail:["Safe-to-discharge criteria documented; no transport required."]}]},{match:e=>e.includes("soap"),sections:u}],p={"family-medicine":[{time:"0:02",text:"Hi, Doctor Goh."},{time:"0:04",text:"How are you doing today?"},{time:"0:05",text:"I'm good, thanks."},{time:"0:06",text:"Kieran, how can I help you today?"},{time:"0:09",text:"So, look, I think, the one thing is, we did that DEXA scan, before, and I know y
1ou said that I've got, osteoporosis."},{time:"0:19",text:"And, yeah, I, I'm, I think I'm just not sure what I should be, be doing on that front."},{time:"0:24",text:"And I think I need maybe some, some input."}],specialist:[{time:"0:02",text:"Morning, Margaret. Take a seat."},{time:"0:05",text:"Your GP sent you through after the echo, so I've had a look at that already."},{time:"0:11",text:"Yes, she said you'd explain what it showed."},{time:"0:14",text:"It showed moderate aortic stenosis. Tell me about the breathlessness first â when do you notice it?"},{time:"0:21",text:"Mostly on the stairs now. I used to get to the top fine, and the last couple of months I stop halfway."},{time:"0:30",text:"Any chest tightness or dizziness with that?"},{time:"0:33",text:"A bit light-headed once, gardening. It passed after I sat down."}],nursing:[{time:"0:02",text:"Hi Tom, I'm Priya, I'll be looking after you today."},{time:"0:06",text:"I'm just here to check the wound, is that right?"},{time:"0:09",text:"That's right â day five post-op. How's the pain been overnight?"},{time:"0:14",text:"About a four. It was worse yesterday, maybe a seven, but the tablets helped."},{time:"0:21",text:"Good. Dressing looks clean and dry, no ooze, edges are well approximated."},{time:"0:29",text:"Obs are stable â temp 36.8, BP 128 over 76."},{time:"0:35",text:"I'll redress it now and let the team know you're mobilising short distances."}],"mental-health":[{time:"0:02",text:"Good to see you again, Alex. How's the fortnight been?"},{time:"0:07",text:"Up and down. The mornings are still the hardest part."},{time:"0:12",text:"Tell me a bit more about the mornings."},{time:"0:15",text:"I wake around four and can't get back off. Then I'm flat all day and I've been calling in sick."},{time:"0:24",text:"Twice last week. And what about the breathing exercises we talked about?"},{time:"0:30",text:"I did them most days. They help in the moment, but it comes back."},{time:"0:36",text:"Any thoughts of harming yourself since we last met?"},{time:"0:40",text:"No. Nothing like that."}],"allied-health":[{time:"0:02",text:"Come through, Dana. How's the shoulder tracking?"},{time:"0:06",text:"Better than last time. I can reach the top shelf now without bracing."},{time:"0:13",text:"That's a good sign. Any night pain?"},{time:"0:16",text:"Only if I roll onto it. Maybe once or twice a week."},{time:"0:22",text:"Let's measure it. Abduction is up to about 150 degrees, external rotation is still limited."},{time:"0:31",text:"I've been doing the band work three times a week like you said."},{time:"0:36",text:"Keep that going and we'll add loaded external rotation this block."}],dental:[{time:"0:02",text:"Hi Rebecca, what's been bothering you?"},{time:"0:05",text:"The back tooth on the bottom right. It's sharp when I drink anything cold."},{time:"0:12",text:"How long has that been going on?"},{time:"0:14",text:"About three weeks. It settles quickly, but it's getting more frequent."},{time:"0:21",text:"Let's have a look. There's a deep occlusal cavity on the lower right seven."},{time:"0:29",text:"Percussion is negative and the gum looks healthy, so it's likely reversible."},{time:"0:35",text:"I'd like a bitewing to check how close it is to the nerve before we restore it."}],"aged-care":[{time:"0:02",text:"Morning, Joan. How did you sleep?"},{time:"0:05",text:"Not very well, love. I was up and down all night."},{time:"0:10",text:"The night staff noted you were unsteady getting to the bathroom around two."},{time:"0:17",text:"I held the rail. I didn't fall, but my legs felt like jelly."},{time:"0:23",text:"Any dizziness when you stand? I'll take a lying and standing blood pressure."},{time:"0:30",text:"A bit, just for a moment."},{time:"0:33",text:"You've eaten about half your meals this week too â I'll flag that with the dietitian."}],veterinarian:[{time:"0:02",text:"Hi, and who have we got here today?"},{time:"0:05",text:"This is Bailey. He's a nine-year-old Labrador, desexed male."},{time:"0:11",text:"And what's been going on with him?"},{time:"0:14",text:"He's been stiff getting up, especially in the mornings, and he's stopped jumping into the car."},{time:"0:22",text:"How long has that been building?"},{time:"0:25",text:"A couple of months. It's worse after a long walk."},{time:"0:31",text:"He's a bit over condition at thirty-six kilos, and there's reduced range in both hips with some discomfort on extension."}],trainee:[{time:"0:02",text:"Thanks for seeing me. I'll present the case and then you can pull me up."},{time:"0:08",text:"Go ahead. Start with the one-liner and I'll stop you if I need detail."},{time:"0:13",text:"Fifty-four-year-old man, day two of admission, presented with two days of right upper quadrant pain and fever."},{time:"0:22",text:"On examination he's tender in the right upper quadrant with a positive Murphy's sign."},{time:"0:29",text:"Bloods show a white cell count of fourteen and a mildly raised bilirubin."},{time:"0:36",text:"And what did the ultrasound show?"},{time:"0:39",text:"Gallstones with a thickened gallbladder wall. No duct dilatation."}]},h={};p[c.lW];let g=["Additional clinical detail included for a more thorough note.","Patient goals, risks, and follow-up contingencies documented in full."];function f(e,t){let n=(e.detail&&e.detail.length>
10?e.detail:g).slice(0,t),[i,...a]=e.items;return i?[i,...n,...a]:[...n]}var b=n(6534),x=n(5579);function y(e){let t,n,r,s,l,c,u,m,p=(0,a.c)(22),{source:h,className:g,heading:f,buttonLabel:y}=e,k=void 0===f?"Enjoy the rest of this output on Heidi":f,w=void 0===y?"Get Heidi Free":y,v=(0,b.useParams)(),I="string"==typeof v?.locale?v.locale:"en-US";p[0]!==I?(t=(0,x.qz)("/onboarding",I),p[0]=I,p[1]=t):t=p[1];let T=t;p[2]!==g?(n=(0,o.cn)("relative z-10 flex flex-col items-center gap-3 rounded-md border border-sunlight-200 bg-sunlight-100 p-4 text-center md:flex-row md:items-center md:justify-between md:gap-0 md:text-left",g),p[2]=g,p[3]=n):n=p[3],p[4]!==k?(r=(0,i.jsx)("p",{className:"font-exposure text-heading-6 text-bark-950",children:k}),p[4]=k,p[5]=r):r=p[5];let _=`scribe_demo::gate_banner::${h}`;return p[6]!==T||p[7]!==h?(s={feature:d.s,source:h,href:T},p[6]=T,p[7]=h,p[8]=s):s=p[8],p[9]!==_||p[10]!==s?(l={category:"Scribe Demo Gate",action:"click",label:"Get Heidi Free",location:_,extras:s},p[9]=_,p[10]=s,p[11]=l):l=p[11],p[12]!==w||p[13]!==T?(c=(0,i.jsx)("a",{href:T,target:"_blank",rel:"noopener noreferrer",children:w}),p[12]=w,p[13]=T,p[14]=c):c=p[14],p[15]!==l||p[16]!==c?(u=(0,i.jsx)(o.$nd,{asChild:!0,variant:"bark",leadingIcon:"HeidiLogoMark",tracking:l,children:c}),p[15]=l,p[16]=c,p[17]=u):u=p[17],p[18]!==u||p[19]!==n||p[20]!==r?(m=(0,i.jsxs)("div",{className:n,children:[r,u]}),p[18]=u,p[19]=n,p[20]=r,p[21]=m):m=p[21],m}let k=["capturing","analysing","drafting"];function w(e){let t,n,r,s,l,d,c=(0,a.c)(13),{stage:u,source:m,tabLabel:p}=e,h="upload"===m?"Transcribing your audio":"Finishing your transcript";c[0]!==p?(t=p.toLowerCase(),c[0]=p,c[1]=t):t=c[1];let g=`Drafting your ${t}`;c[2]!==h||c[3]!==g?(n={capturing:h,analysing:"Analysing the transcript",drafting:g},c[2]=h,c[3]=g,c[4]=n):n=c[4];let f=n,b=k.indexOf(u);return c[5]!==b||c[6]!==f?(r=k.map((e,t)=>{let n=t<b,a=t===b;return(0,i.jsxs)("li",{className:"flex items-center gap-3",children:[(0,i.jsx)("span",{className:(0,o.cn)("flex size-6 shrink-0 items-center justify-center rounded-full",n&&"bg-forest-100 text-forest-600",a&&"bg-sand-150 text-bark-950",!n&&!a&&"bg-sand-100 text-bark-500"),children:n?(0,i.jsx)(o.Int,{icon:"Check",size:"xxs"}):a?(0,i.jsx)(o.Int,{icon:"Loader",size:"xxs",className:"motion-safe:animate-spin"}):(0,i.jsx)("span",{"aria-hidden":"true",className:"size-1.5 rounded-full bg-current"})}),(0,i.jsx)("span",{className:(0,o.cn)("text-sm",a&&"font-medium text-bark-950",n&&"text-bark-700",!n&&!a&&"text-bark-500"),children:f[e]})]},e)}),c[5]=b,c[6]=f,c[7]=r):r=c[7],c[8]!==r?(s=(0,i.jsx)("ol",{className:"flex flex-col gap-3","aria-live":"polite",children:r}),c[8]=r,c[9]=s):s=c[9],c[10]===Symbol.for("react.memo_cache_sentinel")?(l=(0,i.jsx)(I,{}),c[10]=l):l=c[10],c[11]!==s?(d=(0,i.jsxs)("div",{className:"flex flex-col gap-5 py-2",children:[s,l]}),c[11]=s,c[12]=d):d=c[12],d}let v=[{id:"h1",className:"h-3.5 w-28"},{id:"b1",className:"h-3 w-full"},{id:"b2",className:"h-3 w-11/12"},{id:"b3",className:"h-3 w-8/12"},{id:"h2",className:"mt-2 h-3.5 w-24"},{id:"b4",className:"h-3 w-full"},{id:"b5",className:"h-3 w-10/12"}];function I(){let e,t=(0,a.c)(1);return t[0]===Symbol.for("react.memo_cache_sentinel")?(e=(0,i.jsx)("div",{"aria-hidden":"true",className:"flex flex-col gap-2",children:v.map(T)}),t[0]=e):e=t[0],e}function T(e){return(0,i.jsx)(o.EAD,{color:"accent",className:e.className},e.id)}let _=[{value:"GOLDILOCKS",label:"Goldilocks",description:"Balanced detail â Heidi's default voice"},{value:"DETAILED",label:"Detailed",description:"Longer, includes more clinical reasoning"},{value:"BRIEF",label:"Brief",description:"Shorter, terse phrasing"},{value:"SUPER_DETAILED",label:"Super detailed",description:"Maximum coverage, longest output"},{value:"MY_VOICE",label:"My voice",description:"Matches your prior note style (requires sign-up)"}];function E(e){let t,n,r,s,l,d=(0,a.c)(13),{value:c,onChange:u,disabled:m}=e,p=void 0!==m&&m;d[0]!==c?(t=_.find(e=>e.value===c)??_[0],d[0]=c,d[1]=t):t=d[1];let h=t;return d[2]!==h.label||d[3]!==p?(n=(0,i.jsx)(o.tyb,{asChild:!0,children:(0,i.jsx)(o.$nd,{variant:"ghost",leadingIcon:"PencilLine",trailingIcon:"ChevronDown",disabled:p,className:"h-9 gap-1.5 rounded-md border border-sand-150 bg-white px-2.5 py-0 text-sm font-medium text-bark-950 hover:bg-sand-50 [&_svg]:size-4",children:h.label})}),d[2]=h.label,d[3]=p,d[4]=n):n=d[4],d[5]!==u||d[6]!==c?(r=_.map(e=>(0,i.jsxs)(o._26,{onSelect:()=>u(e.value),className:(0,o.cn)("flex flex-col items-start gap-0.5 px-3 py-2",e.value===c&&"bg-sand-50"),children:[(0,i.jsx)("span",{className:"text-sm font-medium text-bark-950",children:e.label}),(0,i.jsx)("span",{className:"text-xs text-bark-600",children:e.description})]},e.value)),d[5]=u,d[6]=c,d[7]=r):r=d[7],d[8]!==r?(s=(0,i.jsx)(o.SQm,{align:"end",className:"w-64",children:r}),d[8]=r,d[9]=s):s=d[9],d[10]!==n||d[11]!==s?(l=(0,i.jsxs)(o.rId,{children:[n,s]}),d[10]=n,d[11]=s,d[12]=l):l=d[12],l}function j(e){let t,n,r,l,c,u,m,p,h,g=(0,a.c)(34),{state:f,voiceStyle:b,onVoiceStyleChange:x,tabs:k,selectedTemplateId:w,onTemplateChange:v,templateSwitchDisabled:I,activeTabLabel:T,specialty:_,copy:E,gateSource:j}=e,A=void 0!==I&&I,S=void 0===T?"SOAP note":T,C=void 0===E?s.Jl:E;g[0]!==C.notesTitle?(t=(0,i.jsx)(o.DZT,{as:"h3",size:"heading6",className:"text-center text-bark-950",children:C.notesTitle}),g[0]=C.notesTitle,g[1]=t):t=g[1],g[2]!==C.templatePrompt?(n=(0,i.jsx)("p",{className:"-mt-2 text-center text-sm text-bark-600",children:C.templatePrompt}),g[2]=C.templatePrompt,g[3]=n):n=g[3],g[4]!==v||g[5]!==w||g[6]!==k||g[7]!==A?(r=0===k.length?(0,i.jsx)("div",{"aria-hidden":"true",className:"h-[34px] w-32 animate-pulse rounded-lg bg-sand-100"}):k.map(e=>{let t=e.id===w;return(0,i.jsx)(o.$nd,{variant:"ghost",leadingIcon:t?"PencilLine":"FileText",disabled:A,onClick:()=>v(e.id),title:e.label,"aria-pressed":t,tracking:{category:"Scribe Demo Template Tab",action:"click",label:e.label,location:"scribe_demo::note_panel::template_tabs",extras:{feature:d.s,templateId:e.id}},className:(0,o.cn)("h-[34px] max-w-[14rem] gap-1.5 truncate rounded-lg border px-3 py-0 text-md font-medium text-bark-950 [&_svg]:size-[18px] [&_svg]:text-forest-600",t?"bg-sand-150 border-sand-150 hover:bg-sand-150":"bg-white border-sand-150 hover:bg-sand-50"),children:(0,i.jsx)("span",{className:"truncate",children:e.label})},e.id)}),g[4]=v,g[5]=w,g[6]=k,g[7]=A,g[8]=r):r=g[8],g[9]!==r?(l=(0,i.jsx)("div",{className:"flex flex-wrap items-center gap-3 overflow-hidden",children:r}),g[9]=r,g[10]=l):l=g[10];let P="upload"===j?"upload":"transcribe";return g[11]!==f?(c=N(f),g[11]=f,g[12]=c):c=g[12],g[13]!==S||g[14]!==x||g[15]!==_||g[16]!==f||g[17]!==P||g[18]!==c||g[19]!==b?(u=(0,i.jsx)(D,{state:f,voiceStyle:b,onVoiceStyleChange:x,activeTabLabel:S,specialty:_,source:P,flushBottom:c}),g[13]=S,g[14]=x,g[15]=_,g[16]=f,g[17]=P,g[18]=c,g[19]=b,g[20]=u):u=g[20],g[21]!==C.gateButtonLabel||g[22]!==C.gateHeading||g[23]!==j||g[24]!==f?(m=N(f)&&(0,i.jsx)(y,{source:j,className:"sticky bottom-0 rounded-t-none",heading:C.gateHeading,buttonLabel:C.gateButtonLabel}),g[21]=C.gateButtonLabel,g[22]=C.gateHeading,g[23]=j,g[24]=f,g[25]=m):m=g[25],g[26]!==u||g[27]!==m?(p=(0,i.jsxs)("div",{className:"flex flex-col",children:[u,m]}),g[26]=u,g[27]=m,g[28]=p):p=g[28],g[29]!==p||g[30]!==t||g[31]!==n||g[32]!==l?(h=(0,i.jsxs)("div",{className:"flex flex-col gap-4 roun
1ded-xl border border-sand-150 bg-white p-4",children:[t,n,l,p]}),g[29]=p,g[30]=t,g[31]=n,g[32]=l,g[33]=h):h=g[33],h}function N(e){switch(e.kind){case"idle":case"note-ready":case"error":return!0;case"preparing":case"recording":case"finalising-recording":case"ready-to-generate":case"analysing":case"uploading":case"processing-upload":return!1}}function D(e){let t,n,r,s=(0,a.c)(55),{state:o,voiceStyle:l,onVoiceStyleChange:d,activeTabLabel:c,specialty:u,source:m,flushBottom:p}=e,h=void 0!==p&&p,g="uploading"===o.kind||"processing-upload"===o.kind||"preparing"===o.kind||"finalising-recording"===o.kind;s[0]!==d||s[1]!==g||s[2]!==l?(t=(0,i.jsx)(E,{value:l,onChange:d,disabled:g}),s[0]=d,s[1]=g,s[2]=l,s[3]=t):t=s[3];let f=t;if("recording"===o.kind||"preparing"===o.kind||"uploading"===o.kind){let e,t,n="uploading"===o.kind?"Waiting for your audio":"Waiting for your transcript",a="uploading"===o.kind?"Heidi will analyse the transcript once your file is processed.":"Stop transcribing when you're done and Heidi will analyse the transcript.";return s[4]!==n||s[5]!==a?(e=(0,i.jsx)(R,{icon:"Mic",title:n,description:a}),s[4]=n,s[5]=a,s[6]=e):e=s[6],s[7]!==c||s[8]!==h||s[9]!==e||s[10]!==f?(t=(0,i.jsx)(A,{title:c,voiceMenu:f,flushBottom:h,children:e}),s[7]=c,s[8]=h,s[9]=e,s[10]=f,s[11]=t):t=s[11],t}if("ready-to-generate"===o.kind||"processing-upload"===o.kind||"finalising-recording"===o.kind||"analysing"===o.kind&&!o.note){let e,t,n;if(s[12]!==o.kind){var b;e="analysing"===(b=o.kind)?"drafting":"ready-to-generate"===b?"analysing":"capturing",s[12]=o.kind,s[13]=e}else e=s[13];return s[14]!==c||s[15]!==m||s[16]!==e?(t=(0,i.jsx)(w,{stage:e,source:m,tabLabel:c}),s[14]=c,s[15]=m,s[16]=e,s[17]=t):t=s[17],s[18]!==c||s[19]!==h||s[20]!==t||s[21]!==f?(n=(0,i.jsx)(A,{title:c,voiceMenu:f,flushBottom:h,children:t}),s[18]=c,s[19]=h,s[20]=t,s[21]=f,s[22]=n):n=s[22],n}if("analysing"===o.kind){let e,t;return s[23]!==o.note?(e=(0,i.jsx)(L,{text:o.note,streaming:!0}),s[23]=o.note,s[24]=e):e=s[24],s[25]!==c||s[26]!==h||s[27]!==e||s[28]!==f?(t=(0,i.jsx)(A,{title:c,fade:!0,voiceMenu:f,flushBottom:h,children:e}),s[25]=c,s[26]=h,s[27]=e,s[28]=f,s[29]=t):t=s[29],t}if("note-ready"===o.kind){let e,t;return s[30]!==o.note?(e=(0,i.jsx)(L,{text:o.note,streaming:!1}),s[30]=o.note,s[31]=e):e=s[31],s[32]!==c||s[33]!==h||s[34]!==e||s[35]!==f?(t=(0,i.jsx)(A,{title:c,fade:!0,truncate:!0,voiceMenu:f,flushBottom:h,children:e}),s[32]=c,s[33]=h,s[34]=e,s[35]=f,s[36]=t):t=s[36],t}if("error"===o.kind){let e,t;
1return s[37]!==c||s[38]!==u||s[39]!==l?(e=(0,i.jsx)(S,{specialty:u,tabLabel:c,voiceStyle:l}),s[37]=c,s[38]=u,s[39]=l,s[40]=e):e=s[40],s[41]!==c||s[42]!==h||s[43]!==e||s[44]!==f?(t=(0,i.jsx)(A,{title:c,fade:!0,truncate:!0,voiceMenu:f,flushBottom:h,children:e}),s[41]=c,s[42]=h,s[43]=e,s[44]=f,s[45]=t):t=s[45],t}return s[46]!==c||s[47]!==u||s[48]!==l?(n=(0,i.jsx)(S,{specialty:u,tabLabel:c,voiceStyle:l}),s[46]=c,s[47]=u,s[48]=l,s[49]=n):n=s[49],s[50]!==c||s[51]!==h||s[52]!==n||s[53]!==f?(r=(0,i.jsx)(A,{title:c,fade:!0,truncate:!0,voiceMenu:f,flushBottom:h,children:n}),s[50]=c,s[51]=h,s[52]=n,s[53]=f,s[54]=r):r=s[54],r}function A(e){let t,n,r,s,l,d,c,u=(0,a.c)(20),{title:m,children:p,fade:h,truncate:g,flushBottom:f,voiceMenu:b}=e,x=void 0!==h&&h,y=void 0!==g&&g,k=void 0!==f&&f&&"rounded-b-none border-b-0";u[0]!==k?(t=(0,o.cn)("relative flex-1 overflow-hidden rounded-md border border-sand-150 bg-sand-50 p-4",k),u[0]=k,u[1]=t):t=u[1],u[2]!==m?(n=(0,i.jsx)("h4",{className:"text-xl font-medium text-bark-950",children:m}),u[2]=m,u[3]=n):n=u[3],u[4]!==n||u[5]!==b?(r=(0,i.jsxs)("div",{className:"mb-4 flex items-center justify-between",children:[n,b]}),u[4]=n,u[5]=b,u[6]=r):r=u[6];let w=y&&"max-h-[18rem] overflow-hidden",v=y&&x&&"pb-12";return u[7]!==w||u[8]!==v?(s=(0,o.cn)(w,v),u[7]=w,u[8]=v,u[9]=s):s=u[9],u[10]!==p||u[11]!==s?(l=(0,i.jsx)("div",{className:s,children:p}),u[10]=p,u[11]=s,u[12]=l):l=u[12],u[13]!==x?(d=x&&(0,i.jsx)("div",{"aria-hidden":"true",className:"pointer-events-none absolute inset-x-0 bottom-0 h-[75px] bg-gradient-to-b from-transparent to-sand-50"}),u[13]=x,u[14]=d):d=u[14],u[15]!==l||u[16]!==d||u[17]!==t||u[18]!==r?(c=(0,i.jsxs)("div",{className:t,children:[r,l,d]}),u[15]=l,u[16]=d,u[17]=t,u[18]=r,u[19]=c):c=u[19],c}function S(e){let t,n,r,s=(0,a.c)(9),{specialty:o,tabLabel:l,voiceStyle:d}=e;if(null===o){let e;return s[0]===Symbol.for("react.memo_cache_sentinel")?(e=(0,i.jsx)("p",{className:"text-sm italic text-bark-500",children:"Select a specialty to preview a sample note."}),s[0]=e):e=s[0],e}return s[1]!==o||s[2]!==l||s[3]!==d?(t="flex flex-col gap-4 text-sm text-bark-950",n=(function(e,t,n){let i,a;var r=function(e,t){let n=function(e,t){let n=t.trim().toLowerCase();if(""===n)return null;let i=(c.Gh[e]??[]).find(e=>e.label.toLowerCase()===n);return i?.key??null}(e,t);if(!n)return null;let i=h[e]?.[n];return i&&i.length>0?i:null}(e,t)??(i=t.toLowerCase(),(a=m.find(e=>e.match(i)))?a.sections:[{heading:t.trim()||"Note",items:["Sample structured output for this note type, based on Kieranâs osteoporosis follow-up consult.","Transcribe or upload audio to generate a real note with Heidi for this template."],detail:["Heidi shapes the headings to the template you pick in your workspace."]},{heading:"Key points from the consult",items:["DEXA-confirmed osteoporosis; patient seeking management guidance.","On vitamin D; discussing next steps including possible bisphosphonate therapy."],detail:["Mild intermittent lower back ache; no falls or fractures."]}]);switch(n){case"BRIEF":return r.map(e=>({heading:e.heading,items:e.items.slice(0,1)}));case"DETAILED":return r.map(e=>({heading:e.heading,items:f(e,1)}));case"SUPER_DETAILED":return[...r.map(e=>({heading:e.heading,items:f(e,2)})),{heading:"Clinical reasoning",items:["Fracture risk weighed against therapy burden and patient preference.","Secondary causes considered and excluded on history."]}];case"MY_VOICE":return[{heading:"My voice",items:["After sign-up, Heidi can match your preferred note style from prior documentation.","Preview below uses the balanced Goldilocks voice until then."]},...r.map(e=>({heading:e.heading,items:[...e.items]}))];default:return r.map(e=>({heading:e.heading,items:[...e.items]}))}})(o,l,d).map(C),s[1]=o,s[2]=l,s[3]=d,s[4]=t,s[5]=n):(t=s[4],n=s[5]),s[6]!==t||s[7]!==n?(r=(0,i.jsx)("div",{className:t,children:n}),s[6]=t,s[7]=n,s[8]=r):r=s[8],r}function C(e){return(0,i.jsxs)("div",{className:"flex flex-col gap-1",children:[(0,i.jsx)("h5",{className:"font-medium text-bark-950",children:e.heading}),(0,i.jsx)("ul",{className:"ml-4 list-disc space-y-1",children:e.items.map(P)})]},e.heading)}function P(e){return(0,i.jsx)("li",{children:e},e)}function L(e){let t,n,r,s=(0,a.c)(7),{text:o,streaming:l}=e;return s[0]!==o?(t=(0,i.jsx)("p",{className:"whitespace-pre-wrap",children:o}),s[0]=o,s[1]=t):t=s[1],s[2]!==l?(n=l&&(0,i.jsx)("span",{"aria-hidden":"true",className:"ml-0.5 inline-block h-4 w-px bg-bark-700 align-middle motion-safe:animate-pulse"}),s[2]=l,s[3]=n):n=s[3],s[4]!==t||s[5]!==n?(r=(0,i.jsxs)("div",{className:"text-sm text-bark-950",children:[t,n]}),s[4]=t,s[5]=n,s[6]=r):r=s[6],r}function R(e){let t,n,r,s,l,d=(0,a.c)(13),{icon:c,iconAnimate:u,title:m,description:p}=e,h=void 0!==u&&u&&"motion-safe:animate-spin";return d[0]!==h?(t=(0,o.cn)(h),d[0]=h,d[1]=t):t=d[1],d[2]!==c||d[3]!==t?(n=(0,i.jsx)("div",{className:"flex size-10 items-center justify-center rounded-full bg-sand-150 text-bark-700",children:(0,i.jsx)(o.Int,{icon:c,size:"md",className:t})}),d[2]=c,d[3]=t,d[4]=n):n=d[4],d[5]!==m?(r=(0,i.jsx)("p",{className:"text-md font-medium text-bark-950",children:m}),d[5]=m,d[6]=r):r=d[6],d[7]!==p?(s=(0,i.jsx)("p",{className:"text-sm text-bark-600",children:p}),d[7]=p,d[8]=s):s=d[8],d[9]!==n||d[10]!==r||d[11]!==s?(l=(0,i.jsxs)("div",{className:"flex flex-col items-center gap-2 py-12 text-center",children:[n,r,s]}),d[9]=n,d[10]=r,d[11]=s,d[12]=l):l=d[12],l}let M="heidi.scribeDemo.consent.v1";function B(){try{return"1"===window.localStorage.getItem(M)}catch{return!1}}var H=n(92139);let O=[{value:"transcribe",label:"Transcribe",icon:"AudioLines"},{value:"upload",label:"Upload session audio",icon:"Upload"}];function F(e){let t,n,r,s,l,d,c=(0,a.c)(13),{value:u,onChange:m,ariaLabel:p,disabled:h}=e,g=void 0===p?"Choose input mode":p,f=void 0!==h&&h;return c[0]===Symbol.for("react.memo_cache_sentinel")?(t=(0,o.cn)("flex h-full items-center justify-center px-1 outline-none","focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-1","disabled:cursor-not-allowed disabled:opacity-50"),n=(0,i.jsx)(o.Int,{icon:"ChevronDown",size:"xxs"}),c[0]=t,c[1]=n):(t=c[0],n=c[1]),c[2]!==g||c[3]!==f?(r=(0,i.jsx)(o.tyb,{"aria-label":g,disabled:f,className:t,children:n}),c[2]=g,c[3]=f,c[4]=r):r=c[4],c[5]!==m||c[6]!==u?(s=O.map(e=>(0,i.jsxs)(o._26,{onSelect:()=>m(e.value),className:(0,o.cn)("flex items-center gap-2 px-3 py-2 text-sm",e.value===u&&"bg-sand-50"),children:[(0,i.jsx)(o.Int,{icon:e.icon,size:"sm",className:"text-forest-600"}),(0,i.jsx)("span",{children:e.label})]},e.value)),c[5]=m,c[6]=u,c[7]=s):s=c[7],c[8]!==s?(l=(0,i.jsx)(o.SQm,{align:"end",className:"w-56",children:s}),c[8]=s,c[9]=l):l=c[9],c[10]!==r||c[11]!==l?(d=(0,i.jsxs)(o.rId,{children:[r,l]}),c[10]=r,c[11]=l,c[12]=d):d=c[12],d}function G(e){let t,n,r,s,l,d,c,u=(0,a.c)(17),{value:m,options:p,onChange:h,disabled:g,className:f}=e,b=void 0!==g&&g||0===p.length,x=null!==m&&p.some(e=>e.key===m)?m:void 0;u[0]!==f?(t=(0,o.cn)("min-w-[10rem] flex-1",f),u[0]=f,u[1]=t):t=u[1];let y=x??"";return u[2]!==h?(n=e=>{e&&h(e)},u[2]=h,u[3]=n):n=u[3],u[4]===Symbol.for("react.memo_cache_sentinel")?(r=(0,i.jsx)(o.bqE,{leadingIcon:"Stethoscope","aria-label":"Select specialty",className:"h-9 w-full gap-1.5 rounded-md border-sand-150 bg-white px-2.5 py-0 text-sm font-medium text-bark-950 hover:bg-white [&_svg]:size-4",children:(0,i.jsx)(o.yvm,{placeholder:"Select specialty"})}),u[4]=r):r=u[4],u[5]!==p?(s=p.map(z),u[5]=p,u[6]=s):s=u[6],u[7]!==s?(l=(0,i.jsx)(o.gCo,{className:"z-[200]",children:s}
1),u[7]=s,u[8]=l):l=u[8],u[9]!==b||u[10]!==y||u[11]!==n||u[12]!==l?(d=(0,i.jsxs)(o.l6P,{value:y,onValueChange:n,disabled:b,children:[r,l]}),u[9]=b,u[10]=y,u[11]=n,u[12]=l,u[13]=d):d=u[13],u[14]!==t||u[15]!==d?(c=(0,i.jsx)("div",{className:t,children:d}),u[14]=t,u[15]=d,u[16]=c):c=u[16],c}function z(e){return(0,i.jsx)(o.ebT,{value:e.key,children:e.label},e.key)}let U=[".mp3",".wav",".m4a",".ogg",".webm"],$=new Set(["audio/mpeg","audio/mp3","audio/wav","audio/x-wav","audio/ogg","audio/mp4","audio/webm"]);function W(e){let t,n,s,l,d,c,u,m,p,h=(0,a.c)(18),{state:g,onBrowseClick:f,onFileDropped:b}=e,[x,y]=(0,r.useState)(!1);if("uploading"===g.kind||"processing-upload"===g.kind){let e;return h[0]!==g?(e=(0,i.jsx)(q,{state:g}),h[0]=g,h[1]=e):e=h[1],e}h[2]!==f?(t=e=>{("Enter"===e.key||" "===e.key)&&(e.preventDefault(),f())},h[2]=f,h[3]=t):t=h[3],h[4]===Symbol.for("react.memo_cache_sentinel")?(n=e=>{e.preventDefault(),y(!0)},s=()=>y(!1),h[4]=n,h[5]=s):(n=h[4],s=h[5]),h[6]!==b?(l=e=>{e.preventDefault(),y(!1);let t=e.dataTransfer.files?.[0];t&&b(t)},h[6]=b,h[7]=l):l=h[7];let k=x&&"border-forest-600 bg-white text-bark-950";return h[8]!==k?(d=(0,o.cn)("group flex flex-1 cursor-pointer flex-col items-center justify-center gap-3 rounded-xl border-2 border-dashed p-6 text-center transition-colors","border-sand-150 bg-sand-50 text-bark-700 hover:border-bark-300 hover:bg-white","focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2",k),h[8]=k,h[9]=d):d=h[9],h[10]===Symbol.for("react.memo_cache_sentinel")?(c=(0,i.jsx)("div",{className:"flex size-10 items-center justify-center rounded-full bg-sand-150 text-bark-700 group-hover:bg-sunlight-100 group-hover:text-bark-950",children:(0,i.jsx)(o.Int,{icon:"Upload",size:"md"})}),u=(0,i.jsx)("p",{className:"text-md font-medium text-bark-950",children:"Click to browse files, or drag and drop your file here"}),m=(0,i.jsx)("p",{className:"text-xs text-bark-600",children:"Accepted: mp3, wav, m4a, ogg, webm \xb7 Max 25MB"}),h[10]=c,h[11]=u,h[12]=m):(c=h[10],u=h[11],m=h[12]),h[13]!==f||h[14]!==t||h[15]!==l||h[16]!==d?(p=(0,i.jsxs)("div",{role:"button",tabIndex:0,onClick:f,onKeyDown:t,onDragOver:n,onDragLeave:s,onDrop:l,className:d,children:[c,u,m]}),h[13]=f,h[14]=t,h[15]=l,h[16]=d,h[17]=p):p=h[17],p}function q(e){let t,n,r,s,l=(0,a.c)(9),{state:d}=e,c="processing-upload"===d.kind;l[0]===Symbol.for("react.memo_cache_sentinel")?(t=(0,i.jsx)("div",{className:"flex size-10 items-center justify-center rounded-full bg-sand-150 text-bark-700",children:(0,i.jsx)(o.Int,{icon:"Loader",size:"md",className:"motion-safe:animate-spin"})}),l[0]=t):t=l[0];let u=c?"Processing audioâ¦":"Uploadingâ¦";l[1]!==u?(n=(0,i.jsx)("p",{className:"text-md font-medium text-bark-950",children:u}),l[1]=u,l[2]=n):n=l[2];let m=c?" â Heidi is transcribing your file.":"";return l[3]!==d.filename||l[4]!==m?(r=(0,i.jsxs)("p",{className:"max-w-[24rem] text-xs text-bark-600",children:[d.filename,m]}),l[3]=d.filename,l[4]=m,l[5]=r):r=l[5],l[6]!==n||l[7]!==r?(s=(0,i.jsxs)("div",{className:"flex flex-1 flex-col items-center justify-center gap-3 rounded-xl border-2 border-dashed border-sand-150 bg-sand-50 p-6 text-center",children:[t,n,r]}),l[6]=n,l[7]=r,l[8]=s):s=l[8],s}let X=["audio/mpeg","audio/mp3","audio/wav","audio/x-wav","audio/ogg","audio/mp4","audio/webm",...U].join(",");function V(e){let t,n,l,d,c,u,m,p,h,g,f,b,x,y=(0,a.c)(46),{state:k,inputMode:w,mediaStream:v,title:I,copy:T,specialty:_,specialtyOptions:E,onSpecialtyChange:j,onInputModeChange:N,onStartRequested:D,onStop:A,onReset:S,onFileChosen:C}=e,P=void 0===v?null:v,L=void 0===I?"Transcribe patient visits":I,R=void 0===T?s.Jl:T,M=(0,r.useRef)(null),B=(0,r.useId)(),[H,O]=(0,r.useState)(null);y[0]===Symbol.for("react.memo_cache_sentinel")?(t=()=>{O(null),M.current?.click()},y[0]=t):t=y[0];let F=t;y[1]!==C?(n=e=>{let t=function(e){if(0===e.size)return{ok:!1,message:"That file is empty."};if(e.size>0x1900000)return{ok:!1,message:"Files must be 25MB or smaller."};let t=e.name.toLowerCase(),n=U.some(e=>t.endsWith(e)),i=e.type.split(";")[0]?.trim().toLowerCase()??"",a=""!==i&&$.has(i);return n||a?{ok:!0}:{ok:!1,message:"Unsupported format. Use mp3, wav, m4a, ogg, or webm."}}(e);t.ok?(O(null),C(e)):O(t.message??"Couldn't accept that file.")},y[1]=C,y[2]=n):n=y[2];let z=n;y[3]!==L?(l=(0,i.jsx)(o.DZT,{as:"h3",size:"heading6",className:"text-center text-bark-950",children:L}),y[3]=L,y[4]=l):l=y[4];let q="recording"===k.kind||"preparing"===k.kind||"finalising-recording"===k.kind||"uploading"===k.kind||"processing-upload"===k.kind||"analysing"===k.kind;if(y[5]!==j||y[6]!==_||y[7]!==E||y[8]!==q?(d=(0,i.jsx)(G,{value:_,options:E,onChange:j,disabled:q}
1),y[5]=j,y[6]=_,y[7]=E,y[8]=q,y[9]=d):d=y[9],y[10]===Symbol.for("react.memo_cache_sentinel")?(c=(0,i.jsx)("span",{className:"text-md text-bark-600",children:"or"}),y[10]=c):c=y[10],y[11]!==w||y[12]!==N||y[13]!==S||y[14]!==D||y[15]!==A||y[16]!==_||y[17]!==k?(u=(0,i.jsx)(Y,{state:k,inputMode:w,specialty:_,onInputModeChange:N,onStartRequested:D,onStop:A,onReset:S,onBrowseClick:F}),y[11]=w,y[12]=N,y[13]=S,y[14]=D,y[15]=A,y[16]=_,y[17]=k,y[18]=u):u=y[18],y[19]!==u||y[20]!==d?(m=(0,i.jsxs)("div",{className:"flex flex-wrap items-center justify-center gap-2",children:[d,c,u]}),y[19]=u,y[20]=d,y[21]=m):m=y[21],y[22]!==R||y[23]!==z||y[24]!==w||y[25]!==P||y[26]!==_||y[27]!==k){var V;p="upload"===w&&("idle"===k.kind||"error"===k.kind||"uploading"===(V=k).kind||"processing-upload"===V.kind)?(0,i.jsx)(W,{state:k,onBrowseClick:F,onFileDropped:z}):(0,i.jsx)(K,{state:k,specialty:_,mediaStream:P,copy:R}),y[22]=R,y[23]=z,y[24]=w,y[25]=P,y[26]=_,y[27]=k,y[28]=p}else p=y[28];return y[29]!==H?(h=H&&(0,i.jsx)("p",{role:"alert",className:"text-sm text-error",children:H}),y[29]=H,y[30]=h):h=y[30],y[31]!==k.error||y[32]!==k.kind?(g="error"===k.kind&&(0,i.jsx)("p",{className:"text-sm text-bark-700",children:k.error.message}),y[31]=k.error,y[32]=k.kind,y[33]=g):g=y[33],y[34]!==z?(f=e=>{let t=e.target.files?.[0];t&&z(t),e.target.value=""},y[34]=z,y[35]=f):f=y[35],y[36]!==B||y[37]!==f?(b=(0,i.jsx)("input",{ref:M,id:B,type:"file",accept:X,className:"sr-only",onChange:f}),y[36]=B,y[37]=f,y[38]=b):b=y[38],y[39]!==m||y[40]!==p||y[41]!==h||y[42]!==g||y[43]!==b||y[44]!==l?(x=(0,i.jsxs)("div",{className:"flex flex-col gap-4 roun
1ded-xl border border-sand-150 bg-white p-4",children:[l,m,p,h,g,b]}),y[39]=m,y[40]=p,y[41]=h,y[42]=g,y[43]=b,y[44]=l,y[45]=x):x=y[45],x}function Y(e){let t,n,r,s,l,d,c=(0,a.c)(25),{state:u,inputMode:m,specialty:p,onInputModeChange:h,onStartRequested:g,onStop:f,onReset:b,onBrowseClick:x}=e;if("recording"===u.kind){let e,t;return c[0]===Symbol.for("react.memo_cache_sentinel")?(e=(0,i.jsxs)("span",{className:"relative flex items-center gap-1.5",children:[(0,i.jsx)("span",{"aria-hidden":"true",className:"size-1.5 rounded-full bg-red-400 motion-safe:animate-pulse"}),"Stop transcribing"]}),c[0]=e):e=c[0],c[1]!==f?(t=(0,i.jsx)(o.$nd,{variant:"ghost",onClick:f,className:"h-9 gap-1.5 rounded-md bg-bark-950 px-3 py-0 text-sm font-medium text-white hover:bg-bark-800",children:e}),c[1]=f,c[2]=t):t=c[2],t}if("preparing"===u.kind||"finalising-recording"===u.kind||"uploading"===u.kind||"processing-upload"===u.kind){let e,t="preparing"===u.kind?"Startingâ¦":"finalising-recording"===u.kind?"Wrapping upâ¦":"uploading"===u.kind?"Uploadingâ¦":"Processingâ¦";return c[3]!==t?(e=(0,i.jsx)(o.$nd,{variant:"ghost",disabled:!0,leadingIcon:"Loader",className:"h-9 gap-1.5 rounded-md bg-success px-3 py-0 text-sm font-medium text-white hover:bg-success [&_svg]:size-4 [&_svg]:animate-spin",children:(0,i.jsx)("span",{className:"px-1",children:t})}),c[3]=t,c[4]=e):e=c[4],e}if("analysing"===u.kind||"ready-to-generate"===u.kind){let e,t;return c[5]===Symbol.for("react.memo_cache_sentinel")?(e=(0,i.jsx)("span",{className:"px-1",children:"Start again"}),c[5]=e):e=c[5],c[6]!==b?(t=(0,i.jsx)(o.$nd,{variant:"ghost",onClick:b,leadingIcon:"RotateCcw",className:"h-9 gap-1.5 rounded-md border border-sand-150 bg-white px-3 py-0 text-sm font-medium text-bark-950 hover:bg-sand-50 [&_svg]:size-4",children:e}),c[6]=b,c[7]=t):t=c[7],t}let y="error"===u.kind,k="transcribe"===m?y?"Try again":"Transcribe":y?"Try again":"Upload session audio",w="transcribe"===m?"AudioLines":"Upload",v="transcribe"===m?g:x,I="transcribe"===m&&null===p;if(c[8]!==I||c[9]!==u)t=("idle"===u.kind||"note-ready"===u.kind||"error"===u.kind)&&!I,c[8]=I,c[9]=u,c[10]=t;else t=c[10];let T=t;c[11]===Symbol.for("react.memo_cache_sentinel")?(n=(0,o.cn)("flex h-9 items-stretch overflow-hidden rounded-md bg-success text-white"),c[11]=n):n=c[11];let _=!T;return c[12]!==k?(r=(0,i.jsx)("span",{className:"px-1",children:k}),c[12]=k,c[13]=r):r=c[13],c[14]!==w||c[15]!==v||c[16]!==_||c[17]!==r?(s=(0,i.jsx)(o.$nd,{variant:"ghost",onClick:v,leadingIcon:w,disabled:_,className:"h-9 gap-1.5 rounded-none bg-success px-3 py-0 text-sm font-medium text-white hover:bg-success [&_svg]:size-4",children:r}),c[14]=w,c[15]=v,c[16]=_,c[17]=r,c[18]=s):s=c[18],c[19]!==m||c[20]!==h?(l=(0,i.jsx)(F,{value:m,onChange:h,ariaLabel:"Choose input mode"}),c[19]=m,c[20]=h,c[21]=l):l=c[21],c[22]!==s||c[23]!==l?(d=(0,i.jsxs)("div",{className:n,children:[s,l]}),c[22]=s,c[23]=l,c[24]=d):d=c[24],d}function K(e){let t,n=(0,a.c)(29),{state:r,specialty:s,mediaStream:o,copy:l}=e;if("idle"===r.kind){let e,t;if(null===s){let e;return n[0]===Symbol.for("react.memo_cache_sentinel")?(e=(0,i.jsx)("div",{className:"flex flex-1 items-center justify-center rounded-xl border border-sand-150 bg-sand-50 p-4 text-sm italic text-bark-500",children:"Select a specialty to preview a sample consult."}),n[0]=e):e=n[0],e}return n[1]!==s?(e=(p[s]??p[c.lW]).map(J),n[1]=s,n[2]=e):e=n[2],n[3]!==e?(t=(0,i.jsx)("div",{className:"flex-1 rounded-xl border border-sand-150 bg-sand-50 p-4 text-sm text-bark-950",children:e}),n[3]=e,n[4]=t):t=n[4],t}if("preparing"===r.kind){let e,t,a;return n[5]!==l.preparingTitle?(e=(0,i.jsx)("p",{className:"text-md font-medium text-bark-950",children:l.preparingTitle}),n[5]=l.preparingTitle,n[6]=e):e=n[6],n[7]!==l.preparingDescription?(t=(0,i.jsx)("p",{className:"text-sm text-bark-600",children:l.preparingDescription}),n[7]=l.preparingDescription,n[8]=t):t=n[8],n[9]!==e||n[10]!==t?(a=(0,i.jsxs)("div",{className:"flex flex-1 flex-col items-center justify-center gap-2 rounded-xl border border-sand-150 bg-sand-50 p-4 text-center",children:[e,t]}),n[9]=e,n[10]=t,n[11]=a):a=n[11],a}if("recording"===r.kind||"finalising-recording"===r.kind){let e,t,a,s;if(r.transcript){let e;return n[12]!==r.transcript?(e=(0,i.jsx)("div",{className:"flex flex-1 flex-col gap-2 overflow-hidden rounded-xl border border-sand-150 bg-sand-50 p-4 text-sm text-bark-950",children:(0,i.jsx)("p",{className:"whitespace-pre-wrap",children:r.transcript})}),n[12]=r.transcript,n[13]=e):e=n[13],e}let d="recording"===r.kind;return n[14]!==o||n[15]!==d?(e=(0,i.jsx)("div",{className:"w-full max-w-75",children:(0,i.jsx)(H.P,{stream:o,isActive:d,height:40,fadeColor:"#F9F4F1",gain:3})}),n[14]=o,n[15]=d,n[16]=e):e=n[16],n[17]!==l.transcribingTitle?(t=(0,i.jsx)("p",{className:"text-md font-medium text-bark-950",children:l.transcribingTitle}),n[17]=l.transcribingTitle,n[18]=t):t=n[18],n[19]!==l.transcribingDescription?(a=(0,i.jsx)("p",{className:"text-sm text-bark-600",children:l.transcribingDescription}),n[19]=l.transcribingDescription,n[20]=a):a=n[20],n[21]!==e||n[22]!==t||n[23]!==a?(s=(0,i.jsxs)("div",{className:"flex flex-1 flex-col items-center justify-center gap-2 rounded-xl border border-sand-150 bg-sand-50 p-4 text-center",children:[e,t,a]}),n[21]=e,n[22]=t,n[23]=a,n[24]=s):s=n[24],s}if("ready-to-generate"===r.kind||"analysing"===r.kind||"note-ready"===r.kind){let e;return n[25]!==r.transcript?(e=(0,i.jsx)("div",{className:"flex-1 rounded-xl border border-sand-150 bg-sand-50 p-4 text-sm text-bark-950",children:(0,i.jsx)("p",{className:"whitespace-pre-wrap",children:r.transcript})}),n[25]=r.transcript,n[26]=e):e=n[26],e}if("uploading"===r.kind||"processing-upload"===r.kind){let e;return n[27]===Symbol.for("react.memo_cache_sentinel")?(e=(0,i.jsx)("div",{className:"flex-1 rounded-xl border border-sand-150 bg-sand-50 p-4 text-sm text-bark-500 italic",children:"Processing your uploadâ¦"}
1),n[27]=e):e=n[27],e}return n[28]===Symbol.for("react.memo_cache_sentinel")?(t=(0,i.jsxs)("div",{className:"flex-1 rounded-xl border border-sand-150 bg-sand-50 p-4 text-sm text-bark-500",children:["Something went wrong. Press ",(0,i.jsx)("span",{className:"font-medium",children:"Try again"})," ","to retry."]}),n[28]=t):t=n[28],t}function J(e){return(0,i.jsxs)("p",{children:[e.time,": ",e.text]},e.time)}let Q=["audio/webm;codecs=opus","audio/webm","audio/mp4","audio/ogg"],Z={kind:"idle"};function ee(e,t){switch(t.type){case"preparing":return{kind:"preparing"};case"session-ready":return{kind:"preparing",sessionId:t.sessionId};case"recording-ready":return{kind:"recording",sessionId:t.sessionId,recordingId:t.recordingId,transcript:"",uploadedChunks:0};case"transcript-updated":if("recording"===e.kind||"finalising-recording"===e.kind)return{...e,transcript:t.transcript};return e;case"chunk-uploaded":if("recording"===e.kind)return{...e,uploadedChunks:e.uploadedChunks+1};return e;case"finalising":if("recording"===e.kind)return{kind:"finalising-recording",sessionId:e.sessionId,recordingId:e.recordingId,transcript:e.transcript};return e;case"transcript-finalised":if("finalising-recording"===e.kind||"processing-upload"===e.kind)return{kind:"ready-to-generate",sessionId:e.sessionId,transcript:t.transcript};return e;case"upload-start":return{kind:"uploading",filename:t.filename};case"upload-complete":return{kind:"processing-upload",sessionId:t.sessionId,filename:t.filename};case"analysing":return{kind:"analysing",sessionId:t.sessionId,transcript:t.transcript,note:""};case"note-chunk":if("analysing"===e.kind)return{...e,note:e.note+t.chunk};return e;case"note-complete":if("analysing"===e.kind)return{kind:"note-ready",sessionId:e.sessionId,transcript:e.transcript,note:e.note};return e;case"error":return{kind:"error",previous:e.kind,error:t.error};case"reset":return Z}}async function et(e,t,n){let i={method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(t)};n&&(i.signal=n);let a=await fetch(e,i);if(!a.ok)throw Error(`${e} failed with ${a.status}: ${await a.text()}`);return await a.json()}async function en(e){if(413===e.status)return"That file is too large to upload. Please use an audio file under 25 MB.";try{let t=await e.json();if("string"==typeof t.message)return t.message}catch{}return`Couldn't upload that audio (HTTP ${e.status}).`}async function ei(e,t,n){let i=new FormData;i.append("sessionId",e),i.append("recordingId",t),i.append("index",String(n.index)),i.append("audio",n.blob);let a=await fetch("/api/scribe/segment-upload",{method:"POST",body:i});if(!a.ok)throw Error(`segment-upload failed with ${a.status}: ${await a.text()}`)}async function*ea(e){let t=e.getReader(),n=new TextDecoder,i="";for(;;){let{done:e,value:a}=await t.read();if(e)break;let r=(i+=n.decode(a,{stream:!0})).split("\n\n");for(let e of(i=r.pop()??"",r)){let t=e.trim();if(!t.startsWith("data:"))continue;let n=t.slice(5).trim();try{let e=JSON.parse(n);"string"==typeof e.data&&(yield e.data)}catch{}}}}let er=/(test\s*\d*|system form)/i;function es(e){return"note-ready"===e.kind||"analysing"===e.kind||"ready-to-generate"===e.kind}function eo(e){var t,n;let o,d,c,u,m,p,h,g,f,b,x,y,k,w,v,I,T,_,E,N,D,A,S,C,P,L,R,H,O,F,G,z,U=(0,a.c)(113),{widgetConfig:$}=e,{state:W,actions:q,mediaStream:X}=function(){let[e,t]=(0,r.useReducer)(ee,Z),n=(0,r.useRef)(null),i=(0,r.useRef)(null),a=(0,r.useRef)(null),o=(0,r.useRef)(e);o.current=e;let l=function(e){let{chunkIntervalMs:t=1e4,onChunk:n,onError:i}=e,a=(0,r.useRef)(null),s=(0,r.useRef)(null),o=(0,r.useRef)(null),l=(0,r.useRef)(0),d=(0,r.useRef)(Promise.resolve()),c=(0,r.useRef)(!1),u=(0,r.useRef)(null),[m,p]=(0,r.useState)(!1),[h,g]=(0,r.useState)(null),f=(0,r.useCallback)(()=>{if(u.current&&(clearTimeout(u.current),u.current=null),a.current){for(let e of a.current.getTracks())e.stop();a.current=null}g(null),s.current=null,o.current=null,l.current=0},[]),b=(0,r.useCallback)(()=>{let e=a.current;if(!e||c.current)return;let r=o.current,m=new MediaRecorder(e,r?{mimeType:r}:void 0);s.current=m,m.addEventListener("dataavailable",e=>
1{if(!e.data||0===e.data.size)return;let t=l.current++;d.current=d.current.then(()=>n({blob:e.data,index:t})).catch(e=>{i({code:"upload_failed",message:e instanceof Error?e.message:"Failed to upload audio chunk."})})}),m.addEventListener("stop",()=>{c.current||b()}),m.addEventListener("error",()=>{i({code:"unknown",message:"Something went wrong while transcribing. Please try again."})}),m.start(),u.current=setTimeout(()=>{"recording"!==m.state||c.current||m.stop()},t)},[t,n,i]),x=(0,r.useCallback)(async()=>{let e;if(!s.current){try{e=await navigator.mediaDevices.getUserMedia({audio:!0})}catch(t){let e;throw i("NotAllowedError"===(e=t instanceof Error?t.name:String(t))||"SecurityError"===e?{code:"mic_permission_denied",message:"Microphone access denied. Update your browser settings to transcribe."}:"NotFoundError"===e||"OverconstrainedError"===e?{code:"mic_unavailable",message:"No microphone detected on this device."}:{code:"unknown",message:"Couldn't start transcribing. Please try again."}),t}a.current=e,g(e),o.current=function(){if("u"<typeof MediaRecorder)return null;for(let e of Q)if(MediaRecorder.isTypeSupported(e))return e;return null}(),c.current=!1,l.current=0,d.current=Promise.resolve(),b(),p(!0)}},[i,b]),y=(0,r.useCallback)(async()=>{c.current=!0,u.current&&(clearTimeout(u.current),u.current=null);let e=s.current;if(!e||"inactive"===e.state){f(),p(!1);return}await new Promise(t=>{e.addEventListener("stop",()=>t(),{once:!0}),e.stop()}),await d.current,f(),p(!1)},[f]);return(0,r.useEffect)(()=>()=>{c.current=!0,s.current&&"inactive"!==s.current.state&&s.current.stop(),f()},[f]),{isRecording:m,stream:h,start:x,stop:y}}({onChunk:(0,r.useCallback)(async e=>{let a=n.current,r=i.current;a&&r&&(await ei(a,r,e),t({type:"chunk-uploaded"}))},[]),onError:(0,r.useCallback)(e=>{t({type:"error",error:e})},[])}),d=(0,r.useRef)(l);d.current=l,function(e){let{active:t,sessionId:n,onTranscriptChange:i}=e,a=(0,r.useRef)(i);a.current=i,(0,r.useEffect)(()=>{if(!t||!n)return;let e=!1,i=null,r=null,s=2500,o="";async function l(){if(!e){r=new AbortController;try{let e=await fetch(`/api/scribe/transcript?sessionId=${encodeURIComponent(n)}`,{signal:r.signal});if(e.ok){let t=(await e.json()).transcript??"";t!==o&&(o=t,a.current(t)),s=2500}else e.status>=500&&(s=Math.min(2*s,3e4))}catch(e){e instanceof Error&&"AbortError"!==e.name&&(s=Math.min(2*s,3e4))}e||(i=setTimeout(l,s))}}return l(),()=>{e=!0,i&&clearTimeout(i),r&&r.abort()}},[t,n])}({active:"recording"===e.kind,sessionId:"recording"===e.kind?e.sessionId:null,onTranscriptChange:(0,r.useCallback)(e=>{t({type:"transcript-updated",transcript:e})},[])});let c=(0,r.useCallback)(async()=>{t({type:"preparing"});try{let e=await et("/api/scribe/session",{});t({type:"session-ready",sessionId:e.sessionId}),n.current=e.sessionId;let a=await et("/api/scribe/segment-init",{sessionId:e.sessionId});i.current=a.recordingId,t({type:"recording-ready",sessionId:e.sessionId,recordingId:a.recordingId}),await d.current.start()}catch(e){t({type:"error",error:{code:e instanceof Error&&/segment-init/.test(e.message)?"init_failed":"session_failed",message:"Couldn't start the demo. Please try again."}})}},[]),u=(0,r.useCallback)(async()=>{let e=o.current;if("recording"===e.kind){t({type:"finalising"});try{await d.current.stop(),await et("/api/scribe/segment-finish",{sessionId:e.sessionId,recordingId:e.recordingId});let n=await fetch(`/api/scribe/transcript?sessionId=${encodeURIComponent(e.sessionId)}`),{transcript:i}=await n.json(),a=i??"";if(!a)return void t({type:"error",error:{code:"transcript_empty",message:"We didn't catch any speech. Try transcribing for a few more seconds."}});t({type:"transcript-finalised",transcript:a})}catch(e){t({type:"error",error:{code:"finish_failed",message:e instanceof Error?e.message:"Couldn't finish transcribing."}})}}},[]),m=(0,r.useCallback)(async function(e,n){let i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:"consult-note",r=o.current;if("ready-to-generate"!==r.kind&&"note-ready"!==r.kind&&"analysing"!==r.kind)return;let l=r.sessionId,d=r.transcript;a.current&&a.current.abort(),t({type:"analysing",sessionId:l,transcript:d});let c=new AbortController;a.current=c;let u=(0,s.GT)(i);try{let i=await fetch(u,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({sessionId:l,templateId:e,voiceStyle:n,brain:"LEFT"}),signal:c.signal});if(!i.ok)throw Error(`${u} failed with ${i.status}`);if(!i.body)throw Error(`${u} returned no body to stream`);for await(let e of ea(i.body))t({type:"note-chunk",chunk:e});t({type:"note-complete"})}catch(e){if(e instanceof Error&&"AbortError"===e.name)return;t({type:"error",error:{code:"note_failed",message:"Couldn't generate the note. Please try again."}})}finally{a.current===c&&(a.current=null)}},[]),p=(0,r.useCallback)(async e=>{let i;t({type:"upload-start",filename:e.name});try{let a=new FormData;a.append("audio",e),a.append("filename",e.name);let r=await fetch("/api/scribe/upload-audio",{method:"POST",body:a});if(!r.ok)return void t({type:"error",error:{code:"upload_failed",message:await en(r)}});n.current=i=(await r.json()).sessionId}catch(e){t({type:"error",error:{code:"upload_failed",message:e instanceof Error?`Couldn't upload that audio: ${e.message}`:"Couldn't upload that audio."}});return}t({type:"upload-complete",sessionId:i,filename:e.name});let a=Date.now()+9e4,r=i;for(;Date.now()<a;){if(n.current!==r)return;let e=o.current.kind;if("idle"===e||"error"===e)return;try{let e=await fetch(`/api/scribe/transcript?sessionId=${encodeURIComponent(i)}`);if(e.ok){let n=await e.json();if(n.transcript&&n.transcript.trim())return void t({type:"transcript-finalised",transcript:n.transcript})}}catch{}await new Promise(e=>setTimeout(e,2e3))}t({type:"error",error:{code:"transcript_timeout",message:"Heidi is still processing your audio. Try a shorter clip or upload again."}})},[]),h=(0,r.useCallback)(()=>{a.current&&a.current.abort(),d.current.isRecording&&d.current.stop(),n.current=null,i.current=null,t({type:"reset"})},[]);return{state:e,actions:(0,r.useMemo)(()=>({startRecording:c,stopRecording:u,uploadAudio:p,generateNote:m,reset:h}),[c,u,p,m,h]),mediaStream:l.stream}}();U[0]!==$?(o=(0,s.OL)($),U[0]=$,U[1]=o):o=U[1];let Y=o;U[2]!==Y?(d=(0,s.CM)(Y),U[2]=Y,U[3]=d):d=U[3];let K=d;U[4]!==$?(c=(0,s.SY)($),U[4]=$,U[5]=c):c=U[5];let J=c,[er,eo]=(0,r.useState)(null);U[6]===Symbol.for("react.memo_cache_sentinel")?(u=[],U[6]=u):u=U[6];let[em,ep]=(0,r.useState)(u),[eh,eg]=(0,r.useState)(""),[ef,eb]=(0,r.useState)("transcribe"),[ex,ey]=(0,r.useState)("GOLDILOCKS"),[ek,ew]=(0,r.useState)(null),[ev,eI]=(0,r.useState)(null);U[7]!==Y||U[8]!==er?(m=()=>{null===er||Y.some(e=>e.key===er)||eo(null)},p=[Y,er],U[7]=Y,U[8]=er,U[9]=m,U[10]=p):(m=U[9],p=U[10]),(0,r.useEffect)(m,p),U[11]===Symbol.for("react.memo_cache_sentinel")?(h=()=>{let e=!1;return fetch("/api/scribe/templates").then(eu).then(t=>{let{templates:n}=t;e||ep(n.filter(ec))}).catch(ed),()=>{e=!0}},g=[],U[11]=h,U[12]=g):(h=U[11],g=U[12]),(0,r.useEffect)(h,g);let eT=er??K;if(U[13]!==em||U[14]!==eT||U[15]!==$){let e=(0,s.zp)(eT,$);f=(0,s.D1)(e,em).map(el),U[13]=em,U[14]=eT,U[15]=$,U[16]=f}else f=U[16];let e_=f;U[17]!==eh||U[18]!==e_?(b=e_.find(e=>e.id===eh)?.endpoint??"consult-note",U[17]=eh,U[18]=e_,U[19]=b):b=U[19];let eE=b;U[20]!==eh||U[21]!==e_?(x=e_.find(e=>e.id===eh)?.label??e_[0]?.label??"SOAP note",U[20]=eh,U[21]=e_,U[22]=x):x=U[22];let ej=x;U[23]!==eh||U[24]!==e_?(y=()=>{0!==e_.length&&(e_.some(e=>e.id===eh)||eg(e_[0].id))},k=[e_,eh],U[23]=eh,U[24]=e_,U[25]=y,U[26]=k):(y=U[25],k=U[26]),(0,r.useEffect)(y,k);let eN=(0,r.useRef)(er);U[27]!==q||U[28]!==eh||U[29]!==er||U[30]!==W||U[31]!==e_[0]||U[32]!==ex?(w=()=>
1{if(eN.current===er)return;eN.current=er;let e=e_[0];if(!e)return;let t=e.id!==eh;eg(e.id),t&&es(W)&&q.generateNote(e.id,ex,e.endpoint)},U[27]=q,U[28]=eh,U[29]=er,U[30]=W,U[31]=e_[0],U[32]=ex,U[33]=w):w=U[33],U[34]!==q||U[35]!==eh||U[36]!==er||U[37]!==W||U[38]!==e_||U[39]!==ex?(v=[er,e_,W,ex,q,eh],U[34]=q,U[35]=eh,U[36]=er,U[37]=W,U[38]=e_,U[39]=ex,U[40]=v):v=U[40],(0,r.useEffect)(w,v),U[41]!==q||U[42]!==eE||U[43]!==eh||U[44]!==W.kind||U[45]!==ex?(I=()=>{"ready-to-generate"===W.kind&&eh&&q.generateNote(eh,ex,eE)},T=[W.kind,eh,ex,eE,q],U[41]=q,U[42]=eE,U[43]=eh,U[44]=W.kind,U[45]=ex,U[46]=I,U[47]=T):(I=U[46],T=U[47]),(0,r.useEffect)(I,T),U[48]!==q||U[49]!==eh||U[50]!==W||U[51]!==e_||U[52]!==ex?(_=e=>{if(e===eh)return;eg(e);let t=e_.find(t=>t.id===e)?.endpoint??"consult-note";es(W)&&e&&q.generateNote(e,ex,t)},U[48]=q,U[49]=eh,U[50]=W,U[51]=e_,U[52]=ex,U[53]=_):_=U[53];let eD=_;U[54]!==q||U[55]!==eE||U[56]!==eh||U[57]!==W||U[58]!==ex?(E=e=>{e!==ex&&(ey(e),es(W)&&eh&&q.generateNote(eh,e,eE))},U[54]=q,U[55]=eE,U[56]=eh,U[57]=W,U[58]=ex,U[59]=E):E=U[59];let eA=E;U[60]!==q?(N=e=>{eo(e),q.reset()},U[60]=q,U[61]=N):N=U[61];let eS=N;U[62]!==q||U[63]!==ef?(D=e=>{e!==ef&&(eb(e),q.reset())},U[62]=q,U[63]=ef,U[64]=D):D=U[64];let eC=D;U[65]!==q?(A=e=>{if("record"===e.kind){eI("transcribe"),q.startRecording();return}eI("upload"),q.uploadAudio(e.file)},U[65]=q,U[66]=A):A=U[66];let eP=A;U[67]!==ek||U[68]!==eP?(S=()=>{if(ek){ew(null);try{window.localStorage.setItem(M,"1")}catch{}eP(ek)}},U[67]=ek,U[68]=eP,U[69]=S):S=U[69];let eL=S;U[70]!==eP?(C=()=>{let e={kind:"record"};B()?eP(e):ew(e)},U[70]=eP,U[71]=C):C=U[71];let eR=C;U[72]!==eP?(P=e=>{let t={kind:"upload",file:e};B()?eP(t):ew(t)},U[72]=eP,U[73]=P):P=U[73];let eM=P;U[74]!==q?(L=()=>void q.stopRecording(),U[74]=q,U[75]=L):L=U[75],U[76]!==q.reset||U[77]!==Y||U[78]!==J||U[79]!==eM||U[80]!==eC||U[81]!==eS||U[82]!==ef||U[83]!==X||U[84]!==eR||U[85]!==er||U[86]!==W||U[87]!==L?(R=(0,i.jsx)(V,{state:W,inputMode:ef,mediaStream:X,title:J.transcribeTitle,copy:J,specialty:er,specialtyOptions:Y,onSpecialtyChange:eS,onInputModeChange:eC,onStartRequested:eR,onStop:L,onReset:q.reset,onFileChosen:eM}),U[76]=q.reset,U[77]=Y,U[78]=J,U[79]=eM,U[80]=eC,U[81]=eS,U[82]=ef,U[83]=X,U[84]=eR,U[85]=er,U[86]=W,U[87]=L,U[88]=R):R=U[88];let eB="preparing"===W.kind||"uploading"===W.kind||"processing-upload"===W.kind||"finalising-recording"===W.kind;U[89]!==ev||U[90]!==W?(t=W,n=ev,H="note-ready"===t.kind||null!==n?"upload"===n?"upload":"live_recording":"auto_demo",U[89]=ev,U[90]=W,U[91]=H):H=U[91],U[92]!==ej||U[93]!==J||U[94]!==eD||U[95]!==eA||U[96]!==eh||U[97]!==er||U[98]!==W||U[99]!==eB||U[100]!==H||U[101]!==e_||U[102]!==ex?(O=(0,i.jsx)(j,{state:W,voiceStyle:ex,onVoiceStyleChange:eA,tabs:e_,selectedTemplateId:eh,onTemplateChange:eD,activeTabLabel:ej,specialty:er,copy:J,templateSwitchDisabled:eB,gateSource:H}),U[92]=ej,U[93]=J,U[94]=eD,U[95]=eA,U[96]=eh,U[97]=er,U[98]=W,U[99]=eB,U[100]=H,U[101]=e_,U[102]=ex,U[103]=O):O=U[103];let eH=null!==ek,eO=ek?.kind==="upload"?"upload":"transcribe";return U[104]===Symbol.for("react.memo_cache_sentinel")?(F=e=>{e||ew(null)},U[104]=F):F=U[104],U[105]!==eL||U[106]!==eH||U[107]!==eO?(G=(0,i.jsx)(l,{open:eH,mode:eO,onOpenChange:F,onConfirm:eL}),U[105]=eL,U[106]=eH,U[107]=eO,U[108]=G):G=U[108],U[109]!==R||U[110]!==O||U[111]!==G?(z=(0,i.jsxs)("div",{className:"grid w-full max-w-container-lg grid-cols-1 gap-3 md:grid-cols-2",children:[R,O,G]}),U[109]=R,U[110]=O,U[111]=G,U[112]=z):z=U[112],z}function el(e){return{id:e.id,label:e.label,endpoint:e.endpoint}}function ed(){}function ec(e){return!er.test(e.name)}function eu(e){return e.json()}},48963:(e,t,n)=>{n.d(t,{s:()=>i});let i="unauth_scribe"},57985:(e,t,n)=>{n.d(t,{Gh:()=>r,WF:()=>i,lW:()=>a});let i=[{key:"family-medicine",label:"Family Medicine"},{key:"specialist",label:"Specialist"},{key:"nursing",label:"Nursing"},{key:"mental-health",label:"Mental Health"},{key:"allied-health",label:"Allied Health"},{key:"dental",label:"Dental"},{key:"aged-care",label:"Aged Care"},{key:"veterinarian",label:"Veterinarian"},{key:"trainee",label:"Trainee"}],a="family-medicine",r={"family-medicine":[{key:"soap",label:"SOAP note",endpoint:"consult-note",templateId:"TEMPLATE_ID_TBD_FAMILY_MEDICINE_SOAP"},{key:"referral-letter",label:"Referral letter",endpoint:"documents",templateId:"TEMPLATE_ID_TBD_FAMILY_MEDICINE_REFERRAL"},{key:"treatment-plan",label:"Patient treatment plan",endpoint:"documents",templateId:"TEMPLATE_ID_TBD_FAMILY_MEDICINE_TREATMENT_PLAN"}],specialist:[{key:"soap",label:"SOAP note",endpoint:"consult-note",templateId:"TEMPLATE_ID_TBD_SPECIALIST_SOAP"},{key:"referral-letter",label:"Referral letter",endpoint:"documents",templateId:"TEMPLATE_ID_TBD_SPECIALIST_REFERRAL"},{key:"discharge-summary",label:"Discharge summary",endpoint:"documents",templateId:"TEMPLATE_ID_TBD_SPECIALIST_DISCHARGE"}],nursing:[{key:"nursing-note",label:"Nursing note",endpoint:"consult-note",templateId:"TEMPLATE_ID_TBD_NURSING_NOTE"},{key:"care-plan",label:"Care plan",endpoint:"documents",templateId:"TEMPLATE_ID_TBD_NURSING_CARE_PLAN"},{key:"handover",label:"Handover",endpoint:"documents",templateId:"TEMPLATE_ID_TBD_NURSING_HANDOVER"}],"mental-health":[{key:"soap",label:"SOAP note",endpoint:"consult-note",templateId:"TEMPLATE_ID_TBD_MENTAL_HEALTH_SOAP"},{key:"progress-note",label:"Progress note",endpoint:"consult-note",templateId:"TEMPLATE_ID_TBD_MENTAL_HEALTH_PROGRESS"},{key:"insurance-form",label:"Insurance form",endpoint:"documents",templateId:"TEMPLATE_ID_TBD_MENTAL_HEALTH_INSURANCE"}],"allied-health":[{key:"soap",label:"SOAP note",endpoint:"consult-note",templateId:"TEMPLATE_ID_TBD_ALLIED_HEALTH_SOAP"},{key:"referral-letter",label:"Referral letter",endpoint:"documents",templateId:"TEMPLATE_ID_TBD_ALLIED_HEALTH_REFERRAL"},{key:"treatment-plan",label:"Treatment plan",endpoint:"documents",templateId:"TEMPLATE_ID_TBD_ALLIED_HEALTH_TREATMENT_PLAN"}],dental:[{key:"dental-note",label:"Dental note",endpoint:"consult-note",templateId:"TEMPLATE_ID_TBD_DENTAL_NOTE"},{key:"referral-letter",label:"Referral letter",endpoint:"documents",templateId:"TEMPLATE_ID_TBD_DENTAL_REFERRAL"},{key:"treatment-plan",label:"Treatment plan",endpoint:"documents",templateId:"TEMPLATE_ID_TBD_DENTAL_TREATMENT_PLAN"}],"aged-care":[{key:"progress-note",label:"Progress note",endpoint:"consult-note",templateId:"TEMPLATE_ID_TBD_AGED_CARE_PROGRESS"},{key:"care-plan",label:"Care plan",endpoint:"documents",templateId:"TEMPLATE_ID_TBD_AGED_CARE_CARE_PLAN"},{key:"incident-report",label:"Incident report",endpoint:"documents",templateId:"TEMPLATE_ID_TBD_AGED_CARE_INCIDENT"}],veterinarian:[{key:"soap",label:"SOAP note",endpoint:"consult-note",templateId:"TEMPLATE_ID_TBD_VET_SOAP"},{key:"referral-letter",label:"Referral letter",endpoint:"documents",templateId:"TEMPLATE_ID_TBD_VET_REFERRAL"},{key:"treatment-plan",label:"Treatment plan",endpoint:"documents",templateId:"TEMPLATE_ID_TBD_VET_TREATMENT_PLAN"}],trainee:[{key:"soap",label:"SOAP note",endpoint:"consult-note",templateId:"TEMPLATE_ID_TBD_TRAINEE_SOAP"},{key:"case-summary",label:"Case summary",endpoint:"documents",templateId:"TEMPLATE_ID_TBD_TRAINEE_CASE_SUMMARY"}]}}}]);
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.