1import{j as e,d as S}from"./vendor-tanstack-05CuIB13.js";import{a as f}from"./vendor-react-Cz8b5gkc.js";import{c as d,M as z,J as I,a8 as g,K as w,U as D,F as k,B as P,Z as H}from"./index-BNbaeP0K.js";import{c as L,M as U,a as $}from"./urlHelpers-V3DyFlWa.js";import{p,a as x,P as N}from"./PositionBadge-Ct82PCqS.js";import{g as de}from"./PositionBadge-Ct82PCqS.js";import{C as F}from"./circle-alert-CJSvYECB.js";import"./vendor-misc-6xamZegg.js";import"./vendor-radix-BwZk06Yn.js";import"./vendor-supabase-CgDQnvFA.js";import"./vendor-ui-utils-D7SlnX3x.js";(function(){try{var s=typeof window<"u"?window:typeof global<"u"?global:typeof globalThis<"u"?globalThis:typeof self<"u"?self:{};s.SENTRY_RELEASE={id:"93bac28c4df27bf7fe103ba2039eca7dea8e63d2"};var r=new s.Error().stack;r&&(s._sentryDebugIds=s._sentryDebugIds||{},s._sentryDebugIds[r]="92428453-0bee-402c-9b6f-cabc61ac451e",s._sentryDebugIdIdentifier="sentry-dbid-92428453-0bee-402c-9b6f-cabc61ac451e")}catch{}})();function b({label:s,count:r,total:t,colorClass:n}){const l=t>0?Math.round(r/t*100):0;return r===0?null:e.jsxs("div",{className:"flex items-center gap-2 text-sm",children:[e.jsx("div",{className:d("w-2.5 h-2.5 rounded-full",n)}),e.jsx("span",{className:"text-muted-foreground",children:s}),e.jsxs("span",{className:"font-semibold tabular-nums",children:[r,e.jsxs("span",{className:"text-muted-foreground font-normal ml-1",children:["(",l,"%)"]})]})]})}function R({stats:s,className:r}){const{total:t,support:n,oppose:l,neutral:a,informational:o,unknown:c}=s,i={support:t>0?n/t*100:0,oppose:t>0?l/t*100:0,neutral:t>0?a/t*100:0,informational:t>0?o/t*100:0,unknown:t>0?c/t*100:0},h=n>0||l>0||a>0||o>0;return e.jsxs("div",{className:d("space-y-4",r),children:[e.jsxs("div",{className:"flex items-baseline justify-between",children:[e.jsxs("h3",{className:"text-lg font-semibold tracking-tight",children:[t," ",t===1?"Testimony":"Testimonies"]}
1),!h&&c>0&&e.jsx("span",{className:"text-xs text-muted-foreground",children:"Position extraction pending"})]}),t>0&&e.jsxs("div",{className:"h-2 rounded-full bg-muted overflow-hidden flex",children:[i.support>0&&e.jsx("div",{className:d(p.support,"transition-all duration-500"),style:{width:`${i.support}%`}}),i.oppose>0&&e.jsx("div",{className:d(p.oppose,"transition-all duration-500"),style:{width:`${i.oppose}%`}}),i.neutral>0&&e.jsx("div",{className:d(p.neutral,"transition-all duration-500"),style:{width:`${i.neutral}%`}}),i.informational>0&&e.jsx("div",{className:d(p.informational,"transition-all duration-500"),style:{width:`${i.informational}%`}}),i.unknown>0&&e.jsx("div",{className:d(p.unknown,"transition-all duration-500"),style:{width:`${i.unknown}%`}})]}),e.jsxs("div",{className:"flex flex-wrap gap-x-6 gap-y-2",children:[e.jsx(b,{label:x.support.label,count:n,total:t,colorClass:x.support.dotColor}),e.jsx(b,{label:x.oppose.label,count:l,total:t,colorClass:x.oppose.dotColor}),e.jsx(b,{label:x.neutral.label,count:a,total:t,colorClass:x.neutral.dotColor}),e.jsx(b,{label:x.informational.label,count:o,total:t,colorClass:x.informational.dotColor}),c>0&&e.jsx(b,{label:"Pending",count:c,total:t,colorClass:x.unknown.dotColor})]})]})}function ae({testimony:s,className:r,compact:t=!1}){const{testifier_name:n,testifier_organization:l,position:a,document:o}=s,c=n||"Anonymous",i=o.url;return e.jsxs("div",{className:d("group relative flex items-start gap-4 roun
1ded-lg border bg-card p-4 transition-all hover:border-primary/30 hover:shadow-sm",t&&"py-3",r),children:[e.jsx("div",{className:d("absolute left-0 top-0 bottom-0 w-1 rounded-l-lg transition-opacity",p[a??"unknown"],"opacity-60 group-hover:opacity-100")}),e.jsxs("div",{className:"min-w-0 flex-1 pl-2",children:[e.jsxs("div",{className:"flex items-start justify-between gap-3",children:[e.jsxs("div",{className:"min-w-0 flex-1",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(z,{className:"h-4 w-4 flex-shrink-0 text-muted-foreground"}),e.jsx("span",{className:"font-medium truncate",children:c})]}),l&&e.jsxs("div",{className:"flex items-center gap-2 mt-1 text-sm text-muted-foreground",children:[e.jsx(I,{className:"h-3.5 w-3.5 flex-shrink-0"}),e.jsx("span",{className:"truncate",children:l})]})]}),e.jsx(N,{position:a,className:"flex-shrink-0"})]}),e.jsx("div",{className:"mt-3 flex items-center",children:e.jsxs("a",{href:i,target:"_blank",rel:"noopener noreferrer",className:"inline-flex items-center gap-1.5 text-sm text-primary hover:text-primary/80 hover:underline underline-offset-2",children:[e.jsx("span",{children:"View Testimony"}),e.jsx(g,{className:"h-3.5 w-3.5"})]})})]})]})}function T({testimony:s,className:r,isSelected:t,onSelect:n}){const{testifier_name:l,testifier_organization:a,position:o,document:c}=s,i=l||"Anonymous",h=c.url,u=e.jsxs(e.Fragment,{children:[e.jsx("div",{className:d("w-1.5 h-8 rounded-full flex-shrink-0",p[o??"unknown"])}),e.jsxs("div",{className:"min-w-0 flex-1",children:[e.jsx("div",{className:d("font-medium truncate text-left",t&&"text-primary"),children:i}),a&&e.jsx("div",{className:"text-sm text-muted-foreground truncate text-left",children:a})]}),e.jsx(N,{position:o,abbreviated:!0,className:"flex-shrink-0"}),e.jsx("a",{href:h,target:"_blank",rel:"noopener noreferrer",onClick:m=>m.stopPropagation(),className:"flex-shrink-0 p-2 rounded-md text-muted-foreground hover:text-primary hover:bg-primary/10 transition-colors","aria-label":"Open testimony PDF in new tab",children:e.jsx(g,{className:"h-4 w-4"})})]});return n?e.jsx("button",{type:"button",onClick:()=>n(s),className:d("group flex items-center gap-4 border-b border-border/50 px-4 py-3 transition-colors w-full","cursor-pointer bg-transparent",t?"bg-primary/10 border-l-2 border-l-primary":"hover:bg-muted/30 border-l-2 border-l-transparent",r),children:u}):e.jsx("div",{className:d("group flex items-center gap-4 border-b border-border/50 px-4 py-3 transition-colors","hover:bg-muted/30 border-l-2 border-l-transparent",r),children:u})}const M=50,V=72,A=56;function B(s){const r=[];for(const t of s){r.push({type:"header",group:t});for(const n of t.testimonies)r.push({type:"testimony",testimony:n})}return r}function O(s){if(s==="unknown")return"Date Unknown";try{return new Date(s+"T00:00:00").toLocaleDateString("en-US",{weekday:"short",year:"numeric",month:"short",day:"numeric"})}catch{return s}}function _({group:s,sticky:r=!1}){const t=s.committee_chamber==="house"?"House":"Senate";return e.jsxs("div",{className:d("flex items-center gap-3 bg-muted/80 backdrop-blur-sm px-4 py-3 border-b border-border",r&&"sticky top-0 z-10"),children:[e.jsx(H,{className:"h-4 w-4 text-muted-foreground flex-shrink-0"}),e.jsxs("div",{className:"min-w-0 flex-1",children:[e.jsx("span",{className:"font-semibold text-sm",children:O(s.meeting_date)}),e.jsx("span",{className:"mx-2 text-muted-foreground",children:"·"}),e.jsxs("span",{className:"text-sm text-muted-foreground truncate",children:[t," ",s.committee_name]})]}),e.jsxs("span",{className:"text-xs text-muted-foreground tabular-nums flex-shrink-0",children:[s.testimonies.length," ",s.testimonies.length===1?"testimony":"testimonies"]}
1)]})}function G(){return e.jsxs("div",{className:"flex flex-col items-center justify-center py-16 px-4 text-center",children:[e.jsx("div",{className:"rounded-full bg-muted p-4 mb-4",children:e.jsx(k,{className:"h-8 w-8 text-muted-foreground"})}),e.jsx("h2",{className:"text-lg font-semibold mb-2",children:"No Testimony Recorded"}),e.jsx("p",{className:"text-muted-foreground max-w-sm",children:"No testimony has been submitted for this bill yet. Testimony is typically submitted during committee hearings."})]})}function Y({testimony:s,isFullscreen:r,onToggleFullscreen:t}){const[n,l]=f.useState(!0),[a,o]=f.useState(!1),c=f.useRef(null);(s==null?void 0:s.id)!==c.current&&(c.current=(s==null?void 0:s.id)??null,s&&(l(!0),o(!1)));const i=()=>{l(!1)},h=()=>{l(!1),o(!0)};if(!s)return e.jsxs("div",{className:"flex flex-col items-center justify-center h-full bg-muted/30 rounded-lg border-2 border-dashed border-border p-8 text-center",children:[e.jsx(k,{className:"h-12 w-12 text-muted-foreground/50 mb-4"}),e.jsx("p",{className:"text-muted-foreground",children:"Select a testimony to preview the PDF"})]});const u=s.document.r2_key?L(s.document.r2_key):s.document.url,m=s.testifier_name||"Anonymous";return e.jsxs("div",{className:d("flex flex-col bg-card rounded-lg border shadow-sm h-full",{"fixed inset-0 z-50":r}),children:[e.jsxs("div",{className:"flex items-center justify-between px-4 py-3 border-b bg-muted/50",children:[e.jsxs("div",{className:"min-w-0 flex-1",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("span",{className:"font-semibold truncate",children:m}),e.jsx(N,{position:s.position,abbreviated:!0})]}),s.testifier_organization&&e.jsx("div",{className:"text-sm text-muted-foreground truncate",children:s.testifier_organization})]}),e.jsxs("div",{className:"flex items-center gap-2 flex-shrink-0 ml-4",children:[e.jsx("a",{href:u,target:"_blank",rel:"noopener noreferrer",className:"p-2 rounded-md text-muted-foreground hover:text-primary hover:bg-primary/10 transition-colors","aria-label":"Open PDF in new tab",children:e.jsx(g,{className:"h-4 w-4"})}),e.jsx(P,{variant:"ghost",size:"icon",onClick:t,"aria-label":r?"Exit fullscreen":"Enter fullscreen",children:r?e.jsx(U,{className:"h-4 w-4"}):e.jsx($,{className:"h-4 w-4"})})]})]}),e.jsxs("div",{className:"flex-1 min-h-0 relative",children:[n&&e.jsx("div",{className:"absolute inset-0 flex items-center justify-center bg-muted/30",children:e.jsx(w,{})}),a?e.jsxs("div",{className:"absolute inset-0 flex flex-col items-center justify-center bg-muted/30 p-8 text-center",children:[e.jsx(F,{className:"h-12 w-12 text-muted-foreground/50 mb-4"}),e.jsx("p",{className:"text-muted-foreground mb-4",children:"Unable to load PDF preview"}),e.jsx("a",{href:u,target:"_blank",rel:"noopener noreferrer",className:"text-primary hover:underline",children:"Open PDF in new tab"})]}):e.jsx("iframe",{src:u,title:`Testimony from ${m}`,className:"w-full h-full border-0",style:{minHeight:r?"calc(100vh - 60px)":"500px"},onLoad:i,onError:h})]})]})}function J({items:s,selectedId:r,onSelect:t}){const n=f.useRef(null),l=S({count:s.length,getScrollElement:()=>n.current,estimateSize:a=>s[a].type==="header"?A:V,overscan:5});return e.jsx("div",{ref:n,className:"h-full overflow-auto rounded-lg border bg-card",children:e.jsx("div",{style:{height:`${l.getTotalSize()}px`,width:"100%",position:"relative"},children:l.getVirtualItems().map(a=>{const o=s[a.index];return e.jsx("div",{style:{position:"absolute",top:0,left:0,width:"100%",height:`${a.size}px`,transform:`translateY(${a.start}px)`},children:o.type==="header"?e.jsx(_,{group:o.group}):e.jsx(T,{testimony:o.testimony,isSelected:o.testimony.id===r,onSelect:t})},a.key)})})})}function K({groups:s,selectedId:r,onSelect:t}){return e.jsx("div",{className:"h-full overflow-auto rounded-lg border bg-card",children:s.map((n,l)=>e.jsxs("div",{children:[e.jsx(_,{group:n,sticky:!0}),e.jsx("div",{className:"divide-y divide-border/50",children:n.testimonies.map(a=>e.jsx(T,{testimony:a,isSelected:a.id===r,onSelect:t},a.id))}),l<s.length-1&&e.jsx("div",{className:"border-b-2 border-border"})]},`${n.meeting_date}
1-${n.committee_name}`))})}function le({groups:s,stats:r,isLoading:t,initialDocumentId:n,className:l}){const[a,o]=f.useState(null),[c,i]=f.useState(!1),h=f.useMemo(()=>B(s),[s]),u=r.total>=M,m=f.useMemo(()=>{if(a)return a;if(n&&s.length>0)for(const j of s){const v=j.testimonies.find(E=>E.document_id===n);if(v)return v}return s.length>0&&s[0].testimonies.length>0?s[0].testimonies[0]:null},[a,s,n]),y=j=>{o(j)},C=()=>{i(!c)};return t?e.jsx("div",{className:"flex items-center justify-center py-16",children:e.jsx(w,{className:"h-8 w-8"})}):r.total===0?e.jsx("div",{className:"bg-card border border-border rounded-lg shadow-sm",children:e.jsx(G,{})}):e.jsxs("div",{className:d("space-y-6",l),children:[e.jsx("div",{className:"bg-card border border-border rounded-lg p-6 shadow-sm",children:e.jsx(R,{stats:r})}),e.jsxs("div",{className:"flex items-center gap-2 text-sm text-muted-foreground",children:[e.jsx(D,{className:"h-4 w-4"}),e.jsxs("span",{children:["Showing ",r.total," ",r.total===1?"testimony":"testimonies"," across"," ",s.length," ",s.length===1?"hearing":"hearings"]}),u&&e.jsx("span",{className:"text-xs bg-muted px-2 py-0.5 rounded",children:"Virtual scroll enabled"})]}),e.jsxs("div",{className:"grid grid-cols-1 lg:grid-cols-2 gap-6",children:[e.jsx("div",{className:"h-[600px]",children:u?e.jsx(J,{items:h,selectedId:(m==null?void 0:m.id)??null,onSelect:y}):e.jsx(K,{groups:s,selectedId:(m==null?void 0:m.id)??null,onSelect:y})}),e.jsx("div",{className:"h-[600px]",children:e.jsx(Y,{testimony:m,isFullscreen:c,onToggleFullscreen:C})})]})]})}export{le as BillTestimonyTab,N as PositionBadge,ae as TestimonyCard,T as TestimonyRow,R as TestimonyStats,de as getPositionConfig,p as positionColors,x as positionConfig}; 2//# sourceMappingURL=index-JUEsL_xG.js.map
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.