1import{r as n,j as e,I as R,z as v,Z as q,b9 as $,ba as B,bl as D,aa as M,X as U,T as L,x as j,v as H,w as V}from"./index-j6sLDzf7.js";import{s as Z,M as i,W as z}from"./masterServiceCodes-y3sYJp3V.js";import{t as K}from"./index-29i6Yi0a.js";import{F as Q}from"./filter-BmtLJGK8.js";const X={diagnostic:"Diagnostic/Intake",individual_therapy:"Individual Therapy",family_therapy:"Family Therapy",group_therapy:"Group Therapy",crisis:"Crisis",screening:"Screening",assessment:"Assessment",care_management:"Care Management",chw:"CHW",life_skills:"Life Skills",peer_support:"Peer Support",substance_use:"Substance Use",service_plan:"Service Plan",housing:"Housing",intake_assessment:"Intake"},w={individual_therapy:"Individual Therapy",intake_assessment:"Intake",comprehensive_assessment:"Comprehensive Assessment",crisis:"Crisis",screening:"Screening",service_plan:"Service Plan",case_management:"Case Management",chw_care_coordination:"CHW",housing_food_benefits:"Housing/Food/Benefits",life_skills:"Life Skills",peer_support:"Peer Support",substance_use:"Substance Use",billing_ops:"Billing Ops"};function Y({code:t}){var u,h,g,d;const[o,c]=n.useState(!1);return e.jsxs("div",{className:`border rounded-xl overflow-hidden transition-all ${t.active?"border-slate-700 bg-slate-800/60":"border-slate-800 bg-slate-900/40 opacity-60"}`,children:[e.jsx("button",{className:"w-full text-left p-4",onClick:()=>c(!o),children:e.jsxs("div",{className:"flex items-start gap-3",children:[e.jsx("div",{className:"flex-shrink-0 mt-0.5",children:e.jsx("span",{className:"text-lg font-black text-white font-mono bg-slate-700/60 rounded-lg px-2 py-0.5 text-sm",children:t.code})}),e.jsxs("div",{className:"flex-1 min-w-0",children:[e.jsxs("div",{className:"flex items-center gap-2 flex-wrap mb-1",children:[e.jsx("p",{className:"text-white font-semibold text-sm",children:t.service_label}),e.jsx(j,{className:"text-xs bg-slate-700/60 text-slate-300 border-slate-600",children:t.code_type}),t.requires_license&&e.jsx(j,{className:"text-xs bg-yellow-500/20 text-yellow-300 border-yellow-500/40",children:"Licensed"}),t.requires_pa_check&&e.jsx(j,{className:"text-xs bg-orange-500/20 text-orange-300 border-orange-500/40",children:"PA Check"}),!t.active&&e.jsx(j,{className:"text-xs bg-red-500/20 text-red-300 border-red-500/40",children:"Inactive"})]}),e.jsx("p",{className:"text-slate-400 text-xs",children:t.short_description}),e.jsxs("div",{className:"flex items-center gap-3 mt-1 flex-wrap text-xs text-slate-500",children:[t.rate>0&&e.jsxs("span",{className:"text-yellow-400",children:["$",t.rate.toFixed(2),"/unit est."]}),e.jsxs("span",{children:[t.default_duration_minutes,"min default"]}),e.jsxs("span",{children:[((u=t.workflow_routes)==null?void 0:u.length)||0," workflows"]})]})]}),e.jsx("span",{className:"text-slate-500 flex-shrink-0",children:o?e.jsx(H,{className:"w-4 h-4"}):e.jsx(V,{className:"w-4 h-4"})})]})}),o&&e.jsxs("div",{className:"border-t border-slate-700/50 p-4 space-y-3",children:[t.clinical_use_case&&e.jsxs("div",{children:[e.jsx("p",{className:"text-slate-400 text-xs font-semibold uppercase mb-1",children:"Clinical Use Case"}),e.jsx("p",{className:"text-slate-300 text-xs",children:t.clinical_use_case})]}),((h=t.allowed_roles)==null?void 0:h.length)>0&&e.jsxs("div",{children:[e.jsx("p",{className:"text-slate-400 text-xs font-semibold uppercase mb-1",children:"Allowed Roles"}),e.jsx("div",{className:"flex flex-wrap gap-1",children:t.allowed_roles.map(r=>e.jsx("span",{className:"text-xs bg-blue-500/15 text-blue-300 border border-blue-500/20 rounded px-2 py-0.5",children:r},r))})]}),((g=t.documentation_requirements)==null?void 0:g.length)>0&&e.jsxs("div",{children:[e.jsx("p",{className:"text-slate-400 text-xs font-semibold uppercase mb-1",children:"Documentation Required"}),e.jsx("ul",{className:"space-y-0.5",children:t.documentation_requirements.map((r,p)=>e.jsxs("li",{className:"text-xs text-slate-300 flex items-center gap-1.5",children:[e.jsx("span",{className:"w-1.5 h-1.5 rounded-full bg-green-400 flex-shrink-0"}),r]},p))})]}),((d=t.workflow_routes)==null?void 0:d.length)>0&&e.jsxs("div",{children:[e.jsx("p",{className:"text-slate-400 text-xs font-semibold uppercase mb-1",children:"Workflow Routes"}),e.jsx("div",{className:"flex flex-wrap gap-1",children:t.workflow_routes.map(r=>e.jsx("span",{className:"text-xs bg-purple-500/15 text-purple-300 border border-purple-500/20 rounded px-2 py-0.5",children:w[r]||r},r))})]}),e.jsxs("div",{className:"flex flex-wrap gap-3 text-xs pt-1",children:[t.requires_license&&e.jsx("span",{className:"text-yellow-300 bg-yellow-500/10 border border-yellow-500/20 rounded px-2 py-1",children:"âï¸ License Required"}),t.requires_licensed_review&&e.jsx("span",{className:"text-purple-300 bg-purple-500/10 border border-purple-500/20 rounded px-2 py-1",children:"ð¥ Licensed Review Gate"}),t.requires_pa_check&&e.jsx("span",{className:"text-orange-300 bg-orange-500/10 border border-orange-500/20 rounded px-2 py-1",children:"ð PA Gate"}),t.requires_insurance_check&&e.jsx("span",{className:"text-blue-300 bg-blue-500/10 border border-blue-500/20 rounded px-2 py-1",children:"ð Insurance Check"})]}),e.jsx("p",{className:"text-amber-400/50 text-xs italic",children:"Review Only â Not A Claim. All values are estimates."})]})]})}function J({results:t}){return t?e.jsxs("div",{className:"bg-slate-800/80 border border-orange-500/30 rounded-xl p-4 space-y-3",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(q,{className:"w-4 h-4 text-orange-400"}),e.jsx("p",{className:"text-white font-bold text-sm",children:"AI Code Gap Scan Results"})]}),t.length===0?e.jsx("p",{className:"text-green-300 text-sm",children:"â No code gaps detected. All workflows have active codes."}):e.jsx("div",{className:"space-y-2",children:t.map((o,c)=>e.jsxs("div",{className:"flex items-start gap-2 text-xs bg-orange-500/10 border border-orange-500/20 rounded-lg p-2",children:[e.jsx(L,{className:"w-3.5 h-3.5 text-orange-400 flex-shrink-0 mt-0.5"}),e.jsx("span",{className:"text-orange-200",children:o})]},c))})]}):null}
1function ae(){const[t,o]=n.useState(""),[c,u]=n.useState(""),[h,g]=n.useState(""),[d,r]=n.useState(""),[p,y]=n.useState(""),[N,_]=n.useState(!1),[k,P]=n.useState(!1),[I,O]=n.useState(null),[C,S]=n.useState(!1),f=n.useMemo(()=>Z(t,{workflow:c||void 0,category:h||void 0,requiresLicense:d===""?void 0:d==="yes",requiresPA:p===""?void 0:p==="yes",includeInactive:N}),[t,c,h,d,p,N]),F=[...new Set(i.map(s=>s.service_category))].sort(),W=async()=>{S(!0);const s=[];for(const[l,m]of Object.entries(z)){if(!m||m.length===0){s.push(`Workflow "${w[l]||l}" has no code options configured.`);continue}m.filter(T=>{const A=i.find(G=>G.code===T);return A&&A.active}).length===0&&s.push(`Workflow "${w[l]||l}" has codes configured but all are inactive.`)}const x=i.filter(l=>l.active&&(!l.documentation_requirements||l.documentation_requirements.length===0));x.length>0&&s.push(`${x.length} active codes have no documentation requirements configured: ${x.slice(0,3).map(l=>l.code).join(", ")}...`);const b=i.filter(l=>l.active&&(!l.workflow_routes||l.workflow_routes.length===0));b.length>0&&s.push(`${b.length} active codes have no workflow routes: ${b.slice(0,3).map(l=>l.code).join(", ")}...`),await new Promise(l=>setTimeout(l,800)),O(s),S(!1),K.success(`Gap scan complete â ${s.length} issues found`)},E=()=>{const x=[["Code","Type","Label","Category","Rate","License","PA","Workflows","Active"],...i.map(a=>[a.code,a.code_type,a.service_label,a.service_category,a.rate,a.requires_license,a.requires_pa_check,(a.workflow_routes||[]).join(";"),a.active])].map(a=>a.join(",")).join(` 2`),b=new Blob([x],{type:"text/csv"}),l=URL.createObjectURL(b),m=document.createElement("a");m.href=l,m.download="cpos_service_codes.csv",m.click()};return e.jsx("div",{className:"min-h-screen bg-slate-900 text-white p-4 md:p-6 -mx-4 -my-5 lg:-mx-8 lg:-my-7",children:e.jsxs("div",{className:"max-w-screen-xl mx-auto space-y-5",children:[e.jsxs("div",{className:"flex items-start justify-between flex-wrap gap-4",children:[e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsx("div",{className:"w-11 h-11 bg-gradient-to-br from-blue-500 to-purple-600 rounded-xl flex items-center justify-center",children:e.jsx(R,{className:"w-6 h-6 text-white"})}),e.jsxs("div",{children:[e.jsx("h1",{className:"text-2xl font-black text-white",children:"CPOS Master CPT/HCPCS Code Library"}),e.jsxs("p",{className:"text-slate-400 text-sm",children:[i.length," codes · Review Only â Not A Claim"]})]})]}),e.jsxs("div",{className:"flex gap-2 flex-wrap",children:[e.jsxs(v,{onClick:W,disabled:C,className:"bg-orange-600 hover:bg-orange-500 text-white text-sm",children:[e.jsx(q,{className:"w-4 h-4 mr-1.5"})," ",C?"Scanning...":"AI Code Gap Scan"]}),e.jsxs(v,{onClick:E,variant:"outline",className:"border-slate-600 text-slate-300 hover:bg-slate-700 text-sm",children:[e.jsx($,{className:"w-4 h-4 mr-1.5"})," Export CSV"]})]})]}),e.jsxs("div",{className:"bg-amber-500/10 border border-amber-500/30 rounded-xl p-3 flex items-start gap-2",children:[e.jsx(B,{className:"w-4 h-4 text-amber-400 flex-shrink-0 mt-0.5"}),e.jsxs("p",{className:"text-amber-300 text-xs",children:[e.jsx("strong",{children:"Review Only â Not A Claim."})," All codes require billing gate completion: eligibility verified, payer confirmed, PA checked, diagnosis/Z-codes reviewed, medical necessity, note completed, duration confirmed, credential checked, supervisor/licensed review, billing review, claim draft approved, Office Ally prepared manually. No auto-submission."]})]}),e.jsx(J,{results:I}),e.jsx("div",{className:"grid grid-cols-2 sm:grid-cols-4 gap-3",children:[{label:"Total Codes",value:i.length,color:"text-blue-400"},{label:"Active",value:i.filter(s=>s.active).length,color:"text-green-400"},{label:"License Required",value:i.filter(s=>s.requires_license).length,color:"text-yellow-400"},{label:"PA Required",value:i.filter(s=>s.requires_pa_check).length,color:"text-orange-400"}].map(s=>e.jsxs("div",{className:"bg-slate-800/60 border border-slate-700 rounded-xl p-3 text-center",children:[e.jsx("p",{className:`font-black text-xl ${s.color}`,children:s.value}),e.jsx("p",{className:"text-slate-500 text-xs",children:s.label})]},s.label))}),e.jsxs("div",{className:"flex gap-2 flex-wrap",children:[e.jsxs("div",{className:"relative flex-1 min-w-64",children:[e.jsx(D,{className:"absolute left-3 top-1/2 -translate-y-1/2 w-4 h-4 text-slate-500"}),e.jsx(M,{placeholder:"Search code, label, or description...",value:t,onChange:s=>o(s.target.value),className:"pl-10 bg-slate-700/60 border-slate-600 text-white placeholder:text-slate-500"}),t&&e.jsx("button",{onClick:()=>o(""),className:"absolute right-3 top-1/2 -translate-y-1/2 text-slate-500 hover:text-slate-300",children:e.jsx(U,{className:"w-4 h-4"})})]}),e.jsxs(v,{variant:"outline",onClick:()=>P(!k),className:"border-slate-600 text-slate-300 hover:bg-slate-700 text-sm",children:[e.jsx(Q,{className:"w-4 h-4 mr-1.5"})," Filters"]})]}),k&&e.jsxs("div",{className:"bg-slate-800/60 border border-slate-700 rounded-xl p-4 grid grid-cols-2 sm:grid-cols-4 gap-3",children:[e.jsxs("div",{children:[e.jsx("label",{className:"text-slate-400 text-xs block mb-1 font-semibold",children:"Workflow"}),e.jsxs("select",{value:c,onChange:s=>u(s.target.value),className:"w-full bg-slate-700 border border-slate-600 text-white text-xs rounded-lg p-2 focus:outline-none",children:[e.jsx("option",{value:"",children:"All Workflows"}),Object.entries(w).map(([s,x])=>e.jsx("option",{value:s,children:x},s))]})]}),e.jsxs("div",{children:[e.jsx("label",{className:"text-slate-400 text-xs block mb-1 font-semibold",children:"Category"}),e.jsxs("select",{value:h,onChange:s=>g(s.target.value),className:"w-full bg-slate-700 border border-slate-600 text-white text-xs rounded-lg p-2 focus:outline-none",children:[e.jsx("option",{value:"",children:"All Categories"}),F.map(s=>e.jsx("option",{value:s,children:X[s]||s},s))]})]}),e.jsxs("div",{children:[e.jsx("label",{className:"text-slate-400 text-xs block mb-1 font-semibold",children:"License Req."}),e.jsxs("select",{value:d,onChange:s=>r(s.target.value),className:"w-full bg-slate-700 border border-slate-600 text-white text-xs rounded-lg p-2 focus:outline-none",children:[e.jsx("option",{value:"",children:"Any"}),e.jsx("option",{value:"yes",children:"License Required"}),e.jsx("option",{value:"no",children:"No License Required"})]})]}),e.jsxs("div",{children:[e.jsx("label",{className:"text-slate-400 text-xs block mb-1 font-semibold",children:"PA Required"}),e.jsxs("select",{value:p,onChange:s=>y(s.target.value),className:"w-full bg-slate-700 border border-slate-600 text-white text-xs rounded-lg p-2 focus:outline-none",children:[e.jsx("option",{value:"",children:"Any"}),e.jsx("option",{value:"yes",children:"PA Required"}),e.jsx("option",{value:"no",children:"No PA Required"})]})]}),e.jsxs("div",{className:"col-span-2 sm:col-span-4 flex items-center gap-2",children:[e.jsx("input",{type:"checkbox",id:"showInactive",checked:N,onChange:s=>_(s.target.checked),className:"rounded"}),e.jsx("label",{htmlFor:"showInactive",className:"text-slate-300 text-xs cursor-pointer",children:"Show inactive codes"}),e.jsx(v,{size:"sm",variant:"ghost",onClick:()=>{u(""),g(""),r(""),y(""),_(!1)},className:"text-slate-400 text-xs ml-auto",children:"Clear All"})]})]}),e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsxs("p",{className:"text-slate-400 text-sm",children:[f.length," codes"]}),f.length===0&&t&&e.jsxs("div",{className:"bg-orange-500/10 border border-orange-500/30 rounded-lg px-3 py-1.5 flex items-center gap-2",children:[e.jsx(L,{className:"w-3.5 h-3.5 text-orange-400"}),e.jsx("p",{className:"text-orange-300 text-xs",children:"No codes match. Check the Master Code Library to add or activate codes for this workflow."})]})]}),f.length===0&&!t?e.jsxs("div",{className:"text-center py-10",children:[e.jsx(R,{className:"w-12 h-12 text-slate-500 mx-auto mb-3 opacity-40"}),e.jsx("p",{className:"text-slate-400",children:"No codes match current filters."}),e.jsx("p",{className:"text-slate-500 text-xs mt-1",children:"No service codes are configured for this workflow. Check filters or add codes."})]}):e.jsx("div",{className:"space-y-2",children:f.map(s=>e.jsx(Y,{code:s},s.code))})]})})}export{ae as default};
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.