@aiquants/enrichment-react 0.1.1 → 0.2.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.js CHANGED
@@ -1 +1 @@
1
- import{jsx as Le,jsxs as ze}from"react/jsx-runtime";var yt={remote_tiers_unavailable:"\u691C\u7D22\u88DC\u52A9\u30B5\u30FC\u30D3\u30B9\u306B\u63A5\u7D9A\u3067\u304D\u307E\u305B\u3093\u3067\u3057\u305F\u3002","circuit_breaker_open:vector":"\u30D9\u30AF\u30C8\u30EB\u691C\u7D22\u304C\u4E00\u6642\u7684\u306B\u906E\u65AD\u3055\u308C\u3066\u3044\u307E\u3059\u3002","circuit_breaker_open:graph":"\u30B0\u30E9\u30D5\u691C\u7D22\u304C\u4E00\u6642\u7684\u306B\u906E\u65AD\u3055\u308C\u3066\u3044\u307E\u3059\u3002",vector_search_disabled:"\u30D9\u30AF\u30C8\u30EB\u691C\u7D22\u304C\u7BA1\u7406\u8005\u306B\u3088\u308A\u7121\u52B9\u5316\u3055\u308C\u3066\u3044\u307E\u3059\u3002",graph_search_disabled:"\u30B0\u30E9\u30D5\u691C\u7D22\u304C\u7BA1\u7406\u8005\u306B\u3088\u308A\u7121\u52B9\u5316\u3055\u308C\u3066\u3044\u307E\u3059\u3002"};function We({metadata:t,onDismiss:r}){if(!t.is_degraded)return null;let o=(t.degradation_reason??"").split(",").map(l=>l.trim()).filter(l=>l.length>0);return Le("div",{role:"status","data-testid":"degraded-search-banner","data-quality-tier":t.quality_tier,"data-search-mode":t.search_mode,"data-degraded":"true",style:{padding:"12px 16px",borderRadius:"6px",border:"1px solid #f59e0b",backgroundColor:"#fffbeb",color:"#92400e",marginBottom:"12px"},children:ze("div",{style:{display:"flex",justifyContent:"space-between",alignItems:"flex-start"},children:[ze("div",{children:[ze("p",{"data-testid":"degraded-mode-message",style:{margin:0,fontWeight:600},children:["\u691C\u7D22\u7D50\u679C\u306F\u7E2E\u9000\u30E2\u30FC\u30C9 (",t.search_mode,") \u3067\u53D6\u5F97\u3055\u308C\u3066\u3044\u307E\u3059\u3002"]}),o.length>0&&Le("ul",{"data-testid":"degraded-reason-list",style:{margin:"6px 0 0 0",paddingLeft:"20px"},children:o.map(l=>Le("li",{"data-testid":`degraded-reason-${l}`,children:yt[l]??l},l))})]}),r&&Le("button",{type:"button","data-testid":"degraded-banner-dismiss",onClick:r,"aria-label":"\u9589\u3058\u308B",style:{background:"none",border:"none",cursor:"pointer",color:"#92400e",fontWeight:"bold",fontSize:"14px",padding:"2px 6px"},children:"\u2715"})]})})}import{ConfidentialityLevelSchema as ht,EnrichmentSyncStatusSchema as Xe,QUARANTINED_CONFIDENTIALITY_LEVEL as Ve}from"@aiquants/enrichment-core";import{useId as ie,useMemo as Qe,useState as j}from"react";import{Fragment as wt,jsx as s,jsxs as d}from"react/jsx-runtime";var Nt=new Set(Xe.options.filter(t=>t.startsWith("FAILED"))),St=new Set(Xe.options);function Et(t){return t.isCurrent===!1?{kind:"blocked",reason:"\u65E7\u7248\u306E\u305F\u3081\u518D\u5B9F\u884C\u4E0D\u53EF"}:t.syncStatus==="SYNCED"?{kind:"resync"}:Nt.has(t.syncStatus)?{kind:"retry"}:St.has(t.syncStatus)?{kind:"blocked",reason:"\u51E6\u7406\u4E2D"}:{kind:"blocked",reason:"\u4E0D\u660E\u306A\u72B6\u614B"}}function Je(t,r,c){let o=t?.find(l=>l.confidentialityLevel===r&&l.capability===c);return o?o.isEnabled:null}var kt={PUBLIC:"\u5168\u516C\u958B",INTERNAL:"\u793E\u5185\u5171\u6709",DEPARTMENT:"\u90E8\u9580\u9650\u5B9A",CONFIDENTIAL:"\u6A5F\u5BC6 - \u65E2\u5B9A",RESTRICTED:"\u691C\u7D22\u5B8C\u5168\u9664\u5916\u30FB\u4FDD\u8B77"},_t=[{key:"GENERAL_DOCUMENT",label:"\u4E00\u822C\u6587\u66F8 (GENERAL_DOCUMENT)"},{key:"CONTRACT_LEGAL",label:"\u5951\u7D04\u66F8\u30FB\u6CD5\u52D9 (CONTRACT_LEGAL)"},{key:"FINANCIAL_REPORT",label:"\u8CA1\u52D9\u8AF8\u8868\u30FB\u6C7A\u7B97\u77ED\u4FE1 (FINANCIAL_REPORT)"},{key:"TECHNICAL_SPEC",label:"\u6280\u8853\u4ED5\u69D8\u66F8\u30FB\u8A2D\u8A08\u66F8 (TECHNICAL_SPEC)"},{key:"DAILY_REPORT",label:"\u696D\u52D9\u65E5\u5831 (DAILY_REPORT)"},{key:"EMAIL_THREAD",label:"\u30E1\u30FC\u30EB\u30B9\u30EC\u30C3\u30C9 (EMAIL_THREAD)"},{key:"MASTER_DATA",label:"\u30DE\u30B9\u30BF\u30C7\u30FC\u30BF (MASTER_DATA)"},{key:"MEDIA_ASSET",label:"\u753B\u50CF\u30FB\u97F3\u58F0\u30E1\u30C7\u30A3\u30A2 (MEDIA_ASSET)"}],It=["\u5951\u7D04\u66F8","\u6C7A\u7B97\u77ED\u4FE1","\u6280\u8853\u4ED5\u69D8\u66F8","\u793E\u5185\u898F\u7A0B","\u8B70\u4E8B\u9332","\u4EBA\u4E8B\u65B9\u91DD"];function Ct(t){if(t<=0)return"0 B";let r=1024,c=["B","KB","MB","GB"],o=Math.floor(Math.log(t)/Math.log(r));return`${(t/r**o).toFixed(1)} ${c[o]}`}function Vt({policies:t,tenantId:r,recentItems:c=[],inspectionResult:o=null,isSubmitting:l=!1,isInspecting:p=!1,onInspectUri:x,onIngestDocument:b,onRetryItem:I}){let E=ie(),k=ie(),g=ie(),u=ie(),y=ie(),P=ie(),H=ie(),B=ie(),[O,z]=j("gdrive://"),[pe,W]=j(""),[Q,K]=j(""),[V,ee]=j("CONFIDENTIAL"),[me,xe]=j("GENERAL_DOCUMENT"),[ue,be]=j(""),[ge,ve]=j(""),[se,re]=j([]),[ke,ye]=j(""),[_e,Ie]=j("user"),[oe,de]=j(1),[le,Pe]=j(!1),q=Qe(()=>({vectorEnabled:Je(t,V,"vector_indexing"),graphEnabled:Je(t,V,"graph_indexing")}),[t,V]),G=Qe(()=>{let a=Q.trim();if(!a)return{valid:!1,error:null};if(!(a.startsWith("file://")||a.startsWith("gdrive://")||a.startsWith("gcs://")))return{valid:!1,error:"\u8A31\u53EF\u3055\u308C\u305F\u30B9\u30AD\u30FC\u30E0 (file://, gdrive://, gcs://) \u3067\u59CB\u307E\u308B\u5FC5\u8981\u304C\u3042\u308A\u307E\u3059\u3002"};let A=a.replace(/^(file|gdrive|gcs):\/\//,"");return!A.trim()||A.trim()==="<id>"||A.trim()==="<bucket>/<key>"?{valid:!1,error:"URI \u306E\u30D1\u30B9\u90E8\u5206\u304C\u6307\u5B9A\u3055\u308C\u3066\u3044\u307E\u305B\u3093\u3002"}:a.includes("..")?{valid:!1,error:"\u76F8\u5BFE\u30D1\u30B9\u8A18\u53F7 (..) \u306B\u3088\u308B\u30D1\u30B9\u30C8\u30E9\u30D0\u30FC\u30B5\u30EB\u306F\u7981\u6B62\u3055\u308C\u3066\u3044\u307E\u3059\u3002"}:{valid:!0,error:null}},[Q]),ne=a=>{let m=a.trim(),A=m.match(/\/file\/d\/([a-zA-Z0-9_-]+)/);if(A)return A[1];let J=m.match(/[?&]id=([a-zA-Z0-9_-]+)/);return J?J[1]:null},he=a=>{if(z(a),pe.trim()){let m=pe.trim().replace(/^(file|gdrive|gcs):\/\//,"");K(`${a}${m}`)}else K("")},Me=a=>{let m=a.trim();if(!m){W(""),K("");return}let A=ne(m);if(A){z("gdrive://"),W(A),K(`gdrive://${A}`);return}if(m.startsWith("gdrive://")){z("gdrive://");let J=m.replace(/^gdrive:\/\//,"");W(J),K(m);return}if(m.startsWith("file://")){z("file://");let J=m.replace(/^file:\/\//,"");W(J),K(m);return}if(m.startsWith("gcs://")){z("gcs://");let J=m.replace(/^gcs:\/\//,"");W(J),K(m);return}if(m.includes("://")){W(a),K(m);return}W(a),K(`${O}${m}`)},Ce=a=>{switch(a){case"gdrive://":return"1EXAMPLEFILEID0000000000000000000 (\u30D5\u30A1\u30A4\u30EB ID \u307E\u305F\u306F\u5171\u6709\u30EA\u30F3\u30AF)";case"file://":return"/srv/documents/specification.md (\u7D76\u5BFE\u30D1\u30B9)";case"gcs://":return"my-bucket/documents/report.pdf (\u30D0\u30B1\u30C3\u30C8\u540D/\u30D1\u30B9)"}},we=()=>{let a=ke.trim();a&&(se.some(m=>m.labelKey===a)||(re(m=>[...m,{labelKey:a,category:_e,confidenceScore:Number(oe.toFixed(2))}]),ye("")))},Fe=a=>{se.some(m=>m.labelKey===a)||re(m=>[...m,{labelKey:a,category:"domain",confidenceScore:1}])},Oe=a=>{re(m=>m.filter(A=>A.labelKey!==a))},Re=a=>{if(a.preventDefault(),!G.valid)return;let m={fileUri:Q.trim(),confidentialityLevel:V,targetDomainKey:me,departmentId:ue.trim()?Number(ue):null,titleOverride:ge.trim()?ge.trim():null,labels:se};b?.(m)},C=a=>{let m=Et(a);if(m.kind==="blocked")return s("span",{className:"font-sans text-[11px] text-slate-400","data-testid":`ingest-action-blocked-${a.id}`,"data-reason":m.reason,children:m.reason});let A=m.kind==="retry";return s("button",{type:"button",onClick:()=>I?.(a.id),"aria-label":`${a.fileName} \u3092${A?"\u518D\u8A66\u884C":"\u518D\u540C\u671F"}`,className:A?"rounded-sm border border-red-200 bg-red-50 px-2 py-1 font-semibold text-red-700 text-xs hover:bg-red-100":"rounded-sm border border-emerald-200 bg-emerald-50 px-2 py-1 font-semibold text-emerald-700 text-xs hover:bg-emerald-100","data-testid":`ingest-${m.kind}-button-${a.id}`,children:A?"\u518D\u8A66\u884C":"\u518D\u540C\u671F"})},Be=a=>{switch(a){case"SYNCED":return s("span",{className:"inline-flex items-center rounded-full bg-emerald-100 px-2.5 py-0.5 font-semibold text-emerald-800 text-xs",children:"\u540C\u671F\u5B8C\u4E86"});case"PENDING":return s("span",{className:"inline-flex items-center rounded-full bg-slate-100 px-2.5 py-0.5 font-medium text-slate-800 text-xs",children:"\u5F85\u6A5F\u4E2D"});case"EXTRACTING":return s("span",{className:"inline-flex items-center rounded-full bg-blue-100 px-2.5 py-0.5 font-medium text-blue-800 text-xs",children:"\u672C\u6587\u62BD\u51FA\u4E2D"});case"ENRICHING":return s("span",{className:"inline-flex items-center rounded-full bg-purple-100 px-2.5 py-0.5 font-medium text-purple-800 text-xs",children:"AI \u8981\u7D04\u30FB\u69CB\u9020\u5316\u4E2D"});case"PROJECTING":return s("span",{className:"inline-flex items-center rounded-full bg-indigo-100 px-2.5 py-0.5 font-medium text-indigo-800 text-xs",children:"\u30D9\u30AF\u30C8\u30EB/\u30B0\u30E9\u30D5\u6295\u5F71\u4E2D"});default:return a.startsWith("FAILED")?d("span",{className:"inline-flex items-center rounded-full bg-red-100 px-2.5 py-0.5 font-semibold text-red-800 text-xs",children:["\u5931\u6557: ",a]}):s("span",{className:"inline-flex items-center rounded-full bg-slate-100 px-2.5 py-0.5 font-medium text-slate-800 text-xs",children:a})}};return d("div",{className:"space-y-6","data-testid":"document-ingest-console",children:[d("div",{className:"rounded-xl border border-slate-200 bg-white p-6 shadow-sm",children:[d("div",{className:"flex flex-col justify-between gap-2 md:flex-row md:items-center",children:[d("div",{children:[s("h2",{className:"font-bold text-lg text-slate-900",children:"\u30C9\u30AD\u30E5\u30E1\u30F3\u30C8\u53D6\u308A\u8FBC\u307F & \u30E1\u30BF\u30C7\u30FC\u30BF\u751F\u6210"}),s("p",{className:"mt-1 text-slate-500 text-sm",children:"\u5BFE\u8C61 URI \u3092\u6307\u5B9A\u3057\u3066\u672C\u6587\u62BD\u51FA\u30FBAI \u8981\u7D04\u30FB\u69CB\u9020\u5316\u30E1\u30BF\u30C7\u30FC\u30BF\u4ED8\u4E0E\u30FBQdrant \u30D9\u30AF\u30C8\u30EB\u304A\u3088\u3073 Neo4j \u30B0\u30E9\u30D5\u3078\u306E\u6295\u5F71\u3092\u5B9F\u884C\u3057\u307E\u3059\u3002"})]}),d("div",{className:"inline-flex items-center rounded-lg border border-slate-200 bg-slate-50 px-3 py-1.5 font-medium text-slate-600 text-xs",children:["\u30C6\u30CA\u30F3\u30C8: ",s("span",{className:"ml-1.5 font-bold text-slate-800",children:r})]})]}),d("form",{onSubmit:Re,className:"mt-6 space-y-6",children:[d("div",{className:"space-y-3","data-testid":"document-uri-input-group",children:[d("div",{className:"flex flex-wrap items-center justify-between gap-2",children:[d("label",{htmlFor:E,className:"block font-semibold text-slate-800 text-sm",children:["\u30D5\u30A1\u30A4\u30EB URI / \u30EA\u30BD\u30FC\u30B9\u8B58\u5225\u5B50 ",s("span",{className:"text-red-500",children:"*"})]}),d("span",{className:"font-mono text-slate-500 text-xs",children:["\u9078\u629E\u30B9\u30AD\u30FC\u30E0: ",s("strong",{className:"font-semibold text-indigo-600",children:O})]})]}),d("div",{className:"flex flex-wrap items-center gap-2",children:[s("span",{className:"font-medium text-slate-500 text-xs",children:"\u30B9\u30AD\u30FC\u30E0\u6307\u5B9A:"}),s("button",{type:"button",onClick:()=>he("gdrive://"),className:`rounded-sm border px-2.5 py-1 font-mono text-xs transition-colors ${O==="gdrive://"?"border-indigo-600 bg-indigo-50 font-semibold text-indigo-700 shadow-sm":"border-slate-200 bg-slate-100 text-slate-700 hover:bg-slate-200"}`,"data-testid":"scheme-select-gdrive",children:"gdrive:// (Google Drive)"}),s("button",{type:"button",onClick:()=>he("file://"),className:`rounded-sm border px-2.5 py-1 font-mono text-xs transition-colors ${O==="file://"?"border-indigo-600 bg-indigo-50 font-semibold text-indigo-700 shadow-sm":"border-slate-200 bg-slate-100 text-slate-700 hover:bg-slate-200"}`,"data-testid":"scheme-select-file",children:"file:// (\u30ED\u30FC\u30AB\u30EB)"}),s("button",{type:"button",onClick:()=>he("gcs://"),className:`rounded-sm border px-2.5 py-1 font-mono text-xs transition-colors ${O==="gcs://"?"border-indigo-600 bg-indigo-50 font-semibold text-indigo-700 shadow-sm":"border-slate-200 bg-slate-100 text-slate-700 hover:bg-slate-200"}`,"data-testid":"scheme-select-gcs",children:"gcs:// (GCS)"})]}),d("div",{className:"space-y-1.5",children:[d("div",{className:"flex gap-2",children:[d("div",{className:`flex flex-1 rounded-lg border shadow-sm transition-colors focus-within:ring-2 ${G.error?"border-red-300 focus-within:border-red-500 focus-within:ring-red-200":"border-slate-300 focus-within:border-indigo-500 focus-within:ring-indigo-100"}`,children:[s("span",{className:"inline-flex select-none items-center rounded-l-lg border-slate-200 border-r bg-slate-50 px-3.5 font-mono font-semibold text-slate-700 text-sm","data-testid":"scheme-prefix-badge",children:O}),s("input",{id:E,type:"text",value:pe,onChange:a=>Me(a.target.value),placeholder:Ce(O),"aria-invalid":!!G.error,"aria-describedby":G.error?"ingest-uri-error":void 0,className:"flex-1 rounded-r-lg px-3.5 py-2 font-mono text-sm focus:outline-none","data-testid":"ingest-file-uri-input",required:!0})]}),s("button",{type:"button",onClick:()=>x?.(Q.trim()),disabled:!G.valid||p,className:"inline-flex items-center justify-center rounded-lg border border-slate-300 bg-white px-4 py-2 font-medium text-slate-700 text-sm shadow-sm hover:bg-slate-50 disabled:opacity-50","data-testid":"ingest-inspect-uri-button",children:p?"\u691C\u8A3C\u4E2D...":"URI \u4E8B\u524D\u691C\u8A3C"})]}),d("div",{className:"flex flex-wrap items-center justify-between gap-1 text-xs",children:[d("p",{className:"text-slate-500",children:[O==="gdrive://"&&"Google Drive \u306E\u30D5\u30A1\u30A4\u30EB ID (\u4F8B: 1EXAMPLEFILEID0000000000000000000) \u307E\u305F\u306F URL \u3092\u8CBC\u308A\u4ED8\u3051\u308B\u3068\u81EA\u52D5\u62BD\u51FA\u3055\u308C\u307E\u3059\u3002",O==="file://"&&"\u30EF\u30FC\u30AF\u30B9\u30DA\u30FC\u30B9\u5185\u306E\u7D76\u5BFE\u30D1\u30B9 (\u4F8B: /srv/documents/sample.md) \u3092\u6307\u5B9A\u3057\u3066\u304F\u3060\u3055\u3044\u3002",O==="gcs://"&&"GCS \u306E\u30D0\u30B1\u30C3\u30C8\u540D/\u30AA\u30D6\u30B8\u30A7\u30AF\u30C8\u30D1\u30B9 (\u4F8B: my-bucket/documents/report.pdf) \u3092\u6307\u5B9A\u3057\u3066\u304F\u3060\u3055\u3044\u3002"]}),Q&&d("div",{className:"flex items-center gap-1 font-mono text-slate-500",children:[s("span",{children:"\u89E3\u6C7A URI:"}),s("code",{className:"rounded-sm bg-slate-100 px-1.5 py-0.5 font-bold text-indigo-700","data-testid":"resolved-uri-code",children:Q})]})]})]}),G.error&&s("p",{id:"ingest-uri-error",className:"text-red-600 text-xs",role:"alert","data-testid":"ingest-uri-error",children:G.error})]}),o&&o.fileUri===Q.trim()&&d("section",{"aria-live":"polite","aria-label":"\u30EA\u30BD\u30FC\u30B9\u691C\u8A3C\u7D50\u679C",className:`rounded-lg border p-4 text-sm transition-all ${o.exists?"border-emerald-200 bg-emerald-50/60 text-emerald-950":"border-red-200 bg-red-50/60 text-red-950"}`,"data-testid":"inspection-result-card",children:[d("div",{className:"flex items-center justify-between",children:[s("span",{className:"font-semibold",children:o.exists?"\u2713 \u30EA\u30BD\u30FC\u30B9\u78BA\u8A8D\u5B8C\u4E86 (\u30A2\u30AF\u30BB\u30B9\u53EF\u80FD)":"\u26A0 \u30EA\u30BD\u30FC\u30B9\u4E0D\u9054 (\u30D5\u30A1\u30A4\u30EB\u304C\u898B\u3064\u304B\u308A\u307E\u305B\u3093)"}),s("span",{className:"font-mono text-slate-500 text-xs",children:o.fileUri})]}),o.exists&&d("div",{className:"mt-2 grid grid-cols-2 gap-4 font-mono text-xs md:grid-cols-4",children:[d("div",{children:[s("span",{className:"block text-slate-500",children:"\u30D5\u30A1\u30A4\u30EB\u540D:"}),s("span",{className:"font-semibold text-slate-800",children:o.fileName})]}),d("div",{children:[s("span",{className:"block text-slate-500",children:"\u30B5\u30A4\u30BA:"}),s("span",{className:"font-semibold text-slate-800",children:Ct(o.fileSize)})]}),d("div",{children:[s("span",{className:"block text-slate-500",children:"MIME:"}),s("span",{className:"font-semibold text-slate-800",children:o.mimeType})]}),d("div",{children:[s("span",{className:"block text-slate-500",children:"\u30EA\u30D3\u30B8\u30E7\u30F3:"}),s("span",{className:"font-semibold text-slate-800",children:o.revisionId?.slice(0,8)??"N/A"})]})]})]}),d("div",{className:"grid grid-cols-1 gap-4 md:grid-cols-3",children:[d("div",{className:"space-y-1",children:[d("label",{htmlFor:k,className:"block font-semibold text-slate-700 text-xs",children:["\u6A5F\u5BC6\u533A\u5206 (Confidentiality Level) ",s("span",{className:"text-red-500",children:"*"})]}),s("select",{id:k,value:V,onChange:a=>ee(a.target.value),className:"w-full rounded-lg border border-slate-300 bg-white px-3 py-2 text-slate-800 text-sm focus:border-indigo-500 focus:outline-none focus:ring-1 focus:ring-indigo-500","data-testid":"ingest-confidentiality-select",children:ht.options.map(a=>d("option",{value:a,children:[a," (",kt[a],")"]},a))})]}),d("div",{className:"space-y-1",children:[d("label",{htmlFor:g,className:"block font-semibold text-slate-700 text-xs",children:["\u5BFE\u8C61\u30C9\u30E1\u30A4\u30F3 (Target Domain) ",s("span",{className:"text-red-500",children:"*"})]}),s("select",{id:g,value:me,onChange:a=>xe(a.target.value),className:"w-full rounded-lg border border-slate-300 bg-white px-3 py-2 text-slate-800 text-sm focus:border-indigo-500 focus:outline-none focus:ring-1 focus:ring-indigo-500","data-testid":"ingest-domain-select",children:_t.map(a=>s("option",{value:a.key,children:a.label},a.key))})]})]}),V===Ve&&d("div",{className:"rounded-lg border border-amber-300 bg-amber-50 p-3 text-amber-900 text-xs",role:"alert","data-testid":"restricted-warning-banner",children:[s("span",{className:"font-bold",children:"\u3010\u9694\u96E2\u6CE8\u610F\u3011"})," ",Ve," \u306B\u8A2D\u5B9A\u3055\u308C\u305F\u6587\u66F8\u306F\u3001\u6CD5\u4EE4\u9075\u5B88\u30FB\u4FC2\u4E89\u4FDD\u5168\u306E\u305F\u3081\u691C\u7D22\u7D50\u679C\u306B\u4E00\u5207\u51FA\u73FE\u3057\u307E\u305B\u3093\u3002\u3053\u308C\u306F\u8A2D\u5B9A\u3067\u306F\u306A\u304F\u4FDD\u8A3C\u3067\u3042\u308A\u3001\u30DD\u30EA\u30B7\u30FC\u306E\u5024\u306B\u4F9D\u3089\u305A\u5E38\u306B\u6210\u7ACB\u3057\u307E\u3059\u3002",s("span",{className:"mt-1 block text-amber-800",children:"\u7D22\u5F15\u305D\u306E\u3082\u306E\u3092\u884C\u3046\u304B\u3069\u3046\u304B\u306F\u5225\u306E\u8A2D\u5B9A\u3067\u3059 (\u4E0B\u306E\u6295\u5F71\u5148\u3092\u53C2\u7167)\u3002\u7D22\u5F15\u3055\u308C\u305F\u6587\u66F8\u3082\u691C\u7D22\u7D50\u679C\u306B\u306F\u73FE\u308C\u307E\u305B\u3093\u3002"})]}),d("div",{className:"space-y-2 rounded-lg border border-indigo-100 bg-indigo-50/30 p-4","data-testid":"projection-capability-card",children:[s("span",{className:"block font-semibold text-indigo-950 text-xs",children:"\u3053\u306E\u6A5F\u5BC6\u533A\u5206\u306B\u5BFE\u3059\u308B\u6295\u5F71\u306E\u53EF\u5426 (Projection)"}),d("div",{className:"grid grid-cols-1 gap-3 sm:grid-cols-2",children:[d("div",{className:"rounded-sm border border-indigo-200/80 bg-white p-2.5",children:[s("span",{className:"block font-semibold text-slate-600 text-xs",children:"\u30D9\u30AF\u30C8\u30EB\u7D22\u5F15 (Qdrant)"}),s("span",{className:"mt-1 block font-bold text-xs","data-testid":"projection-vector-state","data-state":String(q.vectorEnabled),children:q.vectorEnabled===void 0?"\u8A2D\u5B9A\u304C\u6E21\u3055\u308C\u3066\u3044\u306A\u3044\u305F\u3081\u4E0D\u660E":q.vectorEnabled?"\u6709\u52B9":`\u7121\u52B9 (${V} \u306E\u8A2D\u5B9A)`})]}),d("div",{className:"rounded-sm border border-indigo-200/80 bg-white p-2.5",children:[s("span",{className:"block font-semibold text-slate-600 text-xs",children:"\u30B0\u30E9\u30D5\u7D22\u5F15 (Neo4j)"}),s("span",{className:"mt-1 block font-bold text-xs","data-testid":"projection-graph-state","data-state":String(q.graphEnabled),children:q.graphEnabled===void 0?"\u8A2D\u5B9A\u304C\u6E21\u3055\u308C\u3066\u3044\u306A\u3044\u305F\u3081\u4E0D\u660E":q.graphEnabled?"\u6709\u52B9":`\u7121\u52B9 (${V} \u306E\u8A2D\u5B9A)`})]})]}),d("p",{className:"text-[11px] text-slate-600","data-testid":"projection-destination-note",children:["\u6295\u5F71\u5148\u306E\u30B3\u30EC\u30AF\u30B7\u30E7\u30F3\u540D\u30FB\u30B0\u30E9\u30D5\u30E9\u30D9\u30EB\u30FB\u30C1\u30E3\u30F3\u30AF\u5206\u5272\u65B9\u5F0F\u306F\u3001\u9078\u629E\u3057\u305F\u30C9\u30E1\u30A4\u30F3\u306B\u5BFE\u3059\u308B\u914D\u5099\u306E\u53D6\u308A\u8FBC\u307F\u6226\u7565 (",s("code",{className:"font-mono",children:"tm_enrichment_strategy"}),") \u304C\u6C7A\u3081\u307E\u3059\u3002\u3053\u306E\u753B\u9762\u3067\u306F\u63A8\u5B9A\u3057\u307E\u305B\u3093\u3002"]})]}),d("div",{className:"space-y-3 rounded-lg border border-slate-200 bg-slate-50/50 p-4",children:[d("div",{className:"flex items-center justify-between",children:[s("span",{className:"font-semibold text-slate-800 text-xs",children:"\u4ED8\u52A0\u60C5\u5831 / \u30E9\u30D9\u30EB\u30BF\u30B0 (Labels & Tags)"}),d("span",{className:"text-slate-500 text-xs",children:[se.length," \u4EF6\u8A2D\u5B9A\u4E2D"]})]}),d("div",{className:"flex flex-wrap items-center gap-1.5",children:[s("span",{className:"text-slate-500 text-xs",children:"\u30AF\u30A4\u30C3\u30AF\u5019\u88DC:"}),It.map(a=>d("button",{type:"button",onClick:()=>Fe(a),className:"rounded-full border border-slate-200 bg-white px-2.5 py-0.5 text-slate-700 text-xs transition-colors hover:border-indigo-300 hover:text-indigo-600","data-testid":`preset-tag-${a}`,children:["+ ",a]},a))]}),d("div",{className:"grid grid-cols-1 items-end gap-2 sm:grid-cols-5",children:[d("div",{className:"space-y-1 sm:col-span-2",children:[s("label",{htmlFor:P,className:"block text-slate-600 text-xs",children:"\u30E9\u30D9\u30EB\u540D / \u30AD\u30FC"}),s("input",{id:P,type:"text",value:ke,onChange:a=>ye(a.target.value),onKeyDown:a=>{a.key==="Enter"&&(a.preventDefault(),we())},placeholder:"\u4F8B: \u91CD\u8981\u9867\u5BA2\u5951\u7D04, 2026\u5E74\u5EA6",className:"w-full rounded-sm border border-slate-300 bg-white px-2.5 py-1.5 text-slate-800 text-xs focus:outline-none focus:ring-1 focus:ring-indigo-500","data-testid":"ingest-label-key-input"})]}),d("div",{className:"space-y-1",children:[s("label",{htmlFor:H,className:"block text-slate-600 text-xs",children:"\u7A2E\u5225"}),d("select",{id:H,value:_e,onChange:a=>Ie(a.target.value),className:"w-full rounded-sm border border-slate-300 bg-white px-2 py-1.5 text-slate-800 text-xs focus:outline-none focus:ring-1 focus:ring-indigo-500","data-testid":"ingest-label-category-select",children:[s("option",{value:"user",children:"\u30E6\u30FC\u30B6\u30FC (user)"}),s("option",{value:"domain",children:"\u30C9\u30E1\u30A4\u30F3 (domain)"}),s("option",{value:"system",children:"\u30B7\u30B9\u30C6\u30E0 (system)"})]})]}),d("div",{className:"space-y-1",children:[d("label",{htmlFor:B,className:"block text-slate-600 text-xs",children:["\u78BA\u4FE1\u5EA6 (",oe.toFixed(2),": 0.00\u301C1.00 AI/\u81EA\u52D5\u5224\u5B9A\u306E\u4FE1\u983C\u5EA6\u30B9\u30B3\u30A2\u30020.80 \u4EE5\u4E0A\u3067\u81EA\u52D5\u9069\u7528\u63A8\u5968)"]}),s("input",{id:B,type:"range",min:"0.0",max:"1.0",step:"0.05",value:oe,"aria-valuenow":oe,"aria-valuemin":0,"aria-valuemax":1,"aria-valuetext":`${Math.round(oe*100)}%`,onChange:a=>de(Number.parseFloat(a.target.value)),className:"h-2 w-full cursor-pointer appearance-none rounded-lg bg-slate-200","data-testid":"ingest-label-confidence-slider"})]}),s("div",{children:s("button",{type:"button",onClick:we,className:"w-full rounded-sm bg-slate-800 px-3 py-1.5 font-semibold text-white text-xs hover:bg-slate-700","data-testid":"ingest-add-label-button",children:"\u30BF\u30B0\u8FFD\u52A0"})})]}),se.length>0&&s("div",{className:"flex flex-wrap gap-2 pt-2","data-testid":"active-labels-container",children:se.map(a=>d("span",{className:"inline-flex items-center gap-1.5 rounded-md border border-indigo-200 bg-indigo-50 px-2.5 py-1 font-medium text-indigo-800 text-xs","data-testid":`active-label-${a.labelKey}`,children:[s("span",{className:"font-semibold",children:a.labelKey}),d("span",{className:"text-indigo-400",children:["(",a.category,")"]}),s("button",{type:"button",onClick:()=>Oe(a.labelKey),"aria-label":`\u30E9\u30D9\u30EB ${a.labelKey} \u3092\u524A\u9664`,className:"ml-1 font-bold text-indigo-400 hover:text-indigo-900","data-testid":`remove-label-${a.labelKey}`,children:"\xD7"})]},a.labelKey))})]}),d("div",{className:"space-y-3",children:[s("button",{id:"advanced-settings-toggle",type:"button","aria-expanded":le,"aria-controls":"advanced-settings-panel",onClick:()=>Pe(a=>!a),className:"inline-flex items-center gap-1.5 font-semibold text-indigo-600 text-xs hover:text-indigo-800","data-testid":"ingest-toggle-advanced-button",children:d("span",{children:[le?"\u25BC":"\u25B6"," \u30E1\u30BF\u30C7\u30FC\u30BF\u8A73\u7D30\u30AA\u30FC\u30D0\u30FC\u30E9\u30A4\u30C9 (\u9AD8\u5EA6\u306A\u8A2D\u5B9A)"]})}),le&&d("section",{id:"advanced-settings-panel","aria-labelledby":"advanced-settings-toggle",className:"space-y-4 rounded-lg border border-slate-200 bg-slate-50/40 p-4","data-testid":"advanced-settings-panel",children:[s("div",{className:"grid grid-cols-1 gap-4 md:grid-cols-2",children:d("div",{className:"space-y-1",children:[s("label",{htmlFor:y,className:"block font-medium text-slate-700 text-xs",children:"\u6587\u66F8\u30BF\u30A4\u30C8\u30EB (\u4E0A\u66F8\u304D\u6307\u5B9A)"}),s("input",{id:y,type:"text",value:ge,onChange:a=>ve(a.target.value),placeholder:"\u6307\u5B9A\u3057\u306A\u3044\u5834\u5408\u306F\u30D5\u30A1\u30A4\u30EB\u540D\u307E\u305F\u306F AI \u62BD\u51FA\u30BF\u30A4\u30C8\u30EB\u304C\u4F7F\u7528\u3055\u308C\u307E\u3059",className:"w-full rounded-sm border border-slate-300 bg-white px-3 py-1.5 text-slate-800 text-xs","data-testid":"ingest-title-override-input"})]})}),s("div",{className:"grid grid-cols-1 gap-4 md:grid-cols-2",children:d("div",{className:"space-y-1",children:[s("label",{htmlFor:u,className:"block font-medium text-slate-700 text-xs",children:"\u6240\u7BA1\u90E8\u9580 ID (\u4EFB\u610F)"}),s("input",{id:u,type:"number",value:ue,onChange:a=>be(a.target.value),placeholder:"\u4F8B: 101",className:"w-full rounded-sm border border-slate-300 bg-white px-3 py-1.5 text-slate-800 text-xs","data-testid":"ingest-department-input"})]})})]})]}),s("div",{className:"flex justify-end pt-2",children:s("button",{type:"submit",disabled:!G.valid||l||p,"aria-busy":l,className:"inline-flex items-center gap-2 rounded-lg bg-indigo-600 px-6 py-2.5 font-semibold text-sm text-white shadow-sm transition-colors hover:bg-indigo-700 focus:outline-none focus:ring-2 focus:ring-indigo-500 disabled:opacity-50","data-testid":"ingest-submit-button",children:l?d(wt,{children:[s("span",{className:"h-4 w-4 animate-spin rounded-full border-2 border-white border-t-transparent"}),s("span",{children:"\u53D6\u308A\u8FBC\u307F\u6295\u5165\u4E2D..."})]}):s("span",{children:"\u30E1\u30BF\u30C7\u30FC\u30BF\u751F\u6210 & \u53D6\u308A\u8FBC\u307F\u5B9F\u884C"})})})]})]}),d("div",{className:"space-y-4 rounded-xl border border-slate-200 bg-white p-6 shadow-sm",children:[s("div",{className:"flex items-center justify-between",children:d("div",{children:[s("h3",{className:"font-bold text-base text-slate-900",children:"\u6700\u8FD1\u306E\u53D6\u308A\u8FBC\u307F\u30AD\u30E5\u30FC & \u5B9F\u884C\u72B6\u614B"}),s("p",{className:"text-slate-500 text-xs",children:"\u76F4\u8FD1\u306B\u6295\u5165\u3055\u308C\u305F\u30C9\u30AD\u30E5\u30E1\u30F3\u30C8\u306E\u540C\u671F\u9032\u6357\u3068\u7D50\u679C"})]})}),c.length===0?s("div",{className:"py-8 text-center text-slate-500 text-xs","data-testid":"recent-items-empty",children:"\u53D6\u308A\u8FBC\u307F\u5C65\u6B74\u306F\u3042\u308A\u307E\u305B\u3093\u3002"}):s("div",{className:"overflow-x-auto",children:d("table",{className:"min-w-full divide-y divide-slate-200 text-left text-xs","aria-label":"\u6700\u8FD1\u306E\u53D6\u308A\u8FBC\u307F\u5C65\u6B74","data-testid":"recent-items-table",children:[s("thead",{className:"bg-slate-50 font-semibold text-slate-700",children:d("tr",{children:[s("th",{scope:"col",className:"px-3 py-2.5",children:"ID"}),s("th",{scope:"col",className:"px-3 py-2.5",children:"\u30D5\u30A1\u30A4\u30EB\u540D / URI"}),s("th",{scope:"col",className:"px-3 py-2.5",children:"\u6A5F\u5BC6\u533A\u5206"}),s("th",{scope:"col",className:"px-3 py-2.5",children:"\u30EA\u30D3\u30B8\u30E7\u30F3"}),s("th",{scope:"col",className:"px-3 py-2.5",children:"\u540C\u671F\u30B9\u30C6\u30FC\u30BF\u30B9"}),s("th",{scope:"col",className:"px-3 py-2.5",children:"\u767B\u9332\u65E5\u6642"}),s("th",{scope:"col",className:"px-3 py-2.5 text-right",children:"\u30A2\u30AF\u30B7\u30E7\u30F3"})]})}),s("tbody",{className:"divide-y divide-slate-100 font-mono text-slate-800",children:c.map(a=>d("tr",{className:"transition-colors hover:bg-slate-50/80","data-testid":`recent-item-row-${a.id}`,children:[s("td",{className:"px-3 py-2 font-bold",children:a.id}),d("td",{className:"max-w-xs truncate px-3 py-2",title:a.fileUri,children:[s("div",{className:"font-sans font-semibold text-slate-900",children:a.fileName}),s("div",{className:"truncate text-[11px] text-slate-600",children:a.fileUri})]}),s("td",{className:"px-3 py-2",children:s("span",{className:"inline-flex rounded-sm bg-slate-100 px-2 py-0.5 font-medium font-sans text-[11px] text-slate-700",children:a.confidentialityLevel})}),d("td",{className:"px-3 py-2 text-slate-600",children:["rev.",a.revision,a.isCurrent===!1&&s("span",{className:"ml-1.5 inline-flex items-center rounded-sm bg-slate-100 px-1.5 py-0.5 font-medium font-sans text-[10px] text-slate-500","data-testid":`ingest-item-superseded-${a.id}`,children:"\u65E7\u7248"})]}),d("td",{className:"px-3 py-2 font-sans",children:[Be(a.syncStatus),a.errorMessage!==null&&a.errorMessage!==void 0&&a.errorMessage!==""&&s("div",{className:"mt-1 max-w-xs break-words text-[11px] text-red-700","data-testid":`ingest-item-error-${a.id}`,title:a.errorMessage,children:a.errorMessage})]}),s("td",{className:"px-3 py-2 font-sans text-[11px] text-slate-500",children:new Date(a.createdAt).toLocaleString("ja-JP")}),s("td",{className:"px-3 py-2 text-right font-sans",children:C(a)})]},a.id))})]})})]})]})}import{ENRICHMENT_STAGES as qe}from"@aiquants/enrichment-core";import{jsx as $,jsxs as Y}from"react/jsx-runtime";var Ye={open:{label:"\u30D5\u30E9\u30B0\u6709\u52B9",color:"#047857"},closed:{label:"\u30D5\u30E9\u30B0\u7121\u52B9",color:"#b45309"},unmeasured:{label:"\u30D5\u30E9\u30B0\u672A\u6E2C\u5B9A",color:"#64748b"},absent:{label:"\u30C6\u30CA\u30F3\u30C8\u306E\u9580\u306A\u3057",color:"#64748b"}};function Ze(t,r){return t===null?"absent":t in r?r[t]?"open":"closed":"unmeasured"}function Yt({strategies:t,featureFlags:r,onToggleStage:c,isUpdating:o=!1}){let l=c===void 0;return Y("div",{"data-testid":"enrichment-strategy-board",className:"space-y-4 rounded-xl border border-slate-200 bg-white p-6 shadow-sm",children:[Y("div",{children:[$("h2",{className:"font-bold text-lg text-slate-900",children:"\u30C9\u30E1\u30A4\u30F3\u5225 \u53D6\u308A\u8FBC\u307F\u6226\u7565"}),Y("p",{className:"text-slate-500 text-xs",children:["\u6BB5\u304C\u8D70\u308B\u306E\u306F\u3001\u30C6\u30CA\u30F3\u30C8\u306E\u6A5F\u80FD\u30D5\u30E9\u30B0\u3068\u3001\u3053\u306E\u30C9\u30E1\u30A4\u30F3\u306E\u6226\u7565\u306E",$("strong",{children:"\u53CC\u65B9"}),"\u304C\u958B\u3044\u3066\u3044\u308B\u3068\u304D\u3060\u3051\u3067\u3059\u3002\u8868\u306F ",t.length," \u30C9\u30E1\u30A4\u30F3 \xD7 ",qe.length," \u6BB5\u3002"]}),l&&$("p",{"data-testid":"strategy-read-only-note",className:"mt-1 text-slate-500 text-xs",children:"\u3053\u306E\u914D\u5099\u3067\u306F\u66F8\u304D\u8FBC\u307F\u7D4C\u8DEF\u304C\u7D50\u7DDA\u3055\u308C\u3066\u3044\u306A\u3044\u305F\u3081\u3001\u95B2\u89A7\u306E\u307F\u3067\u3059\u3002"})]}),t.length===0?$("p",{"data-testid":"strategy-empty-note",className:"text-slate-500 text-sm",children:"\u767B\u9332\u3055\u308C\u305F\u30C9\u30E1\u30A4\u30F3\u304C\u3042\u308A\u307E\u305B\u3093\u3002"}):$("div",{className:"overflow-x-auto",children:Y("table",{"data-testid":"strategy-grid","aria-label":"\u30C9\u30E1\u30A4\u30F3\u5225 \u53D6\u308A\u8FBC\u307F\u6226\u7565",className:"w-full border-collapse text-xs",children:[$("thead",{children:Y("tr",{children:[$("th",{scope:"col",className:"border-slate-200 border-b p-2 text-left font-semibold text-slate-600",children:"\u30C9\u30E1\u30A4\u30F3"}),qe.map(p=>{let x=Ze(p.featureFlagKey,r);return Y("th",{scope:"col",className:"border-slate-200 border-b p-2 text-center font-semibold text-slate-600",children:[$("div",{children:p.label}),$("div",{"data-testid":`strategy-gate-${p.key}`,"data-gate":x,className:"mt-0.5 font-normal text-[10px]",style:{color:Ye[x].color},children:Ye[x].label})]},p.key)})]})}),$("tbody",{children:t.map(p=>Y("tr",{"data-testid":`strategy-row-${p.domainKey}`,"data-provenance":p.provenance,"data-active":String(p.isActive),children:[Y("th",{scope:"row",className:"border-slate-100 border-b p-2 text-left font-normal",children:[$("div",{className:"font-semibold text-slate-900",children:p.domainLabel}),Y("div",{className:"text-[10px] text-slate-500",children:[$("code",{children:p.domainKey})," / ",p.strategyName]}),$("div",{"data-testid":`strategy-provenance-${p.domainKey}`,className:"text-[10px] text-slate-500",children:p.provenance==="system"?"\u914D\u5099\u306E\u65E2\u5B9A (SYSTEM) \u3092\u89E3\u6C7A\u4E2D \u2014 \u5909\u66F4\u3059\u308B\u3068\u3053\u306E\u30C6\u30CA\u30F3\u30C8\u5C02\u7528\u306E\u884C\u304C\u4F5C\u3089\u308C\u307E\u3059":"\u3053\u306E\u30C6\u30CA\u30F3\u30C8\u56FA\u6709\u306E\u884C"}),!p.isActive&&$("div",{"data-testid":`strategy-inactive-${p.domainKey}`,className:"text-[10px] text-amber-700",children:"\u6226\u7565\u304C\u7121\u52B9\u306E\u305F\u3081\u3001\u6BB5\u3092\u958B\u3044\u3066\u3082\u89E3\u6C7A\u3055\u308C\u307E\u305B\u3093"})]}),qe.map(x=>{let b=p.stages[x.key],I=Ze(x.featureFlagKey,r);return Y("td",{className:"border-slate-100 border-b p-2 text-center",children:[$("button",{type:"button",role:"switch","aria-checked":b,"aria-label":`${p.domainLabel} \u306E ${x.label}`,"data-testid":`strategy-stage-${p.domainKey}-${x.key}`,"data-enabled":String(b),"data-effective":String(b&&(I==="open"||I==="absent")),disabled:l||o,onClick:()=>c?.(p,x.key,!b),className:`rounded-full px-2.5 py-1 font-medium text-[11px] ${b?"bg-emerald-50 text-emerald-700":"bg-slate-100 text-slate-500"} ${l||o?"cursor-not-allowed opacity-60":"cursor-pointer"}`,children:b?"\u958B":"\u9589"}),b&&I==="unmeasured"&&$("div",{"data-testid":`strategy-unmeasured-${p.domainKey}-${x.key}`,className:"mt-0.5 text-[10px] text-slate-500",children:"\u30D5\u30E9\u30B0\u3092\u8AAD\u3081\u3066\u3044\u306A\u3044\u305F\u3081\u3001\u8D70\u308B\u304B\u3069\u3046\u304B\u5224\u308A\u307E\u305B\u3093"}),b&&I==="closed"&&$("div",{"data-testid":`strategy-blocked-${p.domainKey}-${x.key}`,className:"mt-0.5 text-[10px] text-amber-700",children:"\u30D5\u30E9\u30B0\u304C\u9589\u3058\u3066\u3044\u308B\u305F\u3081\u8D70\u308A\u307E\u305B\u3093"})]},x.key)})]},`${p.domainKey}:${p.strategyName}`))})]})})]})}import{Fragment as tt,jsx as S,jsxs as w}from"react/jsx-runtime";var Rt={engine:"\u30A8\u30F3\u30B8\u30F3",edition:"\u30A8\u30C7\u30A3\u30B7\u30E7\u30F3",fullVersion:"\u5B8C\u5168\u30D0\u30FC\u30B8\u30E7\u30F3",title:"\u540D\u79F0",collectionsCount:"\u30B3\u30EC\u30AF\u30B7\u30E7\u30F3",nodeCount:"\u30CE\u30FC\u30C9\u6570 (\u30C6\u30CA\u30F3\u30C8)",totalKeys:"\u30AD\u30FC\u7DCF\u6570",database:"DB",endpointsCount:"\u30A8\u30F3\u30C9\u30DD\u30A4\u30F3\u30C8",port:"\u30DD\u30FC\u30C8",restPort:"REST \u30DD\u30FC\u30C8",boltUri:"Bolt URI",tls:"TLS"},et=["engine","edition","fullVersion","title","collectionsCount","nodeCount","totalKeys","database","endpointsCount","port","restPort","boltUri","tls"],At=new Set(["collectionsCount","nodeCount","totalKeys","endpointsCount"]);function Lt(t,r){return r===null?"\u672A\u6E2C\u5B9A":typeof r=="boolean"?r?"\u6709\u52B9":"\u7121\u52B9":typeof r=="number"&&At.has(t)?`${r.toLocaleString()} \u4EF6`:String(r)}function Tt(t){let r=et.filter(o=>o in t),c=Object.keys(t).filter(o=>!et.includes(o)).sort();return[...r,...c].map(o=>({key:o,label:Rt[o]??o,text:Lt(o,t[o])}))}function ta({health:t,isRefreshing:r=!1,onRefresh:c,className:o=""}){let{services:l,allHealthy:p,checkedAt:x}=t,b=[{key:"qdrant",data:l.qdrant,title:"Qdrant",subtitle:"\u30D9\u30AF\u30C8\u30EB\u691C\u7D22\u30A8\u30F3\u30B8\u30F3 (Vector DB)"},{key:"neo4j",data:l.neo4j,title:"Neo4j",subtitle:"\u30CA\u30EC\u30C3\u30B8\u30B0\u30E9\u30D5 (Graph DB)"},{key:"redis",data:l.redis,title:"Redis",subtitle:"\u30AD\u30E3\u30C3\u30B7\u30E5 & Pub/Sub (Cache)"},{key:"sqlServer",data:l.sqlServer,title:"SQL Server",subtitle:"\u6B63\u6E96\u30C7\u30FC\u30BF\u30B9\u30C8\u30A2 (Single Source of Truth)"},{key:"quantsApi",data:l.quantsApi,title:"AI Quant API",subtitle:"Python \u30D0\u30C3\u30AF\u30A8\u30F3\u30C9\u63A8\u8AD6\u30A8\u30F3\u30B8\u30F3"}];return w("section",{className:`rounded-lg border bg-card p-5 text-card-foreground shadow-sm ${o}`,"data-testid":"infrastructure-health-monitor","data-healthy":String(p),children:[w("div",{className:"flex flex-wrap items-center justify-between gap-4 border-b pb-4",children:[w("div",{className:"flex items-center gap-3",children:[S("div",{className:"flex h-10 w-10 items-center justify-center rounded-lg bg-primary/10 text-primary",children:w("svg",{className:"h-5 w-5",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",children:[S("rect",{width:"20",height:"8",x:"2",y:"2",rx:"2",ry:"2"}),S("rect",{width:"20",height:"8",x:"2",y:"14",rx:"2",ry:"2"}),S("line",{x1:"6",x2:"6.01",y1:"6",y2:"6"}),S("line",{x1:"6",x2:"6.01",y1:"18",y2:"18"})]})}),w("div",{children:[S("h2",{className:"font-semibold text-lg",children:"\u5468\u8FBA\u6A5F\u80FD\u63A5\u7D9A\u72B6\u614B & \u30D0\u30FC\u30B8\u30E7\u30F3"}),w("p",{className:"text-muted-foreground text-xs",children:["\u6700\u7D42\u78BA\u8A8D: ",new Date(x).toLocaleTimeString("ja-JP")," | \u5168 5 \u7CFB\u7D71\u306E\u57FA\u76E4\u30B5\u30FC\u30D3\u30B9\u30EA\u30A2\u30EB\u30BF\u30A4\u30E0\u6B7B\u6D3B\u76E3\u8996"]})]})]}),w("div",{className:"flex items-center gap-3",children:[S("span",{className:`inline-flex items-center gap-1.5 rounded-full px-3 py-1 font-medium text-xs ${p?"bg-emerald-500/15 text-emerald-600 dark:text-emerald-400":"bg-destructive/15 text-destructive"}`,"data-testid":"health-overall-status-badge",children:p?w(tt,{children:[w("svg",{className:"h-3.5 w-3.5",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",children:[S("path",{d:"M22 11.08V12a10 10 0 1 1-5.93-9.14"}),S("polyline",{points:"22 4 12 14.01 9 11.01"})]}),S("span",{children:"\u5168\u30B5\u30FC\u30D3\u30B9\u6B63\u5E38\u63A5\u7D9A"})]}):w(tt,{children:[w("svg",{className:"h-3.5 w-3.5",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",children:[S("circle",{cx:"12",cy:"12",r:"10"}),S("line",{x1:"12",x2:"12",y1:"8",y2:"12"}),S("line",{x1:"12",x2:"12.01",y1:"16",y2:"16"})]}),S("span",{children:"\u4E00\u90E8\u30B5\u30FC\u30D3\u30B9\u63A5\u7D9A\u30A8\u30E9\u30FC"})]})}),c&&w("button",{type:"button",onClick:c,disabled:r,"data-testid":"health-refresh-button",className:"inline-flex items-center gap-1.5 rounded-md border bg-background px-3 py-1.5 font-medium text-xs shadow-sm hover:bg-muted focus:outline-none focus:ring-2 focus:ring-ring disabled:opacity-50",children:[w("svg",{className:`h-3.5 w-3.5 ${r?"animate-spin":""}`,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",children:[S("path",{d:"M21 12a9 9 0 0 0-9-9 9.75 9.75 0 0 0-6.74 2.74L3 8"}),S("path",{d:"M3 3v5h5"}),S("path",{d:"M3 12a9 9 0 0 0 9 9 9.75 9.75 0 0 0 6.74-2.74L21 16"}),S("path",{d:"M16 21h5v-5"})]}),S("span",{children:"\u518D\u78BA\u8A8D"})]})]})]}),S("div",{className:"mt-4 grid grid-cols-1 gap-4 sm:grid-cols-2 lg:grid-cols-5",children:b.map(({key:I,data:E,title:k,subtitle:g})=>{let u=E.status==="connected";return w("div",{"data-testid":`service-card-${I}`,className:`flex flex-col justify-between rounded-md border p-3.5 transition-colors ${u?"border-border bg-card/60 hover:bg-muted/40":"border-destructive/40 bg-destructive/5"}`,children:[w("div",{children:[w("div",{className:"flex items-center justify-between",children:[S("span",{className:"font-semibold text-sm",children:k}),w("span",{className:`inline-flex items-center gap-1 rounded-sm px-1.5 py-0.5 font-medium text-[11px] ${u?"bg-emerald-500/15 text-emerald-600 dark:text-emerald-400":"bg-destructive/15 text-destructive"}`,"data-testid":`service-status-${I}`,children:[S("span",{className:`h-1.5 w-1.5 rounded-full ${u?"animate-pulse bg-emerald-500":"bg-destructive"}`}),u?"Connected":"Error"]})]}),S("p",{className:"mt-1 text-[11px] text-muted-foreground",children:g}),w("div",{className:"mt-3 space-y-1.5 border-t pt-2 text-xs",children:[w("div",{className:"flex items-center justify-between",children:[S("span",{className:"text-muted-foreground",children:"\u30D0\u30FC\u30B8\u30E7\u30F3:"}),S("code",{className:"font-mono font-semibold text-[11px]","data-testid":`service-version-${I}`,children:E.version??"N/A"})]}),w("div",{className:"flex items-center justify-between",children:[S("span",{className:"text-muted-foreground",children:"\u5FDC\u7B54\u6642\u9593:"}),w("span",{className:"font-mono text-[11px] text-muted-foreground",children:[E.latencyMs," ms"]})]}),Tt(E.details).map(y=>w("div",{className:"flex items-center justify-between",children:[w("span",{className:"text-muted-foreground",children:[y.label,":"]}),S("span",{className:"font-medium text-[11px]","data-testid":`health-detail-${I}-${y.key}`,children:y.text})]},y.key))]})]}),w("div",{className:"mt-3 truncate border-t pt-1.5 text-[10px] text-muted-foreground",children:[S("span",{className:"font-mono",children:E.endpoint}),E.errorMessage&&S("p",{className:"mt-0.5 line-clamp-2 text-destructive",children:E.errorMessage})]})]},I)})})]})}import{MODE_TIERS as Dt,SEARCH_MODES as $t,SEARCH_PARAM_LIMITS as at}from"@aiquants/enrichment-core";import{useEffect as st,useId as Z,useRef as nt,useState as L}from"react";import{Fragment as ot,jsx as n,jsxs as i}from"react/jsx-runtime";var it={KEYWORD:{label:"SQL",description:"SQL Server \u306E\u8A9E\u53E5\u4E00\u81F4\u306E\u307F\u3067\u691C\u7D22\u3057\u307E\u3059\u3002\u30D9\u30AF\u30C8\u30EB\u3082\u30B0\u30E9\u30D5\u3082\u547C\u3070\u306A\u3044\u30D5\u30A9\u30FC\u30EB\u30D0\u30C3\u30AF\u7D4C\u8DEF\u3067\u3059\u3002"},SPARSE:{label:"\u758E\u30D9\u30AF\u30C8\u30EB",description:"BM25 \u306E\u8A9E\u5F59\u30D9\u30AF\u30C8\u30EB\u3067\u691C\u7D22\u3057\u307E\u3059\u3002\u56FA\u6709\u540D\u8A5E\u3084\u578B\u756A\u306A\u3069\u306E\u5B8C\u5168\u4E00\u81F4\u306B\u5F37\u3044\u7D4C\u8DEF\u3067\u3059\u3002"},DENSE:{label:"\u5BC6\u30D9\u30AF\u30C8\u30EB",description:"\u57CB\u3081\u8FBC\u307F\u30E2\u30C7\u30EB\u306E\u610F\u5473\u30D9\u30AF\u30C8\u30EB\u3067\u691C\u7D22\u3057\u307E\u3059\u3002\u8A00\u3044\u63DB\u3048\u3084\u6587\u610F\u306E\u8FD1\u3055\u3092\u62FE\u3046\u7D4C\u8DEF\u3067\u3059\u3002"},HYBRID:{label:"\u30CF\u30A4\u30D6\u30EA\u30C3\u30C9",description:"\u758E\u30FB\u5BC6\u30FB\u30B0\u30E9\u30D5\u30FB\u8A9E\u53E5\u4E00\u81F4\u3092\u9806\u4F4D\u878D\u5408\u3057\u307E\u3059\u3002\u65E2\u5B9A\u306E\u691C\u7D22\u7D4C\u8DEF\u3067\u3059\u3002"},GRAPH_TRAVERSE:{label:"\u30CA\u30EC\u30C3\u30B8\u30B0\u30E9\u30D5",description:"\u30CA\u30EC\u30C3\u30B8\u30B0\u30E9\u30D5\u306E\u95A2\u4FC2\u3092\u305F\u3069\u3063\u3066\u691C\u7D22\u3057\u307E\u3059\u3002\u6587\u66F8\u9593\u306E\u3064\u306A\u304C\u308A\u3092\u4E3B\u8EF8\u306B\u3059\u308B\u7D4C\u8DEF\u3067\u3059\u3002"}},Te="\u672A\u5B9F\u884C",Pt=2e3;function Mt(t){return t.fusion?t.fusion==="rrf"?`RRF (k=${t.rrf_k??"\u65E2\u5B9A"})`:`LINEAR (alpha=${t.alpha??"\u65E2\u5B9A"})`:"\u878D\u5408\u306A\u3057 (\u5358\u4E00\u9806\u4F4D\u30E2\u30FC\u30C9)"}var Ge={cosine:{label:"\u5BC6\u30D9\u30AF\u30C8\u30EB",format:t=>`${(t*100).toFixed(1)}%`,title:"\u30B3\u30B5\u30A4\u30F3\u985E\u4F3C\u5EA6 (0\u301C1)"},bm25:{label:"\u758E\u30D9\u30AF\u30C8\u30EB",format:t=>t.toFixed(3),title:"BM25 \u30B9\u30B3\u30A2 (\u4E0A\u9650\u306A\u3057\u3002\u5272\u5408\u3067\u306F\u306A\u3044)"},mixed:{label:"\u30D9\u30AF\u30C8\u30EB",format:t=>t.toFixed(3),title:"\u5BC6\u3068\u758E\u306E\u53CC\u65B9\u304C\u8D70\u3063\u305F\u305F\u3081\u3001\u3053\u306E\u5024\u304C\u3069\u3061\u3089\u306E\u91CF\u304B\u5B9A\u307E\u3089\u306A\u3044"}},Ft=[{id:"balanced-hybrid",title:"\u63A8\u5968\u30CF\u30A4\u30D6\u30EA\u30C3\u30C9 (Balanced Hybrid)",description:"RRF \u878D\u5408 (k=60) \u306B\u3088\u308B\u8A9E\u5F59\u3068\u30BB\u30DE\u30F3\u30C6\u30A3\u30C3\u30AF\u306E\u8ABF\u548C\u30D0\u30E9\u30F3\u30B9\u63A2\u7D22",params:{mode:"HYBRID",limit:20,fusion:"rrf",rrf_k:60}},{id:"high-precision-vector",title:"\u9AD8\u7CBE\u5EA6\u30D9\u30AF\u30C8\u30EB (Dense Dominant)",description:"\u30B3\u30B5\u30A4\u30F3\u985E\u4F3C\u5EA6 0.75 \u4EE5\u4E0A\u306E\u5BC6\u30D9\u30AF\u30C8\u30EB\u63A2\u7D22\u306B\u3088\u308B\u9AD8\u9069\u5408\u7387\u30BB\u30DE\u30F3\u30C6\u30A3\u30C3\u30AF\u691C\u7D22",params:{mode:"DENSE",limit:10,threshold:.75}},{id:"strict-lexical",title:"\u53B3\u683C\u30AD\u30FC\u30EF\u30FC\u30C9 (Strict Lexical)",description:"\u30CF\u30EB\u30B7\u30CD\u30FC\u30B7\u30E7\u30F3\u3092\u6392\u9664\u3059\u308B SQL SoT / \u8A9E\u5F59\u30A4\u30F3\u30C7\u30C3\u30AF\u30B9\u76F4\u63A5\u691C\u7D22",params:{mode:"KEYWORD",limit:20}},{id:"lexical-sparse",title:"\u8A9E\u5F59\u30D9\u30AF\u30C8\u30EB (Sparse BM25)",description:"BM25 \u306E\u8A9E\u5F59\u30D9\u30AF\u30C8\u30EB\u3067\u56FA\u6709\u540D\u8A5E\u3084\u578B\u756A\u306E\u5B8C\u5168\u4E00\u81F4\u3092\u72D9\u3046\u691C\u7D22",params:{mode:"SPARSE",limit:20}},{id:"graph-reasoning",title:"\u30B0\u30E9\u30D5\u6DF1\u6398\u308A\u63A8\u8AD6 (Graph Deep Reasoning)",description:"\u30CA\u30EC\u30C3\u30B8\u30B0\u30E9\u30D5\u306E\u95A2\u4FC2\u9806\u4F4D\u3092\u4E3B\u8EF8\u306B\u636E\u3048\u305F\u63A8\u8AD6\u691C\u7D22",params:{mode:"GRAPH_TRAVERSE",limit:30}}];function rt(t){return t===void 0||Number.isNaN(t)?"N/A":`${(t*100).toFixed(1)}%`}function Ot(t,r){let c=r.trim();if(!(c&&t))return t;let o=c.replace(/[.*+?^${}()|[\]\\]/g,"\\$&"),l=new RegExp(`(${o})`,"gi");return t.split(l).map((b,I)=>({id:`chunk-${I}-${b.slice(0,8)}`,part:b,isMatch:b.toLowerCase()===c.toLowerCase()})).map(b=>b.isMatch?n("mark",{"data-testid":"highlighted-keyword",className:"rounded-sm bg-amber-200 px-1 py-0.5 font-semibold text-amber-950",children:b.part},b.id):b.part)}function je(t){return t==="OPEN"?"bg-red-100 font-bold text-red-800":t==="HALF_OPEN"?"bg-amber-100 font-bold text-amber-800":"bg-slate-200 text-slate-500"}function He(t){return t==="OPEN"?"OPEN":t==="HALF_OPEN"?"HALF":"-"}function oa({tenantId:t,onSearch:r,initialParams:c,initialResult:o=null,circuitBreakerStatus:l={},isLoading:p=!1}){let x=Z(),b=Z(),I=Z(),E=Z(),k=Z(),g=Z(),u=Z(),y=Z(),P=Z(),H=Z(),[B,O]=L(c?.q??""),[z,pe]=L(c?.mode??"HYBRID"),[W,Q]=L(c?.limit??20),[K,V]=L(c?.threshold??.5),[ee,me]=L(c?.fusion??"rrf"),[xe,ue]=L(c?.rrf_k??60),[be,ge]=L(c?.alpha??.7),[ve,se]=L(c?.confidentiality_level??"ALL"),[re,ke]=L(c?.department_id?String(c.department_id):""),[ye,_e]=L(c?.mime_type??""),[Ie,oe]=L(c?.tag??""),de=nt(0),[le,Pe]=L(!1),[q,G]=L(!1),[ne,he]=L("request"),[Me,Ce]=L(null),[we,Fe]=L(new Set),[Oe,Re]=L(!1),[C,Be]=L(o),[a,m]=L(null),[A,J]=L(null),Ae=p||Oe,fe=Dt[z],ce=[fe.dense,fe.sparse,fe.graph,fe.lexical].filter(Boolean).length>1,Ke=fe.dense&&!fe.sparse,te=C?.search_metadata.circuit_breaker_status??l,M=C?.search_metadata.executed_tiers??{sql:!1,dense:!1,sparse:!1,graph:!1},Ue=A??{};st(()=>{if(!q)return;let e=f=>{f.key==="Escape"&&G(!1)};return window.addEventListener("keydown",e),()=>window.removeEventListener("keydown",e)},[q]);let ut=e=>{e.params.mode!==void 0&&pe(e.params.mode),e.params.limit!==void 0&&Q(e.params.limit),e.params.threshold!==void 0&&V(e.params.threshold),e.params.fusion!==void 0&&me(e.params.fusion),e.params.rrf_k!==void 0&&ue(e.params.rrf_k),e.params.alpha!==void 0&&ge(e.params.alpha)},gt=async e=>{let f=new URL("/api/storage/search",window.location.origin);f.searchParams.set("q",e.q),f.searchParams.set("limit",String(e.limit)),f.searchParams.set("mode",e.mode),e.threshold!==void 0&&f.searchParams.set("threshold",String(e.threshold)),e.fusion!==void 0&&f.searchParams.set("fusion",e.fusion),e.rrf_k!==void 0&&f.searchParams.set("rrf_k",String(e.rrf_k)),e.alpha!==void 0&&f.searchParams.set("alpha",String(e.alpha)),e.department_id!==void 0&&f.searchParams.set("department_id",String(e.department_id)),e.confidentiality_level!==void 0&&f.searchParams.set("confidentiality_level",e.confidentiality_level),e.mime_type!==void 0&&f.searchParams.set("mime_type",e.mime_type),e.tag!==void 0&&f.searchParams.set("tag",e.tag);let R=await fetch(f.toString(),{method:"GET",headers:{Accept:"application/json"}});if(!(R.headers.get("content-type")??"").includes("application/json"))throw new Error("\u30BB\u30C3\u30B7\u30E7\u30F3\u306E\u6709\u52B9\u671F\u9650\u304C\u5207\u308C\u3066\u3044\u308B\u53EF\u80FD\u6027\u304C\u3042\u308A\u307E\u3059\u3002\u518D\u5EA6\u30B5\u30A4\u30F3\u30A4\u30F3\u3057\u3066\u304F\u3060\u3055\u3044\u3002");if(!R.ok){let X=await R.json().catch(()=>({}));throw new Error(X.error??`\u691C\u7D22\u30A8\u30E9\u30FC: HTTP ${R.status}`)}return await R.json()},ft=async()=>{if(Ae)return;let e=re.trim()?Number.parseInt(re.trim(),10):void 0,f={q:B.trim(),mode:z,limit:W,threshold:Ke?K:void 0,fusion:ce?ee:void 0,rrf_k:ce&&ee==="rrf"?xe:void 0,alpha:ce&&ee==="linear"?be:void 0,department_id:Number.isNaN(e)?void 0:e,confidentiality_level:ve==="ALL"?void 0:ve,mime_type:ye.trim()||void 0,tag:Ie.trim()||void 0},R=de.current+1;de.current=R,m(null),Re(!0);try{let ae=r?await r(f):await gt(f);if(R!==de.current)return;Be(ae),J(f)}catch(ae){if(R!==de.current)return;m(ae instanceof Error?ae.message:"\u691C\u7D22\u51E6\u7406\u4E2D\u306B\u4E88\u671F\u305B\u306C\u30A8\u30E9\u30FC\u304C\u767A\u751F\u3057\u307E\u3057\u305F\u3002")}finally{R===de.current&&Re(!1)}},Ne=nt(void 0);st(()=>()=>{Ne.current!==void 0&&clearTimeout(Ne.current)},[]);let xt=async(e,f)=>{try{await navigator.clipboard.writeText(e),Ce(f),Ne.current!==void 0&&clearTimeout(Ne.current),Ne.current=setTimeout(()=>Ce(null),Pt)}catch{}},bt=e=>{Fe(f=>{let R=new Set(f);return R.has(e)?R.delete(e):R.add(e),R})};return i("div",{"data-testid":"metadata-search-workbench","data-mode":z,"data-loading":String(Ae),className:"space-y-6",children:[i("div",{className:"rounded-xl border border-slate-200 bg-white p-6 shadow-sm",children:[i("div",{className:"flex flex-col gap-4 lg:flex-row lg:items-center lg:justify-between",children:[i("div",{children:[i("div",{className:"flex items-center gap-2",children:[n("h2",{className:"font-bold text-slate-900 text-xl tracking-tight",children:"\u30E1\u30BF\u30C7\u30FC\u30BF\u691C\u7D22\u30EF\u30FC\u30AF\u30D9\u30F3\u30C1"}),i("span",{"data-testid":"workbench-tenant-badge",className:"rounded-full bg-indigo-50 px-2.5 py-0.5 font-semibold text-indigo-700 text-xs",children:["\u30C6\u30CA\u30F3\u30C8: ",t]})]}),n("p",{className:"mt-1 text-slate-500 text-sm",children:"\u30AD\u30FC\u30EF\u30FC\u30C9\u30FB\u5BC6\u30D9\u30AF\u30C8\u30EB\u30FB\u30CA\u30EC\u30C3\u30B8\u30B0\u30E9\u30D5\u306E\u30DE\u30EB\u30C1\u30EC\u30A4\u30E4\u30FC\u691C\u7D22\u30D1\u30E9\u30E1\u30FC\u30BF\u3092\u5FAE\u8ABF\u6574\u3057\u3001\u30EA\u30A2\u30EB\u30BF\u30A4\u30E0\u306B\u53D6\u5F97\u7CBE\u5EA6\u3068\u63A8\u8AD6\u7D50\u679C\u3092\u691C\u8A3C\u3057\u307E\u3059\u3002"})]}),n("div",{className:"flex items-center gap-2",children:i("button",{type:"button","data-testid":"toggle-inspector-button","aria-expanded":q,"aria-controls":H,onClick:()=>G(e=>!e),className:"inline-flex items-center gap-2 rounded-lg border border-slate-300 bg-slate-50 px-3.5 py-2 font-medium text-slate-700 text-sm shadow-sm transition-colors hover:bg-slate-100",children:[n("span",{className:"font-mono text-xs",children:"{ }"}),n("span",{children:q?"\u30A4\u30F3\u30B9\u30DA\u30AF\u30BF\u3092\u9589\u3058\u308B":"\u958B\u767A\u8005\u30A4\u30F3\u30B9\u30DA\u30AF\u30BF"})]})})]}),i("div",{className:"mt-5 border-slate-100 border-t pt-4",children:[n("span",{className:"font-medium text-slate-600 text-xs",children:"\u958B\u767A\u8005\u30D7\u30EA\u30BB\u30C3\u30C8:"}),n("div",{className:"mt-2 flex flex-wrap gap-2",children:Ft.map(e=>n("button",{type:"button","data-testid":`preset-button-${e.id}`,onClick:()=>ut(e),className:"inline-flex items-center rounded-lg border border-slate-200 bg-slate-50 px-3 py-1.5 text-left text-xs transition-colors hover:border-indigo-300 hover:bg-indigo-50/50",children:i("div",{children:[n("span",{className:"font-semibold text-slate-800",children:e.title}),i("span",{className:"ml-1.5 hidden text-slate-500 xl:inline",children:["(",e.description,")"]})]})},e.id))})]})]}),n("div",{className:"rounded-xl border border-slate-200 bg-white p-6 shadow-sm",children:i("form",{onSubmit:e=>{e.preventDefault(),ft()},className:"space-y-5",children:[i("div",{className:"flex flex-col gap-3 sm:flex-row sm:items-center",children:[i("div",{className:"relative flex-1",children:[n("label",{htmlFor:x,className:"sr-only",children:"\u691C\u7D22\u30AF\u30A8\u30EA"}),n("input",{id:x,type:"text","data-testid":"search-query-input",value:B,onChange:e=>O(e.target.value),placeholder:"\u691C\u7D22\u30AF\u30A8\u30EA\u3092\u5165\u529B (\u4F8B: \u300C\u56DB\u534A\u671F \u6C7A\u7B97\u5831\u544A\u66F8\u300D\u300C\u696D\u52D9\u65E5\u5831 \u539F\u4FA1\u6309\u5206\u300D)...",className:"w-full rounded-lg border border-slate-300 bg-white px-4 py-2.5 text-slate-900 text-sm shadow-sm transition-colors placeholder:text-slate-400 focus:border-indigo-500 focus:outline-none focus:ring-2 focus:ring-indigo-500/20"}),B&&n("button",{type:"button","data-testid":"clear-query-button",onClick:()=>O(""),className:"absolute inset-y-0 right-0 flex items-center pr-3 text-slate-400 hover:text-slate-600",children:"\u2715"})]}),n("div",{className:"flex items-center gap-1 rounded-lg border border-slate-200 bg-slate-100 p-1",children:$t.map(e=>{let f=z===e;return n("button",{type:"button","aria-pressed":f,title:it[e].description,"data-testid":`search-mode-${e}`,"data-active":String(f),onClick:()=>pe(e),className:`rounded-md px-3 py-1.5 font-medium text-xs transition-all ${f?"bg-white text-indigo-700 shadow-sm":"text-slate-600 hover:text-slate-900"}`,children:it[e].label},e)})}),n("button",{type:"submit","data-testid":"execute-search-button",disabled:Ae,className:"inline-flex items-center justify-center rounded-lg bg-indigo-600 px-5 py-2.5 font-semibold text-sm text-white shadow-sm transition-colors hover:bg-indigo-700 disabled:opacity-50",children:Ae?"\u691C\u7D22\u4E2D...":"\u691C\u7D22\u5B9F\u884C"})]}),i("div",{className:"grid grid-cols-1 gap-4 rounded-lg bg-slate-50 p-4 sm:grid-cols-2 lg:grid-cols-4",children:[i("div",{className:"space-y-1.5",children:[i("div",{className:"flex items-center justify-between",children:[n("label",{htmlFor:b,className:"font-medium text-slate-700 text-xs",children:"\u53D6\u5F97\u4EF6\u6570 (Top-K):"}),n("span",{"data-testid":"limit-display",className:"font-mono font-semibold text-indigo-600 text-xs",children:W})]}),n("input",{id:b,type:"range","data-testid":"limit-slider",min:at.limit.min,max:at.limit.max,step:1,value:W,onChange:e=>Q(Number(e.target.value)),className:"h-1.5 w-full cursor-pointer appearance-none rounded-lg bg-slate-200 accent-indigo-600"})]}),i("div",{className:"space-y-1.5",children:[i("div",{className:"flex items-center justify-between",children:[n("label",{htmlFor:I,className:"font-medium text-slate-700 text-xs",title:Ke?"\u30B3\u30B5\u30A4\u30F3\u985E\u4F3C\u5EA6\u306E\u4E0B\u9650\u3067\u3059\u3002":"\u3053\u306E\u6226\u7565\u306E\u30B9\u30B3\u30A2\u306F\u30B3\u30B5\u30A4\u30F3\u985E\u4F3C\u5EA6\u3067\u306F\u306A\u3044\u305F\u3081\u9069\u7528\u3057\u307E\u305B\u3093\u3002",children:"\u985E\u4F3C\u5EA6\u95BE\u5024 (Threshold):"}),n("span",{"data-testid":"threshold-display",className:"font-mono font-semibold text-indigo-600 text-xs",children:K.toFixed(2)})]}),n("input",{id:I,type:"range","data-testid":"threshold-slider",min:0,max:1,step:.01,value:K,disabled:!Ke,onChange:e=>V(Number(e.target.value)),className:"h-1.5 w-full cursor-pointer appearance-none rounded-lg bg-slate-200 accent-indigo-600 disabled:opacity-40"})]}),i("div",{className:"space-y-1.5",children:[i("div",{className:"flex items-center justify-between",children:[n("span",{className:"font-medium text-slate-700 text-xs",children:"\u878D\u5408\u30A2\u30EB\u30B4\u30EA\u30BA\u30E0:"}),n("span",{className:"font-mono font-semibold text-indigo-600 text-xs",children:ee.toUpperCase()})]}),i("div",{className:"flex items-center gap-1",children:[n("button",{type:"button","data-testid":"fusion-strategy-rrf",onClick:()=>me("rrf"),disabled:!ce,className:`flex-1 rounded-sm border py-1 font-medium text-xs ${ee==="rrf"?"border-indigo-300 bg-indigo-50 font-bold text-indigo-700":"border-slate-200 bg-white text-slate-600 hover:bg-slate-50"} disabled:opacity-40`,children:"RRF"}),n("button",{type:"button","data-testid":"fusion-strategy-linear",onClick:()=>me("linear"),disabled:!ce,className:`flex-1 rounded-sm border py-1 font-medium text-xs ${ee==="linear"?"border-indigo-300 bg-indigo-50 font-bold text-indigo-700":"border-slate-200 bg-white text-slate-600 hover:bg-slate-50"} disabled:opacity-40`,children:"\u7DDA\u5F62\u7D50\u5408 (Alpha)"})]})]}),n("div",{className:"space-y-1.5",children:ee==="rrf"?i(ot,{children:[i("div",{className:"flex items-center justify-between",children:[n("label",{htmlFor:E,className:"font-medium text-slate-700 text-xs",children:"RRF \u5B9A\u6570 (k):"}),n("span",{"data-testid":"rrf-k-display",className:"font-mono font-semibold text-indigo-600 text-xs",children:xe})]}),n("input",{id:E,type:"range","data-testid":"rrf-k-slider",min:10,max:120,step:5,value:xe,disabled:!ce,onChange:e=>ue(Number(e.target.value)),className:"h-1.5 w-full cursor-pointer appearance-none rounded-lg bg-slate-200 accent-indigo-600 disabled:opacity-40"})]}):i(ot,{children:[i("div",{className:"flex items-center justify-between",children:[n("label",{htmlFor:k,className:"font-medium text-slate-700 text-xs",children:"\u30D9\u30AF\u30C8\u30EB\u91CD\u307F (Alpha):"}),n("span",{"data-testid":"alpha-display",className:"font-mono font-semibold text-indigo-600 text-xs",children:be.toFixed(2)})]}),n("input",{id:k,type:"range","data-testid":"alpha-slider",min:0,max:1,step:.05,value:be,disabled:!ce,onChange:e=>ge(Number(e.target.value)),className:"h-1.5 w-full cursor-pointer appearance-none rounded-lg bg-slate-200 accent-indigo-600 disabled:opacity-40"})]})})]}),i("div",{children:[i("button",{type:"button","data-testid":"toggle-advanced-filters",onClick:()=>Pe(e=>!e),className:"inline-flex items-center gap-1.5 font-medium text-indigo-600 text-xs hover:text-indigo-800",children:[n("span",{children:le?"\u25BC":"\u25B6"}),i("span",{children:["\u8A73\u7D30\u30E1\u30BF\u30C7\u30FC\u30BF & \u30B0\u30E9\u30D5\u30D5\u30A3\u30EB\u30BF ",le?"\u3092\u9589\u3058\u308B":"\u3092\u5C55\u958B"]})]}),le&&i("div",{"data-testid":"advanced-filters-panel",className:"mt-3 grid grid-cols-1 gap-4 rounded-lg border border-slate-200 bg-white p-4 sm:grid-cols-2 lg:grid-cols-4",children:[i("div",{className:"space-y-1",children:[n("label",{htmlFor:u,className:"font-medium text-slate-700 text-xs",children:"\u6A5F\u5BC6\u533A\u5206 (Confidentiality):"}),i("select",{id:u,"data-testid":"filter-confidentiality",value:ve,onChange:e=>se(e.target.value),className:"w-full rounded-sm border border-slate-300 bg-white px-2.5 py-1.5 text-slate-800 text-xs focus:border-indigo-500",children:[n("option",{value:"ALL",children:"\u5168\u6A5F\u5BC6\u533A\u5206 (ALL)"}),n("option",{value:"PUBLIC",children:"\u516C\u958B (PUBLIC)"}),n("option",{value:"INTERNAL",children:"\u793E\u5185\u9650\u5B9A (INTERNAL)"}),n("option",{value:"DEPARTMENT",children:"\u90E8\u9580\u9650\u5B9A (DEPARTMENT)"}),n("option",{value:"CONFIDENTIAL",children:"\u6A5F\u5BC6 (CONFIDENTIAL)"})]})]}),i("div",{className:"space-y-1",children:[n("label",{htmlFor:g,className:"font-medium text-slate-700 text-xs",children:"\u90E8\u9580 ID (Department ID):"}),n("input",{id:g,type:"number","data-testid":"filter-department-id",value:re,onChange:e=>ke(e.target.value),placeholder:"\u4F8B: 101",className:"w-full rounded-sm border border-slate-300 bg-white px-2.5 py-1.5 text-slate-800 text-xs focus:border-indigo-500"})]}),i("div",{className:"space-y-1",children:[n("label",{htmlFor:y,className:"font-medium text-slate-700 text-xs",children:"MIME \u30BF\u30A4\u30D7 (MIME Type):"}),n("input",{id:y,type:"text","data-testid":"filter-mime-type",value:ye,onChange:e=>_e(e.target.value),placeholder:"application/pdf, image/...",className:"w-full rounded-sm border border-slate-300 bg-white px-2.5 py-1.5 text-slate-800 text-xs focus:border-indigo-500"})]}),i("div",{className:"space-y-1",children:[n("label",{htmlFor:P,className:"font-medium text-slate-700 text-xs",children:"\u30BF\u30B0 (Tag):"}),n("input",{id:P,type:"text","data-testid":"filter-tag",value:Ie,onChange:e=>oe(e.target.value),placeholder:"\u4F8B: \u6C7A\u7B97, \u5951\u7D04\u66F8...",className:"w-full rounded-sm border border-slate-300 bg-white px-2.5 py-1.5 text-slate-800 text-xs focus:border-indigo-500"})]})]})]})]})}),a&&n("div",{role:"alert","data-testid":"search-error-alert",className:"rounded-xl border border-red-200 bg-red-50 p-4 font-medium text-red-700 text-sm shadow-sm",children:a}),C?.search_metadata&&n(We,{metadata:C.search_metadata}),C&&i("div",{"data-testid":"search-summary-bar",className:"flex flex-wrap items-center justify-between gap-3 rounded-lg border border-slate-200 bg-slate-50 px-4 py-3 text-xs",children:[i("div",{className:"flex items-center gap-4",children:[i("span",{"data-testid":"result-count",className:"font-semibold text-slate-800",children:["\u30D2\u30C3\u30C8\u4EF6\u6570: ",n("span",{className:"font-bold text-indigo-600",children:C.count})," \u4EF6"]}),C.search_metadata.execution_time_ms!==void 0&&i("span",{"data-testid":"latency-metric",className:"text-slate-500",children:["\u5B9F\u884C\u30EC\u30A4\u30C6\u30F3\u30B7: ",i("span",{className:"font-mono font-semibold text-slate-700",children:[C.search_metadata.execution_time_ms," ms"]})]}),i("span",{"data-testid":"quality-tier-badge",className:"rounded-full bg-slate-200 px-2 py-0.5 font-medium font-mono text-slate-800",children:["Tier: ",C.search_metadata.quality_tier]})]}),i("div",{className:"flex items-center gap-2",children:[n("span",{className:"text-slate-500",children:"\u30EC\u30A4\u30E4\u30FC\u72B6\u614B:"}),i("span",{"data-testid":"tier-badge-sql","data-active":String(M.sql),className:`rounded-sm px-1.5 py-0.5 font-mono text-[11px] ${M.sql?"bg-emerald-100 font-semibold text-emerald-800":"bg-slate-200 text-slate-500"}`,children:["SQL ",M.sql?"\u2713":"-"]}),i("span",{"data-testid":"tier-badge-sparse","data-active":String(M.sparse),"data-breaker":te.vector??"CLOSED",className:`rounded-sm px-1.5 py-0.5 font-mono text-[11px] ${M.sparse?"bg-emerald-100 font-semibold text-emerald-800":je(te.vector)}`,children:["\u758E\u30D9\u30AF\u30C8\u30EB ",M.sparse?"\u2713":He(te.vector)]}),i("span",{"data-testid":"tier-badge-dense","data-active":String(M.dense),"data-breaker":te.vector??"CLOSED",className:`rounded-sm px-1.5 py-0.5 font-mono text-[11px] ${M.dense?"bg-emerald-100 font-semibold text-emerald-800":je(te.vector)}`,children:["\u5BC6\u30D9\u30AF\u30C8\u30EB ",M.dense?"\u2713":He(te.vector)]}),i("span",{"data-testid":"tier-badge-graph","data-active":String(M.graph),"data-breaker":te.graph??"CLOSED",className:`rounded-sm px-1.5 py-0.5 font-mono text-[11px] ${M.graph?"bg-emerald-100 font-semibold text-emerald-800":je(te.graph)}`,children:["\u30B0\u30E9\u30D5 ",M.graph?"\u2713":He(te.graph)]})]})]}),i("div",{"data-testid":"search-results-container",className:"space-y-4",children:[C&&C.hits.length===0&&i("div",{"data-testid":"empty-search-state",className:"rounded-xl border border-slate-200 bg-white p-12 text-center",children:[n("p",{className:"font-semibold text-base text-slate-700",children:"\u691C\u7D22\u6761\u4EF6\u306B\u4E00\u81F4\u3059\u308B\u30E1\u30BF\u30C7\u30FC\u30BF\u306F\u898B\u3064\u304B\u308A\u307E\u305B\u3093\u3067\u3057\u305F"}),n("p",{className:"mt-1 text-slate-500 text-sm",children:"\u691C\u7D22\u30AD\u30FC\u30EF\u30FC\u30C9\u3092\u7C21\u6F54\u306B\u3059\u308B\u304B\u3001\u985E\u4F3C\u5EA6\u95BE\u5024\u3092\u4E0B\u3052\u308B\uFF08\u4F8B: 0.30\uFF09\u3001\u307E\u305F\u306F\u300C\u63A8\u5968\u30CF\u30A4\u30D6\u30EA\u30C3\u30C9\u300D\u30D7\u30EA\u30BB\u30C3\u30C8\u3092\u304A\u8A66\u3057\u304F\u3060\u3055\u3044\u3002"})]}),C?.hits.map((e,f)=>{let R=we.has(e.id),ae=e.scores?.fused;return i("div",{"data-testid":`search-hit-card-${e.id}`,"data-hit-id":e.id,"data-rank":f+1,className:"rounded-xl border border-slate-200 bg-white p-5 shadow-sm transition-all hover:border-slate-300 hover:shadow-md",children:[i("div",{className:"flex flex-col gap-2 sm:flex-row sm:items-start sm:justify-between",children:[i("div",{className:"space-y-1",children:[i("div",{className:"flex flex-wrap items-center gap-2",children:[i("span",{"data-testid":`hit-rank-${e.id}`,className:"rounded-sm bg-slate-100 px-2 py-0.5 font-bold font-mono text-slate-600 text-xs",children:["#",f+1]}),n("h3",{"data-testid":`hit-filename-${e.id}`,className:"font-bold text-base text-slate-900 tracking-tight",children:e.file_name}),n("span",{"data-testid":`hit-confidentiality-${e.id}`,className:`rounded-full px-2 py-0.5 font-semibold text-[11px] ${e.confidentiality_level==="PUBLIC"?"bg-emerald-50 text-emerald-700":e.confidentiality_level==="INTERNAL"?"bg-blue-50 text-blue-700":e.confidentiality_level==="CONFIDENTIAL"?"bg-amber-50 text-amber-700":"bg-red-50 text-red-700"}`,children:e.confidentiality_level}),e.department_id!==null&&i("span",{"data-testid":`hit-department-${e.id}`,className:"rounded-sm bg-slate-100 px-2 py-0.5 text-[11px] text-slate-600",children:["Dept: ",e.department_id]}),n("span",{"data-testid":`hit-mimetype-${e.id}`,className:"rounded-sm bg-slate-50 px-2 py-0.5 font-mono text-[11px] text-slate-500",children:e.mime_type})]}),n("p",{className:"max-w-xl truncate font-mono text-slate-400 text-xs",children:e.file_uri})]}),ae!==void 0&&i("div",{className:"flex items-center gap-3 sm:text-right",children:[i("div",{children:[n("div",{className:"font-medium text-slate-500 text-xs",children:"\u878D\u5408\u9806\u4F4D\u30B9\u30B3\u30A2"}),n("div",{"data-testid":`hit-fused-score-${e.id}`,className:"font-bold font-mono text-indigo-600 text-sm",title:"\u5404\u5C64\u3067\u306E\u9806\u4F4D\u304B\u3089\u7D44\u307F\u7ACB\u3066\u305F\u5024 (0\u301C1)\u3002\u985E\u4F3C\u5EA6\u3067\u3082\u78BA\u4FE1\u5EA6\u3067\u3082\u306A\u304F\u3001\u3069\u306E\u5C64\u3067\u3082 1 \u4F4D\u306A\u3089 1.000 \u306B\u306A\u308B",children:ae.toFixed(3)})]}),n("div",{className:"h-2 w-16 overflow-hidden rounded-full bg-slate-200",children:n("div",{className:"h-full bg-indigo-600",style:{width:`${Math.min(100,Math.max(0,ae*100))}%`}})})]})]}),e.ai_summary&&n("div",{"data-testid":`hit-summary-${e.id}`,className:"mt-3 rounded-lg bg-slate-50 p-3 text-slate-700 text-sm leading-relaxed",children:Ot(e.ai_summary,A?.q??B)}),e.scores&&i("div",{"data-testid":`hit-score-breakdown-${e.id}`,className:"mt-3 flex flex-wrap items-center gap-2 text-xs",children:[n("span",{className:"text-[11px] text-slate-400",children:"\u30B9\u30B3\u30A2\u5185\u8A33:"}),e.scores.vector!==void 0&&i("span",{"data-testid":`score-vector-${e.id}`,"data-score-kind":e.scores.vector.kind,title:Ge[e.scores.vector.kind].title,className:"rounded-sm bg-blue-50 px-2 py-0.5 font-mono text-blue-700",children:[Ge[e.scores.vector.kind].label,": ",Ge[e.scores.vector.kind].format(e.scores.vector.value)]}),e.scores.lexicalRank!==void 0&&i("span",{"data-testid":`score-lexical-${e.id}`,title:"\u5B57\u53E5\u5C64\u3067\u306E\u9806\u4F4D\u3092 0\u301C1 \u3078\u5199\u3057\u305F\u5024 (\u30B9\u30B3\u30A2\u3067\u306F\u306A\u3044)",className:"rounded-sm bg-amber-50 px-2 py-0.5 font-mono text-amber-700",children:["\u5B57\u53E5\u9806\u4F4D: ",rt(e.scores.lexicalRank)]}),e.scores.graphRank!==void 0&&i("span",{"data-testid":`score-graph-${e.id}`,title:"\u30B0\u30E9\u30D5\u5C64\u3067\u306E\u9806\u4F4D\u3092 0\u301C1 \u3078\u5199\u3057\u305F\u5024 (\u30B9\u30B3\u30A2\u3067\u306F\u306A\u3044)",className:"rounded-sm bg-purple-50 px-2 py-0.5 font-mono text-purple-700",children:["\u30B0\u30E9\u30D5\u9806\u4F4D: ",rt(e.scores.graphRank)]})]}),e.tags&&e.tags.length>0&&n("div",{"data-testid":`hit-tags-${e.id}`,className:"mt-3 flex flex-wrap items-center gap-1.5",children:e.tags.map(X=>i("span",{"data-testid":`hit-tag-${e.id}-${X}`,className:"rounded-full bg-slate-100 px-2.5 py-0.5 font-medium text-slate-600 text-xs",children:["#",X]},`tag-${e.id}-${X}`))}),e.graph_relations&&e.graph_relations.length>0&&i("div",{"data-testid":`hit-graph-relations-${e.id}`,className:"mt-3 flex flex-wrap items-center gap-1.5",children:[n("span",{className:"text-slate-400 text-xs",children:"\u30B0\u30E9\u30D5\u63A5\u7D9A:"}),e.graph_relations.map((X,vt)=>i("span",{"data-testid":`hit-relation-${e.id}-${vt}`,className:"rounded-sm border border-purple-200 bg-purple-50 px-2 py-0.5 font-mono text-[11px] text-purple-800",children:["-[:",X.relation,"]-> ",X.target_name]},`rel-${e.id}-${X.relation}-${X.target_name}`))]}),e.structured_data!==null&&e.structured_data!==void 0&&i("div",{className:"mt-3 border-slate-100 border-t pt-2",children:[i("button",{type:"button","data-testid":`toggle-structured-data-${e.id}`,onClick:()=>bt(e.id),className:"inline-flex items-center gap-1 font-medium text-indigo-600 text-xs hover:text-indigo-800",children:[n("span",{children:R?"\u25BC":"\u25B6"}),i("span",{children:["\u62BD\u51FA\u69CB\u9020\u5316\u30C7\u30FC\u30BF ",R?"\u3092\u9589\u3058\u308B":"\u3092\u8868\u793A"]})]}),R&&n("pre",{"data-testid":`structured-data-json-${e.id}`,tabIndex:0,className:"mt-2 max-h-48 overflow-auto rounded-sm bg-slate-900 p-3 font-mono text-slate-200 text-xs",children:JSON.stringify(e.structured_data,null,2)})]})]},e.id)})]}),q&&i("section",{id:H,"aria-label":"\u958B\u767A\u8005\u30A4\u30F3\u30B9\u30DA\u30AF\u30BF","data-testid":"developer-inspector-drawer",className:"rounded-xl border border-slate-300 bg-slate-900 p-5 text-slate-200 shadow-xl",children:[i("div",{className:"flex items-center justify-between border-slate-800 border-b pb-3",children:[i("div",{className:"flex items-center gap-3",children:[n("span",{className:"font-bold text-base text-white",children:"\u958B\u767A\u8005\u30A4\u30F3\u30B9\u30DA\u30AF\u30BF"}),n("span",{className:"rounded-sm bg-slate-800 px-2 py-0.5 font-mono text-slate-400 text-xs",children:"Live Pipeline Inspector"})]}),i("div",{className:"flex items-center gap-2",children:[n("button",{type:"button","data-testid":"copy-inspector-payload-button",onClick:()=>{let e=JSON.stringify(ne==="request"?A??{}:C??{},null,2);xt(e,"inspector")},className:"rounded-sm bg-slate-800 px-2.5 py-1 font-medium text-slate-300 text-xs transition-colors hover:bg-slate-700",children:Me==="inspector"?"\u30B3\u30D4\u30FC\u5B8C\u4E86 \u2713":"JSON \u3092\u30B3\u30D4\u30FC"}),n("button",{type:"button","data-testid":"close-inspector-button",onClick:()=>G(!1),className:"text-slate-400 hover:text-white",children:"\u2715"})]})]}),n("div",{className:"mt-3 flex gap-2 border-slate-800 border-b pb-2",children:["request","response","pipeline","graph-trace"].map(e=>{let f={request:"Request Payload",response:"Response Payload",pipeline:"Pipeline Trace","graph-trace":"Graph Path Trace"},R=ne===e;return n("button",{type:"button","data-testid":`inspector-tab-${e}`,"data-active":String(R),onClick:()=>he(e),className:`rounded-sm px-3 py-1 font-medium text-xs ${R?"bg-indigo-600 font-semibold text-white":"text-slate-400 hover:text-white"}`,children:f[e]},e)})}),i("div",{className:"mt-4",children:[ne==="request"&&n("pre",{"data-testid":"inspector-request-json",tabIndex:0,className:"max-h-80 overflow-auto rounded-sm bg-slate-950 p-4 font-mono text-emerald-400 text-xs",children:JSON.stringify(A??{},null,2)}),ne==="response"&&n("pre",{"data-testid":"inspector-response-json",tabIndex:0,className:"max-h-80 overflow-auto rounded-sm bg-slate-950 p-4 font-mono text-sky-400 text-xs",children:JSON.stringify(C??{},null,2)}),ne==="pipeline"&&i("div",{"data-testid":"inspector-pipeline-trace",className:"space-y-3 p-2 text-xs",children:[i("div",{className:"flex items-center gap-2",children:[n("span",{className:"rounded-full bg-emerald-500/20 px-2 py-0.5 font-bold text-emerald-400",children:"Step 1"}),n("span",{className:"font-semibold text-slate-300",children:"\u30AF\u30A8\u30EA\u89E3\u6790 & \u57CB\u3081\u8FBC\u307F (Query Analysis & Tokenization)"})]}),i("div",{className:"ml-6 border-slate-700 border-l pl-4 font-mono text-slate-400",children:["mode: ",Ue.mode,' | q: "',Ue.q,'"']}),i("div",{className:"flex items-center gap-2",children:[n("span",{className:"rounded-full bg-emerald-500/20 px-2 py-0.5 font-bold text-emerald-400",children:"Step 2"}),n("span",{className:"font-semibold text-slate-300",children:"\u30DE\u30EB\u30C1\u30EC\u30A4\u30E4\u30FC\u4E26\u884C\u53D6\u5F97 (Multi-Tier Retrieval)"})]}),i("div",{className:"ml-6 border-slate-700 border-l pl-4 font-mono text-slate-400",children:["SQL SoT: ",M.sql?"ACTIVE":"SKIPPED"," | Sparse: ",M.sparse?"ACTIVE":"OFFLINE"," | Dense: ",M.dense?"ACTIVE":"OFFLINE"," | Graph: ",M.graph?"ACTIVE":"OFFLINE"]}),i("div",{className:"flex items-center gap-2",children:[n("span",{className:"rounded-full bg-indigo-500/20 px-2 py-0.5 font-bold text-indigo-400",children:"Step 3"}),n("span",{className:"font-semibold text-slate-300",children:"\u30B9\u30B3\u30A2\u878D\u5408 & \u9806\u4F4D\u4ED8\u3051 (Fusion & Ranking)"})]}),i("div",{className:"ml-6 border-slate-700 border-l pl-4 font-mono text-slate-400",children:[i("span",{"data-testid":"inspector-fusion-strategy",children:["strategy: ",C?Mt(Ue):Te]})," | ",i("span",{"data-testid":"inspector-output-count",children:["Output count: ",C?C.count:Te]})]}),i("div",{className:"flex items-center gap-2",children:[n("span",{className:"rounded-full bg-purple-500/20 px-2 py-0.5 font-bold text-purple-400",children:"Step 4"}),n("span",{className:"font-semibold text-slate-300",children:"ABAC \u884C\u30FB\u5217\u8A8D\u53EF\u30DE\u30B9\u30AD\u30F3\u30B0 (Security Enforcement)"})]}),i("div",{className:"ml-6 border-slate-700 border-l pl-4 font-mono text-slate-400",children:[i("span",{"data-testid":"inspector-authz-row",children:["\u884C\u30B9\u30B3\u30FC\u30D7: ",C?C.authzScopes.rowScopeApplied?"\u9069\u7528 (\u4E00\u89A7\u304B\u3089\u6587\u66F8\u304C\u9664\u304B\u308C\u3066\u3044\u308B\u53EF\u80FD\u6027)":"\u672A\u9069\u7528":Te]})," | ",i("span",{"data-testid":"inspector-authz-column",children:["\u5217\u30B9\u30B3\u30FC\u30D7: ",C?C.authzScopes.columnScopeApplied?"\u9069\u7528 (\u9805\u76EE\u304C\u4F0F\u305B\u3089\u308C\u3066\u3044\u308B)":"\u672A\u9069\u7528":Te]})," | ","tenant: ",t]})]}),ne==="graph-trace"&&i("div",{"data-testid":"inspector-graph-trace",className:"p-2 text-xs",children:[n("div",{className:"font-semibold text-purple-300",children:"\u77E5\u8B58\u30B0\u30E9\u30D5 \u30C8\u30E9\u30D0\u30FC\u30B5\u30EB \u30D1\u30B9:"}),C?.hits.some(e=>e.graph_relations&&e.graph_relations.length>0)?n("ul",{className:"mt-2 space-y-2 font-mono text-slate-300",children:C.hits.map(e=>e.graph_relations?.map(f=>i("li",{className:"rounded-sm bg-slate-950 p-2",children:["(:Document {id: ",e.id,', file: "',e.file_name,'"}) -[:',f.relation,']-> (:Entity {name: "',f.target_name,'"})']},`gtrace-${e.id}-${f.relation}-${f.target_name}`)))}):n("p",{className:"mt-2 text-slate-500",children:"\u95A2\u9023\u3059\u308B\u30B0\u30E9\u30D5\u30D1\u30B9\u306F\u691C\u51FA\u3055\u308C\u307E\u305B\u3093\u3067\u3057\u305F\u3002"})]})]})]})]})}import{jsx as h,jsxs as v}from"react/jsx-runtime";function dt(t){return t===null?Ee:`${t.length} \u7A2E`}var Ee="\u672A\u8A2D\u5B9A";function Se(t,r=""){return t===null?Ee:`${t}${r}`}function De(t){return t===null?Ee:`${t} \u4EF6`}function Bt(t){if(t.currentVersion===null&&t.lifecyclePhase===null)return`${t.schemaName} (\u79FB\u884C\u53F0\u5E33\u306F\u672A\u8A18\u9332)`;let r=t.currentVersion===null?Ee:`v${t.currentVersion}`;return`${t.schemaName} ${r} (${t.lifecyclePhase??Ee})`}function ca({tenantId:t,ontologyStatus:r}){let c=r.classes,o=r.predicates;return v("div",{className:"space-y-6","data-testid":"ontology-status-card",children:[v("div",{className:"rounded-xl border border-slate-200 bg-white p-6 shadow-sm",children:[v("div",{className:"flex flex-col justify-between gap-3 md:flex-row md:items-center",children:[v("div",{children:[v("div",{className:"flex items-center gap-2",children:[h("h2",{className:"font-bold text-base text-slate-900",children:"\u30AA\u30F3\u30C8\u30ED\u30B8\u30FC & \u30B9\u30AD\u30FC\u30DE\u30AC\u30D0\u30CA\u30F3\u30B9\u72B6\u614B"}),h("span",{className:`inline-flex items-center rounded-full px-2.5 py-0.5 font-bold text-xs ${r.autonomousEvolutionEnabled?"bg-emerald-100 text-emerald-800":"bg-slate-100 text-slate-700"}`,"data-testid":"ontology-evolution-badge",children:r.autonomousEvolutionEnabled?"\u81EA\u5F8B\u7684\u30AA\u30F3\u30C8\u30ED\u30B8\u30FC\u9032\u5316: \u6709\u52B9":"\u81EA\u5F8B\u9032\u5316: \u505C\u6B62\u4E2D"}),h("span",{className:"inline-flex items-center rounded-sm bg-indigo-100 px-2 py-0.5 font-mono font-semibold text-indigo-800 text-xs","data-testid":"ontology-schema-version",children:Bt(r)})]}),h("p",{className:"mt-1 text-slate-500 text-xs",children:"Neo4j \u7269\u7406\u30B0\u30E9\u30D5\u30B9\u30AD\u30FC\u30DE\u5236\u7D04\u3001\u8AD6\u7406\u30A8\u30F3\u30C6\u30A3\u30C6\u30A3\u30AF\u30E9\u30B9\u4F53\u7CFB\u3001\u304A\u3088\u3073\u4EBA\u9593\u53C2\u52A0\u578B (HITL) \u30AA\u30F3\u30C8\u30ED\u30B8\u30FC\u6607\u683C\u30D1\u30A4\u30D7\u30E9\u30A4\u30F3\u306E\u7A3C\u50CD\u72B6\u6CC1"})]}),v("div",{className:"inline-flex items-center rounded-lg border border-slate-200 bg-slate-50 px-3 py-1.5 font-medium text-slate-600 text-xs",children:["\u30C6\u30CA\u30F3\u30C8\u540D\u524D\u7A7A\u9593:"," ",h("span",{className:"ml-1.5 font-bold text-slate-800","data-testid":"ontology-tenant-id",children:t})]})]}),v("div",{className:"mt-4 grid grid-cols-2 gap-3 sm:grid-cols-4",children:[v("div",{className:"rounded-lg border border-slate-200 bg-slate-50/70 p-3",children:[h("span",{className:"block text-slate-500 text-xs",children:"\u7269\u7406\u4E00\u610F\u5236\u7D04 (Unique)"}),h("span",{className:"mt-1 block font-bold font-mono text-base text-slate-900","data-testid":"ontology-constraints-count",children:De(r.totalConstraints)})]}),v("div",{className:"rounded-lg border border-slate-200 bg-slate-50/70 p-3",children:[h("span",{className:"block text-slate-500 text-xs",children:"\u691C\u7D22\u7D22\u5F15 (DDL \u304C\u4F5C\u308B\u5206)"}),h("span",{className:"mt-1 block font-bold font-mono text-base text-slate-900","data-testid":"ontology-indexes-count",children:De(r.searchIndexes)}),v("span",{className:"block text-slate-500 text-xs","data-testid":"ontology-indexes-total",children:["\u5168\u7D22\u5F15: ",De(r.totalIndexes)]})]}),v("div",{className:"rounded-lg border border-slate-200 bg-slate-50/70 p-3",children:[h("span",{className:"block text-slate-500 text-xs",children:"\u6607\u683C\u5224\u5B9A\u3057\u304D\u3044\u5024 (\u78BA\u4FE1\u5EA6/\u5171\u8D77)"}),v("span",{className:"mt-1 block font-bold font-mono text-base text-indigo-700","data-testid":"ontology-thresholds-info",children:[Se(r.promotionThresholds.confidence)," / ",Se(r.promotionThresholds.cooccurrence," \u56DE")]})]}),v("div",{className:"rounded-lg border border-slate-200 bg-slate-50/70 p-3",children:[h("span",{className:"block text-slate-500 text-xs",children:"HITL \u6607\u683C\u627F\u8A8D\u5F85\u3061\u5019\u88DC"}),h("span",{className:"mt-1 block font-bold font-mono text-amber-600 text-base","data-testid":"ontology-unresolved-count",children:De(r.unresolvedCandidatesCount)})]})]})]}),v("div",{className:"grid grid-cols-1 gap-6 lg:grid-cols-2",children:[v("div",{className:"rounded-xl border border-slate-200 bg-white p-6 shadow-sm",children:[v("div",{className:"flex items-center justify-between pb-3",children:[v("div",{children:[h("h3",{className:"font-bold text-slate-900 text-sm",children:"\u30AA\u30F3\u30C8\u30ED\u30B8\u30FC\u4E3B\u8981\u30AF\u30E9\u30B9\u4F53\u7CFB (Node Labels)"}),h("p",{className:"text-slate-500 text-xs",children:"\u30B0\u30E9\u30D5\u5185\u3067\u30E2\u30C7\u30EB\u5316\u3055\u308C\u3066\u3044\u308B\u6B63\u6E96\u30A8\u30F3\u30C6\u30A3\u30C6\u30A3\u30CE\u30FC\u30C9\u7A2E\u5225"})]}),h("span",{className:"rounded-sm bg-indigo-50 px-2 py-0.5 font-semibold text-indigo-700 text-xs","data-testid":"ontology-classes-count",children:dt(c)})]}),v("div",{className:"divide-y divide-slate-100",children:[c===null&&h("p",{className:"py-3 text-slate-500 text-xs","data-testid":"ontology-classes-unsupplied",children:"\u3053\u306E\u914D\u5099\u306E\u30AF\u30E9\u30B9\u8A9E\u5F59\u304C\u4F9B\u7D66\u3055\u308C\u3066\u3044\u307E\u305B\u3093\u3002\u5B9F\u88C5\u304C\u8A31\u3059\u8A9E\u5F59\u3092\u8FD4\u3059\u7D4C\u8DEF\u304C\u7D50\u7DDA\u3055\u308C\u3066\u3044\u306A\u3044\u53EF\u80FD\u6027\u304C\u3042\u308A\u307E\u3059\u3002"}),c?.map(l=>v("div",{className:"flex items-start justify-between py-2.5","data-testid":`ontology-class-${l.name}`,children:[v("div",{children:[h("span",{className:"inline-block font-bold font-mono text-indigo-700 text-xs",children:l.name}),h("p",{className:"mt-0.5 text-slate-600 text-xs",children:l.description})]}),typeof l.count=="number"&&h("span",{className:"rounded-sm bg-slate-100 px-2 py-0.5 font-mono text-slate-600 text-xs",children:l.count.toLocaleString()})]},l.name))]})]}),v("div",{className:"rounded-xl border border-slate-200 bg-white p-6 shadow-sm",children:[v("div",{className:"flex items-center justify-between pb-3",children:[v("div",{children:[h("h3",{className:"font-bold text-slate-900 text-sm",children:"\u30EA\u30EC\u30FC\u30B7\u30E7\u30F3\u30B7\u30C3\u30D7\u8FF0\u8A9E\u4F53\u7CFB (Predicates)"}),h("p",{className:"text-slate-500 text-xs",children:"\u30A8\u30F3\u30C6\u30A3\u30C6\u30A3\u9593\u306E\u30BB\u30DE\u30F3\u30C6\u30A3\u30C3\u30AF\u95A2\u4FC2\u3068\u6709\u5411\u6027"})]}),h("span",{className:"rounded-sm bg-amber-50 px-2 py-0.5 font-semibold text-amber-700 text-xs","data-testid":"ontology-predicates-count",children:dt(o)})]}),v("div",{className:"divide-y divide-slate-100",children:[o===null&&h("p",{className:"py-3 text-slate-500 text-xs","data-testid":"ontology-predicates-unsupplied",children:"\u3053\u306E\u914D\u5099\u306E\u8FF0\u8A9E\u8A9E\u5F59\u304C\u4F9B\u7D66\u3055\u308C\u3066\u3044\u307E\u305B\u3093\u3002\u5B9F\u88C5\u304C\u8A31\u3059\u8A9E\u5F59\u3092\u8FD4\u3059\u7D4C\u8DEF\u304C\u7D50\u7DDA\u3055\u308C\u3066\u3044\u306A\u3044\u53EF\u80FD\u6027\u304C\u3042\u308A\u307E\u3059\u3002"}),o?.map(l=>v("div",{className:"flex items-start justify-between py-2.5","data-testid":`ontology-predicate-${l.name}`,children:[v("div",{children:[h("span",{className:"inline-block font-bold font-mono text-amber-800 text-xs",children:l.name}),h("p",{className:"mt-0.5 text-slate-600 text-xs",children:l.description})]}),h("span",{className:"rounded-sm border border-slate-200 bg-slate-50 px-2 py-0.5 font-mono text-[11px] text-slate-600",children:l.direction})]},l.name))]})]})]}),v("div",{className:"rounded-xl border border-indigo-100 bg-indigo-50/40 p-5 shadow-sm","data-testid":"ontology-evolution-policy-card",children:[h("h3",{className:"font-bold text-indigo-950 text-sm",children:"\u81EA\u5F8B\u7684\u30AA\u30F3\u30C8\u30ED\u30B8\u30FC\u9032\u5316 (Autonomous Ontology Evolution) \u30DD\u30EA\u30B7\u30FC"}),v("div",{className:"mt-2 grid grid-cols-1 gap-3 text-indigo-900 text-xs md:grid-cols-3",children:[v("div",{className:"rounded-lg border border-indigo-200/60 bg-white p-3",children:[h("span",{className:"font-semibold text-slate-700",children:"3 \u6761\u4EF6 AND \u30B2\u30FC\u30C8:"}),v("p",{className:"mt-1 text-slate-600",children:["\u672A\u89E3\u6C7A\u30E1\u30F3\u30B7\u30E7\u30F3\u51FA\u73FE\u6642\u306B\u985E\u4F3C\u5EA6 \u2267 ",Se(r.promotionThresholds.confidence),"\u3001\u5171\u8D77\u56DE\u6570 \u2267 ",Se(r.promotionThresholds.cooccurrence),"\u3001\u8B58\u5225\u30E6\u30FC\u30B6\u30FC\u6570 \u2267"," ",Se(r.promotionThresholds.minDistinctUsers)," \u306E\u5168\u5145\u8DB3\u3092\u8981\u6C42\u3002"]})]}),v("div",{className:"rounded-lg border border-indigo-200/60 bg-white p-3",children:[h("span",{className:"font-semibold text-slate-700",children:"2x \u5171\u8D77\u983B\u5EA6\u518D\u63D0\u6848\u30D0\u30C3\u30AF\u30AA\u30D5:"}),h("p",{className:"mt-1 text-slate-600",children:"\u904B\u7528\u8005\u306B\u3088\u308A\u6607\u683C\u3092\u5374\u4E0B\u3055\u308C\u305F\u5019\u88DC\u306F\u3001\u524D\u56DE\u306E\u5171\u8D77\u6570\u306E 2 \u500D\u4EE5\u4E0A\u306E\u983B\u5EA6\u3067\u518D\u8A00\u53CA\u3055\u308C\u308B\u307E\u3067\u6607\u683C\u30AD\u30E5\u30FC\u3078\u306E\u518D\u6D6E\u4E0A\u3092\u81EA\u52D5\u6291\u5236\u3002"})]}),v("div",{className:"rounded-lg border border-indigo-200/60 bg-white p-3",children:[h("span",{className:"font-semibold text-slate-700",children:"Cypher AST ABAC \u8A8D\u53EF\u6CE8\u5165:"}),v("p",{className:"mt-1 text-slate-600",children:["Neo4j \u30AF\u30A8\u30EA\u5B9F\u884C\u6642\u306B ",h("code",{className:"font-mono text-indigo-800",children:"tenantId = $tenant_id"})," \u3068\u6A5F\u5BC6\u533A\u5206\u8FF0\u8A9E\u3092\u4E0D\u53EF\u5206\u306B\u5408\u6210\u3057\u3001\u30C6\u30CA\u30F3\u30C8\u5B8C\u5168\u9694\u96E2\u3092\u62C5\u4FDD\u3002"]})]})]})]})]})}import{jsx as _,jsxs as D}from"react/jsx-runtime";function lt(t){return t==null||t<0?"\u672A\u6E2C\u5B9A":t<1024*1024?`${(t/1024).toFixed(1)} KB`:t<1024*1024*1024?`${(t/(1024*1024)).toFixed(1)} MB`:`${(t/(1024*1024*1024)).toFixed(2)} GB`}function ua({collections:t,probeFailure:r=null,health:c,resources:o,onRefresh:l,isRefreshing:p=!1,onSelectCollection:x,selectedCollectionName:b}){let I=r===null,E=I?t.reduce((g,u)=>g+u.points_count,0):null,k=I?t.reduce((g,u)=>g+u.vectors_count,0):null;return D("div",{"data-testid":"qdrant-storage-card",style:{border:"1px solid #e2e8f0",borderRadius:"8px",padding:"16px",backgroundColor:"#ffffff"},children:[D("div",{style:{display:"flex",justifyContent:"space-between",alignItems:"center",marginBottom:"12px"},children:[D("div",{style:{display:"flex",alignItems:"center",gap:"10px"},children:[_("h2",{style:{margin:0,fontSize:"16px",color:"#1e293b"},children:"Qdrant \u30D9\u30AF\u30C8\u30EB\u30B9\u30C8\u30EC\u30FC\u30B8\u76E3\u8996"}),c&&_("span",{"data-testid":"qdrant-health-badge","data-healthy":String(c.healthy),style:{fontSize:"12px",padding:"2px 8px",borderRadius:"12px",backgroundColor:c.healthy?"#d1fae5":"#fee2e2",color:c.healthy?"#065f46":"#991b1b",fontWeight:600},children:c.healthy?"\u6B63\u5E38\u7A3C\u50CD":"\u969C\u5BB3\u767A\u751F"}),c?.latency_ms!==void 0&&D("span",{"data-testid":"qdrant-latency",style:{fontSize:"12px",color:"#64748b"},children:["\u5FDC\u7B54\u901F\u5EA6: ",c.latency_ms," ms"]})]}),l&&_("button",{type:"button","data-testid":"qdrant-refresh-button",disabled:p,onClick:l,style:{padding:"6px 12px",borderRadius:"4px",border:"1px solid #cbd5e1",backgroundColor:"#ffffff",cursor:p?"not-allowed":"pointer",fontSize:"13px"},children:p?"\u66F4\u65B0\u4E2D...":"\u66F4\u65B0"})]}),D("div",{style:{display:"grid",gridTemplateColumns:"repeat(auto-fit, minmax(140px, 1fr))",gap:"10px",marginBottom:"16px",padding:"10px",backgroundColor:"#f8fafc",borderRadius:"6px"},children:[D("div",{children:[_("div",{style:{fontSize:"12px",color:"#64748b"},children:"\u7DCF\u30DD\u30A4\u30F3\u30C8\u6570"}),_("div",{"data-testid":"qdrant-total-points",style:{fontSize:"18px",fontWeight:700,color:"#0f172a"},children:E===null?"\u672A\u6E2C\u5B9A":E.toLocaleString()})]}),D("div",{children:[_("div",{style:{fontSize:"12px",color:"#64748b"},children:"\u7DCF\u30D9\u30AF\u30C8\u30EB\u6570"}),_("div",{"data-testid":"qdrant-total-vectors",style:{fontSize:"18px",fontWeight:700,color:"#0f172a"},children:k===null?"\u672A\u6E2C\u5B9A":k.toLocaleString()})]}),D("div",{children:[_("div",{style:{fontSize:"12px",color:"#64748b"},children:"\u30E1\u30E2\u30EA\u6D88\u8CBB (RAM)"}),_("div",{"data-testid":"qdrant-ram-usage",style:{fontSize:"18px",fontWeight:700,color:"#0f172a"},children:lt(o?.ram_bytes)})]}),D("div",{children:[_("div",{style:{fontSize:"12px",color:"#64748b"},children:"\u30C7\u30A3\u30B9\u30AF\u6D88\u8CBB"}),_("div",{"data-testid":"qdrant-disk-usage",style:{fontSize:"18px",fontWeight:700,color:"#0f172a"},children:lt(o?.disk_bytes)})]}),D("div",{children:[_("div",{style:{fontSize:"12px",color:"#64748b"},children:"\u30BB\u30B0\u30E1\u30F3\u30C8\u7DCF\u6570"}),_("div",{"data-testid":"qdrant-segment-count",style:{fontSize:"18px",fontWeight:700,color:"#0f172a"},children:o?.segment_count??"\u672A\u6E2C\u5B9A"})]})]}),D("div",{children:[D("h3",{style:{margin:"0 0 8px 0",fontSize:"14px",color:"#334155"},children:["\u30B3\u30EC\u30AF\u30B7\u30E7\u30F3\u4E00\u89A7 (",I?`${t.length} \u4EF6`:"\u672A\u6E2C\u5B9A",")"]}),r!==null?_("p",{"data-testid":"qdrant-probe-failure",style:{margin:0,fontSize:"13px",color:"#92400e",backgroundColor:"#fffbeb",border:"1px solid #f59e0b",borderRadius:"6px",padding:"8px"},children:r}):t.length===0?_("p",{"data-testid":"no-collections-message",style:{margin:0,fontSize:"13px",color:"#64748b"},children:"\u767B\u9332\u3055\u308C\u3066\u3044\u308B\u30B3\u30EC\u30AF\u30B7\u30E7\u30F3\u306F\u3042\u308A\u307E\u305B\u3093\u3002"}):_("div",{style:{overflowX:"auto"},children:D("table",{"data-testid":"qdrant-collections-list",style:{width:"100%",borderCollapse:"collapse",fontSize:"13px"},children:[_("thead",{children:D("tr",{style:{borderBottom:"1px solid #e2e8f0",textAlign:"left",color:"#64748b"},children:[_("th",{style:{padding:"6px 8px"},children:"\u30B3\u30EC\u30AF\u30B7\u30E7\u30F3\u540D"}),_("th",{style:{padding:"6px 8px"},children:"\u30C9\u30E1\u30A4\u30F3"}),_("th",{style:{padding:"6px 8px"},children:"\u30DD\u30A4\u30F3\u30C8\u6570"}),_("th",{style:{padding:"6px 8px"},children:"\u30D9\u30AF\u30C8\u30EB\u69CB\u6210"})]})}),_("tbody",{children:t.map(g=>{let u=g.collection_name===b,y=g.vectors_config.dense!==void 0,P=g.vectors_config.sparse!==void 0,H=g.vectors_config.image!==void 0;return D("tr",{"data-testid":`collection-row-${g.collection_name}`,"data-collection-name":g.collection_name,"data-selected":String(u),role:x?"button":void 0,tabIndex:x?0:void 0,"aria-selected":u,onClick:()=>x?.(g.collection_name),onKeyDown:B=>{x&&(B.key==="Enter"||B.key===" ")&&(B.preventDefault(),x(g.collection_name))},style:{borderBottom:"1px solid #f1f5f9",backgroundColor:u?"#eff6ff":"transparent",cursor:x?"pointer":"default",outline:"none"},children:[_("td",{style:{padding:"8px",fontWeight:500,color:"#1e293b"},children:g.collection_name}),_("td",{style:{padding:"8px",color:"#475569"},children:g.domain_key}),_("td",{"data-testid":`collection-points-${g.collection_name}`,style:{padding:"8px",color:"#0f172a"},children:g.points_count.toLocaleString()}),_("td",{style:{padding:"8px"},children:D("div",{style:{display:"flex",gap:"6px",flexWrap:"wrap"},children:[y&&D("span",{"data-testid":`vector-tag-dense-${g.collection_name}`,style:{fontSize:"11px",padding:"2px 6px",borderRadius:"4px",backgroundColor:"#e0e7ff",color:"#3730a3"},children:["Dense: ",g.vectors_config.dense?.size," dim"]}),P&&_("span",{"data-testid":`vector-tag-sparse-${g.collection_name}`,style:{fontSize:"11px",padding:"2px 6px",borderRadius:"4px",backgroundColor:"#fef3c7",color:"#92400e"},children:g.vectors_config.sparse?.modifier?`Sparse (${g.vectors_config.sparse.modifier.toUpperCase()})`:"Sparse"}),H&&D("span",{"data-testid":`vector-tag-image-${g.collection_name}`,style:{fontSize:"11px",padding:"2px 6px",borderRadius:"4px",backgroundColor:"#f3e8ff",color:"#6b21a8"},children:["Image: ",g.vectors_config.image?.size," dim"]})]})})]},g.collection_name)})})]})})]})]})}import{useState as Kt}from"react";import{jsx as T,jsxs as U}from"react/jsx-runtime";var ct=[{id:"ingestion",title:"\u6587\u66F8\u53D6\u308A\u8FBC\u307F",description:"\u751F\u30C9\u30AD\u30E5\u30E1\u30F3\u30C8\u306E\u62BD\u51FA\u3068\u6B63\u898F\u5316\u51E6\u7406\u3092\u5B9F\u884C\u3002"},{id:"chunking",title:"\u968E\u5C64\u30C1\u30E3\u30F3\u30AF\u5206\u5272",description:"\u89AA\u5B50\u30C1\u30E3\u30F3\u30AF\u69CB\u9020\u304A\u3088\u3073\u30C8\u30FC\u30AF\u30F3\u5883\u754C\u5206\u5272\u3002"},{id:"embedding",title:"\u30DE\u30EB\u30C1\u30E2\u30FC\u30C0\u30EB\u57CB\u3081\u8FBC\u307F",description:"Dense \u30D9\u30AF\u30C8\u30EB\u304A\u3088\u3073 Sparse \u30D9\u30AF\u30C8\u30EB\u751F\u6210\u3002"},{id:"vector_indexing",title:"\u30D9\u30AF\u30C8\u30EB\u683C\u7D0D",description:"Qdrant \u30B3\u30EC\u30AF\u30B7\u30E7\u30F3\u3078\u306E\u30D9\u30AF\u30C8\u30EB\u767B\u9332\u3002",circuitBreakerKey:"vector",configKey:"enable_vector_indexing"},{id:"graph_indexing",title:"\u30CA\u30EC\u30C3\u30B8\u30B0\u30E9\u30D5\u683C\u7D0D",description:"Neo4j \u3078\u306E\u30A8\u30F3\u30C6\u30A3\u30C6\u30A3\u304A\u3088\u3073\u95A2\u4FC2\u6027\u6295\u5F71\u3002",circuitBreakerKey:"graph",configKey:"enable_graph_indexing"},{id:"asset_extraction",title:"\u30A2\u30BB\u30C3\u30C8\u62BD\u51FA",description:"\u753B\u50CF\u30FB\u8868\u30FB\u30E1\u30C7\u30A3\u30A2\u30A2\u30BB\u30C3\u30C8\u306E\u5207\u308A\u51FA\u3057\u3068 OCR \u51E6\u7406\u3002",configKey:"enable_asset_extraction"},{id:"synthesis",title:"\u8981\u7D04\u30FB\u63A8\u8AD6\u751F\u6210",description:"LLM \u306B\u3088\u308B\u69CB\u9020\u5316\u62BD\u51FA\u304A\u3088\u3073\u8981\u7D04\u5408\u6210\u3002",circuitBreakerKey:"llm",configKey:"enable_summary_generation"}],$e="\u672A\u6E2C\u5B9A (\u53CE\u96C6\u7D4C\u8DEF\u304C\u672A\u7D50\u7DDA)",Ut={active:"\u7A3C\u50CD\u4E2D",partial:"\u4E00\u90E8\u30C9\u30E1\u30A4\u30F3\u306E\u307F",degraded:"\u7E2E\u9000",disabled:"\u7121\u52B9",unmeasured:"\u672A\u6E2C\u5B9A"},pt={active:{background:"#d1fae5",text:"#065f46"},partial:{background:"#dbeafe",text:"#1e40af"},degraded:{background:"#fef3c7",text:"#92400e"},disabled:{background:"#e2e8f0",text:"#475569"},unmeasured:{background:"#f1f5f9",text:"#64748b"}};function zt(t){if(!t)return"";let r=[];return t.featureFlagKey===null?r.push("\u30C6\u30CA\u30F3\u30C8\u306E\u9580\u306A\u3057"):t.featureFlag===!1?r.push("\u30C6\u30CA\u30F3\u30C8\u306E\u6A5F\u80FD\u30D5\u30E9\u30B0\u304C\u7121\u52B9"):t.featureFlag===null&&r.push("\u30C6\u30CA\u30F3\u30C8\u306E\u6A5F\u80FD\u30D5\u30E9\u30B0\u672A\u6E2C\u5B9A"),t.domainsEnabled!==null&&t.domainsTotal!==null?r.push(`\u6709\u52B9\u30C9\u30E1\u30A4\u30F3 ${t.domainsEnabled}/${t.domainsTotal}`):r.push("\u30C9\u30E1\u30A4\u30F3\u6226\u7565\u672A\u6E2C\u5B9A"),r.join(" \uFF5C ")}function mt(t,r,c){let o=t.configKey===void 0?void 0:r[t.configKey];if(o){if(o.featureFlag===!1||o.domainsEnabled===0)return"disabled";if((o.featureFlag===!0||o.featureFlagKey===null)&&o.domainsEnabled!==null&&o.domainsTotal!==null&&o.domainsEnabled<o.domainsTotal)return"partial";if(o.featureFlagKey!==null&&o.featureFlag===null||o.domainsEnabled===null)return"unmeasured"}if(t.circuitBreakerKey&&c){let l=c[t.circuitBreakerKey];if(l==="OPEN"||l==="HALF_OPEN")return"degraded"}return t.configKey===void 0&&t.circuitBreakerKey===void 0?"unmeasured":"active"}function ba({pipelineConfig:t,circuitBreakerStatus:r,stageMetrics:c,selectedNodeId:o,onNodeSelect:l}){let[p,x]=Kt(null),b=o!==void 0?o:p,I=y=>{x(y),l&&l(y)},E=ct.find(y=>y.id===b),k=E&&c?c[E.id]:void 0,g=E?mt(E,t,r):null,u=E?.circuitBreakerKey&&r?r[E.circuitBreakerKey]:void 0;return U("div",{"data-testid":"rag-pipeline-graph-viewer",style:{border:"1px solid #e2e8f0",borderRadius:"8px",padding:"16px",backgroundColor:"#f8fafc"},children:[T("h2",{"data-testid":"rag-graph-title",style:{margin:"0 0 12px 0",fontSize:"16px",color:"#1e293b"},children:"RAG \u5B9F\u884C\u30D1\u30A4\u30D7\u30E9\u30A4\u30F3\u69CB\u6210"}),T("div",{"data-testid":"rag-nodes-container",style:{display:"grid",gridTemplateColumns:"repeat(auto-fit, minmax(180px, 1fr))",gap:"12px",marginBottom:"16px"},children:ct.map(y=>{let P=mt(y,t,r),H=y.id===b,B=y.circuitBreakerKey&&r?r[y.circuitBreakerKey]:void 0,O=H?"#2563eb":P==="active"?"#10b981":P==="degraded"?"#f59e0b":"#94a3b8",z=P==="active"?"#ecfdf5":P==="degraded"?"#fffbeb":"#f1f5f9";return U("button",{type:"button","data-testid":`rag-node-${y.id}`,"data-node-id":y.id,"data-node-status":P,"data-selected":String(H),"aria-pressed":H,...B?{"data-circuit-breaker":B}:{},onClick:()=>I(y.id),style:{border:`2px solid ${O}`,backgroundColor:z,borderRadius:"6px",padding:"10px",cursor:"pointer",transition:"all 0.15s ease",textAlign:"left",width:"100%"},children:[U("div",{style:{display:"flex",justifyContent:"space-between",alignItems:"center",marginBottom:"4px"},children:[T("span",{style:{fontWeight:600,fontSize:"14px",color:"#0f172a"},children:y.title}),T("span",{"data-testid":`badge-${y.id}`,style:{fontSize:"11px",padding:"2px 6px",borderRadius:"4px",backgroundColor:pt[P].background,color:pt[P].text,fontWeight:500},children:Ut[P]})]}),T("p",{style:{margin:0,fontSize:"12px",color:"#64748b",lineHeight:1.4},children:y.description}),y.configKey!==void 0&&T("p",{"data-testid":`gates-${y.id}`,style:{margin:"4px 0 0 0",fontSize:"11px",color:"#475569",lineHeight:1.4},children:zt(t[y.configKey])})]},y.id)})}),E&&U("div",{"data-testid":"rag-node-detail-panel",style:{border:"1px solid #cbd5e1",borderRadius:"6px",padding:"14px",backgroundColor:"#ffffff"},children:[U("div",{style:{display:"flex",justifyContent:"space-between",alignItems:"center",marginBottom:"8px"},children:[U("h3",{"data-testid":"detail-stage-title",style:{margin:0,fontSize:"15px",color:"#0f172a"},children:[E.title," \u8A73\u7D30"]}),T("button",{type:"button","data-testid":"close-detail-panel","aria-label":"\u8A73\u7D30\u30D1\u30CD\u30EB\u3092\u9589\u3058\u308B",onClick:()=>{x(null),l&&l(null)},style:{background:"none",border:"none",cursor:"pointer",fontSize:"14px",color:"#64748b"},children:"\u2715"})]}),U("div",{style:{display:"grid",gridTemplateColumns:"repeat(auto-fit, minmax(140px, 1fr))",gap:"8px",fontSize:"13px"},children:[U("div",{children:[T("strong",{children:"\u7A3C\u50CD\u30B9\u30C6\u30FC\u30BF\u30B9: "}),T("span",{"data-testid":"node-detail-status",children:g})]}),u&&U("div",{children:[T("strong",{children:"\u56DE\u8DEF\u906E\u65AD\u5668: "}),T("span",{"data-testid":"node-detail-circuit-breaker",children:u})]}),U("div",{children:[T("strong",{children:"\u30EC\u30A4\u30C6\u30F3\u30B7 (p50): "}),T("span",{"data-testid":"node-metric-latency-p50",children:k?`${k.latency_p50_ms} ms`:$e})]}),U("div",{children:[T("strong",{children:"\u30EC\u30A4\u30C6\u30F3\u30B7 (p95): "}),T("span",{"data-testid":"node-metric-latency-p95",children:k?`${k.latency_p95_ms} ms`:$e})]}),U("div",{children:[T("strong",{children:"\u30B9\u30EB\u30FC\u30D7\u30C3\u30C8: "}),T("span",{"data-testid":"node-metric-throughput",children:k?`${k.throughput_rps} rps`:$e})]}),U("div",{children:[T("strong",{children:"\u6210\u529F\u7387: "}),T("span",{"data-testid":"node-metric-success-rate",children:k?`${(k.success_rate*100).toFixed(1)}%`:$e})]})]})]})]})}import{jsx as N,jsxs as F}from"react/jsx-runtime";var qt="\u5BFE\u8C61\u306A\u3057";function ha({counts:t,totalFiles:r,failedItems:c=[],onRetryAll:o,onRetryItem:l,isRetrying:p=!1,onRefresh:x}){let b=t.SYNCED??0,I=t.PENDING??0,E=(t.EXTRACTING??0)+(t.ENRICHING??0)+(t.PROJECTING??0),k=(t.FAILED_EXTRACT??0)+(t.FAILED_ENRICH??0)+(t.FAILED_VECTOR??0)+(t.FAILED_GRAPH??0),g=r>0?`${(b/r*100).toFixed(1)}%`:qt;return F("div",{"data-testid":"sync-status-monitor",style:{border:"1px solid #e2e8f0",borderRadius:"8px",padding:"16px",backgroundColor:"#ffffff"},children:[F("div",{style:{display:"flex",justifyContent:"space-between",alignItems:"center",marginBottom:"16px"},children:[F("div",{children:[N("h2",{style:{margin:0,fontSize:"16px",color:"#1e293b"},children:"\u30A8\u30F3\u30EA\u30C3\u30C1\u30E1\u30F3\u30C8\u540C\u671F\u30B9\u30C6\u30FC\u30BF\u30B9"}),F("p",{style:{margin:"4px 0 0 0",fontSize:"13px",color:"#64748b"},children:["\u7DCF\u30D5\u30A1\u30A4\u30EB\u6570:"," ",N("span",{"data-testid":"total-files-count",style:{fontWeight:600},children:r})," ","\u4EF6 (\u540C\u671F\u5B8C\u4E86\u7387: ",N("span",{"data-testid":"success-rate-value",children:g}),")"]})]}),F("div",{style:{display:"flex",gap:"8px"},children:[x&&N("button",{type:"button","data-testid":"sync-refresh-button",onClick:x,style:{padding:"6px 12px",borderRadius:"4px",border:"1px solid #cbd5e1",backgroundColor:"#ffffff",cursor:"pointer",fontSize:"13px"},children:"\u66F4\u65B0"}),o&&N("button",{type:"button","data-testid":"retry-all-button",disabled:p||k===0,onClick:o,style:{padding:"6px 14px",borderRadius:"4px",border:"none",backgroundColor:p||k===0?"#94a3b8":"#dc2626",color:"#ffffff",cursor:p||k===0?"not-allowed":"pointer",fontSize:"13px",fontWeight:500},children:p?"\u518D\u8A66\u884C\u4E2D...":"\u5931\u6557\u30B8\u30E7\u30D6\u4E00\u62EC\u518D\u8A66\u884C"})]})]}),F("div",{style:{display:"grid",gridTemplateColumns:"repeat(auto-fit, minmax(130px, 1fr))",gap:"10px",marginBottom:"20px"},children:[F("div",{"data-testid":"status-card-synced","data-count":b,style:{border:"1px solid #10b981",borderRadius:"6px",padding:"10px",backgroundColor:"#ecfdf5"},children:[N("div",{style:{fontSize:"12px",color:"#065f46"},children:"\u5B8C\u5168\u540C\u671F (SYNCED)"}),N("div",{"data-testid":"synced-count",style:{fontSize:"20px",fontWeight:700,color:"#047857"},children:b})]}),F("div",{"data-testid":"status-card-processing","data-count":E,style:{border:"1px solid #3b82f6",borderRadius:"6px",padding:"10px",backgroundColor:"#eff6ff"},children:[N("div",{style:{fontSize:"12px",color:"#1e40af"},children:"\u51E6\u7406\u4E2D (PROCESSING)"}),N("div",{"data-testid":"processing-count",style:{fontSize:"20px",fontWeight:700,color:"#1d4ed8"},children:E})]}),F("div",{"data-testid":"status-card-pending","data-count":I,style:{border:"1px solid #64748b",borderRadius:"6px",padding:"10px",backgroundColor:"#f8fafc"},children:[N("div",{style:{fontSize:"12px",color:"#334155"},children:"\u5F85\u6A5F\u4E2D (PENDING)"}),N("div",{"data-testid":"pending-count",style:{fontSize:"20px",fontWeight:700,color:"#475569"},children:I})]}),F("div",{"data-testid":"status-card-failed","data-count":k,style:{border:"1px solid #ef4444",borderRadius:"6px",padding:"10px",backgroundColor:"#fef2f2"},children:[N("div",{style:{fontSize:"12px",color:"#991b1b"},children:"\u5931\u6557 (FAILED)"}),N("div",{"data-testid":"failed-count",style:{fontSize:"20px",fontWeight:700,color:"#b91c1c"},children:k})]})]}),F("div",{"data-testid":"failed-items-section",children:[F("h3",{style:{margin:"0 0 8px 0",fontSize:"14px",color:"#334155"},"data-testid":"failed-items-heading",children:["\u540C\u671F\u5931\u6557\u30A2\u30A4\u30C6\u30E0\u4E00\u89A7 (",c.length<k?`\u4E0A\u4F4D ${c.length} \u4EF6 / \u5168 ${k} \u4EF6`:`${c.length} \u4EF6`,")"]}),c.length===0?N("p",{"data-testid":"no-failed-items-message",style:{margin:0,fontSize:"13px",color:"#64748b"},children:"\u73FE\u5728\u3001\u540C\u671F\u5931\u6557\u30A2\u30A4\u30C6\u30E0\u306F\u3042\u308A\u307E\u305B\u3093\u3002"}):N("div",{style:{overflowX:"auto"},children:F("table",{"data-testid":"failed-items-table",style:{width:"100%",borderCollapse:"collapse",fontSize:"13px"},children:[N("thead",{children:F("tr",{style:{borderBottom:"1px solid #e2e8f0",textAlign:"left",color:"#64748b"},children:[N("th",{style:{padding:"6px 8px"},children:"\u30D5\u30A1\u30A4\u30EB URI"}),N("th",{style:{padding:"6px 8px"},children:"\u72B6\u614B"}),N("th",{style:{padding:"6px 8px"},children:"\u30A8\u30E9\u30FC\u5185\u5BB9"}),N("th",{style:{padding:"6px 8px"},children:"\u5931\u6557\u65E5\u6642"}),N("th",{style:{padding:"6px 8px",textAlign:"right"},children:"\u64CD\u4F5C"})]})}),N("tbody",{children:c.map(u=>F("tr",{"data-testid":`failed-item-row-${u.id}`,"data-file-uri":u.file_uri,style:{borderBottom:"1px solid #f1f5f9"},children:[F("td",{"data-testid":`failed-item-uri-${u.id}`,style:{padding:"8px",wordBreak:"break-all"},children:[N("div",{style:{fontWeight:600,color:"#0f172a"},children:u.file_name}),N("div",{style:{fontSize:"11px",color:"#64748b"},children:u.file_uri})]}),N("td",{style:{padding:"8px"},children:N("span",{"data-testid":`failed-item-status-${u.id}`,style:{fontSize:"11px",padding:"2px 6px",borderRadius:"4px",backgroundColor:"#fee2e2",color:"#991b1b",fontWeight:500},children:u.sync_status})}),N("td",{"data-testid":`failed-item-error-${u.id}`,style:{padding:"8px",color:"#dc2626",maxWidth:"260px",wordBreak:"break-word"},title:u.error_message??"",children:u.error_message??"\u4E0D\u660E\u306A\u30A8\u30E9\u30FC"}),N("td",{"data-testid":`failed-item-time-${u.id}`,style:{padding:"8px",color:"#64748b",whiteSpace:"nowrap"},children:u.failed_at??"\u8A18\u9332\u306A\u3057"}),N("td",{style:{padding:"8px",textAlign:"right"},children:l&&N("button",{type:"button","data-testid":`retry-item-button-${u.id}`,"aria-label":`${u.file_name} (${u.file_uri}) \u3092\u518D\u8A66\u884C`,disabled:p,onClick:()=>l(u.id,u.file_uri),style:{padding:"4px 8px",borderRadius:"4px",border:"1px solid #dc2626",backgroundColor:"#ffffff",color:"#dc2626",cursor:p?"not-allowed":"pointer",fontSize:"12px"},children:"\u518D\u8A66\u884C"})})]},u.id))})]})})]})]})}export{We as DegradedSearchBanner,Vt as DocumentIngestConsole,Yt as EnrichmentStrategyBoard,ta as InfrastructureHealthMonitor,oa as MetadataSearchWorkbench,ca as OntologyStatusCard,ua as QdrantStorageCard,ba as RAGPipelineGraphViewer,yt as REASON_LABELS,it as SEARCH_MODE_LABELS,Ft as SEARCH_PRESETS,ha as SyncStatusMonitor,Ze as gateStateOf,Et as ingestRowAction};
1
+ import{jsx as lt,jsxs as ht}from"react/jsx-runtime";var Fa={empty_query:"\u691C\u7D22\u8A9E\u304C\u7A7A\u306E\u305F\u3081\u3001\u610F\u5473\u691C\u7D22\u306F\u5B9F\u884C\u3057\u3066\u3044\u307E\u305B\u3093\u3002",caller_token_unavailable:"\u8A8D\u8A3C\u60C5\u5831\u3092\u53D6\u5F97\u3067\u304D\u306A\u304B\u3063\u305F\u305F\u3081\u3001\u610F\u5473\u691C\u7D22\u306F\u5B9F\u884C\u3057\u3066\u3044\u307E\u305B\u3093\u3002\u518D\u8AAD\u307F\u8FBC\u307F\u3057\u3066\u304F\u3060\u3055\u3044\u3002",time_window_unsupported:"\u671F\u9593\u306E\u7D5E\u308A\u8FBC\u307F\u306F\u610F\u5473\u691C\u7D22\u3067\u306F\u6307\u5B9A\u3067\u304D\u306A\u3044\u305F\u3081\u3001\u30AD\u30FC\u30EF\u30FC\u30C9\u4E00\u81F4\u306E\u307F\u3067\u8868\u793A\u3057\u3066\u3044\u307E\u3059\u3002",vector_tier_not_configured:"\u30D9\u30AF\u30C8\u30EB\u691C\u7D22\u304C\u3053\u306E\u914D\u5099\u3067\u69CB\u6210\u3055\u308C\u3066\u3044\u307E\u305B\u3093\u3002",graph_tier_not_configured:"\u30B0\u30E9\u30D5\u691C\u7D22\u304C\u3053\u306E\u914D\u5099\u3067\u69CB\u6210\u3055\u308C\u3066\u3044\u307E\u305B\u3093\u3002",no_active_vector_collection:"\u6709\u52B9\u306A\u30D9\u30AF\u30C8\u30EB\u30B3\u30EC\u30AF\u30B7\u30E7\u30F3\u304C 1 \u3064\u3082\u306A\u3044\u305F\u3081\u3001\u610F\u5473\u691C\u7D22\u306F\u5B9F\u884C\u3057\u3066\u3044\u307E\u305B\u3093\u3002",vector_collections_missing:"\u30D9\u30AF\u30C8\u30EB\u30B3\u30EC\u30AF\u30B7\u30E7\u30F3\u304C\u672A\u4F5C\u6210\u306E\u305F\u3081\u3001\u610F\u5473\u691C\u7D22\u306F\u5B9F\u884C\u3057\u3066\u3044\u307E\u305B\u3093\u3002\u6587\u66F8\u306E\u6295\u5F71\u304C\u5B8C\u4E86\u3059\u308B\u3068\u89E3\u6D88\u3057\u307E\u3059\u3002",remote_tiers_unavailable:"\u691C\u7D22\u88DC\u52A9\u30B5\u30FC\u30D3\u30B9\u306B\u63A5\u7D9A\u3067\u304D\u306A\u3044\u304B\u3001\u505C\u6B62\u4E2D\u3067\u3059\u3002\u30AD\u30FC\u30EF\u30FC\u30C9\u4E00\u81F4\u306E\u307F\u3067\u8868\u793A\u3057\u3066\u3044\u307E\u3059\u3002",remote_tiers_timed_out:"\u691C\u7D22\u88DC\u52A9\u30B5\u30FC\u30D3\u30B9\u304C\u6642\u9593\u5185\u306B\u7B54\u3048\u307E\u305B\u3093\u3067\u3057\u305F\u3002\u30AD\u30FC\u30EF\u30FC\u30C9\u4E00\u81F4\u306E\u307F\u3067\u8868\u793A\u3057\u3066\u3044\u307E\u3059\u3002\u518D\u8A66\u884C\u3059\u308B\u304B\u6761\u4EF6\u3092\u7D5E\u3063\u3066\u304F\u3060\u3055\u3044\u3002",remote_tiers_refused_caller:"\u691C\u7D22\u88DC\u52A9\u30B5\u30FC\u30D3\u30B9\u304C\u3053\u306E\u5229\u7528\u8005\u306E\u8981\u6C42\u3092\u62D2\u5426\u3057\u307E\u3057\u305F (\u8A8D\u8A3C\u307E\u305F\u306F\u6A29\u9650)\u3002\u518D\u30B5\u30A4\u30F3\u30A4\u30F3\u3059\u308B\u304B\u3001\u6A29\u9650\u3092\u78BA\u8A8D\u3057\u3066\u304F\u3060\u3055\u3044\u3002",remote_tiers_rejected_request:"\u691C\u7D22\u88DC\u52A9\u30B5\u30FC\u30D3\u30B9\u304C\u691C\u7D22\u6761\u4EF6\u3092\u53D7\u3051\u4ED8\u3051\u307E\u305B\u3093\u3067\u3057\u305F\u3002\u6761\u4EF6\u3092\u898B\u76F4\u3057\u3066\u304F\u3060\u3055\u3044\u3002",remote_tiers_failed:"\u691C\u7D22\u88DC\u52A9\u30B5\u30FC\u30D3\u30B9\u304C\u51E6\u7406\u4E2D\u306B\u5931\u6557\u3057\u307E\u3057\u305F\u3002\u30AD\u30FC\u30EF\u30FC\u30C9\u4E00\u81F4\u306E\u307F\u3067\u8868\u793A\u3057\u3066\u3044\u307E\u3059\u3002\u7D9A\u304F\u5834\u5408\u306F\u7BA1\u7406\u8005\u3078\u9023\u7D61\u3057\u3066\u304F\u3060\u3055\u3044\u3002",remote_tiers_not_executed:"\u610F\u5473\u691C\u7D22\u304C\u5B9F\u884C\u3055\u308C\u307E\u305B\u3093\u3067\u3057\u305F (\u7406\u7531\u306F\u5831\u544A\u3055\u308C\u3066\u3044\u307E\u305B\u3093)\u3002",vector_search_disabled:"\u30D9\u30AF\u30C8\u30EB\u691C\u7D22\u304C\u7BA1\u7406\u8005\u306B\u3088\u308A\u7121\u52B9\u5316\u3055\u308C\u3066\u3044\u307E\u3059\u3002",graph_search_disabled:"\u30B0\u30E9\u30D5\u691C\u7D22\u304C\u7BA1\u7406\u8005\u306B\u3088\u308A\u7121\u52B9\u5316\u3055\u308C\u3066\u3044\u307E\u3059\u3002","circuit_breaker_open:vector":"\u30D9\u30AF\u30C8\u30EB\u691C\u7D22\u304C\u4E00\u6642\u7684\u306B\u906E\u65AD\u3055\u308C\u3066\u3044\u307E\u3059\u3002","circuit_breaker_open:graph":"\u30B0\u30E9\u30D5\u691C\u7D22\u304C\u4E00\u6642\u7684\u306B\u906E\u65AD\u3055\u308C\u3066\u3044\u307E\u3059\u3002"};function Ut({metadata:e,onDismiss:t}){if(!e.is_degraded)return null;let o=(e.degradation_reason??"").split(",").map(d=>d.trim()).filter(d=>d.length>0);return lt("div",{role:"status","data-testid":"degraded-search-banner","data-quality-tier":e.quality_tier,"data-search-mode":e.search_mode,"data-degraded":"true",style:{padding:"12px 16px",borderRadius:"6px",border:"1px solid #f59e0b",backgroundColor:"#fffbeb",color:"#92400e",marginBottom:"12px"},children:ht("div",{style:{display:"flex",justifyContent:"space-between",alignItems:"flex-start"},children:[ht("div",{children:[ht("p",{"data-testid":"degraded-mode-message",style:{margin:0,fontWeight:600},children:["\u691C\u7D22\u7D50\u679C\u306F\u7E2E\u9000\u30E2\u30FC\u30C9 (",e.search_mode,") \u3067\u53D6\u5F97\u3055\u308C\u3066\u3044\u307E\u3059\u3002"]}),o.length>0&&lt("ul",{"data-testid":"degraded-reason-list",style:{margin:"6px 0 0 0",paddingLeft:"20px"},children:o.map(d=>lt("li",{"data-testid":`degraded-reason-${d}`,children:Fa[d]??d},d))})]}),t&&lt("button",{type:"button","data-testid":"degraded-banner-dismiss",onClick:t,"aria-label":"\u9589\u3058\u308B",style:{background:"none",border:"none",cursor:"pointer",color:"#92400e",fontWeight:"bold",fontSize:"14px",padding:"2px 6px"},children:"\u2715"})]})})}import{ConfidentialityLevelSchema as Qa,EnrichmentSyncStatusSchema as ta,PIPELINE_STEPS as Xa,QUARANTINED_CONFIDENTIALITY_LEVEL as Yt}from"@aiquants/enrichment-core";import{useId as Me,useMemo as Zt,useState as ke}from"react";import{formatCount as Ka}from"@aiquants/console-ui/core";function Fe(e,t,n){try{Ka(e,n)}catch(o){throw new RangeError(`${t}: ${o.message}`,{cause:o})}return e}var Gt=1024,Ba=[{name:"B",power:0,fractionDigits:0},{name:"KiB",power:1,fractionDigits:1},{name:"MiB",power:2,fractionDigits:1},{name:"GiB",power:3,fractionDigits:2},{name:"TiB",power:4,fractionDigits:2}];function qt(e,t){return Number((e/Gt**t.power).toFixed(t.fractionDigits))}function ct(e,t,n){Fe(e,t,n);let[o,...d]=Ba,i=o,m=qt(e,i);for(let u of d){if(m<Gt)break;i=u,m=qt(e,i)}return`${new Intl.NumberFormat(n,{minimumFractionDigits:i.fractionDigits,maximumFractionDigits:i.fractionDigits,useGrouping:!0}).format(m)} ${i.name}`}import{Measured as Ua,RowButton as qa,useConsoleUi as Ga}from"@aiquants/console-ui";import{createElement as Vt}from"react";var Ze="ja-JP";function se(){let e=Ga();if(e.locale!=="ja"||e.formatLocale!==Ze)throw new RangeError(`The ConsoleUiRoot must be locale "${"ja"}" and formatLocale "${Ze}", the language and format of this package's text (got locale "${e.locale}" and formatLocale "${e.formatLocale}")`);return e}function H(e){return se(),Vt(Ua,e)}function zt(e){return se(),Vt(qa,e)}import{jsx as pt}from"react/jsx-runtime";var Nt=/[^\s\x1c-\x1f\x85\ufeff]/,Ha={fontVariantNumeric:"tabular-nums"},Va={fontVariantNumeric:"tabular-nums",whiteSpace:"nowrap"};function Wt({text:e,testId:t,slot:n}){if(se(),e===null)return pt(H,{value:null,testId:t});if(!Nt.test(e))throw new RangeError(`${t}: a measured text must not be empty or only white space (pass null when the value was not measured)`);return pt("span",{"data-measured":"true","data-testid":t,style:n,children:e})}function et({text:e,testId:t}){return pt(Wt,{text:e,testId:t,slot:Ha})}function Re({text:e,testId:t}){return pt(Wt,{text:e,testId:t,slot:Va})}import{PIPELINE_STEPS as za,parseSkipReason as Wa}from"@aiquants/enrichment-core";var je={RUNNING:{label:"\u5B9F\u884C\u4E2D",className:"bg-blue-100 text-blue-800"},SUCCEEDED:{label:"\u6210\u529F",className:"bg-emerald-100 text-emerald-800"},FAILED:{label:"\u5931\u6557",className:"bg-red-100 text-red-800"},FAILED_RETRY_SCHEDULED:{label:"\u5931\u6557 (\u518D\u8A66\u884C\u4E88\u5B9A)",className:"bg-amber-100 text-amber-800"}},St={RUNNING:{label:"\u5B9F\u884C\u4E2D",className:"bg-blue-100 text-blue-800",bar:"bg-blue-400"},SUCCEEDED:{label:"\u6210\u529F",className:"bg-emerald-100 text-emerald-800",bar:"bg-emerald-500"},SKIPPED:{label:"\u7701\u7565",className:"bg-slate-100 text-slate-700",bar:"bg-slate-300"},FAILED:{label:"\u5931\u6557",className:"bg-red-100 text-red-800",bar:"bg-red-500"}},wt={ingest:"\u53D6\u308A\u8FBC\u307F",retry:"\u518D\u8A66\u884C",resync:"\u518D\u540C\u671F"},jt="\u672A\u5B8C\u4E86";function Ke(e){return e.status==="FAILED"&&e.retryScheduled?"FAILED_RETRY_SCHEDULED":e.status}var ja={no_pages:"\u8AAD\u3080\u5BFE\u8C61\u306A\u3057 (\u30DA\u30FC\u30B8\u306A\u3057)",no_pages_rendered:"\u8AAD\u3080\u5BFE\u8C61\u306A\u3057 (\u63CF\u753B\u3067\u304D\u305F\u30DA\u30FC\u30B8\u306A\u3057)"};function Jt(e){let t=Wa(e);if(t===null)return e;switch(t.kind){case"gate_closed":return`${t.featureFlagKey} \u304C\u7121\u52B9`;case"no_children":return"\u5B50\u30A2\u30BB\u30C3\u30C8\u306A\u3057";case"source_skipped":return`${za[t.stepKey].label} \u304C\u5B9F\u884C\u3055\u308C\u306A\u304B\u3063\u305F`;case"nothing_to_read":return ja[t.token]}}import{formatInstant as Ja}from"@aiquants/console-ui/core";function Qt(e,t){return Ja(e,Ze,t)}import{jsx as Xt}from"react/jsx-runtime";function we({iso:e,testId:t}){let{timeZone:n}=se();return Xt(Re,{text:e===null?null:Qt(e,n),testId:t})}function ut({iso:e,testId:t}){return se(),e===null?jt:Xt(we,{iso:e,testId:t})}import{Fragment as ss,jsx as r,jsxs as g}from"react/jsx-runtime";var Ya=new Set(ta.options.filter(e=>e.startsWith("FAILED"))),Za=new Set(ta.options);function es(e){return e.isCurrent===!1?{kind:"blocked",reason:"\u65E7\u7248\u306E\u305F\u3081\u518D\u5B9F\u884C\u4E0D\u53EF"}:e.syncStatus==="SYNCED"?{kind:"resync"}:Ya.has(e.syncStatus)?{kind:"retry"}:Za.has(e.syncStatus)?{kind:"blocked",reason:"\u51E6\u7406\u4E2D"}:{kind:"blocked",reason:"\u4E0D\u660E\u306A\u72B6\u614B"}}function ea(e,t,n){let o=e?.find(d=>d.confidentialityLevel===t&&d.capability===n);return o?o.isEnabled:null}var ts={PUBLIC:"\u5168\u516C\u958B",INTERNAL:"\u793E\u5185\u5171\u6709",DEPARTMENT:"\u90E8\u9580\u9650\u5B9A",CONFIDENTIAL:"\u6A5F\u5BC6 - \u65E2\u5B9A",RESTRICTED:"\u691C\u7D22\u5B8C\u5168\u9664\u5916\u30FB\u4FDD\u8B77"},as=["\u5951\u7D04\u66F8","\u6C7A\u7B97\u77ED\u4FE1","\u6280\u8853\u4ED5\u69D8\u66F8","\u793E\u5185\u898F\u7A0B","\u8B70\u4E8B\u9332","\u4EBA\u4E8B\u65B9\u91DD"];function kt({field:e}){return r("span",{className:"text-red-700","data-testid":`ingest-required-mark-${e}`,children:"*"})}function On({policies:e,tenantId:t,domainOptions:n,recentItems:o=[],inspectionResult:d=null,isSubmitting:i=!1,isInspecting:m=!1,onInspectUri:u,onIngestDocument:y,onRetryItem:h,onShowHistory:v}){let{formatLocale:C}=se(),N=Me(),X=Me(),oe=Me(),Y=Me(),S=Me(),V=Me(),E=Me(),B=Me(),[M,P]=ke("gdrive://"),[z,b]=ke(""),[$,q]=ke(""),[O,ce]=ke("CONFIDENTIAL"),[te,xe]=ke(null),[ve,I]=ke(""),[ue,W]=ke(""),[Z,G]=ke([]),[he,le]=ke(""),[Ee,$e]=ke("user"),[me,Ne]=ke(1),[l,T]=ke(!1),ae=te!==null&&n.some(s=>s.key===te)?te:n.length>0?n[0].key:null,J=Zt(()=>({vectorEnabled:ea(e,O,"vector_indexing"),graphEnabled:ea(e,O,"graph_indexing")}),[e,O]),de=Zt(()=>{let s=$.trim();if(!s)return{valid:!1,error:null};if(!(s.startsWith("file://")||s.startsWith("gdrive://")||s.startsWith("gcs://")))return{valid:!1,error:"\u8A31\u53EF\u3055\u308C\u305F\u30B9\u30AD\u30FC\u30E0 (file://, gdrive://, gcs://) \u3067\u59CB\u307E\u308B\u5FC5\u8981\u304C\u3042\u308A\u307E\u3059\u3002"};let Q=s.replace(/^(file|gdrive|gcs):\/\//,"");return!Q.trim()||Q.trim()==="<id>"||Q.trim()==="<bucket>/<key>"?{valid:!1,error:"URI \u306E\u30D1\u30B9\u90E8\u5206\u304C\u6307\u5B9A\u3055\u308C\u3066\u3044\u307E\u305B\u3093\u3002"}:s.includes("..")?{valid:!1,error:"\u76F8\u5BFE\u30D1\u30B9\u8A18\u53F7 (..) \u306B\u3088\u308B\u30D1\u30B9\u30C8\u30E9\u30D0\u30FC\u30B5\u30EB\u306F\u7981\u6B62\u3055\u308C\u3066\u3044\u307E\u3059\u3002"}:{valid:!0,error:null}},[$]),He=s=>{let w=s.trim(),Q=w.match(/\/file\/d\/([a-zA-Z0-9_-]+)/);if(Q)return Q[1];let Se=w.match(/[?&]id=([a-zA-Z0-9_-]+)/);return Se?Se[1]:null},Te=s=>{if(P(s),z.trim()){let w=z.trim().replace(/^(file|gdrive|gcs):\/\//,"");q(`${s}${w}`)}else q("")},Ve=s=>{let w=s.trim();if(!w){b(""),q("");return}let Q=He(w);if(Q){P("gdrive://"),b(Q),q(`gdrive://${Q}`);return}if(w.startsWith("gdrive://")){P("gdrive://");let Se=w.replace(/^gdrive:\/\//,"");b(Se),q(w);return}if(w.startsWith("file://")){P("file://");let Se=w.replace(/^file:\/\//,"");b(Se),q(w);return}if(w.startsWith("gcs://")){P("gcs://");let Se=w.replace(/^gcs:\/\//,"");b(Se),q(w);return}if(w.includes("://")){b(s),q(w);return}b(s),q(`${M}${w}`)},_e=s=>{switch(s){case"gdrive://":return"1EXAMPLEFILEID0000000000000000000 (\u30D5\u30A1\u30A4\u30EB ID \u307E\u305F\u306F\u5171\u6709\u30EA\u30F3\u30AF)";case"file://":return"/srv/documents/specification.md (\u7D76\u5BFE\u30D1\u30B9)";case"gcs://":return"my-bucket/documents/report.pdf (\u30D0\u30B1\u30C3\u30C8\u540D/\u30D1\u30B9)"}},F=()=>{let s=he.trim();s&&(Z.some(w=>w.labelKey===s)||(G(w=>[...w,{labelKey:s,category:Ee,confidenceScore:Number(me.toFixed(2))}]),le("")))},ze=s=>{Z.some(w=>w.labelKey===s)||G(w=>[...w,{labelKey:s,category:"domain",confidenceScore:1}])},Ie=s=>{G(w=>w.filter(Q=>Q.labelKey!==s))},it=s=>{if(s.preventDefault(),!de.valid||ae===null)return;let w={fileUri:$.trim(),confidentialityLevel:O,targetDomainKey:ae,departmentId:ve.trim()?Number(ve):null,titleOverride:ue.trim()?ue.trim():null,labels:Z};y?.(w)},We=s=>{let w=es(s);if(w.kind==="blocked")return r("span",{className:"font-sans text-[11px] text-slate-500","data-testid":`ingest-action-blocked-${s.id}`,"data-reason":w.reason,children:w.reason});let Q=w.kind==="retry";return r("button",{type:"button",onClick:()=>h?.(s.id),"aria-label":`${s.fileName} \u3092${Q?"\u518D\u8A66\u884C":"\u518D\u540C\u671F"}`,className:Q?"rounded-sm border border-red-200 border-solid bg-red-50 px-2 py-1 font-semibold text-red-700 text-xs hover:bg-red-100":"rounded-sm border border-emerald-200 border-solid bg-emerald-50 px-2 py-1 font-semibold text-emerald-700 text-xs hover:bg-emerald-100","data-testid":`ingest-${w.kind}-button-${s.id}`,children:Q?"\u518D\u8A66\u884C":"\u518D\u540C\u671F"})},yt=s=>{switch(s){case"SYNCED":return r("span",{className:"inline-flex items-center rounded-full bg-emerald-100 px-2.5 py-0.5 font-semibold text-emerald-800 text-xs",children:"\u540C\u671F\u5B8C\u4E86"});case"PENDING":return r("span",{className:"inline-flex items-center rounded-full bg-slate-100 px-2.5 py-0.5 font-medium text-slate-800 text-xs",children:"\u5F85\u6A5F\u4E2D"});case"EXTRACTING":return r("span",{className:"inline-flex items-center rounded-full bg-blue-100 px-2.5 py-0.5 font-medium text-blue-800 text-xs",children:"\u672C\u6587\u62BD\u51FA\u4E2D"});case"ENRICHING":return r("span",{className:"inline-flex items-center rounded-full bg-purple-100 px-2.5 py-0.5 font-medium text-purple-800 text-xs",children:"AI \u8981\u7D04\u30FB\u69CB\u9020\u5316\u4E2D"});case"PROJECTING":return r("span",{className:"inline-flex items-center rounded-full bg-indigo-100 px-2.5 py-0.5 font-medium text-indigo-800 text-xs",children:"\u30D9\u30AF\u30C8\u30EB/\u30B0\u30E9\u30D5\u6295\u5F71\u4E2D"});default:return s.startsWith("FAILED")?g("span",{className:"inline-flex items-center rounded-full bg-red-100 px-2.5 py-0.5 font-semibold text-red-800 text-xs",children:["\u5931\u6557: ",s]}):r("span",{className:"inline-flex items-center rounded-full bg-slate-100 px-2.5 py-0.5 font-medium text-slate-800 text-xs",children:s})}};return g("div",{className:"space-y-6","data-testid":"document-ingest-console",children:[g("div",{className:"rounded-xl border border-slate-200 border-solid bg-white p-6 shadow-sm",children:[g("div",{className:"flex flex-col justify-between gap-2 md:flex-row md:items-center",children:[g("div",{children:[r("h2",{className:"font-bold text-base text-slate-900",children:"\u30C9\u30AD\u30E5\u30E1\u30F3\u30C8\u53D6\u308A\u8FBC\u307F & \u30E1\u30BF\u30C7\u30FC\u30BF\u751F\u6210"}),r("p",{className:"mt-1 text-slate-500 text-sm",children:"\u5BFE\u8C61 URI \u3092\u6307\u5B9A\u3057\u3066\u672C\u6587\u62BD\u51FA\u30FBAI \u8981\u7D04\u30FB\u69CB\u9020\u5316\u30E1\u30BF\u30C7\u30FC\u30BF\u4ED8\u4E0E\u30FBQdrant \u30D9\u30AF\u30C8\u30EB\u304A\u3088\u3073 Neo4j \u30B0\u30E9\u30D5\u3078\u306E\u6295\u5F71\u3092\u5B9F\u884C\u3057\u307E\u3059\u3002"})]}),g("div",{className:"inline-flex items-center rounded-lg border border-slate-200 border-solid bg-slate-50 px-3 py-1.5 font-medium text-slate-600 text-xs",children:["\u30C6\u30CA\u30F3\u30C8: ",r("span",{className:"ml-1.5 font-bold text-slate-800",children:t})]})]}),g("form",{onSubmit:it,className:"mt-6 space-y-6",children:[g("div",{className:"space-y-3","data-testid":"document-uri-input-group",children:[g("div",{className:"flex flex-wrap items-center justify-between gap-2",children:[g("label",{htmlFor:N,className:"block font-semibold text-slate-800 text-sm",children:["\u30D5\u30A1\u30A4\u30EB URI / \u30EA\u30BD\u30FC\u30B9\u8B58\u5225\u5B50 ",r(kt,{field:"uri"})]}),g("span",{className:"font-mono text-slate-500 text-xs",children:["\u9078\u629E\u30B9\u30AD\u30FC\u30E0: ",r("strong",{className:"font-semibold text-indigo-600",children:M})]})]}),g("div",{className:"flex flex-wrap items-center gap-2",children:[r("span",{className:"font-medium text-slate-500 text-xs",children:"\u30B9\u30AD\u30FC\u30E0\u6307\u5B9A:"}),r("button",{type:"button",onClick:()=>Te("gdrive://"),className:`rounded-sm border border-solid px-2.5 py-1 font-mono text-xs transition-colors ${M==="gdrive://"?"border-indigo-600 bg-indigo-50 font-semibold text-indigo-700 shadow-sm":"border-slate-200 bg-slate-100 text-slate-700 hover:bg-slate-200"}`,"data-testid":"scheme-select-gdrive",children:"gdrive:// (Google Drive)"}),r("button",{type:"button",onClick:()=>Te("file://"),className:`rounded-sm border border-solid px-2.5 py-1 font-mono text-xs transition-colors ${M==="file://"?"border-indigo-600 bg-indigo-50 font-semibold text-indigo-700 shadow-sm":"border-slate-200 bg-slate-100 text-slate-700 hover:bg-slate-200"}`,"data-testid":"scheme-select-file",children:"file:// (\u30ED\u30FC\u30AB\u30EB)"}),r("button",{type:"button",onClick:()=>Te("gcs://"),className:`rounded-sm border border-solid px-2.5 py-1 font-mono text-xs transition-colors ${M==="gcs://"?"border-indigo-600 bg-indigo-50 font-semibold text-indigo-700 shadow-sm":"border-slate-200 bg-slate-100 text-slate-700 hover:bg-slate-200"}`,"data-testid":"scheme-select-gcs",children:"gcs:// (GCS)"})]}),g("div",{className:"space-y-1.5",children:[g("div",{className:"flex flex-wrap gap-2 sm:flex-nowrap",children:[g("div",{className:`flex min-w-0 grow basis-full rounded-lg border border-solid shadow-sm transition-colors focus-within:ring-2 sm:basis-0 ${de.error?"border-red-300 focus-within:border-red-500 focus-within:ring-red-200":"border-slate-300 focus-within:border-indigo-500 focus-within:ring-indigo-100"}`,children:[r("span",{className:"inline-flex select-none items-center rounded-l-lg border-slate-200 border-r border-solid bg-slate-50 px-3.5 font-mono font-semibold text-slate-700 text-sm","data-testid":"scheme-prefix-badge",children:M}),r("input",{id:N,type:"text",value:z,onChange:s=>Ve(s.target.value),placeholder:_e(M),"aria-invalid":!!de.error,"aria-describedby":de.error?"ingest-uri-error":void 0,className:"min-w-0 flex-1 rounded-r-lg px-3.5 py-2 font-mono text-sm focus:outline-none","data-testid":"ingest-file-uri-input",required:!0})]}),r("button",{type:"button",onClick:()=>u?.($.trim()),disabled:!de.valid||m,className:"inline-flex items-center justify-center rounded-lg border border-slate-300 border-solid bg-white px-4 py-2 font-medium text-slate-700 text-sm shadow-sm hover:bg-slate-50 disabled:opacity-50","data-testid":"ingest-inspect-uri-button",children:m?"\u691C\u8A3C\u4E2D...":"URI \u4E8B\u524D\u691C\u8A3C"})]}),g("div",{className:"flex flex-wrap items-center justify-between gap-1 text-xs",children:[g("p",{className:"text-slate-500",children:[M==="gdrive://"&&"Google Drive \u306E\u30D5\u30A1\u30A4\u30EB ID (\u4F8B: 1EXAMPLEFILEID0000000000000000000) \u307E\u305F\u306F URL \u3092\u8CBC\u308A\u4ED8\u3051\u308B\u3068\u81EA\u52D5\u62BD\u51FA\u3055\u308C\u307E\u3059\u3002",M==="file://"&&"\u30EF\u30FC\u30AF\u30B9\u30DA\u30FC\u30B9\u5185\u306E\u7D76\u5BFE\u30D1\u30B9 (\u4F8B: /srv/documents/sample.md) \u3092\u6307\u5B9A\u3057\u3066\u304F\u3060\u3055\u3044\u3002",M==="gcs://"&&"GCS \u306E\u30D0\u30B1\u30C3\u30C8\u540D/\u30AA\u30D6\u30B8\u30A7\u30AF\u30C8\u30D1\u30B9 (\u4F8B: my-bucket/documents/report.pdf) \u3092\u6307\u5B9A\u3057\u3066\u304F\u3060\u3055\u3044\u3002"]}),$&&g("div",{className:"flex items-center gap-1 font-mono text-slate-500",children:[r("span",{children:"\u89E3\u6C7A URI:"}),r("code",{className:"rounded-sm bg-slate-100 px-1.5 py-0.5 font-bold text-indigo-700","data-testid":"resolved-uri-code",children:$})]})]})]}),de.error&&r("p",{id:"ingest-uri-error",className:"text-red-600 text-xs",role:"alert","data-testid":"ingest-uri-error",children:de.error})]}),d&&d.fileUri===$.trim()&&g("section",{"aria-live":"polite","aria-label":"\u30EA\u30BD\u30FC\u30B9\u691C\u8A3C\u7D50\u679C",className:`rounded-lg border border-solid p-4 text-sm transition-all ${d.exists?"border-emerald-200 bg-emerald-50/60 text-emerald-950":"border-red-200 bg-red-50/60 text-red-950"}`,"data-testid":"inspection-result-card",children:[g("div",{className:"flex items-center justify-between",children:[r("span",{className:"font-semibold",children:d.exists?"\u2713 \u30EA\u30BD\u30FC\u30B9\u78BA\u8A8D\u5B8C\u4E86 (\u30A2\u30AF\u30BB\u30B9\u53EF\u80FD)":"\u26A0 \u30EA\u30BD\u30FC\u30B9\u4E0D\u9054 (\u30D5\u30A1\u30A4\u30EB\u304C\u898B\u3064\u304B\u308A\u307E\u305B\u3093)"}),r("span",{className:"font-mono text-slate-500 text-xs",children:d.fileUri})]}),d.exists&&g("div",{className:"mt-2 grid grid-cols-2 gap-4 font-mono text-xs md:grid-cols-4",children:[g("div",{children:[r("span",{className:"block text-slate-500",children:"\u30D5\u30A1\u30A4\u30EB\u540D:"}),r("span",{className:"font-semibold text-slate-800",children:d.fileName})]}),g("div",{children:[r("span",{className:"block text-slate-500",children:"\u30B5\u30A4\u30BA:"}),r("span",{className:"font-semibold text-slate-800",children:r(Re,{text:ct(d.fileSize,"fileSize",C),testId:"inspection-file-size-value"})})]}),g("div",{children:[r("span",{className:"block text-slate-500",children:"MIME:"}),r("span",{className:"font-semibold text-slate-800",children:d.mimeType})]}),g("div",{children:[r("span",{className:"block text-slate-500",children:"\u30EA\u30D3\u30B8\u30E7\u30F3:"}),r("span",{className:"font-semibold text-slate-800",children:d.revisionId?.slice(0,8)??"N/A"})]})]})]}),g("div",{className:"grid grid-cols-1 gap-4 md:grid-cols-3",children:[g("div",{className:"space-y-1",children:[g("label",{htmlFor:X,className:"block font-semibold text-slate-700 text-xs",children:["\u6A5F\u5BC6\u533A\u5206 (Confidentiality Level) ",r(kt,{field:"confidentiality"})]}),r("select",{id:X,value:O,onChange:s=>ce(s.target.value),className:"w-full rounded-lg border border-slate-300 border-solid bg-white px-3 py-2 text-slate-800 text-sm focus:border-indigo-500 focus:outline-none focus:ring-1 focus:ring-indigo-500","data-testid":"ingest-confidentiality-select",children:Qa.options.map(s=>g("option",{value:s,children:[s," (",ts[s],")"]},s))})]}),g("div",{className:"space-y-1",children:[g("label",{htmlFor:oe,className:"block font-semibold text-slate-700 text-xs",children:["\u5BFE\u8C61\u30C9\u30E1\u30A4\u30F3 (Target Domain) ",r(kt,{field:"domain"})]}),r("select",{id:oe,value:ae===null?"":ae,onChange:s=>xe(s.target.value),disabled:n.length===0,className:"w-full rounded-lg border border-slate-300 border-solid bg-white px-3 py-2 text-slate-800 text-sm focus:border-indigo-500 focus:outline-none focus:ring-1 focus:ring-indigo-500 disabled:cursor-not-allowed disabled:bg-slate-100","data-testid":"ingest-domain-select",children:n.map(s=>r("option",{value:s.key,children:s.label},s.key))}),n.length===0&&r("p",{className:"text-[11px] text-amber-800","data-testid":"ingest-domain-empty",children:"\u9078\u3079\u308B\u30C9\u30E1\u30A4\u30F3\u304C\u6E21\u3055\u308C\u3066\u3044\u307E\u305B\u3093\u3002\u30C9\u30E1\u30A4\u30F3\u304C\u7121\u3044\u3068\u53D6\u308A\u8FBC\u307F\u306F\u6295\u5165\u3067\u304D\u307E\u305B\u3093\u3002"})]})]}),O===Yt&&g("div",{className:"rounded-lg border border-amber-300 border-solid bg-amber-50 p-3 text-amber-900 text-xs",role:"alert","data-testid":"restricted-warning-banner",children:[r("span",{className:"font-bold",children:"\u3010\u9694\u96E2\u6CE8\u610F\u3011"})," ",Yt," \u306B\u8A2D\u5B9A\u3055\u308C\u305F\u6587\u66F8\u306F\u3001\u6CD5\u4EE4\u9075\u5B88\u30FB\u4FC2\u4E89\u4FDD\u5168\u306E\u305F\u3081\u691C\u7D22\u7D50\u679C\u306B\u4E00\u5207\u51FA\u73FE\u3057\u307E\u305B\u3093\u3002\u3053\u308C\u306F\u8A2D\u5B9A\u3067\u306F\u306A\u304F\u4FDD\u8A3C\u3067\u3042\u308A\u3001\u30DD\u30EA\u30B7\u30FC\u306E\u5024\u306B\u4F9D\u3089\u305A\u5E38\u306B\u6210\u7ACB\u3057\u307E\u3059\u3002",r("span",{className:"mt-1 block text-amber-800",children:"\u7D22\u5F15\u305D\u306E\u3082\u306E\u3092\u884C\u3046\u304B\u3069\u3046\u304B\u306F\u5225\u306E\u8A2D\u5B9A\u3067\u3059 (\u4E0B\u306E\u6295\u5F71\u5148\u3092\u53C2\u7167)\u3002\u7D22\u5F15\u3055\u308C\u305F\u6587\u66F8\u3082\u691C\u7D22\u7D50\u679C\u306B\u306F\u73FE\u308C\u307E\u305B\u3093\u3002"})]}),g("div",{className:"space-y-2 rounded-lg border border-indigo-100 border-solid bg-indigo-50/30 p-4","data-testid":"projection-capability-card",children:[r("span",{className:"block font-semibold text-indigo-950 text-xs",children:"\u3053\u306E\u6A5F\u5BC6\u533A\u5206\u306B\u5BFE\u3059\u308B\u6295\u5F71\u306E\u53EF\u5426 (Projection)"}),g("div",{className:"grid grid-cols-1 gap-3 sm:grid-cols-2",children:[g("div",{className:"rounded-sm border border-indigo-200/80 border-solid bg-white p-2.5",children:[r("span",{className:"block font-semibold text-slate-600 text-xs",children:"\u30D9\u30AF\u30C8\u30EB\u7D22\u5F15 (Qdrant)"}),r("span",{className:"mt-1 block font-bold text-xs","data-testid":"projection-vector-state","data-state":J.vectorEnabled===null?"unknown":String(J.vectorEnabled),children:J.vectorEnabled===null?"\u8A2D\u5B9A\u304C\u6E21\u3055\u308C\u3066\u3044\u306A\u3044\u305F\u3081\u4E0D\u660E":J.vectorEnabled?"\u6709\u52B9":`\u7121\u52B9 (${O} \u306E\u8A2D\u5B9A)`})]}),g("div",{className:"rounded-sm border border-indigo-200/80 border-solid bg-white p-2.5",children:[r("span",{className:"block font-semibold text-slate-600 text-xs",children:"\u30B0\u30E9\u30D5\u7D22\u5F15 (Neo4j)"}),r("span",{className:"mt-1 block font-bold text-xs","data-testid":"projection-graph-state","data-state":J.graphEnabled===null?"unknown":String(J.graphEnabled),children:J.graphEnabled===null?"\u8A2D\u5B9A\u304C\u6E21\u3055\u308C\u3066\u3044\u306A\u3044\u305F\u3081\u4E0D\u660E":J.graphEnabled?"\u6709\u52B9":`\u7121\u52B9 (${O} \u306E\u8A2D\u5B9A)`})]})]}),g("p",{className:"text-[11px] text-slate-600","data-testid":"projection-destination-note",children:["\u6295\u5F71\u5148\u306E\u30B3\u30EC\u30AF\u30B7\u30E7\u30F3\u540D\u30FB\u30B0\u30E9\u30D5\u30E9\u30D9\u30EB\u30FB\u30C1\u30E3\u30F3\u30AF\u5206\u5272\u65B9\u5F0F\u306F\u3001\u9078\u629E\u3057\u305F\u30C9\u30E1\u30A4\u30F3\u306B\u5BFE\u3059\u308B\u914D\u5099\u306E\u53D6\u308A\u8FBC\u307F\u6226\u7565 (",r("code",{className:"font-mono",children:"tm_enrichment_strategy"}),") \u304C\u6C7A\u3081\u307E\u3059\u3002\u3053\u306E\u753B\u9762\u3067\u306F\u63A8\u5B9A\u3057\u307E\u305B\u3093\u3002"]})]}),g("div",{className:"space-y-3 rounded-lg border border-slate-200 border-solid bg-slate-50/50 p-4",children:[g("div",{className:"flex items-center justify-between",children:[r("span",{className:"font-semibold text-slate-800 text-xs",children:"\u4ED8\u52A0\u60C5\u5831 / \u30E9\u30D9\u30EB\u30BF\u30B0 (Labels & Tags)"}),g("span",{className:"text-slate-500 text-xs",children:[Z.length," \u4EF6\u8A2D\u5B9A\u4E2D"]})]}),g("div",{className:"flex flex-wrap items-center gap-1.5",children:[r("span",{className:"text-slate-500 text-xs",children:"\u30AF\u30A4\u30C3\u30AF\u5019\u88DC:"}),as.map(s=>g("button",{type:"button",onClick:()=>ze(s),className:"rounded-full border border-slate-200 border-solid bg-white px-2.5 py-0.5 text-slate-700 text-xs transition-colors hover:border-indigo-300 hover:text-indigo-600","data-testid":`preset-tag-${s}`,children:["+ ",s]},s))]}),g("div",{className:"grid grid-cols-1 items-end gap-2 sm:grid-cols-5",children:[g("div",{className:"space-y-1 sm:col-span-2",children:[r("label",{htmlFor:V,className:"block text-slate-600 text-xs",children:"\u30E9\u30D9\u30EB\u540D / \u30AD\u30FC"}),r("input",{id:V,type:"text",value:he,onChange:s=>le(s.target.value),onKeyDown:s=>{s.key==="Enter"&&(s.preventDefault(),F())},placeholder:"\u4F8B: \u91CD\u8981\u9867\u5BA2\u5951\u7D04, 2026\u5E74\u5EA6",className:"w-full rounded-sm border border-slate-300 border-solid bg-white px-2.5 py-1.5 text-slate-800 text-xs focus:outline-none focus:ring-1 focus:ring-indigo-500","data-testid":"ingest-label-key-input"})]}),g("div",{className:"space-y-1",children:[r("label",{htmlFor:E,className:"block text-slate-600 text-xs",children:"\u7A2E\u5225"}),g("select",{id:E,value:Ee,onChange:s=>$e(s.target.value),className:"w-full rounded-sm border border-slate-300 border-solid bg-white px-2 py-1.5 text-slate-800 text-xs focus:outline-none focus:ring-1 focus:ring-indigo-500","data-testid":"ingest-label-category-select",children:[r("option",{value:"user",children:"\u30E6\u30FC\u30B6\u30FC (user)"}),r("option",{value:"domain",children:"\u30C9\u30E1\u30A4\u30F3 (domain)"}),r("option",{value:"system",children:"\u30B7\u30B9\u30C6\u30E0 (system)"})]})]}),g("div",{className:"space-y-1",children:[g("label",{htmlFor:B,className:"block text-slate-600 text-xs",children:["\u78BA\u4FE1\u5EA6 (",me.toFixed(2),": 0.00\u301C1.00 AI/\u81EA\u52D5\u5224\u5B9A\u306E\u4FE1\u983C\u5EA6\u30B9\u30B3\u30A2\u30020.80 \u4EE5\u4E0A\u3067\u81EA\u52D5\u9069\u7528\u63A8\u5968)"]}),r("input",{id:B,type:"range",min:"0.0",max:"1.0",step:"0.05",value:me,"aria-valuenow":me,"aria-valuemin":0,"aria-valuemax":1,"aria-valuetext":`${Math.round(me*100)}%`,onChange:s=>Ne(Number.parseFloat(s.target.value)),className:"h-2 w-full cursor-pointer appearance-none rounded-lg bg-slate-200","data-testid":"ingest-label-confidence-slider"})]}),r("div",{children:r("button",{type:"button",onClick:F,className:"w-full rounded-sm bg-slate-800 px-3 py-1.5 font-semibold text-white text-xs hover:bg-slate-700","data-testid":"ingest-add-label-button",children:"\u30BF\u30B0\u8FFD\u52A0"})})]}),Z.length>0&&r("div",{className:"flex flex-wrap gap-2 pt-2","data-testid":"active-labels-container",children:Z.map(s=>g("span",{className:"inline-flex items-center gap-1.5 rounded-md border border-indigo-200 border-solid bg-indigo-50 px-2.5 py-1 font-medium text-indigo-800 text-xs","data-testid":`active-label-${s.labelKey}`,children:[r("span",{className:"font-semibold",children:s.labelKey}),g("span",{className:"text-indigo-400",children:["(",s.category,")"]}),r("button",{type:"button",onClick:()=>Ie(s.labelKey),"aria-label":`\u30E9\u30D9\u30EB ${s.labelKey} \u3092\u524A\u9664`,className:"ml-1 font-bold text-indigo-400 hover:text-indigo-900","data-testid":`remove-label-${s.labelKey}`,children:"\xD7"})]},s.labelKey))})]}),g("div",{className:"space-y-3",children:[r("button",{id:"advanced-settings-toggle",type:"button","aria-expanded":l,"aria-controls":"advanced-settings-panel",onClick:()=>T(s=>!s),className:"inline-flex items-center gap-1.5 font-semibold text-indigo-600 text-xs hover:text-indigo-800","data-testid":"ingest-toggle-advanced-button",children:g("span",{children:[l?"\u25BC":"\u25B6"," \u30E1\u30BF\u30C7\u30FC\u30BF\u8A73\u7D30\u30AA\u30FC\u30D0\u30FC\u30E9\u30A4\u30C9 (\u9AD8\u5EA6\u306A\u8A2D\u5B9A)"]})}),l&&g("section",{id:"advanced-settings-panel","aria-labelledby":"advanced-settings-toggle",className:"space-y-4 rounded-lg border border-slate-200 border-solid bg-slate-50/40 p-4","data-testid":"advanced-settings-panel",children:[r("div",{className:"grid grid-cols-1 gap-4 md:grid-cols-2",children:g("div",{className:"space-y-1",children:[r("label",{htmlFor:S,className:"block font-medium text-slate-700 text-xs",children:"\u6587\u66F8\u30BF\u30A4\u30C8\u30EB (\u4E0A\u66F8\u304D\u6307\u5B9A)"}),r("input",{id:S,type:"text",value:ue,onChange:s=>W(s.target.value),placeholder:"\u6307\u5B9A\u3057\u306A\u3044\u5834\u5408\u306F\u30D5\u30A1\u30A4\u30EB\u540D\u307E\u305F\u306F AI \u62BD\u51FA\u30BF\u30A4\u30C8\u30EB\u304C\u4F7F\u7528\u3055\u308C\u307E\u3059",className:"w-full rounded-sm border border-slate-300 border-solid bg-white px-3 py-1.5 text-slate-800 text-xs","data-testid":"ingest-title-override-input"})]})}),r("div",{className:"grid grid-cols-1 gap-4 md:grid-cols-2",children:g("div",{className:"space-y-1",children:[r("label",{htmlFor:Y,className:"block font-medium text-slate-700 text-xs",children:"\u6240\u7BA1\u90E8\u9580 ID (\u4EFB\u610F)"}),r("input",{id:Y,type:"number",value:ve,onChange:s=>I(s.target.value),placeholder:"\u4F8B: 101",className:"w-full rounded-sm border border-slate-300 border-solid bg-white px-3 py-1.5 text-slate-800 text-xs","data-testid":"ingest-department-input"})]})})]})]}),r("div",{className:"flex justify-end pt-2",children:r("button",{type:"submit",disabled:!de.valid||ae===null||i||m,"aria-busy":i,className:"inline-flex items-center gap-2 rounded-lg bg-indigo-600 px-6 py-2.5 font-semibold text-sm text-white shadow-sm transition-colors hover:bg-indigo-700 focus:outline-none focus:ring-2 focus:ring-indigo-500 disabled:opacity-50","data-testid":"ingest-submit-button",children:i?g(ss,{children:[r("span",{className:"h-4 w-4 animate-spin rounded-full border-2 border-white border-t-transparent border-solid"}),r("span",{children:"\u53D6\u308A\u8FBC\u307F\u6295\u5165\u4E2D..."})]}):r("span",{children:"\u30E1\u30BF\u30C7\u30FC\u30BF\u751F\u6210 & \u53D6\u308A\u8FBC\u307F\u5B9F\u884C"})})})]})]}),g("div",{className:"space-y-4 rounded-xl border border-slate-200 border-solid bg-white p-6 shadow-sm",children:[r("div",{className:"flex items-center justify-between",children:g("div",{children:[r("h3",{className:"font-bold text-base text-slate-900",children:"\u6700\u8FD1\u306E\u53D6\u308A\u8FBC\u307F\u30AD\u30E5\u30FC & \u5B9F\u884C\u72B6\u614B"}),r("p",{className:"text-slate-500 text-xs",children:"\u76F4\u8FD1\u306B\u6295\u5165\u3055\u308C\u305F\u30C9\u30AD\u30E5\u30E1\u30F3\u30C8\u306E\u540C\u671F\u9032\u6357\u3068\u7D50\u679C"})]})}),o.length===0?r("div",{className:"py-8 text-center text-slate-500 text-xs","data-testid":"recent-items-empty",children:"\u53D6\u308A\u8FBC\u307F\u5C65\u6B74\u306F\u3042\u308A\u307E\u305B\u3093\u3002"}):r("div",{className:"overflow-x-auto","data-testid":"recent-items-scroll",children:g("table",{className:"min-w-full divide-y divide-solid divide-slate-200 text-left text-xs","aria-label":"\u6700\u8FD1\u306E\u53D6\u308A\u8FBC\u307F\u5C65\u6B74","data-testid":"recent-items-table",children:[r("thead",{className:"bg-slate-50 font-semibold text-slate-700",children:g("tr",{children:[r("th",{scope:"col",className:"px-3 py-2.5",children:"ID"}),r("th",{scope:"col",className:"px-3 py-2.5",children:"\u30D5\u30A1\u30A4\u30EB\u540D / URI"}),r("th",{scope:"col",className:"px-3 py-2.5",children:"\u6A5F\u5BC6\u533A\u5206"}),r("th",{scope:"col",className:"px-3 py-2.5",children:"\u30EA\u30D3\u30B8\u30E7\u30F3"}),r("th",{scope:"col",className:"px-3 py-2.5",children:"\u540C\u671F\u30B9\u30C6\u30FC\u30BF\u30B9"}),r("th",{scope:"col",className:"px-3 py-2.5",children:"\u6700\u7D42\u5B9F\u884C"}),r("th",{scope:"col",className:"px-3 py-2.5",children:"\u767B\u9332\u65E5\u6642"}),r("th",{scope:"col",className:"px-3 py-2.5 text-right",children:"\u30A2\u30AF\u30B7\u30E7\u30F3"})]})}),r("tbody",{className:"divide-y divide-solid divide-slate-100 font-mono text-slate-800",children:o.map(s=>g("tr",{className:"transition-colors hover:bg-slate-50/80","data-testid":`recent-item-row-${s.id}`,children:[r("td",{className:"px-3 py-2 font-bold",children:s.id}),g("td",{className:"max-w-xs truncate px-3 py-2",title:s.fileUri,children:[r("div",{className:"font-sans font-semibold text-slate-900",children:s.fileName}),r("div",{className:"truncate text-[11px] text-slate-600",children:s.fileUri})]}),r("td",{className:"px-3 py-2",children:r("span",{className:"inline-flex rounded-sm bg-slate-100 px-2 py-0.5 font-medium font-sans text-[11px] text-slate-700",children:s.confidentialityLevel})}),g("td",{className:"px-3 py-2 text-slate-600",children:["rev.",s.revision,s.isCurrent===!1&&r("span",{className:"ml-1.5 inline-flex items-center rounded-sm bg-slate-100 px-1.5 py-0.5 font-medium font-sans text-[10px] text-slate-600","data-testid":`ingest-item-superseded-${s.id}`,children:"\u65E7\u7248"})]}),g("td",{className:"px-3 py-2 font-sans",children:[yt(s.syncStatus),s.errorMessage!==null&&s.errorMessage!==void 0&&s.errorMessage!==""&&r("div",{className:"mt-1 max-w-xs break-words text-[11px] text-red-700","data-testid":`ingest-item-error-${s.id}`,title:s.errorMessage,children:s.errorMessage})]}),g("td",{className:"px-3 py-2 font-sans","data-testid":`ingest-last-run-${s.id}`,children:[s.lastRun===null?r("span",{className:"text-[11px] text-slate-500","data-testid":`ingest-last-run-none-${s.id}`,children:"\u8A18\u9332\u306A\u3057"}):g("div",{className:"space-y-1",children:[r("span",{className:`inline-flex items-center rounded-full px-2 py-0.5 font-semibold text-[11px] ${je[Ke(s.lastRun)].className}`,"data-testid":`ingest-last-run-status-${s.id}`,"data-status":s.lastRun.status,"data-presentation":Ke(s.lastRun),children:je[Ke(s.lastRun)].label}),s.lastRun.failedStepKey!==null&&r("div",{className:"text-[11px] text-red-700","data-testid":`ingest-last-run-failed-step-${s.id}`,children:Xa[s.lastRun.failedStepKey].label}),r("div",{className:"text-[11px] text-slate-500","data-testid":`ingest-last-run-finished-at-${s.id}`,children:r(ut,{iso:s.lastRun.finishedAt,testId:`ingest-last-run-finished-at-value-${s.id}`})})]}),v!==void 0&&r("button",{type:"button",onClick:()=>v(s.id),"aria-label":`${s.fileName} \u306E\u5C65\u6B74`,className:"mt-1 rounded-sm border border-slate-300 border-solid bg-white px-2 py-0.5 font-semibold text-[11px] text-slate-700 hover:bg-slate-50","data-testid":`ingest-history-button-${s.id}`,children:"\u5C65\u6B74"})]}),r("td",{className:"px-3 py-2 font-sans text-[11px] text-slate-500","data-testid":`ingest-created-at-${s.id}`,children:r(we,{iso:s.createdAt,testId:`ingest-created-at-value-${s.id}`})}),r("td",{className:"px-3 py-2 text-right font-sans",children:We(s)})]},s.id))})]})})]})]})}import{ENRICHMENT_STAGES as Et}from"@aiquants/enrichment-core";import{jsx as pe,jsxs as Ce}from"react/jsx-runtime";var aa={open:{label:"\u30D5\u30E9\u30B0\u6709\u52B9",color:"#047857"},closed:{label:"\u30D5\u30E9\u30B0\u7121\u52B9",color:"#b45309"},unmeasured:{label:"\u30D5\u30E9\u30B0\u672A\u6E2C\u5B9A",color:"#64748b"},absent:{label:"\u30C6\u30CA\u30F3\u30C8\u306E\u9580\u306A\u3057",color:"#64748b"}};function sa(e,t){return e===null?"absent":e in t?t[e]?"open":"closed":"unmeasured"}function Un({strategies:e,featureFlags:t,onToggleStage:n,isUpdating:o=!1}){let d=n===void 0;return Ce("div",{"data-testid":"enrichment-strategy-board",className:"space-y-4 rounded-xl border border-slate-200 border-solid bg-white p-6 shadow-sm",children:[Ce("div",{children:[pe("h2",{className:"font-bold text-base text-slate-900",children:"\u30C9\u30E1\u30A4\u30F3\u5225 \u53D6\u308A\u8FBC\u307F\u6226\u7565"}),Ce("p",{className:"text-slate-500 text-xs",children:["\u6BB5\u304C\u8D70\u308B\u306E\u306F\u3001\u30C6\u30CA\u30F3\u30C8\u306E\u6A5F\u80FD\u30D5\u30E9\u30B0\u3068\u3001\u3053\u306E\u30C9\u30E1\u30A4\u30F3\u306E\u6226\u7565\u306E",pe("strong",{children:"\u53CC\u65B9"}),"\u304C\u958B\u3044\u3066\u3044\u308B\u3068\u304D\u3060\u3051\u3067\u3059\u3002\u8868\u306F ",e.length," \u30C9\u30E1\u30A4\u30F3 \xD7 ",Et.length," \u6BB5\u3002"]}),d&&pe("p",{"data-testid":"strategy-read-only-note",className:"mt-1 text-slate-500 text-xs",children:"\u3053\u306E\u914D\u5099\u3067\u306F\u66F8\u304D\u8FBC\u307F\u7D4C\u8DEF\u304C\u7D50\u7DDA\u3055\u308C\u3066\u3044\u306A\u3044\u305F\u3081\u3001\u95B2\u89A7\u306E\u307F\u3067\u3059\u3002"})]}),e.length===0?pe("p",{"data-testid":"strategy-empty-note",className:"text-slate-500 text-sm",children:"\u767B\u9332\u3055\u308C\u305F\u30C9\u30E1\u30A4\u30F3\u304C\u3042\u308A\u307E\u305B\u3093\u3002"}):pe("div",{"data-testid":"strategy-grid-scroll",className:"overflow-x-auto",children:Ce("table",{"data-testid":"strategy-grid","aria-label":"\u30C9\u30E1\u30A4\u30F3\u5225 \u53D6\u308A\u8FBC\u307F\u6226\u7565",className:"w-full border-collapse text-xs",children:[pe("thead",{children:Ce("tr",{children:[pe("th",{scope:"col",className:"border-slate-200 border-b border-solid p-2 text-left font-semibold text-slate-600",children:"\u30C9\u30E1\u30A4\u30F3"}),Et.map(i=>{let m=sa(i.featureFlagKey,t);return Ce("th",{scope:"col",className:"border-slate-200 border-b border-solid p-2 text-center font-semibold text-slate-600",children:[pe("div",{children:i.label}),pe("div",{"data-testid":`strategy-gate-${i.key}`,"data-gate":m,className:"mt-0.5 font-normal text-[10px]",style:{color:aa[m].color},children:aa[m].label})]},i.key)})]})}),pe("tbody",{children:e.map(i=>Ce("tr",{"data-testid":`strategy-row-${i.domainKey}`,"data-provenance":i.provenance,"data-active":String(i.isActive),children:[Ce("th",{scope:"row",className:"border-slate-100 border-b border-solid p-2 text-left font-normal",children:[pe("div",{className:"font-semibold text-slate-900",children:i.domainLabel}),Ce("div",{className:"text-[10px] text-slate-500",children:[pe("code",{children:i.domainKey})," / ",i.strategyName]}),pe("div",{"data-testid":`strategy-provenance-${i.domainKey}`,className:"text-[10px] text-slate-500",children:i.provenance==="system"?"\u914D\u5099\u306E\u65E2\u5B9A (SYSTEM) \u3092\u89E3\u6C7A\u4E2D \u2014 \u5909\u66F4\u3059\u308B\u3068\u3053\u306E\u30C6\u30CA\u30F3\u30C8\u5C02\u7528\u306E\u884C\u304C\u4F5C\u3089\u308C\u307E\u3059":"\u3053\u306E\u30C6\u30CA\u30F3\u30C8\u56FA\u6709\u306E\u884C"}),!i.isActive&&pe("div",{"data-testid":`strategy-inactive-${i.domainKey}`,className:"text-[10px] text-amber-700",children:"\u6226\u7565\u304C\u7121\u52B9\u306E\u305F\u3081\u3001\u6BB5\u3092\u958B\u3044\u3066\u3082\u89E3\u6C7A\u3055\u308C\u307E\u305B\u3093"})]}),Et.map(m=>{let u=i.stages[m.key],y=sa(m.featureFlagKey,t);return Ce("td",{className:"border-slate-100 border-b border-solid p-2 text-center",children:[pe("button",{type:"button",role:"switch","aria-checked":u,"aria-label":`${i.domainLabel} \u306E ${m.label}`,"data-testid":`strategy-stage-${i.domainKey}-${m.key}`,"data-enabled":String(u),"data-effective":String(u&&(y==="open"||y==="absent")),disabled:d||o,onClick:()=>n?.(i,m.key,!u),className:`rounded-full px-2.5 py-1 font-medium text-[11px] ${u?"bg-emerald-50 text-emerald-700":"bg-slate-100 text-slate-600"} ${d||o?"cursor-not-allowed opacity-60":"cursor-pointer"}`,children:u?"\u958B":"\u9589"}),u&&y==="unmeasured"&&pe("div",{"data-testid":`strategy-unmeasured-${i.domainKey}-${m.key}`,className:"mt-0.5 text-[10px] text-slate-500",children:"\u30D5\u30E9\u30B0\u3092\u8AAD\u3081\u3066\u3044\u306A\u3044\u305F\u3081\u3001\u8D70\u308B\u304B\u3069\u3046\u304B\u5224\u308A\u307E\u305B\u3093"}),u&&y==="closed"&&pe("div",{"data-testid":`strategy-blocked-${i.domainKey}-${m.key}`,className:"mt-0.5 text-[10px] text-amber-700",children:"\u30D5\u30E9\u30B0\u304C\u9589\u3058\u3066\u3044\u308B\u305F\u3081\u8D70\u308A\u307E\u305B\u3093"})]},m.key)})]},`${i.domainKey}:${i.strategyName}`))})]})})]})}var Je={connected:"\u6B63\u5E38\u63A5\u7D9A",error:"\u63A5\u7D9A\u30A8\u30E9\u30FC"};import{Fragment as da,jsx as L,jsxs as j}from"react/jsx-runtime";var ns={engine:"\u30A8\u30F3\u30B8\u30F3",edition:"\u30A8\u30C7\u30A3\u30B7\u30E7\u30F3",fullVersion:"\u5B8C\u5168\u30D0\u30FC\u30B8\u30E7\u30F3",title:"\u540D\u79F0",collectionsCount:"\u30B3\u30EC\u30AF\u30B7\u30E7\u30F3",nodeCount:"\u30CE\u30FC\u30C9\u6570 (\u30C6\u30CA\u30F3\u30C8)",totalKeys:"\u30AD\u30FC\u7DCF\u6570",database:"DB",endpointsCount:"\u30A8\u30F3\u30C9\u30DD\u30A4\u30F3\u30C8",port:"\u30DD\u30FC\u30C8",restPort:"REST \u30DD\u30FC\u30C8",boltUri:"Bolt URI",tls:"TLS"},na=["engine","edition","fullVersion","title","collectionsCount","nodeCount","totalKeys","database","endpointsCount","port","restPort","boltUri","tls"],rs=new Set(["collectionsCount","nodeCount","totalKeys","endpointsCount"]),mt={atomic:{label:"min-w-0 text-muted-foreground",slot:"shrink-0 whitespace-nowrap text-right"},anywhere:{label:"shrink-0 text-muted-foreground",slot:"wrap-anywhere min-w-0 text-right"}};function ra(e){return e.kind==="text"?"anywhere":"atomic"}function ia(e,t){return t===null?{kind:"unmeasured"}:rs.has(e)&&typeof t=="number"?{kind:"count",count:t}:typeof t=="boolean"?{kind:"word",text:t?"\u6709\u52B9":"\u7121\u52B9"}:typeof t=="number"?{kind:"number",value:t}:{kind:"text",text:t}}function os(e){let t=na.filter(o=>o in e),n=Object.keys(e).filter(o=>!na.includes(o)).sort();return[...t,...n].map(o=>({key:o,label:ns[o]??o,value:ia(o,e[o])}))}function oa(e,t){switch(e.kind){case"count":return L(H,{value:e.count,unit:"\u4EF6",testId:t});case"unmeasured":return L(Re,{text:null,testId:t});case"number":if(!Number.isFinite(e.value))throw new RangeError(`${t}: a number the probe read must be finite, got ${e.value} (pass null when the probe could not read it)`);return L(Re,{text:String(e.value),testId:t});case"word":return L(Re,{text:e.text,testId:t});case"text":return L(et,{text:e.text,testId:t})}}function Jn({health:e,isRefreshing:t=!1,onRefresh:n,className:o=""}){let{services:d,allHealthy:i,checkedAt:m}=e;se();let u=[{key:"qdrant",data:d.qdrant,title:"Qdrant",subtitle:"\u30D9\u30AF\u30C8\u30EB\u691C\u7D22\u30A8\u30F3\u30B8\u30F3 (Vector DB)"},{key:"neo4j",data:d.neo4j,title:"Neo4j",subtitle:"\u30CA\u30EC\u30C3\u30B8\u30B0\u30E9\u30D5 (Graph DB)"},{key:"redis",data:d.redis,title:"Redis",subtitle:"\u30AD\u30E3\u30C3\u30B7\u30E5 & Pub/Sub (Cache)"},{key:"sqlServer",data:d.sqlServer,title:"SQL Server",subtitle:"\u6B63\u6E96\u30C7\u30FC\u30BF\u30B9\u30C8\u30A2 (Single Source of Truth)"},{key:"quantsApi",data:d.quantsApi,title:"AI Quant API",subtitle:"Python \u30D0\u30C3\u30AF\u30A8\u30F3\u30C9\u63A8\u8AD6\u30A8\u30F3\u30B8\u30F3"}];return j("section",{className:`rounded-lg border border-solid bg-card p-5 text-card-foreground shadow-sm ${o}`,"data-testid":"infrastructure-health-monitor","data-healthy":String(i),children:[j("div",{className:"flex flex-wrap items-center justify-between gap-4 border-b border-solid pb-4",children:[j("div",{className:"flex items-center gap-3",children:[L("div",{className:"flex h-10 w-10 items-center justify-center rounded-lg bg-primary/10 text-primary",children:j("svg",{className:"h-5 w-5",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",children:[L("rect",{width:"20",height:"8",x:"2",y:"2",rx:"2",ry:"2"}),L("rect",{width:"20",height:"8",x:"2",y:"14",rx:"2",ry:"2"}),L("line",{x1:"6",x2:"6.01",y1:"6",y2:"6"}),L("line",{x1:"6",x2:"6.01",y1:"18",y2:"18"})]})}),j("div",{children:[L("h2",{className:"font-bold text-base",children:"\u5468\u8FBA\u6A5F\u80FD\u63A5\u7D9A\u72B6\u614B & \u30D0\u30FC\u30B8\u30E7\u30F3"}),j("p",{className:"text-muted-foreground text-xs",children:["\u6700\u7D42\u78BA\u8A8D:"," ",L("span",{"data-testid":"health-checked-at",children:L(we,{iso:m,testId:"health-checked-at-value"})})," ","| \u5168 5 \u7CFB\u7D71\u306E\u57FA\u76E4\u30B5\u30FC\u30D3\u30B9\u30EA\u30A2\u30EB\u30BF\u30A4\u30E0\u6B7B\u6D3B\u76E3\u8996"]})]})]}),j("div",{className:"flex flex-wrap items-center gap-3",children:[L("span",{className:`inline-flex shrink-0 items-center gap-1.5 whitespace-nowrap rounded-full px-3 py-1 font-medium text-xs ${i?"bg-emerald-100 text-emerald-800 dark:bg-emerald-500/15 dark:text-emerald-400":"bg-destructive/15 text-destructive"}`,"data-testid":"health-overall-status-badge",children:i?j(da,{children:[j("svg",{className:"h-3.5 w-3.5",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",children:[L("path",{d:"M22 11.08V12a10 10 0 1 1-5.93-9.14"}),L("polyline",{points:"22 4 12 14.01 9 11.01"})]}),j("span",{children:["\u5168\u30B5\u30FC\u30D3\u30B9",Je.connected]})]}):j(da,{children:[j("svg",{className:"h-3.5 w-3.5",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",children:[L("circle",{cx:"12",cy:"12",r:"10"}),L("line",{x1:"12",x2:"12",y1:"8",y2:"12"}),L("line",{x1:"12",x2:"12.01",y1:"16",y2:"16"})]}),j("span",{children:["\u4E00\u90E8\u30B5\u30FC\u30D3\u30B9",Je.error]})]})}),n&&j("button",{type:"button",onClick:n,disabled:t,"data-testid":"health-refresh-button",className:"inline-flex shrink-0 items-center gap-1.5 whitespace-nowrap rounded-md border border-solid bg-background px-3 py-1.5 font-medium text-xs shadow-sm hover:bg-muted focus:outline-none focus:ring-2 focus:ring-ring disabled:opacity-50",children:[j("svg",{className:`h-3.5 w-3.5 ${t?"animate-spin":""}`,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",children:[L("path",{d:"M21 12a9 9 0 0 0-9-9 9.75 9.75 0 0 0-6.74 2.74L3 8"}),L("path",{d:"M3 3v5h5"}),L("path",{d:"M3 12a9 9 0 0 0 9 9 9.75 9.75 0 0 0 6.74-2.74L21 16"}),L("path",{d:"M16 21h5v-5"})]}),L("span",{children:"\u518D\u78BA\u8A8D"})]})]})]}),L("div",{className:"mt-4 grid grid-cols-1 gap-4 sm:grid-cols-2 lg:grid-cols-5",children:u.map(({key:y,data:h,title:v,subtitle:C})=>{let N=h.status==="connected",X=ia("version",h.version),oe=mt[ra(X)],Y=oa(X,`service-version-value-${y}`);return j("div",{"data-testid":`service-card-${y}`,className:`flex flex-col justify-between rounded-md border border-solid p-3.5 transition-colors ${N?"border-border bg-card/60 hover:bg-muted/40":"border-destructive/40 bg-destructive/5"}`,children:[j("div",{children:[j("div",{className:"flex flex-wrap items-center justify-between gap-x-2 gap-y-1",children:[L("span",{className:"font-semibold text-sm",children:v}),j("span",{className:`inline-flex shrink-0 items-center gap-1 whitespace-nowrap rounded-sm px-1.5 py-0.5 font-medium text-[11px] ${N?"bg-emerald-100 text-emerald-800 dark:bg-emerald-500/15 dark:text-emerald-400":"bg-destructive/15 text-destructive"}`,"data-testid":`service-status-${y}`,children:[L("span",{className:`h-1.5 w-1.5 rounded-full ${N?"animate-pulse bg-emerald-500":"bg-destructive"}`}),Je[h.status]]})]}),L("p",{className:"mt-1 text-[11px] text-muted-foreground",children:C}),j("div",{className:"mt-3 space-y-1.5 border-t border-solid pt-2 text-xs",children:[j("div",{className:"flex items-start justify-between gap-2","data-testid":`service-version-row-${y}`,children:[L("span",{className:oe.label,children:"\u30D0\u30FC\u30B8\u30E7\u30F3:"}),L("span",{className:`${oe.slot} font-medium text-[11px]`,"data-testid":`service-version-${y}`,children:X.kind==="text"?L("code",{className:"font-mono font-semibold",children:Y}):Y})]}),j("div",{className:"flex items-start justify-between gap-2","data-testid":`health-latency-row-${y}`,children:[L("span",{className:mt.atomic.label,children:"\u5FDC\u7B54\u6642\u9593:"}),L("span",{className:`${mt.atomic.slot} font-mono text-[11px] text-muted-foreground`,"data-testid":`health-latency-${y}`,children:L(H,{value:h.latencyMs,unit:"ms",testId:`health-latency-value-${y}`})})]}),os(h.details).map(S=>{let V=mt[ra(S.value)];return j("div",{className:"flex items-start justify-between gap-2","data-testid":`health-detail-row-${y}-${S.key}`,children:[j("span",{className:V.label,children:[S.label,":"]}),L("span",{className:`${V.slot} font-medium text-[11px]`,"data-testid":`health-detail-${y}-${S.key}`,children:oa(S.value,`health-detail-value-${y}-${S.key}`)})]},S.key)})]})]}),j("div",{className:"mt-3 border-t border-solid pt-1.5 text-[10px] text-muted-foreground",children:[L("span",{className:"wrap-anywhere font-mono","data-testid":`service-endpoint-${y}`,children:h.endpoint}),h.errorMessage&&L("p",{className:"mt-0.5 line-clamp-2 text-destructive",children:h.errorMessage})]})]},y)})})]})}import{MODE_TIERS as ds,SEARCH_MODES as is,SEARCH_PARAM_LIMITS as ye}from"@aiquants/enrichment-core";import{useEffect as la,useId as Pe,useRef as ca,useState as ne}from"react";import{Fragment as bt,jsx as c,jsxs as p}from"react/jsx-runtime";var pa={KEYWORD:{label:"SQL",description:"SQL Server \u306E\u8A9E\u53E5\u4E00\u81F4\u306E\u307F\u3067\u691C\u7D22\u3057\u307E\u3059\u3002\u30D9\u30AF\u30C8\u30EB\u3082\u30B0\u30E9\u30D5\u3082\u547C\u3070\u306A\u3044\u30D5\u30A9\u30FC\u30EB\u30D0\u30C3\u30AF\u7D4C\u8DEF\u3067\u3059\u3002"},SPARSE:{label:"\u758E\u30D9\u30AF\u30C8\u30EB",description:"BM25 \u306E\u8A9E\u5F59\u30D9\u30AF\u30C8\u30EB\u3067\u691C\u7D22\u3057\u307E\u3059\u3002\u56FA\u6709\u540D\u8A5E\u3084\u578B\u756A\u306A\u3069\u306E\u5B8C\u5168\u4E00\u81F4\u306B\u5F37\u3044\u7D4C\u8DEF\u3067\u3059\u3002"},DENSE:{label:"\u5BC6\u30D9\u30AF\u30C8\u30EB",description:"\u57CB\u3081\u8FBC\u307F\u30E2\u30C7\u30EB\u306E\u610F\u5473\u30D9\u30AF\u30C8\u30EB\u3067\u691C\u7D22\u3057\u307E\u3059\u3002\u8A00\u3044\u63DB\u3048\u3084\u6587\u610F\u306E\u8FD1\u3055\u3092\u62FE\u3046\u7D4C\u8DEF\u3067\u3059\u3002"},HYBRID:{label:"\u30CF\u30A4\u30D6\u30EA\u30C3\u30C9",description:"\u758E\u30FB\u5BC6\u30FB\u30B0\u30E9\u30D5\u30FB\u8A9E\u53E5\u4E00\u81F4\u3092\u9806\u4F4D\u878D\u5408\u3057\u307E\u3059\u3002\u65E2\u5B9A\u306E\u691C\u7D22\u7D4C\u8DEF\u3067\u3059\u3002"},GRAPH_TRAVERSE:{label:"\u30CA\u30EC\u30C3\u30B8\u30B0\u30E9\u30D5",description:"\u30CA\u30EC\u30C3\u30B8\u30B0\u30E9\u30D5\u306E\u95A2\u4FC2\u3092\u305F\u3069\u3063\u3066\u691C\u7D22\u3057\u307E\u3059\u3002\u6587\u66F8\u9593\u306E\u3064\u306A\u304C\u308A\u3092\u4E3B\u8EF8\u306B\u3059\u308B\u7D4C\u8DEF\u3067\u3059\u3002"}},Qe="\u672A\u5B9F\u884C",ls=(ye.threshold.min+ye.threshold.max)/2,cs=2e3;function ps(e){return e.fusion==="rrf"?`RRF (k=${e.rrf_k})`:e.fusion==="linear"?`LINEAR (alpha=${e.alpha})`:"\u878D\u5408\u306A\u3057 (\u5358\u4E00\u9806\u4F4D\u30E2\u30FC\u30C9)"}var It={cosine:{label:"\u5BC6\u30D9\u30AF\u30C8\u30EB",format:e=>`${(e*100).toFixed(1)}%`,title:"\u30B3\u30B5\u30A4\u30F3\u985E\u4F3C\u5EA6 (0\u301C1)"},bm25:{label:"\u758E\u30D9\u30AF\u30C8\u30EB",format:e=>e.toFixed(3),title:"BM25 \u30B9\u30B3\u30A2 (\u4E0A\u9650\u306A\u3057\u3002\u5272\u5408\u3067\u306F\u306A\u3044)"},mixed:{label:"\u30D9\u30AF\u30C8\u30EB",format:e=>e.toFixed(3),title:"\u5BC6\u3068\u758E\u306E\u53CC\u65B9\u304C\u8D70\u3063\u305F\u305F\u3081\u3001\u3053\u306E\u5024\u304C\u3069\u3061\u3089\u306E\u91CF\u304B\u5B9A\u307E\u3089\u306A\u3044"}},us=[{id:"balanced-hybrid",title:"\u63A8\u5968\u30CF\u30A4\u30D6\u30EA\u30C3\u30C9 (Balanced Hybrid)",description:"RRF \u878D\u5408 (k=60) \u306B\u3088\u308B\u8A9E\u5F59\u3068\u30BB\u30DE\u30F3\u30C6\u30A3\u30C3\u30AF\u306E\u8ABF\u548C\u30D0\u30E9\u30F3\u30B9\u63A2\u7D22",params:{mode:"HYBRID",limit:20,fusion:"rrf",rrf_k:60}},{id:"high-precision-vector",title:"\u9AD8\u7CBE\u5EA6\u30D9\u30AF\u30C8\u30EB (Dense Dominant)",description:"\u30B3\u30B5\u30A4\u30F3\u985E\u4F3C\u5EA6 0.75 \u4EE5\u4E0A\u306E\u5BC6\u30D9\u30AF\u30C8\u30EB\u63A2\u7D22\u306B\u3088\u308B\u9AD8\u9069\u5408\u7387\u30BB\u30DE\u30F3\u30C6\u30A3\u30C3\u30AF\u691C\u7D22",params:{mode:"DENSE",limit:10,threshold:.75}},{id:"strict-lexical",title:"\u53B3\u683C\u30AD\u30FC\u30EF\u30FC\u30C9 (Strict Lexical)",description:"\u30CF\u30EB\u30B7\u30CD\u30FC\u30B7\u30E7\u30F3\u3092\u6392\u9664\u3059\u308B SQL SoT / \u8A9E\u5F59\u30A4\u30F3\u30C7\u30C3\u30AF\u30B9\u76F4\u63A5\u691C\u7D22",params:{mode:"KEYWORD",limit:20}},{id:"lexical-sparse",title:"\u8A9E\u5F59\u30D9\u30AF\u30C8\u30EB (Sparse BM25)",description:"BM25 \u306E\u8A9E\u5F59\u30D9\u30AF\u30C8\u30EB\u3067\u56FA\u6709\u540D\u8A5E\u3084\u578B\u756A\u306E\u5B8C\u5168\u4E00\u81F4\u3092\u72D9\u3046\u691C\u7D22",params:{mode:"SPARSE",limit:20}},{id:"graph-reasoning",title:"\u30B0\u30E9\u30D5\u6DF1\u6398\u308A\u63A8\u8AD6 (Graph Deep Reasoning)",description:"\u30CA\u30EC\u30C3\u30B8\u30B0\u30E9\u30D5\u306E\u95A2\u4FC2\u9806\u4F4D\u3092\u4E3B\u8EF8\u306B\u636E\u3048\u305F\u63A8\u8AD6\u691C\u7D22",params:{mode:"GRAPH_TRAVERSE",limit:30}}];function ua(e){return e===void 0||Number.isNaN(e)?"N/A":`${(e*100).toFixed(1)}%`}function ms(e,t){let n=t.trim();if(!(n&&e))return e;let o=n.replace(/[.*+?^${}()|[\]\\]/g,"\\$&"),d=new RegExp(`(${o})`,"gi");return e.split(d).map((u,y)=>({id:`chunk-${y}-${u.slice(0,8)}`,part:u,isMatch:u.toLowerCase()===n.toLowerCase()})).map(u=>u.isMatch?c("mark",{"data-testid":"highlighted-keyword",className:"rounded-sm bg-amber-200 px-1 py-0.5 font-semibold text-amber-950",children:u.part},u.id):u.part)}function Rt(e){return e==="OPEN"?"bg-red-100 font-bold text-red-800":e==="HALF_OPEN"?"bg-amber-100 font-bold text-amber-800":"bg-slate-200 text-slate-500"}function _t(e){return e==="OPEN"?"OPEN":e==="HALF_OPEN"?"HALF":"-"}function tr({tenantId:e,onSearch:t,initialParams:n,initialResult:o=null,circuitBreakerStatus:d={},isLoading:i=!1}){let m=Pe(),u=Pe(),y=Pe(),h=Pe(),v=Pe(),C=Pe(),N=Pe(),X=Pe(),oe=Pe(),Y=Pe(),[S,V]=ne(n?.q??""),[E,B]=ne(n?.mode??"HYBRID"),[M,P]=ne(n?.limit??ye.limit.default),[z,b]=ne(n?.threshold??ls),[$,q]=ne(n?.fusion??"rrf"),[O,ce]=ne(n?.rrf_k??ye.rrfK.default),[te,xe]=ne(n?.alpha??ye.alpha.default),[ve,I]=ne(n?.confidentiality_level??"ALL"),[ue,W]=ne(n?.department_id?String(n.department_id):""),[Z,G]=ne(n?.mime_type??""),[he,le]=ne(n?.tag??""),Ee=ca(0),[$e,me]=ne(!1),[Ne,l]=ne(!1),[T,ae]=ne("request"),[J,de]=ne(null),[He,Te]=ne(new Set),[Ve,_e]=ne(!1),[F,ze]=ne(o),[Ie,it]=ne(null),[We,yt]=ne(null),s=i||Ve,w=ds[E],Q=[w.dense,w.sparse,w.graph,w.lexical].filter(Boolean).length>1,Se=w.dense&&!w.sparse,Le=F?.search_metadata.circuit_breaker_status??d,be=F?.search_metadata.executed_tiers??{sql:!1,dense:!1,sparse:!1,graph:!1},vt=We??{};la(()=>{if(!Ne)return;let a=ee=>{ee.key==="Escape"&&l(!1)};return window.addEventListener("keydown",a),()=>window.removeEventListener("keydown",a)},[Ne]);let Ta=a=>{B(a.params.mode),P(a.params.limit),a.params.threshold!==void 0&&b(a.params.threshold),a.params.fusion!==void 0&&q(a.params.fusion),a.params.rrf_k!==void 0&&ce(a.params.rrf_k)},Aa=async()=>{if(s)return;let a=ue.trim()?Number.parseInt(ue.trim(),10):void 0,ee={q:S.trim(),mode:E,limit:M,threshold:Se?z:void 0,fusion:Q?$:void 0,rrf_k:Q&&$==="rrf"?O:void 0,alpha:Q&&$==="linear"?te:void 0,department_id:a,confidentiality_level:ve==="ALL"?void 0:ve,mime_type:Z.trim()||void 0,tag:he.trim()||void 0},ge=Ee.current+1;Ee.current=ge,it(null),_e(!0);try{let Ae=await t(ee);if(ge!==Ee.current)return;ze(Ae),yt(ee)}catch(Ae){if(ge!==Ee.current)return;it(Ae instanceof Error?Ae.message:"\u691C\u7D22\u51E6\u7406\u4E2D\u306B\u4E88\u671F\u305B\u306C\u30A8\u30E9\u30FC\u304C\u767A\u751F\u3057\u307E\u3057\u305F\u3002")}finally{ge===Ee.current&&_e(!1)}},Ye=ca(void 0);la(()=>()=>{Ye.current!==void 0&&clearTimeout(Ye.current)},[]);let Da=async(a,ee)=>{try{await navigator.clipboard.writeText(a),de(ee),Ye.current!==void 0&&clearTimeout(Ye.current),Ye.current=setTimeout(()=>de(null),cs)}catch{}},Ma=a=>{Te(ee=>{let ge=new Set(ee);return ge.has(a)?ge.delete(a):ge.add(a),ge})};return p("div",{"data-testid":"metadata-search-workbench","data-mode":E,"data-loading":String(s),className:"space-y-6",children:[p("div",{className:"rounded-xl border border-slate-200 border-solid bg-white p-6 shadow-sm",children:[p("div",{className:"flex flex-col gap-4 lg:flex-row lg:items-center lg:justify-between",children:[p("div",{children:[p("div",{className:"flex items-center gap-2",children:[c("h2",{className:"font-bold text-base text-slate-900 tracking-tight",children:"\u30E1\u30BF\u30C7\u30FC\u30BF\u691C\u7D22\u30EF\u30FC\u30AF\u30D9\u30F3\u30C1"}),p("span",{"data-testid":"workbench-tenant-badge",className:"rounded-full bg-indigo-50 px-2.5 py-0.5 font-semibold text-indigo-700 text-xs",children:["\u30C6\u30CA\u30F3\u30C8: ",e]})]}),c("p",{className:"mt-1 text-slate-500 text-sm",children:"\u30AD\u30FC\u30EF\u30FC\u30C9\u30FB\u5BC6\u30D9\u30AF\u30C8\u30EB\u30FB\u30CA\u30EC\u30C3\u30B8\u30B0\u30E9\u30D5\u306E\u30DE\u30EB\u30C1\u30EC\u30A4\u30E4\u30FC\u691C\u7D22\u30D1\u30E9\u30E1\u30FC\u30BF\u3092\u5FAE\u8ABF\u6574\u3057\u3001\u30EA\u30A2\u30EB\u30BF\u30A4\u30E0\u306B\u53D6\u5F97\u7CBE\u5EA6\u3068\u63A8\u8AD6\u7D50\u679C\u3092\u691C\u8A3C\u3057\u307E\u3059\u3002"})]}),c("div",{className:"flex items-center gap-2",children:p("button",{type:"button","data-testid":"toggle-inspector-button","aria-expanded":Ne,"aria-controls":Y,onClick:()=>l(a=>!a),className:"inline-flex items-center gap-2 rounded-lg border border-slate-300 border-solid bg-slate-50 px-3.5 py-2 font-medium text-slate-700 text-sm shadow-sm transition-colors hover:bg-slate-100",children:[c("span",{className:"font-mono text-xs",children:"{ }"}),c("span",{children:Ne?"\u30A4\u30F3\u30B9\u30DA\u30AF\u30BF\u3092\u9589\u3058\u308B":"\u958B\u767A\u8005\u30A4\u30F3\u30B9\u30DA\u30AF\u30BF"})]})})]}),p("div",{className:"mt-5 border-slate-100 border-t border-solid pt-4",children:[c("span",{className:"font-medium text-slate-600 text-xs",children:"\u958B\u767A\u8005\u30D7\u30EA\u30BB\u30C3\u30C8:"}),c("div",{className:"mt-2 flex flex-wrap gap-2",children:us.map(a=>c("button",{type:"button","data-testid":`preset-button-${a.id}`,onClick:()=>Ta(a),className:"inline-flex items-center rounded-lg border border-slate-200 border-solid bg-slate-50 px-3 py-1.5 text-left text-xs transition-colors hover:border-indigo-300 hover:bg-indigo-50/50",children:p("div",{children:[c("span",{className:"font-semibold text-slate-800",children:a.title}),p("span",{className:"ml-1.5 hidden text-slate-500 xl:inline",children:["(",a.description,")"]})]})},a.id))})]})]}),c("div",{className:"rounded-xl border border-slate-200 border-solid bg-white p-6 shadow-sm",children:p("form",{onSubmit:a=>{a.preventDefault(),Aa()},className:"space-y-5",children:[p("div",{className:"flex flex-col gap-3 sm:flex-row sm:items-center",children:[p("div",{className:"relative flex-1",children:[c("label",{htmlFor:m,className:"sr-only",children:"\u691C\u7D22\u30AF\u30A8\u30EA"}),c("input",{id:m,type:"text","data-testid":"search-query-input",value:S,onChange:a=>V(a.target.value),placeholder:"\u691C\u7D22\u30AF\u30A8\u30EA\u3092\u5165\u529B (\u4F8B: \u300C\u56DB\u534A\u671F \u6C7A\u7B97\u5831\u544A\u66F8\u300D\u300C\u696D\u52D9\u65E5\u5831 \u539F\u4FA1\u6309\u5206\u300D)...",className:"w-full rounded-lg border border-slate-300 border-solid bg-white px-4 py-2.5 text-slate-900 text-sm shadow-sm transition-colors placeholder:text-slate-400 focus:border-indigo-500 focus:outline-none focus:ring-2 focus:ring-indigo-500/20"}),S&&c("button",{type:"button","data-testid":"clear-query-button",onClick:()=>V(""),className:"absolute inset-y-0 right-0 flex items-center pr-3 text-slate-400 hover:text-slate-600",children:"\u2715"})]}),c("div",{"data-testid":"search-modes",className:"flex flex-wrap items-center gap-1 rounded-lg border border-slate-200 border-solid bg-slate-100 p-1",children:is.map(a=>{let ee=E===a;return c("button",{type:"button","aria-pressed":ee,title:pa[a].description,"data-testid":`search-mode-${a}`,"data-active":String(ee),onClick:()=>B(a),className:`shrink-0 whitespace-nowrap rounded-md px-3 py-1.5 font-medium text-xs transition-all ${ee?"bg-white text-indigo-700 shadow-sm":"text-slate-600 hover:text-slate-900"}`,children:pa[a].label},a)})}),c("button",{type:"submit","data-testid":"execute-search-button",disabled:s,className:"inline-flex items-center justify-center rounded-lg bg-indigo-600 px-5 py-2.5 font-semibold text-sm text-white shadow-sm transition-colors hover:bg-indigo-700 disabled:opacity-50",children:s?"\u691C\u7D22\u4E2D...":"\u691C\u7D22\u5B9F\u884C"})]}),p("div",{className:"grid grid-cols-1 gap-4 rounded-lg bg-slate-50 p-4 sm:grid-cols-2 lg:grid-cols-4",children:[p("div",{className:"space-y-1.5",children:[p("div",{className:"flex items-center justify-between",children:[c("label",{htmlFor:u,className:"font-medium text-slate-700 text-xs",children:"\u53D6\u5F97\u4EF6\u6570 (Top-K):"}),c("span",{"data-testid":"limit-display",className:"font-mono font-semibold text-indigo-600 text-xs",children:M})]}),c("input",{id:u,type:"range","data-testid":"limit-slider",min:ye.limit.min,max:ye.limit.max,step:1,value:M,onChange:a=>P(Number(a.target.value)),className:"h-1.5 w-full cursor-pointer appearance-none rounded-lg bg-slate-200 accent-indigo-600"})]}),p("div",{className:"space-y-1.5",children:[p("div",{className:"flex items-center justify-between",children:[c("label",{htmlFor:y,className:"font-medium text-slate-700 text-xs",title:Se?"\u30B3\u30B5\u30A4\u30F3\u985E\u4F3C\u5EA6\u306E\u4E0B\u9650\u3067\u3059\u3002":"\u3053\u306E\u6226\u7565\u306E\u30B9\u30B3\u30A2\u306F\u30B3\u30B5\u30A4\u30F3\u985E\u4F3C\u5EA6\u3067\u306F\u306A\u3044\u305F\u3081\u9069\u7528\u3057\u307E\u305B\u3093\u3002",children:"\u985E\u4F3C\u5EA6\u95BE\u5024 (Threshold):"}),c("span",{"data-testid":"threshold-display",className:"font-mono font-semibold text-indigo-600 text-xs",children:z.toFixed(2)})]}),c("input",{id:y,type:"range","data-testid":"threshold-slider",min:ye.threshold.min,max:ye.threshold.max,step:.01,value:z,disabled:!Se,onChange:a=>b(Number(a.target.value)),className:"h-1.5 w-full cursor-pointer appearance-none rounded-lg bg-slate-200 accent-indigo-600 disabled:opacity-40"})]}),p("div",{className:"space-y-1.5",children:[p("div",{className:"flex items-center justify-between",children:[c("span",{className:"font-medium text-slate-700 text-xs",children:"\u878D\u5408\u30A2\u30EB\u30B4\u30EA\u30BA\u30E0:"}),c("span",{className:"font-mono font-semibold text-indigo-600 text-xs",children:$.toUpperCase()})]}),p("div",{className:"flex items-center gap-1",children:[c("button",{type:"button","data-testid":"fusion-strategy-rrf",onClick:()=>q("rrf"),disabled:!Q,className:`flex-1 rounded-sm border border-solid py-1 font-medium text-xs ${$==="rrf"?"border-indigo-300 bg-indigo-50 font-bold text-indigo-700":"border-slate-200 bg-white text-slate-600 hover:bg-slate-50"} disabled:opacity-40`,children:"RRF"}),c("button",{type:"button","data-testid":"fusion-strategy-linear",onClick:()=>q("linear"),disabled:!Q,className:`flex-1 rounded-sm border border-solid py-1 font-medium text-xs ${$==="linear"?"border-indigo-300 bg-indigo-50 font-bold text-indigo-700":"border-slate-200 bg-white text-slate-600 hover:bg-slate-50"} disabled:opacity-40`,children:"\u7DDA\u5F62\u7D50\u5408 (Alpha)"})]})]}),c("div",{className:"space-y-1.5",children:$==="rrf"?p(bt,{children:[p("div",{className:"flex items-center justify-between",children:[c("label",{htmlFor:h,className:"font-medium text-slate-700 text-xs",children:"RRF \u5B9A\u6570 (k):"}),c("span",{"data-testid":"rrf-k-display",className:"font-mono font-semibold text-indigo-600 text-xs",children:O})]}),c("input",{id:h,type:"range","data-testid":"rrf-k-slider",min:ye.rrfK.min,max:ye.rrfK.max,step:1,value:O,disabled:!Q,onChange:a=>ce(Number(a.target.value)),className:"h-1.5 w-full cursor-pointer appearance-none rounded-lg bg-slate-200 accent-indigo-600 disabled:opacity-40"})]}):p(bt,{children:[p("div",{className:"flex items-center justify-between",children:[c("label",{htmlFor:v,className:"font-medium text-slate-700 text-xs",children:"\u30D9\u30AF\u30C8\u30EB\u91CD\u307F (Alpha):"}),c("span",{"data-testid":"alpha-display",className:"font-mono font-semibold text-indigo-600 text-xs",children:te.toFixed(2)})]}),c("input",{id:v,type:"range","data-testid":"alpha-slider",min:ye.alpha.min,max:ye.alpha.max,step:.05,value:te,disabled:!Q,onChange:a=>xe(Number(a.target.value)),className:"h-1.5 w-full cursor-pointer appearance-none rounded-lg bg-slate-200 accent-indigo-600 disabled:opacity-40"})]})})]}),p("div",{children:[p("button",{type:"button","data-testid":"toggle-advanced-filters",onClick:()=>me(a=>!a),className:"inline-flex items-center gap-1.5 font-medium text-indigo-600 text-xs hover:text-indigo-800",children:[c("span",{children:$e?"\u25BC":"\u25B6"}),p("span",{children:["\u8A73\u7D30\u30E1\u30BF\u30C7\u30FC\u30BF & \u30B0\u30E9\u30D5\u30D5\u30A3\u30EB\u30BF ",$e?"\u3092\u9589\u3058\u308B":"\u3092\u5C55\u958B"]})]}),$e&&p("div",{"data-testid":"advanced-filters-panel",className:"mt-3 grid grid-cols-1 gap-4 rounded-lg border border-slate-200 border-solid bg-white p-4 sm:grid-cols-2 lg:grid-cols-4",children:[p("div",{className:"space-y-1",children:[c("label",{htmlFor:N,className:"font-medium text-slate-700 text-xs",children:"\u6A5F\u5BC6\u533A\u5206 (Confidentiality):"}),p("select",{id:N,"data-testid":"filter-confidentiality",value:ve,onChange:a=>I(a.target.value),className:"w-full rounded-sm border border-slate-300 border-solid bg-white px-2.5 py-1.5 text-slate-800 text-xs focus:border-indigo-500",children:[c("option",{value:"ALL",children:"\u5168\u6A5F\u5BC6\u533A\u5206 (ALL)"}),c("option",{value:"PUBLIC",children:"\u516C\u958B (PUBLIC)"}),c("option",{value:"INTERNAL",children:"\u793E\u5185\u9650\u5B9A (INTERNAL)"}),c("option",{value:"DEPARTMENT",children:"\u90E8\u9580\u9650\u5B9A (DEPARTMENT)"}),c("option",{value:"CONFIDENTIAL",children:"\u6A5F\u5BC6 (CONFIDENTIAL)"})]})]}),p("div",{className:"space-y-1",children:[c("label",{htmlFor:C,className:"font-medium text-slate-700 text-xs",children:"\u90E8\u9580 ID (Department ID):"}),c("input",{id:C,type:"number","data-testid":"filter-department-id",value:ue,onChange:a=>W(a.target.value),placeholder:"\u4F8B: 101",className:"w-full rounded-sm border border-slate-300 border-solid bg-white px-2.5 py-1.5 text-slate-800 text-xs focus:border-indigo-500"})]}),p("div",{className:"space-y-1",children:[c("label",{htmlFor:X,className:"font-medium text-slate-700 text-xs",children:"MIME \u30BF\u30A4\u30D7 (MIME Type):"}),c("input",{id:X,type:"text","data-testid":"filter-mime-type",value:Z,onChange:a=>G(a.target.value),placeholder:"application/pdf, image/...",className:"w-full rounded-sm border border-slate-300 border-solid bg-white px-2.5 py-1.5 text-slate-800 text-xs focus:border-indigo-500"})]}),p("div",{className:"space-y-1",children:[c("label",{htmlFor:oe,className:"font-medium text-slate-700 text-xs",children:"\u30BF\u30B0 (Tag):"}),c("input",{id:oe,type:"text","data-testid":"filter-tag",value:he,onChange:a=>le(a.target.value),placeholder:"\u4F8B: \u6C7A\u7B97, \u5951\u7D04\u66F8...",className:"w-full rounded-sm border border-slate-300 border-solid bg-white px-2.5 py-1.5 text-slate-800 text-xs focus:border-indigo-500"})]})]})]})]})}),Ie&&c("div",{role:"alert","data-testid":"search-error-alert",className:"rounded-xl border border-red-200 border-solid bg-red-50 p-4 font-medium text-red-700 text-sm shadow-sm",children:Ie}),F?.search_metadata&&c(Ut,{metadata:F.search_metadata}),F&&p("div",{"data-testid":"search-summary-bar",className:"flex flex-wrap items-center justify-between gap-3 rounded-lg border border-slate-200 border-solid bg-slate-50 px-4 py-3 text-xs",children:[p("div",{className:"flex items-center gap-4",children:[p("span",{"data-testid":"result-count",className:"font-semibold text-slate-800",children:["\u30D2\u30C3\u30C8\u4EF6\u6570: ",c("span",{className:"font-bold text-indigo-600",children:F.count})," \u4EF6"]}),F.search_metadata.execution_time_ms!==void 0&&p("span",{"data-testid":"latency-metric",className:"text-slate-500",children:["\u5B9F\u884C\u30EC\u30A4\u30C6\u30F3\u30B7: ",p("span",{className:"font-mono font-semibold text-slate-700",children:[F.search_metadata.execution_time_ms," ms"]})]}),p("span",{"data-testid":"quality-tier-badge",className:"rounded-full bg-slate-200 px-2 py-0.5 font-medium font-mono text-slate-800",children:["Tier: ",F.search_metadata.quality_tier]})]}),p("div",{className:"flex items-center gap-2",children:[c("span",{className:"text-slate-500",children:"\u30EC\u30A4\u30E4\u30FC\u72B6\u614B:"}),p("span",{"data-testid":"tier-badge-sql","data-active":String(be.sql),className:`rounded-sm px-1.5 py-0.5 font-mono text-[11px] ${be.sql?"bg-emerald-100 font-semibold text-emerald-800":"bg-slate-200 text-slate-500"}`,children:["SQL ",be.sql?"\u2713":"-"]}),p("span",{"data-testid":"tier-badge-sparse","data-active":String(be.sparse),"data-breaker":Le.vector??"CLOSED",className:`rounded-sm px-1.5 py-0.5 font-mono text-[11px] ${be.sparse?"bg-emerald-100 font-semibold text-emerald-800":Rt(Le.vector)}`,children:["\u758E\u30D9\u30AF\u30C8\u30EB ",be.sparse?"\u2713":_t(Le.vector)]}),p("span",{"data-testid":"tier-badge-dense","data-active":String(be.dense),"data-breaker":Le.vector??"CLOSED",className:`rounded-sm px-1.5 py-0.5 font-mono text-[11px] ${be.dense?"bg-emerald-100 font-semibold text-emerald-800":Rt(Le.vector)}`,children:["\u5BC6\u30D9\u30AF\u30C8\u30EB ",be.dense?"\u2713":_t(Le.vector)]}),p("span",{"data-testid":"tier-badge-graph","data-active":String(be.graph),"data-breaker":Le.graph??"CLOSED",className:`rounded-sm px-1.5 py-0.5 font-mono text-[11px] ${be.graph?"bg-emerald-100 font-semibold text-emerald-800":Rt(Le.graph)}`,children:["\u30B0\u30E9\u30D5 ",be.graph?"\u2713":_t(Le.graph)]})]})]}),p("div",{"data-testid":"search-results-container",className:"space-y-4",children:[F&&F.hits.length===0&&p("div",{"data-testid":"empty-search-state",className:"rounded-xl border border-slate-200 border-solid bg-white p-12 text-center",children:[c("p",{className:"font-semibold text-base text-slate-700",children:"\u691C\u7D22\u6761\u4EF6\u306B\u4E00\u81F4\u3059\u308B\u30E1\u30BF\u30C7\u30FC\u30BF\u306F\u898B\u3064\u304B\u308A\u307E\u305B\u3093\u3067\u3057\u305F"}),c("p",{className:"mt-1 text-slate-500 text-sm",children:"\u691C\u7D22\u30AD\u30FC\u30EF\u30FC\u30C9\u3092\u7C21\u6F54\u306B\u3059\u308B\u304B\u3001\u985E\u4F3C\u5EA6\u95BE\u5024\u3092\u4E0B\u3052\u308B\uFF08\u4F8B: 0.30\uFF09\u3001\u307E\u305F\u306F\u300C\u63A8\u5968\u30CF\u30A4\u30D6\u30EA\u30C3\u30C9\u300D\u30D7\u30EA\u30BB\u30C3\u30C8\u3092\u304A\u8A66\u3057\u304F\u3060\u3055\u3044\u3002"})]}),F?.hits.map((a,ee)=>{let ge=He.has(a.id),Ae=a.scores?.fused;return p("div",{"data-testid":`search-hit-card-${a.id}`,"data-hit-id":a.id,"data-rank":ee+1,className:"rounded-xl border border-slate-200 border-solid bg-white p-5 shadow-sm transition-all hover:border-slate-300 hover:shadow-md",children:[p("div",{className:"flex flex-col gap-2 sm:flex-row sm:items-start sm:justify-between",children:[p("div",{className:"space-y-1",children:[p("div",{className:"flex flex-wrap items-center gap-2",children:[p("span",{"data-testid":`hit-rank-${a.id}`,className:"rounded-sm bg-slate-100 px-2 py-0.5 font-bold font-mono text-slate-600 text-xs",children:["#",ee+1]}),c("h3",{"data-testid":`hit-filename-${a.id}`,className:"font-bold text-base text-slate-900 tracking-tight",children:a.file_name}),c("span",{"data-testid":`hit-confidentiality-${a.id}`,className:`rounded-full px-2 py-0.5 font-semibold text-[11px] ${a.confidentiality_level==="PUBLIC"?"bg-emerald-50 text-emerald-700":a.confidentiality_level==="INTERNAL"?"bg-blue-50 text-blue-700":a.confidentiality_level==="CONFIDENTIAL"?"bg-amber-50 text-amber-700":"bg-red-50 text-red-700"}`,children:a.confidentiality_level}),a.department_id!==null&&p("span",{"data-testid":`hit-department-${a.id}`,className:"rounded-sm bg-slate-100 px-2 py-0.5 text-[11px] text-slate-600",children:["Dept: ",a.department_id]}),c("span",{"data-testid":`hit-mimetype-${a.id}`,className:"rounded-sm bg-slate-50 px-2 py-0.5 font-mono text-[11px] text-slate-500",children:a.mime_type})]}),c("p",{className:"max-w-xl truncate font-mono text-slate-400 text-xs",children:a.file_uri})]}),Ae!==void 0&&p("div",{className:"flex items-center gap-3 sm:text-right",children:[p("div",{children:[c("div",{className:"font-medium text-slate-500 text-xs",children:"\u878D\u5408\u9806\u4F4D\u30B9\u30B3\u30A2"}),c("div",{"data-testid":`hit-fused-score-${a.id}`,className:"font-bold font-mono text-indigo-600 text-sm",title:"\u5404\u5C64\u3067\u306E\u9806\u4F4D\u304B\u3089\u7D44\u307F\u7ACB\u3066\u305F\u5024 (0\u301C1)\u3002\u985E\u4F3C\u5EA6\u3067\u3082\u78BA\u4FE1\u5EA6\u3067\u3082\u306A\u304F\u3001\u3069\u306E\u5C64\u3067\u3082 1 \u4F4D\u306A\u3089 1.000 \u306B\u306A\u308B",children:Ae.toFixed(3)})]}),c("div",{className:"h-2 w-16 overflow-hidden rounded-full bg-slate-200",children:c("div",{className:"h-full bg-indigo-600",style:{width:`${Math.min(100,Math.max(0,Ae*100))}%`}})})]})]}),a.ai_summary&&c("div",{"data-testid":`hit-summary-${a.id}`,className:"mt-3 rounded-lg bg-slate-50 p-3 text-slate-700 text-sm leading-relaxed",children:ms(a.ai_summary,We?.q??S)}),a.scores&&p("div",{"data-testid":`hit-score-breakdown-${a.id}`,className:"mt-3 flex flex-wrap items-center gap-2 text-xs",children:[c("span",{className:"text-[11px] text-slate-400",children:"\u30B9\u30B3\u30A2\u5185\u8A33:"}),a.scores.vector!==void 0&&p("span",{"data-testid":`score-vector-${a.id}`,"data-score-kind":a.scores.vector.kind,title:It[a.scores.vector.kind].title,className:"rounded-sm bg-blue-50 px-2 py-0.5 font-mono text-blue-700",children:[It[a.scores.vector.kind].label,": ",It[a.scores.vector.kind].format(a.scores.vector.value)]}),a.scores.lexicalRank!==void 0&&p("span",{"data-testid":`score-lexical-${a.id}`,title:"\u5B57\u53E5\u5C64\u3067\u306E\u9806\u4F4D\u3092 0\u301C1 \u3078\u5199\u3057\u305F\u5024 (\u30B9\u30B3\u30A2\u3067\u306F\u306A\u3044)",className:"rounded-sm bg-amber-50 px-2 py-0.5 font-mono text-amber-700",children:["\u5B57\u53E5\u9806\u4F4D: ",ua(a.scores.lexicalRank)]}),a.scores.graphRank!==void 0&&p("span",{"data-testid":`score-graph-${a.id}`,title:"\u30B0\u30E9\u30D5\u5C64\u3067\u306E\u9806\u4F4D\u3092 0\u301C1 \u3078\u5199\u3057\u305F\u5024 (\u30B9\u30B3\u30A2\u3067\u306F\u306A\u3044)",className:"rounded-sm bg-purple-50 px-2 py-0.5 font-mono text-purple-700",children:["\u30B0\u30E9\u30D5\u9806\u4F4D: ",ua(a.scores.graphRank)]})]}),a.tags&&a.tags.length>0&&c("div",{"data-testid":`hit-tags-${a.id}`,className:"mt-3 flex flex-wrap items-center gap-1.5",children:a.tags.map(De=>p("span",{"data-testid":`hit-tag-${a.id}-${De}`,className:"rounded-full bg-slate-100 px-2.5 py-0.5 font-medium text-slate-600 text-xs",children:["#",De]},`tag-${a.id}-${De}`))}),a.graph_relations&&a.graph_relations.length>0&&p("div",{"data-testid":`hit-graph-relations-${a.id}`,className:"mt-3 flex flex-wrap items-center gap-1.5",children:[c("span",{className:"text-slate-400 text-xs",children:"\u30B0\u30E9\u30D5\u63A5\u7D9A:"}),a.graph_relations.map((De,Oa)=>p("span",{"data-testid":`hit-relation-${a.id}-${Oa}`,className:"rounded-sm border border-purple-200 border-solid bg-purple-50 px-2 py-0.5 font-mono text-[11px] text-purple-800",children:["-[:",De.relation,"]-> ",De.target_name]},`rel-${a.id}-${De.relation}-${De.target_name}`))]}),a.structured_data!==null&&a.structured_data!==void 0&&p("div",{className:"mt-3 border-slate-100 border-t border-solid pt-2",children:[p("button",{type:"button","data-testid":`toggle-structured-data-${a.id}`,onClick:()=>Ma(a.id),className:"inline-flex items-center gap-1 font-medium text-indigo-600 text-xs hover:text-indigo-800",children:[c("span",{children:ge?"\u25BC":"\u25B6"}),p("span",{children:["\u62BD\u51FA\u69CB\u9020\u5316\u30C7\u30FC\u30BF ",ge?"\u3092\u9589\u3058\u308B":"\u3092\u8868\u793A"]})]}),ge&&c("pre",{"data-testid":`structured-data-json-${a.id}`,tabIndex:0,className:"mt-2 max-h-48 overflow-auto rounded-sm bg-slate-900 p-3 font-mono text-slate-200 text-xs",children:JSON.stringify(a.structured_data,null,2)})]})]},a.id)})]}),Ne&&p("section",{id:Y,"aria-label":"\u958B\u767A\u8005\u30A4\u30F3\u30B9\u30DA\u30AF\u30BF","data-testid":"developer-inspector-drawer",className:"rounded-xl border border-slate-300 border-solid bg-slate-900 p-5 text-slate-200 shadow-xl",children:[p("div",{className:"flex items-center justify-between border-slate-800 border-b border-solid pb-3",children:[p("div",{className:"flex items-center gap-3",children:[c("span",{className:"font-bold text-base text-white",children:"\u958B\u767A\u8005\u30A4\u30F3\u30B9\u30DA\u30AF\u30BF"}),c("span",{className:"rounded-sm bg-slate-800 px-2 py-0.5 font-mono text-slate-400 text-xs",children:"Live Pipeline Inspector"})]}),p("div",{className:"flex items-center gap-2",children:[c("button",{type:"button","data-testid":"copy-inspector-payload-button",onClick:()=>{let a=JSON.stringify(T==="request"?We??{}:F??{},null,2);Da(a,"inspector")},className:"rounded-sm bg-slate-800 px-2.5 py-1 font-medium text-slate-300 text-xs transition-colors hover:bg-slate-700",children:J==="inspector"?"\u30B3\u30D4\u30FC\u5B8C\u4E86 \u2713":"JSON \u3092\u30B3\u30D4\u30FC"}),c("button",{type:"button","data-testid":"close-inspector-button",onClick:()=>l(!1),className:"text-slate-400 hover:text-white",children:"\u2715"})]})]}),c("div",{className:"mt-3 flex gap-2 border-slate-800 border-b border-solid pb-2",children:["request","response","pipeline","graph-trace"].map(a=>{let ee={request:"Request Payload",response:"Response Payload",pipeline:"Pipeline Trace","graph-trace":"Graph Path Trace"},ge=T===a;return c("button",{type:"button","data-testid":`inspector-tab-${a}`,"data-active":String(ge),onClick:()=>ae(a),className:`rounded-sm px-3 py-1 font-medium text-xs ${ge?"bg-indigo-600 font-semibold text-white":"text-slate-400 hover:text-white"}`,children:ee[a]},a)})}),p("div",{className:"mt-4",children:[T==="request"&&c("pre",{"data-testid":"inspector-request-json",tabIndex:0,className:"max-h-80 overflow-auto rounded-sm bg-slate-950 p-4 font-mono text-emerald-400 text-xs",children:JSON.stringify(We??{},null,2)}),T==="response"&&c("pre",{"data-testid":"inspector-response-json",tabIndex:0,className:"max-h-80 overflow-auto rounded-sm bg-slate-950 p-4 font-mono text-sky-400 text-xs",children:JSON.stringify(F??{},null,2)}),T==="pipeline"&&p("div",{"data-testid":"inspector-pipeline-trace",className:"space-y-3 p-2 text-xs",children:[p("div",{className:"flex items-center gap-2",children:[c("span",{className:"rounded-full bg-emerald-500/20 px-2 py-0.5 font-bold text-emerald-400",children:"Step 1"}),c("span",{className:"font-semibold text-slate-300",children:"\u30AF\u30A8\u30EA\u89E3\u6790 & \u57CB\u3081\u8FBC\u307F (Query Analysis & Tokenization)"})]}),c("div",{className:"ml-6 border-slate-700 border-l border-solid pl-4 font-mono text-slate-400","data-testid":"inspector-query-analysis",children:F?p(bt,{children:["mode: ",vt.mode,' | q: "',vt.q,'"']}):Qe}),p("div",{className:"flex items-center gap-2",children:[c("span",{className:"rounded-full bg-emerald-500/20 px-2 py-0.5 font-bold text-emerald-400",children:"Step 2"}),c("span",{className:"font-semibold text-slate-300",children:"\u30DE\u30EB\u30C1\u30EC\u30A4\u30E4\u30FC\u4E26\u884C\u53D6\u5F97 (Multi-Tier Retrieval)"})]}),c("div",{className:"ml-6 border-slate-700 border-l border-solid pl-4 font-mono text-slate-400","data-testid":"inspector-tier-retrieval",children:F?p(bt,{children:["SQL SoT: ",be.sql?"ACTIVE":"SKIPPED"," | Sparse: ",be.sparse?"ACTIVE":"OFFLINE"," | Dense: ",be.dense?"ACTIVE":"OFFLINE"," | Graph: ",be.graph?"ACTIVE":"OFFLINE"]}):Qe}),p("div",{className:"flex items-center gap-2",children:[c("span",{className:"rounded-full bg-indigo-500/20 px-2 py-0.5 font-bold text-indigo-400",children:"Step 3"}),c("span",{className:"font-semibold text-slate-300",children:"\u30B9\u30B3\u30A2\u878D\u5408 & \u9806\u4F4D\u4ED8\u3051 (Fusion & Ranking)"})]}),p("div",{className:"ml-6 border-slate-700 border-l border-solid pl-4 font-mono text-slate-400",children:[p("span",{"data-testid":"inspector-fusion-strategy",children:["strategy: ",F?ps(vt):Qe]})," | ",p("span",{"data-testid":"inspector-output-count",children:["Output count: ",F?F.count:Qe]})]}),p("div",{className:"flex items-center gap-2",children:[c("span",{className:"rounded-full bg-purple-500/20 px-2 py-0.5 font-bold text-purple-400",children:"Step 4"}),c("span",{className:"font-semibold text-slate-300",children:"ABAC \u884C\u30FB\u5217\u8A8D\u53EF\u30DE\u30B9\u30AD\u30F3\u30B0 (Security Enforcement)"})]}),p("div",{className:"ml-6 border-slate-700 border-l border-solid pl-4 font-mono text-slate-400",children:[p("span",{"data-testid":"inspector-authz-row",children:["\u884C\u30B9\u30B3\u30FC\u30D7: ",F?F.authzScopes.rowScopeApplied?"\u9069\u7528 (\u4E00\u89A7\u304B\u3089\u6587\u66F8\u304C\u9664\u304B\u308C\u3066\u3044\u308B\u53EF\u80FD\u6027)":"\u672A\u9069\u7528":Qe]})," | ",p("span",{"data-testid":"inspector-authz-column",children:["\u5217\u30B9\u30B3\u30FC\u30D7: ",F?F.authzScopes.columnScopeApplied?"\u9069\u7528 (\u9805\u76EE\u304C\u4F0F\u305B\u3089\u308C\u3066\u3044\u308B)":"\u672A\u9069\u7528":Qe]})," | ","tenant: ",e]})]}),T==="graph-trace"&&p("div",{"data-testid":"inspector-graph-trace",className:"p-2 text-xs",children:[c("div",{className:"font-semibold text-purple-300",children:"\u77E5\u8B58\u30B0\u30E9\u30D5 \u30C8\u30E9\u30D0\u30FC\u30B5\u30EB \u30D1\u30B9:"}),F?.hits.some(a=>a.graph_relations&&a.graph_relations.length>0)?c("ul",{className:"mt-2 space-y-2 font-mono text-slate-300",children:F.hits.map(a=>a.graph_relations?.map(ee=>p("li",{className:"rounded-sm bg-slate-950 p-2",children:["(:Document {id: ",a.id,', file: "',a.file_name,'"}) -[:',ee.relation,']-> (:Entity {name: "',ee.target_name,'"})']},`gtrace-${a.id}-${ee.relation}-${ee.target_name}`)))}):c("p",{className:"mt-2 text-slate-500",children:"\u95A2\u9023\u3059\u308B\u30B0\u30E9\u30D5\u30D1\u30B9\u306F\u691C\u51FA\u3055\u308C\u307E\u305B\u3093\u3067\u3057\u305F\u3002"})]})]})]})]})}import{SEARCH_PARAM_LIMITS as Ct}from"@aiquants/enrichment-core";import{useId as tt,useState as Be}from"react";import{jsx as U,jsxs as re}from"react/jsx-runtime";var ba=4;function ma(e){return e.toFixed(ba)}function bs(e,t){let n=h=>{let v=new Map;return h.forEach((C,N)=>{v.has(C)||v.set(C,N+1)}),v},o=n(e),d=n(t),i=[...o.keys()].filter(h=>d.has(h)),m=new Set([...o.keys(),...d.keys()]).size,u=m===0?null:i.length/m,y=i.length===0?null:i.reduce((h,v)=>h+Math.abs(o.get(v)-d.get(v)),0)/i.length;return{sharedCount:i.length,overlapRatio:u,meanAbsoluteRankDifference:y}}function Pt(e){return`${e.label} (${e.embeddingModel})`}function or({variants:e,onCompare:t}){let n=tt(),o=tt(),d=tt(),i=tt(),m=tt(),[u,y]=Be(null),[h,v]=Be(null),[C,N]=Be(""),[X,oe]=Be(Ct.limit.default),[Y,S]=Be(!1),[V,E]=Be(null),[B,M]=Be(null),P=e.length>=2,z=e.map(I=>I.strategyId),b=u!==null&&z.includes(u)?u:P?z[0]:null,$=h!==null&&z.includes(h)?h:P?z[1]:null,q=b!==null&&b===$,O=C.trim(),ce=P&&!q&&O!==""&&!Y,te=async I=>{if(I.preventDefault(),!ce||b===null||$===null)return;let ue={query:O,strategyIds:[b,$],limit:X};S(!0),E(null);try{let W=await t(ue);if(!W.ok){M(null),E(W.reason);return}let Z=W.results.find(he=>he.strategyId===b),G=W.results.find(he=>he.strategyId===$);if(Z===void 0||G===void 0){M(null),E(`\u5FDC\u7B54\u306B\u6226\u7565 #${Z===void 0?b:$} \u306E\u7D50\u679C\u304C\u3042\u308A\u307E\u305B\u3093\u3002`);return}M({input:ue,left:Z,right:G})}catch(W){M(null),E(`\u6BD4\u8F03\u3092\u5B9F\u884C\u3067\u304D\u307E\u305B\u3093\u3067\u3057\u305F: ${W instanceof Error?W.message:String(W)}`)}finally{S(!1)}},xe=B===null?null:bs(B.left.hits.map(I=>I.id),B.right.hits.map(I=>I.id)),ve=I=>{let ue=e.find(W=>W.strategyId===I.strategyId);return re("div",{className:"rounded-lg border border-slate-200 border-solid p-4","data-testid":`compare-column-${I.strategyId}`,children:[U("h3",{className:"font-bold text-base text-slate-900",children:ue===void 0?`\u6226\u7565 #${I.strategyId}`:Pt(ue)}),U("p",{className:"mt-1 text-[11px] text-slate-500",children:re("span",{"data-testid":`compare-execution-ms-${I.strategyId}`,children:[I.executionMs," ms"]})}),I.hits.length===0?U("p",{className:"mt-3 text-[13px] text-slate-500","data-testid":`compare-empty-${I.strategyId}`,children:"\u30D2\u30C3\u30C8\u306A\u3057"}):U("ol",{className:"mt-3 space-y-2",children:I.hits.map((W,Z)=>re("li",{"aria-label":`${Z+1} \u4F4D ${W.title} (\u30B9\u30B3\u30A2 ${ma(W.score)})`,className:"flex items-baseline gap-3 text-[13px]","data-testid":`compare-hit-${I.strategyId}-${Z+1}`,"data-hit-id":W.id,"data-score":String(W.score),children:[U("span",{className:"w-6 text-right font-mono text-slate-500",children:Z+1}),U("span",{title:W.title,className:"flex-1 truncate text-slate-900","data-testid":`compare-hit-title-${I.strategyId}-${Z+1}`,children:W.title}),U("span",{title:String(W.score),className:"font-mono text-slate-600","data-testid":`compare-hit-score-${I.strategyId}-${Z+1}`,children:ma(W.score)})]},Z))})]})};return re("section",{className:"space-y-6","aria-labelledby":n,"data-testid":"model-comparison-workbench","data-running":Y,children:[re("form",{onSubmit:te,className:"rounded-xl border border-slate-200 border-solid bg-white p-6 shadow-sm",children:[U("h2",{id:n,className:"font-bold text-base text-slate-900",children:"\u5909\u7A2E\u306E\u6BD4\u8F03"}),re("p",{className:"mt-2 text-[13px] text-slate-500",children:["\u540C\u3058\u30AF\u30A8\u30EA\u3092 2 \u3064\u306E\u6226\u7565\u5909\u7A2E\u3067\u5B9F\u884C\u3057\u3001\u9806\u4F4D\u3092\u4E26\u3079\u3066\u6BD4\u3079\u307E\u3059\u3002\u30B9\u30B3\u30A2\u306F\u5909\u7A2E\u3054\u3068\u306B\u5225\u306E\u91CF\u306A\u306E\u3067\u6B63\u898F\u5316\u305B\u305A\u3001\u5C0F\u6570\u7B2C ",ba," \u4F4D\u307E\u3067\u793A\u3057\u307E\u3059 (\u5168\u6841\u306F\u30B9\u30B3\u30A2\u306B\u30DD\u30A4\u30F3\u30BF\u3092\u5F53\u3066\u308B\u3068\u51FA\u307E\u3059)\u3002"]}),!P&&re("p",{className:"mt-4 rounded-lg border border-amber-300 border-solid bg-amber-50 p-3 text-[13px] text-amber-900","data-testid":"compare-variants-insufficient",children:["\u6BD4\u8F03\u306B\u306F 2 \u3064\u4EE5\u4E0A\u306E\u5909\u7A2E\u304C\u5FC5\u8981\u3067\u3059 (\u73FE\u5728 ",e.length," \u4EF6)\u3002"]}),re("div",{className:"mt-4 grid grid-cols-1 gap-4 sm:grid-cols-2",children:[re("div",{className:"space-y-1",children:[U("label",{htmlFor:i,className:"block font-semibold text-[13px] text-slate-700",children:"\u5909\u7A2E A"}),U("select",{id:i,value:b===null?"":String(b),onChange:I=>y(Number(I.target.value)),disabled:!P,className:"w-full rounded-lg border border-slate-300 border-solid bg-white px-3 py-2 text-[13px] text-slate-800","data-testid":"compare-variant-a",children:e.map(I=>U("option",{value:String(I.strategyId),children:Pt(I)},I.strategyId))})]}),re("div",{className:"space-y-1",children:[U("label",{htmlFor:m,className:"block font-semibold text-[13px] text-slate-700",children:"\u5909\u7A2E B"}),U("select",{id:m,value:$===null?"":String($),onChange:I=>v(Number(I.target.value)),disabled:!P,className:"w-full rounded-lg border border-slate-300 border-solid bg-white px-3 py-2 text-[13px] text-slate-800","data-testid":"compare-variant-b",children:e.map(I=>U("option",{value:String(I.strategyId),children:Pt(I)},I.strategyId))})]})]}),q&&U("p",{className:"mt-2 text-[13px] text-amber-800","data-testid":"compare-same-variant-note",children:"\u540C\u3058\u5909\u7A2E\u3069\u3046\u3057\u306F\u6BD4\u8F03\u3067\u304D\u307E\u305B\u3093\u3002\u5225\u306E\u5909\u7A2E\u3092\u9078\u3093\u3067\u304F\u3060\u3055\u3044\u3002"}),re("div",{className:"mt-4 grid grid-cols-1 gap-4 sm:grid-cols-[1fr_auto]",children:[re("div",{className:"space-y-1",children:[U("label",{htmlFor:o,className:"block font-semibold text-[13px] text-slate-700",children:"\u30AF\u30A8\u30EA"}),U("input",{id:o,type:"text",value:C,onChange:I=>N(I.target.value),disabled:!P,className:"w-full rounded-lg border border-slate-300 border-solid px-3 py-2 text-[13px] text-slate-800","data-testid":"compare-query-input"})]}),re("div",{className:"space-y-1",children:[U("label",{htmlFor:d,className:"block font-semibold text-[13px] text-slate-700",children:"\u4EF6\u6570"}),U("input",{id:d,type:"number",min:Ct.limit.min,max:Ct.limit.max,step:1,value:X,onChange:I=>oe(Number(I.target.value)),disabled:!P,className:"w-24 rounded-lg border border-slate-300 border-solid px-3 py-2 text-[13px] text-slate-800","data-testid":"compare-limit-input"})]})]}),U("div",{className:"mt-4",children:U("button",{type:"submit",disabled:!ce,className:"rounded-lg bg-indigo-600 px-4 py-2 font-semibold text-[13px] text-white hover:bg-indigo-700 disabled:cursor-not-allowed disabled:opacity-50","data-testid":"compare-run-button",children:Y?"\u6BD4\u8F03\u4E2D\u2026":"\u6BD4\u8F03\u3092\u5B9F\u884C"})})]}),V!==null&&U("div",{role:"alert",className:"rounded-lg border border-red-200 border-solid bg-red-50 p-4 text-[13px] text-red-800","data-testid":"compare-failure",children:V}),B!==null&&xe!==null&&re("div",{className:"space-y-4 rounded-xl border border-slate-200 border-solid bg-white p-6 shadow-sm","data-testid":"compare-results",children:[re("dl",{className:"grid grid-cols-1 gap-3 text-[13px] sm:grid-cols-3","data-testid":"compare-agreement",children:[re("div",{children:[U("dt",{className:"text-slate-500",children:"\u5171\u901A\u30D2\u30C3\u30C8"}),re("dd",{"data-testid":"compare-shared-count",children:[xe.sharedCount," \u4EF6 (A ",B.left.hits.length," \u4EF6 / B ",B.right.hits.length," \u4EF6)"]})]}),re("div",{children:[U("dt",{className:"text-slate-500",children:"\u91CD\u306A\u308A\u7387 (Jaccard)"}),U("dd",{"data-testid":"compare-overlap-ratio",children:xe.overlapRatio===null?"\u30D2\u30C3\u30C8\u306A\u3057":`${(xe.overlapRatio*100).toFixed(1)}%`})]}),re("div",{children:[U("dt",{className:"text-slate-500",children:"\u9806\u4F4D\u5DEE\u306E\u5E73\u5747 (\u5171\u901A\u5206)"}),U("dd",{"data-testid":"compare-rank-difference",children:xe.meanAbsoluteRankDifference===null?"\u5171\u901A\u30D2\u30C3\u30C8\u306A\u3057":xe.meanAbsoluteRankDifference.toFixed(2)})]})]}),re("div",{className:"grid grid-cols-1 gap-4 md:grid-cols-2",children:[ve(B.left),ve(B.right)]})]})]})}import{jsx as D,jsxs as A}from"react/jsx-runtime";function ga(e){return e===null?st:`${e.length} \u7A2E`}var st="\u672A\u8A2D\u5B9A";function at(e,t=""){return e===null?st:`${e}${t}`}function gt(e){return e===null?st:`${e} \u4EF6`}function gs(e){if(e.currentVersion===null&&e.lifecyclePhase===null)return`${e.schemaName} (\u79FB\u884C\u53F0\u5E33\u306F\u672A\u8A18\u9332)`;let t=e.currentVersion===null?st:`v${e.currentVersion}`;return`${e.schemaName} ${t} (${e.lifecyclePhase??st})`}function lr({tenantId:e,ontologyStatus:t}){let n=t.classes,o=t.predicates;return A("div",{className:"space-y-6","data-testid":"ontology-status-card",children:[A("div",{className:"rounded-xl border border-slate-200 border-solid bg-white p-6 shadow-sm",children:[A("div",{className:"flex flex-col justify-between gap-3 md:flex-row md:items-center",children:[A("div",{children:[A("div",{className:"flex items-center gap-2",children:[D("h2",{className:"font-bold text-base text-slate-900",children:"\u30AA\u30F3\u30C8\u30ED\u30B8\u30FC & \u30B9\u30AD\u30FC\u30DE\u30AC\u30D0\u30CA\u30F3\u30B9\u72B6\u614B"}),D("span",{className:`inline-flex items-center rounded-full px-2.5 py-0.5 font-bold text-xs ${t.autonomousEvolutionEnabled?"bg-emerald-100 text-emerald-800":"bg-slate-100 text-slate-700"}`,"data-testid":"ontology-evolution-badge",children:t.autonomousEvolutionEnabled?"\u81EA\u5F8B\u7684\u30AA\u30F3\u30C8\u30ED\u30B8\u30FC\u9032\u5316: \u6709\u52B9":"\u81EA\u5F8B\u9032\u5316: \u505C\u6B62\u4E2D"}),D("span",{className:"inline-flex items-center rounded-sm bg-indigo-100 px-2 py-0.5 font-mono font-semibold text-indigo-800 text-xs","data-testid":"ontology-schema-version",children:gs(t)})]}),D("p",{className:"mt-1 text-slate-500 text-xs",children:"Neo4j \u7269\u7406\u30B0\u30E9\u30D5\u30B9\u30AD\u30FC\u30DE\u5236\u7D04\u3001\u8AD6\u7406\u30A8\u30F3\u30C6\u30A3\u30C6\u30A3\u30AF\u30E9\u30B9\u4F53\u7CFB\u3001\u304A\u3088\u3073\u4EBA\u9593\u53C2\u52A0\u578B (HITL) \u30AA\u30F3\u30C8\u30ED\u30B8\u30FC\u6607\u683C\u30D1\u30A4\u30D7\u30E9\u30A4\u30F3\u306E\u7A3C\u50CD\u72B6\u6CC1"})]}),A("div",{className:"inline-flex items-center rounded-lg border border-slate-200 border-solid bg-slate-50 px-3 py-1.5 font-medium text-slate-600 text-xs",children:["\u30C6\u30CA\u30F3\u30C8\u540D\u524D\u7A7A\u9593:"," ",D("span",{className:"ml-1.5 font-bold text-slate-800","data-testid":"ontology-tenant-id",children:e})]})]}),A("div",{className:"mt-4 grid grid-cols-2 gap-3 sm:grid-cols-4",children:[A("div",{className:"rounded-lg border border-slate-200 border-solid bg-slate-50/70 p-3",children:[D("span",{className:"block text-slate-500 text-xs",children:"\u7269\u7406\u4E00\u610F\u5236\u7D04 (Unique)"}),D("span",{className:"mt-1 block font-bold font-mono text-base text-slate-900","data-testid":"ontology-constraints-count",children:gt(t.totalConstraints)})]}),A("div",{className:"rounded-lg border border-slate-200 border-solid bg-slate-50/70 p-3",children:[D("span",{className:"block text-slate-500 text-xs",children:"\u691C\u7D22\u7D22\u5F15 (DDL \u304C\u4F5C\u308B\u5206)"}),D("span",{className:"mt-1 block font-bold font-mono text-base text-slate-900","data-testid":"ontology-indexes-count",children:gt(t.searchIndexes)}),A("span",{className:"block text-slate-500 text-xs","data-testid":"ontology-indexes-total",children:["\u5168\u7D22\u5F15: ",gt(t.totalIndexes)]})]}),A("div",{className:"rounded-lg border border-slate-200 border-solid bg-slate-50/70 p-3",children:[D("span",{className:"block text-slate-500 text-xs",children:"\u6607\u683C\u5224\u5B9A\u3057\u304D\u3044\u5024 (\u78BA\u4FE1\u5EA6/\u5171\u8D77)"}),A("span",{className:"mt-1 block font-bold font-mono text-base text-indigo-700","data-testid":"ontology-thresholds-info",children:[at(t.promotionThresholds.confidence)," / ",at(t.promotionThresholds.cooccurrence," \u56DE")]})]}),A("div",{className:"rounded-lg border border-slate-200 border-solid bg-slate-50/70 p-3",children:[D("span",{className:"block text-slate-500 text-xs",children:"HITL \u6607\u683C\u627F\u8A8D\u5F85\u3061\u5019\u88DC"}),D("span",{className:"mt-1 block font-bold font-mono text-amber-700 text-base","data-testid":"ontology-unresolved-count",children:gt(t.unresolvedCandidatesCount)})]})]})]}),A("div",{className:"grid grid-cols-1 gap-6 lg:grid-cols-2",children:[A("div",{className:"rounded-xl border border-slate-200 border-solid bg-white p-6 shadow-sm",children:[A("div",{className:"flex items-center justify-between pb-3",children:[A("div",{children:[D("h3",{className:"font-bold text-slate-900 text-sm",children:"\u30AA\u30F3\u30C8\u30ED\u30B8\u30FC\u4E3B\u8981\u30AF\u30E9\u30B9\u4F53\u7CFB (Node Labels)"}),D("p",{className:"text-slate-500 text-xs",children:"\u30B0\u30E9\u30D5\u5185\u3067\u30E2\u30C7\u30EB\u5316\u3055\u308C\u3066\u3044\u308B\u6B63\u6E96\u30A8\u30F3\u30C6\u30A3\u30C6\u30A3\u30CE\u30FC\u30C9\u7A2E\u5225"})]}),D("span",{className:"rounded-sm bg-indigo-50 px-2 py-0.5 font-semibold text-indigo-700 text-xs","data-testid":"ontology-classes-count",children:ga(n)})]}),A("div",{className:"divide-y divide-solid divide-slate-100",children:[n===null&&D("p",{className:"py-3 text-slate-500 text-xs","data-testid":"ontology-classes-unsupplied",children:"\u3053\u306E\u914D\u5099\u306E\u30AF\u30E9\u30B9\u8A9E\u5F59\u304C\u4F9B\u7D66\u3055\u308C\u3066\u3044\u307E\u305B\u3093\u3002\u5B9F\u88C5\u304C\u8A31\u3059\u8A9E\u5F59\u3092\u8FD4\u3059\u7D4C\u8DEF\u304C\u7D50\u7DDA\u3055\u308C\u3066\u3044\u306A\u3044\u53EF\u80FD\u6027\u304C\u3042\u308A\u307E\u3059\u3002"}),n?.map(d=>A("div",{className:"flex items-start justify-between py-2.5","data-testid":`ontology-class-${d.name}`,children:[A("div",{children:[D("span",{className:"inline-block font-bold font-mono text-indigo-700 text-xs",children:d.name}),D("p",{className:"mt-0.5 text-slate-600 text-xs",children:d.description})]}),typeof d.count=="number"&&D("span",{className:"rounded-sm bg-slate-100 px-2 py-0.5 font-mono text-slate-600 text-xs",children:d.count.toLocaleString()})]},d.name))]})]}),A("div",{className:"rounded-xl border border-slate-200 border-solid bg-white p-6 shadow-sm",children:[A("div",{className:"flex items-center justify-between pb-3",children:[A("div",{children:[D("h3",{className:"font-bold text-slate-900 text-sm",children:"\u30EA\u30EC\u30FC\u30B7\u30E7\u30F3\u30B7\u30C3\u30D7\u8FF0\u8A9E\u4F53\u7CFB (Predicates)"}),D("p",{className:"text-slate-500 text-xs",children:"\u30A8\u30F3\u30C6\u30A3\u30C6\u30A3\u9593\u306E\u30BB\u30DE\u30F3\u30C6\u30A3\u30C3\u30AF\u95A2\u4FC2\u3068\u6709\u5411\u6027"})]}),D("span",{className:"rounded-sm bg-amber-50 px-2 py-0.5 font-semibold text-amber-700 text-xs","data-testid":"ontology-predicates-count",children:ga(o)})]}),A("div",{className:"divide-y divide-solid divide-slate-100",children:[o===null&&D("p",{className:"py-3 text-slate-500 text-xs","data-testid":"ontology-predicates-unsupplied",children:"\u3053\u306E\u914D\u5099\u306E\u8FF0\u8A9E\u8A9E\u5F59\u304C\u4F9B\u7D66\u3055\u308C\u3066\u3044\u307E\u305B\u3093\u3002\u5B9F\u88C5\u304C\u8A31\u3059\u8A9E\u5F59\u3092\u8FD4\u3059\u7D4C\u8DEF\u304C\u7D50\u7DDA\u3055\u308C\u3066\u3044\u306A\u3044\u53EF\u80FD\u6027\u304C\u3042\u308A\u307E\u3059\u3002"}),o?.map(d=>A("div",{className:"flex items-start justify-between py-2.5","data-testid":`ontology-predicate-${d.name}`,children:[A("div",{children:[D("span",{className:"inline-block font-bold font-mono text-amber-800 text-xs",children:d.name}),D("p",{className:"mt-0.5 text-slate-600 text-xs",children:d.description})]}),D("span",{className:"rounded-sm border border-slate-200 border-solid bg-slate-50 px-2 py-0.5 font-mono text-[11px] text-slate-600",children:d.direction})]},d.name))]})]})]}),A("div",{className:"rounded-xl border border-indigo-100 border-solid bg-indigo-50/40 p-5 shadow-sm","data-testid":"ontology-evolution-policy-card",children:[D("h3",{className:"font-bold text-indigo-950 text-sm",children:"\u81EA\u5F8B\u7684\u30AA\u30F3\u30C8\u30ED\u30B8\u30FC\u9032\u5316 (Autonomous Ontology Evolution) \u30DD\u30EA\u30B7\u30FC"}),A("div",{className:"mt-2 grid grid-cols-1 gap-3 text-indigo-900 text-xs md:grid-cols-3",children:[A("div",{className:"rounded-lg border border-indigo-200/60 border-solid bg-white p-3",children:[D("span",{className:"font-semibold text-slate-700",children:"3 \u6761\u4EF6 AND \u30B2\u30FC\u30C8:"}),A("p",{className:"mt-1 text-slate-600",children:["\u672A\u89E3\u6C7A\u30E1\u30F3\u30B7\u30E7\u30F3\u51FA\u73FE\u6642\u306B\u985E\u4F3C\u5EA6 \u2267 ",at(t.promotionThresholds.confidence),"\u3001\u5171\u8D77\u56DE\u6570 \u2267 ",at(t.promotionThresholds.cooccurrence),"\u3001\u8B58\u5225\u30E6\u30FC\u30B6\u30FC\u6570 \u2267"," ",at(t.promotionThresholds.minDistinctUsers)," \u306E\u5168\u5145\u8DB3\u3092\u8981\u6C42\u3002"]})]}),A("div",{className:"rounded-lg border border-indigo-200/60 border-solid bg-white p-3",children:[D("span",{className:"font-semibold text-slate-700",children:"2x \u5171\u8D77\u983B\u5EA6\u518D\u63D0\u6848\u30D0\u30C3\u30AF\u30AA\u30D5:"}),D("p",{className:"mt-1 text-slate-600",children:"\u904B\u7528\u8005\u306B\u3088\u308A\u6607\u683C\u3092\u5374\u4E0B\u3055\u308C\u305F\u5019\u88DC\u306F\u3001\u524D\u56DE\u306E\u5171\u8D77\u6570\u306E 2 \u500D\u4EE5\u4E0A\u306E\u983B\u5EA6\u3067\u518D\u8A00\u53CA\u3055\u308C\u308B\u307E\u3067\u6607\u683C\u30AD\u30E5\u30FC\u3078\u306E\u518D\u6D6E\u4E0A\u3092\u81EA\u52D5\u6291\u5236\u3002"})]}),A("div",{className:"rounded-lg border border-indigo-200/60 border-solid bg-white p-3",children:[D("span",{className:"font-semibold text-slate-700",children:"Cypher AST ABAC \u8A8D\u53EF\u6CE8\u5165:"}),A("p",{className:"mt-1 text-slate-600",children:["Neo4j \u30AF\u30A8\u30EA\u5B9F\u884C\u6642\u306B ",D("code",{className:"font-mono text-indigo-800",children:"tenantId = $tenant_id"})," \u3068\u6A5F\u5BC6\u533A\u5206\u8FF0\u8A9E\u3092\u4E0D\u53EF\u5206\u306B\u5408\u6210\u3057\u3001\u30C6\u30CA\u30F3\u30C8\u5B8C\u5168\u9694\u96E2\u3092\u62C5\u4FDD\u3002"]})]})]})]})]})}import{DOCUMENT_KIND_LABELS as qe,DOCUMENT_KINDS as ft,flowFor as ks,flowStepGates as xa,MIME_KIND_RULES as Es,PIPELINE_STEPS as Tt}from"@aiquants/enrichment-core";import{useEffect as Is,useId as nt,useRef as xt,useState as $t}from"react";import{ceil8 as fs,textWidthEm as xs}from"@aiquants/console-ui/core";import{orderedSteps as ys,PIPELINE_STEPS as vs}from"@aiquants/enrichment-core";var Xe={inset:12,labelFontSize:13,captionFontSize:11},Ue={offset:3,stroke:2},hs={node:{width:fs(Math.max(...Object.values(vs).map(e=>xs(e.label)))*Xe.labelFontSize+2*Xe.inset),height:56},gap:{column:48,row:24},padding:24};function Oe(e){return Math.round(e*1e3)/1e3}function Ns(e){let t=new Map;for(let n of e){let o=n.dependsOn.reduce((d,i)=>Math.max(d,t.get(i)),-1);t.set(n.step,o+1)}return t}function Lt(e,t){return`${e}->${t}`}function Ss(e,t){let n=[],o=new Map;return{slots:[...e.map(i=>{let m=t.get(i.step),u=i.dependsOn.map(y=>{let h=[],v=y;for(let C=t.get(y)+1;C<m;C+=1){let N=`${Lt(y,i.step)}@${C}`;n.push({id:N,rank:C,predecessors:[v]}),h.push(N),v=N}return o.set(Lt(y,i.step),h),v});return{id:i.step,rank:m,predecessors:u}}),...n],chains:o}}function ws(e){let t=new Map,n=Math.max(...e.map(o=>o.rank));for(let o=0;o<=n;o+=1){let i=e.filter(m=>m.rank===o).map((m,u)=>{let y=o===0?u:m.predecessors.reduce((h,v)=>h+t.get(v),0)/m.predecessors.length;return{slot:m,barycenter:y}});i.sort((m,u)=>m.barycenter-u.barycenter),i.forEach(({slot:m},u)=>{t.set(m.id,u)})}return t}function fa(e,t=hs){let n=ys(e),o=Ns(n),{slots:d,chains:i}=Ss(n,o),m=ws(d),{node:u,gap:y,padding:h}=t,v=E=>({x:Oe(h+E.rank*(u.width+y.column)),y:Oe(h+m.get(E.id)*(u.height+y.row))}),C=new Map(d.map(E=>[E.id,v(E)])),N=n.map(E=>{let B=C.get(E.step);return{key:E.step,x:B.x,y:B.y,rank:o.get(E.step),order:m.get(E.step),width:u.width,height:u.height}}),X=E=>Oe(E+u.height/2),oe=n.flatMap(E=>E.dependsOn.map(B=>{let M=C.get(B),P=C.get(E.step),z=Oe(M.x+u.width),b=X(M.y),$=`M ${z} ${b}`,q=(O,ce)=>{let te=Oe((z+O)/2);$+=` C ${te} ${b}, ${te} ${ce}, ${O} ${ce}`};for(let O of i.get(Lt(B,E.step))){let ce=C.get(O),te=X(ce.y);q(ce.x,te),z=Oe(ce.x+u.width),b=te,$+=` L ${z} ${b}`}return q(P.x,X(P.y)),{from:B,to:E.step,path:$}})),Y=[...C.values()],S=Oe(Math.max(...Y.map(E=>E.x+u.width))+h),V=Oe(Math.max(...Y.map(E=>E.y+u.height))+h);return{width:S,height:V,steps:N,edges:oe}}import{Fragment as ha,jsx as f,jsxs as _}from"react/jsx-runtime";var Na="\u4F9D\u5B58\u306A\u3057 (\u6D41\u308C\u306E\u6700\u521D\u306B\u8D70\u308B)",ya={EXTRACTING:"\u62BD\u51FA",ENRICHING:"\u8981\u7D04",PROJECTING:"\u6295\u5F71"},Rs={rebuild:"\u672C\u6587\u304B\u3089\u7D44\u307F\u76F4\u3059",existing:"\u524D\u6BB5\u304C\u66F8\u3044\u305F\u884C\u3092\u305D\u306E\u307E\u307E\u4F7F\u3046"},Sa={open:{badge:"\u9580: \u958B",stroke:"stroke-emerald-500",dash:void 0},"closed-skip":{badge:"\u9580: \u9589 (\u7701\u7565)",stroke:"stroke-amber-500",dash:void 0},"closed-fail":{badge:"\u9580: \u9589 (\u5931\u6557)",stroke:"stroke-red-500",dash:void 0},unmeasured:{badge:"\u9580: \u672A\u6E2C\u5B9A",stroke:"stroke-slate-400",dash:"6 4"}},wa={none:"\u9580\u306A\u3057",skip:"\u9589\u3058\u305F\u3089\u7701\u7565",fail:"\u9589\u3058\u305F\u3089\u5931\u6557",mixed:"\u9589\u3058\u305F\u9580\u3067\u7570\u306A\u308B"},_s={open:"\u958B",closed:"\u9589",unmeasured:"\u672A\u6E2C\u5B9A"},rt="rgb(248 250 252)",Cs={backgroundColor:rt,backgroundImage:`linear-gradient(to right, ${rt}, ${rt}), linear-gradient(to right, ${rt}, ${rt}), linear-gradient(to right, rgb(15 23 42 / 0.2), transparent), linear-gradient(to left, rgb(15 23 42 / 0.2), transparent)`,backgroundPosition:"left center, right center, left center, right center",backgroundRepeat:"no-repeat",backgroundSize:"24px 100%, 24px 100%, 12px 100%, 12px 100%",backgroundAttachment:"local, local, scroll, scroll"};function ka(e,t){let n=t[e.featureFlagKey];return n===void 0?"unmeasured":n?"open":"closed"}function Ps(e,t){let n=e.map(o=>({gate:o,state:ka(o,t)}));return n.some(({gate:o,state:d})=>d==="closed"&&o.whenClosed==="fail")?"closed-fail":n.some(({state:o})=>o==="closed")?"closed-skip":n.some(({state:o})=>o==="unmeasured")?"unmeasured":"open"}function va(e){return e.length===0?"none":e.every(t=>t.whenClosed==="fail")?"fail":e.every(t=>t.whenClosed==="skip")?"skip":"mixed"}function Ls(e,t){let{badge:n}=Sa[e];return t==="none"||e==="closed-skip"||e==="closed-fail"?n:`${n}\u30FB${wa[t]}`}function $s(e){return e.whenClosed==="skip"?"\u9589\u3058\u305F\u3068\u304D\u306F\u6BB5\u3092\u7701\u7565":`\u9589\u3058\u305F\u3068\u304D\u306F ${e.failureStatus} \u3067\u5931\u6557`}function At(e){return e.map(t=>Tt[t].label).join("\u3001")}function Ts(e){return e.dependsOn.length===0?Na:`\u4F9D\u5B58: ${At(e.dependsOn)}`}function hr({featureFlags:e,metrics:t,metricSampleWindow:n,selectedKind:o,onSelectKind:d,selectedStepKey:i,onSelectStep:m}){if(!Number.isSafeInteger(n)||n<=0)throw new RangeError(`metricSampleWindow must be a positive integer, got ${n}.`);let u=nt(),y=nt(),h=nt(),v=nt(),C=nt(),[N,X]=$t(ft[0]),[oe,Y]=$t(null),[S,V]=$t(null),E=xt(new Map),B=xt(new Map),M=xt(null),P=xt(null),{labels:z}=se(),b=o!==void 0?o:N,$=i!==void 0?i:oe,q=ks(b),O=fa(q),ce=new Map(q.steps.map(l=>[l.step,l])),te=l=>{Y(l),m?.(l)},xe=l=>{X(l),d?.(l),te(null)},ve=(l,T)=>{let ae=ft.length-1,J;switch(l.key){case"ArrowRight":J=T===ae?0:T+1;break;case"ArrowLeft":J=T===0?ae:T-1;break;case"Home":J=0;break;case"End":J=ae;break;default:return}l.preventDefault();let de=ft[J];xe(de),E.current.get(de)?.focus()},I=l=>{let T=P.current;if(te(null),T?.isConnected){T.focus();return}B.current.get(l)?.focus()},ue=l=>{te(l===$?null:l)},W=(l,T)=>{l.currentTarget.focus(),ue(T)},Z=(l,T)=>{l.key==="Enter"||l.key===" "?(l.preventDefault(),ue(T)):l.key==="Escape"&&te(null)},G=$===null?void 0:ce.get($),he=G===void 0?null:G.step;Is(()=>{if(he===null){P.current=null;return}let l=document.activeElement;(l instanceof HTMLElement||l instanceof SVGElement)&&l!==document.body&&M.current?.contains(l)===!1&&(P.current=l)},[he]);let le=G===void 0?void 0:Tt[G.step],Ee=G===void 0?[]:xa(G),$e=G===void 0?[]:q.steps.filter(l=>l.dependsOn.includes(G.step)).map(l=>l.step),me=le===void 0?void 0:t.find(l=>l.documentKind===b&&l.stepKey===le.key),Ne=qe[b];return _("section",{className:"space-y-6","aria-labelledby":u,"data-testid":"pipeline-flow-viewer","data-kind":b,children:[_("div",{className:"rounded-xl border border-slate-200 border-solid bg-white p-6 shadow-sm",children:[f("h2",{id:u,className:"font-bold text-base text-slate-900",children:"\u53D6\u308A\u8FBC\u307F\u30D1\u30A4\u30D7\u30E9\u30A4\u30F3"}),f("p",{className:"mt-2 text-[13px] text-slate-500",children:"\u6587\u66F8\u306E\u7A2E\u985E\u3054\u3068\u306B\u3001\u5B9F\u969B\u306B\u8D70\u308B\u6BB5\u3068\u305D\u306E\u4F9D\u5B58\u3092\u63CF\u304D\u307E\u3059\u3002\u5404\u6BB5\u304C\u5F85\u3064\u6BB5\u306F\u3001\u6BB5\u306E\u8AAC\u660E\u3068\u8A73\u7D30\u306B\u3082\u6587\u5B57\u3067\u793A\u3057\u307E\u3059\u3002\u9580\u306E\u72B6\u614B\u306F\u30C6\u30CA\u30F3\u30C8\u306E\u6A5F\u80FD\u30D5\u30E9\u30B0\u3092\u91CD\u306D\u305F\u3082\u306E\u3067\u3059\u3002"}),f("div",{role:"tablist","aria-label":"\u6587\u66F8\u306E\u7A2E\u985E",className:"mt-4 flex flex-wrap gap-2","data-testid":"flow-kind-tablist",children:ft.map((l,T)=>{let ae=l===b;return f("button",{ref:J=>{J===null?E.current.delete(l):E.current.set(l,J)},type:"button",role:"tab","aria-selected":ae,"aria-controls":y,tabIndex:ae?0:-1,onClick:()=>xe(l),onKeyDown:J=>ve(J,T),className:ae?"rounded-lg border border-indigo-600 border-solid bg-indigo-600 px-3 py-1.5 font-semibold text-[13px] text-white":"rounded-lg border border-slate-300 border-solid bg-white px-3 py-1.5 font-medium text-[13px] text-slate-700 hover:bg-slate-50","data-testid":`flow-kind-${l}`,children:qe[l]},l)})}),f("div",{id:y,role:"tabpanel","aria-label":`${qe[b]} \u306E\u6D41\u308C`,"aria-describedby":h,className:"mt-4 overflow-x-auto rounded-lg border border-slate-200 border-solid p-4",style:Cs,"data-testid":"flow-scroll",children:_("svg",{viewBox:`0 0 ${O.width} ${O.height}`,width:O.width,height:O.height,role:"group","aria-label":`${qe[b]} \u306E\u30D1\u30A4\u30D7\u30E9\u30A4\u30F3`,style:{display:"block",maxWidth:"none"},"data-testid":"flow-svg",children:[f("title",{children:`${qe[b]} \u306E\u30D1\u30A4\u30D7\u30E9\u30A4\u30F3`}),f("defs",{children:f("marker",{id:`${y}-arrow`,viewBox:"0 0 8 8",refX:"8",refY:"4",markerWidth:"8",markerHeight:"8",orient:"auto",children:f("path",{d:"M 0 0 L 8 4 L 0 8 z",className:"fill-slate-500","data-testid":"flow-edge-arrowhead"})})}),O.edges.map(l=>f("path",{d:l.path,fill:"none",strokeWidth:1.5,markerEnd:`url(#${y}-arrow)`,className:"stroke-slate-500","data-testid":`flow-edge-${l.from}-${l.to}`},`${l.from}-${l.to}`)),O.steps.map(l=>{let T=Tt[l.key],ae=ce.get(l.key),J=xa(ae),de=Ps(J,e),He=va(J),Te=Sa[de],Ve=Ls(de,He),_e=l.key===$,F=l.key===S,ze=`${y}-depends-${l.key}`;return _("g",{ref:Ie=>{Ie===null?B.current.delete(l.key):B.current.set(l.key,Ie)},transform:`translate(${l.x} ${l.y})`,role:"button",tabIndex:0,"aria-label":`${T.label} (${Ve})`,"aria-describedby":ze,"aria-expanded":_e,"aria-controls":_e?C:void 0,onClick:Ie=>W(Ie,l.key),onKeyDown:Ie=>Z(Ie,l.key),onFocus:()=>V(l.key),onBlur:()=>V(null),className:"cursor-pointer focus:outline-none","data-testid":`flow-node-${l.key}`,"data-step-key":l.key,"data-gate-state":de,"data-gate-policy":He,"data-selected":_e,"data-focused":F,children:[f("desc",{id:ze,"data-testid":`flow-node-dependencies-${l.key}`,children:Ts(ae)}),F&&f("rect",{x:-Ue.offset,y:-Ue.offset,width:l.width+2*Ue.offset,height:l.height+2*Ue.offset,rx:8+Ue.offset,fill:"none",strokeWidth:Ue.stroke,className:"stroke-indigo-600","data-testid":`flow-node-focus-ring-${l.key}`}),f("rect",{width:l.width,height:l.height,rx:8,strokeWidth:_e?3:1.5,strokeDasharray:Te.dash,className:`${Te.stroke} ${_e?"fill-indigo-50":"fill-white"}`,"data-testid":`flow-node-box-${l.key}`}),f("text",{x:Xe.inset,y:20,className:"fill-slate-900 font-semibold text-[13px]","data-testid":`flow-node-label-${l.key}`,children:T.label}),f("text",{x:Xe.inset,y:36,className:"fill-slate-600 text-[11px]","data-testid":`flow-node-phase-${l.key}`,children:ya[T.phase]}),f("text",{x:Xe.inset,y:49,className:"fill-slate-700 text-[11px]","data-testid":`flow-gate-badge-${l.key}`,"data-gate-state":de,children:Ve})]},l.key)})]})}),_("p",{id:h,className:"mt-2 text-[11px] text-slate-500","data-testid":"flow-scroll-hint",children:["\u56F3\u306F\u5B9F\u5BF8 (\u5E45 ",O.width," px) \u3067\u63CF\u304D\u307E\u3059\u3002\u8868\u793A\u5E45\u306B\u53CE\u307E\u3089\u306A\u3044\u3068\u304D\u306F\u6A2A\u306B\u30B9\u30AF\u30ED\u30FC\u30EB\u3057\u3066\u304F\u3060\u3055\u3044 (Tab \u3067\u6BB5\u3078\u79FB\u308B\u3068\u3001\u305D\u306E\u6BB5\u304C\u898B\u3048\u308B\u4F4D\u7F6E\u307E\u3067\u52D5\u304D\u307E\u3059)\u3002"]})]}),le!==void 0&&G!==void 0&&_("section",{id:C,ref:M,className:"rounded-xl border border-slate-200 border-solid bg-white p-6 shadow-sm","aria-labelledby":v,"data-testid":"flow-step-detail","data-step-key":le.key,children:[_("div",{className:"flex items-start justify-between gap-4",children:[_("div",{children:[f("h3",{id:v,className:"font-bold text-base text-slate-900",children:le.label}),f("p",{className:"mt-1 text-[13px] text-slate-600",children:le.description})]}),f("button",{type:"button",onClick:()=>I(le.key),className:"rounded-lg border border-slate-300 border-solid px-3 py-1.5 text-[13px] text-slate-700 hover:bg-slate-50","data-testid":"flow-step-detail-close",children:"\u9589\u3058\u308B"})]}),_("dl",{className:"mt-4 grid grid-cols-1 gap-3 text-[13px] sm:grid-cols-2",children:[_("div",{children:[f("dt",{className:"font-semibold text-slate-500",children:"\u30A8\u30F3\u30C9\u30DD\u30A4\u30F3\u30C8"}),f("dd",{children:f("code",{className:"font-mono","data-testid":"flow-step-endpoint",children:le.endpoint})})]}),_("div",{children:[f("dt",{className:"font-semibold text-slate-500",children:"\u76F8"}),_("dd",{"data-testid":"flow-step-phase",children:[ya[le.phase]," (",le.phase,")"]})]}),_("div",{children:[f("dt",{className:"font-semibold text-slate-500",children:"\u80FD\u529B"}),f("dd",{"data-testid":"flow-step-capability",children:le.capability===null?"\u30E2\u30C7\u30EB\u3078\u9001\u3089\u306A\u3044":le.capability})]}),G.chunkSource!==void 0&&_("div",{children:[f("dt",{className:"font-semibold text-slate-500",children:"\u30C1\u30E3\u30F3\u30AF\u306E\u51FA\u6240"}),_("dd",{"data-testid":"flow-step-chunk-source","data-chunk-source":G.chunkSource,children:[Rs[G.chunkSource]," (",G.chunkSource,")"]})]}),_("div",{className:"sm:col-span-2",children:[f("dt",{className:"font-semibold text-slate-500",children:"\u4F9D\u5B58 (\u5148\u306B\u7D42\u3048\u308B\u6BB5)"}),f("dd",{"data-testid":"flow-step-depends-on",children:G.dependsOn.length===0?Na:At(G.dependsOn)})]}),_("div",{className:"sm:col-span-2",children:[f("dt",{className:"font-semibold text-slate-500",children:"\u5F8C\u7D9A (\u3053\u306E\u6BB5\u3092\u5F85\u3064\u6BB5)"}),f("dd",{"data-testid":"flow-step-dependents",children:$e.length===0?"\u5F8C\u7D9A\u306A\u3057 (\u6D41\u308C\u306E\u6700\u5F8C\u306B\u8D70\u308B)":At($e)})]}),_("div",{className:"sm:col-span-2",children:[f("dt",{className:"font-semibold text-slate-500",children:"\u9580"}),f("dd",{children:Ee.length===0?f("span",{"data-testid":"flow-step-no-gates",children:"\u9580\u306A\u3057 (\u5E38\u306B\u8D70\u308B)"}):_(ha,{children:[f("ul",{className:"space-y-1",children:Ee.map(l=>{let T=ka(l,e);return _("li",{"data-testid":`flow-gate-${l.featureFlagKey}`,"data-gate-state":T,"data-when-closed":l.whenClosed,children:[f("code",{className:"font-mono",children:l.featureFlagKey}),": ",_s[T]," \u2014 ",$s(l)]},l.featureFlagKey)})}),G.gatePolicy!==void 0&&_("p",{className:"mt-1 text-slate-600","data-testid":"flow-gate-policy-override",children:[Ne," \u306E\u6D41\u308C\u3067\u306F\u6BB5\u306E\u5BA3\u8A00 (",wa[va(le.gates)],") \u3092\u4E0A\u66F8\u304D\u3057\u3001\u9580\u304C\u9589\u3058\u308B\u3068\u5B9F\u884C\u3092 ",G.gatePolicy.failureStatus," \u3067\u5931\u6557\u3055\u305B\u307E\u3059\u3002"]})]})})]})]}),_("div",{className:"mt-4 rounded-lg border border-slate-200 border-solid bg-slate-50 p-4","data-testid":"flow-step-metric","data-kind":b,children:[_("span",{className:"block font-semibold text-[13px] text-slate-700",children:["\u76F4\u8FD1\u306E\u96C6\u8A08 (",Ne,"\u30FB\u76F4\u8FD1 ",n," \u4EF6)"]}),_("p",{className:"mt-1 text-[11px] text-slate-500","data-testid":"flow-metric-scope",children:[Ne," \u306E\u5B9F\u884C\u306B\u5C5E\u3059\u308B\u3001\u3053\u306E\u6BB5\u306E\u65B0\u3057\u3044\u8A18\u9332 ",n," \u4EF6\u307E\u3067\u3092\u96C6\u8A08\u3057\u3066\u3044\u307E\u3059\u3002\u4ED6\u306E\u7A2E\u985E\u306E\u5B9F\u884C\u306F\u6570\u3048\u307E\u305B\u3093\u3002"]}),me===void 0?_("p",{className:"mt-1 text-[13px] text-slate-500","data-testid":"flow-step-metric-empty","data-unmeasured-note":!0,children:[z.unmeasured," (",Ne," \u306E\u5B9F\u884C\u3067\u3053\u306E\u6BB5\u3092\u8A18\u9332\u3057\u305F\u3082\u306E\u306F\u307E\u3060\u3042\u308A\u307E\u305B\u3093)"]}):_(ha,{children:[_("dl",{className:"mt-2 grid grid-cols-2 gap-2 text-[13px] sm:grid-cols-4",children:[_("div",{children:[f("dt",{className:"text-slate-500",children:"\u6A19\u672C\u6570 (\u7701\u7565\u3092\u9664\u304F)"}),f("dd",{"data-testid":"flow-metric-sample-count",children:f(H,{value:me.sampleCount,testId:"flow-metric-sample-count-value"})})]}),_("div",{children:[f("dt",{className:"text-slate-500",children:"\u6210\u529F"}),f("dd",{"data-testid":"flow-metric-succeeded",children:f(H,{value:me.succeeded,testId:"flow-metric-succeeded-value"})})]}),_("div",{children:[f("dt",{className:"text-slate-500",children:"\u5931\u6557"}),f("dd",{"data-testid":"flow-metric-failed",children:f(H,{value:me.failed,testId:"flow-metric-failed-value"})})]}),_("div",{children:[f("dt",{className:"text-slate-500",children:"\u7701\u7565"}),f("dd",{"data-testid":"flow-metric-skipped",children:f(H,{value:me.skipped,testId:"flow-metric-skipped-value"})})]}),_("div",{children:[f("dt",{className:"text-slate-500",children:"p50"}),f("dd",{className:"whitespace-nowrap","data-testid":"flow-metric-p50",children:f(H,{value:me.durationP50Ms,unit:"ms",testId:"flow-metric-p50-value"})})]}),_("div",{children:[f("dt",{className:"text-slate-500",children:"p95"}),f("dd",{className:"whitespace-nowrap","data-testid":"flow-metric-p95",children:f(H,{value:me.durationP95Ms,unit:"ms",testId:"flow-metric-p95-value"})})]}),_("div",{className:"col-span-2",children:[f("dt",{className:"text-slate-500",children:"\u6700\u5F8C\u306E\u958B\u59CB"}),f("dd",{"data-testid":"flow-metric-last-started-at",children:f(we,{iso:me.lastStartedAt,testId:"flow-metric-last-started-at-value"})})]})]}),_("p",{className:"mt-2 text-[11px] text-slate-500","data-testid":"flow-metric-note","data-unmeasured-note":!0,children:["p50 / p95 \u306F\u6240\u8981\u3092\u6E2C\u3063\u305F\u8A18\u9332\u3060\u3051\u304B\u3089\u6C42\u3081\u307E\u3059\u3002\u7701\u7565\u3057\u305F\u6BB5\u306F\u300C\u7701\u7565\u300D\u306B\u3060\u3051\u6570\u3048\u3001\u6A19\u672C\u6570\u306B\u3082\u6240\u8981\u306B\u3082\u5165\u308A\u307E\u305B\u3093\u3002\u4F55\u3082\u547C\u3070\u305A\u306B\u6B62\u307E\u3063\u305F\u5931\u6557 (\u6240\u8981 ",z.unmeasured,") \u306F\u6A19\u672C\u6570\u3068\u300C\u5931\u6557\u300D\u306B\u306F\u5165\u308A\u307E\u3059\u304C\u3001\u6240\u8981\u306B\u306F\u5165\u308A\u307E\u305B\u3093\u3002"]})]})]})]}),_("div",{className:"rounded-xl border border-slate-200 border-solid bg-white p-6 shadow-sm",children:[f("h3",{className:"font-bold text-base text-slate-900",children:"MIME \u578B\u304B\u3089\u7A2E\u985E\u3078\u306E\u5206\u985E\u8868"}),_("p",{className:"mt-1 text-[13px] text-slate-500",children:["\u5206\u985E\u5668\u304C\u8AAD\u3080\u8868\u305D\u306E\u3082\u306E\u3067\u3059\u3002",f("code",{className:"font-mono",children:"*"})," \u3067\u7D42\u308F\u308B\u898F\u5247\u306F\u524D\u65B9\u4E00\u81F4\u3001\u305D\u308C\u4EE5\u5916\u306F\u5B8C\u5168\u4E00\u81F4\u3067\u3001\u6700\u521D\u306B\u4E00\u81F4\u3057\u305F\u898F\u5247\u304C\u52DD\u3061\u307E\u3059\u3002\u3069\u306E\u898F\u5247\u306B\u3082\u4E00\u81F4\u3057\u306A\u3044\u578B\u306F\u300C",qe.other,"\u300D\u3067\u3059\u3002"]}),f("div",{className:"relative mt-4 overflow-x-auto","data-testid":"flow-mime-scroll",children:_("table",{className:"min-w-full divide-y divide-solid divide-slate-200 text-left text-[13px]","data-testid":"flow-mime-table",children:[f("thead",{className:"bg-slate-50 font-semibold text-slate-700",children:_("tr",{children:[f("th",{scope:"col",className:"px-3 py-2",children:"MIME \u578B\u306E\u30D1\u30BF\u30FC\u30F3"}),f("th",{scope:"col",className:"px-3 py-2",children:"\u7A2E\u985E"})]})}),f("tbody",{className:"divide-y divide-solid divide-slate-100",children:Es.map(([l,T],ae)=>_("tr",{className:T===b?"bg-indigo-50":void 0,"data-testid":`flow-mime-rule-${ae}`,"data-kind":T,"data-selected":T===b,children:[f("td",{className:"px-3 py-2",children:f("code",{className:"font-mono",children:l})}),f("td",{className:"px-3 py-2",children:qe[T]})]},l))})]})})]})]})}import{DOCUMENT_KIND_LABELS as Ia,PIPELINE_STEPS as Ot}from"@aiquants/enrichment-core";import{useEffect as Dt,useId as Mt,useRef as Ge}from"react";import{Fragment as dt,jsx as x,jsxs as k}from"react/jsx-runtime";var As=8,Ds={text_layer:"\u6587\u5B57\u5C64",ocr:"OCR",transcript:"\u8EE2\u5199"},Ms={provider:"\u30D7\u30ED\u30D0\u30A4\u30C0",model:"\u30E2\u30C7\u30EB",engine:"\u30A8\u30F3\u30B8\u30F3",prompt_key:"\u30D7\u30ED\u30F3\u30D7\u30C8",prompt_version:"\u7248",duration_ms:"\u51E6\u7406\u6642\u9593",input_chars:"\u5165\u529B\u6587\u5B57\u6570",output_chars:"\u51FA\u529B\u6587\u5B57\u6570",chunk_count:"\u30C1\u30E3\u30F3\u30AF",points_upserted:"\u6295\u5165\u70B9\u6570",collection:"\u30B3\u30EC\u30AF\u30B7\u30E7\u30F3",embedding_model:"\u57CB\u3081\u8FBC\u307F\u30E2\u30C7\u30EB",graph_nodes:"\u30B0\u30E9\u30D5\u30CE\u30FC\u30C9"},Ra={duration_ms:"ms",input_chars:void 0,output_chars:void 0,chunk_count:void 0,points_upserted:void 0,graph_nodes:void 0},Os=["provider","model","engine","prompt_key","prompt_version","duration_ms","input_chars","output_chars","chunk_count","points_upserted","collection","embedding_model","graph_nodes"],Fs=["FAILED","RUNNING","SUCCEEDED","SKIPPED"],Ks={atomic:"whitespace-nowrap",anywhere:"wrap-anywhere"};function _a(e){return Object.hasOwn(Ra,e)}function ot(e,t){return`run-step-provenance-value-${e}-${t}`}function Bs(e,t,n){if(_a(t)){let d=e[t];return d===null?null:x(H,{value:d,unit:Ra[t],testId:ot(n,t)})}let o=e[t];return o===null?null:x(et,{text:String(o),testId:ot(n,t)})}function Us(e,t){let n=Os.map(i=>({key:i,label:Ms[i],value:Bs(e,i,t),breaks:_a(i)?"atomic":"anywhere"})),o=e.pages_read!==null||e.pages_total!==null,d=k(dt,{children:[x(H,{value:e.pages_read,testId:ot(t,"pages_read")})," / ",x(H,{value:e.pages_total,testId:ot(t,"pages_total")})]});return[...n,{key:"pages",label:"\u8AAD\u3093\u3060\u30DA\u30FC\u30B8",value:o?d:null,breaks:"atomic"},{key:"body_source",label:"\u672C\u6587\u306E\u51FA\u6240",value:e.body_source===null?null:x(et,{text:Ds[e.body_source],testId:ot(t,"body_source")}),breaks:"anywhere"}]}function qs(e){let t=[],n=new Map;for(let o of[...e.steps].sort((d,i)=>d.sequence-i.sequence)){if(Ot[o.stepKey].fanOut!=="children"||o.targetMetadataId===e.metadataId){t.push({kind:"step",step:o});continue}let d=n.get(o.stepKey);if(d!==void 0){d.push(o);continue}let i=[o];n.set(o.stepKey,i),t.push({kind:"fan_out",stepKey:o.stepKey,steps:i})}return t}function Gs(e){if(e.skipReason===null)throw new RangeError(`Step record #${e.id} is SKIPPED without a skip reason, which the pipeline record schema refuses.`);return e.skipReason}function Hs({step:e}){let{labels:t}=se();if(e.status==="SKIPPED")return k("p",{className:"text-[13px] text-slate-600","data-testid":`run-step-skip-reason-${e.sequence}`,children:["\u7701\u7565: ",Jt(Gs(e))]});if(e.provenance===null)return x("p",{className:"text-[13px] text-slate-500","data-testid":`run-step-provenance-missing-${e.sequence}`,children:"\u6BB5\u306E\u5831\u544A\u306F\u3042\u308A\u307E\u305B\u3093\u3002"});let n=e.provenance,o=Us(n,e.sequence),d=o.filter(m=>m.value!==null),i=o.filter(m=>m.value===null);return k(dt,{children:[d.length>0&&x("dl",{className:"grid grid-cols-2 gap-x-4 gap-y-1 text-[13px] sm:grid-cols-3","data-testid":`run-step-provenance-${e.sequence}`,children:d.map(m=>k("div",{className:"border-slate-100 border-b border-solid py-0.5",children:[x("dt",{className:"text-slate-500",children:m.label}),x("dd",{className:`text-slate-800 ${Ks[m.breaks]}`,"data-provenance-key":m.key,children:m.value})]},m.key))}),i.length>0&&k("p",{className:"mt-1 text-[11px] text-slate-500","data-testid":`run-step-unmeasured-${e.sequence}`,"data-unmeasured-note":!0,children:[t.unmeasured,": ",i.map(m=>m.label).join("\u3001")]}),Object.keys(n.detail).length>0&&k("details",{className:"mt-2 text-[13px]","data-testid":`run-step-detail-${e.sequence}`,children:[x("summary",{className:"cursor-pointer text-slate-600",children:"\u8A73\u7D30"}),x("pre",{className:"mt-1 overflow-auto rounded-lg bg-slate-900 p-4 font-mono text-[11px] text-slate-100",children:JSON.stringify(n.detail,null,2)})]})]})}function Ea(e,t,n,o){let d=St[e.status];return x("li",{className:"rounded-lg border border-slate-200 border-solid","data-testid":`run-step-${e.sequence}`,"data-status":e.status,"data-step-key":e.stepKey,children:k("details",{open:o,className:"group/step","data-testid":`run-step-card-${e.sequence}`,children:[k("summary",{className:"flex cursor-pointer list-none flex-wrap items-center gap-2 p-4 [&::-webkit-details-marker]:hidden",children:[x("span",{"aria-hidden":"true",className:"text-[11px] text-slate-500 transition-transform group-open/step:rotate-90",children:"\u25B6"}),x("span",{className:"font-semibold text-[13px] text-slate-900",children:t}),e.strategyId!==null&&k("span",{className:"rounded-sm bg-indigo-50 px-1.5 py-0.5 text-[11px] text-indigo-800","data-testid":`run-step-strategy-${e.sequence}`,children:["\u6226\u7565 #",e.strategyId]}),x("span",{className:`inline-flex rounded-full px-2 py-0.5 font-semibold text-[11px] ${d.className}`,"data-testid":`run-step-status-${e.sequence}`,"data-status":e.status,children:d.label}),x("span",{className:"ml-auto text-[11px] text-slate-600","data-testid":`run-step-duration-${e.sequence}`,children:x(H,{value:e.durationMs,unit:"ms",testId:`run-step-duration-value-${e.sequence}`})})]}),k("div",{className:"space-y-2 px-4 pb-4",children:[e.durationMs!==null&&n>0&&x("div",{className:"h-2 rounded-full bg-slate-100",children:x("div",{className:`h-2 rounded-full ${d.bar}`,style:{width:`${e.durationMs/n*100}%`},"data-testid":`run-step-bar-${e.sequence}`})}),e.errorMessage!==null&&k("p",{className:"wrap-anywhere text-[13px] text-red-700","data-testid":`run-step-error-${e.sequence}`,children:[e.errorCode===null?"":`${e.errorCode}: `,e.errorMessage,e.httpStatus===null?"":` (HTTP ${e.httpStatus})`]}),x(Hs,{step:e})]})]})},e.id)}function Vs(e,t,n){let o=Ke(e),d=je[o],i=e.steps.reduce((u,y)=>y.durationMs===null?u:Math.max(u,y.durationMs),0),m=e.steps.length<=As;return k("section",{className:"space-y-4","aria-labelledby":t,"data-testid":"run-detail","data-run-id":e.id,children:[k("h3",{ref:n,id:t,tabIndex:-1,className:"font-bold text-base text-slate-900 focus:outline-none","data-testid":"run-detail-heading",children:[Ia[e.documentKind]," \u306E\u5B9F\u884C #",e.id]}),k("dl",{className:"grid grid-cols-2 gap-3 text-[13px] sm:grid-cols-4","data-testid":"run-inspector-header",children:[k("div",{children:[x("dt",{className:"text-slate-500",children:"\u304D\u3063\u304B\u3051"}),x("dd",{"data-testid":"run-trigger","data-trigger":e.trigger,children:wt[e.trigger]})]}),k("div",{children:[x("dt",{className:"text-slate-500",children:"\u8A66\u884C"}),x("dd",{"data-testid":"run-attempt",children:e.attempt})]}),k("div",{children:[x("dt",{className:"text-slate-500",children:"\u72B6\u614B"}),x("dd",{children:x("span",{className:`inline-flex rounded-full px-2.5 py-0.5 font-semibold text-[11px] ${d.className}`,"data-testid":"run-status","data-status":e.status,"data-presentation":o,children:d.label})})]}),k("div",{children:[x("dt",{className:"text-slate-500",children:"\u8981\u6C42\u8005"}),x("dd",{className:"wrap-anywhere","data-testid":"run-requested-by",children:e.requestedBy})]}),k("div",{className:"col-span-2",children:[x("dt",{className:"text-slate-500",children:"\u958B\u59CB"}),x("dd",{"data-testid":"run-started-at",children:x(we,{iso:e.startedAt,testId:"run-started-at-value"})})]}),k("div",{className:"col-span-2",children:[x("dt",{className:"text-slate-500",children:"\u7D42\u4E86"}),x("dd",{"data-testid":"run-finished-at",children:x(ut,{iso:e.finishedAt,testId:"run-finished-at-value"})})]}),k("div",{className:"col-span-2",children:[x("dt",{className:"text-slate-500",children:"\u30B8\u30E7\u30D6"}),x("dd",{children:x("code",{className:"wrap-anywhere font-mono","data-testid":"run-job-id",children:e.jobId})})]})]}),e.errorMessage!==null&&x("div",{className:"wrap-anywhere rounded-lg border border-red-200 border-solid bg-red-50 p-4 text-[13px] text-red-800","data-testid":"run-error",children:e.errorMessage}),k("div",{children:[x("h4",{className:"font-bold text-[13px] text-slate-900",children:"\u6BB5\u306E\u30BF\u30A4\u30E0\u30E9\u30A4\u30F3"}),x("ol",{className:"mt-3 space-y-3","data-testid":"run-steps",children:qs(e).map(u=>{if(u.kind==="step"){let v=u.step,C=k(dt,{children:[Ot[v.stepKey].label,v.targetMetadataId!==e.metadataId&&k("span",{className:"ml-2 rounded-sm bg-slate-100 px-1.5 py-0.5 font-normal text-[11px] text-slate-600","data-testid":`run-step-target-${v.sequence}`,children:["\u5BFE\u8C61 #",v.targetMetadataId]})]});return Ea(v,C,i,v.status==="FAILED"||m)}let y=u.steps.some(v=>v.status==="FAILED"),h=Fs.map(v=>({status:v,count:u.steps.filter(C=>C.status===v).length})).filter(({count:v})=>v>0);return x("li",{className:"rounded-lg border border-slate-200 border-solid","data-testid":`run-step-group-${u.stepKey}`,"data-count":u.steps.length,children:k("details",{open:y||m,className:"group/fanout","data-testid":`run-step-group-card-${u.stepKey}`,children:[k("summary",{className:"flex cursor-pointer list-none flex-wrap items-center gap-2 p-4 [&::-webkit-details-marker]:hidden",children:[x("span",{"aria-hidden":"true",className:"text-[11px] text-slate-500 transition-transform group-open/fanout:rotate-90",children:"\u25B6"}),x("span",{className:"font-semibold text-[13px] text-slate-900",children:Ot[u.stepKey].label}),k("span",{className:"rounded-sm bg-slate-100 px-1.5 py-0.5 text-[11px] text-slate-600","data-testid":`run-step-group-count-${u.stepKey}`,children:["\u5BFE\u8C61 ",u.steps.length," \u4EF6"]}),x("span",{className:"text-[11px] text-slate-600","data-testid":`run-step-group-statuses-${u.stepKey}`,children:h.map(({status:v,count:C})=>`${St[v].label} ${C}`).join(" \xB7 ")})]}),x("ol",{className:"space-y-3 px-4 pb-4",children:u.steps.map(v=>Ea(v,k("span",{"data-testid":`run-step-target-${v.sequence}`,children:["\u5BFE\u8C61 #",v.targetMetadataId]}),i,v.status==="FAILED"||m))})]})},`group-${u.stepKey}`)})})]})]})}function Cr({metadataId:e,runs:t,selectedRunId:n,onSelectRun:o,isLoading:d,failure:i,onClose:m,openRequest:u,returnFocusFallback:y}){let h=Mt(),v=Mt(),C=Mt(),N=Ge(null),X=Ge(null),oe=Ge(null),Y=Ge(null),S=Ge(null),V=Ge(null),E=Ge(y);se(),Dt(()=>{E.current=y},[y]),Dt(()=>{if(S.current!==u){S.current=u,V.current=null;let b=document.activeElement;N.current?.contains(b)!==!0&&(Y.current=(b instanceof HTMLElement||b instanceof SVGElement)&&b!==document.body?b:null),X.current?.focus();return}n!==null&&n===V.current&&(V.current=null,oe.current?.focus())},[u,n]),Dt(()=>()=>{S.current=null;let b=Y.current;if(b?.isConnected){b.focus();return}E.current()?.focus()},[]);let B=b=>{V.current=b===n?null:b,o(b)},M=b=>{b.key==="Escape"&&(b.stopPropagation(),m())},P=n===null?void 0:t.find(b=>b.id===n),z=()=>t.length===0?x("p",{role:"status",className:"rounded-lg border border-slate-200 border-solid bg-slate-50 p-4 text-[13px] text-slate-700","data-testid":"run-inspector-no-runs",children:"\u3053\u306E\u6587\u66F8\u306B\u306F\u307E\u3060\u8A18\u9332\u3055\u308C\u305F\u5B9F\u884C\u304C\u3042\u308A\u307E\u305B\u3093\u3002"}):k(dt,{children:[k("section",{"aria-labelledby":v,"data-testid":"run-history",children:[k("h3",{id:v,className:"font-bold text-base text-slate-900",children:["\u5B9F\u884C\u306E\u5C65\u6B74 (",t.length," \u4EF6\u3001\u65B0\u3057\u3044\u9806)"]}),x("ol",{className:"mt-3 space-y-1","data-testid":"run-history-list",children:t.map(b=>{let $=b.id===n,q=Ke(b),O=je[q];return x("li",{children:k("button",{type:"button",onClick:()=>B(b.id),"aria-current":$?"true":void 0,className:`flex w-full flex-wrap items-center gap-x-3 gap-y-1 rounded-lg border border-solid px-3 py-2 text-left text-[13px] ${$?"border-indigo-500 bg-indigo-50":"border-slate-200 bg-white hover:bg-slate-50"}`,"data-testid":`run-history-item-${b.id}`,"data-selected":$,children:[k("span",{className:"font-mono font-semibold text-slate-900",children:["#",b.id]}),x("span",{className:"text-slate-700","data-testid":`run-history-trigger-${b.id}`,"data-trigger":b.trigger,children:wt[b.trigger]}),k("span",{className:"text-slate-600","data-testid":`run-history-attempt-${b.id}`,children:["\u8A66\u884C ",b.attempt]}),x("span",{className:`inline-flex rounded-full px-2 py-0.5 font-semibold text-[11px] ${O.className}`,"data-testid":`run-history-status-${b.id}`,"data-status":b.status,"data-presentation":q,children:O.label}),x("span",{className:"ml-auto text-[11px] text-slate-600","data-testid":`run-history-started-at-${b.id}`,children:x(we,{iso:b.startedAt,testId:`run-history-started-at-value-${b.id}`})})]})},b.id)})})]}),P!==void 0?Vs(P,C,oe):n===null?x("p",{className:"text-[13px] text-slate-500","data-testid":"run-inspector-select-prompt",children:"\u4E00\u89A7\u304B\u3089\u5B9F\u884C\u3092\u9078\u3076\u3068\u3001\u305D\u306E\u5B9F\u884C\u306E\u6BB5\u306E\u30BF\u30A4\u30E0\u30E9\u30A4\u30F3\u3092\u793A\u3057\u307E\u3059\u3002"}):k("p",{role:"status",className:"text-[13px] text-slate-600","data-testid":"run-inspector-selection-missing",children:["\u5B9F\u884C #",n," \u306F\u3053\u306E\u6587\u66F8\u306E\u5C65\u6B74\u306B\u3042\u308A\u307E\u305B\u3093\u3002\u4E00\u89A7\u304B\u3089\u5B9F\u884C\u3092\u9078\u3093\u3067\u304F\u3060\u3055\u3044\u3002"]})]});return k("section",{ref:N,role:"dialog","aria-labelledby":h,onKeyDown:M,className:"space-y-6 rounded-xl border border-slate-200 border-solid bg-white p-6 shadow-sm","data-testid":"run-inspector","data-metadata-id":e,children:[k("div",{className:"flex items-start justify-between gap-4",children:[k("h2",{ref:X,id:h,tabIndex:-1,className:"font-bold text-base text-slate-900 focus:outline-none","data-testid":"run-inspector-heading",children:["\u6587\u66F8 #",e," \u306E\u51E6\u7406\u5C65\u6B74",P===void 0?"":` (\u5B9F\u884C #${P.id})`]}),x("button",{type:"button",onClick:m,className:"rounded-lg border border-slate-300 border-solid px-3 py-1.5 text-[13px] text-slate-700 hover:bg-slate-50","data-testid":"run-inspector-close",children:"\u9589\u3058\u308B"})]}),k("dl",{className:"grid grid-cols-2 gap-3 text-[13px] sm:grid-cols-4","data-testid":"run-inspector-document",children:[k("div",{children:[x("dt",{className:"text-slate-500",children:"\u6587\u66F8"}),k("dd",{"data-testid":"run-document-id",children:["#",e]})]}),P!==void 0&&k(dt,{children:[k("div",{children:[x("dt",{className:"text-slate-500",children:"\u7248"}),x("dd",{"data-testid":"run-document-revision",children:P.revision})]}),k("div",{children:[x("dt",{className:"text-slate-500",children:"\u7A2E\u985E"}),x("dd",{"data-testid":"run-document-kind","data-kind":P.documentKind,children:Ia[P.documentKind]})]}),k("div",{children:[x("dt",{className:"text-slate-500",children:"\u6D41\u308C"}),x("dd",{children:x("code",{className:"font-mono","data-testid":"run-document-flow",children:P.flowKey})})]})]})]}),i!==null?x("div",{role:"alert",className:"wrap-anywhere rounded-lg border border-red-200 border-solid bg-red-50 p-4 text-[13px] text-red-800","data-testid":"run-inspector-failure",children:i}):d?x("p",{"aria-busy":"true",className:"text-[13px] text-slate-500","data-testid":"run-inspector-loading",children:"\u51E6\u7406\u5C65\u6B74\u3092\u8AAD\u307F\u8FBC\u3093\u3067\u3044\u307E\u3059\u2026"}):z()]})}import{cssVar as Bt}from"@aiquants/console-ui/core";import{useId as zs}from"react";import{Fragment as an,jsx as R,jsxs as ie}from"react/jsx-runtime";function Ws(e,t){return e==null?null:Fe(e,"segment_count",t)}function Ca(e,t,n){return e==null?null:ct(e,t,n)}function js(e){let t=e.probe_failure;if(t===null)return null;if(!Nt.test(t))throw new RangeError("overview.probe_failure must name why the collections could not be read (pass null when they were measured)");if(e.collections.length>0)throw new RangeError(`overview carries ${e.collections.length} collections and a probe_failure; pass the collections with probe_failure null, or an empty list with the reason`);return t}function Pa(e,t,n){return e.reduce((o,d)=>o+Fe(d[t],`${t} of collection ${d.collection_name}`,n),0)}var Js=Bt("space-1"),Qs={padding:0,height:"1px",color:"#1e293b"},Xs={display:"flex",height:"100%"},Ys={fontWeight:500,marginBlock:"auto",overflowWrap:"normal"},Zs={display:"flex",alignItems:"baseline",gap:"12px",marginBottom:"12px"},en={display:"flex",flexWrap:"wrap",alignItems:"baseline",columnGap:"10px",rowGap:"4px",flex:"1 1 0%",minWidth:0},Ft={whiteSpace:"nowrap"},La=Bt("space-3"),tn=Bt("info-tint"),Kt={fontSize:"11px",padding:"2px 6px",borderRadius:"4px",whiteSpace:"nowrap"};function $a(e,t){return`vectors_config.${e}.size of collection ${t}`}function Kr({overview:e,health:t,resources:n,onRefresh:o,isRefreshing:d=!1,selection:i}){let{formatLocale:m}=se(),u=zs(),{collections:y}=e,h=js(e),v=h===null,C=v?Pa(y,"points_count",m):null,N=v?Pa(y,"vectors_count",m):null,X=Ca(n?.ram_bytes,"ram_bytes",m),oe=Ca(n?.disk_bytes,"disk_bytes",m),Y=Ws(n?.segment_count,m);return ie("div",{"data-testid":"qdrant-storage-card",style:{border:"1px solid #e2e8f0",borderRadius:"8px",padding:"16px",backgroundColor:"#ffffff"},children:[ie("div",{"data-testid":"qdrant-card-header",style:Zs,children:[ie("div",{"data-testid":"qdrant-card-title-group",style:en,children:[R("h2",{style:{margin:0,fontSize:"16px",fontWeight:700,color:"#1e293b"},children:"Qdrant \u30D9\u30AF\u30C8\u30EB\u30B9\u30C8\u30EC\u30FC\u30B8\u76E3\u8996"}),t!==void 0&&ie(an,{children:[R("span",{"data-testid":"qdrant-health-badge","data-healthy":String(t.healthy),style:{...Ft,fontSize:"12px",padding:"2px 8px",borderRadius:"12px",backgroundColor:t.healthy?"#d1fae5":"#fee2e2",color:t.healthy?"#065f46":"#991b1b",fontWeight:600},children:Je[t.healthy?"connected":"error"]}),ie("span",{"data-testid":"qdrant-latency",style:{...Ft,fontSize:"12px",color:"#64748b"},children:["\u5FDC\u7B54\u6642\u9593: ",R(H,{value:t.latency_ms,unit:"ms",testId:"qdrant-latency-value"})]})]})]}),o&&R("button",{type:"button","data-testid":"qdrant-refresh-button",disabled:d,onClick:o,style:{...Ft,flexShrink:0,padding:"6px 12px",borderRadius:"4px",border:"1px solid #cbd5e1",backgroundColor:"#ffffff",cursor:d?"not-allowed":"pointer",fontSize:"13px"},children:d?"\u66F4\u65B0\u4E2D\u2026":"\u66F4\u65B0"})]}),ie("div",{style:{display:"grid",gridTemplateColumns:"repeat(auto-fit, minmax(140px, 1fr))",gap:"10px",marginBottom:"16px",padding:"10px",backgroundColor:"#f8fafc",borderRadius:"6px"},children:[ie("div",{children:[R("div",{style:{fontSize:"12px",color:"#64748b"},children:"\u7DCF\u30DD\u30A4\u30F3\u30C8\u6570"}),R("div",{"data-testid":"qdrant-total-points",style:{fontSize:"18px",fontWeight:700,color:"#0f172a"},children:R(H,{value:C,testId:"qdrant-total-points-value"})})]}),ie("div",{children:[R("div",{style:{fontSize:"12px",color:"#64748b"},children:"\u7DCF\u30D9\u30AF\u30C8\u30EB\u6570"}),R("div",{"data-testid":"qdrant-total-vectors",style:{fontSize:"18px",fontWeight:700,color:"#0f172a"},children:R(H,{value:N,testId:"qdrant-total-vectors-value"})})]}),ie("div",{children:[R("div",{style:{fontSize:"12px",color:"#64748b"},children:"\u30E1\u30E2\u30EA\u6D88\u8CBB (RAM)"}),R("div",{"data-testid":"qdrant-ram-usage",style:{fontSize:"18px",fontWeight:700,color:"#0f172a"},children:R(Re,{text:X,testId:"qdrant-ram-usage-value"})})]}),ie("div",{children:[R("div",{style:{fontSize:"12px",color:"#64748b"},children:"\u30C7\u30A3\u30B9\u30AF\u6D88\u8CBB"}),R("div",{"data-testid":"qdrant-disk-usage",style:{fontSize:"18px",fontWeight:700,color:"#0f172a"},children:R(Re,{text:oe,testId:"qdrant-disk-usage-value"})})]}),ie("div",{children:[R("div",{style:{fontSize:"12px",color:"#64748b"},children:"\u30BB\u30B0\u30E1\u30F3\u30C8\u7DCF\u6570"}),R("div",{"data-testid":"qdrant-segment-count",style:{fontSize:"18px",fontWeight:700,color:"#0f172a"},children:R(H,{value:Y,testId:"qdrant-segment-count-value"})})]})]}),ie("div",{children:[ie("h3",{id:u,style:{margin:"0 0 8px 0",fontSize:"14px",color:"#334155"},children:["\u30B3\u30EC\u30AF\u30B7\u30E7\u30F3\u4E00\u89A7 (",R(H,{value:v?y.length:null,unit:"\u4EF6",testId:"qdrant-collections-count"}),")"]}),h!==null?R("p",{"data-testid":"qdrant-probe-failure",style:{margin:0,fontSize:"13px",color:"#92400e",backgroundColor:"#fffbeb",border:"1px solid #f59e0b",borderRadius:"6px",padding:"8px"},children:h}):y.length===0?R("p",{"data-testid":"no-collections-message",style:{margin:0,fontSize:"13px",color:"#64748b"},children:"\u767B\u9332\u3055\u308C\u3066\u3044\u308B\u30B3\u30EC\u30AF\u30B7\u30E7\u30F3\u306F\u3042\u308A\u307E\u305B\u3093\u3002"}):R("section",{tabIndex:0,"aria-labelledby":u,"data-testid":"qdrant-collections-scroll",style:{overflowX:"auto",WebkitOverflowScrolling:"touch",padding:Js},children:ie("table",{"aria-labelledby":u,"data-testid":"qdrant-collections-list",style:{width:"100%",borderCollapse:"collapse",fontSize:"13px"},children:[R("thead",{children:ie("tr",{style:{borderBottom:"1px solid #e2e8f0",color:"#64748b"},children:[R("th",{scope:"col","data-testid":"qdrant-collections-name-header",style:{padding:`6px ${La}`,textAlign:"start"},children:"\u30B3\u30EC\u30AF\u30B7\u30E7\u30F3\u540D"}),R("th",{scope:"col",style:{padding:"6px 8px",textAlign:"start"},children:"\u30C9\u30E1\u30A4\u30F3"}),R("th",{scope:"col","data-testid":"qdrant-collections-points-header",style:{padding:"6px 8px",textAlign:"end"},children:"\u30DD\u30A4\u30F3\u30C8\u6570"}),R("th",{scope:"col",style:{padding:"6px 8px",textAlign:"start"},children:"\u30D9\u30AF\u30C8\u30EB\u69CB\u6210"})]})}),R("tbody",{children:y.map(S=>{let V=i!==void 0&&S.collection_name===i.selectedCollectionName,E=R("span",{style:Ys,children:S.collection_name}),{dense:B,sparse:M,image:P}=S.vectors_config,z=B===void 0?null:Fe(B.size,$a("dense",S.collection_name),m),b=P===void 0?null:Fe(P.size,$a("image",S.collection_name),m);return ie("tr",{"data-testid":`collection-row-${S.collection_name}`,"data-collection-name":S.collection_name,"data-selected":String(V),style:{borderBottom:"1px solid #f1f5f9",backgroundColor:V?tn:"transparent"},children:[i===void 0?R("td",{style:{padding:`8px ${La}`,color:"#1e293b"},children:E}):R("td",{style:Qs,children:R("div",{style:Xs,children:R(zt,{selected:V,controls:i.detailId,onSelect:()=>i.onSelectCollection(S.collection_name),testId:`collection-select-${S.collection_name}`,children:E})})}),R("td",{style:{padding:"8px",color:"#475569"},children:S.domain_key}),R("td",{"data-testid":`collection-points-${S.collection_name}`,style:{padding:"8px",color:"#0f172a",textAlign:"end"},children:R(H,{value:S.points_count,testId:`collection-points-value-${S.collection_name}`})}),R("td",{style:{padding:"8px"},children:ie("div",{style:{display:"flex",gap:"6px",flexWrap:"wrap"},children:[z!==null&&ie("span",{"data-testid":`vector-tag-dense-${S.collection_name}`,style:{...Kt,backgroundColor:"#e0e7ff",color:"#3730a3"},children:["Dense: ",R(H,{value:z,unit:"\u6B21\u5143",testId:`vector-tag-dense-size-${S.collection_name}`})]}),M!==void 0&&R("span",{"data-testid":`vector-tag-sparse-${S.collection_name}`,style:{...Kt,backgroundColor:"#fef3c7",color:"#92400e"},children:M.modifier?`Sparse (${M.modifier.toUpperCase()})`:"Sparse"}),b!==null&&ie("span",{"data-testid":`vector-tag-image-${S.collection_name}`,style:{...Kt,backgroundColor:"#f3e8ff",color:"#6b21a8"},children:["Image: ",R(H,{value:b,unit:"\u6B21\u5143",testId:`vector-tag-image-size-${S.collection_name}`})]})]})})]},S.collection_name)})})]})})]})]})}import{jsx as K,jsxs as fe}from"react/jsx-runtime";var sn="\u5BFE\u8C61\u306A\u3057";function Hr({counts:e,totalFiles:t,failedItems:n=[],onRetryAll:o,onRetryItem:d,isRetrying:i=!1,onRefresh:m}){se();let u=e.SYNCED??0,y=e.PENDING??0,h=(e.EXTRACTING??0)+(e.ENRICHING??0)+(e.PROJECTING??0),v=(e.FAILED_EXTRACT??0)+(e.FAILED_ENRICH??0)+(e.FAILED_VECTOR??0)+(e.FAILED_GRAPH??0),C=t>0?`${(u/t*100).toFixed(1)}%`:sn;return fe("div",{"data-testid":"sync-status-monitor",style:{border:"1px solid #e2e8f0",borderRadius:"8px",padding:"16px",backgroundColor:"#ffffff"},children:[fe("div",{style:{display:"flex",justifyContent:"space-between",alignItems:"center",marginBottom:"16px"},children:[fe("div",{children:[K("h2",{style:{margin:0,fontSize:"16px",fontWeight:700,color:"#1e293b"},children:"\u30A8\u30F3\u30EA\u30C3\u30C1\u30E1\u30F3\u30C8\u540C\u671F\u30B9\u30C6\u30FC\u30BF\u30B9"}),fe("p",{style:{margin:"4px 0 0 0",fontSize:"13px",color:"#64748b"},children:["\u7DCF\u30D5\u30A1\u30A4\u30EB\u6570:"," ",K("span",{"data-testid":"total-files-count",style:{fontWeight:600},children:t})," ","\u4EF6 (\u540C\u671F\u5B8C\u4E86\u7387: ",K("span",{"data-testid":"success-rate-value",children:C}),")"]})]}),fe("div",{style:{display:"flex",gap:"8px"},children:[m&&K("button",{type:"button","data-testid":"sync-refresh-button",onClick:m,style:{padding:"6px 12px",borderRadius:"4px",border:"1px solid #cbd5e1",backgroundColor:"#ffffff",cursor:"pointer",fontSize:"13px"},children:"\u66F4\u65B0"}),o&&K("button",{type:"button","data-testid":"retry-all-button",disabled:i||v===0,onClick:o,style:{padding:"6px 14px",borderRadius:"4px",border:"none",backgroundColor:i||v===0?"#94a3b8":"#dc2626",color:"#ffffff",cursor:i||v===0?"not-allowed":"pointer",fontSize:"13px",fontWeight:500},children:i?"\u518D\u8A66\u884C\u4E2D...":"\u5931\u6557\u30B8\u30E7\u30D6\u4E00\u62EC\u518D\u8A66\u884C"})]})]}),fe("div",{style:{display:"grid",gridTemplateColumns:"repeat(auto-fit, minmax(130px, 1fr))",gap:"10px",marginBottom:"20px"},children:[fe("div",{"data-testid":"status-card-synced","data-count":u,style:{border:"1px solid #10b981",borderRadius:"6px",padding:"10px",backgroundColor:"#ecfdf5"},children:[K("div",{style:{fontSize:"12px",color:"#065f46"},children:"\u5B8C\u5168\u540C\u671F (SYNCED)"}),K("div",{"data-testid":"synced-count",style:{fontSize:"20px",fontWeight:700,color:"#047857"},children:u})]}),fe("div",{"data-testid":"status-card-processing","data-count":h,style:{border:"1px solid #3b82f6",borderRadius:"6px",padding:"10px",backgroundColor:"#eff6ff"},children:[K("div",{style:{fontSize:"12px",color:"#1e40af"},children:"\u51E6\u7406\u4E2D (PROCESSING)"}),K("div",{"data-testid":"processing-count",style:{fontSize:"20px",fontWeight:700,color:"#1d4ed8"},children:h})]}),fe("div",{"data-testid":"status-card-pending","data-count":y,style:{border:"1px solid #64748b",borderRadius:"6px",padding:"10px",backgroundColor:"#f8fafc"},children:[K("div",{style:{fontSize:"12px",color:"#334155"},children:"\u5F85\u6A5F\u4E2D (PENDING)"}),K("div",{"data-testid":"pending-count",style:{fontSize:"20px",fontWeight:700,color:"#475569"},children:y})]}),fe("div",{"data-testid":"status-card-failed","data-count":v,style:{border:"1px solid #ef4444",borderRadius:"6px",padding:"10px",backgroundColor:"#fef2f2"},children:[K("div",{style:{fontSize:"12px",color:"#991b1b"},children:"\u5931\u6557 (FAILED)"}),K("div",{"data-testid":"failed-count",style:{fontSize:"20px",fontWeight:700,color:"#b91c1c"},children:v})]})]}),fe("div",{"data-testid":"failed-items-section",children:[fe("h3",{style:{margin:"0 0 8px 0",fontSize:"14px",color:"#334155"},"data-testid":"failed-items-heading",children:["\u540C\u671F\u5931\u6557\u30A2\u30A4\u30C6\u30E0\u4E00\u89A7 (",n.length<v?`\u4E0A\u4F4D ${n.length} \u4EF6 / \u5168 ${v} \u4EF6`:`${n.length} \u4EF6`,")"]}),n.length===0?K("p",{"data-testid":"no-failed-items-message",style:{margin:0,fontSize:"13px",color:"#64748b"},children:"\u73FE\u5728\u3001\u540C\u671F\u5931\u6557\u30A2\u30A4\u30C6\u30E0\u306F\u3042\u308A\u307E\u305B\u3093\u3002"}):K("div",{style:{overflowX:"auto"},children:fe("table",{"data-testid":"failed-items-table",style:{width:"100%",borderCollapse:"collapse",fontSize:"13px"},children:[K("thead",{children:fe("tr",{style:{borderBottom:"1px solid #e2e8f0",textAlign:"left",color:"#64748b"},children:[K("th",{style:{padding:"6px 8px"},children:"\u30D5\u30A1\u30A4\u30EB URI"}),K("th",{style:{padding:"6px 8px"},children:"\u72B6\u614B"}),K("th",{style:{padding:"6px 8px"},children:"\u30A8\u30E9\u30FC\u5185\u5BB9"}),K("th",{style:{padding:"6px 8px"},children:"\u5931\u6557\u65E5\u6642"}),K("th",{style:{padding:"6px 8px",textAlign:"right"},children:"\u64CD\u4F5C"})]})}),K("tbody",{children:n.map(N=>fe("tr",{"data-testid":`failed-item-row-${N.id}`,"data-file-uri":N.file_uri,style:{borderBottom:"1px solid #f1f5f9"},children:[fe("td",{"data-testid":`failed-item-uri-${N.id}`,style:{padding:"8px",wordBreak:"break-all"},children:[K("div",{style:{fontWeight:600,color:"#0f172a"},children:N.file_name}),K("div",{style:{fontSize:"11px",color:"#64748b"},children:N.file_uri})]}),K("td",{style:{padding:"8px"},children:K("span",{"data-testid":`failed-item-status-${N.id}`,style:{fontSize:"11px",padding:"2px 6px",borderRadius:"4px",backgroundColor:"#fee2e2",color:"#991b1b",fontWeight:500},children:N.sync_status})}),K("td",{"data-testid":`failed-item-error-${N.id}`,style:{padding:"8px",color:"#dc2626",maxWidth:"260px",wordBreak:"break-word"},title:N.error_message??"",children:N.error_message??"\u4E0D\u660E\u306A\u30A8\u30E9\u30FC"}),K("td",{"data-testid":`failed-item-time-${N.id}`,style:{padding:"8px",color:"#64748b",whiteSpace:"nowrap"},children:N.failed_at===null?"\u8A18\u9332\u306A\u3057":K(we,{iso:N.failed_at,testId:`failed-item-time-value-${N.id}`})}),K("td",{style:{padding:"8px",textAlign:"right"},children:d&&K("button",{type:"button","data-testid":`retry-item-button-${N.id}`,"aria-label":`${N.file_name} (${N.file_uri}) \u3092\u518D\u8A66\u884C`,disabled:i,onClick:()=>d(N.id,N.file_uri),style:{padding:"4px 8px",borderRadius:"4px",border:"1px solid #dc2626",backgroundColor:"#ffffff",color:"#dc2626",cursor:i?"not-allowed":"pointer",fontSize:"12px"},children:"\u518D\u8A66\u884C"})})]},N.id))})]})})]})]})}export{Rs as CHUNK_SOURCE_LABELS,Ut as DegradedSearchBanner,On as DocumentIngestConsole,Un as EnrichmentStrategyBoard,Ue as FLOW_FOCUS_RING,hs as FLOW_GEOMETRY,Xe as FLOW_NODE_TEXT,ut as FinishedInstant,wa as GATE_POLICY_LABELS,Sa as GATE_STATE_PRESENTATION,Jn as InfrastructureHealthMonitor,tr as MetadataSearchWorkbench,or as ModelComparisonWorkbench,ja as NOTHING_TO_READ_LABELS,lr as OntologyStatusCard,ya as PHASE_LABELS,je as PIPELINE_RUN_STATUS_PRESENTATION,St as PIPELINE_STEP_STATUS_PRESENTATION,wt as PIPELINE_TRIGGER_LABELS,hr as PipelineFlowViewer,Cr as PipelineRunInspector,Kr as QdrantStorageCard,Fa as REASON_LABELS,we as RecordedInstant,ba as SCORE_DISPLAY_DECIMALS,pa as SEARCH_MODE_LABELS,us as SEARCH_PRESETS,As as STEP_CARDS_OPEN_LIMIT,Hr as SyncStatusMonitor,jt as UNFINISHED_LABEL,ma as formatComparisonScore,Ls as gateCaption,ka as gateState,sa as gateStateOf,es as ingestRowAction,fa as layoutFlow,Ke as pipelineRunPresentationKey,bs as rankAgreement,Jt as skipReasonLabel,va as stepGatePolicy,Ps as stepGateState};