1import{j as e,r as a}from"./index-GDMS6ldZ.js";import{a as s,L as t,C as r,P as i,l as o,F as n,S as l,G as c,b as d,c as u,d as g,T as p,e as m,i as x,J as h,g as b,h as y,j,r as k,k as C,p as v,m as w}from"./PermitClassifierShared-7aObJi9T.js";import{a as f,b as S,c as N,d as q,e as R}from"./adminPermitClassifierApi-B93LJkO1.js";import"./ArrowLeftIcon-hoaeuoWc.js";import"./MagnifyingGlassIcon-D9LWneJi.js";const _=[{key:"id",label:"Id"},{key:"jurisdiction",label:"Jurisdiction"},{key:"status",label:"Status"},{key:"worker",label:"Worker"},{key:"claimed",label:"Claimed"},{key:"notes",label:"Notes"},{key:"actions",label:"Actions",className:`${p} text-right`}],L=({tone:a,...s})=>e.jsx("button",{type:"button",className:`rounded-md border bg-white px-2.5 py-1 text-[11px] font-semibold transition-colors disabled:cursor-not-allowed disabled:opacity-40 ${{release:"border-sky-200 text-sky-700 hover:bg-sky-50",requeue:"border-amber-200 text-amber-700 hover:bg-amber-50",skip:"border-neutral-200 text-neutral-500 hover:bg-neutral-50 hover:text-neutral-700"}[a]}`,...s}),A=({error:a})=>e.jsx(i,{children:o("Failed to load claims: ",a)}),P=({message:a,onDismiss:s})=>e.jsx(i,{onDismiss:s,children:a}),E=({total:a})=>e.jsx(s,{crumb:"Discovery Board",title:"Discovery Board",description:"Authoritative cities, places, and counties with live discovery progress.",children:e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsx(t,{}),e.jsx(r,{value:a,unit:"jurisdictions"})]})}),F=({status:a,worker:s,q:t,filtersActive:r,onStatusChange:i,onWorkerChange:o,onSearchChange:g,clearFilters:p,state:m,type:x,states:h,geographyLoading:b,geographyError:y,onStateChange:j,onTypeChange:k})=>e.jsxs("div",{className:"flex flex-wrap items-center gap-3",children:[e.jsx(n,{options:l,value:a,onChange:i,ariaLabel:"Claim status filter"}),e.jsx(c,{state:m,type:x,states:h,geographyLoading:b,geographyError:y,onStateChange:j,onTypeChange:k}),e.jsx("div",{className:"relative",children:e.jsx("input",{value:s,onChange:e=>o(e.target.value),placeholder:"Worker (e.g. tx-07)","aria-label":"Worker (e.g. tx-07)",className:"w-44 rounded-lg border border-neutral-200 bg-white px-3 py-1.5 text-sm text-neutral-700 shadow-xs placeholder:text-neutral-400 focus:border-blue-500 focus:outline-none focus:ring-2 focus:ring-blue-500/20"})}),e.jsx(d,{value:t,onChange:g,placeholder:"Search name or id",widthClass:"w-56"}),r&&e.jsx(u,{onClick:p})]}),T=({row:a})=>e.jsxs("td",{className:"max-w-xs truncate px-4 py-2.5 text-xs text-neutral-500",title:a.requeue_reason??a.skip_reason??"",children:[a.requeue_reason&&e.jsxs(e.Fragment,{children:[e.jsx("span",{className:"mr-1 rounded bg-amber-50 px-1.5 py-0.5 font-semibold text-amber-700 ring-1 ring-inset ring-amber-200",children:"requeue"}),a.requeue_reason]}),!a.requeue_reason&&a.skip_reason&&e.jsxs(e.Fragment,{children:[e.jsx("span",{className:"mr-1 rounded bg-neutral-100 px-1.5 py-0.5 font-semibold text-neutral-500 ring-1 ring-inset ring-neutral-200",children:"skip"}),a.skip_reason]})]}),$=({row:a,onRelease:s,onRequeue:t,onSkip:r})=>e.jsxs("td",{className:"whitespace-nowrap px-4 py-2.5 text-right",children:[a.claim_exists&&"claimed"===a.status&&e.jsx(L,{tone:"release",onClick:()=>s(a),children:"Release"}),a.claim_exists&&"written"===a.status&&e.jsx(L,{tone:"requeue",disabled:!0!==a.source_available,title:!0!==a.source_available?"This jurisdiction is no longer available in IQ Mapping.":void 0,onClick:()=>t(a),children:"Requeue"}),a.claim_exists&&("free"===a.status||"claimed"===a.status)&&e.jsx("span",{className:"claimed"===a.status?"ml-1.5":void 0,children:e.jsx(L,{tone:"skip",onClick:()=>r(a),children:"Skip"})})]}),D=({row:a,onRelease:s,onRequeue:t,onSkip:r})=>{const i=x(a);return e.jsxs("tr",{className:"transition-colors hover:bg-neutral-50 "+(i?"bg-amber-50/70 hover:bg-amber-50":""),children:[e.jsx("td",{className:"px-4 py-2.5 font-mono text-[13px]",children:e.jsx(h,{id:a.id})}),e.jsxs("td",{className:"px-4 py-2.5 text-neutral-800",children:[e.jsx(b,{name:a.name,state:a.state}),e.jsx(y,{type:a.type,sourceAvailable:a.source_available})]}),e.jsxs("td",{className:"px-4 py-2.5",children:[e.jsx(j,{status:a.status}),!1===a.claim_exists&&e.jsx("span",{className:"ml-2 text-xs text-neutral-400",children:"Not started"}),i&&e.jsx("span",{className:"ml-2 inline-flex items-center gap-1 rounded-full bg-amber-100 px-2 py-0.5 text-[11px] font-semibold text-amber-800 ring-1 ring-inset ring-amber-300",children:"â Stale"})]}),e.jsx("td",{className:"px-4 py-2.5 font-mono text-xs text-neutral-500",children:a.worker??"â"}),e.jsx("td",{className:"px-4 py-2.5 text-xs text-neutral-500",title:a.claimed_at?new Date(a.claimed_at).toLocaleStr
1ing():void 0,children:a.claimed_at?k(a.claimed_at):"â"}),e.jsx(T,{row:a}),e.jsx($,{row:a,onRelease:s,onRequeue:t,onSkip:r})]})},W=({rows:a,isLoading:s,filtersActive:t,page:r,totalPages:i,total:o,onPageChange:n,onRelease:l,onRequeue:c,onSkip:d})=>e.jsxs("div",{className:"overflow-hidden rounded-xl border border-neutral-200 bg-white shadow-xs",children:[e.jsx(g,{columns:_,isLoading:s,empty:0===a.length?{title:t?"No jurisdictions match these filters.":"No jurisdictions available.",hint:t?"Try clearing the filters above.":"Jurisdictions appear from IQ Mapping as soon as geography is available."}:null,ariaLabel:"Discovery claims",children:a.map(a=>e.jsx(D,{row:a,onRelease:l,onRequeue:c,onSkip:d},a.id))}),e.jsx(m,{page:r,totalPages:i,total:o,onPageChange:n})]});function I(){const{page:s,setPage:t,status:r,worker:i,q:o,rows:n,total:l,totalPages:c,filtersActive:d,isLoading:u,isError:g,error:p,actionError:m,onStatusChange:x,onWorkerChange:h,onSearchChange:b,clearFilters:y,dismissActionError:j,onRelease:k,onRequeue:_,onSkip:L,state:T,type:$,states:D,geographyLoading:I,geographyError:J,onStateChange:M,onTypeChange:B}=(()=>{var e;const[s,t]=a.useState(1),[r,i]=a.useState(""),[o,n]=a.useState(""),[l,c]=a.useState(""),[d,u]=a.useState(""),[g,p]=a.useState(""),[m,x]=a.useState(null),{data:h,isLoading:b,isError:y,error:j}=f({page:s,limit:w,status:r,worker:o,q:l,state:d,type:g}),k=S(),_=N(),L=q(),A=R(),P=(null==h?void 0:h.rows)??[],E=(null==h?void 0:h.total)??0,F=v(E),T=""!==r||""!==o||""!==l||""!==d||""!==g,$=a.useCallback(e=>{u(e),t(1)},[]),D=a.useCallback(e=>{p(e),t(1)},[]),W=a.useCallback(e=>{i(e),t(1)},[]),I=a.useCallback(e=>{n(e),t(1)},[]),J=a.useCallback(e=>{c(e),t(1)},[]),M=a.useCallback(()=>{i(""),n(""),c(""),u(""),p(""),t(1)},[]),B=a.useCallback(()=>x(null),[]),G=a.useCallback(async(e,a)=>{x(null);try{await e.mutateAsync(a)}catch(s){x(C(s))}},[]),Q=a.useCallback(e=>{e.claim_exists&&window.confirm(`Release claim ${e.id} (${e.name}) back to free?`)&&G(_,{id:e.id})},[_,G]),z=a.useCallback(e=>{if(!e.claim_exists||!0!==e.source_available)return;const a=window.prompt(`Requeue ${e.id} (${e.name}) for rediscovery. Reason (required):`);a&&a.trim()&&G(L,{id:e.id,reason:a.trim()})},[L,G]),H=a.useCallback(e=>{if(!e.claim_exists)return;const a=window.prompt(`Skip ${e.id} (${e.name}). Reason (required):`);a&&a.trim()&&G(A,{id:e.id,reason:a.trim()})},[A,G]);return{page:s,setPage:t,status:r,worker:o,q:l,state:d,type:g,states:(null==(e=k.data)?void 0:e.states)??[],geographyLoading:k.isLoading,geographyError:k.error,rows:P,total:E,totalPages:F,filtersActive:T,isLoading:b,isError:y,error:j,actionError:m,onStatusChange:W,onWorkerChange:I,onSearchChange:J,onStateChange:$,onTypeChange:D,clearFilters:M,dismissActionError:B,onRelease:Q,onRequeue:z,onSkip:H}})();return e.jsxs("div",{className:"min-h-full space-y-4 bg-gray-50 p-6",children:[e.jsx(E,{total:l}),g&&e.jsx(A,{error:p}),m&&e.jsx(P,{message:m,onDismiss:j}),e.jsx(F,{status:r,worker:i,q:o,state:T,type:$,states:D,geographyLoading:I,geographyError:J,onStateChange:M,onTypeChange:B,filtersActive:d,onStatusChange:x,onSearchChange:b,onWorkerChange:h,clearFilters:y}),e.jsx(W,{rows:n,isLoading:u,filtersActive:d,page:s,totalPages:c,total:l,onPageChange:t,onRelease:k,onRequeue:_,onSkip:L})]})}export{I 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.