@aiquants/enrichment-react 0.2.1 → 0.4.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/README.md +44 -40
- package/dist/index.cjs +1 -1
- package/dist/index.d.cts +92 -21
- package/dist/index.d.ts +92 -21
- package/dist/index.js +1 -1
- package/package.json +6 -6
package/dist/index.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{jsx as pt,jsxs as St}from"react/jsx-runtime";var Ka={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 qt({metadata:e,onDismiss:t}){if(!e.is_degraded)return null;let r=(e.degradation_reason??"").split(",").map(d=>d.trim()).filter(d=>d.length>0);return pt("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:St("div",{style:{display:"flex",justifyContent:"space-between",alignItems:"flex-start"},children:[St("div",{children:[St("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"]}),r.length>0&&pt("ul",{"data-testid":"degraded-reason-list",style:{margin:"6px 0 0 0",paddingLeft:"20px"},children:r.map(d=>pt("li",{"data-testid":`degraded-reason-${d}`,children:Ka[d]??d},d))})]}),t&&pt("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 Xa,EnrichmentSyncStatusSchema as aa,PIPELINE_STEPS as Ya,QUARANTINED_CONFIDENTIALITY_LEVEL as Zt}from"@aiquants/enrichment-core";import{useId as Me,useMemo as ea,useState as Ee}from"react";import{formatCount as Ba}from"@aiquants/console-ui/core";function Fe(e,t,n){try{Ba(e,n)}catch(r){throw new RangeError(`${t}: ${r.message}`,{cause:r})}return e}var Ht=1024,Ua=[{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 Gt(e,t){return Number((e/Ht**t.power).toFixed(t.fractionDigits))}function ut(e,t,n){Fe(e,t,n);let[r,...d]=Ua,i=r,m=Gt(e,i);for(let u of d){if(m<Ht)break;i=u,m=Gt(e,i)}return`${new Intl.NumberFormat(n,{minimumFractionDigits:i.fractionDigits,maximumFractionDigits:i.fractionDigits,useGrouping:!0}).format(m)} ${i.name}`}import{Measured as qa,RowButton as Ga,useConsoleUi as Ha}from"@aiquants/console-ui";import{createElement as zt}from"react";var et="ja-JP";function se(){let e=Ha();if(e.locale!=="ja"||e.formatLocale!==et)throw new RangeError(`The ConsoleUiRoot must be locale "${"ja"}" and formatLocale "${et}", the language and format of this package's text (got locale "${e.locale}" and formatLocale "${e.formatLocale}")`);return e}function V(e){return se(),zt(qa,e)}function Wt(e){return se(),zt(Ga,e)}import{jsx as mt}from"react/jsx-runtime";var tt=/[^\s\x1c-\x1f\x85\ufeff]/,Va={fontVariantNumeric:"tabular-nums"},za={fontVariantNumeric:"tabular-nums",whiteSpace:"nowrap"};function jt({text:e,testId:t,slot:n}){if(se(),e===null)return mt(V,{value:null,testId:t});if(!tt.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 mt("span",{"data-measured":"true","data-testid":t,style:n,children:e})}function at({text:e,testId:t}){return mt(jt,{text:e,testId:t,slot:Va})}function Ie({text:e,testId:t}){return mt(jt,{text:e,testId:t,slot:za})}import{PIPELINE_STEPS as Wa,parseSkipReason as ja}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"}},wt={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"}},Et={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 Qt(e){let t=ja(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`${Wa[t.stepKey].label} \u304C\u5B9F\u884C\u3055\u308C\u306A\u304B\u3063\u305F`;case"nothing_to_read":return Ja[t.token]}}import{formatInstant as Qa}from"@aiquants/console-ui/core";function Xt(e,t){return Qa(e,et,t)}import{jsx as Yt}from"react/jsx-runtime";function we({iso:e,testId:t}){let{timeZone:n}=se();return Yt(Ie,{text:e===null?null:Xt(e,n),testId:t})}function bt({iso:e,testId:t}){return se(),e===null?Jt:Yt(we,{iso:e,testId:t})}import{Fragment as ns,jsx as o,jsxs as g}from"react/jsx-runtime";var Za=new Set(aa.options.filter(e=>e.startsWith("FAILED"))),es=new Set(aa.options);function ts(e){return e.isCurrent===!1?{kind:"blocked",reason:"\u65E7\u7248\u306E\u305F\u3081\u518D\u5B9F\u884C\u4E0D\u53EF"}:e.syncStatus==="SYNCED"?{kind:"resync"}:Za.has(e.syncStatus)?{kind:"retry"}:es.has(e.syncStatus)?{kind:"blocked",reason:"\u51E6\u7406\u4E2D"}:{kind:"blocked",reason:"\u4E0D\u660E\u306A\u72B6\u614B"}}function ta(e,t,n){let r=e?.find(d=>d.confidentialityLevel===t&&d.capability===n);return r?r.isEnabled:null}var as={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"},ss=["\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 o("span",{className:"text-red-700","data-testid":`ingest-required-mark-${e}`,children:"*"})}function Fn({policies:e,tenantId:t,domainOptions:n,recentItems:r=[],inspectionResult:d=null,isSubmitting:i=!1,isInspecting:m=!1,onInspectUri:u,onIngestDocument:x,onRetryItem:h,onShowHistory:v}){let{formatLocale:C}=se(),N=Me(),X=Me(),re=Me(),U=Me(),k=Me(),Y=Me(),E=Me(),B=Me(),[M,P]=Ee("gdrive://"),[z,b]=Ee(""),[$,G]=Ee(""),[O,ce]=Ee("CONFIDENTIAL"),[te,xe]=Ee(null),[ve,R]=Ee(""),[ue,W]=Ee(""),[Z,H]=Ee([]),[he,le]=Ee(""),[ke,$e]=Ee("user"),[me,Ne]=Ee(1),[l,T]=Ee(!1),ae=te!==null&&n.some(s=>s.key===te)?te:n.length>0?n[0].key:null,J=ea(()=>({vectorEnabled:ta(e,O,"vector_indexing"),graphEnabled:ta(e,O,"graph_indexing")}),[e,O]),de=ea(()=>{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 S=s.trim(),Q=S.match(/\/file\/d\/([a-zA-Z0-9_-]+)/);if(Q)return Q[1];let Se=S.match(/[?&]id=([a-zA-Z0-9_-]+)/);return Se?Se[1]:null},Te=s=>{if(P(s),z.trim()){let S=z.trim().replace(/^(file|gdrive|gcs):\/\//,"");G(`${s}${S}`)}else G("")},Ve=s=>{let S=s.trim();if(!S){b(""),G("");return}let Q=He(S);if(Q){P("gdrive://"),b(Q),G(`gdrive://${Q}`);return}if(S.startsWith("gdrive://")){P("gdrive://");let Se=S.replace(/^gdrive:\/\//,"");b(Se),G(S);return}if(S.startsWith("file://")){P("file://");let Se=S.replace(/^file:\/\//,"");b(Se),G(S);return}if(S.startsWith("gcs://")){P("gcs://");let Se=S.replace(/^gcs:\/\//,"");b(Se),G(S);return}if(S.includes("://")){b(s),G(S);return}b(s),G(`${M}${S}`)},_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(S=>S.labelKey===s)||(H(S=>[...S,{labelKey:s,category:ke,confidenceScore:Number(me.toFixed(2))}]),le("")))},ze=s=>{Z.some(S=>S.labelKey===s)||H(S=>[...S,{labelKey:s,category:"domain",confidenceScore:1}])},Re=s=>{H(S=>S.filter(Q=>Q.labelKey!==s))},ct=s=>{if(s.preventDefault(),!de.valid||ae===null)return;let S={fileUri:$.trim(),confidentialityLevel:O,targetDomainKey:ae,departmentId:ve.trim()?Number(ve):null,titleOverride:ue.trim()?ue.trim():null,labels:Z};x?.(S)},We=s=>{let S=ts(s);if(S.kind==="blocked")return o("span",{className:"font-sans text-[11px] text-slate-500","data-testid":`ingest-action-blocked-${s.id}`,"data-reason":S.reason,children:S.reason});let Q=S.kind==="retry";return o("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-${S.kind}-button-${s.id}`,children:Q?"\u518D\u8A66\u884C":"\u518D\u540C\u671F"})},ht=s=>{switch(s){case"SYNCED":return o("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 o("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 o("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 o("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 o("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]}):o("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:[o("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"}),o("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: ",o("span",{className:"ml-1.5 font-bold text-slate-800",children:t})]})]}),g("form",{onSubmit:ct,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 ",o(kt,{field:"uri"})]}),g("span",{className:"font-mono text-slate-500 text-xs",children:["\u9078\u629E\u30B9\u30AD\u30FC\u30E0: ",o("strong",{className:"font-semibold text-indigo-600",children:M})]})]}),g("div",{className:"flex flex-wrap items-center gap-2",children:[o("span",{className:"font-medium text-slate-500 text-xs",children:"\u30B9\u30AD\u30FC\u30E0\u6307\u5B9A:"}),o("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)"}),o("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)"}),o("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:[o("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}),o("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})]}),o("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:[o("span",{children:"\u89E3\u6C7A URI:"}),o("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&&o("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:[o("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)"}),o("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:[o("span",{className:"block text-slate-500",children:"\u30D5\u30A1\u30A4\u30EB\u540D:"}),o("span",{className:"font-semibold text-slate-800",children:d.fileName})]}),g("div",{children:[o("span",{className:"block text-slate-500",children:"\u30B5\u30A4\u30BA:"}),o("span",{className:"font-semibold text-slate-800",children:o(Ie,{text:ut(d.fileSize,"fileSize",C),testId:"inspection-file-size-value"})})]}),g("div",{children:[o("span",{className:"block text-slate-500",children:"MIME:"}),o("span",{className:"font-semibold text-slate-800",children:d.mimeType})]}),g("div",{children:[o("span",{className:"block text-slate-500",children:"\u30EA\u30D3\u30B8\u30E7\u30F3:"}),o("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) ",o(kt,{field:"confidentiality"})]}),o("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:Xa.options.map(s=>g("option",{value:s,children:[s," (",as[s],")"]},s))})]}),g("div",{className:"space-y-1",children:[g("label",{htmlFor:re,className:"block font-semibold text-slate-700 text-xs",children:["\u5BFE\u8C61\u30C9\u30E1\u30A4\u30F3 (Target Domain) ",o(kt,{field:"domain"})]}),o("select",{id:re,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=>o("option",{value:s.key,children:s.label},s.key))}),n.length===0&&o("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===Zt&&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:[o("span",{className:"font-bold",children:"\u3010\u9694\u96E2\u6CE8\u610F\u3011"})," ",Zt," \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",o("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:[o("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:[o("span",{className:"block font-semibold text-slate-600 text-xs",children:"\u30D9\u30AF\u30C8\u30EB\u7D22\u5F15 (Qdrant)"}),o("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:[o("span",{className:"block font-semibold text-slate-600 text-xs",children:"\u30B0\u30E9\u30D5\u7D22\u5F15 (Neo4j)"}),o("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 (",o("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:[o("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:[o("span",{className:"text-slate-500 text-xs",children:"\u30AF\u30A4\u30C3\u30AF\u5019\u88DC:"}),ss.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:[o("label",{htmlFor:Y,className:"block text-slate-600 text-xs",children:"\u30E9\u30D9\u30EB\u540D / \u30AD\u30FC"}),o("input",{id:Y,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:[o("label",{htmlFor:E,className:"block text-slate-600 text-xs",children:"\u7A2E\u5225"}),g("select",{id:E,value:ke,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:[o("option",{value:"user",children:"\u30E6\u30FC\u30B6\u30FC (user)"}),o("option",{value:"domain",children:"\u30C9\u30E1\u30A4\u30F3 (domain)"}),o("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)"]}),o("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"})]}),o("div",{children:o("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&&o("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:[o("span",{className:"font-semibold",children:s.labelKey}),g("span",{className:"text-indigo-400",children:["(",s.category,")"]}),o("button",{type:"button",onClick:()=>Re(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:[o("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:[o("div",{className:"grid grid-cols-1 gap-4 md:grid-cols-2",children:g("div",{className:"space-y-1",children:[o("label",{htmlFor:k,className:"block font-medium text-slate-700 text-xs",children:"\u6587\u66F8\u30BF\u30A4\u30C8\u30EB (\u4E0A\u66F8\u304D\u6307\u5B9A)"}),o("input",{id:k,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"})]})}),o("div",{className:"grid grid-cols-1 gap-4 md:grid-cols-2",children:g("div",{className:"space-y-1",children:[o("label",{htmlFor:U,className:"block font-medium text-slate-700 text-xs",children:"\u6240\u7BA1\u90E8\u9580 ID (\u4EFB\u610F)"}),o("input",{id:U,type:"number",value:ve,onChange:s=>R(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"})]})})]})]}),o("div",{className:"flex justify-end pt-2",children:o("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(ns,{children:[o("span",{className:"h-4 w-4 animate-spin rounded-full border-2 border-white border-t-transparent border-solid"}),o("span",{children:"\u53D6\u308A\u8FBC\u307F\u6295\u5165\u4E2D..."})]}):o("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:[o("div",{className:"flex items-center justify-between",children:g("div",{children:[o("h3",{className:"font-bold text-base text-slate-900",children:"\u6700\u8FD1\u306E\u53D6\u308A\u8FBC\u307F\u30AD\u30E5\u30FC & \u5B9F\u884C\u72B6\u614B"}),o("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"})]})}),r.length===0?o("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"}):o("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:[o("thead",{className:"bg-slate-50 font-semibold text-slate-700",children:g("tr",{children:[o("th",{scope:"col",className:"px-3 py-2.5",children:"ID"}),o("th",{scope:"col",className:"px-3 py-2.5",children:"\u30D5\u30A1\u30A4\u30EB\u540D / URI"}),o("th",{scope:"col",className:"px-3 py-2.5",children:"\u6A5F\u5BC6\u533A\u5206"}),o("th",{scope:"col",className:"px-3 py-2.5",children:"\u30EA\u30D3\u30B8\u30E7\u30F3"}),o("th",{scope:"col",className:"px-3 py-2.5",children:"\u540C\u671F\u30B9\u30C6\u30FC\u30BF\u30B9"}),o("th",{scope:"col",className:"px-3 py-2.5",children:"\u6700\u7D42\u5B9F\u884C"}),o("th",{scope:"col",className:"px-3 py-2.5",children:"\u767B\u9332\u65E5\u6642"}),o("th",{scope:"col",className:"px-3 py-2.5 text-right",children:"\u30A2\u30AF\u30B7\u30E7\u30F3"})]})}),o("tbody",{className:"divide-y divide-solid divide-slate-100 font-mono text-slate-800",children:r.map(s=>g("tr",{className:"transition-colors hover:bg-slate-50/80","data-testid":`recent-item-row-${s.id}`,children:[o("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:[o("div",{className:"font-sans font-semibold text-slate-900",children:s.fileName}),o("div",{className:"truncate text-[11px] text-slate-600",children:s.fileUri})]}),o("td",{className:"px-3 py-2",children:o("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&&o("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:[ht(s.syncStatus),s.errorMessage!==null&&s.errorMessage!==void 0&&s.errorMessage!==""&&o("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?o("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:[o("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&&o("div",{className:"text-[11px] text-red-700","data-testid":`ingest-last-run-failed-step-${s.id}`,children:Ya[s.lastRun.failedStepKey].label}),o("div",{className:"text-[11px] text-slate-500","data-testid":`ingest-last-run-finished-at-${s.id}`,children:o(bt,{iso:s.lastRun.finishedAt,testId:`ingest-last-run-finished-at-value-${s.id}`})})]}),v!==void 0&&o("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"})]}),o("td",{className:"px-3 py-2 font-sans text-[11px] text-slate-500","data-testid":`ingest-created-at-${s.id}`,children:o(we,{iso:s.createdAt,testId:`ingest-created-at-value-${s.id}`})}),o("td",{className:"px-3 py-2 text-right font-sans",children:We(s)})]},s.id))})]})})]})]})}import{ENRICHMENT_STAGES as Rt}from"@aiquants/enrichment-core";import{jsx as pe,jsxs as Ce}from"react/jsx-runtime";var sa={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 na(e,t){return e===null?"absent":e in t?t[e]?"open":"closed":"unmeasured"}function qn({strategies:e,featureFlags:t,onToggleStage:n,isUpdating:r=!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 ",Rt.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"}),Rt.map(i=>{let m=na(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:sa[m].color},children:sa[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"})]}),Rt.map(m=>{let u=i.stages[m.key],x=na(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&&(x==="open"||x==="absent")),disabled:d||r,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||r?"cursor-not-allowed opacity-60":"cursor-pointer"}`,children:u?"\u958B":"\u9589"}),u&&x==="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&&x==="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"},Qe={connected:{"data-cui-fg":"success-fg","data-cui-surface":"success-tint"},error:{"data-cui-fg":"danger-fg","data-cui-surface":"danger-tint"}};import{Fragment as ia,jsx as L,jsxs as j}from"react/jsx-runtime";var os={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"},oa=["engine","edition","fullVersion","title","collectionsCount","nodeCount","totalKeys","database","endpointsCount","port","restPort","boltUri","tls"],rs=new Set(["collectionsCount","nodeCount","totalKeys","endpointsCount"]),gt={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 la(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 ds(e){let t=oa.filter(r=>r in e),n=Object.keys(e).filter(r=>!oa.includes(r)).sort();return[...t,...n].map(r=>({key:r,label:os[r]??r,value:la(r,e[r])}))}function da(e,t){switch(e.kind){case"count":return L(V,{value:e.count,unit:"\u4EF6",testId:t});case"unmeasured":return L(Ie,{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(Ie,{text:String(e.value),testId:t});case"word":return L(Ie,{text:e.text,testId:t});case"text":return L(at,{text:e.text,testId:t})}}function Qn({health:e,isRefreshing:t=!1,onRefresh:n,className:r=""}){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 ${r}`,"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",...Qe[i?"connected":"error"],"data-testid":"health-overall-status-badge",children:i?j(ia,{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(ia,{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:x,data:h,title:v,subtitle:C})=>{let N=la("version",h.version),X=gt[ra(N)],re=da(N,`service-version-value-${x}`);return j("div",{"data-testid":`service-card-${x}`,className:"flex flex-col justify-between rounded-md border border-border border-solid bg-card/60 p-3.5 transition-colors hover:bg-muted/40",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]",...Qe[h.status],"data-testid":`service-status-${x}`,children:[L("span",{className:"h-1.5 w-1.5 rounded-full bg-current","data-testid":`service-status-dot-${x}`}),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-${x}`,children:[L("span",{className:X.label,children:"\u30D0\u30FC\u30B8\u30E7\u30F3:"}),L("span",{className:`${X.slot} font-medium text-[11px]`,"data-testid":`service-version-${x}`,children:N.kind==="text"?L("code",{className:"font-mono font-semibold",children:re}):re})]}),j("div",{className:"flex items-start justify-between gap-2","data-testid":`health-latency-row-${x}`,children:[L("span",{className:gt.atomic.label,children:"\u5FDC\u7B54\u6642\u9593:"}),L("span",{className:`${gt.atomic.slot} font-mono text-[11px] text-muted-foreground`,"data-testid":`health-latency-${x}`,children:L(V,{value:h.latencyMs,unit:"ms",testId:`health-latency-value-${x}`})})]}),ds(h.details).map(U=>{let k=gt[ra(U.value)];return j("div",{className:"flex items-start justify-between gap-2","data-testid":`health-detail-row-${x}-${U.key}`,children:[j("span",{className:k.label,children:[U.label,":"]}),L("span",{className:`${k.slot} font-medium text-[11px]`,"data-testid":`health-detail-${x}-${U.key}`,children:da(U.value,`health-detail-value-${x}-${U.key}`)})]},U.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-${x}`,children:h.endpoint}),h.errorMessage!==void 0&&tt.test(h.errorMessage)&&L("p",{className:"wrap-anywhere mt-1 rounded-sm px-1.5 py-0.5",...Qe.error,"data-testid":`service-error-${x}`,children:h.errorMessage})]})]},x)})})]})}import{MODE_TIERS as is,SEARCH_MODES as ls,SEARCH_PARAM_LIMITS as ye}from"@aiquants/enrichment-core";import{useEffect as ca,useId as Pe,useRef as pa,useState as ne}from"react";import{Fragment as ft,jsx as c,jsxs as p}from"react/jsx-runtime";var ua={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"}},Xe="\u672A\u5B9F\u884C",cs=(ye.threshold.min+ye.threshold.max)/2,ps=2e3;function us(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"}},ms=[{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 ma(e){return e===void 0||Number.isNaN(e)?"N/A":`${(e*100).toFixed(1)}%`}function bs(e,t){let n=t.trim();if(!(n&&e))return e;let r=n.replace(/[.*+?^${}()|[\]\\]/g,"\\$&"),d=new RegExp(`(${r})`,"gi");return e.split(d).map((u,x)=>({id:`chunk-${x}-${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 _t(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 Ct(e){return e==="OPEN"?"OPEN":e==="HALF_OPEN"?"HALF":"-"}function ao({tenantId:e,onSearch:t,initialParams:n,initialResult:r=null,circuitBreakerStatus:d={},isLoading:i=!1}){let m=Pe(),u=Pe(),x=Pe(),h=Pe(),v=Pe(),C=Pe(),N=Pe(),X=Pe(),re=Pe(),U=Pe(),[k,Y]=ne(n?.q??""),[E,B]=ne(n?.mode??"HYBRID"),[M,P]=ne(n?.limit??ye.limit.default),[z,b]=ne(n?.threshold??cs),[$,G]=ne(n?.fusion??"rrf"),[O,ce]=ne(n?.rrf_k??ye.rrfK.default),[te,xe]=ne(n?.alpha??ye.alpha.default),[ve,R]=ne(n?.confidentiality_level??"ALL"),[ue,W]=ne(n?.department_id?String(n.department_id):""),[Z,H]=ne(n?.mime_type??""),[he,le]=ne(n?.tag??""),ke=pa(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(r),[Re,ct]=ne(null),[We,ht]=ne(null),s=i||Ve,S=is[E],Q=[S.dense,S.sparse,S.graph,S.lexical].filter(Boolean).length>1,Se=S.dense&&!S.sparse,Le=F?.search_metadata.circuit_breaker_status??d,be=F?.search_metadata.executed_tiers??{sql:!1,dense:!1,sparse:!1,graph:!1},Nt=We??{};ca(()=>{if(!Ne)return;let a=ee=>{ee.key==="Escape"&&l(!1)};return window.addEventListener("keydown",a),()=>window.removeEventListener("keydown",a)},[Ne]);let Aa=a=>{B(a.params.mode),P(a.params.limit),a.params.threshold!==void 0&&b(a.params.threshold),a.params.fusion!==void 0&&G(a.params.fusion),a.params.rrf_k!==void 0&&ce(a.params.rrf_k)},Da=async()=>{if(s)return;let a=ue.trim()?Number.parseInt(ue.trim(),10):void 0,ee={q:k.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=ke.current+1;ke.current=ge,ct(null),_e(!0);try{let Ae=await t(ee);if(ge!==ke.current)return;ze(Ae),ht(ee)}catch(Ae){if(ge!==ke.current)return;ct(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===ke.current&&_e(!1)}},Ze=pa(void 0);ca(()=>()=>{Ze.current!==void 0&&clearTimeout(Ze.current)},[]);let Ma=async(a,ee)=>{try{await navigator.clipboard.writeText(a),de(ee),Ze.current!==void 0&&clearTimeout(Ze.current),Ze.current=setTimeout(()=>de(null),ps)}catch{}},Oa=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":U,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:ms.map(a=>c("button",{type:"button","data-testid":`preset-button-${a.id}`,onClick:()=>Aa(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(),Da()},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:k,onChange:a=>Y(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"}),k&&c("button",{type:"button","data-testid":"clear-query-button",onClick:()=>Y(""),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:ls.map(a=>{let ee=E===a;return c("button",{type:"button","aria-pressed":ee,title:ua[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:ua[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:x,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:x,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:()=>G("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:()=>G("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(ft,{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(ft,{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=>R(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=>H(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:re,className:"font-medium text-slate-700 text-xs",children:"\u30BF\u30B0 (Tag):"}),c("input",{id:re,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"})]})]})]})]})}),Re&&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:Re}),F?.search_metadata&&c(qt,{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":_t(Le.vector)}`,children:["\u758E\u30D9\u30AF\u30C8\u30EB ",be.sparse?"\u2713":Ct(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":_t(Le.vector)}`,children:["\u5BC6\u30D9\u30AF\u30C8\u30EB ",be.dense?"\u2713":Ct(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":_t(Le.graph)}`,children:["\u30B0\u30E9\u30D5 ",be.graph?"\u2713":Ct(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:bs(a.ai_summary,We?.q??k)}),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: ",ma(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: ",ma(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,Fa)=>p("span",{"data-testid":`hit-relation-${a.id}-${Fa}`,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:()=>Oa(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:U,"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);Ma(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(ft,{children:["mode: ",Nt.mode,' | q: "',Nt.q,'"']}):Xe}),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(ft,{children:["SQL SoT: ",be.sql?"ACTIVE":"SKIPPED"," | Sparse: ",be.sparse?"ACTIVE":"OFFLINE"," | Dense: ",be.dense?"ACTIVE":"OFFLINE"," | Graph: ",be.graph?"ACTIVE":"OFFLINE"]}):Xe}),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?us(Nt):Xe]})," | ",p("span",{"data-testid":"inspector-output-count",children:["Output count: ",F?F.count:Xe]})]}),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":Xe]})," | ",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":Xe]})," | ","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 Pt}from"@aiquants/enrichment-core";import{useId as st,useState as Be}from"react";import{jsx as q,jsxs as oe}from"react/jsx-runtime";var ga=4;function ba(e){return e.toFixed(ga)}function gs(e,t){let n=h=>{let v=new Map;return h.forEach((C,N)=>{v.has(C)||v.set(C,N+1)}),v},r=n(e),d=n(t),i=[...r.keys()].filter(h=>d.has(h)),m=new Set([...r.keys(),...d.keys()]).size,u=m===0?null:i.length/m,x=i.length===0?null:i.reduce((h,v)=>h+Math.abs(r.get(v)-d.get(v)),0)/i.length;return{sharedCount:i.length,overlapRatio:u,meanAbsoluteRankDifference:x}}function Lt(e){return`${e.label} (${e.embeddingModel})`}function io({variants:e,onCompare:t}){let n=st(),r=st(),d=st(),i=st(),m=st(),[u,x]=Be(null),[h,v]=Be(null),[C,N]=Be(""),[X,re]=Be(Pt.limit.default),[U,k]=Be(!1),[Y,E]=Be(null),[B,M]=Be(null),P=e.length>=2,z=e.map(R=>R.strategyId),b=u!==null&&z.includes(u)?u:P?z[0]:null,$=h!==null&&z.includes(h)?h:P?z[1]:null,G=b!==null&&b===$,O=C.trim(),ce=P&&!G&&O!==""&&!U,te=async R=>{if(R.preventDefault(),!ce||b===null||$===null)return;let ue={query:O,strategyIds:[b,$],limit:X};k(!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),H=W.results.find(he=>he.strategyId===$);if(Z===void 0||H===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:H})}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{k(!1)}},xe=B===null?null:gs(B.left.hits.map(R=>R.id),B.right.hits.map(R=>R.id)),ve=R=>{let ue=e.find(W=>W.strategyId===R.strategyId);return oe("div",{className:"rounded-lg border border-slate-200 border-solid p-4","data-testid":`compare-column-${R.strategyId}`,children:[q("h3",{className:"font-bold text-base text-slate-900",children:ue===void 0?`\u6226\u7565 #${R.strategyId}`:Lt(ue)}),q("p",{className:"mt-1 text-[11px] text-slate-500",children:oe("span",{"data-testid":`compare-execution-ms-${R.strategyId}`,children:[R.executionMs," ms"]})}),R.hits.length===0?q("p",{className:"mt-3 text-[13px] text-slate-500","data-testid":`compare-empty-${R.strategyId}`,children:"\u30D2\u30C3\u30C8\u306A\u3057"}):q("ol",{className:"mt-3 space-y-2",children:R.hits.map((W,Z)=>oe("li",{"aria-label":`${Z+1} \u4F4D ${W.title} (\u30B9\u30B3\u30A2 ${ba(W.score)})`,className:"flex items-baseline gap-3 text-[13px]","data-testid":`compare-hit-${R.strategyId}-${Z+1}`,"data-hit-id":W.id,"data-score":String(W.score),children:[q("span",{className:"w-6 text-right font-mono text-slate-500",children:Z+1}),q("span",{title:W.title,className:"flex-1 truncate text-slate-900","data-testid":`compare-hit-title-${R.strategyId}-${Z+1}`,children:W.title}),q("span",{title:String(W.score),className:"font-mono text-slate-600","data-testid":`compare-hit-score-${R.strategyId}-${Z+1}`,children:ba(W.score)})]},Z))})]})};return oe("section",{className:"space-y-6","aria-labelledby":n,"data-testid":"model-comparison-workbench","data-running":U,children:[oe("form",{onSubmit:te,className:"rounded-xl border border-slate-200 border-solid bg-white p-6 shadow-sm",children:[q("h2",{id:n,className:"font-bold text-base text-slate-900",children:"\u5909\u7A2E\u306E\u6BD4\u8F03"}),oe("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 ",ga," \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&&oe("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"]}),oe("div",{className:"mt-4 grid grid-cols-1 gap-4 sm:grid-cols-2",children:[oe("div",{className:"space-y-1",children:[q("label",{htmlFor:i,className:"block font-semibold text-[13px] text-slate-700",children:"\u5909\u7A2E A"}),q("select",{id:i,value:b===null?"":String(b),onChange:R=>x(Number(R.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(R=>q("option",{value:String(R.strategyId),children:Lt(R)},R.strategyId))})]}),oe("div",{className:"space-y-1",children:[q("label",{htmlFor:m,className:"block font-semibold text-[13px] text-slate-700",children:"\u5909\u7A2E B"}),q("select",{id:m,value:$===null?"":String($),onChange:R=>v(Number(R.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(R=>q("option",{value:String(R.strategyId),children:Lt(R)},R.strategyId))})]})]}),G&&q("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"}),oe("div",{className:"mt-4 grid grid-cols-1 gap-4 sm:grid-cols-[1fr_auto]",children:[oe("div",{className:"space-y-1",children:[q("label",{htmlFor:r,className:"block font-semibold text-[13px] text-slate-700",children:"\u30AF\u30A8\u30EA"}),q("input",{id:r,type:"text",value:C,onChange:R=>N(R.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"})]}),oe("div",{className:"space-y-1",children:[q("label",{htmlFor:d,className:"block font-semibold text-[13px] text-slate-700",children:"\u4EF6\u6570"}),q("input",{id:d,type:"number",min:Pt.limit.min,max:Pt.limit.max,step:1,value:X,onChange:R=>re(Number(R.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"})]})]}),q("div",{className:"mt-4",children:q("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:U?"\u6BD4\u8F03\u4E2D\u2026":"\u6BD4\u8F03\u3092\u5B9F\u884C"})})]}),Y!==null&&q("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:Y}),B!==null&&xe!==null&&oe("div",{className:"space-y-4 rounded-xl border border-slate-200 border-solid bg-white p-6 shadow-sm","data-testid":"compare-results",children:[oe("dl",{className:"grid grid-cols-1 gap-3 text-[13px] sm:grid-cols-3","data-testid":"compare-agreement",children:[oe("div",{children:[q("dt",{className:"text-slate-500",children:"\u5171\u901A\u30D2\u30C3\u30C8"}),oe("dd",{"data-testid":"compare-shared-count",children:[xe.sharedCount," \u4EF6 (A ",B.left.hits.length," \u4EF6 / B ",B.right.hits.length," \u4EF6)"]})]}),oe("div",{children:[q("dt",{className:"text-slate-500",children:"\u91CD\u306A\u308A\u7387 (Jaccard)"}),q("dd",{"data-testid":"compare-overlap-ratio",children:xe.overlapRatio===null?"\u30D2\u30C3\u30C8\u306A\u3057":`${(xe.overlapRatio*100).toFixed(1)}%`})]}),oe("div",{children:[q("dt",{className:"text-slate-500",children:"\u9806\u4F4D\u5DEE\u306E\u5E73\u5747 (\u5171\u901A\u5206)"}),q("dd",{"data-testid":"compare-rank-difference",children:xe.meanAbsoluteRankDifference===null?"\u5171\u901A\u30D2\u30C3\u30C8\u306A\u3057":xe.meanAbsoluteRankDifference.toFixed(2)})]})]}),oe("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 fa(e){return e===null?ot:`${e.length} \u7A2E`}var ot="\u672A\u8A2D\u5B9A";function nt(e,t=""){return e===null?ot:`${e}${t}`}function xt(e){return e===null?ot:`${e} \u4EF6`}function fs(e){if(e.currentVersion===null&&e.lifecyclePhase===null)return`${e.schemaName} (\u79FB\u884C\u53F0\u5E33\u306F\u672A\u8A18\u9332)`;let t=e.currentVersion===null?ot:`v${e.currentVersion}`;return`${e.schemaName} ${t} (${e.lifecyclePhase??ot})`}function po({tenantId:e,ontologyStatus:t}){let n=t.classes,r=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:fs(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:xt(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:xt(t.searchIndexes)}),A("span",{className:"block text-slate-500 text-xs","data-testid":"ontology-indexes-total",children:["\u5168\u7D22\u5F15: ",xt(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:[nt(t.promotionThresholds.confidence)," / ",nt(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:xt(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:fa(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:fa(r)})]}),A("div",{className:"divide-y divide-solid divide-slate-100",children:[r===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"}),r?.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 ",nt(t.promotionThresholds.confidence),"\u3001\u5171\u8D77\u56DE\u6570 \u2267 ",nt(t.promotionThresholds.cooccurrence),"\u3001\u8B58\u5225\u30E6\u30FC\u30B6\u30FC\u6570 \u2267"," ",nt(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 yt,flowFor as ks,flowStepGates as ya,MIME_KIND_RULES as Rs,PIPELINE_STEPS as At}from"@aiquants/enrichment-core";import{useEffect as Is,useId as rt,useRef as vt,useState as Tt}from"react";import{ceil8 as xs,textWidthEm as ys}from"@aiquants/console-ui/core";import{orderedSteps as vs,PIPELINE_STEPS as hs}from"@aiquants/enrichment-core";var Ye={inset:12,labelFontSize:13,captionFontSize:11},Ue={offset:3,stroke:2},Ns={node:{width:xs(Math.max(...Object.values(hs).map(e=>ys(e.label)))*Ye.labelFontSize+2*Ye.inset),height:56},gap:{column:48,row:24},padding:24};function Oe(e){return Math.round(e*1e3)/1e3}function Ss(e){let t=new Map;for(let n of e){let r=n.dependsOn.reduce((d,i)=>Math.max(d,t.get(i)),-1);t.set(n.step,r+1)}return t}function $t(e,t){return`${e}->${t}`}function ws(e,t){let n=[],r=new Map;return{slots:[...e.map(i=>{let m=t.get(i.step),u=i.dependsOn.map(x=>{let h=[],v=x;for(let C=t.get(x)+1;C<m;C+=1){let N=`${$t(x,i.step)}@${C}`;n.push({id:N,rank:C,predecessors:[v]}),h.push(N),v=N}return r.set($t(x,i.step),h),v});return{id:i.step,rank:m,predecessors:u}}),...n],chains:r}}function Es(e){let t=new Map,n=Math.max(...e.map(r=>r.rank));for(let r=0;r<=n;r+=1){let i=e.filter(m=>m.rank===r).map((m,u)=>{let x=r===0?u:m.predecessors.reduce((h,v)=>h+t.get(v),0)/m.predecessors.length;return{slot:m,barycenter:x}});i.sort((m,u)=>m.barycenter-u.barycenter),i.forEach(({slot:m},u)=>{t.set(m.id,u)})}return t}function xa(e,t=Ns){let n=vs(e),r=Ss(n),{slots:d,chains:i}=ws(n,r),m=Es(d),{node:u,gap:x,padding:h}=t,v=E=>({x:Oe(h+E.rank*(u.width+x.column)),y:Oe(h+m.get(E.id)*(u.height+x.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:r.get(E.step),order:m.get(E.step),width:u.width,height:u.height}}),X=E=>Oe(E+u.height/2),re=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}`,G=(O,ce)=>{let te=Oe((z+O)/2);$+=` C ${te} ${b}, ${te} ${ce}, ${O} ${ce}`};for(let O of i.get($t(B,E.step))){let ce=C.get(O),te=X(ce.y);G(ce.x,te),z=Oe(ce.x+u.width),b=te,$+=` L ${z} ${b}`}return G(P.x,X(P.y)),{from:B,to:E.step,path:$}})),U=[...C.values()],k=Oe(Math.max(...U.map(E=>E.x+u.width))+h),Y=Oe(Math.max(...U.map(E=>E.y+u.height))+h);return{width:k,height:Y,steps:N,edges:re}}import{Fragment as Na,jsx as f,jsxs as _}from"react/jsx-runtime";var Sa="\u4F9D\u5B58\u306A\u3057 (\u6D41\u308C\u306E\u6700\u521D\u306B\u8D70\u308B)",va={EXTRACTING:"\u62BD\u51FA",ENRICHING:"\u8981\u7D04",PROJECTING:"\u6295\u5F71"},_s={rebuild:"\u672C\u6587\u304B\u3089\u7D44\u307F\u76F4\u3059",existing:"\u524D\u6BB5\u304C\u66F8\u3044\u305F\u884C\u3092\u305D\u306E\u307E\u307E\u4F7F\u3046"},wa={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"}},Ea={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"},Cs={open:"\u958B",closed:"\u9589",unmeasured:"\u672A\u6E2C\u5B9A"},dt="rgb(248 250 252)",Ps={backgroundColor:dt,backgroundImage:`linear-gradient(to right, ${dt}, ${dt}), linear-gradient(to right, ${dt}, ${dt}), 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 Ls(e,t){let n=e.map(r=>({gate:r,state:ka(r,t)}));return n.some(({gate:r,state:d})=>d==="closed"&&r.whenClosed==="fail")?"closed-fail":n.some(({state:r})=>r==="closed")?"closed-skip":n.some(({state:r})=>r==="unmeasured")?"unmeasured":"open"}function ha(e){return e.length===0?"none":e.every(t=>t.whenClosed==="fail")?"fail":e.every(t=>t.whenClosed==="skip")?"skip":"mixed"}function $s(e,t){let{badge:n}=wa[e];return t==="none"||e==="closed-skip"||e==="closed-fail"?n:`${n}\u30FB${Ea[t]}`}function Ts(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 Dt(e){return e.map(t=>At[t].label).join("\u3001")}function As(e){return e.dependsOn.length===0?Sa:`\u4F9D\u5B58: ${Dt(e.dependsOn)}`}function So({featureFlags:e,metrics:t,metricSampleWindow:n,selectedKind:r,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=rt(),x=rt(),h=rt(),v=rt(),C=rt(),[N,X]=Tt(yt[0]),[re,U]=Tt(null),[k,Y]=Tt(null),E=vt(new Map),B=vt(new Map),M=vt(null),P=vt(null),{labels:z}=se(),b=r!==void 0?r:N,$=i!==void 0?i:re,G=ks(b),O=xa(G),ce=new Map(G.steps.map(l=>[l.step,l])),te=l=>{U(l),m?.(l)},xe=l=>{X(l),d?.(l),te(null)},ve=(l,T)=>{let ae=yt.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=yt[J];xe(de),E.current.get(de)?.focus()},R=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)},H=$===null?void 0:ce.get($),he=H===void 0?null:H.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=H===void 0?void 0:At[H.step],ke=H===void 0?[]:ya(H),$e=H===void 0?[]:G.steps.filter(l=>l.dependsOn.includes(H.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:yt.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":x,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:x,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:Ps,"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:`${x}-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(#${x}-arrow)`,className:"stroke-slate-500","data-testid":`flow-edge-${l.from}-${l.to}`},`${l.from}-${l.to}`)),O.steps.map(l=>{let T=At[l.key],ae=ce.get(l.key),J=ya(ae),de=Ls(J,e),He=ha(J),Te=wa[de],Ve=$s(de,He),_e=l.key===$,F=l.key===k,ze=`${x}-depends-${l.key}`;return _("g",{ref:Re=>{Re===null?B.current.delete(l.key):B.current.set(l.key,Re)},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:Re=>W(Re,l.key),onKeyDown:Re=>Z(Re,l.key),onFocus:()=>Y(l.key),onBlur:()=>Y(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:As(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:Ye.inset,y:20,className:"fill-slate-900 font-semibold text-[13px]","data-testid":`flow-node-label-${l.key}`,children:T.label}),f("text",{x:Ye.inset,y:36,className:"fill-slate-600 text-[11px]","data-testid":`flow-node-phase-${l.key}`,children:va[T.phase]}),f("text",{x:Ye.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&&H!==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:()=>R(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:[va[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})]}),H.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":H.chunkSource,children:[_s[H.chunkSource]," (",H.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:H.dependsOn.length===0?Sa:Dt(H.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)":Dt($e)})]}),_("div",{className:"sm:col-span-2",children:[f("dt",{className:"font-semibold text-slate-500",children:"\u9580"}),f("dd",{children:ke.length===0?f("span",{"data-testid":"flow-step-no-gates",children:"\u9580\u306A\u3057 (\u5E38\u306B\u8D70\u308B)"}):_(Na,{children:[f("ul",{className:"space-y-1",children:ke.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}),": ",Cs[T]," \u2014 ",Ts(l)]},l.featureFlagKey)})}),H.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 (",Ea[ha(le.gates)],") \u3092\u4E0A\u66F8\u304D\u3057\u3001\u9580\u304C\u9589\u3058\u308B\u3068\u5B9F\u884C\u3092 ",H.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)"]}):_(Na,{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(V,{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(V,{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(V,{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(V,{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(V,{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(V,{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:Rs.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 Ft}from"@aiquants/enrichment-core";import{useEffect as Mt,useId as Ot,useRef as Ge}from"react";import{Fragment as lt,jsx as y,jsxs as w}from"react/jsx-runtime";var Ds=8,Ms={text_layer:"\u6587\u5B57\u5C64",ocr:"OCR",transcript:"\u8EE2\u5199"},Os={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"},_a={duration_ms:"ms",input_chars:void 0,output_chars:void 0,chunk_count:void 0,points_upserted:void 0,graph_nodes:void 0},Fs=["provider","model","engine","prompt_key","prompt_version","duration_ms","input_chars","output_chars","chunk_count","points_upserted","collection","embedding_model","graph_nodes"],Ks=["FAILED","RUNNING","SUCCEEDED","SKIPPED"],Bs={atomic:"whitespace-nowrap",anywhere:"wrap-anywhere"};function Ca(e){return Object.hasOwn(_a,e)}function it(e,t){return`run-step-provenance-value-${e}-${t}`}function Us(e,t,n){if(Ca(t)){let d=e[t];return d===null?null:y(V,{value:d,unit:_a[t],testId:it(n,t)})}let r=e[t];return r===null?null:y(at,{text:String(r),testId:it(n,t)})}function qs(e,t){let n=Fs.map(i=>({key:i,label:Os[i],value:Us(e,i,t),breaks:Ca(i)?"atomic":"anywhere"})),r=e.pages_read!==null||e.pages_total!==null,d=w(lt,{children:[y(V,{value:e.pages_read,testId:it(t,"pages_read")})," / ",y(V,{value:e.pages_total,testId:it(t,"pages_total")})]});return[...n,{key:"pages",label:"\u8AAD\u3093\u3060\u30DA\u30FC\u30B8",value:r?d:null,breaks:"atomic"},{key:"body_source",label:"\u672C\u6587\u306E\u51FA\u6240",value:e.body_source===null?null:y(at,{text:Ms[e.body_source],testId:it(t,"body_source")}),breaks:"anywhere"}]}function Gs(e){let t=[],n=new Map;for(let r of[...e.steps].sort((d,i)=>d.sequence-i.sequence)){if(Ft[r.stepKey].fanOut!=="children"||r.targetMetadataId===e.metadataId){t.push({kind:"step",step:r});continue}let d=n.get(r.stepKey);if(d!==void 0){d.push(r);continue}let i=[r];n.set(r.stepKey,i),t.push({kind:"fan_out",stepKey:r.stepKey,steps:i})}return t}function Hs(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 Vs({step:e}){let{labels:t}=se();if(e.status==="SKIPPED")return w("p",{className:"text-[13px] text-slate-600","data-testid":`run-step-skip-reason-${e.sequence}`,children:["\u7701\u7565: ",Qt(Hs(e))]});if(e.provenance===null)return y("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,r=qs(n,e.sequence),d=r.filter(m=>m.value!==null),i=r.filter(m=>m.value===null);return w(lt,{children:[d.length>0&&y("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=>w("div",{className:"border-slate-100 border-b border-solid py-0.5",children:[y("dt",{className:"text-slate-500",children:m.label}),y("dd",{className:`text-slate-800 ${Bs[m.breaks]}`,"data-provenance-key":m.key,children:m.value})]},m.key))}),i.length>0&&w("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&&w("details",{className:"mt-2 text-[13px]","data-testid":`run-step-detail-${e.sequence}`,children:[y("summary",{className:"cursor-pointer text-slate-600",children:"\u8A73\u7D30"}),y("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 Ra(e,t,n,r){let d=wt[e.status];return y("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:w("details",{open:r,className:"group/step","data-testid":`run-step-card-${e.sequence}`,children:[w("summary",{className:"flex cursor-pointer list-none flex-wrap items-center gap-2 p-4 [&::-webkit-details-marker]:hidden",children:[y("span",{"aria-hidden":"true",className:"text-[11px] text-slate-500 transition-transform group-open/step:rotate-90",children:"\u25B6"}),y("span",{className:"font-semibold text-[13px] text-slate-900",children:t}),e.strategyId!==null&&w("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]}),y("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}),y("span",{className:"ml-auto text-[11px] text-slate-600","data-testid":`run-step-duration-${e.sequence}`,children:y(V,{value:e.durationMs,unit:"ms",testId:`run-step-duration-value-${e.sequence}`})})]}),w("div",{className:"space-y-2 px-4 pb-4",children:[e.durationMs!==null&&n>0&&y("div",{className:"h-2 rounded-full bg-slate-100",children:y("div",{className:`h-2 rounded-full ${d.bar}`,style:{width:`${e.durationMs/n*100}%`},"data-testid":`run-step-bar-${e.sequence}`})}),e.errorMessage!==null&&w("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})`]}),y(Vs,{step:e})]})]})},e.id)}function zs(e,t,n){let r=Ke(e),d=je[r],i=e.steps.reduce((u,x)=>x.durationMs===null?u:Math.max(u,x.durationMs),0),m=e.steps.length<=Ds;return w("section",{className:"space-y-4","aria-labelledby":t,"data-testid":"run-detail","data-run-id":e.id,children:[w("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]}),w("dl",{className:"grid grid-cols-2 gap-3 text-[13px] sm:grid-cols-4","data-testid":"run-inspector-header",children:[w("div",{children:[y("dt",{className:"text-slate-500",children:"\u304D\u3063\u304B\u3051"}),y("dd",{"data-testid":"run-trigger","data-trigger":e.trigger,children:Et[e.trigger]})]}),w("div",{children:[y("dt",{className:"text-slate-500",children:"\u8A66\u884C"}),y("dd",{"data-testid":"run-attempt",children:e.attempt})]}),w("div",{children:[y("dt",{className:"text-slate-500",children:"\u72B6\u614B"}),y("dd",{children:y("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":r,children:d.label})})]}),w("div",{children:[y("dt",{className:"text-slate-500",children:"\u8981\u6C42\u8005"}),y("dd",{className:"wrap-anywhere","data-testid":"run-requested-by",children:e.requestedBy})]}),w("div",{className:"col-span-2",children:[y("dt",{className:"text-slate-500",children:"\u958B\u59CB"}),y("dd",{"data-testid":"run-started-at",children:y(we,{iso:e.startedAt,testId:"run-started-at-value"})})]}),w("div",{className:"col-span-2",children:[y("dt",{className:"text-slate-500",children:"\u7D42\u4E86"}),y("dd",{"data-testid":"run-finished-at",children:y(bt,{iso:e.finishedAt,testId:"run-finished-at-value"})})]}),w("div",{className:"col-span-2",children:[y("dt",{className:"text-slate-500",children:"\u30B8\u30E7\u30D6"}),y("dd",{children:y("code",{className:"wrap-anywhere font-mono","data-testid":"run-job-id",children:e.jobId})})]})]}),e.errorMessage!==null&&y("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}),w("div",{children:[y("h4",{className:"font-bold text-[13px] text-slate-900",children:"\u6BB5\u306E\u30BF\u30A4\u30E0\u30E9\u30A4\u30F3"}),y("ol",{className:"mt-3 space-y-3","data-testid":"run-steps",children:Gs(e).map(u=>{if(u.kind==="step"){let v=u.step,C=w(lt,{children:[Ft[v.stepKey].label,v.targetMetadataId!==e.metadataId&&w("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 Ra(v,C,i,v.status==="FAILED"||m)}let x=u.steps.some(v=>v.status==="FAILED"),h=Ks.map(v=>({status:v,count:u.steps.filter(C=>C.status===v).length})).filter(({count:v})=>v>0);return y("li",{className:"rounded-lg border border-slate-200 border-solid","data-testid":`run-step-group-${u.stepKey}`,"data-count":u.steps.length,children:w("details",{open:x||m,className:"group/fanout","data-testid":`run-step-group-card-${u.stepKey}`,children:[w("summary",{className:"flex cursor-pointer list-none flex-wrap items-center gap-2 p-4 [&::-webkit-details-marker]:hidden",children:[y("span",{"aria-hidden":"true",className:"text-[11px] text-slate-500 transition-transform group-open/fanout:rotate-90",children:"\u25B6"}),y("span",{className:"font-semibold text-[13px] text-slate-900",children:Ft[u.stepKey].label}),w("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"]}),y("span",{className:"text-[11px] text-slate-600","data-testid":`run-step-group-statuses-${u.stepKey}`,children:h.map(({status:v,count:C})=>`${wt[v].label} ${C}`).join(" \xB7 ")})]}),y("ol",{className:"space-y-3 px-4 pb-4",children:u.steps.map(v=>Ra(v,w("span",{"data-testid":`run-step-target-${v.sequence}`,children:["\u5BFE\u8C61 #",v.targetMetadataId]}),i,v.status==="FAILED"||m))})]})},`group-${u.stepKey}`)})})]})]})}function Lo({metadataId:e,runs:t,selectedRunId:n,onSelectRun:r,isLoading:d,failure:i,onClose:m,openRequest:u,returnFocusFallback:x}){let h=Ot(),v=Ot(),C=Ot(),N=Ge(null),X=Ge(null),re=Ge(null),U=Ge(null),k=Ge(null),Y=Ge(null),E=Ge(x);se(),Mt(()=>{E.current=x},[x]),Mt(()=>{if(k.current!==u){k.current=u,Y.current=null;let b=document.activeElement;N.current?.contains(b)!==!0&&(U.current=(b instanceof HTMLElement||b instanceof SVGElement)&&b!==document.body?b:null),X.current?.focus();return}n!==null&&n===Y.current&&(Y.current=null,re.current?.focus())},[u,n]),Mt(()=>()=>{k.current=null;let b=U.current;if(b?.isConnected){b.focus();return}E.current()?.focus()},[]);let B=b=>{Y.current=b===n?null:b,r(b)},M=b=>{b.key==="Escape"&&(b.stopPropagation(),m())},P=n===null?void 0:t.find(b=>b.id===n),z=()=>t.length===0?y("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"}):w(lt,{children:[w("section",{"aria-labelledby":v,"data-testid":"run-history",children:[w("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)"]}),y("ol",{className:"mt-3 space-y-1","data-testid":"run-history-list",children:t.map(b=>{let $=b.id===n,G=Ke(b),O=je[G];return y("li",{children:w("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:[w("span",{className:"font-mono font-semibold text-slate-900",children:["#",b.id]}),y("span",{className:"text-slate-700","data-testid":`run-history-trigger-${b.id}`,"data-trigger":b.trigger,children:Et[b.trigger]}),w("span",{className:"text-slate-600","data-testid":`run-history-attempt-${b.id}`,children:["\u8A66\u884C ",b.attempt]}),y("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":G,children:O.label}),y("span",{className:"ml-auto text-[11px] text-slate-600","data-testid":`run-history-started-at-${b.id}`,children:y(we,{iso:b.startedAt,testId:`run-history-started-at-value-${b.id}`})})]})},b.id)})})]}),P!==void 0?zs(P,C,re):n===null?y("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"}):w("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 w("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:[w("div",{className:"flex items-start justify-between gap-4",children:[w("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})`]}),y("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"})]}),w("dl",{className:"grid grid-cols-2 gap-3 text-[13px] sm:grid-cols-4","data-testid":"run-inspector-document",children:[w("div",{children:[y("dt",{className:"text-slate-500",children:"\u6587\u66F8"}),w("dd",{"data-testid":"run-document-id",children:["#",e]})]}),P!==void 0&&w(lt,{children:[w("div",{children:[y("dt",{className:"text-slate-500",children:"\u7248"}),y("dd",{"data-testid":"run-document-revision",children:P.revision})]}),w("div",{children:[y("dt",{className:"text-slate-500",children:"\u7A2E\u985E"}),y("dd",{"data-testid":"run-document-kind","data-kind":P.documentKind,children:Ia[P.documentKind]})]}),w("div",{children:[y("dt",{className:"text-slate-500",children:"\u6D41\u308C"}),y("dd",{children:y("code",{className:"font-mono","data-testid":"run-document-flow",children:P.flowKey})})]})]})]}),i!==null?y("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?y("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 Ut}from"@aiquants/console-ui/core";import{useId as Ws}from"react";import{Fragment as sn,jsx as I,jsxs as ie}from"react/jsx-runtime";function js(e,t){return e==null?null:Fe(e,"segment_count",t)}function Pa(e,t,n){return e==null?null:ut(e,t,n)}function Js(e){let t=e.probe_failure;if(t===null)return null;if(!tt.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 La(e,t,n){return e.reduce((r,d)=>r+Fe(d[t],`${t} of collection ${d.collection_name}`,n),0)}var Qs=Ut("space-1"),Xs={padding:0,height:"1px",color:"#1e293b"},Ys={display:"flex",height:"100%"},Zs={fontWeight:500,marginBlock:"auto",overflowWrap:"normal"},en={display:"flex",alignItems:"baseline",gap:"12px",marginBottom:"12px"},tn={display:"flex",flexWrap:"wrap",alignItems:"baseline",columnGap:"10px",rowGap:"4px",flex:"1 1 0%",minWidth:0},Kt={whiteSpace:"nowrap"},$a=Ut("space-3"),an=Ut("info-tint"),Bt={fontSize:"11px",padding:"2px 6px",borderRadius:"4px",whiteSpace:"nowrap"};function Ta(e,t){return`vectors_config.${e}.size of collection ${t}`}function Uo({overview:e,health:t,resources:n,onRefresh:r,isRefreshing:d=!1,selection:i}){let{formatLocale:m}=se(),u=Ws(),{collections:x}=e,h=Js(e),v=h===null,C=v?La(x,"points_count",m):null,N=v?La(x,"vectors_count",m):null,X=Pa(n?.ram_bytes,"ram_bytes",m),re=Pa(n?.disk_bytes,"disk_bytes",m),U=js(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:en,children:[ie("div",{"data-testid":"qdrant-card-title-group",style:tn,children:[I("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(sn,{children:[I("span",{"data-testid":"qdrant-health-badge","data-healthy":String(t.healthy),...Qe[t.healthy?"connected":"error"],style:{...Kt,fontSize:"12px",padding:"2px 8px",borderRadius:"12px",fontWeight:600},children:Je[t.healthy?"connected":"error"]}),ie("span",{"data-testid":"qdrant-latency",style:{...Kt,fontSize:"12px",color:"#64748b"},children:["\u5FDC\u7B54\u6642\u9593: ",I(V,{value:t.latency_ms,unit:"ms",testId:"qdrant-latency-value"})]})]})]}),r&&I("button",{type:"button","data-testid":"qdrant-refresh-button",disabled:d,onClick:r,style:{...Kt,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:[I("div",{style:{fontSize:"12px",color:"#64748b"},children:"\u7DCF\u30DD\u30A4\u30F3\u30C8\u6570"}),I("div",{"data-testid":"qdrant-total-points",style:{fontSize:"18px",fontWeight:700,color:"#0f172a"},children:I(V,{value:C,testId:"qdrant-total-points-value"})})]}),ie("div",{children:[I("div",{style:{fontSize:"12px",color:"#64748b"},children:"\u7DCF\u30D9\u30AF\u30C8\u30EB\u6570"}),I("div",{"data-testid":"qdrant-total-vectors",style:{fontSize:"18px",fontWeight:700,color:"#0f172a"},children:I(V,{value:N,testId:"qdrant-total-vectors-value"})})]}),ie("div",{children:[I("div",{style:{fontSize:"12px",color:"#64748b"},children:"\u30E1\u30E2\u30EA\u6D88\u8CBB (RAM)"}),I("div",{"data-testid":"qdrant-ram-usage",style:{fontSize:"18px",fontWeight:700,color:"#0f172a"},children:I(Ie,{text:X,testId:"qdrant-ram-usage-value"})})]}),ie("div",{children:[I("div",{style:{fontSize:"12px",color:"#64748b"},children:"\u30C7\u30A3\u30B9\u30AF\u6D88\u8CBB"}),I("div",{"data-testid":"qdrant-disk-usage",style:{fontSize:"18px",fontWeight:700,color:"#0f172a"},children:I(Ie,{text:re,testId:"qdrant-disk-usage-value"})})]}),ie("div",{children:[I("div",{style:{fontSize:"12px",color:"#64748b"},children:"\u30BB\u30B0\u30E1\u30F3\u30C8\u7DCF\u6570"}),I("div",{"data-testid":"qdrant-segment-count",style:{fontSize:"18px",fontWeight:700,color:"#0f172a"},children:I(V,{value:U,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 (",I(V,{value:v?x.length:null,unit:"\u4EF6",testId:"qdrant-collections-count"}),")"]}),h!==null?I("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}):x.length===0?I("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"}):I("section",{tabIndex:0,"aria-labelledby":u,"data-testid":"qdrant-collections-scroll",style:{overflowX:"auto",WebkitOverflowScrolling:"touch",padding:Qs},children:ie("table",{"aria-labelledby":u,"data-testid":"qdrant-collections-list",style:{width:"100%",borderCollapse:"collapse",fontSize:"13px"},children:[I("thead",{children:ie("tr",{style:{borderBottom:"1px solid #e2e8f0",color:"#64748b"},children:[I("th",{scope:"col","data-testid":"qdrant-collections-name-header",style:{padding:`6px ${$a}`,textAlign:"start"},children:"\u30B3\u30EC\u30AF\u30B7\u30E7\u30F3\u540D"}),I("th",{scope:"col",style:{padding:"6px 8px",textAlign:"start"},children:"\u30C9\u30E1\u30A4\u30F3"}),I("th",{scope:"col","data-testid":"qdrant-collections-points-header",style:{padding:"6px 8px",textAlign:"end"},children:"\u30DD\u30A4\u30F3\u30C8\u6570"}),I("th",{scope:"col",style:{padding:"6px 8px",textAlign:"start"},children:"\u30D9\u30AF\u30C8\u30EB\u69CB\u6210"})]})}),I("tbody",{children:x.map(k=>{let Y=i!==void 0&&k.collection_name===i.selectedCollectionName,E=I("span",{style:Zs,children:k.collection_name}),{dense:B,sparse:M,image:P}=k.vectors_config,z=B===void 0?null:Fe(B.size,Ta("dense",k.collection_name),m),b=P===void 0?null:Fe(P.size,Ta("image",k.collection_name),m);return ie("tr",{"data-testid":`collection-row-${k.collection_name}`,"data-collection-name":k.collection_name,"data-selected":String(Y),style:{borderBottom:"1px solid #f1f5f9",backgroundColor:Y?an:"transparent"},children:[i===void 0?I("td",{style:{padding:`8px ${$a}`,color:"#1e293b"},children:E}):I("td",{style:Xs,children:I("div",{style:Ys,children:I(Wt,{selected:Y,controls:i.detailId,onSelect:()=>i.onSelectCollection(k.collection_name),testId:`collection-select-${k.collection_name}`,children:E})})}),I("td",{style:{padding:"8px",color:"#475569"},children:k.domain_key}),I("td",{"data-testid":`collection-points-${k.collection_name}`,style:{padding:"8px",color:"#0f172a",textAlign:"end"},children:I(V,{value:k.points_count,testId:`collection-points-value-${k.collection_name}`})}),I("td",{style:{padding:"8px"},children:ie("div",{style:{display:"flex",gap:"6px",flexWrap:"wrap"},children:[z!==null&&ie("span",{"data-testid":`vector-tag-dense-${k.collection_name}`,style:{...Bt,backgroundColor:"#e0e7ff",color:"#3730a3"},children:["Dense: ",I(V,{value:z,unit:"\u6B21\u5143",testId:`vector-tag-dense-size-${k.collection_name}`})]}),M!==void 0&&I("span",{"data-testid":`vector-tag-sparse-${k.collection_name}`,style:{...Bt,backgroundColor:"#fef3c7",color:"#92400e"},children:M.modifier?`Sparse (${M.modifier.toUpperCase()})`:"Sparse"}),b!==null&&ie("span",{"data-testid":`vector-tag-image-${k.collection_name}`,style:{...Bt,backgroundColor:"#f3e8ff",color:"#6b21a8"},children:["Image: ",I(V,{value:b,unit:"\u6B21\u5143",testId:`vector-tag-image-size-${k.collection_name}`})]})]})})]},k.collection_name)})})]})})]})]})}import{jsx as K,jsxs as fe}from"react/jsx-runtime";var nn="\u5BFE\u8C61\u306A\u3057";function zo({counts:e,totalFiles:t,failedItems:n=[],onRetryAll:r,onRetryItem:d,isRetrying:i=!1,onRefresh:m}){se();let u=e.SYNCED??0,x=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)}%`:nn;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"}),r&&K("button",{type:"button","data-testid":"retry-all-button",disabled:i||v===0,onClick:r,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":x,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:x})]}),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{_s as CHUNK_SOURCE_LABELS,qt as DegradedSearchBanner,Fn as DocumentIngestConsole,qn as EnrichmentStrategyBoard,Ue as FLOW_FOCUS_RING,Ns as FLOW_GEOMETRY,Ye as FLOW_NODE_TEXT,bt as FinishedInstant,Ea as GATE_POLICY_LABELS,wa as GATE_STATE_PRESENTATION,Qn as InfrastructureHealthMonitor,ao as MetadataSearchWorkbench,io as ModelComparisonWorkbench,Ja as NOTHING_TO_READ_LABELS,po as OntologyStatusCard,va as PHASE_LABELS,je as PIPELINE_RUN_STATUS_PRESENTATION,wt as PIPELINE_STEP_STATUS_PRESENTATION,Et as PIPELINE_TRIGGER_LABELS,So as PipelineFlowViewer,Lo as PipelineRunInspector,Uo as QdrantStorageCard,Ka as REASON_LABELS,we as RecordedInstant,ga as SCORE_DISPLAY_DECIMALS,ua as SEARCH_MODE_LABELS,ms as SEARCH_PRESETS,Ds as STEP_CARDS_OPEN_LIMIT,zo as SyncStatusMonitor,Jt as UNFINISHED_LABEL,ba as formatComparisonScore,$s as gateCaption,ka as gateState,na as gateStateOf,ts as ingestRowAction,xa as layoutFlow,Ke as pipelineRunPresentationKey,gs as rankAgreement,Qt as skipReasonLabel,ha as stepGatePolicy,Ls as stepGateState};
|
|
1
|
+
import{jsx as Gt,jsxs as ua}from"react/jsx-runtime";var Fs={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 ja({metadata:e,onDismiss:t}){if(!e.is_degraded)return null;let n=(e.degradation_reason??"").split(",").map(r=>r.trim()).filter(r=>r.length>0);return Gt("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:ua("div",{style:{display:"flex",justifyContent:"space-between",alignItems:"flex-start"},children:[ua("div",{children:[ua("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"]}),n.length>0&&Gt("ul",{"data-testid":"degraded-reason-list",style:{margin:"6px 0 0 0",paddingLeft:"20px"},children:n.map(r=>Gt("li",{"data-testid":`degraded-reason-${r}`,children:Fs[r]??r},r))})]}),t&&Gt("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{HTTP_FORBIDDEN as xr,mapOutcome as _n}from"@aiquants/console-ui/core";import{DOCUMENT_CHANGE_FEED_PAGE_SIZE as hr}from"@aiquants/enrichment-core";import{useRef as Tn}from"react";import{reasonAside as Us}from"@aiquants/console-ui/core";var dt={classification:"\u5206\u985E",metadata:"\u30E1\u30BF\u30C7\u30FC\u30BF",labels:"\u30E9\u30D9\u30EB",tags:"\u30BF\u30B0",structured_data:"\u69CB\u9020\u5316\u30C7\u30FC\u30BF",text:"\u672C\u6587",summary:"\u8981\u7D04",chunks:"\u30C1\u30E3\u30F3\u30AF",assets:"\u6DFB\u4ED8"},xt={RUN:"\u5B9F\u884C\u306E\u5F8C\u306E\u8A18\u9332",PRE_WRITE:"\u4E0A\u66F8\u304D\u306E\u524D\u306E\u8A18\u9332",MANUAL:"\u624B\u52D5\u306E\u8A18\u9332",BACKFILL:"\u8A18\u9332\u306E\u8D77\u70B9"},pa={ADDED:"\u8FFD\u52A0",REMOVED:"\u524A\u9664",MODIFIED:"\u5909\u66F4",MOVED:"\u79FB\u52D5"},Xa={EXACT:"\u305D\u306E\u307E\u307E\u518D\u73FE",WHITESPACE_NORMALIZED:"\u7A7A\u767D\u3092\u7E4B\u304E\u76F4\u3057\u3066\u518D\u73FE",UNVERIFIED:"\u518D\u73FE\u3067\u304D\u306A\u3044"},Ya="\u30C1\u30E3\u30F3\u30AF\u306E\u672C\u6587\u306F\u3053\u306E\u533A\u9593\u306E\u6587\u3092\u7A7A\u767D\u3067\u7E4B\u304E\u76F4\u3057\u305F\u5F62\u3067\u3059\u3002",Ja="\u3053\u306E\u65AD\u7247\u306F\u3053\u306E\u72B6\u614B\u306E\u62BD\u51FA\u672C\u6587\u3068\u5BFE\u5FDC\u3057\u307E\u305B\u3093\u3002",Qa="\u672C\u6587\u306F\u540C\u3058\u3067\u3001\u30C1\u30E3\u30F3\u30AF\u306E\u5207\u308A\u65B9\u3060\u3051\u304C\u5909\u308F\u308A\u307E\u3057\u305F\u3002",qt={confidentialityLevel:"\u6A5F\u5BC6\u533A\u5206",departmentId:"\u90E8\u9580",folderPath:"\u30D5\u30A9\u30EB\u30C0",createdBy:"\u4F5C\u6210\u8005",fileName:"\u767B\u9332\u540D",filePath:"\u30D1\u30B9",fileId:"\u30D5\u30A1\u30A4\u30EB ID",revision:"\u7248",revisionId:"\u7248\u306E ID",fileSize:"\u5927\u304D\u3055",mimeType:"MIME",fileHash:"\u30CF\u30C3\u30B7\u30E5",mtime:"\u66F4\u65B0\u6642\u523B",present:"\u672C\u6587\u306E\u6709\u7121",lineEnding:"\u6539\u884C",finalNewline:"\u6700\u5F8C\u306E\u6539\u884C",mime:"\u672C\u6587\u306E MIME",source:"\u672C\u6587\u306E\u51FA\u6240",isTruncated:"\u5207\u308A\u8A70\u3081",pageOffsets:"\u9801\u306E\u533A\u5207\u308A",assignedBy:"\u4ED8\u3051\u305F\u8005",confidenceScore:"\u78BA\u4FE1\u5EA6",textSha256:"\u672C\u6587\u306E\u30CF\u30C3\u30B7\u30E5"};function Pt(e){return Object.hasOwn(qt,e)?qt[e]:e}var ht="\u9694\u96E2 (RESTRICTED) \u306E\u6587\u66F8",Za="\u9694\u96E2\u3055\u308C\u3066\u3044\u305F\u671F\u9593\u306E\u72B6\u614B",Vt="\u9694\u96E2\u3055\u308C\u3066\u3044\u305F\u671F\u9593\u306E\u5B9F\u884C",en="\u76F4\u524D\u306E\u8A18\u9332\u3068\u306E\u6BD4\u8F03\u306F\u3042\u308A\u307E\u305B\u3093\u3002",tn="\u5931\u6557\u3057\u305F\u5B9F\u884C\u306E\u5F8C\u306E\u72B6\u614B",ma="\u8A18\u9332\u3055\u308C\u3066\u3044\u307E\u305B\u3093",an="\u30BD\u30FC\u30B9\u306F\u540C\u3058\u3067\u3001\u30E2\u30C7\u30EB\u306E\u51FA\u529B\u3060\u3051\u304C\u5909\u308F\u308A\u307E\u3057\u305F";function nn(e){return`\u3053\u306E\u5909\u5316\u306B\u306F\u8A18\u9332\u3055\u308C\u306A\u304B\u3063\u305F\u5B9F\u884C ${e.map(t=>`#${t}`).join("\u3001")} \u306E\u5909\u5316\u3082\u542B\u307E\u308C\u307E\u3059`}function qe(e){return`r${e}`}function fa(e,t){return e===t?`${qe(t)} (\u540C\u3058\u7248)`:`${qe(e)} \u2192 ${qe(t)}`}function Wt(e){let t=dt[e.facet];if(e.facet==="classification"||e.facet==="metadata")return`${t} \u5909\u66F4`;let n=[[e.addedCount,"+"],[e.removedCount,"\u2212"],[e.modifiedCount,"~"],[e.movedCount,"\u79FB\u52D5 "]].flatMap(([r,s])=>r===null||r===0?[]:[`${s}${r}`]);return n.length===0?`${t} \u5909\u66F4`:`${t} ${n.join(" ")}`}function lt(e){return e===null?"(\u306A\u3057)":typeof e=="string"?e:JSON.stringify(e)}var at="\u6587\u66F8\u306E\u5C65\u6B74\u3092\u95B2\u89A7\u3059\u308B\u6A29\u9650\u304C\u3042\u308A\u307E\u305B\u3093\u3002";function zt(e,t,a){return e.failureSentence(t,at,nt(a))}function nt(e){return t=>`${e}\u3092\u8AAD\u3081\u307E\u305B\u3093\u3067\u3057\u305F${Us(t)}\u3002`}import{RUN_TERMINAL_STEP_KEY as rn}from"@aiquants/enrichment-core";var sn=(e,t)=>Date.parse(t.time)-Date.parse(e.time);function on(e){let t=e.states.flatMap(d=>d.kind==="readable"?[d.item]:[]),a=e.runs.flatMap(d=>d.kind==="readable"?[d.item]:[]),n=new Set(a.map(d=>d.id)),r=[...a.map(d=>({kind:"run",key:`run:${d.id}`,time:d.startedAt,run:d,state:t.find(h=>h.runId===d.id)??null})),...t.filter(d=>d.runId===null||!n.has(d.runId)).map(d=>({kind:"state",key:`state:${d.stateId}`,time:d.settledAt,state:d}))].sort(sn),o=[...new Set([...e.revisions.map(d=>d.revision),...r.map(d=>d.kind==="run"?d.run.revision:d.state.revision)])].sort((d,h)=>h-d).map(d=>({revision:d,isCurrent:e.revisions.some(h=>h.revision===d&&h.isCurrent),items:r.filter(h=>(h.kind==="run"?h.run.revision:h.state.revision)===d)})),u=[...e.states.flatMap((d,h)=>d.kind==="restricted"?[{key:`restricted:state:${h}`,time:d.settledAt,mark:d}]:[]),...e.runs.flatMap((d,h)=>d.kind==="restricted"?[{key:`restricted:run:${h}`,time:d.startedAt,mark:d}]:[])].sort(sn);return{groups:o,marks:u,states:t,runs:a}}function ga(e){if(e.status==="RUNNING")return!1;let t=e.steps.find(a=>a.stepKey===rn);return t===void 0||t.status==="FAILED"}function dn(e,t){let a=t.states.find(s=>s.stateId===e.previousStateId);if(a===void 0)return[];let n=Date.parse(a.settledAt),r=Date.parse(e.settledAt);return t.runs.filter(s=>{let o=Date.parse(s.startedAt);return s.status!=="RUNNING"&&s.id!==e.runId&&o>=n&&o<r&&!t.states.some(u=>u.runId===s.id)&&!s.steps.some(u=>u.stepKey===rn&&u.status==="SUCCEEDED")}).map(s=>s.id)}function ln(e,t){switch(e.kind){case"latest_state":{let a=t.states[0];return a===void 0?null:t.runs.some(n=>n.id===a.runId)?`run:${a.runId}`:`state:${a.stateId}`}case"run":return`run:${e.runId}`;case"state":{let a=t.states.find(n=>n.stateId===e.stateId);return a!==void 0&&t.runs.some(n=>n.id===a.runId)?`run:${a.runId}`:`state:${e.stateId}`}}}function cn(e,t){return e.kind==="readable"?`readable:${e.item.stateId}`:`restricted:${t}`}import{useState as Ks}from"react";function jt(e){let[t,a]=Ks({failure:null,count:0});return e!==null&&e!==t.failure?(a({failure:e,count:t.count+1}),t.count+1):t.count}import{ceil8 as Xt,monoTextWidthEm as ba,TOKENS as ya,textWidthEm as xa}from"@aiquants/console-ui/core";var st=ya.type.body.size,ha=ya.space["space-3"],Hs=20,un=Xt(st*xa("\u3042".repeat(Hs))+2*ha),pn=448,Bs=40,Gs=2,qs="+ ",Vs=ya.space["space-4"];function Ws(e){if(!(Number.isSafeInteger(e)&&e>=0))throw new RangeError(`A line number is a non-negative safe integer: ${e}`);return String(e).length}function mn(e){let a=ba("0".repeat(Ws(e)+Gs))+ba(qs)+ba("0".repeat(Bs));return Xt(st*2*a+Vs)}function ct(e){return Xt(st*xa(e)+2*ha)}function ut(e){if(e.length===0)throw new RangeError("A column needs at least one sample text");return Math.max(...e.map(ct))}function Yt(e){return Xt(st*xa(e)+4*ha)}var fn="0000/00/00 00:00:00",Oe=ct("\u3042".repeat(10));import{AlertMessage as zs,Button as js,Card as Xs,ComparisonGrid as Ys,DataTable as Js,LoadMore as Qs,MasterDetail as Zs,Measured as er,Notice as tr,Pill as ar,ResourceFailed as nr,RowButton as sr,SelectableList as rr,VisuallyHidden as or,useConsoleUi as ir,useFocusRescue as dr,usePagedResource as lr,useResource as cr}from"@aiquants/console-ui";import{createElement as Le}from"react";var Lt="ja-JP";function M(){let e=ir();if(e.locale!=="ja"||e.formatLocale!==Lt)throw new RangeError(`The ConsoleUiRoot must be locale "${"ja"}" and formatLocale "${Lt}", the language and format of this package's text (got locale "${e.locale}" and formatLocale "${e.formatLocale}")`);return e}function ae(e){return M(),Le(er,e)}function bn(e){return M(),Le(sr,e)}function yn(e){return M(),Le(Zs,e)}function xn(e){return M(),Le(Ys,e)}function Je(e){return M(),Le(ar,e)}function hn(e){return M(),Le(Xs,e)}function $e(e){return M(),Le(js,e)}function vt(e){return M(),Le(tr,e)}function $t(e){return M(),Le(zs,e)}function pt(e){return M(),Le(nr,e)}function Jt(e){return M(),Le(Qs,e)}function vn(e){return M(),Le(or,e)}function Nt(e){return M(),Le(Js,e)}function Nn(e){return M(),Le(rr,e)}function va(e,t,a){return M(),cr(e,t,a)}function Qt(e,t,a){return M(),lr(e,t,a)}function We(e){return M(),dr(e)}import{jsx as Zt}from"react/jsx-runtime";var Dt=/[^\s\x1c-\x1f\x85\ufeff]/,ur={fontVariantNumeric:"tabular-nums"},pr={fontVariantNumeric:"tabular-nums",whiteSpace:"nowrap"};function Sn({text:e,testId:t,slot:a}){if(M(),e===null)return Zt(ae,{value:null,testId:t});if(!Dt.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 Zt("span",{"data-measured":"true","data-testid":t,style:a,children:e})}function At({text:e,testId:t}){return Zt(Sn,{text:e,testId:t,slot:ur})}function Fe({text:e,testId:t}){return Zt(Sn,{text:e,testId:t,slot:pr})}import{PIPELINE_STEPS as En,parseSkipReason as mr,RUN_TERMINAL_STEP_KEY as fr}from"@aiquants/enrichment-core";var Qe={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"}},Na={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"}},Sa={ingest:"\u53D6\u308A\u8FBC\u307F",retry:"\u518D\u8A66\u884C",resync:"\u518D\u540C\u671F"},gr="\u6587\u66F8\u306E\u72B6\u614B\u306E\u8A18\u9332";function Ea(e){return e===fr?gr:En[e].label}var Rn={RECORDED:"\u72B6\u614B\u3092\u8A18\u9332\u3057\u307E\u3057\u305F",UNCHANGED:"\u524D\u306E\u8A18\u9332\u304B\u3089\u5909\u5316\u306F\u3042\u308A\u307E\u305B\u3093",ALREADY_RECORDED:"\u3053\u306E\u5B9F\u884C\u306E\u72B6\u614B\u306F\u8A18\u9332\u6E08\u307F\u3067\u3059"},In="\u672A\u5B8C\u4E86";function rt(e){return e.status==="FAILED"&&e.retryScheduled?"FAILED_RETRY_SCHEDULED":e.status}var br={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 kn(e){let t=mr(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`${En[t.stepKey].label} \u304C\u5B9F\u884C\u3055\u308C\u306A\u304B\u3063\u305F`;case"nothing_to_read":return br[t.token];case"superseded":return"\u5B9F\u884C\u306E\u7248\u304C\u73FE\u5728\u306E\u7248\u3067\u306A\u304F\u306A\u3063\u305F";case"recording_disabled":return"\u8A18\u9332\u306E\u5207\u66FF\u304C\u7121\u52B9";case"recording_misconfigured":return"\u8A18\u9332\u306E\u5207\u66FF\u306E\u8A2D\u5B9A\u306E\u8AA4\u308A"}}import{formatInstant as yr}from"@aiquants/console-ui/core";function wn(e,t){return yr(e,Lt,t)}import{jsx as Cn}from"react/jsx-runtime";function ge({iso:e,testId:t}){let{timeZone:a}=M();return Cn(Fe,{text:e===null?null:wn(e,a),testId:t})}function St({iso:e,testId:t}){return M(),e===null?In:Cn(ge,{iso:e,testId:t})}import{Fragment as Pn,jsx as He,jsxs as Ra}from"react/jsx-runtime";var vr="document-changes";function Vi({host:e,onOpen:t}){let{labels:a}=M(),n=Tn(null),r=Tn(null),s=Qt(vr,{first:_=>e.loadChanges(null,_).then(R=>_n(R,l=>({rows:l.rows,next:l.next,meta:null}))),next:(_,R)=>e.loadChanges(_,R).then(l=>(!l.ok&&l.status===xr&&s.reload(),_n(l,C=>({rows:C.rows,next:C.next}))))},0),o=We(()=>n.current),u=s.state.kind==="ready"?s.state.refreshFailure:null,d=jt(u);return He(hn,{title:"\u76F4\u8FD1\u306E\u6587\u66F8\u306E\u5909\u5316",headingRef:n,testId:"change-feed",children:(()=>{if(s.state.kind==="failed")return He(pt,{failure:s.state,onReload:s.reload,forbiddenMessage:at,failureMessage:nt("\u76F4\u8FD1\u306E\u6587\u66F8\u306E\u5909\u5316"),rescueRef:o,testId:"change-feed-failed"});if(s.state.kind!=="ready")return He("p",{"aria-busy":"true","data-testid":"change-feed-loading",children:"\u76F4\u8FD1\u306E\u6587\u66F8\u306E\u5909\u5316\u3092\u8AAD\u307F\u8FBC\u3093\u3067\u3044\u307E\u3059\u2026"});let{value:_}=s.state,R=_.rows.map((l,C)=>({row:l,position:C}));return Ra(Pn,{children:[u!==null&&He($t,{occurrence:d,testId:"change-feed-refresh-failed",children:zt(a,u,"\u76F4\u8FD1\u306E\u6587\u66F8\u306E\u5909\u5316")}),He(Nt,{caption:"\u76F4\u8FD1\u306E\u6587\u66F8\u306E\u5909\u5316",captionHidden:!0,columns:[{key:"time",header:"\u6642\u523B",width:{fixedPx:ct(fn)},align:"start",cell:({row:l,position:C})=>He(ge,{iso:l.kind==="readable"?l.item.settledAt:l.settledAt,testId:`change-feed-time-value-${C}`})},{key:"document",header:"\u6587\u66F8",width:{minPx:Oe},align:"start",cell:({row:l})=>l.kind==="readable"?Ra(Pn,{children:[He("span",{children:l.item.fileName})," ",He("span",{children:l.item.fileUri})]}):He("span",{"data-restricted-mark":"change",children:ht})},{key:"revision",header:"\u7248",width:{fixedPx:ct("r00000 \u2192 r00000")},align:"start",cell:({row:l})=>l.kind==="readable"?fa(l.item.previousRevision,l.item.revision):null},{key:"cause",header:"\u5951\u6A5F",width:{fixedPx:ut(Object.values(xt))},align:"start",cell:({row:l})=>l.kind==="readable"?xt[l.item.cause]:null},{key:"actor",header:"\u64CD\u4F5C\u8005",width:{minPx:Oe},align:"start",cell:({row:l})=>l.kind==="readable"?l.item.actor:null},{key:"facets",header:"\u5909\u308F\u3063\u305F\u9762",width:{minPx:Oe},align:"start",cell:({row:l,position:C})=>l.kind==="readable"?l.item.changes.map($=>He(Je,{tone:"neutral",variant:"tint",testId:`change-feed-badge-${C}-${$.facet}`,children:Wt($)},$.facet)):null},...t===void 0?[]:[{key:"open",header:"\u958B\u304F",width:{fixedPx:Yt("\u958B\u304F")},align:"start",cell:({row:l})=>l.kind==="readable"?Ra($e,{variant:"secondary",onClick:()=>t(l.item.metadataId,l.item.stateId),testId:`change-feed-open-${l.item.stateId}`,children:["\u958B\u304F ",He(vn,{testId:`change-feed-open-name-${l.item.stateId}`,children:`${l.item.fileName} ${fa(l.item.previousRevision,l.item.revision)} \u306E\u5909\u5316`})]}):null}]],rows:R,rowKey:({row:l,position:C})=>cn(l,C),rowTestId:"change-feed-row",rowData:({row:l})=>({"data-row-kind":l.kind}),rowSize:t===void 0?"row":"row-control",empty:"\u76F4\u8FD1\u306E\u5909\u5316\u306F\u3042\u308A\u307E\u305B\u3093\u3002",testId:"change-feed-table",ref:r}),He(Jt,{onLoad:s.loadMore,busy:_.loadingMore||s.state.refreshing,done:_.next===null,failure:_.moreFailure,limit:hr,rows:{count:R.length,ref:r},testId:"change-feed-more"})]})})()})}import{reasonAside as eo,TOKENS as $a}from"@aiquants/console-ui/core";import{DOCUMENT_KIND_LABELS as to}from"@aiquants/enrichment-core";import{useCallback as ao,useEffect as na,useId as Ta,useRef as ze,useState as It}from"react";import{TOKENS as Pr}from"@aiquants/console-ui/core";import{DOCUMENT_FACETS as Lr}from"@aiquants/enrichment-core";import{useCallback as $r,useEffect as Dr,useId as Ar,useState as Mr}from"react";import{useState as Cr}from"react";import{mapOutcome as Ln}from"@aiquants/console-ui/core";import{DIFF_LINE_PAGE_MAX as Ia}from"@aiquants/enrichment-core";import{useCallback as Dn,useEffect as wa,useId as Nr,useRef as An,useState as ea}from"react";import{Fragment as Un,jsx as L,jsxs as Ee}from"react/jsx-runtime";var Ca="\u5E45\u304C\u8DB3\u308A\u306A\u3044\u305F\u3081 1 \u5217\u3067\u8868\u793A\u3057\u3066\u3044\u307E\u3059",Mn={context:"",removed:"\u2212",added:"+"},On={whiteSpace:"pre-wrap",overflowWrap:"anywhere"};function ka(e){let t=e.newLines>0?e.newStart:e.oldStart,a=e.firstPage===null?"":` (p.${e.firstPage})`;return`${t} \u884C\u76EE${a} +${e.linesAdded} \u2212${e.linesRemoved}`}function Sr(e){return e.reduce((t,a)=>Math.max(t,a.oldStart+a.oldLines-1,a.newStart+a.newLines-1),0)}function Er(e){return e.reduce((t,{line:a})=>Math.max(t,a.oldNumber??0,a.newNumber??0),0)}function Rr(e){let t=[],a=0;for(let n=1;n<=e.length;n++)(n===e.length||e[n].page!==e[a].page)&&(t.push(...Ir(e.slice(a,n).map(({line:r})=>r))),a=n);return t}function Ir(e){let t=[],a=[],n=[],r=()=>{for(let s=0;s<Math.max(a.length,n.length);s++)t.push({left:a[s]??null,right:n[s]??null});a=[],n=[]};for(let s of e)s.kind==="context"?(r(),t.push({left:s,right:s})):s.kind==="removed"?(n.length>0&&r(),a.push(s)):n.push(s);return r(),t}function Fn(e){return e.segments.map((t,a)=>{let n=`${a}`;return t.kind==="removed"?L("del",{"data-cui-surface":"danger-tint","data-cui-fg":"fg","data-segment":"removed",children:t.text},n):t.kind==="added"?L("ins",{"data-cui-surface":"success-tint","data-cui-fg":"fg","data-segment":"added",children:t.text},n):L("span",{children:t.text},n)})}function $n(e,t){return Ee(Un,{children:[L("td",{"data-line-number":t,children:e===null?"":t==="old"?e.oldNumber:e.newNumber}),L("td",{"data-line-sign":!0,children:e===null?"":Mn[e.kind]}),L("td",{style:On,"data-line-text":t,children:e===null?null:Fn(e)})]})}function kr({states:e,target:t,hunk:a,layout:n,tableLabel:r,readLines:s,rescueTarget:o,onLines:u,testId:d}){let h={...e,...t,hunk:a},_=JSON.stringify([e.fromStateId,e.toStateId,t,a]),R=Qt(_,{first:S=>s({...h,offset:0,limit:Ia},S).then(P=>Ln(P,O=>({rows:O.lines.map(Q=>({line:Q,page:0})),next:O.next,meta:null}))),next:(S,P)=>s({...h,offset:S,limit:Ia},P).then(O=>Ln(O,Q=>({rows:Q.lines.map(G=>({line:G,page:S})),next:Q.next})))},0),l=We(o),C=An(null),$=R.state.kind==="ready"?R.state.value.rows:null;if(wa(()=>{$!==null&&u(Er($))},[$,u]),R.state.kind==="failed")return L(pt,{failure:R.state,onReload:R.reload,forbiddenMessage:at,failureMessage:nt("\u5DEE\u5206\u306E\u884C"),rescueRef:l,testId:`${d}-failed`});if(R.state.kind!=="ready")return L("p",{"aria-busy":"true","data-testid":`${d}-loading`,children:"\u5DEE\u5206\u306E\u884C\u3092\u8AAD\u307F\u8FBC\u3093\u3067\u3044\u307E\u3059\u2026"});let{value:m}=R.state,I=n==="split"?Rr(m.rows):null;return Ee("div",{"data-testid":d,"data-layout":n,children:[Ee("table",{"aria-label":r,"data-testid":`${d}-lines`,"data-cui-type":"body","data-cui-face":"mono",children:[L("thead",{children:n==="split"?Ee("tr",{children:[L("th",{scope:"col",children:"\u65E7"}),L("th",{scope:"col",children:"\u7B26\u53F7"}),L("th",{scope:"col",children:"\u53E4\u3044\u672C\u6587"}),L("th",{scope:"col",children:"\u65B0"}),L("th",{scope:"col",children:"\u7B26\u53F7"}),L("th",{scope:"col",children:"\u65B0\u3057\u3044\u672C\u6587"})]}):Ee("tr",{children:[L("th",{scope:"col",children:"\u65E7"}),L("th",{scope:"col",children:"\u65B0"}),L("th",{scope:"col",children:"\u7B26\u53F7"}),L("th",{scope:"col",children:"\u672C\u6587"})]})}),L("tbody",{ref:C,children:I===null?m.rows.map(({line:S},P)=>Ee("tr",{tabIndex:-1,"data-cui-row-focus":"","data-line-kind":S.kind,children:[L("td",{"data-line-number":"old",children:S.oldNumber}),L("td",{"data-line-number":"new",children:S.newNumber}),L("td",{"data-line-sign":!0,children:Mn[S.kind]}),L("td",{style:On,"data-line-text":"unified",children:Fn(S)})]},P)):I.map(S=>Ee("tr",{tabIndex:-1,"data-cui-row-focus":"","data-line-kind":S.left===S.right?"context":"changed",children:[$n(S.left,"old"),$n(S.right,"new")]},`${S.left?.oldNumber??""}:${S.right?.newNumber??""}`))})]}),L(Jt,{onLoad:R.loadMore,busy:m.loadingMore||R.state.refreshing,done:m.next===null,failure:m.moreFailure,limit:Ia,rows:{count:I===null?m.rows.length:I.length,ref:C},testId:`${d}-more`})]})}function wr(){let[e,t]=ea(null);return[Dn((n=>{let r=new ResizeObserver(s=>{for(let o of s)t(o.contentRect.width)});return r.observe(n),()=>r.disconnect()}),[]),e]}function ta({states:e,target:t,index:a,readLines:n,label:r,rescueTarget:s,onNarrowChange:o,testId:u}){M();let d=Nr(),[h,_]=ea("split"),[R,l]=ea(()=>new Set(a===null?[0]:[])),[C,$]=ea(0),[m,I]=wr(),S=An(new Map),P=Dn(E=>$(q=>Math.max(q,E)),[]),O=mn(Math.max(a===null?0:Sr(a.hunks),C)),Q=I!==null&&I>=O,G=h==="split"&&Q?"split":"unified",Z=h==="split"&&I!==null&&!Q;wa(()=>{o(d,Z)},[d,Z,o]),wa(()=>()=>o(d,!1),[d,o]);let F=(E,q)=>l(Y=>{let fe=new Set(Y);return q?fe.add(E):fe.delete(E),fe}),H=E=>`${d}-hunk-${E}`,re=(E,q)=>L(kr,{states:e,target:t,hunk:E,layout:G,tableLabel:q,readLines:n,rescueTarget:()=>S.current.get(E)??s(),onLines:P,testId:`${u}-hunk-${E}-body`});return Ee("div",{ref:m,"data-testid":u,"data-layout":G,"data-split-min-px":O,children:[a!==null&&Ee(Un,{children:[Ee("dl",{"data-testid":`${u}-stats`,children:[Ee("div",{children:[L("dt",{children:"\u8FFD\u52A0\u3057\u305F\u884C"}),L("dd",{children:L(ae,{value:a.stats.linesAdded,testId:`${u}-lines-added`})})]}),Ee("div",{children:[L("dt",{children:"\u524A\u9664\u3057\u305F\u884C"}),L("dd",{children:L(ae,{value:a.stats.linesRemoved,testId:`${u}-lines-removed`})})]}),Ee("div",{children:[L("dt",{children:"\u5909\u308F\u3089\u306A\u3044\u884C"}),L("dd",{children:L(ae,{value:a.stats.linesUnchanged,testId:`${u}-lines-unchanged`})})]}),Ee("div",{children:[L("dt",{children:"\u8FFD\u52A0\u3057\u305F\u5B57"}),L("dd",{children:L(ae,{value:a.stats.charsAdded,testId:`${u}-chars-added`})})]}),Ee("div",{children:[L("dt",{children:"\u524A\u9664\u3057\u305F\u5B57"}),L("dd",{children:L(ae,{value:a.stats.charsRemoved,testId:`${u}-chars-removed`})})]}),Ee("div",{children:[L("dt",{children:"\u985E\u4F3C\u5EA6"}),L("dd",{children:L(Fe,{text:a.stats.similarity===null?null:`${(a.stats.similarity*100).toFixed(1)}%`,testId:`${u}-similarity`})})]})]}),a.attributes.length>0&&L("ul",{"data-testid":`${u}-attributes`,children:a.attributes.map(E=>Ee("li",{"data-field":E.field,children:[Pt(E.field)," ",lt(E.before)," \u2192 ",lt(E.after)]},E.field))}),a.hunks.length>0&&L("ol",{"aria-label":"\u5909\u5316\u306E\u584A","data-testid":`${u}-hunk-index`,children:a.hunks.map(E=>L("li",{children:L("a",{href:`#${H(E.hunk)}`,onClick:()=>F(E.hunk,!0),"data-hunk":E.hunk,children:ka(E)})},E.hunk))})]}),L($e,{variant:"secondary",onClick:()=>_(h==="split"?"unified":"split"),dataAttributes:{"data-preferred":h},testId:`${u}-layout-toggle`,children:h==="split"?"1 \u5217\u3067\u8868\u793A":"\u4E26\u3079\u3066\u8868\u793A"}),Z&&L("p",{"data-testid":`${u}-narrow`,children:Ca}),a===null?re(0,r):a.hunks.map(E=>{let q=R.has(E.hunk);return Ee("div",{id:H(E.hunk),"data-testid":`${u}-hunk-${E.hunk}`,"data-open":q,children:[L($e,{variant:"secondary",expanded:q,controls:`${H(E.hunk)}-body`,onClick:()=>F(E.hunk,!q),ref:Y=>{Y===null?S.current.delete(E.hunk):S.current.set(E.hunk,Y)},testId:`${u}-hunk-${E.hunk}-toggle`,children:ka(E)}),L("div",{id:`${H(E.hunk)}-body`,children:q&&re(E.hunk,`${r} ${ka(E)}`)})]},E.hunk)})]})}import{Fragment as Tr,jsx as Et,jsxs as aa}from"react/jsx-runtime";function _r(e){let t=[e.page===null?null:`p.${e.page}`,e.sheet===null?null:`\u30B7\u30FC\u30C8 ${e.sheet}`,e.slide===null?null:`\u30B9\u30E9\u30A4\u30C9 ${e.slide}`,e.startSec===null?null:`${e.startSec}${e.endSec===null?"":`\u2013${e.endSec}`} \u79D2`].filter(a=>a!==null);return t.length===0?"\u4F4D\u7F6E\u306A\u3057":t.join("\u30FB")}function Kn(e){return e.new??e.old}function Hn(e){return e.kind==="MODIFIED"&&e.old?.fidelity!=="UNVERIFIED"&&e.new?.fidelity!=="UNVERIFIED"}function Bn({states:e,stats:t,entries:a,textUnchangedChunkingChanged:n,readLines:r,rescueTarget:s,onNarrowChange:o,testId:u}){M();let[d,h]=Cr(()=>new Set),_=l=>h(C=>{let $=new Set(C);return $.delete(l)||$.add(l),$}),R=l=>{let C=[l.old===null?null:["\u65E7",l.old],l.new===null?null:["\u65B0",l.new]].filter(m=>m!==null),$=new Set(C.flatMap(([,m])=>m.fidelity==="UNVERIFIED"?[Ja]:m.fidelity==="WHITESPACE_NORMALIZED"?[Ya]:[]));return aa(Tr,{children:[C.map(([m,I])=>aa("span",{"data-fidelity":I.fidelity,"data-side":m,children:[m," ",Xa[I.fidelity]," "]},m)),[...$].map(m=>Et("span",{"data-chunk-note":!0,children:m},m))]})};return aa("div",{"data-testid":u,children:[n&&Et(vt,{tone:"info",testId:`${u}-chunking-only`,children:Qa}),aa("p",{"data-testid":`${u}-stats`,children:["\u8FFD\u52A0 ",t.added,"\u30FB\u524A\u9664 ",t.removed,"\u30FB\u5909\u66F4 ",t.modified,"\u30FB\u79FB\u52D5 ",t.moved,"\u30FB\u5909\u308F\u3089\u306A\u3044 ",t.unchanged]}),Et(Nt,{caption:"\u5909\u308F\u3063\u305F\u30C1\u30E3\u30F3\u30AF",captionHidden:!0,columns:[{key:"kind",header:"\u7A2E\u985E",width:{fixedPx:ut(Object.values(pa))},align:"start",cell:l=>pa[l.kind]},{key:"position",header:"\u4F4D\u7F6E",width:{minPx:Oe},align:"start",cell:l=>_r(Kn(l))},{key:"heading",header:"\u898B\u51FA\u3057",width:{minPx:Oe},align:"start",cell:l=>Kn(l).breadcrumbs},{key:"numbers",header:"\u65E7 # \u2192 \u65B0 #",width:{fixedPx:ct("#00000 \u2192 #00000")},align:"start",cell:l=>`${l.old===null?"(\u306A\u3057)":`#${l.old.index}`} \u2192 ${l.new===null?"(\u306A\u3057)":`#${l.new.index}`}`},{key:"fidelity",header:"\u672C\u6587\u306E\u518D\u73FE",width:{minPx:Oe},align:"start",cell:R},{key:"diff",header:"\u5DEE\u5206",width:{fixedPx:Yt("\u5DEE\u5206\u3092\u9589\u3058\u308B")},align:"start",cell:l=>Hn(l)?Et($e,{variant:"secondary",expanded:d.has(l.entry),controls:`${u}-diff-${l.entry}`,onClick:()=>_(l.entry),testId:`${u}-diff-toggle-${l.entry}`,children:d.has(l.entry)?"\u5DEE\u5206\u3092\u9589\u3058\u308B":"\u5DEE\u5206\u3092\u958B\u304F"}):null}],rows:a,rowKey:l=>`${l.entry}`,rowTestId:`${u}-row`,rowData:l=>({"data-entry":l.entry,"data-kind":l.kind}),rowSize:"row-control",empty:"\u5909\u308F\u3063\u305F\u30C1\u30E3\u30F3\u30AF\u306F\u3042\u308A\u307E\u305B\u3093\u3002",testId:`${u}-table`}),a.filter(l=>Hn(l)&&d.has(l.entry)).map(l=>{let C=`\u30C1\u30E3\u30F3\u30AF #${l.old?.index} \u2192 #${l.new?.index} \u306E\u5DEE\u5206`;return Et("section",{id:`${u}-diff-${l.entry}`,"aria-label":C,"data-testid":`${u}-diff-${l.entry}`,children:Et(ta,{states:e,target:{facet:"chunks",entry:l.entry},index:null,readLines:r,label:C,rescueTarget:s,onNarrowChange:o,testId:`${u}-diff-${l.entry}-view`})},l.entry)})]})}import{Fragment as Wn,jsx as De,jsxs as mt}from"react/jsx-runtime";var Or={fontSize:`${st}px`,fontWeight:Pr.weight.bold},Gn={whiteSpace:"pre-wrap",overflowWrap:"anywhere",margin:0},qn={add:"\u8FFD\u52A0",remove:"\u524A\u9664",replace:"\u7F6E\u63DB"},Fr=ut(Object.values(qt));function Ur(e,t,a){let n=r=>Object.fromEntries(t.map(s=>[s.field,o=>De("span",{"data-testid":`${a}-${s.field}-${r}-${o}`,children:lt(s[r])})]));return De(xn,{caption:`${e}\u306E\u5909\u5316`,attributes:t.map(r=>({key:r.field,label:Pt(r.field)})),columns:[{key:"before",heading:"\u5909\u66F4\u524D",cells:n("before")},{key:"after",heading:"\u5909\u66F4\u5F8C",cells:n("after")}],attributePx:Fr,columnMinPx:Oe,testId:a})}function Mt(e,t,a){return t.length===0?null:mt("div",{"data-testid":a,children:[mt("p",{children:[e," (",t.length,")"]}),De("ul",{children:t.map(([n,r])=>De("li",{children:r},n))})]})}var Vn=e=>[e.key,`${e.key}: ${JSON.stringify(e.value)}`],Kr=e=>[e.key,`${e.key}: ${e.fields.map(t=>`${Pt(t.field)} ${lt(t.before)} \u2192 ${lt(t.after)}`).join("\u3001")}`];function zn({states:e,comparison:t,readLines:a,rescueTarget:n,testId:r}){let{announce:s}=M(),o=Ar(),[u,d]=Mr(()=>new Set),h=$r((m,I)=>d(S=>{if(S.has(m)===I)return S;let P=new Set(S);return I?P.add(m):P.delete(m),P}),[]),_=u.size>0;Dr(()=>{_&&s(Ca)},[_,s]);let R=t.facets.filter(m=>m.change==="CHANGED"),l=Lr.filter(m=>!R.some(I=>I.facet===m)),C=m=>`${o}-${m}`,$=m=>{let I=`${r}-${m.facet}`;switch(m.facet){case"classification":case"metadata":return Ur(dt[m.facet],m.fields,`${I}-grid`);case"labels":case"assets":return mt(Wn,{children:[Mt("\u8FFD\u52A0",m.added.map(Vn),`${I}-added`),Mt("\u524A\u9664",m.removed.map(Vn),`${I}-removed`),Mt("\u5909\u66F4",m.modified.map(Kr),`${I}-modified`)]});case"tags":return mt(Wn,{children:[Mt("\u8FFD\u52A0",m.added.map(S=>[S,S]),`${I}-added`),Mt("\u524A\u9664",m.removed.map(S=>[S,S]),`${I}-removed`)]});case"structured_data":return De(Nt,{caption:"\u69CB\u9020\u5316\u30C7\u30FC\u30BF\u306E\u64CD\u4F5C",captionHidden:!0,columns:[{key:"op",header:"\u64CD\u4F5C",width:{fixedPx:ut(Object.values(qn))},align:"start",cell:({operation:S})=>qn[S.op]},{key:"path",header:"\u9053",width:{minPx:Oe},align:"start",cell:({operation:S})=>S.path===""?"(\u6839)":S.path},{key:"before",header:"\u5909\u66F4\u524D",width:{minPx:Oe},align:"start",cell:({operation:S})=>S.op==="add"?null:De("pre",{style:Gn,children:JSON.stringify(S.previous,null,2)})},{key:"after",header:"\u5909\u66F4\u5F8C",width:{minPx:Oe},align:"start",cell:({operation:S})=>S.op==="remove"?null:De("pre",{style:Gn,children:JSON.stringify(S.value,null,2)})}],rows:m.operations.map((S,P)=>({operation:S,position:P})),rowKey:({position:S})=>`${S}`,rowTestId:`${I}-operation`,rowData:({operation:S})=>({"data-op":S.op}),rowSize:"row",empty:"\u64CD\u4F5C\u306F\u3042\u308A\u307E\u305B\u3093\u3002",testId:`${I}-operations`});case"text":case"summary":return De(ta,{states:e,target:{facet:m.facet},index:m,readLines:a,label:dt[m.facet],rescueTarget:n,onNarrowChange:h,testId:`${I}-diff`});case"chunks":return De(Bn,{states:e,stats:m.stats,entries:m.entries,textUnchangedChunkingChanged:m.textUnchangedChunkingChanged,readLines:a,rescueTarget:n,onNarrowChange:h,testId:`${I}-table`})}};return mt("div",{"data-testid":r,children:[R.length>0&&De("nav",{"aria-label":"\u5909\u308F\u3063\u305F\u9762","data-testid":`${r}-nav`,children:De("ul",{children:R.map(m=>De("li",{children:De("a",{href:`#${C(m.facet)}`,"data-facet":m.facet,children:dt[m.facet]})},m.facet))})}),R.map(m=>mt("section",{id:C(m.facet),"aria-labelledby":`${C(m.facet)}-heading`,"data-testid":`${r}-${m.facet}`,"data-facet":m.facet,children:[De("h4",{id:`${C(m.facet)}-heading`,style:Or,children:dt[m.facet]}),$(m)]},m.facet)),l.length>0&&mt("p",{"data-testid":`${r}-unchanged`,children:["\u5909\u5316\u306A\u3057: ",l.map(m=>dt[m]).join("\u30FB")]})]})}import{PIPELINE_STEPS as Hr,RUN_TERMINAL_STEP_KEY as Xn,RunTerminalStepDetailSchema as Br}from"@aiquants/enrichment-core";import{Fragment as _a,jsx as oe,jsxs as Re}from"react/jsx-runtime";var Gr=8,qr={text_layer:"\u6587\u5B57\u5C64",ocr:"OCR",transcript:"\u8EE2\u5199"},Vr={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"},Yn={duration_ms:"ms",input_chars:void 0,output_chars:void 0,chunk_count:void 0,points_upserted:void 0,graph_nodes:void 0},Wr=["provider","model","engine","prompt_key","prompt_version","duration_ms","input_chars","output_chars","chunk_count","points_upserted","collection","embedding_model","graph_nodes"],zr=["FAILED","RUNNING","SUCCEEDED","SKIPPED"],jr={atomic:"whitespace-nowrap",anywhere:"wrap-anywhere"};function Jn(e){return Object.hasOwn(Yn,e)}function Ot(e,t){return`run-step-provenance-value-${e}-${t}`}function Xr(e,t,a){if(Jn(t)){let r=e[t];return r===null?null:oe(ae,{value:r,unit:Yn[t],testId:Ot(a,t)})}let n=e[t];return n===null?null:oe(At,{text:String(n),testId:Ot(a,t)})}function Yr(e,t){let a=Wr.map(s=>({key:s,label:Vr[s],value:Xr(e,s,t),breaks:Jn(s)?"atomic":"anywhere"})),n=e.pages_read!==null||e.pages_total!==null,r=Re(_a,{children:[oe(ae,{value:e.pages_read,testId:Ot(t,"pages_read")})," / ",oe(ae,{value:e.pages_total,testId:Ot(t,"pages_total")})]});return[...a,{key:"pages",label:"\u8AAD\u3093\u3060\u30DA\u30FC\u30B8",value:n?r:null,breaks:"atomic"},{key:"body_source",label:"\u672C\u6587\u306E\u51FA\u6240",value:e.body_source===null?null:oe(At,{text:qr[e.body_source],testId:Ot(t,"body_source")}),breaks:"anywhere"}]}function Jr(e){let t=[],a=new Map;for(let n of[...e.steps].sort((r,s)=>r.sequence-s.sequence)){let r=n.stepKey;if(r===Xn||Hr[r].fanOut!=="children"||n.targetMetadataId===e.metadataId){t.push({kind:"step",step:n});continue}let s=a.get(r);if(s!==void 0){s.push(n);continue}let o=[n];a.set(r,o),t.push({kind:"fan_out",stepKey:r,steps:o})}return t}function Qr(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 Zr({step:e}){let{labels:t}=M();if(e.status==="SKIPPED")return Re("p",{className:"text-[13px] text-slate-600","data-testid":`run-step-skip-reason-${e.sequence}`,children:["\u7701\u7565: ",kn(Qr(e))]});if(e.stepKey===Xn&&e.status==="SUCCEEDED"){let{outcome:o}=Br.parse(e.provenance?.detail);return oe("p",{className:"text-[13px] text-slate-700","data-testid":`run-step-terminal-outcome-${e.sequence}`,"data-outcome":o,children:Rn[o]})}if(e.provenance===null)return oe("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 a=e.provenance,n=Yr(a,e.sequence),r=n.filter(o=>o.value!==null),s=n.filter(o=>o.value===null);return Re(_a,{children:[r.length>0&&oe("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:r.map(o=>Re("div",{className:"border-slate-100 border-b border-solid py-0.5",children:[oe("dt",{className:"text-slate-500",children:o.label}),oe("dd",{className:`text-slate-800 ${jr[o.breaks]}`,"data-provenance-key":o.key,children:o.value})]},o.key))}),s.length>0&&Re("p",{className:"mt-1 text-[11px] text-slate-500","data-testid":`run-step-unmeasured-${e.sequence}`,"data-unmeasured-note":!0,children:[t.unmeasured,": ",s.map(o=>o.label).join("\u3001")]}),Object.keys(a.detail).length>0&&Re("details",{className:"mt-2 text-[13px]","data-testid":`run-step-detail-${e.sequence}`,children:[oe("summary",{className:"cursor-pointer text-slate-600",children:"\u8A73\u7D30"}),oe("pre",{className:"mt-1 overflow-auto rounded-lg bg-slate-900 p-4 font-mono text-[11px] text-slate-100",children:JSON.stringify(a.detail,null,2)})]})]})}function jn(e,t,a,n){let r=Na[e.status];return oe("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:Re("details",{open:n,className:"group/step","data-testid":`run-step-card-${e.sequence}`,children:[Re("summary",{className:"flex cursor-pointer list-none flex-wrap items-center gap-2 p-4 [&::-webkit-details-marker]:hidden",children:[oe("span",{"aria-hidden":"true",className:"text-[11px] text-slate-500 transition-transform group-open/step:rotate-90",children:"\u25B6"}),oe("span",{className:"font-semibold text-[13px] text-slate-900",children:t}),e.strategyId!==null&&Re("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]}),oe("span",{className:`inline-flex rounded-full px-2 py-0.5 font-semibold text-[11px] ${r.className}`,"data-testid":`run-step-status-${e.sequence}`,"data-status":e.status,children:r.label}),oe("span",{className:"ml-auto text-[11px] text-slate-600","data-testid":`run-step-duration-${e.sequence}`,children:oe(ae,{value:e.durationMs,unit:"ms",testId:`run-step-duration-value-${e.sequence}`})})]}),Re("div",{className:"space-y-2 px-4 pb-4",children:[e.durationMs!==null&&a>0&&oe("div",{className:"h-2 rounded-full bg-slate-100",children:oe("div",{className:`h-2 rounded-full ${r.bar}`,style:{width:`${e.durationMs/a*100}%`},"data-testid":`run-step-bar-${e.sequence}`})}),e.errorMessage!==null&&Re("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})`]}),oe(Zr,{step:e})]})]})},e.id)}function Qn({run:e}){M();let t=e.steps.reduce((n,r)=>r.durationMs===null?n:Math.max(n,r.durationMs),0),a=e.steps.length<=Gr;return oe("ol",{className:"space-y-3","data-testid":"run-steps",children:Jr(e).map(n=>{if(n.kind==="step"){let o=n.step,u=Re(_a,{children:[Ea(o.stepKey),o.targetMetadataId!==e.metadataId&&Re("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-${o.sequence}`,children:["\u5BFE\u8C61 #",o.targetMetadataId]})]});return jn(o,u,t,o.status==="FAILED"||a)}let r=n.steps.some(o=>o.status==="FAILED"),s=zr.map(o=>({status:o,count:n.steps.filter(u=>u.status===o).length})).filter(({count:o})=>o>0);return oe("li",{className:"rounded-lg border border-slate-200 border-solid","data-testid":`run-step-group-${n.stepKey}`,"data-count":n.steps.length,children:Re("details",{open:r||a,className:"group/fanout","data-testid":`run-step-group-card-${n.stepKey}`,children:[Re("summary",{className:"flex cursor-pointer list-none flex-wrap items-center gap-2 p-4 [&::-webkit-details-marker]:hidden",children:[oe("span",{"aria-hidden":"true",className:"text-[11px] text-slate-500 transition-transform group-open/fanout:rotate-90",children:"\u25B6"}),oe("span",{className:"font-semibold text-[13px] text-slate-900",children:Ea(n.stepKey)}),Re("span",{className:"rounded-sm bg-slate-100 px-1.5 py-0.5 text-[11px] text-slate-600","data-testid":`run-step-group-count-${n.stepKey}`,children:["\u5BFE\u8C61 ",n.steps.length," \u4EF6"]}),oe("span",{className:"text-[11px] text-slate-600","data-testid":`run-step-group-statuses-${n.stepKey}`,children:s.map(({status:o,count:u})=>`${Na[o].label} ${u}`).join(" \xB7 ")})]}),oe("ol",{className:"space-y-3 px-4 pb-4",children:n.steps.map(o=>jn(o,Re("span",{"data-testid":`run-step-target-${o.sequence}`,children:["\u5BFE\u8C61 #",o.targetMetadataId]}),t,o.status==="FAILED"||a))})]})},`group-${n.stepKey}`)})})}import{Fragment as Rt,jsx as g,jsxs as j}from"react/jsx-runtime";var no={fontSize:`${$a.type.title.size}px`,fontWeight:$a.weight.bold},so={fontSize:`${st}px`,fontWeight:$a.weight.bold},Pa={RUNNING:"info",SUCCEEDED:"success",FAILED:"danger",FAILED_RETRY_SCHEDULED:"warning"};function Zn({host:e,fromStateId:t,toStateId:a,rescueTarget:n}){let r={fromStateId:t,toStateId:a},s=va(`${t}:${a}`,u=>e.compare(r,u),0),o=We(n);return s.state.kind==="failed"?g(pt,{failure:s.state,onReload:s.reload,forbiddenMessage:at,failureMessage:nt("\u6BD4\u8F03"),rescueRef:o,testId:"history-comparison-failed"}):s.state.kind!=="ready"?g("p",{"aria-busy":"true","data-testid":"history-comparison-loading",children:"\u6BD4\u8F03\u3092\u8AAD\u307F\u8FBC\u3093\u3067\u3044\u307E\u3059\u2026"}):g(zn,{states:r,comparison:s.state.value,readLines:e.readLines,rescueTarget:n,testId:"history-change"})}function La(e,t,a){let n=dn(e,t);return[e.runOutcome==="FAILED"?g("span",{"data-testid":`${a}-failed-run`,"data-state-mark":"failed_run",children:tn},"failed"):null,n.length>0?g("span",{"data-testid":`${a}-unrecorded-runs`,"data-state-mark":"unrecorded_runs",children:nn(n)},"unrecorded"):null,e.modelOnlyChange?g("span",{"data-testid":`${a}-model-only`,"data-state-mark":"model_only",children:an},"model"):null].filter(r=>r!==null)}function ro(e,t){return e.changes===null?null:g("span",{"data-testid":`${t}-badges`,children:e.changes.map(a=>g(Je,{tone:"neutral",variant:"tint",testId:`${t}-badge-${a.facet}`,children:Wt(a)},a.facet))})}function oo({pinned:e,shown:t,onPin:a,onUnpin:n,fallback:r}){let s=ze(null),o=ze(null),u=We(()=>o.current??s.current??r()),d=ao(R=>(l=>{R.current=l;let C=u(l);return()=>{R.current=null,C()}}),[u]),[h]=It(()=>d(s)),[_]=It(()=>d(o));return e!==null?j("p",{"data-testid":"history-pin",children:[g(Je,{tone:"info",variant:"tint",testId:"history-pin-badge",children:"\u6BD4\u8F03\u306E\u8D77\u70B9"})," ",qe(e.revision)," ",g(ge,{iso:e.settledAt,testId:"history-pin-settled-at-value"})," ",g($e,{variant:"secondary",onClick:n,ref:_,testId:"history-unpin",children:"\u5916\u3059"})]}):t===null?null:g("p",{"data-testid":"history-pin",children:g($e,{variant:"secondary",onClick:()=>a(t.stateId),ref:h,testId:"history-pin-button",children:"\u6BD4\u8F03\u306E\u8D77\u70B9\u306B\u3059\u308B"})})}function Fd({host:e,metadataId:t,target:a,openRequest:n,onClose:r,returnFocusFallback:s,captureState:o}){let{labels:u,announce:d}=M(),h=Ta(),_=Ta(),R=Ta(),l=ze(null),C=ze(null),$=ze(null),m=ze(null),I=ze(null),S=ze(null),P=ze(s),O=ze(0),[Q,G]=It(null),[Z,F]=It(null),[H,re]=It({metadataId:t,groups:{}});H.metadataId!==t&&re({metadataId:t,groups:{}});let[E,q]=It(null),Y=va(t,x=>e.loadHistory(t,x),n),fe=We(()=>C.current),Ke=We(()=>C.current),D=Y.state.kind==="ready"?Y.state.refreshFailure:null,we=jt(D),se=Y.state.kind==="ready"&&Y.state.refreshing,de=Y.state.kind==="ready"?Y.state.value:null,U=de===null?null:on(de),ce=Q!==null&&Q.request===n?Q.key:U===null?null:ln(a,U),J=U?.groups.flatMap(x=>x.items).find(x=>x.key===ce),Ce=J===void 0||se?null:`revision:${J.kind==="run"?J.run.revision:J.state.revision}`,Ge=We(()=>ce===null?C.current:$.current);na(()=>{P.current=s},[s]),na(()=>{if(I.current!==n){I.current=n,S.current=null;let x=document.activeElement;l.current?.contains(x)!==!0&&(m.current=(x instanceof HTMLElement||x instanceof SVGElement)&&x!==document.body?x:null),C.current?.focus();return}ce!==null&&ce===S.current&&(S.current=null,$.current?.focus())},[n,ce]),na(()=>{Ce!==null&&re(x=>x.groups[Ce]===!0?x:{metadataId:x.metadataId,groups:{...x.groups,[Ce]:!0}})},[Ce,n]),na(()=>()=>{I.current=null,O.current+=1;let x=m.current;if(x?.isConnected){x.focus();return}P.current()?.focus()},[]);let Pe=x=>{x.key==="Escape"&&(x.stopPropagation(),r())},Ne=x=>{if(x===ce){$.current?.focus();return}S.current=x,G({request:n,key:x})},f=x=>{O.current+=1;let T=O.current,A=E?.metadataId===t?E.failure:null;q({metadataId:t,busy:!0,failure:A}),x(t).then(V=>{if(O.current===T){if(V.ok){q({metadataId:t,busy:!1,failure:null}),d(V.value.outcome==="RECORDED"?"\u8A18\u9332\u3057\u307E\u3057\u305F":"\u524D\u306E\u8A18\u9332\u304B\u3089\u5909\u5316\u306F\u3042\u308A\u307E\u305B\u3093"),Y.refresh();return}q({metadataId:t,busy:!1,failure:{status:V.status,reason:V.reason,occurrence:(A?.occurrence??0)+1}})}})},z=()=>{if(Y.state.kind==="failed")return g(pt,{failure:Y.state,onReload:Y.reload,forbiddenMessage:at,failureMessage:nt("\u6587\u66F8\u306E\u5C65\u6B74"),rescueRef:fe,testId:"history-failed"});if(de===null||U===null)return g("p",{"aria-busy":"true","data-testid":"history-loading",children:"\u6587\u66F8\u306E\u5C65\u6B74\u3092\u8AAD\u307F\u8FBC\u3093\u3067\u3044\u307E\u3059\u2026"});let x=U.states,T=U.runs[0],A=o!==void 0&&T!==void 0&&!x.some(N=>N.runId===T.id),V=E?.metadataId===t?E:null,p=x[0];return j("div",{ref:Ke,"data-testid":"history-content",children:[j("dl",{"data-testid":"history-document",children:[j("div",{children:[g("dt",{children:"URI"}),g("dd",{style:{overflowWrap:"anywhere"},"data-testid":"history-document-uri",children:de.document.fileUri})]}),j("div",{children:[g("dt",{children:"\u73FE\u5728\u306E\u7248"}),g("dd",{"data-testid":"history-document-revision",children:qe(de.document.revision)})]}),j("div",{children:[g("dt",{children:"\u6A5F\u5BC6\u533A\u5206"}),g("dd",{"data-testid":"history-document-confidentiality",children:de.document.confidentialityLevel})]}),j("div",{children:[g("dt",{children:"\u7248\u306E\u6570"}),g("dd",{"data-testid":"history-document-revisions",children:U.groups.length})]}),j("div",{children:[g("dt",{children:"\u6700\u5F8C\u306E\u5909\u5316"}),g("dd",{"data-testid":"history-document-last-change",children:p===void 0?"\u8A18\u9332\u306A\u3057":g(ge,{iso:p.settledAt,testId:"history-document-last-change-value"})})]})]}),D!==null&&g($t,{occurrence:we,testId:"history-refresh-failed",children:zt(u,D,"\u6587\u66F8\u306E\u5C65\u6B74")}),A&&g("p",{"data-testid":"history-capture",children:g($e,{variant:"primary",busy:V?.busy===!0,busyLabel:u.loading,onClick:()=>f(o),ref:Ge,testId:"history-capture-button",children:"\u4ECA\u306E\u72B6\u614B\u3092\u8A18\u9332"})}),V!==null&&V.failure!==null&&g($t,{occurrence:V.failure.occurrence,testId:"history-capture-failed",children:u.failureSentence(V.failure,"\u6587\u66F8\u306E\u72B6\u614B\u3092\u8A18\u9332\u3059\u308B\u6A29\u9650\u304C\u3042\u308A\u307E\u305B\u3093\u3002",N=>`\u6587\u66F8\u306E\u72B6\u614B\u3092\u8A18\u9332\u3067\u304D\u307E\u305B\u3093\u3067\u3057\u305F${eo(N)}\u3002`)}),x.length===0&&U.runs.length===0&&U.marks.length===0?g("p",{role:"status","data-testid":"history-empty",children:"\u3053\u306E\u6587\u66F8\u306B\u306F\u307E\u3060\u8A18\u9332\u304C\u3042\u308A\u307E\u305B\u3093\u3002"}):g(yn,{master:Ze(U),detail:Me(U),masterMinPx:un,detailMinPx:pn,testId:"history-master-detail"})]})},he=H.groups,le=(x,T)=>he[x]??T,pe=(x,T)=>re({metadataId:t,groups:{...he,[x]:!le(x,T)}}),Se=Z!==null&&Z.request===n?Z.stateId:null,Ze=x=>j("div",{"data-testid":"history-timeline",children:[x.marks.length>0&&j("div",{"data-testid":"history-restricted-group",children:[j($e,{variant:"secondary",expanded:le("restricted",!1),controls:`${_}-restricted`,onClick:()=>pe("restricted",!1),testId:"history-restricted-toggle",children:["\u9694\u96E2\u3055\u308C\u3066\u3044\u305F\u671F\u9593\u306E\u8A18\u9332 (",x.marks.length," \u4EF6)"]}),g("ul",{role:"list",id:`${_}-restricted`,hidden:!le("restricted",!1),"aria-label":"\u9694\u96E2\u3055\u308C\u3066\u3044\u305F\u671F\u9593\u306E\u8A18\u9332",children:x.marks.map(({key:T,mark:A})=>g("li",{"data-restricted-mark":A.subject,"data-testid":"history-restricted-mark",children:A.subject==="state"?j(Rt,{children:[g("span",{children:Za})," ",g(ge,{iso:A.settledAt,testId:`history-${T}-settled-at-value`})]}):j(Rt,{children:[g("span",{children:Vt})," ",g(Je,{tone:Pa[A.status],variant:"tint",testId:`history-${T}-status`,children:Qe[A.status].label})," ",g(ge,{iso:A.startedAt,testId:`history-${T}-started-at-value`})," \u301C ",g(St,{iso:A.finishedAt,testId:`history-${T}-finished-at-value`})]})},T))})]}),x.groups.map(T=>{let A=`revision:${T.revision}`,V=le(A,T.isCurrent),p=`${qe(T.revision)}${T.isCurrent?" (\u73FE\u5728\u306E\u7248)":""}`;return j("div",{"data-testid":"history-revision-group","data-revision":T.revision,"data-current":T.isCurrent,children:[g($e,{variant:"secondary",expanded:V,controls:`${_}-${A}`,onClick:()=>pe(A,T.isCurrent),testId:`history-revision-toggle-${T.revision}`,children:`${p} \u2014 ${T.items.length} \u4EF6`}),g("div",{id:`${_}-${A}`,hidden:!V,children:g(Nn,{label:p,items:T.items,itemKey:N=>N.key,selectedKey:ce,onSelect:N=>Ne(N.key),detailId:_,renderRow:N=>Ve(N,x),rowTestId:"history-item",rowData:N=>({"data-item-key":N.key,"data-pinned":N.state!==null&&N.state.stateId===Se}),empty:"\u3053\u306E\u7248\u306E\u8A18\u9332\u306F\u3042\u308A\u307E\u305B\u3093\u3002",testId:`history-revision-list-${T.revision}`})})]},A)})]}),Ve=(x,T)=>{let A=x.state,V=`history-row-${x.key}`,p=A===null?[]:La(A,T,V);return j(Rt,{children:[x.kind==="run"?j("span",{children:["\u5B9F\u884C #",x.run.id," \xB7 ",Sa[x.run.trigger]," ",g(Je,{tone:Pa[rt(x.run)],variant:"tint",testId:`${V}-status`,children:Qe[rt(x.run)].label})]}):g("span",{children:xt[x.state.cause]}),g("span",{children:g(ge,{iso:x.time,testId:`${V}-time-value`})}),A!==null&&ro(A,V),x.kind==="run"&&ga(x.run)&&g("span",{"data-testid":`${V}-unrecorded`,children:ma}),p,A!==null&&A.stateId===Se&&g(Je,{tone:"info",variant:"tint",testId:`${V}-pinned`,children:"\u6BD4\u8F03\u306E\u8D77\u70B9"})]})},Ae=(x,T)=>{let A=T.states.find(v=>v.stateId===Se)??null,V=g(oo,{pinned:A,shown:x,onPin:v=>F({request:n,stateId:v}),onUnpin:()=>F(null),fallback:()=>$.current});if(x===null)return V;let p=()=>$.current,N;if(A!==null&&A.stateId!==x.stateId){let[v,be]=T.states.indexOf(A)>T.states.indexOf(x)?[A,x]:[x,A];N=g(Zn,{host:e,fromStateId:v.stateId,toStateId:be.stateId,rescueTarget:p})}else x.previousStateId===null?N=g("p",{"data-testid":"history-no-previous",children:en}):N=g(Zn,{host:e,fromStateId:x.previousStateId,toStateId:x.stateId,rescueTarget:p});return j(Rt,{children:[V,N]})},te=x=>{if(J===void 0)return"\u8A18\u9332\u306E\u8A73\u7D30";let T=J.state,A=x.states.find(V=>V.stateId===Se);if(A!==void 0&&T!==null&&A.stateId!==T.stateId){let[V,p]=x.states.indexOf(A)>x.states.indexOf(T)?[A,T]:[T,A];return`\u6BD4\u8F03: ${qe(V.revision)} \u2192 ${qe(p.revision)}`}return J.kind==="run"?`${qe(J.run.revision)} \u306E\u5B9F\u884C #${J.run.id}`:`${qe(J.state.revision)} \u306E\u5909\u5316`},Ye=x=>{if(ce===null)return x.groups.some(p=>p.items.length>0)?g("p",{"data-testid":"history-select-prompt",children:"\u6642\u7CFB\u5217\u304B\u3089\u8A18\u9332\u3092\u9078\u3076\u3068\u3001\u305D\u306E\u5909\u5316\u3092\u793A\u3057\u307E\u3059\u3002"}):g("p",{role:"status","data-testid":"history-no-selectable",children:"\u9078\u3079\u308B\u8A18\u9332\u306F\u3042\u308A\u307E\u305B\u3093\u3002"});if(J===void 0&&se)return g("p",{"aria-busy":"true","data-testid":"history-detail-loading",children:"\u6587\u66F8\u306E\u5C65\u6B74\u3092\u8AAD\u307F\u8FBC\u3093\u3067\u3044\u307E\u3059\u2026"});if(J===void 0)return j("p",{role:"status","data-testid":"history-selection-missing",children:[ce.startsWith("run:")?`\u5B9F\u884C #${ce.slice(4)} \u306F`:"\u9078\u3093\u3060\u72B6\u614B\u306F","\u3053\u306E\u6587\u66F8\u306E\u5C65\u6B74\u306B\u3042\u308A\u307E\u305B\u3093\u3002"]});if(J.kind==="state"){let{state:p}=J;return j(Rt,{children:[j("dl",{"data-testid":"history-state-summary",children:[j("div",{children:[g("dt",{children:"\u5951\u6A5F"}),g("dd",{"data-testid":"history-state-cause",children:xt[p.cause]})]}),j("div",{children:[g("dt",{children:"\u6642\u523B"}),g("dd",{children:g(ge,{iso:p.settledAt,testId:"history-state-settled-at-value"})})]}),j("div",{children:[g("dt",{children:"\u64CD\u4F5C\u8005"}),g("dd",{style:{overflowWrap:"anywhere"},"data-testid":"history-state-actor",children:p.actor})]}),j("div",{children:[g("dt",{children:"\u6A5F\u5BC6\u533A\u5206"}),g("dd",{"data-testid":"history-state-confidentiality",children:p.classification.confidentialityLevel})]})]}),La(p,x,"history-detail"),Ae(p,x)]})}let{run:T,state:A}=J,V=rt(T);return j(Rt,{children:[j("dl",{"data-testid":"history-run-summary","data-run-id":T.id,children:[j("div",{children:[g("dt",{children:"\u304D\u3063\u304B\u3051"}),g("dd",{"data-testid":"history-run-trigger","data-trigger":T.trigger,children:Sa[T.trigger]})]}),j("div",{children:[g("dt",{children:"\u8A66\u884C"}),g("dd",{"data-testid":"history-run-attempt",children:T.attempt})]}),j("div",{children:[g("dt",{children:"\u72B6\u614B"}),g("dd",{children:g(Je,{tone:Pa[V],variant:"tint",testId:"history-run-status",dataAttributes:{"data-status":T.status,"data-presentation":V},children:Qe[V].label})})]}),j("div",{children:[g("dt",{children:"\u7A2E\u985E"}),g("dd",{"data-testid":"history-run-kind",children:to[T.documentKind]})]}),j("div",{children:[g("dt",{children:"\u8981\u6C42\u8005"}),g("dd",{style:{overflowWrap:"anywhere"},"data-testid":"history-run-requested-by",children:T.requestedBy})]}),j("div",{children:[g("dt",{children:"\u958B\u59CB"}),g("dd",{children:g(ge,{iso:T.startedAt,testId:"history-run-started-at-value"})})]}),j("div",{children:[g("dt",{children:"\u7D42\u4E86"}),g("dd",{"data-testid":"history-run-finished-at",children:g(St,{iso:T.finishedAt,testId:"history-run-finished-at-value"})})]}),j("div",{children:[g("dt",{children:"\u30B8\u30E7\u30D6"}),g("dd",{style:{overflowWrap:"anywhere"},"data-testid":"history-run-job-id",children:T.jobId})]})]}),T.errorMessage!==null&&g("p",{style:{overflowWrap:"anywhere"},"data-testid":"history-run-error",children:T.errorMessage}),ga(T)&&g("p",{"data-testid":"history-run-unrecorded",children:ma}),A===null?g("p",{"data-testid":"history-run-no-state",children:"\u3053\u306E\u5B9F\u884C\u304C\u4F5C\u3063\u305F\u72B6\u614B\u306F\u3042\u308A\u307E\u305B\u3093\u3002"}):La(A,x,"history-detail"),Ae(A,x),j("details",{"data-testid":"history-run-steps",children:[g("summary",{children:"\u6BB5\u306E\u6642\u7CFB\u5217"}),g(Qn,{run:T})]})]})},Me=x=>j("section",{id:_,"aria-labelledby":R,"data-testid":"history-detail","data-selected-key":ce??"",children:[g("h3",{ref:$,id:R,tabIndex:-1,style:so,"data-testid":"history-detail-heading",children:te(x)}),Ye(x)]});return j("section",{ref:l,role:"dialog","aria-labelledby":h,onKeyDown:Pe,"data-testid":"history-inspector","data-metadata-id":t,"data-cui-surface":"surface","data-cui-fg":"fg","data-cui-type":"body","data-cui-face":"sans",children:[j("div",{children:[g("h2",{ref:C,id:h,tabIndex:-1,style:no,"data-testid":"history-heading",children:de===null?"\u6587\u66F8\u306E\u5C65\u6B74":`\u6587\u66F8\u306E\u5C65\u6B74 \u2014 ${de.document.fileName}`}),g($e,{variant:"secondary",onClick:r,testId:"history-close",children:u.close})]}),z()]})}import{ConfidentialityLevelSchema as co,EnrichmentSyncStatusSchema as rs,PIPELINE_STEPS as uo,QUARANTINED_CONFIDENTIALITY_LEVEL as as}from"@aiquants/enrichment-core";import{useId as ot,useMemo as ns,useState as Be}from"react";import{formatCount as io}from"@aiquants/console-ui/core";function ft(e,t,a){try{io(e,a)}catch(n){throw new RangeError(`${t}: ${n.message}`,{cause:n})}return e}var ts=1024,lo=[{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 es(e,t){return Number((e/ts**t.power).toFixed(t.fractionDigits))}function sa(e,t,a){ft(e,t,a);let[n,...r]=lo,s=n,o=es(e,s);for(let u of r){if(o<ts)break;s=u,o=es(e,s)}return`${new Intl.NumberFormat(a,{minimumFractionDigits:s.fractionDigits,maximumFractionDigits:s.fractionDigits,useGrouping:!0}).format(o)} ${s.name}`}import{Fragment as xo,jsx as c,jsxs as k}from"react/jsx-runtime";var po="\u53D6\u308A\u8FBC\u307F\u306E\u8A18\u9332\u306A\u3057",mo=new Set(rs.options.filter(e=>e.startsWith("FAILED"))),fo=new Set(rs.options);function go(e){return e.isCurrent===!1?{kind:"blocked",reason:"\u65E7\u7248\u306E\u305F\u3081\u518D\u5B9F\u884C\u4E0D\u53EF"}:e.syncStatus==="SYNCED"?{kind:"resync"}:mo.has(e.syncStatus)?{kind:"retry"}:fo.has(e.syncStatus)?{kind:"blocked",reason:"\u51E6\u7406\u4E2D"}:{kind:"blocked",reason:"\u4E0D\u660E\u306A\u72B6\u614B"}}function ss(e,t,a){let n=e?.find(r=>r.confidentialityLevel===t&&r.capability===a);return n?n.isEnabled:null}var bo={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"},yo=["\u5951\u7D04\u66F8","\u6C7A\u7B97\u77ED\u4FE1","\u6280\u8853\u4ED5\u69D8\u66F8","\u793E\u5185\u898F\u7A0B","\u8B70\u4E8B\u9332","\u4EBA\u4E8B\u65B9\u91DD"];function Da({field:e}){return c("span",{className:"text-red-700","data-testid":`ingest-required-mark-${e}`,children:"*"})}function Zd({policies:e,tenantId:t,domainOptions:a,recentItems:n=[],inspectionResult:r=null,isSubmitting:s=!1,isInspecting:o=!1,onInspectUri:u,onIngestDocument:d,onRetryItem:h,onShowHistory:_,listRefusal:R}){let{formatLocale:l}=M(),C=ot(),$=ot(),m=ot(),I=ot(),S=ot(),P=ot(),O=ot(),Q=ot(),[G,Z]=Be("gdrive://"),[F,H]=Be(""),[re,E]=Be(""),[q,Y]=Be("CONFIDENTIAL"),[fe,Ke]=Be(null),[D,we]=Be(""),[se,de]=Be(""),[U,ce]=Be([]),[J,Ce]=Be(""),[Ge,Pe]=Be("user"),[Ne,f]=Be(1),[z,he]=Be(!1),le=fe!==null&&a.some(p=>p.key===fe)?fe:a.length>0?a[0].key:null,pe=ns(()=>({vectorEnabled:ss(e,q,"vector_indexing"),graphEnabled:ss(e,q,"graph_indexing")}),[e,q]),Se=ns(()=>{let p=re.trim();if(!p)return{valid:!1,error:null};if(!(p.startsWith("file://")||p.startsWith("gdrive://")||p.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 v=p.replace(/^(file|gdrive|gcs):\/\//,"");return!v.trim()||v.trim()==="<id>"||v.trim()==="<bucket>/<key>"?{valid:!1,error:"URI \u306E\u30D1\u30B9\u90E8\u5206\u304C\u6307\u5B9A\u3055\u308C\u3066\u3044\u307E\u305B\u3093\u3002"}:p.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}},[re]),Ze=p=>{let N=p.trim(),v=N.match(/\/file\/d\/([a-zA-Z0-9_-]+)/);if(v)return v[1];let be=N.match(/[?&]id=([a-zA-Z0-9_-]+)/);return be?be[1]:null},Ve=p=>{if(Z(p),F.trim()){let N=F.trim().replace(/^(file|gdrive|gcs):\/\//,"");E(`${p}${N}`)}else E("")},Ae=p=>{let N=p.trim();if(!N){H(""),E("");return}let v=Ze(N);if(v){Z("gdrive://"),H(v),E(`gdrive://${v}`);return}if(N.startsWith("gdrive://")){Z("gdrive://");let be=N.replace(/^gdrive:\/\//,"");H(be),E(N);return}if(N.startsWith("file://")){Z("file://");let be=N.replace(/^file:\/\//,"");H(be),E(N);return}if(N.startsWith("gcs://")){Z("gcs://");let be=N.replace(/^gcs:\/\//,"");H(be),E(N);return}if(N.includes("://")){H(p),E(N);return}H(p),E(`${G}${N}`)},te=p=>{switch(p){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)"}},Ye=()=>{let p=J.trim();p&&(U.some(N=>N.labelKey===p)||(ce(N=>[...N,{labelKey:p,category:Ge,confidenceScore:Number(Ne.toFixed(2))}]),Ce("")))},Me=p=>{U.some(N=>N.labelKey===p)||ce(N=>[...N,{labelKey:p,category:"domain",confidenceScore:1}])},x=p=>{ce(N=>N.filter(v=>v.labelKey!==p))},T=p=>{if(p.preventDefault(),!Se.valid||le===null)return;let N={fileUri:re.trim(),confidentialityLevel:q,targetDomainKey:le,departmentId:D.trim()?Number(D):null,titleOverride:se.trim()?se.trim():null,labels:U};d?.(N)},A=p=>{let N=go(p);if(N.kind==="blocked")return c("span",{className:"font-sans text-[11px] text-slate-500","data-testid":`ingest-action-blocked-${p.id}`,"data-reason":N.reason,children:N.reason});let v=N.kind==="retry";return c("button",{type:"button",onClick:()=>h?.(p.id),"aria-label":`${p.fileName} \u3092${v?"\u518D\u8A66\u884C":"\u518D\u540C\u671F"}`,className:v?"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-${N.kind}-button-${p.id}`,children:v?"\u518D\u8A66\u884C":"\u518D\u540C\u671F"})},V=p=>{switch(p){case"SYNCED":return c("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 c("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 c("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 c("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 c("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 p.startsWith("FAILED")?k("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: ",p]}):c("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:p})}};return k("div",{className:"space-y-6","data-testid":"document-ingest-console",children:[k("div",{className:"rounded-xl border border-slate-200 border-solid bg-white p-6 shadow-sm",children:[k("div",{className:"flex flex-col justify-between gap-2 md:flex-row md:items-center",children:[k("div",{children:[c("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"}),c("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"})]}),k("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: ",c("span",{className:"ml-1.5 font-bold text-slate-800",children:t})]})]}),k("form",{onSubmit:T,className:"mt-6 space-y-6",children:[k("div",{className:"space-y-3","data-testid":"document-uri-input-group",children:[k("div",{className:"flex flex-wrap items-center justify-between gap-2",children:[k("label",{htmlFor:C,className:"block font-semibold text-slate-800 text-sm",children:["\u30D5\u30A1\u30A4\u30EB URI / \u30EA\u30BD\u30FC\u30B9\u8B58\u5225\u5B50 ",c(Da,{field:"uri"})]}),k("span",{className:"font-mono text-slate-500 text-xs",children:["\u9078\u629E\u30B9\u30AD\u30FC\u30E0: ",c("strong",{className:"font-semibold text-indigo-600",children:G})]})]}),k("div",{className:"flex flex-wrap items-center gap-2",children:[c("span",{className:"font-medium text-slate-500 text-xs",children:"\u30B9\u30AD\u30FC\u30E0\u6307\u5B9A:"}),c("button",{type:"button",onClick:()=>Ve("gdrive://"),className:`rounded-sm border border-solid px-2.5 py-1 font-mono text-xs transition-colors ${G==="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)"}),c("button",{type:"button",onClick:()=>Ve("file://"),className:`rounded-sm border border-solid px-2.5 py-1 font-mono text-xs transition-colors ${G==="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)"}),c("button",{type:"button",onClick:()=>Ve("gcs://"),className:`rounded-sm border border-solid px-2.5 py-1 font-mono text-xs transition-colors ${G==="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)"})]}),k("div",{className:"space-y-1.5",children:[k("div",{className:"flex flex-wrap gap-2 sm:flex-nowrap",children:[k("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 ${Se.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:[c("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:G}),c("input",{id:C,type:"text",value:F,onChange:p=>Ae(p.target.value),placeholder:te(G),"aria-invalid":!!Se.error,"aria-describedby":Se.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})]}),c("button",{type:"button",onClick:()=>u?.(re.trim()),disabled:!Se.valid||o,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:o?"\u691C\u8A3C\u4E2D...":"URI \u4E8B\u524D\u691C\u8A3C"})]}),k("div",{className:"flex flex-wrap items-center justify-between gap-1 text-xs",children:[k("p",{className:"text-slate-500",children:[G==="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",G==="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",G==="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"]}),re&&k("div",{className:"flex items-center gap-1 font-mono text-slate-500",children:[c("span",{children:"\u89E3\u6C7A URI:"}),c("code",{className:"rounded-sm bg-slate-100 px-1.5 py-0.5 font-bold text-indigo-700","data-testid":"resolved-uri-code",children:re})]})]})]}),Se.error&&c("p",{id:"ingest-uri-error",className:"text-red-600 text-xs",role:"alert","data-testid":"ingest-uri-error",children:Se.error})]}),r&&r.fileUri===re.trim()&&k("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 ${r.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:[k("div",{className:"flex items-center justify-between",children:[c("span",{className:"font-semibold",children:r.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)"}),c("span",{className:"font-mono text-slate-500 text-xs",children:r.fileUri})]}),r.exists&&k("div",{className:"mt-2 grid grid-cols-2 gap-4 font-mono text-xs md:grid-cols-4",children:[k("div",{children:[c("span",{className:"block text-slate-500",children:"\u30D5\u30A1\u30A4\u30EB\u540D:"}),c("span",{className:"font-semibold text-slate-800",children:r.fileName})]}),k("div",{children:[c("span",{className:"block text-slate-500",children:"\u30B5\u30A4\u30BA:"}),c("span",{className:"font-semibold text-slate-800",children:c(Fe,{text:sa(r.fileSize,"fileSize",l),testId:"inspection-file-size-value"})})]}),k("div",{children:[c("span",{className:"block text-slate-500",children:"MIME:"}),c("span",{className:"font-semibold text-slate-800",children:r.mimeType})]}),k("div",{children:[c("span",{className:"block text-slate-500",children:"\u30EA\u30D3\u30B8\u30E7\u30F3:"}),c("span",{className:"font-semibold text-slate-800",children:r.revisionId?.slice(0,8)??"N/A"})]})]})]}),k("div",{className:"grid grid-cols-1 gap-4 md:grid-cols-3",children:[k("div",{className:"space-y-1",children:[k("label",{htmlFor:$,className:"block font-semibold text-slate-700 text-xs",children:["\u6A5F\u5BC6\u533A\u5206 (Confidentiality Level) ",c(Da,{field:"confidentiality"})]}),c("select",{id:$,value:q,onChange:p=>Y(p.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:co.options.map(p=>k("option",{value:p,children:[p," (",bo[p],")"]},p))})]}),k("div",{className:"space-y-1",children:[k("label",{htmlFor:m,className:"block font-semibold text-slate-700 text-xs",children:["\u5BFE\u8C61\u30C9\u30E1\u30A4\u30F3 (Target Domain) ",c(Da,{field:"domain"})]}),c("select",{id:m,value:le===null?"":le,onChange:p=>Ke(p.target.value),disabled:a.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:a.map(p=>c("option",{value:p.key,children:p.label},p.key))}),a.length===0&&c("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"})]})]}),q===as&&k("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:[c("span",{className:"font-bold",children:"\u3010\u9694\u96E2\u6CE8\u610F\u3011"})," ",as," \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",c("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"})]}),k("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:[c("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)"}),k("div",{className:"grid grid-cols-1 gap-3 sm:grid-cols-2",children:[k("div",{className:"rounded-sm border border-indigo-200/80 border-solid bg-white p-2.5",children:[c("span",{className:"block font-semibold text-slate-600 text-xs",children:"\u30D9\u30AF\u30C8\u30EB\u7D22\u5F15 (Qdrant)"}),c("span",{className:"mt-1 block font-bold text-xs","data-testid":"projection-vector-state","data-state":pe.vectorEnabled===null?"unknown":String(pe.vectorEnabled),children:pe.vectorEnabled===null?"\u8A2D\u5B9A\u304C\u6E21\u3055\u308C\u3066\u3044\u306A\u3044\u305F\u3081\u4E0D\u660E":pe.vectorEnabled?"\u6709\u52B9":`\u7121\u52B9 (${q} \u306E\u8A2D\u5B9A)`})]}),k("div",{className:"rounded-sm border border-indigo-200/80 border-solid bg-white p-2.5",children:[c("span",{className:"block font-semibold text-slate-600 text-xs",children:"\u30B0\u30E9\u30D5\u7D22\u5F15 (Neo4j)"}),c("span",{className:"mt-1 block font-bold text-xs","data-testid":"projection-graph-state","data-state":pe.graphEnabled===null?"unknown":String(pe.graphEnabled),children:pe.graphEnabled===null?"\u8A2D\u5B9A\u304C\u6E21\u3055\u308C\u3066\u3044\u306A\u3044\u305F\u3081\u4E0D\u660E":pe.graphEnabled?"\u6709\u52B9":`\u7121\u52B9 (${q} \u306E\u8A2D\u5B9A)`})]})]}),k("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 (",c("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"]})]}),k("div",{className:"space-y-3 rounded-lg border border-slate-200 border-solid bg-slate-50/50 p-4",children:[k("div",{className:"flex items-center justify-between",children:[c("span",{className:"font-semibold text-slate-800 text-xs",children:"\u4ED8\u52A0\u60C5\u5831 / \u30E9\u30D9\u30EB\u30BF\u30B0 (Labels & Tags)"}),k("span",{className:"text-slate-500 text-xs",children:[U.length," \u4EF6\u8A2D\u5B9A\u4E2D"]})]}),k("div",{className:"flex flex-wrap items-center gap-1.5",children:[c("span",{className:"text-slate-500 text-xs",children:"\u30AF\u30A4\u30C3\u30AF\u5019\u88DC:"}),yo.map(p=>k("button",{type:"button",onClick:()=>Me(p),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-${p}`,children:["+ ",p]},p))]}),k("div",{className:"grid grid-cols-1 items-end gap-2 sm:grid-cols-5",children:[k("div",{className:"space-y-1 sm:col-span-2",children:[c("label",{htmlFor:P,className:"block text-slate-600 text-xs",children:"\u30E9\u30D9\u30EB\u540D / \u30AD\u30FC"}),c("input",{id:P,type:"text",value:J,onChange:p=>Ce(p.target.value),onKeyDown:p=>{p.key==="Enter"&&(p.preventDefault(),Ye())},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"})]}),k("div",{className:"space-y-1",children:[c("label",{htmlFor:O,className:"block text-slate-600 text-xs",children:"\u7A2E\u5225"}),k("select",{id:O,value:Ge,onChange:p=>Pe(p.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:[c("option",{value:"user",children:"\u30E6\u30FC\u30B6\u30FC (user)"}),c("option",{value:"domain",children:"\u30C9\u30E1\u30A4\u30F3 (domain)"}),c("option",{value:"system",children:"\u30B7\u30B9\u30C6\u30E0 (system)"})]})]}),k("div",{className:"space-y-1",children:[k("label",{htmlFor:Q,className:"block text-slate-600 text-xs",children:["\u78BA\u4FE1\u5EA6 (",Ne.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)"]}),c("input",{id:Q,type:"range",min:"0.0",max:"1.0",step:"0.05",value:Ne,"aria-valuenow":Ne,"aria-valuemin":0,"aria-valuemax":1,"aria-valuetext":`${Math.round(Ne*100)}%`,onChange:p=>f(Number.parseFloat(p.target.value)),className:"h-2 w-full cursor-pointer appearance-none rounded-lg bg-slate-200","data-testid":"ingest-label-confidence-slider"})]}),c("div",{children:c("button",{type:"button",onClick:Ye,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"})})]}),U.length>0&&c("div",{className:"flex flex-wrap gap-2 pt-2","data-testid":"active-labels-container",children:U.map(p=>k("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-${p.labelKey}`,children:[c("span",{className:"font-semibold",children:p.labelKey}),k("span",{className:"text-indigo-400",children:["(",p.category,")"]}),c("button",{type:"button",onClick:()=>x(p.labelKey),"aria-label":`\u30E9\u30D9\u30EB ${p.labelKey} \u3092\u524A\u9664`,className:"ml-1 font-bold text-indigo-400 hover:text-indigo-900","data-testid":`remove-label-${p.labelKey}`,children:"\xD7"})]},p.labelKey))})]}),k("div",{className:"space-y-3",children:[c("button",{id:"advanced-settings-toggle",type:"button","aria-expanded":z,"aria-controls":"advanced-settings-panel",onClick:()=>he(p=>!p),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:k("span",{children:[z?"\u25BC":"\u25B6"," \u30E1\u30BF\u30C7\u30FC\u30BF\u8A73\u7D30\u30AA\u30FC\u30D0\u30FC\u30E9\u30A4\u30C9 (\u9AD8\u5EA6\u306A\u8A2D\u5B9A)"]})}),z&&k("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:[c("div",{className:"grid grid-cols-1 gap-4 md:grid-cols-2",children:k("div",{className:"space-y-1",children:[c("label",{htmlFor:S,className:"block font-medium text-slate-700 text-xs",children:"\u6587\u66F8\u30BF\u30A4\u30C8\u30EB (\u4E0A\u66F8\u304D\u6307\u5B9A)"}),c("input",{id:S,type:"text",value:se,onChange:p=>de(p.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"})]})}),c("div",{className:"grid grid-cols-1 gap-4 md:grid-cols-2",children:k("div",{className:"space-y-1",children:[c("label",{htmlFor:I,className:"block font-medium text-slate-700 text-xs",children:"\u6240\u7BA1\u90E8\u9580 ID (\u4EFB\u610F)"}),c("input",{id:I,type:"number",value:D,onChange:p=>we(p.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"})]})})]})]}),c("div",{className:"flex justify-end pt-2",children:c("button",{type:"submit",disabled:!Se.valid||le===null||s||o,"aria-busy":s,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:s?k(xo,{children:[c("span",{className:"h-4 w-4 animate-spin rounded-full border-2 border-white border-t-transparent border-solid"}),c("span",{children:"\u53D6\u308A\u8FBC\u307F\u6295\u5165\u4E2D..."})]}):c("span",{children:"\u30E1\u30BF\u30C7\u30FC\u30BF\u751F\u6210 & \u53D6\u308A\u8FBC\u307F\u5B9F\u884C"})})})]})]}),k("div",{className:"space-y-4 rounded-xl border border-slate-200 border-solid bg-white p-6 shadow-sm",children:[c("div",{className:"flex items-center justify-between",children:k("div",{children:[c("h3",{className:"font-bold text-base text-slate-900",children:"\u6700\u8FD1\u306E\u53D6\u308A\u8FBC\u307F\u30AD\u30E5\u30FC & \u5B9F\u884C\u72B6\u614B"}),c("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"})]})}),R!==void 0?c(vt,{tone:"warning",testId:"recent-items-refused",children:R}):n.length===0?c("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"}):c("div",{className:"overflow-x-auto","data-testid":"recent-items-scroll",children:k("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:[c("thead",{className:"bg-slate-50 font-semibold text-slate-700",children:k("tr",{children:[c("th",{scope:"col",className:"px-3 py-2.5",children:"ID"}),c("th",{scope:"col",className:"px-3 py-2.5",children:"\u30D5\u30A1\u30A4\u30EB\u540D / URI"}),c("th",{scope:"col",className:"px-3 py-2.5",children:"\u6A5F\u5BC6\u533A\u5206"}),c("th",{scope:"col",className:"px-3 py-2.5",children:"\u30EA\u30D3\u30B8\u30E7\u30F3"}),c("th",{scope:"col",className:"px-3 py-2.5",children:"\u540C\u671F\u30B9\u30C6\u30FC\u30BF\u30B9"}),c("th",{scope:"col",className:"px-3 py-2.5",children:"\u6700\u7D42\u5B9F\u884C"}),c("th",{scope:"col",className:"px-3 py-2.5",children:"\u767B\u9332\u65E5\u6642"}),c("th",{scope:"col",className:"px-3 py-2.5 text-right",children:"\u30A2\u30AF\u30B7\u30E7\u30F3"})]})}),c("tbody",{className:"divide-y divide-solid divide-slate-100 font-mono text-slate-800",children:n.map((p,N)=>{if(p.kind==="restricted")return k("tr",{"data-testid":`recent-item-restricted-${N}`,"data-restricted-mark":"ingest",children:[c("td",{className:"px-3 py-2"}),c("td",{className:"px-3 py-2 font-sans text-[11px] text-slate-600","data-testid":`recent-item-restricted-text-${N}`,children:ht}),c("td",{className:"px-3 py-2"}),c("td",{className:"px-3 py-2"}),c("td",{className:"px-3 py-2 font-sans","data-testid":`recent-item-restricted-status-${N}`,children:p.syncStatus===null?c("span",{className:"text-[11px] text-slate-600","data-sync-status":"none",children:po}):V(p.syncStatus)}),c("td",{className:"px-3 py-2"}),c("td",{className:"px-3 py-2 font-sans text-[11px] text-slate-500","data-testid":`recent-item-restricted-created-at-${N}`,children:c(ge,{iso:p.createdAt,testId:`recent-item-restricted-created-at-value-${N}`})}),c("td",{className:"px-3 py-2"})]},`restricted:${N}`);let v=p.item;return k("tr",{className:"transition-colors hover:bg-slate-50/80","data-testid":`recent-item-row-${v.id}`,children:[c("td",{className:"px-3 py-2 font-bold",children:v.id}),k("td",{className:"max-w-xs truncate px-3 py-2",title:v.fileUri,children:[c("div",{className:"font-sans font-semibold text-slate-900",children:v.fileName}),c("div",{className:"truncate text-[11px] text-slate-600",children:v.fileUri})]}),c("td",{className:"px-3 py-2",children:c("span",{className:"inline-flex rounded-sm bg-slate-100 px-2 py-0.5 font-medium font-sans text-[11px] text-slate-700",children:v.confidentialityLevel})}),k("td",{className:"px-3 py-2 text-slate-600",children:["rev.",v.revision,v.isCurrent===!1&&c("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-${v.id}`,children:"\u65E7\u7248"})]}),k("td",{className:"px-3 py-2 font-sans",children:[V(v.syncStatus),v.errorMessage!==null&&v.errorMessage!==void 0&&v.errorMessage!==""&&c("div",{className:"mt-1 max-w-xs break-words text-[11px] text-red-700","data-testid":`ingest-item-error-${v.id}`,title:v.errorMessage,children:v.errorMessage})]}),k("td",{className:"px-3 py-2 font-sans","data-testid":`ingest-last-run-${v.id}`,children:[v.lastRun===null?c("span",{className:"text-[11px] text-slate-500","data-testid":`ingest-last-run-none-${v.id}`,children:"\u8A18\u9332\u306A\u3057"}):v.lastRun.kind==="restricted"?k("div",{className:"space-y-1","data-testid":`ingest-last-run-restricted-${v.id}`,"data-restricted-mark":"run",children:[c("div",{className:"text-[11px] text-slate-600",children:Vt}),c("span",{className:`inline-flex items-center rounded-full px-2 py-0.5 font-semibold text-[11px] ${Qe[v.lastRun.status].className}`,"data-testid":`ingest-last-run-status-${v.id}`,"data-status":v.lastRun.status,children:Qe[v.lastRun.status].label}),c("div",{className:"text-[11px] text-slate-500","data-testid":`ingest-last-run-finished-at-${v.id}`,children:c(St,{iso:v.lastRun.finishedAt,testId:`ingest-last-run-finished-at-value-${v.id}`})})]}):k("div",{className:"space-y-1",children:[c("span",{className:`inline-flex items-center rounded-full px-2 py-0.5 font-semibold text-[11px] ${Qe[rt(v.lastRun.item)].className}`,"data-testid":`ingest-last-run-status-${v.id}`,"data-status":v.lastRun.item.status,"data-presentation":rt(v.lastRun.item),children:Qe[rt(v.lastRun.item)].label}),v.lastRun.item.failedStepKey!==null&&c("div",{className:"text-[11px] text-red-700","data-testid":`ingest-last-run-failed-step-${v.id}`,children:uo[v.lastRun.item.failedStepKey].label}),c("div",{className:"text-[11px] text-slate-500","data-testid":`ingest-last-run-finished-at-${v.id}`,children:c(St,{iso:v.lastRun.item.finishedAt,testId:`ingest-last-run-finished-at-value-${v.id}`})})]}),_!==void 0&&c("button",{type:"button",onClick:()=>_(v.id),"aria-label":`${v.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-${v.id}`,children:"\u5C65\u6B74"})]}),c("td",{className:"px-3 py-2 font-sans text-[11px] text-slate-500","data-testid":`ingest-created-at-${v.id}`,children:c(ge,{iso:v.createdAt,testId:`ingest-created-at-value-${v.id}`})}),c("td",{className:"px-3 py-2 text-right font-sans",children:A(v)})]},`readable:${v.id}`)})})]})})]})]})}import{ENRICHMENT_STAGES as Aa}from"@aiquants/enrichment-core";import{jsx as Ie,jsxs as je}from"react/jsx-runtime";var os={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 is(e,t){return e===null?"absent":e in t?t[e]?"open":"closed":"unmeasured"}function nl({strategies:e,featureFlags:t,onToggleStage:a,isUpdating:n=!1}){let r=a===void 0;return je("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:[je("div",{children:[Ie("h2",{className:"font-bold text-base text-slate-900",children:"\u30C9\u30E1\u30A4\u30F3\u5225 \u53D6\u308A\u8FBC\u307F\u6226\u7565"}),je("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",Ie("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 ",Aa.length," \u6BB5\u3002"]}),r&&Ie("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?Ie("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"}):Ie("div",{"data-testid":"strategy-grid-scroll",className:"overflow-x-auto",children:je("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:[Ie("thead",{children:je("tr",{children:[Ie("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"}),Aa.map(s=>{let o=is(s.featureFlagKey,t);return je("th",{scope:"col",className:"border-slate-200 border-b border-solid p-2 text-center font-semibold text-slate-600",children:[Ie("div",{children:s.label}),Ie("div",{"data-testid":`strategy-gate-${s.key}`,"data-gate":o,className:"mt-0.5 font-normal text-[10px]",style:{color:os[o].color},children:os[o].label})]},s.key)})]})}),Ie("tbody",{children:e.map(s=>je("tr",{"data-testid":`strategy-row-${s.domainKey}`,"data-provenance":s.provenance,"data-active":String(s.isActive),children:[je("th",{scope:"row",className:"border-slate-100 border-b border-solid p-2 text-left font-normal",children:[Ie("div",{className:"font-semibold text-slate-900",children:s.domainLabel}),je("div",{className:"text-[10px] text-slate-500",children:[Ie("code",{children:s.domainKey})," / ",s.strategyName]}),Ie("div",{"data-testid":`strategy-provenance-${s.domainKey}`,className:"text-[10px] text-slate-500",children:s.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"}),!s.isActive&&Ie("div",{"data-testid":`strategy-inactive-${s.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"})]}),Aa.map(o=>{let u=s.stages[o.key],d=is(o.featureFlagKey,t);return je("td",{className:"border-slate-100 border-b border-solid p-2 text-center",children:[Ie("button",{type:"button",role:"switch","aria-checked":u,"aria-label":`${s.domainLabel} \u306E ${o.label}`,"data-testid":`strategy-stage-${s.domainKey}-${o.key}`,"data-enabled":String(u),"data-effective":String(u&&(d==="open"||d==="absent")),disabled:r||n,onClick:()=>a?.(s,o.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"} ${r||n?"cursor-not-allowed opacity-60":"cursor-pointer"}`,children:u?"\u958B":"\u9589"}),u&&d==="unmeasured"&&Ie("div",{"data-testid":`strategy-unmeasured-${s.domainKey}-${o.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&&d==="closed"&&Ie("div",{"data-testid":`strategy-blocked-${s.domainKey}-${o.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"})]},o.key)})]},`${s.domainKey}:${s.strategyName}`))})]})})]})}var kt={connected:"\u6B63\u5E38\u63A5\u7D9A",error:"\u63A5\u7D9A\u30A8\u30E9\u30FC"},wt={connected:{"data-cui-fg":"success-fg","data-cui-surface":"success-tint"},error:{"data-cui-fg":"danger-fg","data-cui-surface":"danger-tint"}};import{Fragment as us,jsx as X,jsxs as ue}from"react/jsx-runtime";var ho={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"},ds=["engine","edition","fullVersion","title","collectionsCount","nodeCount","totalKeys","database","endpointsCount","port","restPort","boltUri","tls"],vo=new Set(["collectionsCount","nodeCount","totalKeys","endpointsCount"]),ra={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 ls(e){return e.kind==="text"?"anywhere":"atomic"}function ps(e,t){return t===null?{kind:"unmeasured"}:vo.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 No(e){let t=ds.filter(n=>n in e),a=Object.keys(e).filter(n=>!ds.includes(n)).sort();return[...t,...a].map(n=>({key:n,label:ho[n]??n,value:ps(n,e[n])}))}function cs(e,t){switch(e.kind){case"count":return X(ae,{value:e.count,unit:"\u4EF6",testId:t});case"unmeasured":return X(Fe,{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 X(Fe,{text:String(e.value),testId:t});case"word":return X(Fe,{text:e.text,testId:t});case"text":return X(At,{text:e.text,testId:t})}}function ul({health:e,isRefreshing:t=!1,onRefresh:a,className:n=""}){let{services:r,allHealthy:s,checkedAt:o}=e;M();let u=[{key:"qdrant",data:r.qdrant,title:"Qdrant",subtitle:"\u30D9\u30AF\u30C8\u30EB\u691C\u7D22\u30A8\u30F3\u30B8\u30F3 (Vector DB)"},{key:"neo4j",data:r.neo4j,title:"Neo4j",subtitle:"\u30CA\u30EC\u30C3\u30B8\u30B0\u30E9\u30D5 (Graph DB)"},{key:"redis",data:r.redis,title:"Redis",subtitle:"\u30AD\u30E3\u30C3\u30B7\u30E5 & Pub/Sub (Cache)"},{key:"sqlServer",data:r.sqlServer,title:"SQL Server",subtitle:"\u6B63\u6E96\u30C7\u30FC\u30BF\u30B9\u30C8\u30A2 (Single Source of Truth)"},{key:"quantsApi",data:r.quantsApi,title:"AI Quant API",subtitle:"Python \u30D0\u30C3\u30AF\u30A8\u30F3\u30C9\u63A8\u8AD6\u30A8\u30F3\u30B8\u30F3"}];return ue("section",{className:`rounded-lg border border-solid bg-card p-5 text-card-foreground shadow-sm ${n}`,"data-testid":"infrastructure-health-monitor","data-healthy":String(s),children:[ue("div",{className:"flex flex-wrap items-center justify-between gap-4 border-b border-solid pb-4",children:[ue("div",{className:"flex items-center gap-3",children:[X("div",{className:"flex h-10 w-10 items-center justify-center rounded-lg bg-primary/10 text-primary",children:ue("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:[X("rect",{width:"20",height:"8",x:"2",y:"2",rx:"2",ry:"2"}),X("rect",{width:"20",height:"8",x:"2",y:"14",rx:"2",ry:"2"}),X("line",{x1:"6",x2:"6.01",y1:"6",y2:"6"}),X("line",{x1:"6",x2:"6.01",y1:"18",y2:"18"})]})}),ue("div",{children:[X("h2",{className:"font-bold text-base",children:"\u5468\u8FBA\u6A5F\u80FD\u63A5\u7D9A\u72B6\u614B & \u30D0\u30FC\u30B8\u30E7\u30F3"}),ue("p",{className:"text-muted-foreground text-xs",children:["\u6700\u7D42\u78BA\u8A8D:"," ",X("span",{"data-testid":"health-checked-at",children:X(ge,{iso:o,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"]})]})]}),ue("div",{className:"flex flex-wrap items-center gap-3",children:[X("span",{className:"inline-flex shrink-0 items-center gap-1.5 whitespace-nowrap rounded-full px-3 py-1 font-medium text-xs",...wt[s?"connected":"error"],"data-testid":"health-overall-status-badge",children:s?ue(us,{children:[ue("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:[X("path",{d:"M22 11.08V12a10 10 0 1 1-5.93-9.14"}),X("polyline",{points:"22 4 12 14.01 9 11.01"})]}),ue("span",{children:["\u5168\u30B5\u30FC\u30D3\u30B9",kt.connected]})]}):ue(us,{children:[ue("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:[X("circle",{cx:"12",cy:"12",r:"10"}),X("line",{x1:"12",x2:"12",y1:"8",y2:"12"}),X("line",{x1:"12",x2:"12.01",y1:"16",y2:"16"})]}),ue("span",{children:["\u4E00\u90E8\u30B5\u30FC\u30D3\u30B9",kt.error]})]})}),a&&ue("button",{type:"button",onClick:a,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:[ue("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:[X("path",{d:"M21 12a9 9 0 0 0-9-9 9.75 9.75 0 0 0-6.74 2.74L3 8"}),X("path",{d:"M3 3v5h5"}),X("path",{d:"M3 12a9 9 0 0 0 9 9 9.75 9.75 0 0 0 6.74-2.74L21 16"}),X("path",{d:"M16 21h5v-5"})]}),X("span",{children:"\u518D\u78BA\u8A8D"})]})]})]}),X("div",{className:"mt-4 grid grid-cols-1 gap-4 sm:grid-cols-2 lg:grid-cols-5",children:u.map(({key:d,data:h,title:_,subtitle:R})=>{let l=ps("version",h.version),C=ra[ls(l)],$=cs(l,`service-version-value-${d}`);return ue("div",{"data-testid":`service-card-${d}`,className:"flex flex-col justify-between rounded-md border border-border border-solid bg-card/60 p-3.5 transition-colors hover:bg-muted/40",children:[ue("div",{children:[ue("div",{className:"flex flex-wrap items-center justify-between gap-x-2 gap-y-1",children:[X("span",{className:"font-semibold text-sm",children:_}),ue("span",{className:"inline-flex shrink-0 items-center gap-1 whitespace-nowrap rounded-sm px-1.5 py-0.5 font-medium text-[11px]",...wt[h.status],"data-testid":`service-status-${d}`,children:[X("span",{className:"h-1.5 w-1.5 rounded-full bg-current","data-testid":`service-status-dot-${d}`}),kt[h.status]]})]}),X("p",{className:"mt-1 text-[11px] text-muted-foreground",children:R}),ue("div",{className:"mt-3 space-y-1.5 border-t border-solid pt-2 text-xs",children:[ue("div",{className:"flex items-start justify-between gap-2","data-testid":`service-version-row-${d}`,children:[X("span",{className:C.label,children:"\u30D0\u30FC\u30B8\u30E7\u30F3:"}),X("span",{className:`${C.slot} font-medium text-[11px]`,"data-testid":`service-version-${d}`,children:l.kind==="text"?X("code",{className:"font-mono font-semibold",children:$}):$})]}),ue("div",{className:"flex items-start justify-between gap-2","data-testid":`health-latency-row-${d}`,children:[X("span",{className:ra.atomic.label,children:"\u5FDC\u7B54\u6642\u9593:"}),X("span",{className:`${ra.atomic.slot} font-mono text-[11px] text-muted-foreground`,"data-testid":`health-latency-${d}`,children:X(ae,{value:h.latencyMs,unit:"ms",testId:`health-latency-value-${d}`})})]}),No(h.details).map(m=>{let I=ra[ls(m.value)];return ue("div",{className:"flex items-start justify-between gap-2","data-testid":`health-detail-row-${d}-${m.key}`,children:[ue("span",{className:I.label,children:[m.label,":"]}),X("span",{className:`${I.slot} font-medium text-[11px]`,"data-testid":`health-detail-${d}-${m.key}`,children:cs(m.value,`health-detail-value-${d}-${m.key}`)})]},m.key)})]})]}),ue("div",{className:"mt-3 border-t border-solid pt-1.5 text-[10px] text-muted-foreground",children:[X("span",{className:"wrap-anywhere font-mono","data-testid":`service-endpoint-${d}`,children:h.endpoint}),h.errorMessage!==void 0&&Dt.test(h.errorMessage)&&X("p",{className:"wrap-anywhere mt-1 rounded-sm px-1.5 py-0.5",...wt.error,"data-testid":`service-error-${d}`,children:h.errorMessage})]})]},d)})})]})}import{MODE_TIERS as So,SEARCH_MODES as Eo,SEARCH_PARAM_LIMITS as Ue}from"@aiquants/enrichment-core";import{useEffect as ms,useId as Xe,useRef as fs,useState as ye}from"react";import{Fragment as oa,jsx as b,jsxs as y}from"react/jsx-runtime";var gs={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"}},Ct="\u672A\u5B9F\u884C",Ro=(Ue.threshold.min+Ue.threshold.max)/2,Io=2e3;function ko(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 Ma={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"}},wo=[{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 bs(e){return e===void 0||Number.isNaN(e)?"N/A":`${(e*100).toFixed(1)}%`}function Co(e,t){let a=t.trim();if(!(a&&e))return e;let n=a.replace(/[.*+?^${}()|[\]\\]/g,"\\$&"),r=new RegExp(`(${n})`,"gi");return e.split(r).map((u,d)=>({id:`chunk-${d}-${u.slice(0,8)}`,part:u,isMatch:u.toLowerCase()===a.toLowerCase()})).map(u=>u.isMatch?b("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 Oa(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 Fa(e){return e==="OPEN"?"OPEN":e==="HALF_OPEN"?"HALF":"-"}function yl({tenantId:e,onSearch:t,initialParams:a,initialResult:n=null,circuitBreakerStatus:r={},isLoading:s=!1}){let o=Xe(),u=Xe(),d=Xe(),h=Xe(),_=Xe(),R=Xe(),l=Xe(),C=Xe(),$=Xe(),m=Xe(),[I,S]=ye(a?.q??""),[P,O]=ye(a?.mode??"HYBRID"),[Q,G]=ye(a?.limit??Ue.limit.default),[Z,F]=ye(a?.threshold??Ro),[H,re]=ye(a?.fusion??"rrf"),[E,q]=ye(a?.rrf_k??Ue.rrfK.default),[Y,fe]=ye(a?.alpha??Ue.alpha.default),[Ke,D]=ye(a?.confidentiality_level??"ALL"),[we,se]=ye(a?.department_id?String(a.department_id):""),[de,U]=ye(a?.mime_type??""),[ce,J]=ye(a?.tag??""),Ce=fs(0),[Ge,Pe]=ye(!1),[Ne,f]=ye(!1),[z,he]=ye("request"),[le,pe]=ye(null),[Se,Ze]=ye(new Set),[Ve,Ae]=ye(!1),[te,Ye]=ye(n),[Me,x]=ye(null),[T,A]=ye(null),V=s||Ve,p=So[P],N=[p.dense,p.sparse,p.graph,p.lexical].filter(Boolean).length>1,v=p.dense&&!p.sparse,be=te?.search_metadata.circuit_breaker_status??r,_e=te?.search_metadata.executed_tiers??{sql:!1,dense:!1,sparse:!1,graph:!1},ca=T??{};ms(()=>{if(!Ne)return;let i=me=>{me.key==="Escape"&&f(!1)};return window.addEventListener("keydown",i),()=>window.removeEventListener("keydown",i)},[Ne]);let $s=i=>{O(i.params.mode),G(i.params.limit),i.params.threshold!==void 0&&F(i.params.threshold),i.params.fusion!==void 0&&re(i.params.fusion),i.params.rrf_k!==void 0&&q(i.params.rrf_k)},Ds=async()=>{if(V)return;let i=we.trim()?Number.parseInt(we.trim(),10):void 0,me={q:I.trim(),mode:P,limit:Q,threshold:v?Z:void 0,fusion:N?H:void 0,rrf_k:N&&H==="rrf"?E:void 0,alpha:N&&H==="linear"?Y:void 0,department_id:i,confidentiality_level:Ke==="ALL"?void 0:Ke,mime_type:de.trim()||void 0,tag:ce.trim()||void 0},Te=Ce.current+1;Ce.current=Te,x(null),Ae(!0);try{let et=await t(me);if(Te!==Ce.current)return;Ye(et),A(me)}catch(et){if(Te!==Ce.current)return;x(et instanceof Error?et.message:"\u691C\u7D22\u51E6\u7406\u4E2D\u306B\u4E88\u671F\u305B\u306C\u30A8\u30E9\u30FC\u304C\u767A\u751F\u3057\u307E\u3057\u305F\u3002")}finally{Te===Ce.current&&Ae(!1)}},Tt=fs(void 0);ms(()=>()=>{Tt.current!==void 0&&clearTimeout(Tt.current)},[]);let As=async(i,me)=>{try{await navigator.clipboard.writeText(i),pe(me),Tt.current!==void 0&&clearTimeout(Tt.current),Tt.current=setTimeout(()=>pe(null),Io)}catch{}},Ms=i=>{Ze(me=>{let Te=new Set(me);return Te.has(i)?Te.delete(i):Te.add(i),Te})};return y("div",{"data-testid":"metadata-search-workbench","data-mode":P,"data-loading":String(V),className:"space-y-6",children:[y("div",{className:"rounded-xl border border-slate-200 border-solid bg-white p-6 shadow-sm",children:[y("div",{className:"flex flex-col gap-4 lg:flex-row lg:items-center lg:justify-between",children:[y("div",{children:[y("div",{className:"flex items-center gap-2",children:[b("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"}),y("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]})]}),b("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"})]}),b("div",{className:"flex items-center gap-2",children:y("button",{type:"button","data-testid":"toggle-inspector-button","aria-expanded":Ne,"aria-controls":m,onClick:()=>f(i=>!i),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:[b("span",{className:"font-mono text-xs",children:"{ }"}),b("span",{children:Ne?"\u30A4\u30F3\u30B9\u30DA\u30AF\u30BF\u3092\u9589\u3058\u308B":"\u958B\u767A\u8005\u30A4\u30F3\u30B9\u30DA\u30AF\u30BF"})]})})]}),y("div",{className:"mt-5 border-slate-100 border-t border-solid pt-4",children:[b("span",{className:"font-medium text-slate-600 text-xs",children:"\u958B\u767A\u8005\u30D7\u30EA\u30BB\u30C3\u30C8:"}),b("div",{className:"mt-2 flex flex-wrap gap-2",children:wo.map(i=>b("button",{type:"button","data-testid":`preset-button-${i.id}`,onClick:()=>$s(i),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:y("div",{children:[b("span",{className:"font-semibold text-slate-800",children:i.title}),y("span",{className:"ml-1.5 hidden text-slate-500 xl:inline",children:["(",i.description,")"]})]})},i.id))})]})]}),b("div",{className:"rounded-xl border border-slate-200 border-solid bg-white p-6 shadow-sm",children:y("form",{onSubmit:i=>{i.preventDefault(),Ds()},className:"space-y-5",children:[y("div",{className:"flex flex-col gap-3 sm:flex-row sm:items-center",children:[y("div",{className:"relative flex-1",children:[b("label",{htmlFor:o,className:"sr-only",children:"\u691C\u7D22\u30AF\u30A8\u30EA"}),b("input",{id:o,type:"text","data-testid":"search-query-input",value:I,onChange:i=>S(i.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"}),I&&b("button",{type:"button","data-testid":"clear-query-button",onClick:()=>S(""),className:"absolute inset-y-0 right-0 flex items-center pr-3 text-slate-400 hover:text-slate-600",children:"\u2715"})]}),b("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:Eo.map(i=>{let me=P===i;return b("button",{type:"button","aria-pressed":me,title:gs[i].description,"data-testid":`search-mode-${i}`,"data-active":String(me),onClick:()=>O(i),className:`shrink-0 whitespace-nowrap rounded-md px-3 py-1.5 font-medium text-xs transition-all ${me?"bg-white text-indigo-700 shadow-sm":"text-slate-600 hover:text-slate-900"}`,children:gs[i].label},i)})}),b("button",{type:"submit","data-testid":"execute-search-button",disabled:V,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:V?"\u691C\u7D22\u4E2D...":"\u691C\u7D22\u5B9F\u884C"})]}),y("div",{className:"grid grid-cols-1 gap-4 rounded-lg bg-slate-50 p-4 sm:grid-cols-2 lg:grid-cols-4",children:[y("div",{className:"space-y-1.5",children:[y("div",{className:"flex items-center justify-between",children:[b("label",{htmlFor:u,className:"font-medium text-slate-700 text-xs",children:"\u53D6\u5F97\u4EF6\u6570 (Top-K):"}),b("span",{"data-testid":"limit-display",className:"font-mono font-semibold text-indigo-600 text-xs",children:Q})]}),b("input",{id:u,type:"range","data-testid":"limit-slider",min:Ue.limit.min,max:Ue.limit.max,step:1,value:Q,onChange:i=>G(Number(i.target.value)),className:"h-1.5 w-full cursor-pointer appearance-none rounded-lg bg-slate-200 accent-indigo-600"})]}),y("div",{className:"space-y-1.5",children:[y("div",{className:"flex items-center justify-between",children:[b("label",{htmlFor:d,className:"font-medium text-slate-700 text-xs",title:v?"\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):"}),b("span",{"data-testid":"threshold-display",className:"font-mono font-semibold text-indigo-600 text-xs",children:Z.toFixed(2)})]}),b("input",{id:d,type:"range","data-testid":"threshold-slider",min:Ue.threshold.min,max:Ue.threshold.max,step:.01,value:Z,disabled:!v,onChange:i=>F(Number(i.target.value)),className:"h-1.5 w-full cursor-pointer appearance-none rounded-lg bg-slate-200 accent-indigo-600 disabled:opacity-40"})]}),y("div",{className:"space-y-1.5",children:[y("div",{className:"flex items-center justify-between",children:[b("span",{className:"font-medium text-slate-700 text-xs",children:"\u878D\u5408\u30A2\u30EB\u30B4\u30EA\u30BA\u30E0:"}),b("span",{className:"font-mono font-semibold text-indigo-600 text-xs",children:H.toUpperCase()})]}),y("div",{className:"flex items-center gap-1",children:[b("button",{type:"button","data-testid":"fusion-strategy-rrf",onClick:()=>re("rrf"),disabled:!N,className:`flex-1 rounded-sm border border-solid py-1 font-medium text-xs ${H==="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"}),b("button",{type:"button","data-testid":"fusion-strategy-linear",onClick:()=>re("linear"),disabled:!N,className:`flex-1 rounded-sm border border-solid py-1 font-medium text-xs ${H==="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)"})]})]}),b("div",{className:"space-y-1.5",children:H==="rrf"?y(oa,{children:[y("div",{className:"flex items-center justify-between",children:[b("label",{htmlFor:h,className:"font-medium text-slate-700 text-xs",children:"RRF \u5B9A\u6570 (k):"}),b("span",{"data-testid":"rrf-k-display",className:"font-mono font-semibold text-indigo-600 text-xs",children:E})]}),b("input",{id:h,type:"range","data-testid":"rrf-k-slider",min:Ue.rrfK.min,max:Ue.rrfK.max,step:1,value:E,disabled:!N,onChange:i=>q(Number(i.target.value)),className:"h-1.5 w-full cursor-pointer appearance-none rounded-lg bg-slate-200 accent-indigo-600 disabled:opacity-40"})]}):y(oa,{children:[y("div",{className:"flex items-center justify-between",children:[b("label",{htmlFor:_,className:"font-medium text-slate-700 text-xs",children:"\u30D9\u30AF\u30C8\u30EB\u91CD\u307F (Alpha):"}),b("span",{"data-testid":"alpha-display",className:"font-mono font-semibold text-indigo-600 text-xs",children:Y.toFixed(2)})]}),b("input",{id:_,type:"range","data-testid":"alpha-slider",min:Ue.alpha.min,max:Ue.alpha.max,step:.05,value:Y,disabled:!N,onChange:i=>fe(Number(i.target.value)),className:"h-1.5 w-full cursor-pointer appearance-none rounded-lg bg-slate-200 accent-indigo-600 disabled:opacity-40"})]})})]}),y("div",{children:[y("button",{type:"button","data-testid":"toggle-advanced-filters",onClick:()=>Pe(i=>!i),className:"inline-flex items-center gap-1.5 font-medium text-indigo-600 text-xs hover:text-indigo-800",children:[b("span",{children:Ge?"\u25BC":"\u25B6"}),y("span",{children:["\u8A73\u7D30\u30E1\u30BF\u30C7\u30FC\u30BF & \u30B0\u30E9\u30D5\u30D5\u30A3\u30EB\u30BF ",Ge?"\u3092\u9589\u3058\u308B":"\u3092\u5C55\u958B"]})]}),Ge&&y("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:[y("div",{className:"space-y-1",children:[b("label",{htmlFor:l,className:"font-medium text-slate-700 text-xs",children:"\u6A5F\u5BC6\u533A\u5206 (Confidentiality):"}),y("select",{id:l,"data-testid":"filter-confidentiality",value:Ke,onChange:i=>D(i.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:[b("option",{value:"ALL",children:"\u5168\u6A5F\u5BC6\u533A\u5206 (ALL)"}),b("option",{value:"PUBLIC",children:"\u516C\u958B (PUBLIC)"}),b("option",{value:"INTERNAL",children:"\u793E\u5185\u9650\u5B9A (INTERNAL)"}),b("option",{value:"DEPARTMENT",children:"\u90E8\u9580\u9650\u5B9A (DEPARTMENT)"}),b("option",{value:"CONFIDENTIAL",children:"\u6A5F\u5BC6 (CONFIDENTIAL)"})]})]}),y("div",{className:"space-y-1",children:[b("label",{htmlFor:R,className:"font-medium text-slate-700 text-xs",children:"\u90E8\u9580 ID (Department ID):"}),b("input",{id:R,type:"number","data-testid":"filter-department-id",value:we,onChange:i=>se(i.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"})]}),y("div",{className:"space-y-1",children:[b("label",{htmlFor:C,className:"font-medium text-slate-700 text-xs",children:"MIME \u30BF\u30A4\u30D7 (MIME Type):"}),b("input",{id:C,type:"text","data-testid":"filter-mime-type",value:de,onChange:i=>U(i.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"})]}),y("div",{className:"space-y-1",children:[b("label",{htmlFor:$,className:"font-medium text-slate-700 text-xs",children:"\u30BF\u30B0 (Tag):"}),b("input",{id:$,type:"text","data-testid":"filter-tag",value:ce,onChange:i=>J(i.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"})]})]})]})]})}),Me&&b("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:Me}),te?.search_metadata&&b(ja,{metadata:te.search_metadata}),te&&y("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:[y("div",{className:"flex items-center gap-4",children:[y("span",{"data-testid":"result-count",className:"font-semibold text-slate-800",children:["\u30D2\u30C3\u30C8\u4EF6\u6570: ",b("span",{className:"font-bold text-indigo-600",children:te.count})," \u4EF6"]}),te.search_metadata.execution_time_ms!==void 0&&y("span",{"data-testid":"latency-metric",className:"text-slate-500",children:["\u5B9F\u884C\u30EC\u30A4\u30C6\u30F3\u30B7: ",y("span",{className:"font-mono font-semibold text-slate-700",children:[te.search_metadata.execution_time_ms," ms"]})]}),y("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: ",te.search_metadata.quality_tier]})]}),y("div",{className:"flex items-center gap-2",children:[b("span",{className:"text-slate-500",children:"\u30EC\u30A4\u30E4\u30FC\u72B6\u614B:"}),y("span",{"data-testid":"tier-badge-sql","data-active":String(_e.sql),className:`rounded-sm px-1.5 py-0.5 font-mono text-[11px] ${_e.sql?"bg-emerald-100 font-semibold text-emerald-800":"bg-slate-200 text-slate-500"}`,children:["SQL ",_e.sql?"\u2713":"-"]}),y("span",{"data-testid":"tier-badge-sparse","data-active":String(_e.sparse),"data-breaker":be.vector??"CLOSED",className:`rounded-sm px-1.5 py-0.5 font-mono text-[11px] ${_e.sparse?"bg-emerald-100 font-semibold text-emerald-800":Oa(be.vector)}`,children:["\u758E\u30D9\u30AF\u30C8\u30EB ",_e.sparse?"\u2713":Fa(be.vector)]}),y("span",{"data-testid":"tier-badge-dense","data-active":String(_e.dense),"data-breaker":be.vector??"CLOSED",className:`rounded-sm px-1.5 py-0.5 font-mono text-[11px] ${_e.dense?"bg-emerald-100 font-semibold text-emerald-800":Oa(be.vector)}`,children:["\u5BC6\u30D9\u30AF\u30C8\u30EB ",_e.dense?"\u2713":Fa(be.vector)]}),y("span",{"data-testid":"tier-badge-graph","data-active":String(_e.graph),"data-breaker":be.graph??"CLOSED",className:`rounded-sm px-1.5 py-0.5 font-mono text-[11px] ${_e.graph?"bg-emerald-100 font-semibold text-emerald-800":Oa(be.graph)}`,children:["\u30B0\u30E9\u30D5 ",_e.graph?"\u2713":Fa(be.graph)]})]})]}),y("div",{"data-testid":"search-results-container",className:"space-y-4",children:[te&&te.hits.length===0&&y("div",{"data-testid":"empty-search-state",className:"rounded-xl border border-slate-200 border-solid bg-white p-12 text-center",children:[b("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"}),b("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"})]}),te?.hits.map((i,me)=>{let Te=Se.has(i.id),et=i.scores?.fused;return y("div",{"data-testid":`search-hit-card-${i.id}`,"data-hit-id":i.id,"data-rank":me+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:[y("div",{className:"flex flex-col gap-2 sm:flex-row sm:items-start sm:justify-between",children:[y("div",{className:"space-y-1",children:[y("div",{className:"flex flex-wrap items-center gap-2",children:[y("span",{"data-testid":`hit-rank-${i.id}`,className:"rounded-sm bg-slate-100 px-2 py-0.5 font-bold font-mono text-slate-600 text-xs",children:["#",me+1]}),b("h3",{"data-testid":`hit-filename-${i.id}`,className:"font-bold text-base text-slate-900 tracking-tight",children:i.file_name}),b("span",{"data-testid":`hit-confidentiality-${i.id}`,className:`rounded-full px-2 py-0.5 font-semibold text-[11px] ${i.confidentiality_level==="PUBLIC"?"bg-emerald-50 text-emerald-700":i.confidentiality_level==="INTERNAL"?"bg-blue-50 text-blue-700":i.confidentiality_level==="CONFIDENTIAL"?"bg-amber-50 text-amber-700":"bg-red-50 text-red-700"}`,children:i.confidentiality_level}),i.department_id!==null&&y("span",{"data-testid":`hit-department-${i.id}`,className:"rounded-sm bg-slate-100 px-2 py-0.5 text-[11px] text-slate-600",children:["Dept: ",i.department_id]}),b("span",{"data-testid":`hit-mimetype-${i.id}`,className:"rounded-sm bg-slate-50 px-2 py-0.5 font-mono text-[11px] text-slate-500",children:i.mime_type})]}),b("p",{className:"max-w-xl truncate font-mono text-slate-400 text-xs",children:i.file_uri})]}),et!==void 0&&y("div",{className:"flex items-center gap-3 sm:text-right",children:[y("div",{children:[b("div",{className:"font-medium text-slate-500 text-xs",children:"\u878D\u5408\u9806\u4F4D\u30B9\u30B3\u30A2"}),b("div",{"data-testid":`hit-fused-score-${i.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:et.toFixed(3)})]}),b("div",{className:"h-2 w-16 overflow-hidden rounded-full bg-slate-200",children:b("div",{className:"h-full bg-indigo-600",style:{width:`${Math.min(100,Math.max(0,et*100))}%`}})})]})]}),i.ai_summary&&b("div",{"data-testid":`hit-summary-${i.id}`,className:"mt-3 rounded-lg bg-slate-50 p-3 text-slate-700 text-sm leading-relaxed",children:Co(i.ai_summary,T?.q??I)}),i.scores&&y("div",{"data-testid":`hit-score-breakdown-${i.id}`,className:"mt-3 flex flex-wrap items-center gap-2 text-xs",children:[b("span",{className:"text-[11px] text-slate-400",children:"\u30B9\u30B3\u30A2\u5185\u8A33:"}),i.scores.vector!==void 0&&y("span",{"data-testid":`score-vector-${i.id}`,"data-score-kind":i.scores.vector.kind,title:Ma[i.scores.vector.kind].title,className:"rounded-sm bg-blue-50 px-2 py-0.5 font-mono text-blue-700",children:[Ma[i.scores.vector.kind].label,": ",Ma[i.scores.vector.kind].format(i.scores.vector.value)]}),i.scores.lexicalRank!==void 0&&y("span",{"data-testid":`score-lexical-${i.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: ",bs(i.scores.lexicalRank)]}),i.scores.graphRank!==void 0&&y("span",{"data-testid":`score-graph-${i.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: ",bs(i.scores.graphRank)]})]}),i.tags&&i.tags.length>0&&b("div",{"data-testid":`hit-tags-${i.id}`,className:"mt-3 flex flex-wrap items-center gap-1.5",children:i.tags.map(tt=>y("span",{"data-testid":`hit-tag-${i.id}-${tt}`,className:"rounded-full bg-slate-100 px-2.5 py-0.5 font-medium text-slate-600 text-xs",children:["#",tt]},`tag-${i.id}-${tt}`))}),i.graph_relations&&i.graph_relations.length>0&&y("div",{"data-testid":`hit-graph-relations-${i.id}`,className:"mt-3 flex flex-wrap items-center gap-1.5",children:[b("span",{className:"text-slate-400 text-xs",children:"\u30B0\u30E9\u30D5\u63A5\u7D9A:"}),i.graph_relations.map((tt,Os)=>y("span",{"data-testid":`hit-relation-${i.id}-${Os}`,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:["-[:",tt.relation,"]-> ",tt.target_name]},`rel-${i.id}-${tt.relation}-${tt.target_name}`))]}),i.structured_data!==null&&i.structured_data!==void 0&&y("div",{className:"mt-3 border-slate-100 border-t border-solid pt-2",children:[y("button",{type:"button","data-testid":`toggle-structured-data-${i.id}`,onClick:()=>Ms(i.id),className:"inline-flex items-center gap-1 font-medium text-indigo-600 text-xs hover:text-indigo-800",children:[b("span",{children:Te?"\u25BC":"\u25B6"}),y("span",{children:["\u62BD\u51FA\u69CB\u9020\u5316\u30C7\u30FC\u30BF ",Te?"\u3092\u9589\u3058\u308B":"\u3092\u8868\u793A"]})]}),Te&&b("pre",{"data-testid":`structured-data-json-${i.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(i.structured_data,null,2)})]})]},i.id)})]}),Ne&&y("section",{id:m,"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:[y("div",{className:"flex items-center justify-between border-slate-800 border-b border-solid pb-3",children:[y("div",{className:"flex items-center gap-3",children:[b("span",{className:"font-bold text-base text-white",children:"\u958B\u767A\u8005\u30A4\u30F3\u30B9\u30DA\u30AF\u30BF"}),b("span",{className:"rounded-sm bg-slate-800 px-2 py-0.5 font-mono text-slate-400 text-xs",children:"Live Pipeline Inspector"})]}),y("div",{className:"flex items-center gap-2",children:[b("button",{type:"button","data-testid":"copy-inspector-payload-button",onClick:()=>{let i=JSON.stringify(z==="request"?T??{}:te??{},null,2);As(i,"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:le==="inspector"?"\u30B3\u30D4\u30FC\u5B8C\u4E86 \u2713":"JSON \u3092\u30B3\u30D4\u30FC"}),b("button",{type:"button","data-testid":"close-inspector-button",onClick:()=>f(!1),className:"text-slate-400 hover:text-white",children:"\u2715"})]})]}),b("div",{className:"mt-3 flex gap-2 border-slate-800 border-b border-solid pb-2",children:["request","response","pipeline","graph-trace"].map(i=>{let me={request:"Request Payload",response:"Response Payload",pipeline:"Pipeline Trace","graph-trace":"Graph Path Trace"},Te=z===i;return b("button",{type:"button","data-testid":`inspector-tab-${i}`,"data-active":String(Te),onClick:()=>he(i),className:`rounded-sm px-3 py-1 font-medium text-xs ${Te?"bg-indigo-600 font-semibold text-white":"text-slate-400 hover:text-white"}`,children:me[i]},i)})}),y("div",{className:"mt-4",children:[z==="request"&&b("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(T??{},null,2)}),z==="response"&&b("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(te??{},null,2)}),z==="pipeline"&&y("div",{"data-testid":"inspector-pipeline-trace",className:"space-y-3 p-2 text-xs",children:[y("div",{className:"flex items-center gap-2",children:[b("span",{className:"rounded-full bg-emerald-500/20 px-2 py-0.5 font-bold text-emerald-400",children:"Step 1"}),b("span",{className:"font-semibold text-slate-300",children:"\u30AF\u30A8\u30EA\u89E3\u6790 & \u57CB\u3081\u8FBC\u307F (Query Analysis & Tokenization)"})]}),b("div",{className:"ml-6 border-slate-700 border-l border-solid pl-4 font-mono text-slate-400","data-testid":"inspector-query-analysis",children:te?y(oa,{children:["mode: ",ca.mode,' | q: "',ca.q,'"']}):Ct}),y("div",{className:"flex items-center gap-2",children:[b("span",{className:"rounded-full bg-emerald-500/20 px-2 py-0.5 font-bold text-emerald-400",children:"Step 2"}),b("span",{className:"font-semibold text-slate-300",children:"\u30DE\u30EB\u30C1\u30EC\u30A4\u30E4\u30FC\u4E26\u884C\u53D6\u5F97 (Multi-Tier Retrieval)"})]}),b("div",{className:"ml-6 border-slate-700 border-l border-solid pl-4 font-mono text-slate-400","data-testid":"inspector-tier-retrieval",children:te?y(oa,{children:["SQL SoT: ",_e.sql?"ACTIVE":"SKIPPED"," | Sparse: ",_e.sparse?"ACTIVE":"OFFLINE"," | Dense: ",_e.dense?"ACTIVE":"OFFLINE"," | Graph: ",_e.graph?"ACTIVE":"OFFLINE"]}):Ct}),y("div",{className:"flex items-center gap-2",children:[b("span",{className:"rounded-full bg-indigo-500/20 px-2 py-0.5 font-bold text-indigo-400",children:"Step 3"}),b("span",{className:"font-semibold text-slate-300",children:"\u30B9\u30B3\u30A2\u878D\u5408 & \u9806\u4F4D\u4ED8\u3051 (Fusion & Ranking)"})]}),y("div",{className:"ml-6 border-slate-700 border-l border-solid pl-4 font-mono text-slate-400",children:[y("span",{"data-testid":"inspector-fusion-strategy",children:["strategy: ",te?ko(ca):Ct]})," | ",y("span",{"data-testid":"inspector-output-count",children:["Output count: ",te?te.count:Ct]})]}),y("div",{className:"flex items-center gap-2",children:[b("span",{className:"rounded-full bg-purple-500/20 px-2 py-0.5 font-bold text-purple-400",children:"Step 4"}),b("span",{className:"font-semibold text-slate-300",children:"ABAC \u884C\u30FB\u5217\u8A8D\u53EF\u30DE\u30B9\u30AD\u30F3\u30B0 (Security Enforcement)"})]}),y("div",{className:"ml-6 border-slate-700 border-l border-solid pl-4 font-mono text-slate-400",children:[y("span",{"data-testid":"inspector-authz-row",children:["\u884C\u30B9\u30B3\u30FC\u30D7: ",te?te.authzScopes.rowScopeApplied?"\u9069\u7528 (\u4E00\u89A7\u304B\u3089\u6587\u66F8\u304C\u9664\u304B\u308C\u3066\u3044\u308B\u53EF\u80FD\u6027)":"\u672A\u9069\u7528":Ct]})," | ",y("span",{"data-testid":"inspector-authz-column",children:["\u5217\u30B9\u30B3\u30FC\u30D7: ",te?te.authzScopes.columnScopeApplied?"\u9069\u7528 (\u9805\u76EE\u304C\u4F0F\u305B\u3089\u308C\u3066\u3044\u308B)":"\u672A\u9069\u7528":Ct]})," | ","tenant: ",e]})]}),z==="graph-trace"&&y("div",{"data-testid":"inspector-graph-trace",className:"p-2 text-xs",children:[b("div",{className:"font-semibold text-purple-300",children:"\u77E5\u8B58\u30B0\u30E9\u30D5 \u30C8\u30E9\u30D0\u30FC\u30B5\u30EB \u30D1\u30B9:"}),te?.hits.some(i=>i.graph_relations&&i.graph_relations.length>0)?b("ul",{className:"mt-2 space-y-2 font-mono text-slate-300",children:te.hits.map(i=>i.graph_relations?.map(me=>y("li",{className:"rounded-sm bg-slate-950 p-2",children:["(:Document {id: ",i.id,', file: "',i.file_name,'"}) -[:',me.relation,']-> (:Entity {name: "',me.target_name,'"})']},`gtrace-${i.id}-${me.relation}-${me.target_name}`)))}):b("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 Ua}from"@aiquants/enrichment-core";import{useId as Ft,useState as gt}from"react";import{jsx as ie,jsxs as xe}from"react/jsx-runtime";var xs=4;function ys(e){return e.toFixed(xs)}function _o(e,t){let a=h=>{let _=new Map;return h.forEach((R,l)=>{_.has(R)||_.set(R,l+1)}),_},n=a(e),r=a(t),s=[...n.keys()].filter(h=>r.has(h)),o=new Set([...n.keys(),...r.keys()]).size,u=o===0?null:s.length/o,d=s.length===0?null:s.reduce((h,_)=>h+Math.abs(n.get(_)-r.get(_)),0)/s.length;return{sharedCount:s.length,overlapRatio:u,meanAbsoluteRankDifference:d}}function Ka(e){return`${e.label} (${e.embeddingModel})`}function Sl({variants:e,onCompare:t}){let a=Ft(),n=Ft(),r=Ft(),s=Ft(),o=Ft(),[u,d]=gt(null),[h,_]=gt(null),[R,l]=gt(""),[C,$]=gt(Ua.limit.default),[m,I]=gt(!1),[S,P]=gt(null),[O,Q]=gt(null),G=e.length>=2,Z=e.map(D=>D.strategyId),F=u!==null&&Z.includes(u)?u:G?Z[0]:null,H=h!==null&&Z.includes(h)?h:G?Z[1]:null,re=F!==null&&F===H,E=R.trim(),q=G&&!re&&E!==""&&!m,Y=async D=>{if(D.preventDefault(),!q||F===null||H===null)return;let we={query:E,strategyIds:[F,H],limit:C};I(!0),P(null);try{let se=await t(we);if(!se.ok){Q(null),P(se.reason);return}let de=se.results.find(ce=>ce.strategyId===F),U=se.results.find(ce=>ce.strategyId===H);if(de===void 0||U===void 0){Q(null),P(`\u5FDC\u7B54\u306B\u6226\u7565 #${de===void 0?F:H} \u306E\u7D50\u679C\u304C\u3042\u308A\u307E\u305B\u3093\u3002`);return}Q({input:we,left:de,right:U})}catch(se){Q(null),P(`\u6BD4\u8F03\u3092\u5B9F\u884C\u3067\u304D\u307E\u305B\u3093\u3067\u3057\u305F: ${se instanceof Error?se.message:String(se)}`)}finally{I(!1)}},fe=O===null?null:_o(O.left.hits.map(D=>D.id),O.right.hits.map(D=>D.id)),Ke=D=>{let we=e.find(se=>se.strategyId===D.strategyId);return xe("div",{className:"rounded-lg border border-slate-200 border-solid p-4","data-testid":`compare-column-${D.strategyId}`,children:[ie("h3",{className:"font-bold text-base text-slate-900",children:we===void 0?`\u6226\u7565 #${D.strategyId}`:Ka(we)}),ie("p",{className:"mt-1 text-[11px] text-slate-500",children:xe("span",{"data-testid":`compare-execution-ms-${D.strategyId}`,children:[D.executionMs," ms"]})}),D.hits.length===0?ie("p",{className:"mt-3 text-[13px] text-slate-500","data-testid":`compare-empty-${D.strategyId}`,children:"\u30D2\u30C3\u30C8\u306A\u3057"}):ie("ol",{className:"mt-3 space-y-2",children:D.hits.map((se,de)=>xe("li",{"aria-label":`${de+1} \u4F4D ${se.title} (\u30B9\u30B3\u30A2 ${ys(se.score)})`,className:"flex items-baseline gap-3 text-[13px]","data-testid":`compare-hit-${D.strategyId}-${de+1}`,"data-hit-id":se.id,"data-score":String(se.score),children:[ie("span",{className:"w-6 text-right font-mono text-slate-500",children:de+1}),ie("span",{title:se.title,className:"flex-1 truncate text-slate-900","data-testid":`compare-hit-title-${D.strategyId}-${de+1}`,children:se.title}),ie("span",{title:String(se.score),className:"font-mono text-slate-600","data-testid":`compare-hit-score-${D.strategyId}-${de+1}`,children:ys(se.score)})]},de))})]})};return xe("section",{className:"space-y-6","aria-labelledby":a,"data-testid":"model-comparison-workbench","data-running":m,children:[xe("form",{onSubmit:Y,className:"rounded-xl border border-slate-200 border-solid bg-white p-6 shadow-sm",children:[ie("h2",{id:a,className:"font-bold text-base text-slate-900",children:"\u5909\u7A2E\u306E\u6BD4\u8F03"}),xe("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 ",xs," \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"]}),!G&&xe("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"]}),xe("div",{className:"mt-4 grid grid-cols-1 gap-4 sm:grid-cols-2",children:[xe("div",{className:"space-y-1",children:[ie("label",{htmlFor:s,className:"block font-semibold text-[13px] text-slate-700",children:"\u5909\u7A2E A"}),ie("select",{id:s,value:F===null?"":String(F),onChange:D=>d(Number(D.target.value)),disabled:!G,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(D=>ie("option",{value:String(D.strategyId),children:Ka(D)},D.strategyId))})]}),xe("div",{className:"space-y-1",children:[ie("label",{htmlFor:o,className:"block font-semibold text-[13px] text-slate-700",children:"\u5909\u7A2E B"}),ie("select",{id:o,value:H===null?"":String(H),onChange:D=>_(Number(D.target.value)),disabled:!G,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(D=>ie("option",{value:String(D.strategyId),children:Ka(D)},D.strategyId))})]})]}),re&&ie("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"}),xe("div",{className:"mt-4 grid grid-cols-1 gap-4 sm:grid-cols-[1fr_auto]",children:[xe("div",{className:"space-y-1",children:[ie("label",{htmlFor:n,className:"block font-semibold text-[13px] text-slate-700",children:"\u30AF\u30A8\u30EA"}),ie("input",{id:n,type:"text",value:R,onChange:D=>l(D.target.value),disabled:!G,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"})]}),xe("div",{className:"space-y-1",children:[ie("label",{htmlFor:r,className:"block font-semibold text-[13px] text-slate-700",children:"\u4EF6\u6570"}),ie("input",{id:r,type:"number",min:Ua.limit.min,max:Ua.limit.max,step:1,value:C,onChange:D=>$(Number(D.target.value)),disabled:!G,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"})]})]}),ie("div",{className:"mt-4",children:ie("button",{type:"submit",disabled:!q,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:m?"\u6BD4\u8F03\u4E2D\u2026":"\u6BD4\u8F03\u3092\u5B9F\u884C"})})]}),S!==null&&ie("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:S}),O!==null&&fe!==null&&xe("div",{className:"space-y-4 rounded-xl border border-slate-200 border-solid bg-white p-6 shadow-sm","data-testid":"compare-results",children:[xe("dl",{className:"grid grid-cols-1 gap-3 text-[13px] sm:grid-cols-3","data-testid":"compare-agreement",children:[xe("div",{children:[ie("dt",{className:"text-slate-500",children:"\u5171\u901A\u30D2\u30C3\u30C8"}),xe("dd",{"data-testid":"compare-shared-count",children:[fe.sharedCount," \u4EF6 (A ",O.left.hits.length," \u4EF6 / B ",O.right.hits.length," \u4EF6)"]})]}),xe("div",{children:[ie("dt",{className:"text-slate-500",children:"\u91CD\u306A\u308A\u7387 (Jaccard)"}),ie("dd",{"data-testid":"compare-overlap-ratio",children:fe.overlapRatio===null?"\u30D2\u30C3\u30C8\u306A\u3057":`${(fe.overlapRatio*100).toFixed(1)}%`})]}),xe("div",{children:[ie("dt",{className:"text-slate-500",children:"\u9806\u4F4D\u5DEE\u306E\u5E73\u5747 (\u5171\u901A\u5206)"}),ie("dd",{"data-testid":"compare-rank-difference",children:fe.meanAbsoluteRankDifference===null?"\u5171\u901A\u30D2\u30C3\u30C8\u306A\u3057":fe.meanAbsoluteRankDifference.toFixed(2)})]})]}),xe("div",{className:"grid grid-cols-1 gap-4 md:grid-cols-2",children:[Ke(O.left),Ke(O.right)]})]})]})}import{jsx as ne,jsxs as ee}from"react/jsx-runtime";function hs(e){return e===null?Kt:`${e.length} \u7A2E`}var Kt="\u672A\u8A2D\u5B9A";function Ut(e,t=""){return e===null?Kt:`${e}${t}`}function ia(e){return e===null?Kt:`${e} \u4EF6`}function To(e){if(e.currentVersion===null&&e.lifecyclePhase===null)return`${e.schemaName} (\u79FB\u884C\u53F0\u5E33\u306F\u672A\u8A18\u9332)`;let t=e.currentVersion===null?Kt:`v${e.currentVersion}`;return`${e.schemaName} ${t} (${e.lifecyclePhase??Kt})`}function Il({tenantId:e,ontologyStatus:t}){let a=t.classes,n=t.predicates;return ee("div",{className:"space-y-6","data-testid":"ontology-status-card",children:[ee("div",{className:"rounded-xl border border-slate-200 border-solid bg-white p-6 shadow-sm",children:[ee("div",{className:"flex flex-col justify-between gap-3 md:flex-row md:items-center",children:[ee("div",{children:[ee("div",{className:"flex items-center gap-2",children:[ne("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"}),ne("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"}),ne("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:To(t)})]}),ne("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"})]}),ee("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:"," ",ne("span",{className:"ml-1.5 font-bold text-slate-800","data-testid":"ontology-tenant-id",children:e})]})]}),ee("div",{className:"mt-4 grid grid-cols-2 gap-3 sm:grid-cols-4",children:[ee("div",{className:"rounded-lg border border-slate-200 border-solid bg-slate-50/70 p-3",children:[ne("span",{className:"block text-slate-500 text-xs",children:"\u7269\u7406\u4E00\u610F\u5236\u7D04 (Unique)"}),ne("span",{className:"mt-1 block font-bold font-mono text-base text-slate-900","data-testid":"ontology-constraints-count",children:ia(t.totalConstraints)})]}),ee("div",{className:"rounded-lg border border-slate-200 border-solid bg-slate-50/70 p-3",children:[ne("span",{className:"block text-slate-500 text-xs",children:"\u691C\u7D22\u7D22\u5F15 (DDL \u304C\u4F5C\u308B\u5206)"}),ne("span",{className:"mt-1 block font-bold font-mono text-base text-slate-900","data-testid":"ontology-indexes-count",children:ia(t.searchIndexes)}),ee("span",{className:"block text-slate-500 text-xs","data-testid":"ontology-indexes-total",children:["\u5168\u7D22\u5F15: ",ia(t.totalIndexes)]})]}),ee("div",{className:"rounded-lg border border-slate-200 border-solid bg-slate-50/70 p-3",children:[ne("span",{className:"block text-slate-500 text-xs",children:"\u6607\u683C\u5224\u5B9A\u3057\u304D\u3044\u5024 (\u78BA\u4FE1\u5EA6/\u5171\u8D77)"}),ee("span",{className:"mt-1 block font-bold font-mono text-base text-indigo-700","data-testid":"ontology-thresholds-info",children:[Ut(t.promotionThresholds.confidence)," / ",Ut(t.promotionThresholds.cooccurrence," \u56DE")]})]}),ee("div",{className:"rounded-lg border border-slate-200 border-solid bg-slate-50/70 p-3",children:[ne("span",{className:"block text-slate-500 text-xs",children:"HITL \u6607\u683C\u627F\u8A8D\u5F85\u3061\u5019\u88DC"}),ne("span",{className:"mt-1 block font-bold font-mono text-amber-700 text-base","data-testid":"ontology-unresolved-count",children:ia(t.unresolvedCandidatesCount)})]})]})]}),ee("div",{className:"grid grid-cols-1 gap-6 lg:grid-cols-2",children:[ee("div",{className:"rounded-xl border border-slate-200 border-solid bg-white p-6 shadow-sm",children:[ee("div",{className:"flex items-center justify-between pb-3",children:[ee("div",{children:[ne("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)"}),ne("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"})]}),ne("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:hs(a)})]}),ee("div",{className:"divide-y divide-solid divide-slate-100",children:[a===null&&ne("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"}),a?.map(r=>ee("div",{className:"flex items-start justify-between py-2.5","data-testid":`ontology-class-${r.name}`,children:[ee("div",{children:[ne("span",{className:"inline-block font-bold font-mono text-indigo-700 text-xs",children:r.name}),ne("p",{className:"mt-0.5 text-slate-600 text-xs",children:r.description})]}),typeof r.count=="number"&&ne("span",{className:"rounded-sm bg-slate-100 px-2 py-0.5 font-mono text-slate-600 text-xs",children:r.count.toLocaleString()})]},r.name))]})]}),ee("div",{className:"rounded-xl border border-slate-200 border-solid bg-white p-6 shadow-sm",children:[ee("div",{className:"flex items-center justify-between pb-3",children:[ee("div",{children:[ne("h3",{className:"font-bold text-slate-900 text-sm",children:"\u30EA\u30EC\u30FC\u30B7\u30E7\u30F3\u30B7\u30C3\u30D7\u8FF0\u8A9E\u4F53\u7CFB (Predicates)"}),ne("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"})]}),ne("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:hs(n)})]}),ee("div",{className:"divide-y divide-solid divide-slate-100",children:[n===null&&ne("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"}),n?.map(r=>ee("div",{className:"flex items-start justify-between py-2.5","data-testid":`ontology-predicate-${r.name}`,children:[ee("div",{children:[ne("span",{className:"inline-block font-bold font-mono text-amber-800 text-xs",children:r.name}),ne("p",{className:"mt-0.5 text-slate-600 text-xs",children:r.description})]}),ne("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:r.direction})]},r.name))]})]})]}),ee("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:[ne("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"}),ee("div",{className:"mt-2 grid grid-cols-1 gap-3 text-indigo-900 text-xs md:grid-cols-3",children:[ee("div",{className:"rounded-lg border border-indigo-200/60 border-solid bg-white p-3",children:[ne("span",{className:"font-semibold text-slate-700",children:"3 \u6761\u4EF6 AND \u30B2\u30FC\u30C8:"}),ee("p",{className:"mt-1 text-slate-600",children:["\u672A\u89E3\u6C7A\u30E1\u30F3\u30B7\u30E7\u30F3\u51FA\u73FE\u6642\u306B\u985E\u4F3C\u5EA6 \u2267 ",Ut(t.promotionThresholds.confidence),"\u3001\u5171\u8D77\u56DE\u6570 \u2267 ",Ut(t.promotionThresholds.cooccurrence),"\u3001\u8B58\u5225\u30E6\u30FC\u30B6\u30FC\u6570 \u2267"," ",Ut(t.promotionThresholds.minDistinctUsers)," \u306E\u5168\u5145\u8DB3\u3092\u8981\u6C42\u3002"]})]}),ee("div",{className:"rounded-lg border border-indigo-200/60 border-solid bg-white p-3",children:[ne("span",{className:"font-semibold text-slate-700",children:"2x \u5171\u8D77\u983B\u5EA6\u518D\u63D0\u6848\u30D0\u30C3\u30AF\u30AA\u30D5:"}),ne("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"})]}),ee("div",{className:"rounded-lg border border-indigo-200/60 border-solid bg-white p-3",children:[ne("span",{className:"font-semibold text-slate-700",children:"Cypher AST ABAC \u8A8D\u53EF\u6CE8\u5165:"}),ee("p",{className:"mt-1 text-slate-600",children:["Neo4j \u30AF\u30A8\u30EA\u5B9F\u884C\u6642\u306B ",ne("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 yt,DOCUMENT_KINDS as da,flowFor as Uo,flowStepGates as Ns,MIME_KIND_RULES as Ko,PIPELINE_STEPS as Ga}from"@aiquants/enrichment-core";import{useEffect as Ho,useId as Ht,useRef as la,useState as Ba}from"react";import{ceil8 as Po,textWidthEm as Lo}from"@aiquants/console-ui/core";import{orderedSteps as $o,PIPELINE_STEPS as Do}from"@aiquants/enrichment-core";var _t={inset:12,labelFontSize:13,captionFontSize:11},bt={offset:3,stroke:2},Ao={node:{width:Po(Math.max(...Object.values(Do).map(e=>Lo(e.label)))*_t.labelFontSize+2*_t.inset),height:56},gap:{column:48,row:24},padding:24};function it(e){return Math.round(e*1e3)/1e3}function Mo(e){let t=new Map;for(let a of e){let n=a.dependsOn.reduce((r,s)=>Math.max(r,t.get(s)),-1);t.set(a.step,n+1)}return t}function Ha(e,t){return`${e}->${t}`}function Oo(e,t){let a=[],n=new Map;return{slots:[...e.map(s=>{let o=t.get(s.step),u=s.dependsOn.map(d=>{let h=[],_=d;for(let R=t.get(d)+1;R<o;R+=1){let l=`${Ha(d,s.step)}@${R}`;a.push({id:l,rank:R,predecessors:[_]}),h.push(l),_=l}return n.set(Ha(d,s.step),h),_});return{id:s.step,rank:o,predecessors:u}}),...a],chains:n}}function Fo(e){let t=new Map,a=Math.max(...e.map(n=>n.rank));for(let n=0;n<=a;n+=1){let s=e.filter(o=>o.rank===n).map((o,u)=>{let d=n===0?u:o.predecessors.reduce((h,_)=>h+t.get(_),0)/o.predecessors.length;return{slot:o,barycenter:d}});s.sort((o,u)=>o.barycenter-u.barycenter),s.forEach(({slot:o},u)=>{t.set(o.id,u)})}return t}function vs(e,t=Ao){let a=$o(e),n=Mo(a),{slots:r,chains:s}=Oo(a,n),o=Fo(r),{node:u,gap:d,padding:h}=t,_=P=>({x:it(h+P.rank*(u.width+d.column)),y:it(h+o.get(P.id)*(u.height+d.row))}),R=new Map(r.map(P=>[P.id,_(P)])),l=a.map(P=>{let O=R.get(P.step);return{key:P.step,x:O.x,y:O.y,rank:n.get(P.step),order:o.get(P.step),width:u.width,height:u.height}}),C=P=>it(P+u.height/2),$=a.flatMap(P=>P.dependsOn.map(O=>{let Q=R.get(O),G=R.get(P.step),Z=it(Q.x+u.width),F=C(Q.y),H=`M ${Z} ${F}`,re=(E,q)=>{let Y=it((Z+E)/2);H+=` C ${Y} ${F}, ${Y} ${q}, ${E} ${q}`};for(let E of s.get(Ha(O,P.step))){let q=R.get(E),Y=C(q.y);re(q.x,Y),Z=it(q.x+u.width),F=Y,H+=` L ${Z} ${F}`}return re(G.x,C(G.y)),{from:O,to:P.step,path:H}})),m=[...R.values()],I=it(Math.max(...m.map(P=>P.x+u.width))+h),S=it(Math.max(...m.map(P=>P.y+u.height))+h);return{width:I,height:S,steps:l,edges:$}}import{Fragment as Rs,jsx as w,jsxs as B}from"react/jsx-runtime";var Is="\u4F9D\u5B58\u306A\u3057 (\u6D41\u308C\u306E\u6700\u521D\u306B\u8D70\u308B)",Ss={EXTRACTING:"\u62BD\u51FA",ENRICHING:"\u8981\u7D04",PROJECTING:"\u6295\u5F71"},Bo={rebuild:"\u672C\u6587\u304B\u3089\u7D44\u307F\u76F4\u3059",existing:"\u524D\u6BB5\u304C\u66F8\u3044\u305F\u884C\u3092\u305D\u306E\u307E\u307E\u4F7F\u3046"},ks={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"}},ws={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"},Go={open:"\u958B",closed:"\u9589",unmeasured:"\u672A\u6E2C\u5B9A"},Bt="rgb(248 250 252)",qo={backgroundColor:Bt,backgroundImage:`linear-gradient(to right, ${Bt}, ${Bt}), linear-gradient(to right, ${Bt}, ${Bt}), 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 Cs(e,t){let a=t[e.featureFlagKey];return a===void 0?"unmeasured":a?"open":"closed"}function Vo(e,t){let a=e.map(n=>({gate:n,state:Cs(n,t)}));return a.some(({gate:n,state:r})=>r==="closed"&&n.whenClosed==="fail")?"closed-fail":a.some(({state:n})=>n==="closed")?"closed-skip":a.some(({state:n})=>n==="unmeasured")?"unmeasured":"open"}function Es(e){return e.length===0?"none":e.every(t=>t.whenClosed==="fail")?"fail":e.every(t=>t.whenClosed==="skip")?"skip":"mixed"}function Wo(e,t){let{badge:a}=ks[e];return t==="none"||e==="closed-skip"||e==="closed-fail"?a:`${a}\u30FB${ws[t]}`}function zo(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 qa(e){return e.map(t=>Ga[t].label).join("\u3001")}function jo(e){return e.dependsOn.length===0?Is:`\u4F9D\u5B58: ${qa(e.dependsOn)}`}function Ml({featureFlags:e,metrics:t,metricSampleWindow:a,selectedKind:n,onSelectKind:r,selectedStepKey:s,onSelectStep:o}){if(!Number.isSafeInteger(a)||a<=0)throw new RangeError(`metricSampleWindow must be a positive integer, got ${a}.`);let u=Ht(),d=Ht(),h=Ht(),_=Ht(),R=Ht(),[l,C]=Ba(da[0]),[$,m]=Ba(null),[I,S]=Ba(null),P=la(new Map),O=la(new Map),Q=la(null),G=la(null),{labels:Z}=M(),F=n!==void 0?n:l,H=s!==void 0?s:$,re=Uo(F),E=vs(re),q=new Map(re.steps.map(f=>[f.step,f])),Y=f=>{m(f),o?.(f)},fe=f=>{C(f),r?.(f),Y(null)},Ke=(f,z)=>{let he=da.length-1,le;switch(f.key){case"ArrowRight":le=z===he?0:z+1;break;case"ArrowLeft":le=z===0?he:z-1;break;case"Home":le=0;break;case"End":le=he;break;default:return}f.preventDefault();let pe=da[le];fe(pe),P.current.get(pe)?.focus()},D=f=>{let z=G.current;if(Y(null),z?.isConnected){z.focus();return}O.current.get(f)?.focus()},we=f=>{Y(f===H?null:f)},se=(f,z)=>{f.currentTarget.focus(),we(z)},de=(f,z)=>{f.key==="Enter"||f.key===" "?(f.preventDefault(),we(z)):f.key==="Escape"&&Y(null)},U=H===null?void 0:q.get(H),ce=U===void 0?null:U.step;Ho(()=>{if(ce===null){G.current=null;return}let f=document.activeElement;(f instanceof HTMLElement||f instanceof SVGElement)&&f!==document.body&&Q.current?.contains(f)===!1&&(G.current=f)},[ce]);let J=U===void 0?void 0:Ga[U.step],Ce=U===void 0?[]:Ns(U),Ge=U===void 0?[]:re.steps.filter(f=>f.dependsOn.includes(U.step)).map(f=>f.step),Pe=J===void 0?void 0:t.find(f=>f.documentKind===F&&f.stepKey===J.key),Ne=yt[F];return B("section",{className:"space-y-6","aria-labelledby":u,"data-testid":"pipeline-flow-viewer","data-kind":F,children:[B("div",{className:"rounded-xl border border-slate-200 border-solid bg-white p-6 shadow-sm",children:[w("h2",{id:u,className:"font-bold text-base text-slate-900",children:"\u53D6\u308A\u8FBC\u307F\u30D1\u30A4\u30D7\u30E9\u30A4\u30F3"}),w("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"}),w("div",{role:"tablist","aria-label":"\u6587\u66F8\u306E\u7A2E\u985E",className:"mt-4 flex flex-wrap gap-2","data-testid":"flow-kind-tablist",children:da.map((f,z)=>{let he=f===F;return w("button",{ref:le=>{le===null?P.current.delete(f):P.current.set(f,le)},type:"button",role:"tab","aria-selected":he,"aria-controls":d,tabIndex:he?0:-1,onClick:()=>fe(f),onKeyDown:le=>Ke(le,z),className:he?"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-${f}`,children:yt[f]},f)})}),w("div",{id:d,role:"tabpanel","aria-label":`${yt[F]} \u306E\u6D41\u308C`,"aria-describedby":h,className:"mt-4 overflow-x-auto rounded-lg border border-slate-200 border-solid p-4",style:qo,"data-testid":"flow-scroll",children:B("svg",{viewBox:`0 0 ${E.width} ${E.height}`,width:E.width,height:E.height,role:"group","aria-label":`${yt[F]} \u306E\u30D1\u30A4\u30D7\u30E9\u30A4\u30F3`,style:{display:"block",maxWidth:"none"},"data-testid":"flow-svg",children:[w("title",{children:`${yt[F]} \u306E\u30D1\u30A4\u30D7\u30E9\u30A4\u30F3`}),w("defs",{children:w("marker",{id:`${d}-arrow`,viewBox:"0 0 8 8",refX:"8",refY:"4",markerWidth:"8",markerHeight:"8",orient:"auto",children:w("path",{d:"M 0 0 L 8 4 L 0 8 z",className:"fill-slate-500","data-testid":"flow-edge-arrowhead"})})}),E.edges.map(f=>w("path",{d:f.path,fill:"none",strokeWidth:1.5,markerEnd:`url(#${d}-arrow)`,className:"stroke-slate-500","data-testid":`flow-edge-${f.from}-${f.to}`},`${f.from}-${f.to}`)),E.steps.map(f=>{let z=Ga[f.key],he=q.get(f.key),le=Ns(he),pe=Vo(le,e),Se=Es(le),Ze=ks[pe],Ve=Wo(pe,Se),Ae=f.key===H,te=f.key===I,Ye=`${d}-depends-${f.key}`;return B("g",{ref:Me=>{Me===null?O.current.delete(f.key):O.current.set(f.key,Me)},transform:`translate(${f.x} ${f.y})`,role:"button",tabIndex:0,"aria-label":`${z.label} (${Ve})`,"aria-describedby":Ye,"aria-expanded":Ae,"aria-controls":Ae?R:void 0,onClick:Me=>se(Me,f.key),onKeyDown:Me=>de(Me,f.key),onFocus:()=>S(f.key),onBlur:()=>S(null),className:"cursor-pointer focus:outline-none","data-testid":`flow-node-${f.key}`,"data-step-key":f.key,"data-gate-state":pe,"data-gate-policy":Se,"data-selected":Ae,"data-focused":te,children:[w("desc",{id:Ye,"data-testid":`flow-node-dependencies-${f.key}`,children:jo(he)}),te&&w("rect",{x:-bt.offset,y:-bt.offset,width:f.width+2*bt.offset,height:f.height+2*bt.offset,rx:8+bt.offset,fill:"none",strokeWidth:bt.stroke,className:"stroke-indigo-600","data-testid":`flow-node-focus-ring-${f.key}`}),w("rect",{width:f.width,height:f.height,rx:8,strokeWidth:Ae?3:1.5,strokeDasharray:Ze.dash,className:`${Ze.stroke} ${Ae?"fill-indigo-50":"fill-white"}`,"data-testid":`flow-node-box-${f.key}`}),w("text",{x:_t.inset,y:20,className:"fill-slate-900 font-semibold text-[13px]","data-testid":`flow-node-label-${f.key}`,children:z.label}),w("text",{x:_t.inset,y:36,className:"fill-slate-600 text-[11px]","data-testid":`flow-node-phase-${f.key}`,children:Ss[z.phase]}),w("text",{x:_t.inset,y:49,className:"fill-slate-700 text-[11px]","data-testid":`flow-gate-badge-${f.key}`,"data-gate-state":pe,children:Ve})]},f.key)})]})}),B("p",{id:h,className:"mt-2 text-[11px] text-slate-500","data-testid":"flow-scroll-hint",children:["\u56F3\u306F\u5B9F\u5BF8 (\u5E45 ",E.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"]})]}),J!==void 0&&U!==void 0&&B("section",{id:R,ref:Q,className:"rounded-xl border border-slate-200 border-solid bg-white p-6 shadow-sm","aria-labelledby":_,"data-testid":"flow-step-detail","data-step-key":J.key,children:[B("div",{className:"flex items-start justify-between gap-4",children:[B("div",{children:[w("h3",{id:_,className:"font-bold text-base text-slate-900",children:J.label}),w("p",{className:"mt-1 text-[13px] text-slate-600",children:J.description})]}),w("button",{type:"button",onClick:()=>D(J.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"})]}),B("dl",{className:"mt-4 grid grid-cols-1 gap-3 text-[13px] sm:grid-cols-2",children:[B("div",{children:[w("dt",{className:"font-semibold text-slate-500",children:"\u30A8\u30F3\u30C9\u30DD\u30A4\u30F3\u30C8"}),w("dd",{children:w("code",{className:"font-mono","data-testid":"flow-step-endpoint",children:J.endpoint})})]}),B("div",{children:[w("dt",{className:"font-semibold text-slate-500",children:"\u76F8"}),B("dd",{"data-testid":"flow-step-phase",children:[Ss[J.phase]," (",J.phase,")"]})]}),B("div",{children:[w("dt",{className:"font-semibold text-slate-500",children:"\u80FD\u529B"}),w("dd",{"data-testid":"flow-step-capability",children:J.capability===null?"\u30E2\u30C7\u30EB\u3078\u9001\u3089\u306A\u3044":J.capability})]}),U.chunkSource!==void 0&&B("div",{children:[w("dt",{className:"font-semibold text-slate-500",children:"\u30C1\u30E3\u30F3\u30AF\u306E\u51FA\u6240"}),B("dd",{"data-testid":"flow-step-chunk-source","data-chunk-source":U.chunkSource,children:[Bo[U.chunkSource]," (",U.chunkSource,")"]})]}),B("div",{className:"sm:col-span-2",children:[w("dt",{className:"font-semibold text-slate-500",children:"\u4F9D\u5B58 (\u5148\u306B\u7D42\u3048\u308B\u6BB5)"}),w("dd",{"data-testid":"flow-step-depends-on",children:U.dependsOn.length===0?Is:qa(U.dependsOn)})]}),B("div",{className:"sm:col-span-2",children:[w("dt",{className:"font-semibold text-slate-500",children:"\u5F8C\u7D9A (\u3053\u306E\u6BB5\u3092\u5F85\u3064\u6BB5)"}),w("dd",{"data-testid":"flow-step-dependents",children:Ge.length===0?"\u5F8C\u7D9A\u306A\u3057 (\u6D41\u308C\u306E\u6700\u5F8C\u306B\u8D70\u308B)":qa(Ge)})]}),B("div",{className:"sm:col-span-2",children:[w("dt",{className:"font-semibold text-slate-500",children:"\u9580"}),w("dd",{children:Ce.length===0?w("span",{"data-testid":"flow-step-no-gates",children:"\u9580\u306A\u3057 (\u5E38\u306B\u8D70\u308B)"}):B(Rs,{children:[w("ul",{className:"space-y-1",children:Ce.map(f=>{let z=Cs(f,e);return B("li",{"data-testid":`flow-gate-${f.featureFlagKey}`,"data-gate-state":z,"data-when-closed":f.whenClosed,children:[w("code",{className:"font-mono",children:f.featureFlagKey}),": ",Go[z]," \u2014 ",zo(f)]},f.featureFlagKey)})}),U.gatePolicy!==void 0&&B("p",{className:"mt-1 text-slate-600","data-testid":"flow-gate-policy-override",children:[Ne," \u306E\u6D41\u308C\u3067\u306F\u6BB5\u306E\u5BA3\u8A00 (",ws[Es(J.gates)],") \u3092\u4E0A\u66F8\u304D\u3057\u3001\u9580\u304C\u9589\u3058\u308B\u3068\u5B9F\u884C\u3092 ",U.gatePolicy.failureStatus," \u3067\u5931\u6557\u3055\u305B\u307E\u3059\u3002"]})]})})]})]}),B("div",{className:"mt-4 rounded-lg border border-slate-200 border-solid bg-slate-50 p-4","data-testid":"flow-step-metric","data-kind":F,children:[B("span",{className:"block font-semibold text-[13px] text-slate-700",children:["\u76F4\u8FD1\u306E\u96C6\u8A08 (",Ne,"\u30FB\u76F4\u8FD1 ",a," \u4EF6)"]}),B("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 ",a," \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"]}),Pe===void 0?B("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)"]}):B(Rs,{children:[B("dl",{className:"mt-2 grid grid-cols-2 gap-2 text-[13px] sm:grid-cols-4",children:[B("div",{children:[w("dt",{className:"text-slate-500",children:"\u6A19\u672C\u6570 (\u7701\u7565\u3092\u9664\u304F)"}),w("dd",{"data-testid":"flow-metric-sample-count",children:w(ae,{value:Pe.sampleCount,testId:"flow-metric-sample-count-value"})})]}),B("div",{children:[w("dt",{className:"text-slate-500",children:"\u6210\u529F"}),w("dd",{"data-testid":"flow-metric-succeeded",children:w(ae,{value:Pe.succeeded,testId:"flow-metric-succeeded-value"})})]}),B("div",{children:[w("dt",{className:"text-slate-500",children:"\u5931\u6557"}),w("dd",{"data-testid":"flow-metric-failed",children:w(ae,{value:Pe.failed,testId:"flow-metric-failed-value"})})]}),B("div",{children:[w("dt",{className:"text-slate-500",children:"\u7701\u7565"}),w("dd",{"data-testid":"flow-metric-skipped",children:w(ae,{value:Pe.skipped,testId:"flow-metric-skipped-value"})})]}),B("div",{children:[w("dt",{className:"text-slate-500",children:"p50"}),w("dd",{className:"whitespace-nowrap","data-testid":"flow-metric-p50",children:w(ae,{value:Pe.durationP50Ms,unit:"ms",testId:"flow-metric-p50-value"})})]}),B("div",{children:[w("dt",{className:"text-slate-500",children:"p95"}),w("dd",{className:"whitespace-nowrap","data-testid":"flow-metric-p95",children:w(ae,{value:Pe.durationP95Ms,unit:"ms",testId:"flow-metric-p95-value"})})]}),B("div",{className:"col-span-2",children:[w("dt",{className:"text-slate-500",children:"\u6700\u5F8C\u306E\u958B\u59CB"}),w("dd",{"data-testid":"flow-metric-last-started-at",children:w(ge,{iso:Pe.lastStartedAt,testId:"flow-metric-last-started-at-value"})})]})]}),B("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"]})]})]})]}),B("div",{className:"rounded-xl border border-slate-200 border-solid bg-white p-6 shadow-sm",children:[w("h3",{className:"font-bold text-base text-slate-900",children:"MIME \u578B\u304B\u3089\u7A2E\u985E\u3078\u306E\u5206\u985E\u8868"}),B("p",{className:"mt-1 text-[13px] text-slate-500",children:["\u5206\u985E\u5668\u304C\u8AAD\u3080\u8868\u305D\u306E\u3082\u306E\u3067\u3059\u3002",w("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",yt.other,"\u300D\u3067\u3059\u3002"]}),w("div",{className:"relative mt-4 overflow-x-auto","data-testid":"flow-mime-scroll",children:B("table",{className:"min-w-full divide-y divide-solid divide-slate-200 text-left text-[13px]","data-testid":"flow-mime-table",children:[w("thead",{className:"bg-slate-50 font-semibold text-slate-700",children:B("tr",{children:[w("th",{scope:"col",className:"px-3 py-2",children:"MIME \u578B\u306E\u30D1\u30BF\u30FC\u30F3"}),w("th",{scope:"col",className:"px-3 py-2",children:"\u7A2E\u985E"})]})}),w("tbody",{className:"divide-y divide-solid divide-slate-100",children:Ko.map(([f,z],he)=>B("tr",{className:z===F?"bg-indigo-50":void 0,"data-testid":`flow-mime-rule-${he}`,"data-kind":z,"data-selected":z===F,children:[w("td",{className:"px-3 py-2",children:w("code",{className:"font-mono",children:f})}),w("td",{className:"px-3 py-2",children:yt[z]})]},f))})]})})]})]})}import{cssVar as za}from"@aiquants/console-ui/core";import{useId as Xo}from"react";import{Fragment as ri,jsx as K,jsxs as ve}from"react/jsx-runtime";function Yo(e,t){return e==null?null:ft(e,"segment_count",t)}function _s(e,t,a){return e==null?null:sa(e,t,a)}function Jo(e){let t=e.probe_failure;if(t===null)return null;if(!Dt.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 Ts(e,t,a){return e.reduce((n,r)=>n+ft(r[t],`${t} of collection ${r.collection_name}`,a),0)}var Qo=za("space-1"),Zo={padding:0,height:"1px",color:"#1e293b"},ei={display:"flex",height:"100%"},ti={fontWeight:500,marginBlock:"auto",overflowWrap:"normal"},ai={display:"flex",alignItems:"baseline",gap:"12px",marginBottom:"12px"},ni={display:"flex",flexWrap:"wrap",alignItems:"baseline",columnGap:"10px",rowGap:"4px",flex:"1 1 0%",minWidth:0},Va={whiteSpace:"nowrap"},Ps=za("space-3"),si=za("info-tint"),Wa={fontSize:"11px",padding:"2px 6px",borderRadius:"4px",whiteSpace:"nowrap"};function Ls(e,t){return`vectors_config.${e}.size of collection ${t}`}function Wl({overview:e,health:t,resources:a,onRefresh:n,isRefreshing:r=!1,selection:s}){let{formatLocale:o}=M(),u=Xo(),{collections:d}=e,h=Jo(e),_=h===null,R=_?Ts(d,"points_count",o):null,l=_?Ts(d,"vectors_count",o):null,C=_s(a?.ram_bytes,"ram_bytes",o),$=_s(a?.disk_bytes,"disk_bytes",o),m=Yo(a?.segment_count,o);return ve("div",{"data-testid":"qdrant-storage-card",style:{border:"1px solid #e2e8f0",borderRadius:"8px",padding:"16px",backgroundColor:"#ffffff"},children:[ve("div",{"data-testid":"qdrant-card-header",style:ai,children:[ve("div",{"data-testid":"qdrant-card-title-group",style:ni,children:[K("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&&ve(ri,{children:[K("span",{"data-testid":"qdrant-health-badge","data-healthy":String(t.healthy),...wt[t.healthy?"connected":"error"],style:{...Va,fontSize:"12px",padding:"2px 8px",borderRadius:"12px",fontWeight:600},children:kt[t.healthy?"connected":"error"]}),ve("span",{"data-testid":"qdrant-latency",style:{...Va,fontSize:"12px",color:"#64748b"},children:["\u5FDC\u7B54\u6642\u9593: ",K(ae,{value:t.latency_ms,unit:"ms",testId:"qdrant-latency-value"})]})]})]}),n&&K("button",{type:"button","data-testid":"qdrant-refresh-button",disabled:r,onClick:n,style:{...Va,flexShrink:0,padding:"6px 12px",borderRadius:"4px",border:"1px solid #cbd5e1",backgroundColor:"#ffffff",cursor:r?"not-allowed":"pointer",fontSize:"13px"},children:r?"\u66F4\u65B0\u4E2D\u2026":"\u66F4\u65B0"})]}),ve("div",{style:{display:"grid",gridTemplateColumns:"repeat(auto-fit, minmax(140px, 1fr))",gap:"10px",marginBottom:"16px",padding:"10px",backgroundColor:"#f8fafc",borderRadius:"6px"},children:[ve("div",{children:[K("div",{style:{fontSize:"12px",color:"#64748b"},children:"\u7DCF\u30DD\u30A4\u30F3\u30C8\u6570"}),K("div",{"data-testid":"qdrant-total-points",style:{fontSize:"18px",fontWeight:700,color:"#0f172a"},children:K(ae,{value:R,testId:"qdrant-total-points-value"})})]}),ve("div",{children:[K("div",{style:{fontSize:"12px",color:"#64748b"},children:"\u7DCF\u30D9\u30AF\u30C8\u30EB\u6570"}),K("div",{"data-testid":"qdrant-total-vectors",style:{fontSize:"18px",fontWeight:700,color:"#0f172a"},children:K(ae,{value:l,testId:"qdrant-total-vectors-value"})})]}),ve("div",{children:[K("div",{style:{fontSize:"12px",color:"#64748b"},children:"\u30E1\u30E2\u30EA\u6D88\u8CBB (RAM)"}),K("div",{"data-testid":"qdrant-ram-usage",style:{fontSize:"18px",fontWeight:700,color:"#0f172a"},children:K(Fe,{text:C,testId:"qdrant-ram-usage-value"})})]}),ve("div",{children:[K("div",{style:{fontSize:"12px",color:"#64748b"},children:"\u30C7\u30A3\u30B9\u30AF\u6D88\u8CBB"}),K("div",{"data-testid":"qdrant-disk-usage",style:{fontSize:"18px",fontWeight:700,color:"#0f172a"},children:K(Fe,{text:$,testId:"qdrant-disk-usage-value"})})]}),ve("div",{children:[K("div",{style:{fontSize:"12px",color:"#64748b"},children:"\u30BB\u30B0\u30E1\u30F3\u30C8\u7DCF\u6570"}),K("div",{"data-testid":"qdrant-segment-count",style:{fontSize:"18px",fontWeight:700,color:"#0f172a"},children:K(ae,{value:m,testId:"qdrant-segment-count-value"})})]})]}),ve("div",{children:[ve("h3",{id:u,style:{margin:"0 0 8px 0",fontSize:"14px",color:"#334155"},children:["\u30B3\u30EC\u30AF\u30B7\u30E7\u30F3\u4E00\u89A7 (",K(ae,{value:_?d.length:null,unit:"\u4EF6",testId:"qdrant-collections-count"}),")"]}),h!==null?K("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}):d.length===0?K("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"}):K("section",{tabIndex:0,"aria-labelledby":u,"data-testid":"qdrant-collections-scroll",style:{overflowX:"auto",WebkitOverflowScrolling:"touch",padding:Qo},children:ve("table",{"aria-labelledby":u,"data-testid":"qdrant-collections-list",style:{width:"100%",borderCollapse:"collapse",fontSize:"13px"},children:[K("thead",{children:ve("tr",{style:{borderBottom:"1px solid #e2e8f0",color:"#64748b"},children:[K("th",{scope:"col","data-testid":"qdrant-collections-name-header",style:{padding:`6px ${Ps}`,textAlign:"start"},children:"\u30B3\u30EC\u30AF\u30B7\u30E7\u30F3\u540D"}),K("th",{scope:"col",style:{padding:"6px 8px",textAlign:"start"},children:"\u30C9\u30E1\u30A4\u30F3"}),K("th",{scope:"col","data-testid":"qdrant-collections-points-header",style:{padding:"6px 8px",textAlign:"end"},children:"\u30DD\u30A4\u30F3\u30C8\u6570"}),K("th",{scope:"col",style:{padding:"6px 8px",textAlign:"start"},children:"\u30D9\u30AF\u30C8\u30EB\u69CB\u6210"})]})}),K("tbody",{children:d.map(I=>{let S=s!==void 0&&I.collection_name===s.selectedCollectionName,P=K("span",{style:ti,children:I.collection_name}),{dense:O,sparse:Q,image:G}=I.vectors_config,Z=O===void 0?null:ft(O.size,Ls("dense",I.collection_name),o),F=G===void 0?null:ft(G.size,Ls("image",I.collection_name),o);return ve("tr",{"data-testid":`collection-row-${I.collection_name}`,"data-collection-name":I.collection_name,"data-selected":String(S),style:{borderBottom:"1px solid #f1f5f9",backgroundColor:S?si:"transparent"},children:[s===void 0?K("td",{style:{padding:`8px ${Ps}`,color:"#1e293b"},children:P}):K("td",{style:Zo,children:K("div",{style:ei,children:K(bn,{selected:S,controls:s.detailId,onSelect:()=>s.onSelectCollection(I.collection_name),testId:`collection-select-${I.collection_name}`,children:P})})}),K("td",{style:{padding:"8px",color:"#475569"},children:I.domain_key}),K("td",{"data-testid":`collection-points-${I.collection_name}`,style:{padding:"8px",color:"#0f172a",textAlign:"end"},children:K(ae,{value:I.points_count,testId:`collection-points-value-${I.collection_name}`})}),K("td",{style:{padding:"8px"},children:ve("div",{style:{display:"flex",gap:"6px",flexWrap:"wrap"},children:[Z!==null&&ve("span",{"data-testid":`vector-tag-dense-${I.collection_name}`,style:{...Wa,backgroundColor:"#e0e7ff",color:"#3730a3"},children:["Dense: ",K(ae,{value:Z,unit:"\u6B21\u5143",testId:`vector-tag-dense-size-${I.collection_name}`})]}),Q!==void 0&&K("span",{"data-testid":`vector-tag-sparse-${I.collection_name}`,style:{...Wa,backgroundColor:"#fef3c7",color:"#92400e"},children:Q.modifier?`Sparse (${Q.modifier.toUpperCase()})`:"Sparse"}),F!==null&&ve("span",{"data-testid":`vector-tag-image-${I.collection_name}`,style:{...Wa,backgroundColor:"#f3e8ff",color:"#6b21a8"},children:["Image: ",K(ae,{value:F,unit:"\u6B21\u5143",testId:`vector-tag-image-size-${I.collection_name}`})]})]})})]},I.collection_name)})})]})})]})]})}import{jsx as W,jsxs as ke}from"react/jsx-runtime";var oi="\u5BFE\u8C61\u306A\u3057";function Ql({counts:e,totalFiles:t,failedItems:a=[],onRetryAll:n,onRetryItem:r,isRetrying:s=!1,onRefresh:o,listRefusal:u}){M();let d=e.SYNCED??0,h=e.PENDING??0,_=(e.EXTRACTING??0)+(e.ENRICHING??0)+(e.PROJECTING??0),R=(e.FAILED_EXTRACT??0)+(e.FAILED_ENRICH??0)+(e.FAILED_VECTOR??0)+(e.FAILED_GRAPH??0),l=t>0?`${(d/t*100).toFixed(1)}%`:oi;return ke("div",{"data-testid":"sync-status-monitor",style:{border:"1px solid #e2e8f0",borderRadius:"8px",padding:"16px",backgroundColor:"#ffffff"},children:[ke("div",{style:{display:"flex",justifyContent:"space-between",alignItems:"center",marginBottom:"16px"},children:[ke("div",{children:[W("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"}),ke("p",{style:{margin:"4px 0 0 0",fontSize:"13px",color:"#64748b"},children:["\u7DCF\u30D5\u30A1\u30A4\u30EB\u6570:"," ",W("span",{"data-testid":"total-files-count",style:{fontWeight:600},children:t})," ","\u4EF6 (\u540C\u671F\u5B8C\u4E86\u7387: ",W("span",{"data-testid":"success-rate-value",children:l}),")"]})]}),ke("div",{style:{display:"flex",gap:"8px"},children:[o&&W("button",{type:"button","data-testid":"sync-refresh-button",onClick:o,style:{padding:"6px 12px",borderRadius:"4px",border:"1px solid #cbd5e1",backgroundColor:"#ffffff",cursor:"pointer",fontSize:"13px"},children:"\u66F4\u65B0"}),n&&W("button",{type:"button","data-testid":"retry-all-button",disabled:s||R===0,onClick:n,style:{padding:"6px 14px",borderRadius:"4px",border:"none",backgroundColor:s||R===0?"#94a3b8":"#dc2626",color:"#ffffff",cursor:s||R===0?"not-allowed":"pointer",fontSize:"13px",fontWeight:500},children:s?"\u518D\u8A66\u884C\u4E2D...":"\u5931\u6557\u30B8\u30E7\u30D6\u4E00\u62EC\u518D\u8A66\u884C"})]})]}),ke("div",{style:{display:"grid",gridTemplateColumns:"repeat(auto-fit, minmax(130px, 1fr))",gap:"10px",marginBottom:"20px"},children:[ke("div",{"data-testid":"status-card-synced","data-count":d,style:{border:"1px solid #10b981",borderRadius:"6px",padding:"10px",backgroundColor:"#ecfdf5"},children:[W("div",{style:{fontSize:"12px",color:"#065f46"},children:"\u5B8C\u5168\u540C\u671F (SYNCED)"}),W("div",{"data-testid":"synced-count",style:{fontSize:"20px",fontWeight:700,color:"#047857"},children:d})]}),ke("div",{"data-testid":"status-card-processing","data-count":_,style:{border:"1px solid #3b82f6",borderRadius:"6px",padding:"10px",backgroundColor:"#eff6ff"},children:[W("div",{style:{fontSize:"12px",color:"#1e40af"},children:"\u51E6\u7406\u4E2D (PROCESSING)"}),W("div",{"data-testid":"processing-count",style:{fontSize:"20px",fontWeight:700,color:"#1d4ed8"},children:_})]}),ke("div",{"data-testid":"status-card-pending","data-count":h,style:{border:"1px solid #64748b",borderRadius:"6px",padding:"10px",backgroundColor:"#f8fafc"},children:[W("div",{style:{fontSize:"12px",color:"#334155"},children:"\u5F85\u6A5F\u4E2D (PENDING)"}),W("div",{"data-testid":"pending-count",style:{fontSize:"20px",fontWeight:700,color:"#475569"},children:h})]}),ke("div",{"data-testid":"status-card-failed","data-count":R,style:{border:"1px solid #ef4444",borderRadius:"6px",padding:"10px",backgroundColor:"#fef2f2"},children:[W("div",{style:{fontSize:"12px",color:"#991b1b"},children:"\u5931\u6557 (FAILED)"}),W("div",{"data-testid":"failed-count",style:{fontSize:"20px",fontWeight:700,color:"#b91c1c"},children:R})]})]}),ke("div",{"data-testid":"failed-items-section",children:[ke("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",u!==void 0?"":` (${a.length<R?`\u4E0A\u4F4D ${a.length} \u4EF6 / \u5168 ${R} \u4EF6`:`${a.length} \u4EF6`})`]}),u!==void 0?W(vt,{tone:"warning",testId:"failed-items-refused",children:u}):a.length===0?W("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"}):W("div",{style:{overflowX:"auto"},children:ke("table",{"data-testid":"failed-items-table",style:{width:"100%",borderCollapse:"collapse",fontSize:"13px"},children:[W("thead",{children:ke("tr",{style:{borderBottom:"1px solid #e2e8f0",textAlign:"left",color:"#64748b"},children:[W("th",{style:{padding:"6px 8px"},children:"\u30D5\u30A1\u30A4\u30EB URI"}),W("th",{style:{padding:"6px 8px"},children:"\u72B6\u614B"}),W("th",{style:{padding:"6px 8px"},children:"\u30A8\u30E9\u30FC\u5185\u5BB9"}),W("th",{style:{padding:"6px 8px"},children:"\u5931\u6557\u65E5\u6642"}),W("th",{style:{padding:"6px 8px",textAlign:"right"},children:"\u64CD\u4F5C"})]})}),W("tbody",{children:a.map((C,$)=>{if(C.kind==="restricted")return ke("tr",{"data-testid":`failed-item-restricted-${$}`,"data-restricted-mark":"failure",children:[W("td",{"data-testid":`failed-item-restricted-text-${$}`,style:{padding:"8px"},children:ht}),W("td",{style:{padding:"8px"},children:W("span",{"data-testid":`failed-item-restricted-status-${$}`,style:{fontSize:"11px"},children:C.syncStatus})}),W("td",{style:{padding:"8px"}}),W("td",{"data-testid":`failed-item-restricted-time-${$}`,style:{padding:"8px",whiteSpace:"nowrap"},children:C.failedAt===null?"\u8A18\u9332\u306A\u3057":W(ge,{iso:C.failedAt,testId:`failed-item-restricted-time-value-${$}`})}),W("td",{style:{padding:"8px"}})]},`restricted:${$}`);let m=C.item;return ke("tr",{"data-testid":`failed-item-row-${m.id}`,"data-file-uri":m.file_uri,style:{borderBottom:"1px solid #f1f5f9"},children:[ke("td",{"data-testid":`failed-item-uri-${m.id}`,style:{padding:"8px",wordBreak:"break-all"},children:[W("div",{style:{fontWeight:600,color:"#0f172a"},children:m.file_name}),W("div",{style:{fontSize:"11px",color:"#64748b"},children:m.file_uri})]}),W("td",{style:{padding:"8px"},children:W("span",{"data-testid":`failed-item-status-${m.id}`,style:{fontSize:"11px",padding:"2px 6px",borderRadius:"4px",backgroundColor:"#fee2e2",color:"#991b1b",fontWeight:500},children:m.sync_status})}),W("td",{"data-testid":`failed-item-error-${m.id}`,style:{padding:"8px",color:"#dc2626",maxWidth:"260px",wordBreak:"break-word"},title:m.error_message??"",children:m.error_message??"\u4E0D\u660E\u306A\u30A8\u30E9\u30FC"}),W("td",{"data-testid":`failed-item-time-${m.id}`,style:{padding:"8px",color:"#64748b",whiteSpace:"nowrap"},children:m.failed_at===null?"\u8A18\u9332\u306A\u3057":W(ge,{iso:m.failed_at,testId:`failed-item-time-value-${m.id}`})}),W("td",{style:{padding:"8px",textAlign:"right"},children:r&&W("button",{type:"button","data-testid":`retry-item-button-${m.id}`,"aria-label":`${m.file_name} (${m.file_uri}) \u3092\u518D\u8A66\u884C`,disabled:s,onClick:()=>r(m.id,m.file_uri),style:{padding:"4px 8px",borderRadius:"4px",border:"1px solid #dc2626",backgroundColor:"#ffffff",color:"#dc2626",cursor:s?"not-allowed":"pointer",fontSize:"12px"},children:"\u518D\u8A66\u884C"})})]},`readable:${m.id}`)})})]})})]})]})}export{Qa as CHUNKING_ONLY_NOTE,Xa as CHUNK_BODY_FIDELITY_LABELS,pa as CHUNK_CHANGE_KIND_LABELS,Bo as CHUNK_SOURCE_LABELS,xt as DOCUMENT_STATE_CAUSE_LABELS,ja as DegradedSearchBanner,Vi as DocumentChangeFeed,Fd as DocumentHistoryInspector,Zd as DocumentIngestConsole,nl as EnrichmentStrategyBoard,dt as FACET_LABELS,tn as FAILED_RUN_STATE_MARK,qt as FIELD_LABELS,bt as FLOW_FOCUS_RING,Ao as FLOW_GEOMETRY,_t as FLOW_NODE_TEXT,St as FinishedInstant,ws as GATE_POLICY_LABELS,ks as GATE_STATE_PRESENTATION,at as HISTORY_REFUSAL,ul as InfrastructureHealthMonitor,an as MODEL_ONLY_CHANGE_MARK,yl as MetadataSearchWorkbench,Sl as ModelComparisonWorkbench,br as NOTHING_TO_READ_LABELS,po as NO_ENRICHMENT_RECORD_TEXT,en as NO_PREVIOUS_RECORD_TEXT,Il as OntologyStatusCard,Ss as PHASE_LABELS,Qe as PIPELINE_RUN_STATUS_PRESENTATION,Na as PIPELINE_STEP_STATUS_PRESENTATION,Sa as PIPELINE_TRIGGER_LABELS,Ml as PipelineFlowViewer,Wl as QdrantStorageCard,Fs as REASON_LABELS,ht as RESTRICTED_DOCUMENT_TEXT,Vt as RESTRICTED_RUN_TEXT,Za as RESTRICTED_STATE_TEXT,gr as RUN_TERMINAL_STEP_LABEL,Rn as RUN_TERMINAL_STEP_OUTCOME_LABELS,ge as RecordedInstant,xs as SCORE_DISPLAY_DECIMALS,gs as SEARCH_MODE_LABELS,wo as SEARCH_PRESETS,Ql as SyncStatusMonitor,In as UNFINISHED_LABEL,ma as UNRECORDED_RUN_MARK,Ja as UNVERIFIED_CHUNK_NOTE,Ya as WHITESPACE_NORMALIZED_NOTE,Wt as facetCountsText,Pt as fieldLabel,ys as formatComparisonScore,Wo as gateCaption,Cs as gateState,is as gateStateOf,nt as historyFailedSentence,zt as historyFailureSentence,go as ingestRowAction,lt as jsonValueText,vs as layoutFlow,Ea as ledgerStepLabel,rt as pipelineRunPresentationKey,_o as rankAgreement,qe as revisionLabel,fa as revisionTransitionText,kn as skipReasonLabel,Es as stepGatePolicy,Vo as stepGateState,nn as unrecordedRunsMark};
|