1(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[28086],{5705:(e,t,r)=>{"use strict";r.r(t),r.d(t,{PDFFormFillDialog:()=>Q});var a=r(95155),s=r(12115),l=r(51834),n=r(3998),i=r(65142),o=r(11647),c=r(73457),d=r(76444),m=r(26282),u=r(99708),p=r(63240),h=r(52056),x=r(46701),f=r(35299),g=r(20908),N=r(65229),j=r(23327),b=r(18514),v=r(24033),y=r(35626),w=r(39867),k=r(61362),C=r(18720),F=r(48370),P=r(26333),S=r(63817),A=r(5917),D=r(64269);let T={firstName:"First Name",lastName:"Last Name",preferredName:"Preferred Name",dateOfBirth:"Date of Birth",gender:"Gender",pronouns:"Pronouns",address:"Address",mobile:"Phone/Mobile",email:"Email",occupation:"Occupation",maritalStatus:"Marital Status",title:"Title",emergencyContactName:"Emergency Contact Name",emergencyContactMobile:"Emergency Contact Phone",emergencyContactEmail:"Emergency Contact Email",emergencyContactRelationship:"Emergency Contact Relationship",medicareNumber:"Medicare Number",medicareIRN:"Medicare IRN",medicareExpiry:"Medicare Expiry",dvaNumber:"DVA Number",dvaCardType:"DVA Card Type",healthFundName:"Health Fund Name",healthFundMemberNumber:"Health Fund Member Number",fundingSource:"Funding Source",ndisNumber:"NDIS Number",ndisValidTo:"NDIS Plan End",workcoverClaimNumber:"WorkCover Claim Number",tacClaimNumber:"TAC Claim Number",gpName:"GP Name",gpAddress:"GP Address/Clinic",gpPhone:"GP Phone",gpEmail:"GP Email",gpProviderNumber:"GP Provider Number",referrerName:"Referrer Name",referrerProviderNumber:"Referrer Provider Number",referrerPhone:"Referrer Phone",referrerEmail:"Referrer Email",referrerAddress:"Referrer Address",referrerPracticeName:"Referrer Practice Name",referrerFax:"Referrer Fax",referrerRegistrationNumber:"Referrer Registration Number",referrerLocationNumber:"Referrer Location Number",referralDate:"Referral Date",referralExpiryDate:"Referral Expiry Date",referralReason:"Referral Reason",referralSessionsTotal:"Referral Sessions Total",referralSessionsUsed:"Referral Sessions Used",claimantFirstName:"Claimant First Name",claimantLastName:"Claimant Last Name",claimantDob:"Claimant Date of Birth",claimantMedicareNumber:"Claimant Medicare Number",claimantMedicareIRN:"Claimant Medicare IRN",countryOfBirth:"Country of Birth",culturalBackground:"Cultural Background",indigenousStatus:"Indigenous Status",preferredLanguage:"Preferred Language",interpreterRequired:"Interpreter Required",notes:"Client Notes",status:"Client Status"},R={sessionDate:"Session Date",title:"Session Title",generatedNote:"Generated Note",duration:"Session Duration"},L={name:"Practitioner Name",email:"Practitioner Email",profession:"Profession",practiceName:"Practice Name",practiceAddress:"Practice Address"},M={totalSessionCount:"Total Session Count",treatmentGoal1:"Treatment Goal 1",treatmentGoal2:"Treatment Goal 2",treatmentGoal3:"Treatment Goal 3",treatmentPlanName:"Treatment Plan Name"},E=[{label:"Client",type:"client",catalog:T},{label:"Session",type:"session",catalog:R},{label:"Practitioner",type:"user",catalog:L},{label:"Derived",type:"derived",catalog:M}],O=[{key:"score",label:"Total score"},{key:"severity",label:"Severity / interpretation"},{key:"date",label:"Completion date"}];function B(e){if(!e||"unmapped"===e.sourceType||!e.sourceField)return"Not mapped";if("assessment"===e.sourceType)return e.sourceField;let t=E.find(t=>t.type===e.sourceType);return t&&t.catalog[e.sourceField]||e.sourceField}function G(e){let{value:t,onChange:r,knownAssessmentTools:l=[],className:i}=e,[o,c]=(0,s.useState)(!1),d=(0,s.useMemo)(()=>{let e=[];for(let t of E)for(let[r,a]of Object.entries(t.catalog))e.push({sourceType:t.type,sourceField:r,label:a});for(let t of l)for(let r of O)e.push({sourceType:"assessment",sourceField:"".concat(t,":").concat(r.key),label:"".concat(t," â ").concat(r.label)});return e},[l]);return(0,a.jsxs)(P.AM,{open:o,onOpenChange:c,children:[(0,a.jsx)(P.Wv,{asChild:!0,children:(0,a.jsxs)(n.$,{variant:"outline",role:"combobox","aria-expanded":o,className:(0,D.cn)("h-7 justify-between text-xs font-normal w-full max-w-[280px]",i),children:[(0,a.jsx)("span",{className:"truncate",children:B(t)}),(0,a.jsx)(v.A,{className:"h-3 w-3 ml-2 opacity-50 shrink-0"})]})}),(0,a.jsx)(P.hl,{className:"w-[320px] p-0",align:"start",children:(0,a.jsxs)(S.uB,{children:[(0,a.jsx)(S.G7,{placeholder:"Search source fields...",className:"h-9"}),(0,a.jsxs)(S.oI,{children:[(0,a.jsx)(S.xL,{children:"No matching source."}),(0,a.jsx)(S.L$,{heading:"Reset",children:(0,a.jsxs)(S.h_,{value:"__unmapped",onSelect:()=>{r({sourceType:"unmapped",sourceField:""}),c(!1)},children:[(0,a.jsx)(A.A,{className:(0,D.cn)("mr-2 h-4 w-4",t&&"unmapped"!==t.sourceType?"opacity-0":"opacity-100")}),"Not mapped (leave blank)"]})}),(0,a.jsx)(S.fx,{}),E.map(e=>(0,a.jsx)(S.L$,{heading:e.label,children:Object.entries(e.catalog).map(s=>{let[l,n]=s,i=(null==t?void 0:t.sourceType)===e.type&&t.sourceField===l;return(0,a.jsxs)(S.h_,{value:"".concat(e.label," ").concat(n," ").concat(l),onSelect:()=>{r({sourceType:e.type,sourceField:l}),c(!1)},children:[(0,a.jsx)(A.A,{className:(0,D.cn)("mr-2 h-4 w-4",i?"opacity-100":"opacity-0")}),(0,a.jsxs)("div",{className:"flex flex-col",children:[(0,a.jsx)("span",{children:n}),(0,a.jsx)("span",{className:"text-xs text-muted-foreground",children:l})]})]},"".concat(e.type,":").concat(l))})},e.type)),d.some(e=>"assessment"===e.sourceType)&&(0,a.jsxs)(a.Fragment,{children:[(0,a.jsx)(S.fx,{}),(0,a.jsx)(S.L$,{heading:"Assessment scores",children:l.flatMap(e=>O.map(s=>{let l="".concat(e,":").concat(s.key),n=(null==t?void 0:t.sourceType)==="assessment"&&t.sourceField===l;return(0,a.jsxs)(S.h_,{value:"Assessment ".concat(e," ").concat(s.label),onSelect:()=>{r({sourceType:"assessment",sourceField:l}),c(!1)},children:[(0,a.jsx)(A.A,{className:(0,D.cn)("mr-2 h-4 w-4",n?"opacity-100":"opacity-0")}),(0,a.jsxs)("div",{className:"flex flex-col",children:[(0,a.jsxs)("span",{children:[e," â ",s.label]}),(0,a.jsx)("span",{className:"text-xs text-muted-foreground",children:l})]})]},l)}))})]})]})]})})]})}G.describe=B;var I=r(46767),$=r(42409),U=r(25261),z=r(37711),_=r(90483);r(6589),r(34087);var W=r(90368),H=r(27937);function V(e){let{pdfBase64:t}
1=e,[r,l]=(0,s.useState)(1),[i,o]=(0,s.useState)(null),[c,d]=(0,s.useState)(560),m=(0,s.useMemo)(()=>{if(!t)return null;let e=new Blob([Uint8Array.from(atob(t),e=>e.charCodeAt(0))],{type:"application/pdf"});return URL.createObjectURL(e)},[t]);return((0,s.useEffect)(()=>()=>{m&&URL.revokeObjectURL(m)},[m]),(0,s.useEffect)(()=>{let e=()=>{d(Math.max(280,Math.min(.4*window.innerWidth,600)))};return e(),window.addEventListener("resize",e),()=>window.removeEventListener("resize",e)},[]),m)?(0,a.jsxs)("div",{className:"flex flex-col h-full bg-muted/30 rounded-lg border overflow-hidden",children:[(0,a.jsx)("div",{className:"flex-1 overflow-auto p-4 flex justify-center",children:(0,a.jsx)(z.A,{file:m,onLoadSuccess:e=>{let{numPages:t}=e;return o(t)},loading:(0,a.jsxs)("div",{className:"flex items-center gap-2 text-sm text-muted-foreground py-8",children:[(0,a.jsx)(f.A,{className:"w-4 h-4 animate-spin"}),"Loading previewâ¦"]}),error:(0,a.jsx)("div",{className:"text-sm text-muted-foreground py-8",children:"Couldn't render preview. The PDF will still fill correctly."}),children:(0,a.jsx)(_.A,{pageNumber:r,width:c,renderTextLayer:!1,renderAnnotationLayer:!1,loading:(0,a.jsxs)("div",{className:"flex items-center gap-2 text-sm text-muted-foreground py-8",children:[(0,a.jsx)(f.A,{className:"w-4 h-4 animate-spin"}),"Rendering pageâ¦"]})})})}),null!==i&&i>1&&(0,a.jsxs)("div",{className:"flex items-center justify-between px-3 py-2 border-t bg-background",children:[(0,a.jsxs)(n.$,{variant:"ghost",size:"sm",onClick:()=>l(e=>Math.max(1,e-1)),disabled:r<=1,className:"h-7",children:[(0,a.jsx)(W.A,{className:"w-4 h-4 mr-1"}),"Previous"]}),(0,a.jsxs)("span",{className:"text-xs text-muted-foreground",children:["Page ",r," of ",i]}),(0,a.jsxs)(n.$,{variant:"ghost",size:"sm",onClick:()=>l(e=>Math.min(null!=i?i:e,e+1)),disabled:r>=(null!=i?i:1),className:"h-7",children:["Next",(0,a.jsx)(H.A,{className:"w-4 h-4 ml-1"})]})]})]}):(0,a.jsx)("div",{className:"flex items-center justify-center h-full text-sm text-muted-foreground",children:"No PDF to preview."})}U.GlobalWorkerOptions.workerSrc="//unpkg.com/pdfjs-dist@".concat(U.version,"/build/pdf.worker.min.mjs");let Z={client:"this client",session:"this session",user:"your practitioner profile",derived:"related records",assessment:"an assessment score",custom:"a custom value",unmapped:""},J={client:T,session:R,user:L,derived:M},q={choose:{title:"Choose a fillable PDF",description:"Upload any fillable PDF â referral, intake, Medicare or NDIS form â and we'll match its fields to this client's record.",dropZoneHint:"Drop a PDF here, or click to browse",button:"Choose file",buttonLoading:"Reading your PDFâ¦"},review:{title:"Check the auto-filled values",description:"We've pre-filled each PDF field from this client's record. Edit anything that's wrong â your corrections are saved for next time.",helpHeading:"How this works",helpSteps:["We read the field labels in your PDF (no editing yet).","We pre-fill values from this client's record.","You review and correct anything that's off.","We generate the filled PDF â your corrections are saved so the same form auto-fills correctly next time."],moreOptions:"More options",flattenLabel:"Lock fields after filling",flattenHelp:"Recommended when sending the PDF to someone else (Medicare, GP, NDIS). The recipient cannot edit the values.",backButton:"Back",generateButton:"Generate filled PDF",generateLoading:"Generatingâ¦"},done:{title:"Filled PDF downloaded",description:"The PDF has been saved to your downloads. Your corrections are saved â next time you upload this form for any client, we'll auto-fill it correctly without asking.",fillAnotherButton:"Fill another",doneButton:"Done"},emptyMatch:"No match â pick a source"};var Y=r(81029).Buffer;
1let K=[{id:"choose",label:"Choose PDF"},{id:"review",label:"Check & edit"},{id:"done",label:"Download"}],X="gs:pdf-form-fill:help-dismissed-v1";function Q(e){let{clientId:t,sessionId:r,trigger:P,mappingId:S,mappingName:A,defaultOpen:T,onClose:R}=e,[L,M]=(0,s.useState)(null!=T&&T),[E,O]=(0,s.useState)("choose"),[B,U]=(0,s.useState)(!1),[z,_]=(0,s.useState)(null),[W,H]=(0,s.useState)([]),[Q,ee]=(0,s.useState)(""),[et,er]=(0,s.useState)({}),[ea,es]=(0,s.useState)(null),[el,en]=(0,s.useState)(!1),[ei,eo]=(0,s.useState)(!1),[ec,ed]=(0,s.useState)(""),[em,eu]=(0,s.useState)(null),[ep,eh]=(0,s.useState)(!0),[ex,ef]=(0,s.useState)({}),eg=(0,s.useRef)(null);(0,s.useEffect)(()=>{void 0!==T&&M(T)},[T]),(0,s.useEffect)(()=>{eh("1"===window.localStorage.getItem(X))},[]);let eN=(0,s.useCallback)(()=>{O("choose"),_(null),H([]),er({}),ef({}),es(null),ed(""),ee(""),eu(null),eo(!1),en(!1)},[]),ej=(0,s.useCallback)(()=>{M(!1),eN(),null==R||R()},[eN,R]),eb=(0,s.useCallback)(()=>{eh(!0),window.localStorage.setItem(X,"1")},[]),ev=(0,s.useCallback)(async(e,a)=>{try{let s=await fetch("/api/pdf-form-fill/preview",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({mappingId:e,clientId:t,sessionId:r,mappingOverrides:Object.keys(a).length>0?a:void 0})});if(!s.ok)return;let l=await s.json();H(l.preview)}catch(e){}},[t,r]),ey=async e=>{var a;let s=null==(a=e.target.files)?void 0:a[0];if(s){if("application/pdf"!==s.type)return void C.o.error("Please choose a PDF file");U(!0),eu(null);try{let e=await s.arrayBuffer(),a=Y.from(e).toString("base64");ed(a);let l=new FormData;l.append("pdf",s);let n=await fetch("/api/pdf-form-fill/analyze",{method:"POST",body:l});if(!n.ok){let e=await n.json();if(e.kind)return void eu({kind:e.kind,message:e.error||"Could not read this PDF"});throw Error(e.error||"Could not read this PDF")}let i=await n.json();S&&(i.mapping.id=S,i.mapping.isNew=!1),_(i);let o=await fetch("/api/pdf-form-fill/preview",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({mappingId:S||i.mapping.id,clientId:t,sessionId:r})});if(o.ok){let e=await o.json();H(e.preview),ee(e.clientName)}O("review")}catch(e){C.o.error((0,F.Zk)(e)||"Could not read this PDF")}finally{U(!1),eg.current&&(eg.current.value="")}}},ew=async()=>{if(z){U(!0);try{let e=await fetch("/api/pdf-form-fill/generate",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({mappingId:z.mapping.id,clientId:t,sessionId:r,overrides:Object.keys(et).length>0?et:void 0,mappingOverrides:Object.keys(ex).length>0?ex:void 0,flattenForm:el,pdfBase64:ec})});if(!e.ok){let t=await e.json();throw Error(t.error||"Could not generate the PDF")}let a=await e.blob(),s=URL.createObjectURL(a),l=document.createElement("a");l.href=s,l.download="filled-form-".concat(Q.replace(/\s+/g,"-").toLowerCase()||"client",".pdf"),document.body.appendChild(l),l.click(),document.body.removeChild(l),URL.revokeObjectURL(s),O("done"),C.o.success("Filled PDF downloaded")}catch(e){C.o.error((0,F.Zk)(e)||"Could not generate the PDF")}finally{U(!1)}}},ek=e=>{switch(e){case"xfa":return{icon:(0,a.jsx)(m.A,{className:"h-5 w-5"}),title:"Adobe LiveCycle (XFA) form"};case"encrypted":return{icon:(0,a.jsx)(u.A,{className:"h-5 w-5"}),title:"Password-protected PDF"};case"empty":return{icon:(0,a.jsx)(p.A,{className:"h-5 w-5"}),title:"No fillable fields detected"};case"corrupted":return{icon:(0,a.jsx)(h.A,{className:"h-5 w-5"}),title:"PDF could not be read"};default:return{icon:(0,a.jsx)(h.A,{className:"h-5 w-5"}),title:"Unsupported PDF"}}},eC=(0,a.jsxs)(l.Cf,{className:"max-w-5xl w-[95vw] h-[90vh] sm:h-[85vh] p-0 flex flex-col gap-0 overflow-hidden",children:[(0,a.jsx)(l.c7,{className:"border-b px-6 py-4 space-y-3",children:(0,a.jsxs)("div",{className:"flex items-center justify-between gap-4",children:[(0,a.jsxs)("div",{className:"space-y-0.5 min-w-0",children:[(0,a.jsxs)(l.L3,{className:"text-base",children:["choose"===E&&q.choose.title,"review"===E&&q.review.title,"done"===E&&q.done.title]}),(0,a.jsxs)(l.rr,{className:"text-xs",children:["choose"===E&&(A?'Using saved match for "'.concat(A,'".'):q.choose.description),"review"===E&&(Q?"For ".concat(Q,". ").concat(q.review.description):q.review.description),"done"===E&&q.done.description]})]}),(0,a.jsx)($.t,{steps:K,current:E})]})}),"choose"===E&&(0,a.jsx)("div",{className:"flex-1 overflow-y-auto px-6 py-6",children:(0,a.jsxs)("div",{className:"max-w-xl mx-auto
1space-y-4",children:[em&&(0,a.jsxs)("div",{className:"flex gap-3 rounded-lg border border-amber-200 bg-amber-50 p-4 text-amber-900",children:[(0,a.jsx)("div",{className:"mt-0.5 shrink-0 text-amber-600",children:ek(em.kind).icon}),(0,a.jsxs)("div",{className:"space-y-2 text-sm",children:[(0,a.jsx)("div",{className:"font-medium",children:ek(em.kind).title}),(0,a.jsx)("div",{className:"text-amber-900/90",children:em.message}),(0,a.jsx)(n.$,{variant:"outline",size:"sm",className:"mt-2",onClick:()=>{var e;eu(null),null==(e=eg.current)||e.click()},children:"Try a different PDF"})]})]}),(0,a.jsxs)("div",{className:"border-2 border-dashed rounded-lg p-10 text-center bg-muted/30",children:[(0,a.jsx)(x.A,{className:"h-12 w-12 mx-auto mb-4 text-muted-foreground"}),(0,a.jsx)("p",{className:"text-sm text-muted-foreground mb-4",children:q.choose.dropZoneHint}),(0,a.jsx)("input",{ref:eg,type:"file",accept:".pdf",onChange:ey,className:"hidden"}),(0,a.jsx)(n.$,{onClick:()=>{var e;return null==(e=eg.current)?void 0:e.click()},disabled:B,children:B?(0,a.jsxs)(a.Fragment,{children:[(0,a.jsx)(f.A,{className:"h-4 w-4 mr-2 animate-spin"}),q.choose.buttonLoading]}):(0,a.jsxs)(a.Fragment,{children:[(0,a.jsx)(x.A,{className:"h-4 w-4 mr-2"}),q.choose.button]})})]}),(0,a.jsx)("p",{className:"text-xs text-muted-foreground text-center",children:"Works with fillable AND scanned PDFs. Larger files take a little longer."})]})}),"review"===E&&(0,a.jsxs)("div",{className:"flex-1 grid md:grid-cols-[minmax(0,1fr)_minmax(0,1.1fr)] overflow-hidden",children:[(0,a.jsx)("div",{className:"hidden md:block p-4 border-r overflow-hidden",children:(0,a.jsx)(V,{pdfBase64:ec})}),(0,a.jsxs)("div",{className:"flex flex-col overflow-hidden",children:[(0,a.jsxs)("div",{className:"flex-1 overflow-y-auto p-4 space-y-3",children:[!ep&&(0,a.jsxs)("div",{className:"rounded-lg border border-primary/20 bg-primary/5 p-3 text-sm space-y-2",children:[(0,a.jsxs)("div",{className:"flex items-start justify-between gap-2",children:[(0,a.jsxs)("div",{className:"flex items-center gap-2 font-medium",children:[(0,a.jsx)(g.A,{className:"h-4 w-4 text-primary"}),q.review.helpHeading]}),(0,a.jsx)("button",{type:"button",onClick:eb,className:"text-muted-foreground hover:text-foreground","aria-label":"Dismiss",children:(0,a.jsx)(N.A,{className:"h-4 w-4"})})]}),(0,a.jsx)("ol",{className:"list-decimal pl-5 text-xs text-muted-foreground space-y-1",children:q.review.helpSteps.map(e=>(0,a.jsx)("li",{children:e},e))})]}),(0,a.jsx)(I.Bc,{delayDuration:150,children:(0,a.jsx)("div",{className:"border rounded-lg divide-y",children:W.map(e=>{var t;let r=(e=>{let t=ex[e.pdfFieldName];return t||{sourceType:e.sourceType,sourceField:e.sourceField}})(e),s=void 0!==ex[e.pdfFieldName],l=function(e){if("unmapped"===e.sourceType||!e.sourceField)return null;if("assessment"===e.sourceType){let[t,r]=e.sourceField.split(":");return"".concat(t," â ").concat("score"===r?"Total score":"severity"===r?"Severity":"Date")}let t=J[e.sourceType],r=(null==t?void 0:t[e.sourceField])||e.sourceField,a=Z[e.sourceType];return a?"".concat(r," (from ").concat(a,")"):r}(r),c=!s&&function(e){switch(e){case"high":return{emoji:"â
",label:"Confident",help:"Obvious match. Worth a glance, but unlikely to need editing.",tone:"good"};case"medium":return{emoji:"â ï¸",label:"Best guess",help:"Inferred from context. Please double-check before generating.",tone:"warn"};case"low":return{emoji:"â",label:"Not sure",help:"No reliable match. Please pick the right source from the dropdown.",tone:"bad"};default:return null}}(e.confidence);return(0,a.jsxs)("div",{className:"p-3 space-y-2",children:[(0,a.jsx)("div",{className:"flex items-start justify-between gap-2",children:(0,a.jsxs)("div",{className:"min-w-0 flex-1 space-y-0.5",children:[(0,a.jsxs)("div",{className:"flex items-center gap-2 flex-wrap",children:[(0,a.jsx)("span",{className:"text-sm font-medium truncate",children:e.label}),c&&(0,a.jsxs)(I.m_,{children:[(0,a.jsx)(I.k$,{asChild:!0,children:(0,a.jsxs)("span",{className:(0,D.cn)("inline-flex items-center gap-1 rounded-full border px-2 py-0.5 text-[10px] uppercase tracking-wide cursor-help","good"===c.tone&&"bg-emerald-50 text-emerald-700 border-emerald-200","warn"===c.tone&&"bg-amber-50 text-amber-700 border-amber-200","bad"===c.tone&&"bg-rose-50 text-rose-700 border-rose-200"),children:[(0,a.jsx)("span",{"aria-hidden":"true",children:c.emoji}),c.label]})}),(0,a.jsx)(I.ZI,{className:"max-w-xs text-xs",children:c.help})]}),s&&(0,a.jsx)(o.E,{variant:"outline",className:"text-[10px] uppercase tracking-wide bg-blue-50 text-blue-700 border-blue-200",children:"edited"}),e.reasoning&&!s&&(0,a.jsxs)(I.m_,{children:[(0,a.jsx)(I.k$,{asChild:!0,children:(0,a.jsx)("button",{type:"button",className:"text-muted-foreground hover:text-foreground","aria-label":"Why this match?",children:(0,a.jsx)(j.A,{className:"h-3 w-3"})})}),(0,a.jsx)(I.ZI,{className:"max-w-xs text-xs",children:e.reasoning})]})]}),(0,a.jsx)("div",{className:"text-[11px] text-muted-foreground",children:null!=l?l:q.emptyMatch})]})}),(0,a.jsxs)("div",{className:"flex items-center gap-2",children:[(0,a.jsx)(G,{value:r,onChange:t=>{let r={...ex,[e.pdfFieldName]:t};ef(r),er(t=>{if(!(e.pdfFieldName in t))return t;let r={...t};return delete r[e.pdfFieldName],r}),z&&ev(z.mapping.id,r)}}),(0,a.jsx)("div",{className:"flex-1 min-w-0",children:ea===e.pdfFieldName?(0,a.jsx)(i.p,{value:null!=(t=et[e.pdfFieldName])?t:e.resolvedValue,onChange:t=>er(r=>({...r,[e.pdfFieldName]:t.target.value})),onBlur:()=>es(null),onKeyDown:e=>"Enter"===e.key&&es(null),autoFocus:!0,className:"h-7 text-sm"}):(0,a.jsx)("button",{type:"button",onClick:()=>es(e.pdfFieldName),className:"text-sm text-left w-full truncate hover:underline",children:(0,a.jsx)("span",{className:et[e.pdfFieldName]||e.resolvedValue?"":"text-muted-foreground italic",children:et[e.pdfFieldName]||e.resolvedValue||"empty"})})}),(0,a.jsx)(n.$,{variant:"ghost",size:"sm",className:"h-7 w-7 p-0 shrink-0",onClick:()=>es(e.pdfFieldName),"aria-label":"Edit value",children:(0,a.jsx)(b.A,{className:"h-3.5 w-3.5"})})]})]},e.pdfFieldName)})})})]}),(0,a.jsxs)("div",{className:"border-t px-4 py-3 space-y-2 bg-background",children:[(0,a.jsxs)("button",{type:"button",onClick:()=>eo(e=>!e),className:"flex items-center gap-1 text-xs text-muted-foreground hover:text-foreground",children:[(0,a.jsx)(v.A,{className:(0,D.cn)("h-3 w-3 transition-transform",ei&&"rotate-180")}
1),q.review.moreOptions]}),ei&&(0,a.jsxs)("div",{className:"flex items-start gap-2 pl-4",children:[(0,a.jsx)(c.S,{id:"flatten",checked:el,onCheckedChange:e=>en(!0===e),className:"mt-0.5"}),(0,a.jsxs)("div",{className:"space-y-0.5",children:[(0,a.jsx)(d.J,{htmlFor:"flatten",className:"text-sm cursor-pointer",children:q.review.flattenLabel}),(0,a.jsx)("p",{className:"text-xs text-muted-foreground",children:q.review.flattenHelp})]})]}),(0,a.jsxs)("div",{className:"flex gap-2 justify-end pt-1",children:[(0,a.jsxs)(n.$,{variant:"outline",onClick:()=>O("choose"),children:[(0,a.jsx)(y.A,{className:"h-4 w-4 mr-1"}),q.review.backButton]}),(0,a.jsx)(n.$,{onClick:ew,disabled:B,children:B?(0,a.jsxs)(a.Fragment,{children:[(0,a.jsx)(f.A,{className:"h-4 w-4 mr-2 animate-spin"}),q.review.generateLoading]}):(0,a.jsxs)(a.Fragment,{children:[(0,a.jsx)(w.A,{className:"h-4 w-4 mr-2"}),q.review.generateButton]})})]})]})]})]}),"done"===E&&(0,a.jsx)("div",{className:"flex-1 overflow-y-auto px-6 py-10",children:(0,a.jsxs)("div",{className:"max-w-md mx-auto text-center space-y-5",children:[(0,a.jsx)(k.A,{className:"h-16 w-16 mx-auto text-emerald-500"}),(0,a.jsxs)("div",{className:"space-y-2",children:[(0,a.jsx)("h3",{className:"text-lg font-medium",children:q.done.title}),(0,a.jsx)("p",{className:"text-sm text-muted-foreground",children:q.done.description})]}),(0,a.jsxs)("div",{className:"flex gap-2 justify-center pt-2",children:[(0,a.jsx)(n.$,{variant:"outline",onClick:eN,children:q.done.fillAnotherButton}),(0,a.jsx)(n.$,{onClick:ej,children:q.done.doneButton})]})]})})]});return S?(0,a.jsx)(l.lG,{open:L,onOpenChange:e=>{e?M(!0):ej()},children:eC}):(0,a.jsxs)(l.lG,{open:L,onOpenChange:e=>{M(e),e||(eN(),null==R||R())},children:[(0,a.jsx)(l.zM,{asChild:!0,children:P||(0,a.jsxs)(n.$,{variant:"outline",size:"sm",children:[(0,a.jsx)(x.A,{className:"h-4 w-4 mr-2"}),"Auto-fill a PDF"]})}),eC]})}},6589:()=>{},20908:(e,t,r)=>{"use strict";r.d(t,{A:()=>a});let a=(0,r(71847).A)("circle-question-mark",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"M9.09 9a3 3 0 0 1 5.83 1c0 2-3 3-3 3",key:"1u773s"}],["path",{d:"M12 17h.01",key:"p32p05"}]])},26282:(e,t,r)=>{"use strict";r.d(t,{A:()=>a});let a=(0,r(71847).A)("file-exclamation-point",[["path",{d:"M6 22a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h8a2.4 2.4 0 0 1 1.704.706l3.588 3.588A2.4 2.4 0 0 1 20 8v12a2 2 0 0 1-2 2z",key:"1oefj6"}],["path",{d:"M12 9v4",key:"juzpu7"}],["path",{d:"M12 17h.01",key:"p32p05"}]])},34087:()=>{},42409:(e,t,r)=>{"use strict";r.d(t,{t:()=>n});var a=r(95155),s=r(5917),l=r(64269);function n(e){let{steps:t,current:r,onStepClick:n}=e,i=t.findIndex(e=>e.id===r);return(0,a.jsx)("div",{className:"flex items-center gap-1 text-xs select-none","aria-label":"Progress",children:t.map((e,r)=>{let o=r<i,c=r===i,d=o&&!!n;return(0,a.jsxs)("div",{className:"flex items-center gap-1",children:[(0,a.jsxs)(d?"button":"div",{type:d?"button":void 0,onClick:d?()=>null==n?void 0:n(e.id):void 0,className:(0,l.cn)("flex items-center gap-1.5 px-2 py-1 rounded-full transition-colors",c&&"bg-primary text-primary-foreground font-medium",o&&"text-emerald-700",!c&&!o&&"text-muted-foreground",d&&"hover:bg-emerald-50 cursor-pointer"),"aria-current":c?"step":void 0,children:[(0,a.jsx)("span",{className:(0,l.cn)("flex items-center justify-center w-4 h-4 rounded-full text-[10px]",o&&"bg-emerald-100 text-emerald-700",c&&"bg-primary-foreground/20 text-primary-foreground",!c&&!o&&"bg-muted text-muted-foreground"),children:o?(0,a.jsx)(s.A,{className:"w-3 h-3"}):r+1}),(0,a.jsx)("span",{className:"hidden sm:inline whitespace-nowrap",children:e.label})]}),r<t.length-1&&(0,a.jsx)("div",{className:(0,l.cn)("h-px w-2 sm:w-4 shrink-0",o?"bg-emerald-300":"bg-border")})]},e.id)})})}},63240:(e,t,r)=>{"use strict";r.d(t,{A:()=>a});let a=(0,r(71847).A)("file-x",[["path",{d:"M6 22a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h8a2.4 2.4 0 0 1 1.704.706l3.588 3.588A2.4 2.4 0 0 1 20 8v12a2 2 0 0 1-2 2z",key:"1oefj6"}],["path",{d:"M14 2v5a1 1 0 0 0 1 1h5",key:"wfsgrz"}],["path",{d:"m14.5 12.5-5 5",key:"b62r18"}],["path",{d:"m9.5 12.5 5 5",key:"1rk7el"}]])}}]);
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.